Commit Graph

34 Commits (main)

Author SHA1 Message Date
lyingbug 234aa948db
docs(swagger): document the real request and response types (#4304)
* docs(swagger): add shared response envelope types

* docs(swagger): type knowledge base responses

* docs(swagger): add concrete response body types

* docs(swagger): type chunk list responses

* docs(swagger): type knowledge mutation responses

* docs(swagger): type wiki search and autofix responses

* docs(swagger): type FAQ responses

* docs(swagger): type tag responses

* docs(swagger): type message responses and SSE schemas

* docs(swagger): type agent responses

* docs(swagger): type remaining handler responses

* docs(swagger): regenerate OpenAPI spec

* docs(swagger): type knowledge, activity and wiki maintenance endpoints

Covers the endpoints left out of the earlier passes: knowledge base
detail, document list/detail/spans/reparse/cancel/delete, knowledge
base activity and the Wiki stats, issues, lint and rebuild-links
endpoints. The spans handler now writes the documented structs instead
of gin.H, so the schema cannot drift from the body; the JSON is
unchanged. List filters gain their real enums and bounds, including
the finalizing, cancelled and deleting parse states.

* docs(swagger): document JSON-valued fields as JSON, not byte arrays

types.JSON and json.RawMessage are byte slices, so swag rendered every
metadata, details and config field as an array of integers. A swag
overrides file documents them as objects; the four fields that hold
arrays (relation chunk ids, allowed origins, image refs) say so with a
swaggertype tag.

* chore(lint): exempt swag annotation lines from the line-length limit

swag reads each @Param, @Success and @Failure as a single line, so an
enum list or a composed response type cannot be wrapped to fit.

* chore(lint): exempt struct tags carrying swag attributes from the line limit

Struct tags cannot wrap either; a field documented with swaggertype or
extensions keeps its tags on the declaration line.
2026-10-15 01:41:42 +08:00
VictorMaznyuk 3206e15e83
fix(docs): make `make docs` reproduce the committed Swagger again (#3751)
Running `make docs` on main no longer reproduces the committed docs/*:
every definition loses its package-qualified name (types.* instead of
github_com_Tencent_WeKnora_internal_types.*), enums disappear, ErrorCode
becomes a plain integer, and docs/swagger_contract_test.go fails
(TestModelDeleteUsageContract).

Cause: internal/localsandbox is not a dependency of cmd/server (its
importers are behind the `desktop` build tag), but swag's directory walk
reaches it. Its `const X = core.X` aliases make swag load
internal/localsandbox/core again through go/loader, and that second load
re-registers every already-deduplicated type under its short name without
enum values. Excluding the directory removes the second load.

That load was also hiding a second problem: skill_handler.go references
errors.AppError in @Failure without importing internal/errors, so with the
exclude swag stops with "cannot find type definition: errors.AppError".
A blank import lets swag resolve it.

Co-authored-by: Victor Maznyuk <victor@maznyuk.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 01:26:08 +08:00
lyingbug e179f44445
refactor(models): separate provider definitions, model catalogs, and runtime configuration (#3589)
* refactor(models): separate providers, catalog and runtime configuration

* refactor(models): isolate provider definitions and runtime catalogs

* docs: exclude refactoring analysis notes from the pull request
2026-09-23 14:20:08 +08:00
lyingbug 4a9aa06274
refactor(asr): move the wire format into protocol packages, and cover every vendor whose docs offer ASR (#3503) 2026-09-21 13:25:27 +08:00
lyingbug 9030f556f2
refactor(embedding): move the wire formats into protocol packages, and correct the vendor facts (#3500) 2026-09-21 11:55:38 +08:00
lyingbug c40a9dd194
refactor(models): rebuild vendor integration on protocol + catalog + vendor layers (#3470)
把集中式的 OpenAI 方言客户端重建为三层:协议层 internal/models/api/<protocol>(OpenAI Chat Completions / OpenAI Responses / Anthropic Messages / Google GenAI),目录层 internal/models/catalog,厂商层 internal/models/vendors/<id>(27 家,go:embed)。27 家厂商逐条对照官方文档核验,厂商事实以数据声明,协议层不出现厂商名。

既有行的运行时行为会变的四处:
1. extra_config.api 变为保留的协议选择器,非法取值被拒绝;
2. Azure 未填 api_version 的行改走 /openai/v1 GA 数据面;
3. api.openai.com 的一方流量改走 Responses 协议(中转/网关不受影响);
4. 7 家厂商的输出上限字段按文档纠正。

不需要数据库迁移。详见 PR 描述与 website-docs/03-features/06-models.md。
2026-09-20 21:28:23 +08:00
HUANG Cheng 6a55860431
feat(ui): multi-stage Docker frontend build (no host npm) (#3074)
* feat(ui): multi-stage Docker build without host npm

Build frontend assets inside the image with node:24-bookworm, then
copy into the existing digest-pinned nginx runtime so docker compose
and CI no longer require a host-side dist step.

* fix(ui): copy local xlsx package and raise Node heap in Docker build

npm ci needs packages/xlsx before install, and vite OOM'd under the
default Node heap during the multi-stage image build.

* fix(ui): native multi-arch frontend Docker build and layer cache

Keep Vite on BUILDPLATFORM so CI does not qemu-emulate Node, pin the
builder image, and move the commit ARG after npm ci so dependency
layers stay cacheable.

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-07 19:33:57 +08:00
wizardchen 9b4f792a04 fix(docker): 默认在 app 镜像中链接 anydoc 解析引擎
Hub / compose 打包的二进制此前走 stub,设置页会显示引擎未编入。WITH_ANYDOC 改为默认开启,并补上 builder 所需的 curl。
2026-08-16 13:31:51 +08:00
wizardchen e123f8247e feat(docparser): 引入 anydoc 引擎,在 Go 进程内解析 office 文档
通过 cgo 链接 anydoc Rust 静态库,把 docx/pptx/xlsx 等转为带原位图片的 Markdown;扫描版 PDF 无文字层时回落到 DocReader OCR。默认构建不链接该库。

Co-authored-by: lyingbug <lyingbug@users.noreply.github.com>
2026-08-16 11:37:27 +08:00
wizardchen 1c31d649a7 feat(docker): streamline frontend build process and update Docker configuration
- Added a new script `build_frontend_dist.sh` to handle the building of frontend static assets.
- Updated `docker-compose.yml` to include a note about running the build script before building the frontend service.
- Modified the GitHub Actions workflow to integrate the new build script for frontend assets.
- Adjusted the Dockerfile to copy built assets directly from the `dist` directory.
- Refined the `.dockerignore` to exclude unnecessary files while keeping the `dist` directory.
2026-06-10 16:04:11 +08:00
wizardchen ef1047bf67 feat(parser): add OpenDataLoader, PaddleOCR-VL engines, and parser improvements
Introduce opendataloader and PaddleOCR-VL parser engines with tenant-level
settings UI, replace liteparse, and harden Excel/PPT/Markdown parsing.
Optional odl-hybrid sidecar stays local-build only and is excluded from
default dev-start and full profiles.
2026-06-03 12:29:13 +08:00
wizardchen ea47dce337 fix(compose): use env_file array form for builtin_models compatibility
PR #1453 introduced the map form of env_file:

  env_file:
    - path: .env
      required: false

which is only recognised by Docker Compose v2.24+ (Jan 2024). Older
deploys would refuse to parse docker-compose.yml even when builtin_models
YAML is not enabled — breaking the "no impact unless opted in" promise.

Switch to the array form (`env_file: [.env]`) which has been supported
since the earliest Compose schemas. The trade-off is that Compose now
errors when .env is absent, so:

- scripts/start_all.sh already calls check_env_file (cp .env.example .env
  if missing) before docker compose up; that path is unaffected.
- The bare `make docker-run` / `make docker-restart` targets in the
  Makefile are taught the same fallback: touch / copy .env.example before
  invoking docker-compose, so fresh clones keep working.

The docker-compose.yml comment block is updated to explain the version
trade-off so future maintainers don't re-introduce the map form.
2026-05-26 11:37:03 +08:00
swim2sun d2c6814f22 fix: SQLite/Lite mode compatibility for FAQ import and chunk operations
Multiple fixes for WeKnora Lite mode (SQLite, no Redis):

1. Redis nil pointer panic on FAQ import (knowledge.go)
   - Add in-memory fallback (sync.Map) for FAQ import progress tracking
   - Add nil guards for running task locks and progress queries

2. seq_id not auto-incrementing in SQLite (chunk.go, tag.go)
   - GORM autoIncrement on non-PK columns doesn't work in SQLite
   - Add AssignChunkSeqIDs() to pre-assign seq_ids before batch insert
   - Add BeforeCreate hook for KnowledgeTag
   - Use Unscoped() to include soft-deleted records in MAX(seq_id) query

3. NOW() function not available in SQLite (chunk.go)
   - Replace raw SQL NOW() with time.Now() or datetime('now')
   - Use dialector check for raw SQL that must differ between PG and SQLite

4. FAQ KB should reject file uploads (knowledge.go)
   - Add kb.Type == "faq" check in CreateKnowledgeFromFile

5. Linux/macOS build compatibility (Makefile)
   - Conditionally apply macOS-only linker flag based on uname

6. Add SQLite integration tests (chunk_sqlite_test.go)
   - TestCreateChunks_SQLite_SeqIDAutoAssigned
   - TestCreateChunks_SQLite_SeqIDContinuesFromExisting
   - TestCreateChunks_SQLite_SeqIDUniqueAcrossKBs
   - TestCreateChunks_SQLite_SeqIDAfterSoftDelete
   - TestKnowledgeTag_SQLite_SeqIDAutoAssigned
   - TestUpdateChunk_SQLite_NoNOWError

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 20:37:10 +08:00
wizardchen 96fb36ebb3 feat: introduce macOS desktop app using Wails wrapper 2026-04-11 18:51:16 +08:00
wizardchen d005bd1db8 Revert "chore: make Lite edition support and related configurations hidden"
This reverts commit 88d5b303b8.
2026-04-11 18:51:16 +08:00
wizardchen 88d5b303b8 chore: make Lite edition support and related configurations hidden 2026-03-02 21:21:49 +08:00
wizardchen 2a5cf57589 fix: improve Makefile and duckdb.go for better environment handling
- Updated the Makefile to export the EDITION variable for the lite build process, ensuring proper environment setup.
- Added a defer statement in duckdb.go to ensure the SQL database connection is closed after use, improving resource management.

These changes enhance the build process and resource handling in the application.
2026-03-02 21:21:49 +08:00
wizardchen 397689d2f3 feat: introduce WeKnora Lite edition with lightweight configuration and deployment
- Added a new `.env.lite.example` file for the Lite version, providing a minimal configuration template.
- Updated `.env.example` to remove deprecated variables and include new Docreader settings.
- Enhanced Docker configurations to support the Lite version, including a new Dockerfile for the Docreader service.
- Introduced a Makefile target for building and running the Lite version, along with packaging capabilities.
- Created GitHub workflows for building and releasing Lite binaries, including Homebrew formula support.
- Implemented a new service file for managing the Lite version as a system service.

This update enables a streamlined, single-binary deployment of WeKnora, reducing external dependencies and simplifying setup.
2026-03-02 21:21:49 +08:00
joeyczheng 1b56e99cac feat: support milvus vectordb for knowledge retrieve
Signed-off-by: joeyczheng <joeyczheng@tencent.com>
2026-02-27 09:51:17 +08:00
wizardchen c805334cf5 fix: prioritize env variable over git tag in version 2026-01-27 18:01:12 +08:00
wizardchen b71e7084fd feat: 将未分类FAQ条目转为"未分类"标签 2026-01-07 11:08:59 +08:00
begoniezhao 1b0edccfc4 feat: add download_spatial target and DuckDB spatial extension handling 2026-01-05 15:01:50 +08:00
wizardchen a7df6900eb feat: 完善Swagger API文档生成功能 2025-12-17 22:04:18 +08:00
wizardchen 77b6133e2a feat: Add MCP services support and enhance migration scripts
- Introduced new MCP services functionality, including management routes and integration with the agent service.
- Updated Docker Compose configuration to include a new SQL migration for MCP services.
- Enhanced Makefile with new migration commands for versioning and creating migrations.
- Improved chat component to handle selected MCP services in message processing.
- Updated migration documentation to reflect new strategies and added MCP services migration files.
2025-11-09 03:27:24 +08:00
wizardchen d387fd672f chore: Update .gitignore and Makefile for development enhancements
- Added 'logs/' and '*.pid' to .gitignore to exclude log files and process ID files from version control.
- Expanded Makefile with new development commands for easier local environment management, including 'dev-start', 'dev-stop', 'dev-restart', 'dev-logs', 'dev-status', 'dev-app', and 'dev-frontend'.
- Updated README_CN.md to include instructions for the new development mode and commands for improved developer experience.
2025-11-07 15:52:52 +08:00
begoniezhao d734b80cb5 chore(build): Optimize Makefile and Dockerfile.app build configuration 2025-09-18 14:46:10 +08:00
wizardchen 41ea7b64a6 fix(frontend): Fix Login Direct Page 2025-09-17 20:29:34 +08:00
wizardchen 98e47e83d2 feat(ui): Support multi knowledgebases operation 2025-09-17 16:02:08 +08:00
wizardchen 78088057fb fix: frontend depends app health 2025-09-11 14:22:29 +08:00
wizardchen 7cfae7e0d3 fix: pre fetch ocr models in docker container 2025-09-10 17:24:26 +08:00
wizardchen 19d2493afc fix: make file docker build not work 2025-09-10 15:13:12 +08:00
wizardchen 1eed11fc4f fix: ignore non-utf8 words when saving to db 2025-08-21 19:53:54 +08:00
wizardchen 8b43931886 feat: support minio storage 2025-08-14 12:16:08 +08:00
wizardchen 56eb2bce33 init commit 2025-08-05 15:08:07 +08:00