diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d40d639..75e45754 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,93 @@ All notable changes to this project will be documented in this file. +## [0.6.1] - 2026-06-05 + +### New Features + +- **NEW**: **Document Parsing Trace Timeline** — the headline of this release. Every document now records a Langfuse-style span tree (`knowledge_processing_spans`) so you can watch parsing progress stage-by-stage in real time. Highlights: + - **Waterfall timeline UI** redesigned as a Langfuse-style side drawer with attempt tabs, resizable width persisted to local storage, and a header "Trace" pill; reachable directly from the card menu. + - **Per-stage instrumentation**: a new `/stages` API tracks each parsing stage; postprocess subspans, per-image multimodal subspans, and synthesized-stage status (inferred from `parse_status`) are surfaced; root span closes on terminal state with enriched stage metadata. + - **Stop-parse control**: cancel an in-flight parse from the timeline panel; cancellation moves the document into a "finalizing" post-process state with a reliable finalizing-subtask counter (drains on all terminal exits) and async question fan-out. + - **Reliability**: documents no longer get stuck in "processing"; housekeeping is protected from false-killing long-running stages; polling switched to `setInterval` + watchdog with attempt tracking and surfaced silent failures. +- **NEW**: **OpenSearch vector store driver** — a full new retrieval backend, landed across three PRs (interface skeleton → read/write paths → activated k-NN driver), with bulk update, by-query delete, copy, health-check, SSRF-aware transport, and an integration-test guide (`docs/dev/opensearch-integration-test.md`). +- **NEW**: **Declarative built-in models via YAML** — `config/builtin_models.yaml` drives the platform's built-in model catalog with `${ENV}` interpolation, a `managed_by` column, lifecycle reconciliation, and a drift sweep that keeps the DB in sync with the YAML. Entries are schema-validated and ID lengths aligned with the DB. See `config/builtin_models.yaml.example`. +- **NEW**: **System Admin & Platform Settings** — system-admin bootstrap/promotion with revocation safeguards, a consolidated single Settings panel merging system admin and settings, a platform audit log with polished audit drawers, and server-side system settings management. +- **NEW**: **New-User Onboarding Guide** — an interactive spotlight/tour (`NewUserGuide`) with contextual guides for agent and knowledge-base creation, tenant-model-readiness hints, login hints for new users, and an improved backdrop/hole calculation, integrated into the user menu. +- **NEW**: **Settings UI redesign** — model cards with type badges, redesigned vector-store / parser / storage-engine cards, redesigned web-search / MCP provider cards, brand logos replacing monogram badges, regrouped sidebar nav with a header pinned on scroll, and vector-store test moved into the card menu with a toast result. +- **NEW**: **`weknora` CLI v0.7 / v0.8** (BREAKING) — agent-first wire contract and command-surface cleanup: + - **Command-surface rename**: `session ask`, `session continue-stream`, `doc fetch`, `doc create`, `doc delete --all`; `context` CRUD replaced by a `profile` cascade (`context` → `profile`); `agent invoke` / `kb empty` removed. + - **`--format json` is now the default** with an NDJSON event stream (one JSON event per line) and symmetric envelope infrastructure. + - **Agent safety nets**: `--dry-run` with risk metadata and validation parity across 19 mutations; `MCP Tool.Annotations` added to 10 tools (spec 2025-06-18). +- **NEW**: **Parser engine expansion** — OpenDataLoader and PaddleOCR-VL (cloud + local) engines join the doc-reader; scanned-PDF parsing sped up with streamed image results and isolated heavy async queues; dedicated Excel/PPT converters, PPTX media extraction, and Markdown-table normalization; a hybrid OpenDataLoader Docker image (`docker/Dockerfile.odl-hybrid`); reorganized Markdown parser with enhanced gRPC document reading. +- **NEW**: **MCP server multi-transport** — the Python MCP server now supports stdio / SSE / HTTP transports and exposes read-only wiki tools; the MCP service is optional via the `full` Docker profile. +- **NEW**: **Thinking-mode configuration in the model editor** — per-model thinking-mode controls (`thinkingControl`) plus improved `` tag handling in chat messages and an agent `think_stream` tool; the chat provider was modularized (request / stream / transport / usage / thinking split out). +- **NEW**: **More models & providers** — Milvus database selection for vector stores; Tencent Cloud LKEAP Rerank; native Gemini embeddings; MiniMax-M3 in the provider model list; a local image resolver for multimodal chat. +- **NEW**: **Cached prompt tokens** surfaced from upstream usage, with clarified cached-token semantics for explicit-cache providers. +- **NEW**: **KB experience** — a `KBSwitcherDropdown` for fast KB selection, a consolidated `KBInfoPopover` (reused on FAQ KBs with correct document/FAQ counts), multi-KB search retrieval parameters, and KB ↔ vector-store binding surfaced in the list, editor, and detail UI (with a `VectorStoreBadge`). +- **NEW**: **Multi-use share-link invitations** for `invite_only` mode (RBAC), with register-by-invite and a tenant invite-link flow. +- **NEW**: **FAQ enhancements** — improved FAQ handling/localization plus a `faq_snippet` agent tool. +- **NEW**: **"View in Graph"** entry on wiki pages. +- **NEW**: **Server startup time & uptime tracking** exposed via a new runtime server module. +- **NEW**: **Chat request-info / debug button** — inspect the debug payload for stream requests from the chat toolbar. +- **NEW**: **`LOG_FORMAT` template** support with hardened level coloring. +- **NEW**: **Windows build support for the sandbox** — Linux remains the default implementation; Windows now compiles via a dedicated stub. +- **NEW**: **`display_name` column on models** and an expanded `knowledge.source` column length. + +### Improvements + +- **IMPROVED**: Retrieval — Elasticsearch search responses exclude the embedding field to reduce payload size; rerank pipeline falls back to raw retrieval results when the rerank API fails; OpenSearch type prep added ahead of the driver. +- **IMPROVED**: Qdrant — optimized batch save, map iteration, and error wrapping. +- **IMPROVED**: Knowledge — chunks stitched by text overlap instead of position; image caption/OCR text preserved in document summaries; single-item delete routed through the async pipeline with list polling after delete; stale knowledge records avoided on upload failure. +- **IMPROVED**: Chat — model-selection handling refined; in-progress messages stay reactive so continue-stream renders; user multi-line query formatting preserved; user message container supports pre-wrapped text. +- **IMPROVED**: Agent — event routing for reasoning vs. answers in streaming; content filtering in streaming events; intent-prompt customization in the agent editor (whitespace preserved); deterministic ordering of function definitions; `final_answer` tool references removed. +- **IMPROVED**: Configuration — asynq concurrency settings tuned; env-file array form used for `builtin_models` compatibility. +- **IMPROVED**: Frontend — floating-UI / agent-selector positioning corrected under root `zoom`; settings cards' interactions and accessibility polished; `X-Tenant-ID` override preserved when switching back to home. +- **IMPROVED**: Multimodal — embedding input image-payload safety hardened; image payload sanitization in the hybrid indexer. + +### Bug Fixes + +- **FIXED**: Schema — expanded knowledge-source length to avoid truncation. +- **FIXED**: Knowledge — reject `reuse_vectors` knowledge moves across stores; deep-copy stored files and images when cloning a KB; guard the knowledge list against stale updates. +- **FIXED**: Handler — `/knowledge/search` accepts `?query=` and rejects empty keywords; multiple Swagger endpoints that returned 404 fixed and docs regenerated. +- **FIXED**: Datasource — sync fails when all fetched items fail; Feishu wiki node parents preserved and Feishu connector capabilities aligned; slower datasource resource listing allowed; credential validation skipped when editing a data source; Yuque team token supported. +- **FIXED**: Session — user-requested stop events handled gracefully in QA execution; stop watcher gains a timeout; agent system prompt preserved for greetings (reverted, then refined). +- **FIXED**: IM — synthetic identity injected so IM channels can use shared KBs; recover from deleted session when `GetSession` returns the app sentinel; presigned-URL flow made diagnosable end-to-end. +- **FIXED**: Security — throttling for protected file-fetch retries; vector-store connection addresses validated against SSRF policy; tenant validation for file access; tenant default storage-provider handling on KB creation. +- **FIXED**: Repository — `tenant_id` qualified with the table name to resolve an ambiguous-column error; built-in models query syntax corrected. +- **FIXED**: Multi-turn — `multi-turn-disabled` flag respected in the KnowledgeQA pipeline. +- **FIXED**: Doris — `LIMIT`/`OFFSET` inlined as literals with parameter interpolation enabled. +- **FIXED**: Doc parsing — DOC→DOCX conversion reliability improved; MinerU markdown and relative images preserved. +- **FIXED**: Frontend — `{size}` param passed to the `fileSizeExceeded` i18n message on Nginx 413; wrong toast when selecting built-in agents other than quick-answer / smart-reasoning; default context template applied when switching to quick-answer mode; card popover closed before opening the delete-confirm dialog. +- **FIXED**: Embedding — native Gemini embeddings supported. +- **FIXED**: Events — panic recovery added to async goroutines. +- **FIXED**: Milvus — skip empty enabled-status groups. +- **FIXED**: Agent — tool-parameter parsing hardened against LLM type mismatches. +- **FIXED**: Container — `resetPendingTasks` startup SQL corrected. + +### Refactoring + +- **REFACTOR**: Chat provider modularized into request / stream / transport / usage / thinking / stream-emit files; legacy `chat_provider_spec` removed. +- **REFACTOR**: Logger — `LOG_FORMAT` template support with hardened level coloring. +- **REFACTOR**: Migrations — deprecated user-system-admin migration files removed; system-settings migration introduced. +- **REFACTOR**: Knowledge — flat stage table replaced with a Langfuse-style span tree; cancel-parse flow and user-confirmation dialogs streamlined; terminology clarified across parsing docs and UI. +- **REFACTOR**: CLI — symmetric envelope infrastructure; envelope sweep (Emit shape, batch ops, MCP `StructuredContent`); context→profile cascade with post-review hardening. +- **REFACTOR**: Settings — system-settings management and UI consolidated; provider/vector-store card chrome tightened. +- **REFACTOR**: Chunk — removed the unused `VideoInfo` field from the `Chunk` struct. + +### Infrastructure & Build + +- **BUILD**: New migrations `000052`–`000058` — `models.managed_by`, system admin & settings, invitation tokens, `knowledge_processing_spans`, knowledge pending subtasks, `models.display_name`, and expanded knowledge source. +- **BUILD**: `opensearch-go` v4.6.0 added; `github.com/mattn/go-runewidth` bumped. +- **BUILD**: Dedicated `mcp-server/Dockerfile`; MCP service gated behind the `full` Docker profile. + +### Documentation + +- **DOC**: New `docs/日志配置.md` (logging configuration guide). +- **DOC**: OpenSearch integration-test guide (`docs/dev/opensearch-integration-test.md`). +- **DOC**: CLI — `AGENTS.md`, `README.md`, and `CHANGELOG.md` brought in sync with the v0.7 / v0.8 surface. +- **DOC**: Clarified cached-token semantics for explicit-cache providers in chat docs. + ## [0.6.0] - 2026-05-21 ### New Features diff --git a/README.md b/README.md index 4a2c26f9..4d0dbccb 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ License - Version + Version

@@ -57,6 +57,7 @@ The framework supports auto-syncing knowledge from Feishu, Notion, and Yuque (mo ## ✨ Latest Updates +- **v0.6.1** — Document parsing trace timeline (Langfuse-style span tree with stage-by-stage progress + stop-parse); OpenSearch vector store driver; declarative built-in models via YAML; system admin & consolidated platform settings + audit log; new-user onboarding guide; settings UI redesign; `weknora` CLI v0.7 / v0.8 (agent-first wire contract, NDJSON, `--dry-run`); OpenDataLoader + PaddleOCR-VL parsers; MCP server multi-transport (stdio / SSE / HTTP); per-model thinking-mode config; Tencent LKEAP rerank + native Gemini embeddings + MiniMax-M3. See [`CHANGELOG.md`](./CHANGELOG.md). - **v0.6.0** — Tenant RBAC (4-tier role matrix `Owner` / `Admin` / `Contributor` / `Viewer` + per-KB ownership + per-tenant audit log), tenant member management & multi-workspace UX, self-service workspaces; `weknora` CLI v0.4 GA with `mcp serve`; KB retrieval fan-out across vector stores; AES-256-GCM credential encryption + docreader gRPC TLS + Token; Zhipu embedder + Huawei OBS; server-side user preferences; Go 1.26.0. See [`docs/RBAC说明.md`](./docs/RBAC说明.md) and [`CHANGELOG.md`](./CHANGELOG.md). - **v0.5.2** — Wiki ingest scales to 40k-document KBs (task queue + DLQ); MCP human-in-the-loop tool approval; Anthropic / Apache Doris / Tencent VectorDB / KS3 / SearXNG backends; adaptive 3-tier chunking with live preview; global ⌘K command palette; Yuque connector + WeChat Mini Program; `weknora` CLI preview. - **v0.5.1** — Knowledge-base batch management; tenant-wide IM channels overview; session search + user-scoped pinning; unified Model / Web Search / MCP settings cards; per-agent LLM timeout; desktop tenant switching. @@ -125,7 +126,7 @@ Fully modular pipeline from document parsing, vectorization, and retrieval to LL |------------|---------| | LLMs | OpenAI / Azure OpenAI / Anthropic (Claude) / DeepSeek / Qwen (Alibaba Cloud) / Zhipu / Hunyuan / Doubao (Volcengine) / Gemini / MiniMax / NVIDIA / Novita AI / SiliconFlow / OpenRouter / Ollama | | Embeddings | Ollama / BGE / GTE / Zhipu / OpenAI-compatible APIs | -| Vector DBs | PostgreSQL (pgvector) / Elasticsearch / Milvus / Weaviate / Qdrant / Apache Doris / Tencent VectorDB | +| Vector DBs | PostgreSQL (pgvector) / Elasticsearch / OpenSearch / Milvus / Weaviate / Qdrant / Apache Doris / Tencent VectorDB | | Object Storage | Local / MinIO / AWS S3 / Volcengine TOS / Alibaba Cloud OSS / Kingsoft Cloud KS3 / Huawei Cloud OBS | | IM Channels | WeCom / Feishu / Slack / Telegram / DingTalk / Mattermost / WeChat | | Web Search | DuckDuckGo / Bing / Google / Tavily / Baidu / Ollama / SearXNG | @@ -138,9 +139,9 @@ Fully modular pipeline from document parsing, vectorization, and retrieval to LL | UI | Web UI / RESTful API / CLI (`weknora`) / Chrome Extension / WeChat Mini Program | | Access Control | Tenant RBAC with 4-tier role matrix (Owner / Admin / Contributor / Viewer), per-KB resource ownership, per-tenant audit log, invite-only workspaces, self-service tenant creation, cross-tenant superuser | | Security | AES-256-GCM at-rest encryption for API keys and MCP / data-source credentials with graceful key rotation; gRPC TLS + Token between app and docreader; SSRF-safe HTTP client; sandbox isolation for agent skills | -| Observability | Integrated Langfuse for ReAct loops, token tracking, tool calls, and pipeline tracing | +| Observability | Integrated Langfuse for ReAct loops, token tracking, tool calls, and pipeline tracing; built-in Langfuse-style document parsing trace timeline with stage-by-stage progress | | Task Management | MQ async tasks, automatic database migration on version upgrade | -| Model Management | Centralized config, per-knowledge-base model selection, multi-tenant built-in model sharing, WeKnora Cloud hosted models and parsing | +| Model Management | Centralized config, declarative built-in models via YAML, per-knowledge-base model selection, per-model thinking-mode config, multi-tenant built-in model sharing, WeKnora Cloud hosted models and parsing | ## 🧩 Chrome Extension diff --git a/README_CN.md b/README_CN.md index bf93bf9d..368e279f 100644 --- a/README_CN.md +++ b/README_CN.md @@ -28,7 +28,7 @@ License - 版本 + 版本

@@ -56,6 +56,7 @@ ## ✨ 最新更新 +- **v0.6.1** —— 文档解析追踪时间线(Langfuse 风格 Span 树,逐阶段进度展示 + 解析中止);OpenSearch 向量库驱动;YAML 声明式内置模型配置;系统管理员与统一平台设置 + 审计日志;新用户引导;设置页 UI 重构;`weknora` CLI v0.7 / v0.8(Agent 优先线协议、NDJSON、`--dry-run`);OpenDataLoader 与 PaddleOCR-VL 解析引擎;MCP Server 多传输(stdio / SSE / HTTP);按模型的思考模式配置;腾讯云 LKEAP 重排 + 原生 Gemini Embedding + MiniMax-M3。详见 [`CHANGELOG.md`](./CHANGELOG.md)。 - **v0.6.0** —— 租户 RBAC(四级角色矩阵 `Owner` / `Admin` / `Contributor` / `Viewer` + 按 KB 归属 + 每租户审计日志)、租户成员管理与多工作区 UX、自助创建工作区;`weknora` CLI v0.4 正式版 + `mcp serve`;KB 检索跨向量库扇出;MCP / 数据源凭据 AES-256-GCM 加密 + docreader gRPC TLS + Token;新增智谱 Embedding 与华为云 OBS;服务端用户偏好;Go 1.26.0。详见 [`docs/RBAC说明.md`](./docs/RBAC说明.md) 与 [`CHANGELOG.md`](./CHANGELOG.md)。 - **v0.5.2** —— Wiki 入库支撑万级文档知识库(任务队列 + 死信队列);MCP 工具人机审批;Anthropic / Apache Doris / 腾讯云 VectorDB / 金山云 KS3 / SearXNG 后端;自适应三层分块 + 实时调试面板;全局 ⌘K 命令面板;语雀连接器 + 微信小程序;`weknora` CLI 早期版本。 - **v0.5.1** —— 知识库批量管理;租户级 IM 频道总览;会话搜索 + 用户级置顶;模型 / 网页搜索 / MCP 统一卡片化设置;按 Agent LLM 调用超时;桌面端租户切换。 @@ -123,7 +124,7 @@ | 能力 | 详情 | |------|------| | 模型厂商 | OpenAI / Azure OpenAI / Anthropic(Claude)/ DeepSeek / Qwen(阿里云)/ 智谱 / 混元 / 豆包(火山引擎)/ Gemini / MiniMax / NVIDIA / Novita AI / SiliconFlow / OpenRouter / Ollama | -| 向量数据库 | PostgreSQL (pgvector) / Elasticsearch / Milvus / Weaviate / Qdrant / Apache Doris / 腾讯云 VectorDB | +| 向量数据库 | PostgreSQL (pgvector) / Elasticsearch / OpenSearch / Milvus / Weaviate / Qdrant / Apache Doris / 腾讯云 VectorDB | | Embedding | Ollama / BGE / GTE / 智谱 / OpenAI 兼容接口 | | 对象存储 | 本地 / 腾讯云COS / 火山引擎 TOS / MinIO / AWS S3 / 阿里云 OSS / 金山云 KS3 / 华为云 OBS | | IM 集成 | 企业微信 / 飞书 / Slack / Telegram / 钉钉 / Mattermost / 微信 | @@ -138,9 +139,9 @@ | 界面 | Web UI / RESTful API / 命令行(`weknora`)/ Chrome Extension / 微信小程序 | | 权限控制 | 租户 RBAC 四级角色矩阵(Owner / Admin / Contributor / Viewer),按知识库的资源归属,每租户审计日志,invite-only 准入,自助创建工作区,跨租户超级管理员 | | 安全 | API Key 与 MCP / 数据源凭据 AES-256-GCM 静态加密、支持平滑密钥轮换;app ↔ docreader gRPC TLS + Token;防 SSRF HTTP 客户端;Agent 技能沙箱隔离 | -| 可观测性 | 集成 Langfuse 以追踪 ReAct 循环、Token 消耗、工具调用和任务流水线 | +| 可观测性 | 集成 Langfuse 以追踪 ReAct 循环、Token 消耗、工具调用和任务流水线;内置 Langfuse 风格的文档解析追踪时间线,逐阶段展示解析进度 | | 任务管理 | MQ 异步任务,版本升级自动数据库迁移 | -| 模型管理 | 集中配置,知识库级别模型选择,多租户共享内置模型,WeKnora Cloud 托管模型与文档解析 | +| 模型管理 | 集中配置,YAML 声明式内置模型配置,知识库级别模型选择,按模型思考模式配置,多租户共享内置模型,WeKnora Cloud 托管模型与文档解析 | ## 🧩 Chrome 插件 diff --git a/README_JA.md b/README_JA.md index f2ce5b61..dc5d5d01 100644 --- a/README_JA.md +++ b/README_JA.md @@ -28,7 +28,7 @@ License - バージョン + バージョン

@@ -56,6 +56,7 @@ Feishu、Notion、Yuqueなどの外部プラットフォームからのナレッ ## ✨ 最新アップデート +- **v0.6.1** — ドキュメント解析トレースタイムライン(Langfuse 風の Span ツリー、ステージごとの進捗表示 + 解析中止);OpenSearch ベクター DB ドライバー;YAML 宣言型ビルトインモデル設定;システム管理者と統合プラットフォーム設定 + 監査ログ;新規ユーザーオンボーディングガイド;設定 UI 刷新;`weknora` CLI v0.7 / v0.8(Agent ファースト ワイヤープロトコル、NDJSON、`--dry-run`);OpenDataLoader と PaddleOCR-VL 解析エンジン;MCP サーバーのマルチトランスポート(stdio / SSE / HTTP);モデル単位の思考モード設定;Tencent LKEAP リランク + ネイティブ Gemini Embedding + MiniMax-M3。詳細は [`CHANGELOG.md`](./CHANGELOG.md) を参照。 - **v0.6.0** — テナント RBAC(4 階層ロールマトリクス `Owner` / `Admin` / `Contributor` / `Viewer` + KB 単位の所有 + テナントごとの監査ログ)、テナントメンバー管理とマルチワークスペース UX、セルフサービスでのワークスペース作成;`weknora` CLI v0.4 GA + `mcp serve`;KB 検索の複数ベクター DB ファンアウト;MCP / データソース資格情報の AES-256-GCM 暗号化 + docreader gRPC TLS + Token;Zhipu Embedder と華為雲 OBS の追加;サーバーサイドユーザー設定;Go 1.26.0。詳細は [`docs/RBAC说明.md`](./docs/RBAC说明.md) と [`CHANGELOG.md`](./CHANGELOG.md) を参照。 - **v0.5.2** — Wiki インジェストが万件規模 KB に対応(タスクキュー + DLQ);MCP 工具人機審批;Anthropic / Apache Doris / Tencent VectorDB / 金山雲 KS3 / SearXNG バックエンド;適応型 3 段階チャンキング + ライブプレビュー;グローバル ⌘K コマンドパレット;Yuque コネクタ + WeChat ミニプログラム;`weknora` CLI プレビュー版。 - **v0.5.1** — KB 一括管理;テナント全体の IM チャネル概観;セッション検索 + ユーザー単位ピン留め;モデル / Web 検索 / MCP 統一カード設定;Agent ごとの LLM タイムアウト;デスクトップ版テナント切替。 @@ -125,7 +126,7 @@ Feishu、Notion、Yuqueなどの外部プラットフォームからのナレッ |------|------| | 大規模モデル | OpenAI / Azure OpenAI / Anthropic (Claude) / DeepSeek / Qwen (Alibaba Cloud) / Zhipu / Hunyuan / Doubao (Volcengine) / Gemini / MiniMax / NVIDIA / Novita AI / SiliconFlow / OpenRouter / Ollama | | Embedding | Ollama / BGE / GTE / OpenAI 互換 API | -| ベクトル DB | PostgreSQL (pgvector) / Elasticsearch / Milvus / Weaviate / Qdrant / Apache Doris / Tencent VectorDB | +| ベクトル DB | PostgreSQL (pgvector) / Elasticsearch / OpenSearch / Milvus / Weaviate / Qdrant / Apache Doris / Tencent VectorDB | | オブジェクトストレージ | ローカル / MinIO / AWS S3 / 火山引擎 TOS / Alibaba Cloud OSS / 金山雲 KS3 | | IM 統合 | WeChat Work / Feishu / Slack / Telegram / DingTalk / Mattermost / WeChat | | Web 検索 | DuckDuckGo / Bing / Google / Tavily / Baidu / Ollama / SearXNG | @@ -136,9 +137,9 @@ Feishu、Notion、Yuqueなどの外部プラットフォームからのナレッ |------|------| | デプロイ | ローカル / Docker / Kubernetes (Helm)、プライベート化・オフラインデプロイ対応 | | UI | Web UI / RESTful API / CLI (`weknora`) / Chrome Extension / WeChat ミニプログラム | -| 可観測性 | ReActループ、トークン消費、ツール呼び出し、パイプライン追跡のためのLangfuse統合 | +| 可観測性 | ReActループ、トークン消費、ツール呼び出し、パイプライン追跡のためのLangfuse統合;Langfuse 風のドキュメント解析トレースタイムラインを内蔵し、ステージごとの進捗を表示 | | タスク管理 | MQ 非同期タスク、バージョンアップ時の DB 自動マイグレーション | -| モデル管理 | 集中設定、ナレッジベース単位のモデル選択、マルチテナント組み込みモデル共有、WeKnora Cloud ホスティングモデルとドキュメント解析 | +| モデル管理 | 集中設定、YAML 宣言型ビルトインモデル設定、ナレッジベース単位のモデル選択、モデル単位の思考モード設定、マルチテナント組み込みモデル共有、WeKnora Cloud ホスティングモデルとドキュメント解析 | ## 🧩 Chrome 拡張機能 diff --git a/README_KO.md b/README_KO.md index 73f65449..69da28d2 100644 --- a/README_KO.md +++ b/README_KO.md @@ -28,7 +28,7 @@ License - 버전 + 버전

@@ -56,6 +56,7 @@ Feishu, Notion, Yuque 등 외부 플랫폼에서 지식 자동 동기화를 지 ## ✨ 최신 업데이트 +- **v0.6.1** — 문서 파싱 추적 타임라인(Langfuse 스타일 Span 트리, 단계별 진행 표시 + 파싱 중단); OpenSearch 벡터 저장소 드라이버; YAML 선언형 내장 모델 구성; 시스템 관리자와 통합 플랫폼 설정 + 감사 로그; 신규 사용자 온보딩 가이드; 설정 UI 리디자인; `weknora` CLI v0.7 / v0.8(Agent 우선 와이어 프로토콜, NDJSON, `--dry-run`); OpenDataLoader 및 PaddleOCR-VL 파싱 엔진; MCP 서버 멀티 트랜스포트(stdio / SSE / HTTP); 모델별 사고 모드 설정; Tencent LKEAP 리랭크 + 네이티브 Gemini 임베딩 + MiniMax-M3. 자세한 내용은 [`CHANGELOG.md`](./CHANGELOG.md) 참고. - **v0.6.0** — 테넌트 RBAC(4단계 역할 매트릭스 `Owner` / `Admin` / `Contributor` / `Viewer` + KB 단위 소유 + 테넌트별 감사 로그), 테넌트 멤버 관리와 멀티 워크스페이스 UX, 셀프 서비스 워크스페이스 생성; `weknora` CLI v0.4 GA + `mcp serve`; 여러 벡터 저장소에 걸친 KB 검색 팬아웃; MCP / 데이터 소스 자격 증명 AES-256-GCM 암호화 + docreader gRPC TLS + Token; Zhipu 임베더와 화웨이 클라우드 OBS 추가; 서버 사이드 사용자 환경설정; Go 1.26.0. 자세한 내용은 [`docs/RBAC说明.md`](./docs/RBAC说明.md)과 [`CHANGELOG.md`](./CHANGELOG.md) 참고. - **v0.5.2** — Wiki 인제스트가 만 건 규모 KB 지원(작업 큐 + DLQ); MCP 휴먼인더루프 도구 승인; Anthropic / Apache Doris / Tencent VectorDB / Kingsoft Cloud KS3 / SearXNG 백엔드; 적응형 3단계 청킹 + 라이브 미리보기; 글로벌 ⌘K 명령 팔레트; Yuque 커넥터 + WeChat 미니프로그램; `weknora` CLI 프리뷰. - **v0.5.1** — 지식베이스 일괄 관리; 테넌트 전체 IM 채널 개요; 세션 검색 + 사용자 단위 핀; 모델 / 웹 검색 / MCP 통일 카드 설정; Agent별 LLM 타임아웃; 데스크탑 테넌트 전환. @@ -134,7 +135,7 @@ Feishu, Notion, Yuque 등 외부 플랫폼에서 지식 자동 동기화를 지 |------|------| | LLM | OpenAI / Azure OpenAI / Anthropic (Claude) / DeepSeek / Qwen (Alibaba Cloud) / Zhipu / Hunyuan / Doubao (Volcengine) / Gemini / MiniMax / NVIDIA / Novita AI / SiliconFlow / OpenRouter / Ollama | | Embedding | Ollama / BGE / GTE / OpenAI 호환 API | -| 벡터 DB | PostgreSQL (pgvector) / Elasticsearch / Milvus / Weaviate / Qdrant / Apache Doris / Tencent VectorDB | +| 벡터 DB | PostgreSQL (pgvector) / Elasticsearch / OpenSearch / Milvus / Weaviate / Qdrant / Apache Doris / Tencent VectorDB | | 오브젝트 스토리지 | 로컬 / MinIO / AWS S3 / Volcengine TOS / Alibaba Cloud OSS / Kingsoft Cloud KS3 | | IM 통합 | WeChat Work / Feishu / Slack / Telegram / DingTalk / Mattermost / WeChat | | 웹 검색 | DuckDuckGo / Bing / Google / Tavily / Baidu / Ollama / SearXNG | @@ -145,9 +146,9 @@ Feishu, Notion, Yuque 등 외부 플랫폼에서 지식 자동 동기화를 지 |------|------| | 배포 | 로컬 / Docker / Kubernetes (Helm), 프라이빗/오프라인 배포 지원 | | UI | Web UI / RESTful API / CLI (`weknora`) / Chrome Extension / WeChat 미니 프로그램 | -| 관측 가능성 | ReAct 루프, 토큰 소비, 도구 호출, 파이프라인 추적을 위한 Langfuse 통합 | +| 관측 가능성 | ReAct 루프, 토큰 소비, 도구 호출, 파이프라인 추적을 위한 Langfuse 통합; Langfuse 스타일의 문서 파싱 추적 타임라인 내장으로 단계별 진행 표시 | | 작업 관리 | MQ 비동기 작업, 버전 업그레이드 시 자동 DB 마이그레이션 | -| 모델 관리 | 중앙 설정, 지식베이스별 모델 선택, 멀티테넌트 내장 모델 공유, WeKnora Cloud 호스팅 모델 및 문서 파싱 | +| 모델 관리 | 중앙 설정, YAML 선언형 내장 모델 구성, 지식베이스별 모델 선택, 모델별 사고 모드 설정, 멀티테넌트 내장 모델 공유, WeKnora Cloud 호스팅 모델 및 문서 파싱 | ## 🧩 Chrome 확장 프로그램 diff --git a/VERSION b/VERSION index a918a2aa..ee6cdce3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.0 +0.6.1 diff --git a/client/README.md b/client/README.md index dd6c8faa..75cfb263 100644 --- a/client/README.md +++ b/client/README.md @@ -353,6 +353,22 @@ if err != nil { fmt.Printf("Parse Status: %s\n", knowledge.ParseStatus) // "cancelled" ``` +### 示例:查看文档解析追踪(Span 树) + +```go +// 获取文档解析流水线的 Span 树(root → stage → subspan) +// - attempt 传 0 表示获取最新一次解析尝试 +// - 始终返回 5 个标准阶段:docreader / chunking / embedding / multimodal / postprocess +trace, err := apiClient.GetKnowledgeProcessingSpans(context.Background(), knowledgeID, 0) +if err != nil { + // 处理错误 +} +fmt.Printf("ParseStatus=%s CurrentStage=%s\n", trace.ParseStatus, trace.CurrentStage) +for _, stage := range trace.Trace.Children { + fmt.Printf("- %s: %s (%dms)\n", stage.Name, stage.Status, stage.DurationMs) +} +``` + ### 示例:获取会话消息 ```go diff --git a/client/knowledge.go b/client/knowledge.go index cbecf54d..1398455e 100644 --- a/client/knowledge.go +++ b/client/knowledge.go @@ -539,6 +539,103 @@ func (c *Client) CancelKnowledgeParse(ctx context.Context, knowledgeID string) ( return &response.Data, nil } +// KnowledgeSpanNode mirrors one node of the server's document-parsing trace +// tree (root → stage → subspan). Children carries nested subspans such as +// per-image multimodal calls or LLM generations under a stage. +type KnowledgeSpanNode struct { + KnowledgeID string `json:"knowledge_id"` + Attempt int `json:"attempt"` + SpanID string `json:"span_id"` + ParentSpanID string `json:"parent_span_id,omitempty"` + Name string `json:"name"` + Kind string `json:"kind"` // root / stage / subspan / generation + Status string `json:"status"` // pending / running / done / failed / skipped / cancelled + Input map[string]interface{} `json:"input,omitempty"` + Output map[string]interface{} `json:"output,omitempty"` + Metadata map[string]interface{} `json:"metadata,omitempty"` + ErrorCode string `json:"error_code,omitempty"` + ErrorMessage string `json:"error_message,omitempty"` + StartedAt *time.Time `json:"started_at,omitempty"` + FinishedAt *time.Time `json:"finished_at,omitempty"` + DurationMs int64 `json:"duration_ms,omitempty"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + Children []*KnowledgeSpanNode `json:"children,omitempty"` +} + +// KnowledgeSpanError describes the most recent failed span in a trace. +type KnowledgeSpanError struct { + Stage string `json:"stage"` + Code string `json:"code"` + Message string `json:"message"` + FinishedAt *time.Time `json:"finished_at,omitempty"` +} + +// KnowledgeProcessingTrace is the document-parsing trace for one parse +// attempt: a five-segment stage timeline (docreader, chunking, embedding, +// multimodal, postprocess) plus any subspans, with the current stage and +// last error surfaced for convenience. +type KnowledgeProcessingTrace struct { + KnowledgeID string `json:"knowledge_id"` + ParseStatus string `json:"parse_status"` + CurrentAttempt int `json:"current_attempt"` + CurrentStage string `json:"current_stage"` + Trace *KnowledgeSpanNode `json:"trace"` + LastError *KnowledgeSpanError `json:"last_error,omitempty"` +} + +type knowledgeProcessingTraceResponse struct { + Success bool `json:"success"` + Data KnowledgeProcessingTrace `json:"data"` +} + +// GetKnowledgeProcessingSpans fetches the document-parsing trace tree for a +// knowledge entry. The response always contains the five canonical stages; +// stages that have not produced rows yet are synthesized as "pending" +// placeholders so the timeline is stable to render. +// +// Parameters: +// - ctx: Context for the request +// - knowledgeID: The ID of the knowledge entry +// - attempt: A specific parse attempt number; pass 0 for the latest attempt +// +// Returns: +// - *KnowledgeProcessingTrace: The trace for the selected attempt +// - error: Error information if the request fails +// +// Example: +// +// trace, err := client.GetKnowledgeProcessingSpans(ctx, "knowledge-id-123", 0) +// if err != nil { +// log.Fatalf("Failed to get parsing trace: %v", err) +// } +// fmt.Printf("parse_status=%s current_stage=%s\n", trace.ParseStatus, trace.CurrentStage) +func (c *Client) GetKnowledgeProcessingSpans( + ctx context.Context, knowledgeID string, attempt int, +) (*KnowledgeProcessingTrace, error) { + if knowledgeID == "" { + return nil, fmt.Errorf("knowledge ID cannot be empty") + } + + queryParams := url.Values{} + if attempt > 0 { + queryParams.Add("attempt", strconv.Itoa(attempt)) + } + + path := fmt.Sprintf("/api/v1/knowledge/%s/spans", knowledgeID) + resp, err := c.doRequest(ctx, http.MethodGet, path, nil, queryParams) + if err != nil { + return nil, err + } + + var response knowledgeProcessingTraceResponse + if err := parseResponse(resp, &response); err != nil { + return nil, err + } + + return &response.Data, nil +} + // UpdateChunk updates a chunk's information // Updates information for a specific chunk under a knowledge document // Parameters: diff --git a/docs/QA.md b/docs/QA.md index 2a10ceb9..325710ca 100644 --- a/docs/QA.md +++ b/docs/QA.md @@ -233,5 +233,32 @@ Wiki 模式允许 Agent 根据原始文档自动生成并维护一套结构化 如果你希望开启「invite-only」(不允许自助注册到本租户),可在租户设置里打开邀请制,并通过「邀请」入口签发邀请码或链接。 +## 14. 文档解析卡在「处理中」/ 解析追踪时间线打不开怎么办? + +0.6.1 起每个文档解析都会记录一棵 Langfuse 风格的 Span 树(`knowledge_processing_spans` 表),可在知识库卡片菜单或卡片上的「Trace」入口打开侧边时间线,逐阶段查看进度。常见情况: + +- **文档长时间停在「处理中」**:先打开时间线看是哪个阶段没有推进(解析 / 切分 / 向量化 / 后处理)。0.6.1 已修复多数「卡死」场景,并加入看门狗轮询;如确认是某次解析挂死,可在时间线面板点击「中止解析」,文档会进入 finalizing 后处理状态后结束。 +- **时间线一直显示「更新中」但无数据**:通常是轮询请求静默失败(网络 / 反向代理截断 SSE)。0.6.1 会显式暴露轮询失败,刷新页面或检查 Nginx 是否缓冲了响应即可。 +- **升级后没有时间线数据**:确认数据库迁移 `000055_knowledge_processing_spans`、`000056_knowledge_pending_subtasks` 已执行(服务启动会自动迁移)。 + +## 15. 如何启用 OpenSearch 作为向量库? + +0.6.1 新增了 OpenSearch 向量库驱动(k-NN)。在 **设置 → 向量库** 中新增 OpenSearch 引擎并填写连接地址、凭据即可;KB 可绑定该向量库。注意: + +- 连接地址会经过 SSRF 策略校验,内网 / 回环地址需符合放行规则;可用「测试连接」先行校验。 +- 集成测试与索引映射细节见 [`docs/dev/opensearch-integration-test.md`](./dev/opensearch-integration-test.md)。 + +## 16. 内置模型(builtin models)如何用 YAML 声明式管理? + +0.6.1 起平台内置模型由 `config/builtin_models.yaml` 声明式驱动,支持 `${ENV}` 变量插值,并通过 `managed_by` 字段与漂移巡检保持数据库与 YAML 一致。常见问题: + +- **改了 YAML 不生效**:内置模型在服务启动时做生命周期对账(drift sweep);确认重启了服务,且条目通过了 schema 校验(ID 长度、必填字段)。 +- **Docker 下环境变量未注入**:`builtin_models` 依赖 `env_file` 数组形式注入变量,确认 compose 中按数组形式挂载了 `.env`。 +- 参考样例:`config/builtin_models.yaml.example`。 + +## 17. 系统管理员(System Admin)与平台设置怎么用? + +0.6.1 引入了系统管理员与统一平台设置面板(含平台审计日志),与租户内 RBAC 区分:系统管理员管理的是「平台级」配置,而非单个租户内的资源。首次启用需通过系统管理员 bootstrap 流程晋升首个管理员;撤销管理员权限有安全防护(避免误撤导致无人可管)。相关迁移为 `000053_system_admin_and_settings`。 + ## P.S. 如果以上方式未解决问题,请在issue中描述您的问题,并提供必要的日志信息辅助我们进行问题排查 diff --git a/docs/docs.go b/docs/docs.go index c6a0fed5..17cc68d9 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -576,6 +576,45 @@ const docTemplate = `{ } } }, + "/api/v1/knowledge/{id}/spans": { + "get": { + "description": "返回该知识在解析流水线的 trace tree(root → stage → subspan):每段状态、耗时、input/output、错误码、langfuse_trace_id。支持 ?attempt=N 查看历史尝试;不传则返回最新尝试。前端用于渲染时间线 + 多模态/embedding 子节点 + 一键跳转 Langfuse。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "知识管理" + ], + "summary": "获取知识文档解析的 Span 树(含历史尝试)", + "parameters": [ + { + "type": "string", + "description": "知识ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "指定尝试号;省略=最新", + "name": "attempt", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/auth/auto-setup": { "post": { "description": "Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程", @@ -683,6 +722,46 @@ const docTemplate = `{ } } }, + "/auth/invitations/lookup": { + "post": { + "description": "根据邀请链接中的 token 返回邀请上下文(租户名 / 角色 / 过期时间),\n供注册页展示。无认证;token 无效或被撤销返回 410。\n使用 POST + body 而非 GET + path,避免 token 落入访问日志 / 浏览器历史 / tracing。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证" + ], + "summary": "解析共享邀请链接 token", + "parameters": [ + { + "description": "邀请 token", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.invitationLookupRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/internal_handler.invitationLookupResponse" + } + }, + "410": { + "description": "链接无效或已撤销", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, "/auth/login": { "post": { "description": "用户登录并获取访问令牌", @@ -1044,6 +1123,58 @@ const docTemplate = `{ } } }, + "/auth/register-by-invite": { + "post": { + "description": "通过 Owner 生成的共享邀请链接 token 完成注册,绕过 invite_only 模式拦截。\n注册者自填邮箱(与 token 不绑定);注册成功后自动加入对应租户。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证" + ], + "summary": "使用共享链接注册", + "parameters": [ + { + "description": "邀请注册请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.registerByInviteRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "409": { + "description": "邮箱已注册", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "410": { + "description": "链接无效或已撤销", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, "/auth/switch-tenant": { "post": { "security": [ @@ -5963,6 +6094,65 @@ const docTemplate = `{ } } }, + "/knowledge/{id}/cancel-parse": { + "post": { + "security": [ + { + "Bearer": [] + }, + { + "ApiKeyAuth": [] + } + ], + "description": "取消进行中的知识解析任务。当前已写入的 chunk / 索引保留,可通过 reparse 接口重新触发解析。已完成 / 已失败 / 删除中的知识不支持取消。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "知识管理" + ], + "summary": "取消知识解析", + "parameters": [ + { + "type": "string", + "description": "知识ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "取消已提交", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "状态不支持取消", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "403": { + "description": "权限不足", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "404": { + "description": "知识不存在", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, "/knowledge/{id}/download": { "get": { "security": [ @@ -9970,6 +10160,418 @@ const docTemplate = `{ } } }, + "/system/admin/audit-log": { + "get": { + "security": [ + { + "Bearer": [] + }, + { + "ApiKeyAuth": [] + } + ], + "description": "返回 system-scope(tenant_id=0)的审计事件,覆盖 system.setting_changed / system.admin_promoted / system.admin_revoked 等 SystemAdmin 操作。按 id 倒序的游标分页。", + "produces": [ + "application/json" + ], + "tags": [ + "审计日志" + ], + "summary": "获取平台审计日志", + "parameters": [ + { + "type": "integer", + "description": "游标:返回 id 小于此值的记录(默认从最新开始)", + "name": "after_id", + "in": "query" + }, + { + "type": "integer", + "description": "页大小,1-100,默认 50", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "description": "按 action 精确过滤(如 system.setting_changed)", + "name": "action", + "in": "query" + }, + { + "type": "string", + "description": "按 outcome 精确过滤(success / denied)", + "name": "outcome", + "in": "query" + }, + { + "type": "string", + "description": "按 actor_user_id 精确过滤", + "name": "actor", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/internal_handler.auditLogListResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, + "/system/admin/list": { + "get": { + "description": "Retrieve a paginated list of users with system administrator\nprivileges (SystemAdmin only). Supports ` + "`" + `offset` + "`" + ` (default 0)\nand ` + "`" + `limit` + "`" + ` (default 50, max 200) query parameters. Walks the\npartial-friendly idx_users_is_system_admin index.", + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "List all system administrators", + "parameters": [ + { + "type": "integer", + "default": 0, + "description": "Page offset", + "name": "offset", + "in": "query" + }, + { + "type": "integer", + "default": 50, + "description": "Page size (max 200)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "System admins retrieved successfully", + "schema": { + "$ref": "#/definitions/internal_handler.ListSystemAdminsResponse" + } + }, + "403": { + "description": "Forbidden: not a system admin", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/system/admin/promote": { + "post": { + "description": "Grant system administrator privileges to a user (SystemAdmin only).\nIdempotent: re-promoting an existing system admin returns 200 with no DB write.\nIdentify the user by email (preferred for human operators) or user_id (UUID, for API clients).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "Promote a user to system administrator", + "parameters": [ + { + "description": "User promotion request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.PromoteUserToSystemAdminRequest" + } + } + ], + "responses": { + "200": { + "description": "User promoted successfully", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UserInfo" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "Forbidden: not a system admin", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "User not found", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/system/admin/revoke": { + "post": { + "description": "Remove system administrator privileges from a user (SystemAdmin only).\nTwo safety guards: the caller cannot revoke their own privileges,\nand revoking the last remaining system admin is rejected — both\nprevent a SystemAdmin from accidentally locking the platform out\nof system-level administration. Idempotent on already-non-admin users.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "Revoke system administrator privileges from a user", + "parameters": [ + { + "description": "User revocation request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.RevokeSystemAdminRequest" + } + } + ], + "responses": { + "200": { + "description": "Privileges revoked successfully", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UserInfo" + } + }, + "400": { + "description": "Bad request / would remove last admin / self-revoke", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "Forbidden: not a system admin", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "User not found", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/system/admin/settings": { + "get": { + "description": "Return every row in the system_settings table (system-scope,\nnot tenant-scope). SystemAdmin only.", + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "List all system settings", + "responses": { + "200": { + "description": "list of settings", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SystemSetting" + } + } + }, + "403": { + "description": "Forbidden: not a system admin", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/system/admin/settings/{key}": { + "get": { + "description": "Returns the row matching :key. 404 when the key is unknown\nto the registry; 200 with the row when known.", + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "Get a single system setting by key", + "parameters": [ + { + "type": "string", + "description": "Setting key (e.g. file.max_size_mb)", + "name": "key", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "the setting row", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SystemSetting" + } + }, + "400": { + "description": "Unknown key", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "Key registered but DB row absent", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "description": "Persist a new value for :key. Service validates the\nrawValue against the registry's declared value_type and\nrejects mismatches with 400. SystemAdmin only. Emits an\naudit row (action=system.setting_changed) on success.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "Update a system setting value", + "parameters": [ + { + "type": "string", + "description": "Setting key", + "name": "key", + "in": "path", + "required": true + }, + { + "description": "New value", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.UpdateSystemSettingRequest" + } + } + ], + "responses": { + "200": { + "description": "the updated row", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SystemSetting" + } + }, + "400": { + "description": "Bad request / unknown key / type mismatch", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "Forbidden: not a system admin", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "description": "Removes the DB override for :key so the 3-tier resolver\nfalls back to the environment variable (when configured)\nor the in-code default. Idempotent — resetting a key\nthat was never persisted returns 200.", + "tags": [ + "System Admin" + ], + "summary": "Reset a system setting to ENV / built-in default", + "parameters": [ + { + "type": "string", + "description": "Setting key", + "name": "key", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Reset acknowledged", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "Unknown key", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "DB write failed", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/system/admin/tenants/apply-default-storage-quota": { + "post": { + "description": "Reads the current value of ` + "`" + `tenant.default_storage_quota_gb` + "`" + `\n(3-tier resolver: DB \u003e ENV \u003e default) and writes that many\nGiB into storage_quota for every row in tenants. Bypasses\nthe per-tenant PUT whitelist, which forbids storage_quota\nedits by Owners. SystemAdmin only.\nIdempotent — running twice with the same setting is a no-op.", + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "Apply the default storage quota to every existing tenant", + "responses": { + "200": { + "description": "{ affected: int64, quota_bytes: int64 }", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "DB write failed", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/system/docreader/reconnect": { "post": { "consumes": [ @@ -10895,6 +11497,53 @@ const docTemplate = `{ } } }, + "/tenants/{id}/invite-links": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "生成一条多次使用的共享邀请链接:谁拿到链接谁就能注册并加入当前租户。\n链接持续有效,直到过期或被撤销。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "租户邀请" + ], + "summary": "生成共享邀请链接", + "parameters": [ + { + "type": "string", + "description": "租户 ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "共享链接配置", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.createInviteLinkRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/tenants/{id}/leave": { "post": { "security": [ @@ -12397,7 +13046,16 @@ const docTemplate = `{ "rbac.invitation_accepted", "rbac.invitation_declined", "rbac.invitation_revoked", - "rbac.invitation_expired" + "rbac.invitation_expired", + "vector_store.created", + "vector_store.updated", + "vector_store.deleted", + "opensearch.index_created", + "opensearch.index_deleted", + "opensearch.reindex_executed", + "system.setting_changed", + "system.admin_promoted", + "system.admin_revoked" ], "x-enum-varnames": [ "AuditActionMemberAdded", @@ -12409,7 +13067,16 @@ const docTemplate = `{ "AuditActionInvitationAccepted", "AuditActionInvitationDeclined", "AuditActionInvitationRevoked", - "AuditActionInvitationExpired" + "AuditActionInvitationExpired", + "AuditActionVectorStoreCreated", + "AuditActionVectorStoreUpdated", + "AuditActionVectorStoreDeleted", + "AuditActionOpenSearchIndexCreated", + "AuditActionOpenSearchIndexDeleted", + "AuditActionOpenSearchReindexExecuted", + "AuditActionSystemSettingChanged", + "AuditActionSystemAdminPromoted", + "AuditActionSystemAdminRevoked" ] }, "github_com_Tencent_WeKnora_internal_types.AuditLog": { @@ -12580,7 +13247,7 @@ const docTemplate = `{ "type": "string" }, "database": { - "description": "Tencent VectorDB and Doris database name.", + "description": "Database name used by engines that support database-level namespaces\n(currently Milvus, Tencent VectorDB, and Doris).", "type": "string" }, "grpc_address": { @@ -12595,6 +13262,10 @@ const docTemplate = `{ "description": "Doris: HTTP port for Stream Load API (FE default 8030).\nAddr is reused for the MySQL protocol \"host:9030\"; HTTPPort + the host of Addr\ntogether form the FE HTTP endpoint used by Stream Load.", "type": "integer" }, + "insecure_skip_verify": { + "description": "InsecureSkipVerify disables TLS certificate verification when\ntalking to the backing store over HTTPS. Defaults to false\n(secure). Set to true ONLY for self-signed development clusters;\nproduction deployments should provide trusted certificates via\nthe system CA pool. Cross-driver applicable but currently only\nthe OpenSearch driver (Phase 3) reads this field. Note: this\ndiffers from the Qdrant-specific UseTLS below, which *enables*\nTLS on gRPC connections — InsecureSkipVerify only controls\n*verification* of an already-TLS connection.", + "type": "boolean" + }, "password": { "description": "AES-GCM encrypted", "type": "string" @@ -12781,6 +13452,13 @@ const docTemplate = `{ "description": "===== Image Upload / Multimodal Settings =====\nWhether image upload is enabled for this agent (default: false)", "type": "boolean" }, + "intent_prompts": { + "description": "IntentPrompts holds per-intent system prompt overrides for non-retrieval\nintents (greeting, chitchat, etc.). Empty values fall back to templates\nunder config/prompt_templates/intent_prompts.yaml.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "kb_selection_mode": { "description": "===== Knowledge Base Settings =====\nKnowledge base selection mode: \"all\" = all KBs, \"selected\" = specific KBs, \"none\" = no KB", "type": "string" @@ -13326,10 +14004,26 @@ const docTemplate = `{ "description": "Weaviate: number of shards per collection", "type": "integer" }, + "hnsw_ef_construction": { + "description": "OpenSearch: HNSW index-build candidate list size", + "type": "integer" + }, + "hnsw_ef_search": { + "description": "OpenSearch: HNSW search candidate list size (faiss; lucene reads at query time)", + "type": "integer" + }, + "hnsw_m": { + "description": "--- OpenSearch k-NN HNSW fields ---\nAll omitempty so other engines' serialized IndexConfig is unchanged.\nZero / empty values fall back to the driver defaults in buildInternalCfg.", + "type": "integer" + }, "index_name": { "description": "--- Existing fields ---", "type": "string" }, + "knn_engine": { + "description": "OpenSearch: k-NN backend (\"lucene\" | \"faiss\")", + "type": "string" + }, "number_of_replicas": { "description": "ES, OpenSearch", "type": "integer" @@ -13569,6 +14263,10 @@ const docTemplate = `{ "description": "Parse status of the knowledge", "type": "string" }, + "pending_subtasks_count": { + "description": "PendingSubtasksCount is the outstanding enrichment subtask count\n(summary + question + graph chunks). Only meaningful while\nParseStatus == \"finalizing\"; defaults to 0 in any terminal state.", + "type": "integer" + }, "processed_at": { "description": "Processed time of the knowledge", "type": "string" @@ -14881,6 +15579,48 @@ const docTemplate = `{ "mineru_vlm_server_url": { "description": "vLLM 服务器地址 (vlm-http-client / hybrid-http-client)", "type": "string" + }, + "odl_hybrid": { + "description": "OpenDataLoader PDF (docreader engine); hybrid requires opendataloader-pdf-hybrid service.", + "type": "string" + }, + "odl_hybrid_fallback": { + "type": "boolean" + }, + "odl_hybrid_mode": { + "description": "auto, full", + "type": "string" + }, + "odl_hybrid_url": { + "description": "e.g. http://odl-hybrid:5002", + "type": "string" + }, + "odl_markdown_with_html": { + "type": "boolean" + }, + "paddleocr_vl_cloud_model": { + "description": "e.g. PaddleOCR-VL-1.6", + "type": "string" + }, + "paddleocr_vl_cloud_token": { + "description": "PaddleOCR-VL AI Studio cloud API.", + "type": "string" + }, + "paddleocr_vl_cloud_use_chart_recognition": { + "type": "boolean" + }, + "paddleocr_vl_cloud_use_seal_recognition": { + "type": "boolean" + }, + "paddleocr_vl_endpoint": { + "description": "PaddleOCR-VL self-hosted pipeline service (full /layout-parsing API).", + "type": "string" + }, + "paddleocr_vl_use_chart_recognition": { + "type": "boolean" + }, + "paddleocr_vl_use_seal_recognition": { + "type": "boolean" } } }, @@ -15113,7 +15853,8 @@ const docTemplate = `{ "weaviate", "doris", "sqlite", - "tencent_vectordb" + "tencent_vectordb", + "opensearch" ], "x-enum-varnames": [ "PostgresRetrieverEngineType", @@ -15125,7 +15866,8 @@ const docTemplate = `{ "WeaviateRetrieverEngineType", "DorisRetrieverEngineType", "SQLiteRetrieverEngineType", - "TencentVectorDBRetrieverEngineType" + "TencentVectorDBRetrieverEngineType", + "OpenSearchRetrieverEngineType" ] }, "github_com_Tencent_WeKnora_internal_types.RetrieverEngines": { @@ -15651,6 +16393,62 @@ const docTemplate = `{ } } }, + "github_com_Tencent_WeKnora_internal_types.SystemSetting": { + "type": "object", + "properties": { + "category": { + "description": "Category groups settings in the management UI (\"limits\", \"agent\",\n\"auth\", ...). Free-form string so adding a new category is a\ndata-only change.", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "enum": { + "description": "Enum is populated by the service layer (NOT persisted) from the\nin-code registry. Empty/nil means \"free-form input\"; non-empty\nmeans the UI should render a select with these options. Tagged\n` + "`" + `gorm:\"-\"` + "`" + ` so GORM never tries to read/write the column.", + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "integer" + }, + "is_secret": { + "description": "IsSecret reserves UI affordances for P3 (mask + reveal-with-confirm).\nIn P1 every row is is_secret=false; service Update accepts the\ncolumn but does not yet enforce special handling.", + "type": "boolean" + }, + "key": { + "type": "string" + }, + "last_modified_by": { + "type": "string" + }, + "last_modified_by_name": { + "description": "LastModifiedByName is a display label resolved from LastModifiedBy\n(the user's UUID) at handler time — username when available,\notherwise email. Empty for virtual rows that were never persisted\n(LastModifiedBy=\"\"). Not stored: derived per request so renaming\na user reflects on the next reload without a backfill job.", + "type": "string" + }, + "requires_restart": { + "description": "RequiresRestart reserves UI affordances for P3 (banner \"this\nchange won't take effect until the next restart\"). In P1 the\nonly seeded key is per-request, so always false.", + "type": "boolean" + }, + "updated_at": { + "type": "string" + }, + "value": { + "type": "array", + "items": { + "type": "integer" + } + }, + "value_type": { + "description": "ValueType is one of \"int\", \"string\", \"bool\". Service layer rejects\nupdates whose payload type does not match; UI uses it to pick\nInputNumber vs Input vs Switch.", + "type": "string" + } + } + }, "github_com_Tencent_WeKnora_internal_types.TOSEngineConfig": { "type": "object", "properties": { @@ -15960,6 +16758,10 @@ const docTemplate = `{ "description": "Whether the user is active", "type": "boolean" }, + "is_system_admin": { + "description": "Whether the user is a system administrator (independent of tenant roles)", + "type": "boolean" + }, "preferences": { "description": "Per-user UI/feature preferences (memory toggle, future knobs).\nStored as JSON (jsonb on Postgres, TEXT on SQLite) via the\ndriver.Valuer / sql.Scanner methods on UserPreferences.", "allOf": [ @@ -15990,6 +16792,44 @@ const docTemplate = `{ } } }, + "github_com_Tencent_WeKnora_internal_types.UserInfo": { + "type": "object", + "properties": { + "avatar": { + "type": "string" + }, + "can_access_all_tenants": { + "type": "boolean" + }, + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "is_system_admin": { + "type": "boolean" + }, + "preferences": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UserPreferences" + }, + "tenant_id": { + "type": "integer" + }, + "updated_at": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, "github_com_Tencent_WeKnora_internal_types.UserPreferences": { "type": "object", "properties": { @@ -16739,6 +17579,9 @@ const docTemplate = `{ "description": { "type": "string" }, + "display_name": { + "type": "string" + }, "name": { "type": "string" }, @@ -16876,6 +17719,14 @@ const docTemplate = `{ "minio_enabled": { "type": "boolean" }, + "started_at": { + "description": "StartedAt is the server process boot time (RFC3339, UTC).", + "type": "string" + }, + "uptime_seconds": { + "description": "UptimeSeconds is seconds elapsed since process start.", + "type": "integer" + }, "vector_store_engine": { "type": "string" }, @@ -17229,6 +18080,20 @@ const docTemplate = `{ } } }, + "internal_handler.ListSystemAdminsResponse": { + "type": "object", + "properties": { + "admins": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UserInfo" + } + }, + "total": { + "type": "integer" + } + } + }, "internal_handler.ModelTestRequest": { "type": "object", "required": [ @@ -17238,6 +18103,10 @@ const docTemplate = `{ "apiKey": { "type": "string" }, + "appSecret": { + "description": "AppSecret 用于 LKEAP Rerank 等需要第二段密钥的场景(对应模型 Parameters.AppSecret)。", + "type": "string" + }, "baseUrl": { "type": "string" }, @@ -17448,6 +18317,17 @@ const docTemplate = `{ } } }, + "internal_handler.PromoteUserToSystemAdminRequest": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, "internal_handler.RemoteModelCheckRequest": { "type": "object", "required": [ @@ -17457,6 +18337,10 @@ const docTemplate = `{ "apiKey": { "type": "string" }, + "appSecret": { + "description": "AppSecret 用于 LKEAP Rerank 等需要第二段密钥的场景(对应模型 Parameters.AppSecret)。", + "type": "string" + }, "baseUrl": { "type": "string" }, @@ -17494,6 +18378,17 @@ const docTemplate = `{ } } }, + "internal_handler.RevokeSystemAdminRequest": { + "type": "object", + "required": [ + "user_id" + ], + "properties": { + "user_id": { + "type": "string" + } + } + }, "internal_handler.SearchMessagesRequest": { "type": "object", "required": [ @@ -17705,6 +18600,9 @@ const docTemplate = `{ "description": { "type": "string" }, + "display_name": { + "type": "string" + }, "name": { "type": "string" }, @@ -17747,6 +18645,14 @@ const docTemplate = `{ } } }, + "internal_handler.UpdateSystemSettingRequest": { + "type": "object", + "properties": { + "value": { + "description": "Value is intentionally ` + "`" + `any` + "`" + ` (decoded as float64 / string / bool /\netc. by the JSON unmarshaller). Service.encodeForType normalises\nthese against the registry's declared type and rejects mismatches." + } + } + }, "internal_handler.addMemberRequest": { "type": "object", "required": [ @@ -17812,6 +18718,20 @@ const docTemplate = `{ } } }, + "internal_handler.createInviteLinkRequest": { + "type": "object", + "required": [ + "role" + ], + "properties": { + "message": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.TenantRole" + } + } + }, "internal_handler.createTenantRequest": { "type": "object", "required": [ @@ -17829,6 +18749,58 @@ const docTemplate = `{ } } }, + "internal_handler.invitationLookupRequest": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string" + } + } + }, + "internal_handler.invitationLookupResponse": { + "type": "object", + "properties": { + "expires_at": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.TenantRole" + }, + "tenant_id": { + "type": "integer" + }, + "tenant_name": { + "type": "string" + } + } + }, + "internal_handler.registerByInviteRequest": { + "type": "object", + "required": [ + "email", + "password", + "token", + "username" + ], + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string", + "minLength": 6 + }, + "token": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, "internal_handler.updateLastFAQImportResultDisplayStatusRequest": { "type": "object", "required": [ diff --git a/docs/images/architecture.png b/docs/images/architecture.png index 181e7f8b..92917119 100644 Binary files a/docs/images/architecture.png and b/docs/images/architecture.png differ diff --git a/docs/swagger.json b/docs/swagger.json index 732e88ed..56fb55df 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -569,6 +569,45 @@ } } }, + "/api/v1/knowledge/{id}/spans": { + "get": { + "description": "返回该知识在解析流水线的 trace tree(root → stage → subspan):每段状态、耗时、input/output、错误码、langfuse_trace_id。支持 ?attempt=N 查看历史尝试;不传则返回最新尝试。前端用于渲染时间线 + 多模态/embedding 子节点 + 一键跳转 Langfuse。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "知识管理" + ], + "summary": "获取知识文档解析的 Span 树(含历史尝试)", + "parameters": [ + { + "type": "string", + "description": "知识ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "指定尝试号;省略=最新", + "name": "attempt", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/auth/auto-setup": { "post": { "description": "Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程", @@ -676,6 +715,46 @@ } } }, + "/auth/invitations/lookup": { + "post": { + "description": "根据邀请链接中的 token 返回邀请上下文(租户名 / 角色 / 过期时间),\n供注册页展示。无认证;token 无效或被撤销返回 410。\n使用 POST + body 而非 GET + path,避免 token 落入访问日志 / 浏览器历史 / tracing。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证" + ], + "summary": "解析共享邀请链接 token", + "parameters": [ + { + "description": "邀请 token", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.invitationLookupRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/internal_handler.invitationLookupResponse" + } + }, + "410": { + "description": "链接无效或已撤销", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, "/auth/login": { "post": { "description": "用户登录并获取访问令牌", @@ -1037,6 +1116,58 @@ } } }, + "/auth/register-by-invite": { + "post": { + "description": "通过 Owner 生成的共享邀请链接 token 完成注册,绕过 invite_only 模式拦截。\n注册者自填邮箱(与 token 不绑定);注册成功后自动加入对应租户。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证" + ], + "summary": "使用共享链接注册", + "parameters": [ + { + "description": "邀请注册请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.registerByInviteRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "409": { + "description": "邮箱已注册", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "410": { + "description": "链接无效或已撤销", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, "/auth/switch-tenant": { "post": { "security": [ @@ -5956,6 +6087,65 @@ } } }, + "/knowledge/{id}/cancel-parse": { + "post": { + "security": [ + { + "Bearer": [] + }, + { + "ApiKeyAuth": [] + } + ], + "description": "取消进行中的知识解析任务。当前已写入的 chunk / 索引保留,可通过 reparse 接口重新触发解析。已完成 / 已失败 / 删除中的知识不支持取消。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "知识管理" + ], + "summary": "取消知识解析", + "parameters": [ + { + "type": "string", + "description": "知识ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "取消已提交", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "状态不支持取消", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "403": { + "description": "权限不足", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "404": { + "description": "知识不存在", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, "/knowledge/{id}/download": { "get": { "security": [ @@ -9963,6 +10153,418 @@ } } }, + "/system/admin/audit-log": { + "get": { + "security": [ + { + "Bearer": [] + }, + { + "ApiKeyAuth": [] + } + ], + "description": "返回 system-scope(tenant_id=0)的审计事件,覆盖 system.setting_changed / system.admin_promoted / system.admin_revoked 等 SystemAdmin 操作。按 id 倒序的游标分页。", + "produces": [ + "application/json" + ], + "tags": [ + "审计日志" + ], + "summary": "获取平台审计日志", + "parameters": [ + { + "type": "integer", + "description": "游标:返回 id 小于此值的记录(默认从最新开始)", + "name": "after_id", + "in": "query" + }, + { + "type": "integer", + "description": "页大小,1-100,默认 50", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "description": "按 action 精确过滤(如 system.setting_changed)", + "name": "action", + "in": "query" + }, + { + "type": "string", + "description": "按 outcome 精确过滤(success / denied)", + "name": "outcome", + "in": "query" + }, + { + "type": "string", + "description": "按 actor_user_id 精确过滤", + "name": "actor", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/internal_handler.auditLogListResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, + "/system/admin/list": { + "get": { + "description": "Retrieve a paginated list of users with system administrator\nprivileges (SystemAdmin only). Supports `offset` (default 0)\nand `limit` (default 50, max 200) query parameters. Walks the\npartial-friendly idx_users_is_system_admin index.", + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "List all system administrators", + "parameters": [ + { + "type": "integer", + "default": 0, + "description": "Page offset", + "name": "offset", + "in": "query" + }, + { + "type": "integer", + "default": 50, + "description": "Page size (max 200)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "System admins retrieved successfully", + "schema": { + "$ref": "#/definitions/internal_handler.ListSystemAdminsResponse" + } + }, + "403": { + "description": "Forbidden: not a system admin", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/system/admin/promote": { + "post": { + "description": "Grant system administrator privileges to a user (SystemAdmin only).\nIdempotent: re-promoting an existing system admin returns 200 with no DB write.\nIdentify the user by email (preferred for human operators) or user_id (UUID, for API clients).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "Promote a user to system administrator", + "parameters": [ + { + "description": "User promotion request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.PromoteUserToSystemAdminRequest" + } + } + ], + "responses": { + "200": { + "description": "User promoted successfully", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UserInfo" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "Forbidden: not a system admin", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "User not found", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/system/admin/revoke": { + "post": { + "description": "Remove system administrator privileges from a user (SystemAdmin only).\nTwo safety guards: the caller cannot revoke their own privileges,\nand revoking the last remaining system admin is rejected — both\nprevent a SystemAdmin from accidentally locking the platform out\nof system-level administration. Idempotent on already-non-admin users.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "Revoke system administrator privileges from a user", + "parameters": [ + { + "description": "User revocation request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.RevokeSystemAdminRequest" + } + } + ], + "responses": { + "200": { + "description": "Privileges revoked successfully", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UserInfo" + } + }, + "400": { + "description": "Bad request / would remove last admin / self-revoke", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "Forbidden: not a system admin", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "User not found", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/system/admin/settings": { + "get": { + "description": "Return every row in the system_settings table (system-scope,\nnot tenant-scope). SystemAdmin only.", + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "List all system settings", + "responses": { + "200": { + "description": "list of settings", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SystemSetting" + } + } + }, + "403": { + "description": "Forbidden: not a system admin", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/system/admin/settings/{key}": { + "get": { + "description": "Returns the row matching :key. 404 when the key is unknown\nto the registry; 200 with the row when known.", + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "Get a single system setting by key", + "parameters": [ + { + "type": "string", + "description": "Setting key (e.g. file.max_size_mb)", + "name": "key", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "the setting row", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SystemSetting" + } + }, + "400": { + "description": "Unknown key", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "Key registered but DB row absent", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "description": "Persist a new value for :key. Service validates the\nrawValue against the registry's declared value_type and\nrejects mismatches with 400. SystemAdmin only. Emits an\naudit row (action=system.setting_changed) on success.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "Update a system setting value", + "parameters": [ + { + "type": "string", + "description": "Setting key", + "name": "key", + "in": "path", + "required": true + }, + { + "description": "New value", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.UpdateSystemSettingRequest" + } + } + ], + "responses": { + "200": { + "description": "the updated row", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SystemSetting" + } + }, + "400": { + "description": "Bad request / unknown key / type mismatch", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "Forbidden: not a system admin", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "description": "Removes the DB override for :key so the 3-tier resolver\nfalls back to the environment variable (when configured)\nor the in-code default. Idempotent — resetting a key\nthat was never persisted returns 200.", + "tags": [ + "System Admin" + ], + "summary": "Reset a system setting to ENV / built-in default", + "parameters": [ + { + "type": "string", + "description": "Setting key", + "name": "key", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Reset acknowledged", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "Unknown key", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "DB write failed", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/system/admin/tenants/apply-default-storage-quota": { + "post": { + "description": "Reads the current value of `tenant.default_storage_quota_gb`\n(3-tier resolver: DB \u003e ENV \u003e default) and writes that many\nGiB into storage_quota for every row in tenants. Bypasses\nthe per-tenant PUT whitelist, which forbids storage_quota\nedits by Owners. SystemAdmin only.\nIdempotent — running twice with the same setting is a no-op.", + "produces": [ + "application/json" + ], + "tags": [ + "System Admin" + ], + "summary": "Apply the default storage quota to every existing tenant", + "responses": { + "200": { + "description": "{ affected: int64, quota_bytes: int64 }", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "DB write failed", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/system/docreader/reconnect": { "post": { "consumes": [ @@ -10888,6 +11490,53 @@ } } }, + "/tenants/{id}/invite-links": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "生成一条多次使用的共享邀请链接:谁拿到链接谁就能注册并加入当前租户。\n链接持续有效,直到过期或被撤销。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "租户邀请" + ], + "summary": "生成共享邀请链接", + "parameters": [ + { + "type": "string", + "description": "租户 ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "共享链接配置", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.createInviteLinkRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/tenants/{id}/leave": { "post": { "security": [ @@ -12390,7 +13039,16 @@ "rbac.invitation_accepted", "rbac.invitation_declined", "rbac.invitation_revoked", - "rbac.invitation_expired" + "rbac.invitation_expired", + "vector_store.created", + "vector_store.updated", + "vector_store.deleted", + "opensearch.index_created", + "opensearch.index_deleted", + "opensearch.reindex_executed", + "system.setting_changed", + "system.admin_promoted", + "system.admin_revoked" ], "x-enum-varnames": [ "AuditActionMemberAdded", @@ -12402,7 +13060,16 @@ "AuditActionInvitationAccepted", "AuditActionInvitationDeclined", "AuditActionInvitationRevoked", - "AuditActionInvitationExpired" + "AuditActionInvitationExpired", + "AuditActionVectorStoreCreated", + "AuditActionVectorStoreUpdated", + "AuditActionVectorStoreDeleted", + "AuditActionOpenSearchIndexCreated", + "AuditActionOpenSearchIndexDeleted", + "AuditActionOpenSearchReindexExecuted", + "AuditActionSystemSettingChanged", + "AuditActionSystemAdminPromoted", + "AuditActionSystemAdminRevoked" ] }, "github_com_Tencent_WeKnora_internal_types.AuditLog": { @@ -12573,7 +13240,7 @@ "type": "string" }, "database": { - "description": "Tencent VectorDB and Doris database name.", + "description": "Database name used by engines that support database-level namespaces\n(currently Milvus, Tencent VectorDB, and Doris).", "type": "string" }, "grpc_address": { @@ -12588,6 +13255,10 @@ "description": "Doris: HTTP port for Stream Load API (FE default 8030).\nAddr is reused for the MySQL protocol \"host:9030\"; HTTPPort + the host of Addr\ntogether form the FE HTTP endpoint used by Stream Load.", "type": "integer" }, + "insecure_skip_verify": { + "description": "InsecureSkipVerify disables TLS certificate verification when\ntalking to the backing store over HTTPS. Defaults to false\n(secure). Set to true ONLY for self-signed development clusters;\nproduction deployments should provide trusted certificates via\nthe system CA pool. Cross-driver applicable but currently only\nthe OpenSearch driver (Phase 3) reads this field. Note: this\ndiffers from the Qdrant-specific UseTLS below, which *enables*\nTLS on gRPC connections — InsecureSkipVerify only controls\n*verification* of an already-TLS connection.", + "type": "boolean" + }, "password": { "description": "AES-GCM encrypted", "type": "string" @@ -12774,6 +13445,13 @@ "description": "===== Image Upload / Multimodal Settings =====\nWhether image upload is enabled for this agent (default: false)", "type": "boolean" }, + "intent_prompts": { + "description": "IntentPrompts holds per-intent system prompt overrides for non-retrieval\nintents (greeting, chitchat, etc.). Empty values fall back to templates\nunder config/prompt_templates/intent_prompts.yaml.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "kb_selection_mode": { "description": "===== Knowledge Base Settings =====\nKnowledge base selection mode: \"all\" = all KBs, \"selected\" = specific KBs, \"none\" = no KB", "type": "string" @@ -13319,10 +13997,26 @@ "description": "Weaviate: number of shards per collection", "type": "integer" }, + "hnsw_ef_construction": { + "description": "OpenSearch: HNSW index-build candidate list size", + "type": "integer" + }, + "hnsw_ef_search": { + "description": "OpenSearch: HNSW search candidate list size (faiss; lucene reads at query time)", + "type": "integer" + }, + "hnsw_m": { + "description": "--- OpenSearch k-NN HNSW fields ---\nAll omitempty so other engines' serialized IndexConfig is unchanged.\nZero / empty values fall back to the driver defaults in buildInternalCfg.", + "type": "integer" + }, "index_name": { "description": "--- Existing fields ---", "type": "string" }, + "knn_engine": { + "description": "OpenSearch: k-NN backend (\"lucene\" | \"faiss\")", + "type": "string" + }, "number_of_replicas": { "description": "ES, OpenSearch", "type": "integer" @@ -13562,6 +14256,10 @@ "description": "Parse status of the knowledge", "type": "string" }, + "pending_subtasks_count": { + "description": "PendingSubtasksCount is the outstanding enrichment subtask count\n(summary + question + graph chunks). Only meaningful while\nParseStatus == \"finalizing\"; defaults to 0 in any terminal state.", + "type": "integer" + }, "processed_at": { "description": "Processed time of the knowledge", "type": "string" @@ -14874,6 +15572,48 @@ "mineru_vlm_server_url": { "description": "vLLM 服务器地址 (vlm-http-client / hybrid-http-client)", "type": "string" + }, + "odl_hybrid": { + "description": "OpenDataLoader PDF (docreader engine); hybrid requires opendataloader-pdf-hybrid service.", + "type": "string" + }, + "odl_hybrid_fallback": { + "type": "boolean" + }, + "odl_hybrid_mode": { + "description": "auto, full", + "type": "string" + }, + "odl_hybrid_url": { + "description": "e.g. http://odl-hybrid:5002", + "type": "string" + }, + "odl_markdown_with_html": { + "type": "boolean" + }, + "paddleocr_vl_cloud_model": { + "description": "e.g. PaddleOCR-VL-1.6", + "type": "string" + }, + "paddleocr_vl_cloud_token": { + "description": "PaddleOCR-VL AI Studio cloud API.", + "type": "string" + }, + "paddleocr_vl_cloud_use_chart_recognition": { + "type": "boolean" + }, + "paddleocr_vl_cloud_use_seal_recognition": { + "type": "boolean" + }, + "paddleocr_vl_endpoint": { + "description": "PaddleOCR-VL self-hosted pipeline service (full /layout-parsing API).", + "type": "string" + }, + "paddleocr_vl_use_chart_recognition": { + "type": "boolean" + }, + "paddleocr_vl_use_seal_recognition": { + "type": "boolean" } } }, @@ -15106,7 +15846,8 @@ "weaviate", "doris", "sqlite", - "tencent_vectordb" + "tencent_vectordb", + "opensearch" ], "x-enum-varnames": [ "PostgresRetrieverEngineType", @@ -15118,7 +15859,8 @@ "WeaviateRetrieverEngineType", "DorisRetrieverEngineType", "SQLiteRetrieverEngineType", - "TencentVectorDBRetrieverEngineType" + "TencentVectorDBRetrieverEngineType", + "OpenSearchRetrieverEngineType" ] }, "github_com_Tencent_WeKnora_internal_types.RetrieverEngines": { @@ -15644,6 +16386,62 @@ } } }, + "github_com_Tencent_WeKnora_internal_types.SystemSetting": { + "type": "object", + "properties": { + "category": { + "description": "Category groups settings in the management UI (\"limits\", \"agent\",\n\"auth\", ...). Free-form string so adding a new category is a\ndata-only change.", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "enum": { + "description": "Enum is populated by the service layer (NOT persisted) from the\nin-code registry. Empty/nil means \"free-form input\"; non-empty\nmeans the UI should render a select with these options. Tagged\n`gorm:\"-\"` so GORM never tries to read/write the column.", + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "integer" + }, + "is_secret": { + "description": "IsSecret reserves UI affordances for P3 (mask + reveal-with-confirm).\nIn P1 every row is is_secret=false; service Update accepts the\ncolumn but does not yet enforce special handling.", + "type": "boolean" + }, + "key": { + "type": "string" + }, + "last_modified_by": { + "type": "string" + }, + "last_modified_by_name": { + "description": "LastModifiedByName is a display label resolved from LastModifiedBy\n(the user's UUID) at handler time — username when available,\notherwise email. Empty for virtual rows that were never persisted\n(LastModifiedBy=\"\"). Not stored: derived per request so renaming\na user reflects on the next reload without a backfill job.", + "type": "string" + }, + "requires_restart": { + "description": "RequiresRestart reserves UI affordances for P3 (banner \"this\nchange won't take effect until the next restart\"). In P1 the\nonly seeded key is per-request, so always false.", + "type": "boolean" + }, + "updated_at": { + "type": "string" + }, + "value": { + "type": "array", + "items": { + "type": "integer" + } + }, + "value_type": { + "description": "ValueType is one of \"int\", \"string\", \"bool\". Service layer rejects\nupdates whose payload type does not match; UI uses it to pick\nInputNumber vs Input vs Switch.", + "type": "string" + } + } + }, "github_com_Tencent_WeKnora_internal_types.TOSEngineConfig": { "type": "object", "properties": { @@ -15953,6 +16751,10 @@ "description": "Whether the user is active", "type": "boolean" }, + "is_system_admin": { + "description": "Whether the user is a system administrator (independent of tenant roles)", + "type": "boolean" + }, "preferences": { "description": "Per-user UI/feature preferences (memory toggle, future knobs).\nStored as JSON (jsonb on Postgres, TEXT on SQLite) via the\ndriver.Valuer / sql.Scanner methods on UserPreferences.", "allOf": [ @@ -15983,6 +16785,44 @@ } } }, + "github_com_Tencent_WeKnora_internal_types.UserInfo": { + "type": "object", + "properties": { + "avatar": { + "type": "string" + }, + "can_access_all_tenants": { + "type": "boolean" + }, + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "is_system_admin": { + "type": "boolean" + }, + "preferences": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UserPreferences" + }, + "tenant_id": { + "type": "integer" + }, + "updated_at": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, "github_com_Tencent_WeKnora_internal_types.UserPreferences": { "type": "object", "properties": { @@ -16732,6 +17572,9 @@ "description": { "type": "string" }, + "display_name": { + "type": "string" + }, "name": { "type": "string" }, @@ -16869,6 +17712,14 @@ "minio_enabled": { "type": "boolean" }, + "started_at": { + "description": "StartedAt is the server process boot time (RFC3339, UTC).", + "type": "string" + }, + "uptime_seconds": { + "description": "UptimeSeconds is seconds elapsed since process start.", + "type": "integer" + }, "vector_store_engine": { "type": "string" }, @@ -17222,6 +18073,20 @@ } } }, + "internal_handler.ListSystemAdminsResponse": { + "type": "object", + "properties": { + "admins": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UserInfo" + } + }, + "total": { + "type": "integer" + } + } + }, "internal_handler.ModelTestRequest": { "type": "object", "required": [ @@ -17231,6 +18096,10 @@ "apiKey": { "type": "string" }, + "appSecret": { + "description": "AppSecret 用于 LKEAP Rerank 等需要第二段密钥的场景(对应模型 Parameters.AppSecret)。", + "type": "string" + }, "baseUrl": { "type": "string" }, @@ -17441,6 +18310,17 @@ } } }, + "internal_handler.PromoteUserToSystemAdminRequest": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, "internal_handler.RemoteModelCheckRequest": { "type": "object", "required": [ @@ -17450,6 +18330,10 @@ "apiKey": { "type": "string" }, + "appSecret": { + "description": "AppSecret 用于 LKEAP Rerank 等需要第二段密钥的场景(对应模型 Parameters.AppSecret)。", + "type": "string" + }, "baseUrl": { "type": "string" }, @@ -17487,6 +18371,17 @@ } } }, + "internal_handler.RevokeSystemAdminRequest": { + "type": "object", + "required": [ + "user_id" + ], + "properties": { + "user_id": { + "type": "string" + } + } + }, "internal_handler.SearchMessagesRequest": { "type": "object", "required": [ @@ -17698,6 +18593,9 @@ "description": { "type": "string" }, + "display_name": { + "type": "string" + }, "name": { "type": "string" }, @@ -17740,6 +18638,14 @@ } } }, + "internal_handler.UpdateSystemSettingRequest": { + "type": "object", + "properties": { + "value": { + "description": "Value is intentionally `any` (decoded as float64 / string / bool /\netc. by the JSON unmarshaller). Service.encodeForType normalises\nthese against the registry's declared type and rejects mismatches." + } + } + }, "internal_handler.addMemberRequest": { "type": "object", "required": [ @@ -17805,6 +18711,20 @@ } } }, + "internal_handler.createInviteLinkRequest": { + "type": "object", + "required": [ + "role" + ], + "properties": { + "message": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.TenantRole" + } + } + }, "internal_handler.createTenantRequest": { "type": "object", "required": [ @@ -17822,6 +18742,58 @@ } } }, + "internal_handler.invitationLookupRequest": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string" + } + } + }, + "internal_handler.invitationLookupResponse": { + "type": "object", + "properties": { + "expires_at": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.TenantRole" + }, + "tenant_id": { + "type": "integer" + }, + "tenant_name": { + "type": "string" + } + } + }, + "internal_handler.registerByInviteRequest": { + "type": "object", + "required": [ + "email", + "password", + "token", + "username" + ], + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string", + "minLength": 6 + }, + "token": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, "internal_handler.updateLastFAQImportResultDisplayStatusRequest": { "type": "object", "required": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index a81d9b7e..a916b239 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -259,6 +259,15 @@ definitions: - rbac.invitation_declined - rbac.invitation_revoked - rbac.invitation_expired + - vector_store.created + - vector_store.updated + - vector_store.deleted + - opensearch.index_created + - opensearch.index_deleted + - opensearch.reindex_executed + - system.setting_changed + - system.admin_promoted + - system.admin_revoked type: string x-enum-varnames: - AuditActionMemberAdded @@ -271,6 +280,15 @@ definitions: - AuditActionInvitationDeclined - AuditActionInvitationRevoked - AuditActionInvitationExpired + - AuditActionVectorStoreCreated + - AuditActionVectorStoreUpdated + - AuditActionVectorStoreDeleted + - AuditActionOpenSearchIndexCreated + - AuditActionOpenSearchIndexDeleted + - AuditActionOpenSearchReindexExecuted + - AuditActionSystemSettingChanged + - AuditActionSystemAdminPromoted + - AuditActionSystemAdminRevoked github_com_Tencent_WeKnora_internal_types.AuditLog: properties: action: @@ -410,7 +428,9 @@ definitions: description: AES-GCM encrypted type: string database: - description: Tencent VectorDB and Doris database name. + description: |- + Database name used by engines that support database-level namespaces + (currently Milvus, Tencent VectorDB, and Doris). type: string grpc_address: description: Weaviate @@ -424,6 +444,18 @@ definitions: Addr is reused for the MySQL protocol "host:9030"; HTTPPort + the host of Addr together form the FE HTTP endpoint used by Stream Load. type: integer + insecure_skip_verify: + description: |- + InsecureSkipVerify disables TLS certificate verification when + talking to the backing store over HTTPS. Defaults to false + (secure). Set to true ONLY for self-signed development clusters; + production deployments should provide trusted certificates via + the system CA pool. Cross-driver applicable but currently only + the OpenSearch driver (Phase 3) reads this field. Note: this + differs from the Qdrant-specific UseTLS below, which *enables* + TLS on gRPC connections — InsecureSkipVerify only controls + *verification* of an already-TLS connection. + type: boolean password: description: AES-GCM encrypted type: string @@ -589,6 +621,14 @@ definitions: ===== Image Upload / Multimodal Settings ===== Whether image upload is enabled for this agent (default: false) type: boolean + intent_prompts: + additionalProperties: + type: string + description: |- + IntentPrompts holds per-intent system prompt overrides for non-retrieval + intents (greeting, chitchat, etc.). Empty values fall back to templates + under config/prompt_templates/intent_prompts.yaml. + type: object kb_selection_mode: description: |- ===== Knowledge Base Settings ===== @@ -1007,9 +1047,25 @@ definitions: desired_shard_count: description: 'Weaviate: number of shards per collection' type: integer + hnsw_ef_construction: + description: 'OpenSearch: HNSW index-build candidate list size' + type: integer + hnsw_ef_search: + description: 'OpenSearch: HNSW search candidate list size (faiss; lucene reads + at query time)' + type: integer + hnsw_m: + description: |- + --- OpenSearch k-NN HNSW fields --- + All omitempty so other engines' serialized IndexConfig is unchanged. + Zero / empty values fall back to the driver defaults in buildInternalCfg. + type: integer index_name: description: '--- Existing fields ---' type: string + knn_engine: + description: 'OpenSearch: k-NN backend ("lucene" | "faiss")' + type: string number_of_replicas: description: ES, OpenSearch type: integer @@ -1184,6 +1240,12 @@ definitions: parse_status: description: Parse status of the knowledge type: string + pending_subtasks_count: + description: |- + PendingSubtasksCount is the outstanding enrichment subtask count + (summary + question + graph chunks). Only meaningful while + ParseStatus == "finalizing"; defaults to 0 in any terminal state. + type: integer processed_at: description: Processed time of the knowledge type: string @@ -2160,6 +2222,38 @@ definitions: mineru_vlm_server_url: description: vLLM 服务器地址 (vlm-http-client / hybrid-http-client) type: string + odl_hybrid: + description: OpenDataLoader PDF (docreader engine); hybrid requires opendataloader-pdf-hybrid + service. + type: string + odl_hybrid_fallback: + type: boolean + odl_hybrid_mode: + description: auto, full + type: string + odl_hybrid_url: + description: e.g. http://odl-hybrid:5002 + type: string + odl_markdown_with_html: + type: boolean + paddleocr_vl_cloud_model: + description: e.g. PaddleOCR-VL-1.6 + type: string + paddleocr_vl_cloud_token: + description: PaddleOCR-VL AI Studio cloud API. + type: string + paddleocr_vl_cloud_use_chart_recognition: + type: boolean + paddleocr_vl_cloud_use_seal_recognition: + type: boolean + paddleocr_vl_endpoint: + description: PaddleOCR-VL self-hosted pipeline service (full /layout-parsing + API). + type: string + paddleocr_vl_use_chart_recognition: + type: boolean + paddleocr_vl_use_seal_recognition: + type: boolean type: object github_com_Tencent_WeKnora_internal_types.ParserEngineRule: properties: @@ -2332,6 +2426,7 @@ definitions: - doris - sqlite - tencent_vectordb + - opensearch type: string x-enum-varnames: - PostgresRetrieverEngineType @@ -2344,6 +2439,7 @@ definitions: - DorisRetrieverEngineType - SQLiteRetrieverEngineType - TencentVectorDBRetrieverEngineType + - OpenSearchRetrieverEngineType github_com_Tencent_WeKnora_internal_types.RetrieverEngines: properties: engines: @@ -2731,6 +2827,66 @@ definitions: description: Last update timestamp type: string type: object + github_com_Tencent_WeKnora_internal_types.SystemSetting: + properties: + category: + description: |- + Category groups settings in the management UI ("limits", "agent", + "auth", ...). Free-form string so adding a new category is a + data-only change. + type: string + created_at: + type: string + description: + type: string + enum: + description: |- + Enum is populated by the service layer (NOT persisted) from the + in-code registry. Empty/nil means "free-form input"; non-empty + means the UI should render a select with these options. Tagged + `gorm:"-"` so GORM never tries to read/write the column. + items: + type: string + type: array + id: + type: integer + is_secret: + description: |- + IsSecret reserves UI affordances for P3 (mask + reveal-with-confirm). + In P1 every row is is_secret=false; service Update accepts the + column but does not yet enforce special handling. + type: boolean + key: + type: string + last_modified_by: + type: string + last_modified_by_name: + description: |- + LastModifiedByName is a display label resolved from LastModifiedBy + (the user's UUID) at handler time — username when available, + otherwise email. Empty for virtual rows that were never persisted + (LastModifiedBy=""). Not stored: derived per request so renaming + a user reflects on the next reload without a backfill job. + type: string + requires_restart: + description: |- + RequiresRestart reserves UI affordances for P3 (banner "this + change won't take effect until the next restart"). In P1 the + only seeded key is per-request, so always false. + type: boolean + updated_at: + type: string + value: + items: + type: integer + type: array + value_type: + description: |- + ValueType is one of "int", "string", "bool". Service layer rejects + updates whose payload type does not match; UI uses it to pick + InputNumber vs Input vs Switch. + type: string + type: object github_com_Tencent_WeKnora_internal_types.TOSEngineConfig: properties: access_key: @@ -2941,6 +3097,10 @@ definitions: is_active: description: Whether the user is active type: boolean + is_system_admin: + description: Whether the user is a system administrator (independent of tenant + roles) + type: boolean preferences: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.UserPreferences' @@ -2962,6 +3122,31 @@ definitions: description: Username of the user type: string type: object + github_com_Tencent_WeKnora_internal_types.UserInfo: + properties: + avatar: + type: string + can_access_all_tenants: + type: boolean + created_at: + type: string + email: + type: string + id: + type: string + is_active: + type: boolean + is_system_admin: + type: boolean + preferences: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.UserPreferences' + tenant_id: + type: integer + updated_at: + type: string + username: + type: string + type: object github_com_Tencent_WeKnora_internal_types.UserPreferences: properties: enable_memory: @@ -3548,6 +3733,8 @@ definitions: properties: description: type: string + display_name: + type: string name: type: string parameters: @@ -3649,6 +3836,12 @@ definitions: type: string minio_enabled: type: boolean + started_at: + description: StartedAt is the server process boot time (RFC3339, UTC). + type: string + uptime_seconds: + description: UptimeSeconds is seconds elapsed since process start. + type: integer vector_store_engine: type: string version: @@ -3889,10 +4082,22 @@ definitions: required: - llmModelId type: object + internal_handler.ListSystemAdminsResponse: + properties: + admins: + items: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.UserInfo' + type: array + total: + type: integer + type: object internal_handler.ModelTestRequest: properties: apiKey: type: string + appSecret: + description: AppSecret 用于 LKEAP Rerank 等需要第二段密钥的场景(对应模型 Parameters.AppSecret)。 + type: string baseUrl: type: string customHeaders: @@ -4045,10 +4250,20 @@ definitions: response was truncated to previewMaxChunks for transport. type: integer type: object + internal_handler.PromoteUserToSystemAdminRequest: + properties: + email: + type: string + user_id: + type: string + type: object internal_handler.RemoteModelCheckRequest: properties: apiKey: type: string + appSecret: + description: AppSecret 用于 LKEAP Rerank 等需要第二段密钥的场景(对应模型 Parameters.AppSecret)。 + type: string baseUrl: type: string customHeaders: @@ -4084,6 +4299,13 @@ definitions: required: - modelName type: object + internal_handler.RevokeSystemAdminRequest: + properties: + user_id: + type: string + required: + - user_id + type: object internal_handler.SearchMessagesRequest: properties: limit: @@ -4225,6 +4447,8 @@ definitions: properties: description: type: string + display_name: + type: string name: type: string parameters: @@ -4252,6 +4476,14 @@ definitions: required: - name type: object + internal_handler.UpdateSystemSettingRequest: + properties: + value: + description: |- + Value is intentionally `any` (decoded as float64 / string / bool / + etc. by the JSON unmarshaller). Service.encodeForType normalises + these against the registry's declared type and rejects mismatches. + type: object internal_handler.addMemberRequest: properties: email: @@ -4295,6 +4527,15 @@ definitions: - email - role type: object + internal_handler.createInviteLinkRequest: + properties: + message: + type: string + role: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.TenantRole' + required: + - role + type: object internal_handler.createTenantRequest: properties: description: @@ -4307,6 +4548,41 @@ definitions: required: - name type: object + internal_handler.invitationLookupRequest: + properties: + token: + type: string + required: + - token + type: object + internal_handler.invitationLookupResponse: + properties: + expires_at: + type: string + role: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.TenantRole' + tenant_id: + type: integer + tenant_name: + type: string + type: object + internal_handler.registerByInviteRequest: + properties: + email: + type: string + password: + minLength: 6 + type: string + token: + type: string + username: + type: string + required: + - email + - password + - token + - username + type: object internal_handler.updateLastFAQImportResultDisplayStatusRequest: properties: display_status: @@ -4854,6 +5130,33 @@ paths: summary: 获取智能体类型预设列表 tags: - 智能体 + /api/v1/knowledge/{id}/spans: + get: + consumes: + - application/json + description: 返回该知识在解析流水线的 trace tree(root → stage → subspan):每段状态、耗时、input/output、错误码、langfuse_trace_id。支持 + ?attempt=N 查看历史尝试;不传则返回最新尝试。前端用于渲染时间线 + 多模态/embedding 子节点 + 一键跳转 Langfuse。 + parameters: + - description: 知识ID + in: path + name: id + required: true + type: string + - description: 指定尝试号;省略=最新 + in: query + name: attempt + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + summary: 获取知识文档解析的 Span 树(含历史尝试) + tags: + - 知识管理 /auth/auto-setup: post: consumes: @@ -4923,6 +5226,35 @@ paths: summary: 获取认证配置 tags: - 认证 + /auth/invitations/lookup: + post: + consumes: + - application/json + description: |- + 根据邀请链接中的 token 返回邀请上下文(租户名 / 角色 / 过期时间), + 供注册页展示。无认证;token 无效或被撤销返回 410。 + 使用 POST + body 而非 GET + path,避免 token 落入访问日志 / 浏览器历史 / tracing。 + parameters: + - description: 邀请 token + in: body + name: request + required: true + schema: + $ref: '#/definitions/internal_handler.invitationLookupRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/internal_handler.invitationLookupResponse' + "410": + description: 链接无效或已撤销 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + summary: 解析共享邀请链接 token + tags: + - 认证 /auth/login: post: consumes: @@ -5158,6 +5490,42 @@ paths: summary: 用户注册 tags: - 认证 + /auth/register-by-invite: + post: + consumes: + - application/json + description: |- + 通过 Owner 生成的共享邀请链接 token 完成注册,绕过 invite_only 模式拦截。 + 注册者自填邮箱(与 token 不绑定);注册成功后自动加入对应租户。 + parameters: + - description: 邀请注册请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/internal_handler.registerByInviteRequest' + produces: + - application/json + responses: + "201": + description: Created + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse' + "400": + description: 请求参数错误 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + "409": + description: 邮箱已注册 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + "410": + description: 链接无效或已撤销 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + summary: 使用共享链接注册 + tags: + - 认证 /auth/switch-tenant: post: consumes: @@ -7994,6 +8362,44 @@ paths: summary: 更新知识 tags: - 知识管理 + /knowledge/{id}/cancel-parse: + post: + consumes: + - application/json + description: 取消进行中的知识解析任务。当前已写入的 chunk / 索引保留,可通过 reparse 接口重新触发解析。已完成 / 已失败 + / 删除中的知识不支持取消。 + parameters: + - description: 知识ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 取消已提交 + schema: + additionalProperties: true + type: object + "400": + description: 状态不支持取消 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + "403": + description: 权限不足 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + "404": + description: 知识不存在 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + security: + - Bearer: [] + - ApiKeyAuth: [] + summary: 取消知识解析 + tags: + - 知识管理 /knowledge/{id}/download: get: consumes: @@ -10803,6 +11209,312 @@ paths: summary: 获取预装Skills列表 tags: - Skills + /system/admin/audit-log: + get: + description: 返回 system-scope(tenant_id=0)的审计事件,覆盖 system.setting_changed / system.admin_promoted + / system.admin_revoked 等 SystemAdmin 操作。按 id 倒序的游标分页。 + parameters: + - description: 游标:返回 id 小于此值的记录(默认从最新开始) + in: query + name: after_id + type: integer + - description: 页大小,1-100,默认 50 + in: query + name: limit + type: integer + - description: 按 action 精确过滤(如 system.setting_changed) + in: query + name: action + type: string + - description: 按 outcome 精确过滤(success / denied) + in: query + name: outcome + type: string + - description: 按 actor_user_id 精确过滤 + in: query + name: actor + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/internal_handler.auditLogListResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + security: + - Bearer: [] + - ApiKeyAuth: [] + summary: 获取平台审计日志 + tags: + - 审计日志 + /system/admin/list: + get: + description: |- + Retrieve a paginated list of users with system administrator + privileges (SystemAdmin only). Supports `offset` (default 0) + and `limit` (default 50, max 200) query parameters. Walks the + partial-friendly idx_users_is_system_admin index. + parameters: + - default: 0 + description: Page offset + in: query + name: offset + type: integer + - default: 50 + description: Page size (max 200) + in: query + name: limit + type: integer + produces: + - application/json + responses: + "200": + description: System admins retrieved successfully + schema: + $ref: '#/definitions/internal_handler.ListSystemAdminsResponse' + "403": + description: 'Forbidden: not a system admin' + schema: + additionalProperties: true + type: object + summary: List all system administrators + tags: + - System Admin + /system/admin/promote: + post: + consumes: + - application/json + description: |- + Grant system administrator privileges to a user (SystemAdmin only). + Idempotent: re-promoting an existing system admin returns 200 with no DB write. + Identify the user by email (preferred for human operators) or user_id (UUID, for API clients). + parameters: + - description: User promotion request + in: body + name: request + required: true + schema: + $ref: '#/definitions/internal_handler.PromoteUserToSystemAdminRequest' + produces: + - application/json + responses: + "200": + description: User promoted successfully + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.UserInfo' + "400": + description: Bad request + schema: + additionalProperties: true + type: object + "403": + description: 'Forbidden: not a system admin' + schema: + additionalProperties: true + type: object + "404": + description: User not found + schema: + additionalProperties: true + type: object + summary: Promote a user to system administrator + tags: + - System Admin + /system/admin/revoke: + post: + consumes: + - application/json + description: |- + Remove system administrator privileges from a user (SystemAdmin only). + Two safety guards: the caller cannot revoke their own privileges, + and revoking the last remaining system admin is rejected — both + prevent a SystemAdmin from accidentally locking the platform out + of system-level administration. Idempotent on already-non-admin users. + parameters: + - description: User revocation request + in: body + name: request + required: true + schema: + $ref: '#/definitions/internal_handler.RevokeSystemAdminRequest' + produces: + - application/json + responses: + "200": + description: Privileges revoked successfully + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.UserInfo' + "400": + description: Bad request / would remove last admin / self-revoke + schema: + additionalProperties: true + type: object + "403": + description: 'Forbidden: not a system admin' + schema: + additionalProperties: true + type: object + "404": + description: User not found + schema: + additionalProperties: true + type: object + summary: Revoke system administrator privileges from a user + tags: + - System Admin + /system/admin/settings: + get: + description: |- + Return every row in the system_settings table (system-scope, + not tenant-scope). SystemAdmin only. + produces: + - application/json + responses: + "200": + description: list of settings + schema: + items: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SystemSetting' + type: array + "403": + description: 'Forbidden: not a system admin' + schema: + additionalProperties: true + type: object + summary: List all system settings + tags: + - System Admin + /system/admin/settings/{key}: + delete: + description: |- + Removes the DB override for :key so the 3-tier resolver + falls back to the environment variable (when configured) + or the in-code default. Idempotent — resetting a key + that was never persisted returns 200. + parameters: + - description: Setting key + in: path + name: key + required: true + type: string + responses: + "200": + description: Reset acknowledged + schema: + additionalProperties: true + type: object + "400": + description: Unknown key + schema: + additionalProperties: true + type: object + "500": + description: DB write failed + schema: + additionalProperties: true + type: object + summary: Reset a system setting to ENV / built-in default + tags: + - System Admin + get: + description: |- + Returns the row matching :key. 404 when the key is unknown + to the registry; 200 with the row when known. + parameters: + - description: Setting key (e.g. file.max_size_mb) + in: path + name: key + required: true + type: string + produces: + - application/json + responses: + "200": + description: the setting row + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SystemSetting' + "400": + description: Unknown key + schema: + additionalProperties: true + type: object + "404": + description: Key registered but DB row absent + schema: + additionalProperties: true + type: object + summary: Get a single system setting by key + tags: + - System Admin + put: + consumes: + - application/json + description: |- + Persist a new value for :key. Service validates the + rawValue against the registry's declared value_type and + rejects mismatches with 400. SystemAdmin only. Emits an + audit row (action=system.setting_changed) on success. + parameters: + - description: Setting key + in: path + name: key + required: true + type: string + - description: New value + in: body + name: request + required: true + schema: + $ref: '#/definitions/internal_handler.UpdateSystemSettingRequest' + produces: + - application/json + responses: + "200": + description: the updated row + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SystemSetting' + "400": + description: Bad request / unknown key / type mismatch + schema: + additionalProperties: true + type: object + "403": + description: 'Forbidden: not a system admin' + schema: + additionalProperties: true + type: object + summary: Update a system setting value + tags: + - System Admin + /system/admin/tenants/apply-default-storage-quota: + post: + description: |- + Reads the current value of `tenant.default_storage_quota_gb` + (3-tier resolver: DB > ENV > default) and writes that many + GiB into storage_quota for every row in tenants. Bypasses + the per-tenant PUT whitelist, which forbids storage_quota + edits by Owners. SystemAdmin only. + Idempotent — running twice with the same setting is a no-op. + produces: + - application/json + responses: + "200": + description: '{ affected: int64, quota_bytes: int64 }' + schema: + additionalProperties: true + type: object + "500": + description: DB write failed + schema: + additionalProperties: true + type: object + summary: Apply the default storage quota to every existing tenant + tags: + - System Admin /system/docreader/reconnect: post: consumes: @@ -11220,6 +11932,38 @@ paths: summary: 撤销待接受邀请 tags: - 租户邀请 + /tenants/{id}/invite-links: + post: + consumes: + - application/json + description: |- + 生成一条多次使用的共享邀请链接:谁拿到链接谁就能注册并加入当前租户。 + 链接持续有效,直到过期或被撤销。 + parameters: + - description: 租户 ID + in: path + name: id + required: true + type: string + - description: 共享链接配置 + in: body + name: request + required: true + schema: + $ref: '#/definitions/internal_handler.createInviteLinkRequest' + produces: + - application/json + responses: + "201": + description: Created + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 生成共享邀请链接 + tags: + - 租户邀请 /tenants/{id}/leave: post: description: 调用方主动退出当前租户。等价于以自己的 user_id 调 RemoveMember, diff --git a/frontend/package.json b/frontend/package.json index d942a9a8..6e3230e2 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "knowledage-base", - "version": "0.6.0", + "version": "0.6.1", "private": true, "type": "module", "scripts": { diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 03e6c8f1..458508b9 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -5,7 +5,7 @@ description: | with document parsing, vector search, and LLM integration. type: application version: 0.1.0 -appVersion: "v0.6.0" +appVersion: "v0.6.1" kubeVersion: ">=1.25.0-0" home: https://github.com/Tencent/WeKnora icon: https://raw.githubusercontent.com/Tencent/WeKnora/main/docs/images/logo.png diff --git a/internal/handler/auth_register_by_invite.go b/internal/handler/auth_register_by_invite.go index 86d15cfb..1ce358e6 100644 --- a/internal/handler/auth_register_by_invite.go +++ b/internal/handler/auth_register_by_invite.go @@ -56,7 +56,7 @@ type invitationLookupRequest struct { // @Produce json // @Param request body invitationLookupRequest true "邀请 token" // @Success 200 {object} invitationLookupResponse -// @Failure 410 {object} errors.AppError "链接无效或已撤销" +// @Failure 410 {object} apperrors.AppError "链接无效或已撤销" // @Router /auth/invitations/lookup [post] func (h *AuthHandler) LookupInvitationByToken(c *gin.Context) { ctx := c.Request.Context() @@ -112,9 +112,9 @@ func (h *AuthHandler) LookupInvitationByToken(c *gin.Context) { // @Produce json // @Param request body registerByInviteRequest true "邀请注册请求" // @Success 201 {object} types.LoginResponse -// @Failure 400 {object} errors.AppError "请求参数错误" -// @Failure 409 {object} errors.AppError "邮箱已注册" -// @Failure 410 {object} errors.AppError "链接无效或已撤销" +// @Failure 400 {object} apperrors.AppError "请求参数错误" +// @Failure 409 {object} apperrors.AppError "邮箱已注册" +// @Failure 410 {object} apperrors.AppError "链接无效或已撤销" // @Router /auth/register-by-invite [post] // // RegisterByInvite is intentionally NOT subject to the invite_only gate: