{ "swagger": "2.0", "info": { "description": "WeKnora 知识库管理系统 API 文档", "title": "WeKnora API", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "WeKnora Github", "url": "https://github.com/Tencent/WeKnora" }, "version": "1.0" }, "basePath": "/api/v1", "paths": { "/agent/mcp-oauth-resolutions/{pending_id}": { "post": { "security": [ { "Bearer": [] } ], "description": "用户在对话中完成 OAuth 授权后调用,校验令牌存在后恢复被暂停的 Agent 工具调用", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "完成对话内 MCP OAuth 授权", "parameters": [ { "type": "string", "description": "待授权 ID", "name": "pending_id", "in": "path", "required": true }, { "description": "{service_id: string}", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "409": { "description": "用户尚未完成授权", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/agent/mcp-oauth-resolutions/{pending_id}/cancel": { "post": { "security": [ { "Bearer": [] } ], "description": "用户主动跳过 OAuth 授权,解除 Agent 阻塞", "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "跳过对话内 MCP OAuth 授权", "parameters": [ { "type": "string", "description": "待授权 ID", "name": "pending_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/agent/tool-approvals/{pending_id}": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "用户审批通过或驳回一次工具调用(用于 Agent 阻塞等待审批的场景)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "处理 MCP 工具调用待审批请求", "parameters": [ { "type": "string", "description": "待审批记录 ID", "name": "pending_id", "in": "path", "required": true }, { "description": "{decision: \\", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } } ], "responses": { "200": { "description": "审批结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "待审批记录不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/agents": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取当前空间的所有智能体(包括内置智能体)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "智能体" ], "summary": "获取智能体列表", "responses": { "200": { "description": "智能体列表", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "创建新的自定义智能体", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "智能体" ], "summary": "创建智能体", "parameters": [ { "description": "智能体信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.CreateAgentRequest" } } ], "responses": { "201": { "description": "创建的智能体", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/agents/placeholders": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取所有可用的提示词占位符定义,按字段类型分组", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "智能体" ], "summary": "获取占位符定义", "responses": { "200": { "description": "占位符定义", "schema": { "type": "object", "additionalProperties": true } } } } }, "/agents/type-presets": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "返回所有 smart-reasoning 下可用的智能体类型预设(RAG/Wiki/Hybrid/Custom),用于编辑器自动填充系统提示词、工具和 KB 兼容性", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "智能体" ], "summary": "获取智能体类型预设列表", "responses": { "200": { "description": "预设列表", "schema": { "type": "object", "additionalProperties": true } } } } }, "/agents/{id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据ID获取智能体详情", "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" } }, "404": { "description": "智能体不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新智能体的名称、描述和配置", "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.UpdateAgentRequest" } } ], "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" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除指定的智能体", "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" } } } } }, "/agents/{id}/copy": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "复制指定的智能体", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "智能体" ], "summary": "复制智能体", "parameters": [ { "type": "string", "description": "智能体ID", "name": "id", "in": "path", "required": true } ], "responses": { "201": { "description": "复制成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "智能体不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/agents/{id}/shares/{share_id}": { "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "从智能体的共享列表中移除指定共享关系", "produces": [ "application/json" ], "tags": [ "组织" ], "summary": "取消智能体共享", "parameters": [ { "type": "string", "description": "智能体 ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "共享记录 ID", "name": "share_id", "in": "path", "required": true } ], "responses": { "200": { "description": "success: true", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/agents/{id}/suggested-questions": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "基于智能体关联的知识库,返回推荐问题供用户快捷提问", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "智能体" ], "summary": "获取推荐问题", "parameters": [ { "type": "string", "description": "智能体ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "知识库ID列表(逗号分隔),覆盖智能体默认配置", "name": "knowledge_base_ids", "in": "query" }, { "type": "string", "description": "知识ID列表(逗号分隔),限定到具体文档", "name": "knowledge_ids", "in": "query" }, { "type": "string", "description": "带知识库归属的标签范围(JSON)", "name": "tag_scopes", "in": "query" }, { "type": "integer", "description": "返回数量上限(未传时使用智能体配置的开场问题数量,最大30)", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "推荐问题列表", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "智能体不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/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 版专用:首次启动时自动创建默认用户和空间并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "自动初始化(Lite 桌面版)", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse" } }, "403": { "description": "非 Lite 版本", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/auth/change-password": { "post": { "security": [ { "Bearer": [] } ], "description": "修改当前用户的登录密码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "修改密码", "parameters": [ { "description": "密码修改请求", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "properties": { "new_password": { "type": "string" }, "old_password": { "type": "string" } } } } ], "responses": { "200": { "description": "修改成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/auth/config": { "get": { "description": "返回当前部署的注册模式等公开认证配置,供前端决定是否展示注册入口", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "获取认证配置", "responses": { "200": { "description": "认证配置", "schema": { "type": "object", "additionalProperties": true } } } } }, "/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": "用户登录并获取访问令牌", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "用户登录", "parameters": [ { "description": "登录请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse" } }, "401": { "description": "认证失败", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/auth/logout": { "post": { "security": [ { "Bearer": [] } ], "description": "撤销当前访问令牌并登出", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "用户登出", "responses": { "200": { "description": "登出成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/auth/me": { "get": { "security": [ { "Bearer": [] } ], "description": "获取当前登录用户的详细信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "获取当前用户信息", "responses": { "200": { "description": "用户信息", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "未授权", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/auth/me/preferences": { "put": { "security": [ { "Bearer": [] } ], "description": "按 PATCH 语义合并用户偏好(仅覆盖请求体里出现的字段,其余字段保持不变),\n数据存放在 users.preferences (JSON),跨设备/浏览器自动同步。", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "更新当前用户的个性化设置", "parameters": [ { "description": "Preferences patch", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.updateMyPreferencesRequest" } } ], "responses": { "200": { "description": "更新后的偏好", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "401": { "description": "未授权", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/auth/oidc/callback": { "get": { "description": "接收OIDC provider回调并由后端完成code交换,随后重定向回前端登录页", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "OIDC登录重定向回调", "parameters": [ { "type": "string", "description": "OIDC授权码", "name": "code", "in": "query" }, { "type": "string", "description": "OIDC状态", "name": "state", "in": "query" }, { "type": "string", "description": "OIDC错误码", "name": "error", "in": "query" } ], "responses": { "302": { "description": "Found" } } } }, "/auth/oidc/config": { "get": { "description": "返回OIDC是否启用以及provider展示名称,供前端决定是否展示OIDC登录入口", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "获取OIDC登录配置", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCConfigResponse" } } } } }, "/auth/oidc/url": { "get": { "description": "根据后端OIDC配置生成第三方登录跳转地址", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "获取OIDC授权地址", "parameters": [ { "type": "string", "description": "OIDC回调地址", "name": "redirect_uri", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCAuthURLResponse" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "403": { "description": "OIDC未启用", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/auth/refresh": { "post": { "description": "使用刷新令牌获取新的访问令牌", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "刷新令牌", "parameters": [ { "description": "刷新令牌", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "properties": { "refreshToken": { "type": "string" } } } } ], "responses": { "200": { "description": "新令牌", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "令牌无效", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/auth/register": { "post": { "description": "注册新用户账号", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "用户注册", "parameters": [ { "description": "注册请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterResponse" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "403": { "description": "注册功能已禁用", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/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": [ { "Bearer": [] } ], "description": "为当前用户在目标空间重新签发访问令牌;要求该用户在目标空间存在 active 成员关系", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "切换激活空间", "parameters": [ { "description": "切换请求", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "properties": { "refresh_token": { "type": "string" }, "tenant_id": { "type": "integer" } } } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "403": { "description": "无该空间成员关系", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/auth/validate": { "get": { "security": [ { "Bearer": [] } ], "description": "验证访问令牌是否有效", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "验证令牌", "responses": { "200": { "description": "令牌有效", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "令牌无效", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/chunker/preview": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "对提交的文本运行自适应分块器并返回分块预览,不写入数据库不生成 embedding。文本最大 64k 字符", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "分块" ], "summary": "预览分块结果", "parameters": [ { "description": "{text, chunking_config}", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.PreviewChunkingRequest" } } ], "responses": { "200": { "description": "分块结果", "schema": { "$ref": "#/definitions/internal_handler.PreviewChunkingResponse" } }, "400": { "description": "请求参数错误", "schema": { "type": "object", "additionalProperties": true } }, "413": { "description": "文本超过预览限制", "schema": { "type": "object", "additionalProperties": true } }, "504": { "description": "分块超时", "schema": { "type": "object", "additionalProperties": true } } } } }, "/chunks/by-id/{id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "仅通过分块ID获取分块详情(不需要knowledge_id);支持共享知识库下的分块访问", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "分块管理" ], "summary": "通过ID获取分块", "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" } }, "404": { "description": "分块不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/chunks/by-id/{id}/questions": { "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除分块中生成的问题", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "分块管理" ], "summary": "删除生成的问题", "parameters": [ { "type": "string", "description": "分块ID", "name": "id", "in": "path", "required": true }, { "description": "问题ID", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "properties": { "question_id": { "type": "string" } } } } ], "responses": { "200": { "description": "删除成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "分块不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/chunks/{knowledge_id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取指定知识下的所有分块列表,支持分页", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "分块管理" ], "summary": "获取知识分块列表", "parameters": [ { "type": "string", "description": "知识ID", "name": "knowledge_id", "in": "path", "required": true }, { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "分块列表", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除指定知识下的所有分块", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "分块管理" ], "summary": "删除知识下所有分块", "parameters": [ { "type": "string", "description": "知识ID", "name": "knowledge_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" } } } } }, "/chunks/{knowledge_id}/{id}": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新指定分块的内容和属性", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "分块管理" ], "summary": "更新分块", "parameters": [ { "type": "string", "description": "知识ID", "name": "knowledge_id", "in": "path", "required": true }, { "type": "string", "description": "分块ID", "name": "id", "in": "path", "required": true }, { "description": "更新请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.UpdateChunkRequest" } } ], "responses": { "200": { "description": "更新后的分块", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "分块不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除指定的分块", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "分块管理" ], "summary": "删除分块", "parameters": [ { "type": "string", "description": "知识ID", "name": "knowledge_id", "in": "path", "required": true }, { "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" } }, "404": { "description": "分块不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/datasource": { "get": { "description": "List all data sources for a specific knowledge base", "produces": [ "application/json" ], "tags": [ "DataSource" ], "summary": "List data sources for a knowledge base", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "post": { "description": "Create a new data source configuration for a knowledge base", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "DataSource" ], "summary": "Create a new data source", "parameters": [ { "description": "Data source configuration", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource" } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/datasource/logs/{log_id}": { "get": { "description": "Retrieve a specific sync log entry", "produces": [ "application/json" ], "tags": [ "DataSource" ], "summary": "Get specific sync log", "parameters": [ { "type": "string", "description": "Sync log ID", "name": "log_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog" } }, "404": { "description": "Not Found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/datasource/types": { "get": { "description": "Get list of available data source connectors", "produces": [ "application/json" ], "tags": [ "DataSource" ], "summary": "Get available connectors", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_datasource.ConnectorMetadata" } } } } } }, "/datasource/validate-credentials": { "post": { "description": "Validate connectivity to an external data source using type + credentials", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "DataSource" ], "summary": "Test connection with raw credentials (no persistence)", "parameters": [ { "description": "type and credentials", "name": "request", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/datasource/{id}": { "get": { "description": "Retrieve a data source configuration by ID", "produces": [ "application/json" ], "tags": [ "DataSource" ], "summary": "Get a data source by ID", "parameters": [ { "type": "string", "description": "Data source ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource" } }, "404": { "description": "Not Found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "put": { "description": "Update an existing data source configuration", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "DataSource" ], "summary": "Update a data source", "parameters": [ { "type": "string", "description": "Data source ID", "name": "id", "in": "path", "required": true }, { "description": "Updated configuration", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource" } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "delete": { "description": "Delete a data source (soft delete)", "tags": [ "DataSource" ], "summary": "Delete a data source", "parameters": [ { "type": "string", "description": "Data source ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "404": { "description": "Not Found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/datasource/{id}/logs": { "get": { "description": "Retrieve sync history for a data source", "produces": [ "application/json" ], "tags": [ "DataSource" ], "summary": "Get sync logs", "parameters": [ { "type": "string", "description": "Data source ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "Limit (default: 10)", "name": "limit", "in": "query" }, { "type": "integer", "description": "Offset (default: 0)", "name": "offset", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/datasource/{id}/pause": { "post": { "description": "Pause a data source's scheduled syncs", "tags": [ "DataSource" ], "summary": "Pause data source", "parameters": [ { "type": "string", "description": "Data source ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/datasource/{id}/resource-ancestors": { "post": { "description": "Resolve the ancestor ExternalIDs that must be expanded to reveal the given (possibly deeply nested) resources in a lazily-loaded picker. Used to restore an existing selection when editing a data source.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "DataSource" ], "summary": "Resolve resource ancestors", "parameters": [ { "type": "string", "description": "Data source ID", "name": "id", "in": "path", "required": true }, { "description": "Resource IDs to resolve", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.resolveAncestorsRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/datasource/{id}/resources": { "get": { "description": "List resources available for sync in the external system. Pass parent_id to lazily load the direct children of a resource (used for large hierarchical sources such as Feishu wiki).", "produces": [ "application/json" ], "tags": [ "DataSource" ], "summary": "List available resources in data source", "parameters": [ { "type": "string", "description": "Data source ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "Parent resource ExternalID; empty lists the top level", "name": "parent_id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Resource" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/datasource/{id}/resume": { "post": { "description": "Resume a paused data source", "tags": [ "DataSource" ], "summary": "Resume data source", "parameters": [ { "type": "string", "description": "Data source ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/datasource/{id}/sync": { "post": { "description": "Trigger an immediate sync for a data source", "tags": [ "DataSource" ], "summary": "Trigger immediate sync", "parameters": [ { "type": "string", "description": "Data source ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog" } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/datasource/{id}/validate": { "post": { "description": "Validate the connection to an external data source", "tags": [ "DataSource" ], "summary": "Test data source connection", "parameters": [ { "type": "string", "description": "Data source ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/evaluation/": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据任务ID获取评估结果", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "评估" ], "summary": "获取评估结果", "parameters": [ { "type": "string", "description": "评估任务ID", "name": "task_id", "in": "query", "required": true } ], "responses": { "200": { "description": "评估结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "对知识库进行评估测试", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "评估" ], "summary": "执行评估", "parameters": [ { "description": "评估请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.EvaluationRequest" } } ], "responses": { "200": { "description": "评估任务", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/faq/import/progress/{task_id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取FAQ导入任务的进度", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "获取FAQ导入进度", "parameters": [ { "type": "string", "description": "任务ID", "name": "task_id", "in": "path", "required": true } ], "responses": { "200": { "description": "导入进度", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "任务不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/im-channels/{id}": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新指定 IM 渠道的名称、模式、知识库、凭证或启用状态", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "IM 渠道" ], "summary": "更新 IM 渠道", "parameters": [ { "type": "string", "description": "渠道 ID", "name": "id", "in": "path", "required": true }, { "description": "更新字段(name/mode/output_mode/knowledge_base_id/credentials/enabled)", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } } ], "responses": { "200": { "description": "更新后的渠道", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "渠道不存在", "schema": { "type": "object", "additionalProperties": true } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除指定 IM 渠道", "produces": [ "application/json" ], "tags": [ "IM 渠道" ], "summary": "删除 IM 渠道", "parameters": [ { "type": "string", "description": "渠道 ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "success: true", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "渠道不存在", "schema": { "type": "object", "additionalProperties": true } } } } }, "/im-channels/{id}/toggle": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "切换指定 IM 渠道的启用状态", "produces": [ "application/json" ], "tags": [ "IM 渠道" ], "summary": "启用/停用 IM 渠道", "parameters": [ { "type": "string", "description": "渠道 ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "更新后的渠道", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "渠道不存在", "schema": { "type": "object", "additionalProperties": true } } } } }, "/im/callback/{channel_id}": { "get": { "description": "接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "IM 回调" ], "summary": "IM 平台回调", "parameters": [ { "type": "string", "description": "渠道 ID", "name": "channel_id", "in": "path", "required": true } ], "responses": { "200": { "description": "处理结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "签名校验失败", "schema": { "type": "object", "additionalProperties": true } } } }, "post": { "description": "接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "IM 回调" ], "summary": "IM 平台回调", "parameters": [ { "type": "string", "description": "渠道 ID", "name": "channel_id", "in": "path", "required": true } ], "responses": { "200": { "description": "处理结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "签名校验失败", "schema": { "type": "object", "additionalProperties": true } } } } }, "/initialization/asr/check": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "检查ASR(语音识别)模型连接是否正常,通过发送一段静默音频测试 /v1/audio/transcriptions 端点", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "检查ASR模型", "parameters": [ { "description": "ASR检查请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.ModelTestRequest" } } ], "responses": { "200": { "description": "检查结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/config/{kbId}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据知识库ID获取当前配置信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "获取知识库配置", "parameters": [ { "type": "string", "description": "知识库ID", "name": "kbId", "in": "path", "required": true } ], "responses": { "200": { "description": "配置信息", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "知识库不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据知识库ID更新模型和分块配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "更新知识库配置", "parameters": [ { "type": "string", "description": "知识库ID", "name": "kbId", "in": "path", "required": true }, { "description": "配置请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.KBModelConfigRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "知识库不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/embedding/test": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "测试Embedding接口是否可用并返回向量维度", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "测试Embedding模型", "parameters": [ { "description": "Embedding测试请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.ModelTestRequest" } } ], "responses": { "200": { "description": "测试结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/extract/fabri-tag": { "post": { "description": "随机生成一组标签", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "生成随机标签", "responses": { "200": { "description": "生成的标签", "schema": { "type": "object", "additionalProperties": true } } } } }, "/initialization/extract/fabri-text": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据标签生成示例文本", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "生成示例文本", "parameters": [ { "description": "生成请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.FabriTextRequest" } } ], "responses": { "200": { "description": "生成的文本", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/extract/text-relation": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "从文本中提取实体和关系", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "提取文本关系", "parameters": [ { "description": "提取请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.TextRelationExtractionRequest" } } ], "responses": { "200": { "description": "提取结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/initialize/{kbId}": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据知识库ID执行完整配置更新", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "初始化知识库配置", "parameters": [ { "type": "string", "description": "知识库ID", "name": "kbId", "in": "path", "required": true }, { "description": "初始化请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.InitializationRequest" } } ], "responses": { "200": { "description": "初始化成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/multimodal/test": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "上传图片测试多模态处理功能", "consumes": [ "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "测试多模态功能", "parameters": [ { "type": "file", "description": "测试图片", "name": "image", "in": "formData", "required": true }, { "type": "string", "description": "VLM模型名称", "name": "vlm_model", "in": "formData", "required": true }, { "type": "string", "description": "VLM Base URL", "name": "vlm_base_url", "in": "formData", "required": true }, { "type": "string", "description": "VLM API Key", "name": "vlm_api_key", "in": "formData" }, { "type": "string", "description": "VLM接口类型", "name": "vlm_interface_type", "in": "formData" }, { "type": "string", "description": "存储类型(cos/minio)", "name": "storage_type", "in": "formData", "required": true } ], "responses": { "200": { "description": "测试结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/ollama/download/progress/{taskId}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取Ollama模型下载任务的进度", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "获取下载进度", "parameters": [ { "type": "string", "description": "任务ID", "name": "taskId", "in": "path", "required": true } ], "responses": { "200": { "description": "下载进度", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "任务不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/ollama/download/tasks": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "列出所有Ollama模型下载任务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "列出下载任务", "responses": { "200": { "description": "任务列表", "schema": { "type": "object", "additionalProperties": true } } } } }, "/initialization/ollama/models": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "列出已安装的Ollama模型", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "列出Ollama模型", "responses": { "200": { "description": "模型列表", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/ollama/models/check": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "检查指定的Ollama模型是否已安装", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "检查Ollama模型状态", "parameters": [ { "description": "模型名称列表", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "string" } } } } } ], "responses": { "200": { "description": "模型状态", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/ollama/models/download": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "异步下载指定的Ollama模型", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "下载Ollama模型", "parameters": [ { "description": "模型名称", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "properties": { "modelName": { "type": "string" } } } } ], "responses": { "200": { "description": "下载任务信息", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/ollama/status": { "get": { "description": "检查Ollama服务是否可用", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "检查Ollama服务状态", "responses": { "200": { "description": "Ollama状态", "schema": { "type": "object", "additionalProperties": true } } } } }, "/initialization/remote/check": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "检查远程API模型连接是否正常", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "检查远程模型", "parameters": [ { "description": "模型检查请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.RemoteModelCheckRequest" } } ], "responses": { "200": { "description": "检查结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/initialization/rerank/check": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "检查Rerank模型连接和功能是否正常", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "初始化" ], "summary": "检查Rerank模型", "parameters": [ { "description": "Rerank检查请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.ModelTestRequest" } } ], "responses": { "200": { "description": "检查结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取当前空间的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识库" ], "summary": "获取知识库列表", "parameters": [ { "type": "string", "description": "共享智能体 ID(传入时返回该智能体可用的知识库)", "name": "agent_id", "in": "query" } ], "responses": { "200": { "description": "知识库列表", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "创建新的知识库", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识库" ], "summary": "创建知识库", "parameters": [ { "description": "知识库信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBase" } } ], "responses": { "201": { "description": "创建的知识库", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/copy": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "将一个知识库的内容复制到另一个知识库(异步任务)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识库" ], "summary": "复制知识库", "parameters": [ { "description": "复制请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.CopyKnowledgeBaseRequest" } } ], "responses": { "200": { "description": "任务ID", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/copy/progress/{task_id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取知识库复制任务的进度", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识库" ], "summary": "获取知识库复制进度", "parameters": [ { "type": "string", "description": "任务ID", "name": "task_id", "in": "path", "required": true } ], "responses": { "200": { "description": "进度信息", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "任务不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据ID获取知识库详情。当使用共享智能体时,可传 agent_id 以校验该智能体是否有权访问该知识库。", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识库" ], "summary": "获取知识库详情", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "共享智能体 ID(用于校验智能体是否有权访问该知识库)", "name": "agent_id", "in": "query" } ], "responses": { "200": { "description": "知识库详情", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "知识库不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新知识库的名称、描述和配置", "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.UpdateKnowledgeBaseRequest" } } ], "responses": { "200": { "description": "更新后的知识库", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除指定的知识库及其所有内容", "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" } } } } }, "/knowledge-bases/{id}/activity": { "get": { "security": [ { "Bearer": [] } ], "description": "返回知识库的重要变更与后台任务入口。仅知识库创建者或所属空间管理员可读,共享空间不可读。", "produces": [ "application/json" ], "tags": [ "知识库" ], "summary": "获取知识库活动记录", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "游标:返回 id 小于此值的记录", "name": "after_id", "in": "query" }, { "type": "integer", "description": "页大小,1-100,默认 50", "name": "limit", "in": "query" }, { "type": "string", "description": "按 action 精确过滤", "name": "action", "in": "query" }, { "type": "string", "description": "按 outcome 精确过滤", "name": "outcome", "in": "query" }, { "type": "string", "description": "按 actor_user_id 精确过滤", "name": "actor", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_handler.auditLogListResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/duplicate": { "post": { "security": [ { "Bearer": [] } ], "description": "创建一个只包含设置的新知识库副本,不复制知识、FAQ 内容、分块、索引、Wiki 页面、分享或置顶状态", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识库" ], "summary": "创建知识库副本", "parameters": [ { "type": "string", "description": "源知识库 ID", "name": "id", "in": "path", "required": true } ], "responses": { "201": { "description": "创建后的知识库副本", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/faq/entries": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取知识库下的FAQ条目列表,支持分页和筛选", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "获取FAQ条目列表", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" }, { "type": "integer", "description": "标签ID筛选(seq_id),兼容旧版单标签", "name": "tag_id", "in": "query" }, { "type": "string", "description": "标签UUID筛选,逗号分隔(OR语义)", "name": "tag_ids", "in": "query" }, { "type": "string", "description": "关键词搜索", "name": "keyword", "in": "query" }, { "type": "string", "description": "搜索字段: standard_question(标准问题), similar_questions(相似问法), answers(答案), 默认搜索全部", "name": "search_field", "in": "query" }, { "type": "string", "description": "排序方式: asc(按更新时间正序), 默认按更新时间倒序", "name": "sort_order", "in": "query" } ], "responses": { "200": { "description": "FAQ列表", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "异步批量更新或插入FAQ条目。支持 dry_run 模式(设置 dry_run=true),异步验证不实际导入。\ndry_run 模式是异步操作,返回 task_id,通过 /faq/import/progress/{task_id} 查询进度和结果。\n验证内容包括:1) 条目基本格式 2) 重复问题(批次内和知识库已有) 3) 内容安全检查。", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "批量更新/插入FAQ条目", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "description": "批量操作请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQBatchUpsertPayload" } } ], "responses": { "200": { "description": "任务ID", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "批量删除指定的FAQ条目", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "批量删除FAQ条目", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "description": "要删除的FAQ ID列表(seq_id)", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "properties": { "ids": { "type": "array", "items": { "type": "integer" } } } } } ], "responses": { "200": { "description": "删除成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/faq/entries/export": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "将所有FAQ条目导出为 CSV(默认)或 JSON。?format=json 返回与 FAQEntryPayload 结构兼容的数组。", "consumes": [ "application/json" ], "produces": [ "text/csv", "application/json" ], "tags": [ "FAQ管理" ], "summary": "导出FAQ条目", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "导出格式:csv(默认)或 json", "name": "format", "in": "query" } ], "responses": { "200": { "description": "导出文件", "schema": { "type": "file" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/faq/entries/fields": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "批量更新FAQ条目的多个字段(is_enabled, is_recommended, tag_id)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "批量更新FAQ字段", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "description": "字段更新请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryFieldsBatchUpdate" } } ], "responses": { "200": { "description": "更新成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/faq/entries/tags": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "批量更新FAQ条目的标签", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "批量更新FAQ标签", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "description": "标签更新请求", "name": "request", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "更新成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/faq/entries/{entry_id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据ID获取单个FAQ条目的详情", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "获取FAQ条目详情", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "FAQ条目ID(seq_id)", "name": "entry_id", "in": "path", "required": true } ], "responses": { "200": { "description": "FAQ条目详情", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "条目不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新指定的FAQ条目", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "更新FAQ条目", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "FAQ条目ID(seq_id)", "name": "entry_id", "in": "path", "required": true }, { "description": "FAQ条目", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload" } } ], "responses": { "200": { "description": "更新成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/faq/entries/{entry_id}/similar-questions": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "向指定的FAQ条目添加相似问题", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "添加相似问", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "FAQ条目ID(seq_id)", "name": "entry_id", "in": "path", "required": true }, { "description": "相似问列表", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.addSimilarQuestionsRequest" } } ], "responses": { "200": { "description": "更新后的FAQ条目", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "条目不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/faq/entry": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "同步创建单个FAQ条目", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "创建单个FAQ条目", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "description": "FAQ条目", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload" } } ], "responses": { "200": { "description": "创建的FAQ条目", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/faq/import/last-result/display": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新FAQ知识库导入结果统计卡片的显示或隐藏状态", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "更新FAQ最后一次导入结果显示状态", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "description": "状态更新请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.updateLastFAQImportResultDisplayStatusRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "知识库不存在或无导入记录", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/faq/search": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "使用混合搜索在FAQ中搜索,支持两级优先级标签召回:first_priority_tag_ids优先级最高,second_priority_tag_ids次之", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "FAQ管理" ], "summary": "搜索FAQ", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "description": "搜索请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQSearchRequest" } } ], "responses": { "200": { "description": "搜索结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/hybrid-search": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "在知识库中执行向量和关键词混合搜索。推荐使用 POST;GET 携带 JSON 请求体仍受支持(兼容旧客户端)。", "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/github_com_Tencent_WeKnora_internal_types.SearchParams" } } ], "responses": { "200": { "description": "搜索结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "在知识库中执行向量和关键词混合搜索。推荐使用 POST;GET 携带 JSON 请求体仍受支持(兼容旧客户端)。", "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/github_com_Tencent_WeKnora_internal_types.SearchParams" } } ], "responses": { "200": { "description": "搜索结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/knowledge": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取知识库下的知识列表,支持分页和筛选", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识管理" ], "summary": "获取知识列表", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" }, { "type": "string", "description": "标签ID筛选,逗号分隔(OR语义)", "name": "tag_ids", "in": "query" }, { "type": "string", "description": "关键词搜索", "name": "keyword", "in": "query" }, { "type": "string", "description": "文件类型筛选", "name": "file_type", "in": "query" }, { "type": "string", "description": "解析状态筛选 (pending/processing/completed/failed)", "name": "parse_status", "in": "query" }, { "type": "string", "description": "来源/渠道筛选 (web/api/feishu/notion/yuque/wechat/...,或 manual/url 按 type 过滤)", "name": "source", "in": "query" }, { "type": "string", "description": "更新时间起点,RFC3339 格式", "name": "start_time", "in": "query" }, { "type": "string", "description": "更新时间终点,RFC3339 格式", "name": "end_time", "in": "query" } ], "responses": { "200": { "description": "知识列表", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除知识库下的所有知识条目(异步任务)。知识库本身保留,仅清空其中的内容", "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" } } } } }, "/knowledge-bases/{id}/knowledge/file": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "上传文件并创建知识条目", "consumes": [ "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ "知识管理" ], "summary": "从文件创建知识", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "file", "description": "上传的文件", "name": "file", "in": "formData", "required": true }, { "type": "string", "description": "自定义文件名", "name": "fileName", "in": "formData" }, { "type": "string", "description": "元数据JSON", "name": "metadata", "in": "formData" }, { "type": "boolean", "description": "启用多模态处理", "name": "enable_multimodel", "in": "formData" }, { "type": "string", "description": "分类ID列表,逗号分隔", "name": "tag_ids", "in": "formData" }, { "type": "string", "description": "处理配置JSON(KnowledgeProcessOverrides)", "name": "process_config", "in": "formData" } ], "responses": { "200": { "description": "创建的知识", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "409": { "description": "文件重复", "schema": { "type": "object", "additionalProperties": true } } } } }, "/knowledge-bases/{id}/knowledge/manual": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "手工录入Markdown格式的知识内容", "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/github_com_Tencent_WeKnora_internal_types.ManualKnowledgePayload" } } ], "responses": { "200": { "description": "创建的知识", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/knowledge/url": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "从指定URL抓取内容并创建知识条目。当提供 file_name/file_type 或 URL 路径含已知文件扩展名时,自动切换为文件下载模式", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识管理" ], "summary": "从URL创建知识", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "description": "URL请求", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "properties": { "enable_multimodel": { "type": "boolean" }, "file_name": { "type": "string" }, "file_type": { "type": "string" }, "tag_ids": { "type": "array", "items": { "type": "string" } }, "title": { "type": "string" }, "url": { "type": "string" } } } } ], "responses": { "201": { "description": "创建的知识", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "409": { "description": "URL重复", "schema": { "type": "object", "additionalProperties": true } } } } }, "/knowledge-bases/{id}/move-targets": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "返回与源知识库 Type 一致、EmbeddingModelID 一致、非临时且不是自身的目标知识库列表", "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" } }, "404": { "description": "知识库不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/pin": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "切换知识库的置顶状态", "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 } }, "404": { "description": "知识库不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/shares": { "get": { "security": [ { "Bearer": [] } ], "description": "获取知识库的所有共享记录", "produces": [ "application/json" ], "tags": [ "知识库共享" ], "summary": "获取知识库的共享列表", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ListSharesResponse" } } } }, "post": { "security": [ { "Bearer": [] } ], "description": "将知识库共享到指定组织", "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/github_com_Tencent_WeKnora_internal_types.ShareKnowledgeBaseRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/shares/{share_id}": { "put": { "security": [ { "Bearer": [] } ], "description": "更新知识库共享的权限级别", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识库共享" ], "summary": "更新共享权限", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "共享记录ID", "name": "share_id", "in": "path", "required": true }, { "description": "权限信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UpdateSharePermissionRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] } ], "description": "取消知识库的共享", "tags": [ "知识库共享" ], "summary": "取消共享", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "共享记录ID", "name": "share_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/tags": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取知识库下的所有标签及统计信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "标签管理" ], "summary": "获取标签列表", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" }, { "type": "string", "description": "关键词搜索", "name": "keyword", "in": "query" } ], "responses": { "200": { "description": "标签列表", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "在知识库下创建新标签", "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": { "type": "object", "properties": { "color": { "type": "string" }, "name": { "type": "string" }, "sort_order": { "type": "integer" } } } } ], "responses": { "200": { "description": "创建的标签", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge-bases/{id}/tags/{tag_id}": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新标签信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "标签管理" ], "summary": "更新标签", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "标签ID (UUID或seq_id)", "name": "tag_id", "in": "path", "required": true }, { "description": "标签更新信息", "name": "request", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "更新后的标签", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除标签,可使用force=true强制删除被引用的标签,content_only=true仅删除标签下的内容而保留标签本身", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "标签管理" ], "summary": "删除标签", "parameters": [ { "type": "string", "description": "知识库ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "标签ID (UUID或seq_id)", "name": "tag_id", "in": "path", "required": true }, { "type": "boolean", "description": "强制删除", "name": "force", "in": "query" }, { "type": "boolean", "description": "仅删除内容,保留标签", "name": "content_only", "in": "query" }, { "description": "删除选项", "name": "body", "in": "body", "schema": { "$ref": "#/definitions/internal_handler.DeleteTagRequest" } } ], "responses": { "200": { "description": "删除成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge/batch": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的空间解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属空间查询(用于刷新后恢复共享知识库下的文件)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识管理" ], "summary": "批量获取知识", "parameters": [ { "type": "array", "items": { "type": "string" }, "collectionFormat": "csv", "description": "知识ID列表", "name": "ids", "in": "query", "required": true }, { "type": "string", "description": "可选,知识库ID(用于共享知识库时指定范围)", "name": "kb_id", "in": "query" }, { "type": "string", "description": "可选,共享智能体ID(用于按智能体空间批量拉取文件详情)", "name": "agent_id", "in": "query" } ], "responses": { "200": { "description": "知识列表", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge/batch-delete": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "按 ID 列表批量删除单个知识库下的多个知识条目", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识管理" ], "summary": "批量删除知识", "parameters": [ { "description": "批量删除请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.BatchDeleteKnowledgeRequest" } } ], "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" } } } } }, "/knowledge/batch-reparse": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "按 ID 列表批量重新解析单个知识库下的多个知识条目", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识管理" ], "summary": "批量重新解析知识", "parameters": [ { "description": "批量重解析请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.batchReparseKnowledgeRequest" } } ], "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" } } } } }, "/knowledge/image/{id}/{chunk_id}": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新知识分块的图像信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识管理" ], "summary": "更新图像信息", "parameters": [ { "type": "string", "description": "知识ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "分块ID", "name": "chunk_id", "in": "path", "required": true }, { "description": "图像信息", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "properties": { "image_info": { "type": "string" } } } } ], "responses": { "200": { "description": "更新成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge/manual/{id}": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新手工录入的Markdown知识内容", "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/github_com_Tencent_WeKnora_internal_types.ManualKnowledgePayload" } } ], "responses": { "200": { "description": "更新后的知识", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge/move": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "将一条或多条知识从源知识库移动到目标知识库(异步),返回任务 ID 用于查询进度", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识" ], "summary": "移动知识到其他知识库", "parameters": [ { "description": "{source_kb_id, target_kb_id, knowledge_ids}", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.MoveKnowledgeRequest" } } ], "responses": { "200": { "description": "任务信息", "schema": { "$ref": "#/definitions/internal_handler.MoveKnowledgeResponse" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge/move/progress/{task_id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "按任务 ID 查询移动进度", "produces": [ "application/json" ], "tags": [ "知识" ], "summary": "获取知识移动进度", "parameters": [ { "type": "string", "description": "移动任务 ID", "name": "task_id", "in": "path", "required": true } ], "responses": { "200": { "description": "进度信息", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeMoveProgress" } }, "404": { "description": "任务不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge/search": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Search knowledge files by keyword. Pass recent=true without a keyword to browse recent files. When agent_id is set (shared agent), scope is the agent's configured knowledge bases.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Knowledge" ], "summary": "Search knowledge", "parameters": [ { "type": "string", "description": "Keyword to search", "name": "keyword", "in": "query" }, { "type": "integer", "description": "Offset for pagination", "name": "offset", "in": "query" }, { "type": "integer", "description": "Limit for pagination (default 20)", "name": "limit", "in": "query" }, { "type": "string", "description": "Comma-separated file extensions to filter (e.g., csv,xlsx)", "name": "file_types", "in": "query" }, { "type": "string", "description": "Shared agent ID (search within agent's KB scope)", "name": "agent_id", "in": "query" }, { "type": "boolean", "description": "Return recent files when keyword is empty", "name": "recent", "in": "query" } ], "responses": { "200": { "description": "Search results", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Invalid request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge/tags": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的空间解析", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识管理" ], "summary": "批量更新知识标签", "parameters": [ { "description": "标签更新请求(updates 必填,kb_id 可选)", "name": "request", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "更新成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge/{id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据ID获取知识条目详情", "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" } }, "404": { "description": "知识不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新知识条目信息", "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/github_com_Tencent_WeKnora_internal_types.Knowledge" } } ], "responses": { "200": { "description": "更新成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据ID异步删除知识条目。请求会被入队到与批量删除相同的异步管道(asynq);\n接口返回 200 仅表示任务已提交(响应 data.task_id 为任务 ID),实际删除由后台 worker 完成。", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识管理" ], "summary": "删除知识", "parameters": [ { "type": "string", "description": "知识ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "任务已提交,返回 task_id", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/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": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "下载知识条目关联的原始文件", "consumes": [ "application/json" ], "produces": [ "application/octet-stream" ], "tags": [ "知识管理" ], "summary": "下载知识文件", "parameters": [ { "type": "string", "description": "知识ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "文件内容", "schema": { "type": "file" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge/{id}/preview": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "返回知识条目关联的原始文件,Content-Type 根据文件类型设置,用于浏览器内嵌预览", "consumes": [ "application/json" ], "produces": [ "application/pdf", "image/jpeg", "image/png", "text/plain" ], "tags": [ "知识管理" ], "summary": "预览知识文件", "parameters": [ { "type": "string", "description": "知识ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "文件内容", "schema": { "type": "file" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledge/{id}/reparse": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除知识中现有的文档内容并重新解析,使用异步任务方式处理", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "知识管理" ], "summary": "重新解析知识", "parameters": [ { "type": "string", "description": "知识ID", "name": "id", "in": "path", "required": true }, { "description": "可选的处理配置覆盖:{\\", "name": "body", "in": "body", "schema": { "type": "object" } } ], "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" } } } } }, "/knowledgebase/{kb_id}/wiki/auto-fix": { "post": { "security": [ { "Bearer": [] } ], "description": "Automatically fix fixable wiki issues (broken links, etc.)", "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Auto-fix wiki issues", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/knowledgebase/{kb_id}/wiki/folders": { "get": { "security": [ { "Bearer": [] } ], "description": "Retrieve the direct child folders of a parent folder (parent_id empty = root level), each with its page count and a has-children flag for the directory tree.", "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "List wiki folders", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Parent folder id (empty = root)", "name": "parent_id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiFolderListResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] } ], "description": "Create a new (initially empty) directory node under parent_id", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Create a wiki folder", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "description": "Folder data", "name": "folder", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiFolderCreateRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiFolder" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledgebase/{kb_id}/wiki/folders/{folder_id}": { "put": { "security": [ { "Bearer": [] } ], "description": "Rename and/or reparent a folder; the whole subtree's paths and the affected pages' cached paths are recomputed", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Rename or move a wiki folder", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Folder ID", "name": "folder_id", "in": "path", "required": true }, { "description": "Folder update", "name": "folder", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiFolderUpdateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiFolder" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] } ], "description": "Delete a folder that has no pages and no child folders", "tags": [ "Wiki" ], "summary": "Delete an empty wiki folder", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Folder ID", "name": "folder_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledgebase/{kb_id}/wiki/graph": { "get": { "security": [ { "Bearer": [] } ], "description": "Returns a slice of the wiki link graph for visualization. Supports\n`mode=overview` (top-N most-connected pages, default) and\n`mode=ego` (BFS neighborhood of a center slug) to keep response\nsize tractable for knowledge bases with tens of thousands of pages.", "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Get wiki link graph", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "overview (default) | ego", "name": "mode", "in": "query" }, { "type": "string", "description": "Center slug for ego mode", "name": "center", "in": "query" }, { "type": "integer", "description": "Ego BFS depth (1-3, default 1)", "name": "depth", "in": "query" }, { "type": "string", "description": "Comma-separated page_type allow-list", "name": "types", "in": "query" }, { "type": "integer", "description": "Max nodes to return (default 500, max 2000)", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiGraphData" } } } } }, "/knowledgebase/{kb_id}/wiki/index": { "get": { "security": [ { "Bearer": [] } ], "description": "Returns the wiki index as intro text plus per-type paginated\ndirectory groups. The heavy directory markdown that used to\nlive in wiki_pages.content was replaced with this structured\nresponse so a KB with tens of thousands of pages no longer\nmaterializes megabytes of TEXT on every index open.", "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Get wiki index view", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Comma-separated page types (default: all content types)", "name": "types", "in": "query" }, { "type": "integer", "description": "Per-group window size, 1-200 (default 50)", "name": "limit", "in": "query" }, { "type": "string", "description": "Opaque offset cursor from previous response", "name": "cursor", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiIndexResponse" } } } } }, "/knowledgebase/{kb_id}/wiki/issues": { "get": { "security": [ { "Bearer": [] } ], "description": "List issues flagged on wiki pages with optional filtering", "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "List wiki page issues", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Filter by page slug", "name": "slug", "in": "query" }, { "type": "string", "description": "Filter by status (pending, ignored, resolved)", "name": "status", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageIssue" } } } } } }, "/knowledgebase/{kb_id}/wiki/issues/{issue_id}/status": { "put": { "security": [ { "Bearer": [] } ], "description": "Update the status of a flagged wiki page issue", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Update wiki page issue status", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Issue ID", "name": "issue_id", "in": "path", "required": true }, { "description": "New status {'status': 'ignored'}", "name": "status", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledgebase/{kb_id}/wiki/lint": { "get": { "security": [ { "Bearer": [] } ], "description": "Perform a comprehensive health check on the wiki", "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Run wiki lint", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_application_service.WikiLintReport" } } } } }, "/knowledgebase/{kb_id}/wiki/move-page": { "put": { "security": [ { "Bearer": [] } ], "description": "Relocate a page (identified by slug in the body) into a folder (folder_id empty = root); the page's cached category path is recomputed", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Move a wiki page into a folder", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "description": "Move target", "name": "move", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageMoveRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledgebase/{kb_id}/wiki/pages": { "get": { "security": [ { "Bearer": [] } ], "description": "List wiki pages with optional filtering and pagination", "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "List wiki pages", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Filter by page type; comma-separated for multiple (e.g. entity,concept)", "name": "page_type", "in": "query" }, { "type": "string", "description": "Filter by status", "name": "status", "in": "query" }, { "type": "string", "description": "Full-text search", "name": "query", "in": "query" }, { "type": "integer", "description": "Page number", "name": "page", "in": "query" }, { "type": "integer", "description": "Page size", "name": "page_size", "in": "query" }, { "type": "string", "description": "Sort field", "name": "sort_by", "in": "query" }, { "type": "string", "description": "Sort order (asc/desc)", "name": "sort_order", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageListResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] } ], "description": "Create a new wiki page in the knowledge base", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Create a wiki page", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "description": "Wiki page data", "name": "page", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledgebase/{kb_id}/wiki/pages/{slug}": { "get": { "security": [ { "Bearer": [] } ], "description": "Retrieve a wiki page by its slug", "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Get a wiki page by slug", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Page slug", "name": "slug", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] } ], "description": "Partially update a wiki page by slug. Absent fields keep\ntheir stored value. When `version` is \u003e 0 it acts as an\noptimistic-lock guard: a mismatch with the stored version\nreturns 409 together with the current version so the client\ncan reload and re-apply.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Update a wiki page", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Page slug", "name": "slug", "in": "path", "required": true }, { "description": "Fields to update", "name": "page", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageUpdateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] } ], "description": "Soft-delete a wiki page by slug", "tags": [ "Wiki" ], "summary": "Delete a wiki page", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Page slug", "name": "slug", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledgebase/{kb_id}/wiki/rebuild-links": { "post": { "security": [ { "Bearer": [] } ], "description": "Re-parse all pages and rebuild bidirectional link references", "tags": [ "Wiki" ], "summary": "Rebuild wiki links", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/knowledgebase/{kb_id}/wiki/revert": { "post": { "security": [ { "Bearer": [] } ], "description": "Rolls the page (slug in the body, like move-page) back to\nthe content of the given stored revision. Applied as a\nregular edit: the pre-revert state is snapshotted and the\nversion advances.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Revert a wiki page to an earlier revision", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "description": "Revert target", "name": "revert", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageRevertRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledgebase/{kb_id}/wiki/revisions/{slug}": { "get": { "security": [ { "Bearer": [] } ], "description": "Returns the stored historical snapshots for a page, newest\nfirst (content omitted), plus the current version. Passing\n`version` returns that single snapshot with full content.", "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "List wiki page revisions", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Page slug", "name": "slug", "in": "path", "required": true }, { "type": "integer", "description": "Return this single revision with content", "name": "version", "in": "query" }, { "type": "integer", "description": "Page size (default 50, max 200)", "name": "limit", "in": "query" }, { "type": "integer", "description": "Offset into the newest-first list", "name": "offset", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageRevisionListResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/knowledgebase/{kb_id}/wiki/search": { "get": { "security": [ { "Bearer": [] } ], "description": "Full-text search over wiki pages", "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Search wiki pages", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true }, { "type": "string", "description": "Search query", "name": "q", "in": "query", "required": true }, { "type": "integer", "description": "Max results (default 10)", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage" } } } } } }, "/knowledgebase/{kb_id}/wiki/stats": { "get": { "security": [ { "Bearer": [] } ], "description": "Returns aggregate statistics about the wiki", "produces": [ "application/json" ], "tags": [ "Wiki" ], "summary": "Get wiki statistics", "parameters": [ { "type": "string", "description": "Knowledge base ID", "name": "kb_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiStats" } } } } }, "/mcp-services": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取当前空间的所有MCP服务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "获取MCP服务列表", "responses": { "200": { "description": "MCP服务列表", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "创建新的MCP服务配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "创建MCP服务", "parameters": [ { "description": "MCP服务配置", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MCPService" } } ], "responses": { "200": { "description": "创建的MCP服务", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/mcp-services/oauth/callback": { "get": { "description": "接收授权服务器回调并完成 code 交换,随后重定向回前端", "tags": [ "MCP服务" ], "summary": "MCP OAuth 回调", "parameters": [ { "type": "string", "description": "授权码", "name": "code", "in": "query" }, { "type": "string", "description": "状态参数", "name": "state", "in": "query" }, { "type": "string", "description": "授权错误码", "name": "error", "in": "query" } ], "responses": { "302": { "description": "Found" } } } }, "/mcp-services/{id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据ID获取MCP服务详情", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "获取MCP服务详情", "parameters": [ { "type": "string", "description": "MCP服务ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "MCP服务详情", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "服务不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新MCP服务配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "更新MCP服务", "parameters": [ { "type": "string", "description": "MCP服务ID", "name": "id", "in": "path", "required": true }, { "description": "更新字段", "name": "request", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "更新后的MCP服务", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除指定的MCP服务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "删除MCP服务", "parameters": [ { "type": "string", "description": "MCP服务ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/mcp-services/{id}/credentials": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "为指定字段写入新凭据;省略的字段保留原值;空字符串视为 no-op(如需删除请用 DELETE)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "设置 MCP 服务凭据", "parameters": [ { "type": "string", "description": "MCP 服务 ID", "name": "id", "in": "path", "required": true }, { "description": "{api_key?: string, token?: string}", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } } ], "responses": { "200": { "description": "写入后的凭据状态", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "服务不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/mcp-services/{id}/credentials/{field}": { "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除指定字段的存储凭据;删除已为空的字段是幂等的", "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "移除 MCP 服务的单个凭据字段", "parameters": [ { "type": "string", "description": "MCP 服务 ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "字段名(api_key | token)", "name": "field", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "字段名非法", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "服务不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/mcp-services/{id}/oauth/authorize-url": { "post": { "security": [ { "Bearer": [] } ], "description": "对使用 OAuth 的 MCP 服务执行发现与动态客户端注册,返回浏览器应跳转的授权地址(当前用户维度)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "发起 MCP OAuth 授权", "parameters": [ { "type": "string", "description": "MCP 服务 ID", "name": "id", "in": "path", "required": true }, { "description": "{redirect_uri: string, frontend_redirect?: string}", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } } ], "responses": { "200": { "description": "{authorization_url: string, authorization_attempt: string}", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/mcp-services/{id}/oauth/status": { "get": { "security": [ { "Bearer": [] } ], "description": "返回当前用户的 OAuth Token 生命周期状态;传 authorization_attempt 时只检查本次授权流程", "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "查询 MCP OAuth 授权状态", "parameters": [ { "type": "string", "description": "MCP 服务 ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "本次授权尝试 ID;传入后不会接受历史 Token", "name": "authorization_attempt", "in": "query" } ], "responses": { "200": { "description": "{authorized: bool, state: string, refresh_available: bool, expires_at?: string}", "schema": { "type": "object", "additionalProperties": true } } } } }, "/mcp-services/{id}/oauth/token": { "delete": { "security": [ { "Bearer": [] } ], "description": "删除当前用户对指定 MCP 服务的 OAuth 令牌", "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "撤销 MCP OAuth 授权", "parameters": [ { "type": "string", "description": "MCP 服务 ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" } } } }, "/mcp-services/{id}/resources": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取MCP服务提供的资源列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "获取MCP服务资源列表", "parameters": [ { "type": "string", "description": "MCP服务ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "资源列表", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/mcp-services/{id}/test": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "测试MCP服务是否可以正常连接", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "测试MCP服务连接", "parameters": [ { "type": "string", "description": "MCP服务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" } } } } }, "/mcp-services/{id}/tool-approvals/{tool_name}": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "为指定 MCP 服务下的某个工具设置/更新审批要求", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "设置 MCP 工具人工审批策略", "parameters": [ { "type": "string", "description": "MCP 服务 ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "工具名", "name": "tool_name", "in": "path", "required": true }, { "description": "{require_approval: bool}", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } } ], "responses": { "200": { "description": "更新结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "404": { "description": "MCP 服务或工具不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/mcp-services/{id}/tools": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取MCP服务提供的工具列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "MCP服务" ], "summary": "获取MCP服务工具列表", "parameters": [ { "type": "string", "description": "MCP服务ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "工具列表", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/me/invitations": { "get": { "security": [ { "Bearer": [] } ], "description": "返回当前登录用户的待接受邀请(默认仅 pending),用于头像入口和 /invitations 收件箱页。", "produces": [ "application/json" ], "tags": [ "我的邀请" ], "summary": "列出我的待接受邀请", "parameters": [ { "type": "boolean", "description": "是否包含已处理 / 已过期等终止态行(默认 false)", "name": "include_terminal", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/me/invitations/pending-count": { "get": { "security": [ { "Bearer": [] } ], "description": "轻量级 endpoint,返回当前登录用户的 pending 邀请数,用于头像旁的角标轮询。", "produces": [ "application/json" ], "tags": [ "我的邀请" ], "summary": "获取我的待处理邀请数", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/me/invitations/{inv_id}/accept": { "post": { "security": [ { "Bearer": [] } ], "description": "当前登录用户接受一条 pending 邀请;服务端会同时写入 tenant_members 行。", "produces": [ "application/json" ], "tags": [ "我的邀请" ], "summary": "接受邀请", "parameters": [ { "type": "string", "description": "邀请 ID", "name": "inv_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/me/invitations/{inv_id}/decline": { "post": { "security": [ { "Bearer": [] } ], "description": "当前登录用户拒绝一条 pending 邀请;不创建 tenant_members 行。", "produces": [ "application/json" ], "tags": [ "我的邀请" ], "summary": "拒绝邀请", "parameters": [ { "type": "string", "description": "邀请 ID", "name": "inv_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/messages/chat-history-stats": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取聊天历史知识库的统计信息(已索引消息数、知识库大小等)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "消息" ], "summary": "获取聊天历史知识库统计", "responses": { "200": { "description": "统计信息", "schema": { "type": "object", "additionalProperties": true } } } } }, "/messages/search": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "通过关键词和/或向量相似度搜索历史对话记录,支持关键词、向量、混合三种模式", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "消息" ], "summary": "搜索历史对话", "parameters": [ { "description": "搜索请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.SearchMessagesRequest" } } ], "responses": { "200": { "description": "搜索结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/messages/{session_id}/load": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "加载会话的消息历史,支持分页和时间筛选", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "消息" ], "summary": "加载消息历史", "parameters": [ { "type": "string", "description": "会话ID", "name": "session_id", "in": "path", "required": true }, { "type": "integer", "default": 20, "description": "返回数量", "name": "limit", "in": "query" }, { "type": "string", "description": "在此时间之前的消息(RFC3339Nano格式)", "name": "before_time", "in": "query" } ], "responses": { "200": { "description": "消息列表", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/messages/{session_id}/{id}": { "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "从会话中删除指定消息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "消息" ], "summary": "删除消息", "parameters": [ { "type": "string", "description": "会话ID", "name": "session_id", "in": "path", "required": true }, { "type": "string", "description": "消息ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/models": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取当前空间的所有模型", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "模型管理" ], "summary": "获取模型列表", "responses": { "200": { "description": "模型列表", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "创建新的模型配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "模型管理" ], "summary": "创建模型", "parameters": [ { "description": "模型信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.CreateModelRequest" } } ], "responses": { "201": { "description": "创建的模型", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/models/providers": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据模型类型获取支持的厂商列表及配置信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "模型管理" ], "summary": "获取模型厂商列表", "parameters": [ { "type": "string", "description": "模型类型 (chat, embedding, rerank, vllm)", "name": "model_type", "in": "query" } ], "responses": { "200": { "description": "厂商列表", "schema": { "type": "object", "additionalProperties": true } } } } }, "/models/weknoracloud/status": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "检查当前空间的 WeKnoraCloud 凭证是否完好;needs_reinit=true 表示需要重新保存", "produces": [ "application/json" ], "tags": [ "WeKnoraCloud" ], "summary": "检查 WeKnoraCloud 凭证状态", "responses": { "200": { "description": "凭证状态", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "type": "object", "additionalProperties": true } } } } }, "/models/{id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据ID获取模型详情", "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 } }, "404": { "description": "模型不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新模型配置信息", "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.UpdateModelRequest" } } ], "responses": { "200": { "description": "更新后的模型", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "模型不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除指定的模型", "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 } }, "404": { "description": "模型不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations": { "get": { "security": [ { "Bearer": [] } ], "description": "获取当前空间所属的所有组织,并附带各空间内知识库/智能体数量", "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "获取我的组织列表", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ListOrganizationsResponse" } } } }, "post": { "security": [ { "Bearer": [] } ], "description": "创建新的组织,创建者自动成为管理员", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "创建组织", "parameters": [ { "description": "组织信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.CreateOrganizationRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/join": { "post": { "security": [ { "Bearer": [] } ], "description": "使用邀请码加入组织", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "通过邀请码加入组织", "parameters": [ { "description": "邀请码", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.JoinOrganizationRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/join-by-id": { "post": { "security": [ { "Bearer": [] } ], "description": "加入已开放可被搜索的空间,无需邀请码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "通过空间 ID 加入(可搜索空间)", "parameters": [ { "description": "空间 ID", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.JoinByOrganizationIDRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/join-request": { "post": { "security": [ { "Bearer": [] } ], "description": "对需要审核的组织提交加入申请", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "提交加入申请", "parameters": [ { "description": "申请信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SubmitJoinRequestRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/preview/{code}": { "get": { "security": [ { "Bearer": [] } ], "description": "通过邀请码获取组织基本信息(不加入)", "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "通过邀请码预览组织", "parameters": [ { "type": "string", "description": "邀请码", "name": "code", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/search": { "get": { "security": [ { "Bearer": [] } ], "description": "搜索已开放可被搜索的空间,用于发现并加入", "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "搜索可加入的空间", "parameters": [ { "type": "string", "description": "搜索关键词(空间名称或描述)", "name": "q", "in": "query" }, { "type": "integer", "default": 20, "description": "返回数量限制", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/organizations/{id}": { "get": { "security": [ { "Bearer": [] } ], "description": "根据ID获取组织详情", "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "获取组织详情", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] } ], "description": "更新组织信息(需要管理员权限)", "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/github_com_Tencent_WeKnora_internal_types.UpdateOrganizationRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] } ], "description": "删除组织(仅组织创建者可操作)", "tags": [ "组织管理" ], "summary": "删除组织", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/{id}/agent-shares": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "返回所有被共享到指定组织的智能体(含我的有效权限)", "produces": [ "application/json" ], "tags": [ "组织" ], "summary": "获取共享到本组织的智能体", "parameters": [ { "type": "string", "description": "组织 ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "智能体共享列表 + total", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "非组织成员", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/{id}/invite": { "post": { "security": [ { "Bearer": [] } ], "description": "管理员直接添加用户为组织成员", "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/github_com_Tencent_WeKnora_internal_types.InviteMemberRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/{id}/invite-code": { "post": { "security": [ { "Bearer": [] } ], "description": "生成新的组织邀请码(需要管理员权限)", "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "生成邀请码", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/{id}/join-requests": { "get": { "security": [ { "Bearer": [] } ], "description": "获取组织的待审核加入申请(仅管理员)", "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "获取待审核加入申请列表", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/{id}/join-requests/{request_id}/review": { "put": { "security": [ { "Bearer": [] } ], "description": "通过或拒绝加入申请(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "审核加入申请", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "申请ID", "name": "request_id", "in": "path", "required": true }, { "description": "审核结果", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ReviewJoinRequestRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/{id}/leave": { "post": { "security": [ { "Bearer": [] } ], "description": "退出指定组织", "tags": [ "组织管理" ], "summary": "退出组织", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/{id}/members": { "get": { "security": [ { "Bearer": [] } ], "description": "获取组织的所有成员(按空间)", "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "获取组织成员列表", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ListMembersResponse" } } } } }, "/organizations/{id}/members/{tenant_id}": { "put": { "security": [ { "Bearer": [] } ], "description": "更新组织成员(空间)的角色(需要管理员权限)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "更新成员角色", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "成员空间ID", "name": "tenant_id", "in": "path", "required": true }, { "description": "角色信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UpdateMemberRoleRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] } ], "description": "从组织中移除成员空间(需要管理员权限)", "tags": [ "组织管理" ], "summary": "移除成员", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "成员空间ID", "name": "tenant_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/{id}/request-upgrade": { "post": { "security": [ { "Bearer": [] } ], "description": "现有成员申请更高权限", "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/github_com_Tencent_WeKnora_internal_types.RequestRoleUpgradeRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/{id}/search-tenants": { "get": { "security": [ { "Bearer": [] } ], "description": "按空间名搜索可邀请的空间(排除已加入的空间)用于邀请加入组织;按空间去重", "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "搜索可邀请的空间", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "搜索关键词(空间名)", "name": "q", "in": "query", "required": true }, { "type": "integer", "default": 10, "description": "返回数量限制", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/organizations/{id}/search-users": { "get": { "deprecated": true, "responses": {} } }, "/organizations/{id}/shared-agents": { "get": { "security": [ { "Bearer": [] } ], "description": "获取指定空间下所有共享智能体,包含他人共享的与我共享的,用于列表页空间视角", "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "获取空间内全部智能体(含我共享的)", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/organizations/{id}/shared-knowledge-bases": { "get": { "security": [ { "Bearer": [] } ], "description": "获取指定空间下所有共享知识库,包含直接共享的与通过共享智能体可见的,用于列表页空间视角", "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "获取空间内全部知识库(含我共享的、含智能体携带的)", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/organizations/{id}/shares": { "get": { "security": [ { "Bearer": [] } ], "description": "获取共享到指定组织的所有知识库", "produces": [ "application/json" ], "tags": [ "组织管理" ], "summary": "获取组织的共享知识库列表", "parameters": [ { "type": "string", "description": "组织ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ListSharesResponse" } } } } }, "/sessions": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取当前空间的会话列表,支持分页、关键字搜索、按来源/Agent 筛选", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "会话" ], "summary": "获取会话列表", "parameters": [ { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" }, { "type": "string", "description": "标题模糊搜索", "name": "keyword", "in": "query" }, { "type": "string", "description": "来源过滤:web / embed / api / feishu / wechat / slack / ...(api、embed、IM 渠道需 Admin+)", "name": "source", "in": "query" }, { "type": "string", "description": "按 Agent 过滤(仅对 IM 会话生效)", "name": "agent_id", "in": "query" } ], "responses": { "200": { "description": "会话列表", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "创建新的对话会话", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "会话" ], "summary": "创建会话", "parameters": [ { "description": "会话创建请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler_session.CreateSessionRequest" } } ], "responses": { "201": { "description": "创建的会话", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/sessions/batch": { "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据ID列表批量删除对话会话,或设置 delete_all=true 删除当前空间的所有会话", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "会话" ], "summary": "批量删除会话", "parameters": [ { "description": "批量删除请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler_session.batchDeleteRequest" } } ], "responses": { "200": { "description": "删除结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/sessions/continue-stream/{session_id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "继续获取正在进行的流式响应", "consumes": [ "application/json" ], "produces": [ "text/event-stream" ], "tags": [ "问答" ], "summary": "继续流式响应", "parameters": [ { "type": "string", "description": "会话ID", "name": "session_id", "in": "path", "required": true }, { "type": "string", "description": "消息ID", "name": "message_id", "in": "query", "required": true } ], "responses": { "200": { "description": "流式响应", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "会话或消息不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/sessions/search": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "在知识库中搜索(不使用LLM总结)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "问答" ], "summary": "知识搜索", "parameters": [ { "description": "搜索请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler_session.SearchKnowledgeRequest" } } ], "responses": { "200": { "description": "搜索结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/sessions/{id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据ID获取会话详情", "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 } }, "404": { "description": "会话不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新会话属性", "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/github_com_Tencent_WeKnora_internal_types.Session" } } ], "responses": { "200": { "description": "更新后的会话", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "会话不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除指定的会话", "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 } }, "404": { "description": "会话不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/sessions/{id}/messages": { "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除会话中的所有消息,同时清除 LLM 上下文和聊天历史知识库条目。会话本身保留。", "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" } }, "404": { "description": "会话不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/sessions/{id}/pin": { "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "取消指定会话的置顶", "produces": [ "application/json" ], "tags": [ "会话" ], "summary": "取消置顶会话", "parameters": [ { "type": "string", "description": "会话ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "取消置顶成功", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "会话不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/sessions/{session_id}/agent-qa": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "基于Agent的智能问答,支持多轮对话和SSE流式响应", "consumes": [ "application/json" ], "produces": [ "text/event-stream" ], "tags": [ "问答" ], "summary": "Agent问答", "parameters": [ { "type": "string", "description": "会话ID", "name": "session_id", "in": "path", "required": true }, { "description": "问答请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler_session.CreateKnowledgeQARequest" } } ], "responses": { "200": { "description": "问答结果(SSE流)", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/sessions/{session_id}/knowledge-qa": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "基于知识库的问答(使用LLM总结),支持SSE流式响应", "consumes": [ "application/json" ], "produces": [ "text/event-stream" ], "tags": [ "问答" ], "summary": "知识问答", "parameters": [ { "type": "string", "description": "会话ID", "name": "session_id", "in": "path", "required": true }, { "description": "问答请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler_session.CreateKnowledgeQARequest" } } ], "responses": { "200": { "description": "问答结果(SSE流)", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/sessions/{session_id}/messages/{message_id}/suggestions": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "produces": [ "application/json" ], "tags": [ "会话" ], "summary": "获取回答后推荐问题", "parameters": [ { "type": "string", "description": "会话 ID", "name": "session_id", "in": "path", "required": true }, { "type": "string", "description": "助手消息 ID", "name": "message_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "对已完成的助手消息异步生成或重新生成推荐问题;相同配置快照会复用持久化结果", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "会话" ], "summary": "确保生成回答后推荐问题", "parameters": [ { "type": "string", "description": "会话 ID", "name": "session_id", "in": "path", "required": true }, { "type": "string", "description": "助手消息 ID", "name": "message_id", "in": "path", "required": true }, { "description": "生成选项", "name": "request", "in": "body", "schema": { "$ref": "#/definitions/internal_handler.EnsureMessageSuggestionsRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "202": { "description": "Accepted", "schema": { "type": "object", "additionalProperties": true } } } } }, "/sessions/{session_id}/pin": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "将指定会话置顶(用户维度)", "produces": [ "application/json" ], "tags": [ "会话" ], "summary": "置顶会话", "parameters": [ { "type": "string", "description": "会话ID", "name": "session_id", "in": "path", "required": true } ], "responses": { "200": { "description": "置顶成功", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "会话不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/sessions/{session_id}/stop": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "停止当前正在进行的生成任务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "问答" ], "summary": "停止生成", "parameters": [ { "type": "string", "description": "会话ID", "name": "session_id", "in": "path", "required": true }, { "description": "停止请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler_session.StopSessionRequest" } } ], "responses": { "200": { "description": "停止成功", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "会话或消息不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/sessions/{session_id}/suggestion-events": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "记录曝光、点击或关闭事件", "consumes": [ "application/json" ], "tags": [ "会话" ], "summary": "上报推荐问题事件", "parameters": [ { "type": "string", "description": "会话 ID", "name": "session_id", "in": "path", "required": true }, { "description": "事件", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.SuggestionEventRequest" } } ], "responses": { "204": { "description": "No Content" } } } }, "/sessions/{session_id}/title": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据消息内容自动生成会话标题", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "会话" ], "summary": "生成会话标题", "parameters": [ { "type": "string", "description": "会话ID", "name": "session_id", "in": "path", "required": true }, { "description": "生成请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler_session.GenerateTitleRequest" } } ], "responses": { "200": { "description": "生成的标题", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/shared-agents": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "返回所有共享给当前用户所在组织的智能体", "produces": [ "application/json" ], "tags": [ "组织" ], "summary": "获取我可访问的共享智能体", "responses": { "200": { "description": "智能体列表 + total", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/shared-knowledge-bases": { "get": { "security": [ { "Bearer": [] } ], "description": "获取通过组织共享给当前用户的所有知识库", "produces": [ "application/json" ], "tags": [ "知识库共享" ], "summary": "获取共享给我的知识库列表", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/skills": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取所有预装的Agent Skills元数据", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Skills" ], "summary": "获取预装Skills列表", "responses": { "200": { "description": "Skills列表", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/storage-backends": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "List all storage backend instances for the current workspace, with credentials masked. The workspace default backend id is returned alongside the list.", "produces": [ "application/json" ], "tags": [ "StorageBackend" ], "summary": "List storage backends", "responses": { "200": { "description": "List of storage backends and default_storage_backend_id", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Register a new object/file storage instance for the current workspace. The configuration is validated and a connectivity test is run before the backend is persisted.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "StorageBackend" ], "summary": "Create storage backend", "parameters": [ { "description": "Storage backend configuration", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.storageBackendRequest" } } ], "responses": { "201": { "description": "Created storage backend", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Invalid request, validation, or connectivity test failure", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "409": { "description": "A storage backend with this name already exists", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/storage-backends/test": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Test connectivity for the provided storage configuration without persisting it. Returns success=false with a sanitized error message on failure (the HTTP status stays 200).", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "StorageBackend" ], "summary": "Test storage backend with raw config", "parameters": [ { "description": "Storage backend configuration to test", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.storageBackendRequest" } } ], "responses": { "200": { "description": "Connectivity test result (success, error)", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Invalid request or validation error", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } } } } }, "/storage-backends/types": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Return the storage provider types allowed by STORAGE_ALLOW_LIST for UI form generation (e.g. local, minio, cos, tos, s3, oss, ks3, obs).", "produces": [ "application/json" ], "tags": [ "StorageBackend" ], "summary": "List allowed storage provider types", "responses": { "200": { "description": "List of allowed storage provider types", "schema": { "type": "object", "additionalProperties": true } } } } }, "/storage-backends/{id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Retrieve a single storage backend by ID for the current workspace. Credentials are masked.", "produces": [ "application/json" ], "tags": [ "StorageBackend" ], "summary": "Get storage backend", "parameters": [ { "type": "string", "description": "Storage backend ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Storage backend details", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Storage backend not found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Update a storage backend's mutable fields (name, credentials, status). Provider and physical location (endpoint, region, bucket, path prefix) are immutable; use storage migration to move data. Environment-sourced backends are read-only. Redacted secret placeholders preserve the stored credentials.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "StorageBackend" ], "summary": "Update storage backend", "parameters": [ { "type": "string", "description": "Storage backend ID", "name": "id", "in": "path", "required": true }, { "description": "Updated storage backend fields", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.storageBackendRequest" } } ], "responses": { "200": { "description": "Updated storage backend", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Immutable field change, read-only backend, validation, or connectivity failure", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Storage backend not found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Soft-delete a storage backend. A backend that is the workspace default, still bound to knowledge bases, environment-sourced, or a legacy alias cannot be deleted.", "produces": [ "application/json" ], "tags": [ "StorageBackend" ], "summary": "Delete storage backend", "parameters": [ { "type": "string", "description": "Storage backend ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Deletion success", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Backend is default, bound, read-only, or legacy alias", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Storage backend not found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/storage-backends/{id}/default": { "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Mark a storage backend as the workspace default. Only an active backend can become the default. New knowledge bases without an explicit binding use the default.", "produces": [ "application/json" ], "tags": [ "StorageBackend" ], "summary": "Set default storage backend", "parameters": [ { "type": "string", "description": "Storage backend ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Default set successfully", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Backend is not active", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Storage backend not found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/storage-backends/{id}/test": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Test connectivity of an existing saved storage backend using its stored credentials. Returns success=false with a sanitized error message on failure (the HTTP status stays 200).", "produces": [ "application/json" ], "tags": [ "StorageBackend" ], "summary": "Test storage backend by ID", "parameters": [ { "type": "string", "description": "Storage backend ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Connectivity test result (success, error)", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Storage backend not found", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/system/admin/api-keys": { "get": { "security": [ { "Bearer": [] } ], "description": "Lists non-workspace API keys. Full tokens are always masked. Human SystemAdmin only.", "produces": [ "application/json" ], "tags": [ "System Admin" ], "summary": "List platform API keys", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } }, "post": { "security": [ { "Bearer": [] } ], "description": "Creates a capability-scoped key that may target any workspace through X-Tenant-ID. The plaintext token is returned once. Human SystemAdmin only.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "System Admin" ], "summary": "Create a platform API key", "parameters": [ { "description": "Platform API key", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.platformAPIKeyCreateRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "type": "object", "additionalProperties": true } } } } }, "/system/admin/api-keys/{key_id}": { "delete": { "security": [ { "Bearer": [] } ], "description": "Immediately revokes a platform API key. Human SystemAdmin only.", "produces": [ "application/json" ], "tags": [ "System Admin" ], "summary": "Revoke a platform API key", "parameters": [ { "type": "integer", "description": "API key ID", "name": "key_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/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/runtime/queues": { "get": { "description": "返回各 asynq 队列的实时深度(pending/active/scheduled/retry 等)与 worker 并发配置,仅系统管理员可见", "produces": [ "application/json" ], "tags": [ "系统管理" ], "summary": "获取解析任务队列运行时状态", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_handler.RuntimeQueuesResponse" } } } } }, "/system/admin/runtime/queues/{queue}/archived": { "delete": { "produces": [ "application/json" ], "tags": [ "System Admin" ], "summary": "Purge all archived tasks in a queue", "parameters": [ { "type": "string", "description": "Queue name", "name": "queue", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/system/admin/runtime/queues/{queue}/tasks": { "get": { "produces": [ "application/json" ], "tags": [ "System Admin" ], "summary": "List runtime queue tasks by state", "parameters": [ { "type": "string", "description": "Queue name", "name": "queue", "in": "path", "required": true }, { "enum": [ "pending", "active", "scheduled", "retry", "archived", "completed" ], "type": "string", "description": "Task state", "name": "state", "in": "query", "required": true }, { "type": "string", "description": "Opaque continuation cursor", "name": "cursor", "in": "query" }, { "type": "integer", "default": 20, "description": "Page size", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_handler.RuntimeTasksResponse" } } } } }, "/system/admin/runtime/queues/{queue}/tasks/{task_id}/actions/{action}": { "post": { "produces": [ "application/json" ], "tags": [ "System Admin" ], "summary": "Run a safe runtime task action", "parameters": [ { "type": "string", "description": "Queue name", "name": "queue", "in": "path", "required": true }, { "type": "string", "description": "Task ID", "name": "task_id", "in": "path", "required": true }, { "enum": [ "cancel", "run_now", "delete" ], "type": "string", "description": "Action", "name": "action", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "boolean" } } } } } }, "/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-workspace 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 workspace", "responses": { "200": { "description": "{ affected: int64, quota_bytes: int64 }", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "DB write failed", "schema": { "type": "object", "additionalProperties": true } } } } }, "/system/admin/users/reset-password": { "post": { "description": "Replace another user's local password and revoke all of their existing sessions (SystemAdmin only).\nA system administrator cannot reset their own password through this endpoint; self-service password change still requires the old password.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "System Admin" ], "summary": "Reset another user's password", "parameters": [ { "description": "Password reset request", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.ResetUserPasswordRequest" } } ], "responses": { "200": { "description": "Password reset successfully", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Invalid request, weak password, or self reset", "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/docreader/reconnect": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统" ], "summary": "重连文档解析服务", "parameters": [ { "description": "DocReader 地址", "name": "request", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "OK" } } } }, "/system/info": { "get": { "description": "获取系统版本、构建信息和引擎配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统" ], "summary": "获取系统信息", "responses": { "200": { "description": "系统信息", "schema": { "$ref": "#/definitions/internal_handler.GetSystemInfoResponse" } } } } }, "/system/parser-engines": { "get": { "produces": [ "application/json" ], "tags": [ "系统" ], "summary": "列出可用的文档解析引擎", "responses": { "200": { "description": "解析引擎列表", "schema": { "type": "object", "additionalProperties": true } } } } }, "/system/parser-engines/check": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统" ], "summary": "使用当前参数检测解析引擎可用性", "parameters": [ { "description": "解析引擎配置(与保存接口同结构)", "name": "body", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "OK" } } } }, "/system/storage-engine-check": { "post": { "description": "使用当前填写的参数测试 MinIO/COS 连通性,不保存配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统" ], "summary": "测试存储引擎连通性", "parameters": [ { "description": "存储引擎配置", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.StorageCheckRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_handler.StorageCheckResponse" } } } } }, "/system/storage-engine-status": { "get": { "description": "返回 Local、MinIO、COS 各存储引擎的可用状态及说明,供全局设置与知识库选择使用", "produces": [ "application/json" ], "tags": [ "系统" ], "summary": "获取存储引擎状态", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_handler.GetStorageEngineStatusResponse" } } } } }, "/tenants": { "get": { "security": [ { "Bearer": [] } ], "description": "获取当前用户可访问的空间列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "获取空间列表", "responses": { "200": { "description": "空间列表", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "post": { "security": [ { "Bearer": [] } ], "description": "创建新的空间。任意已登录用户均可调用以建立自己的新工作区,\n调用方会被自动设为该空间的 Owner。跨空间超管仍可像以前一样\n通过本接口创建任意空间。\n当 tenant.auto_create_api_key(或 WEKNORA_TENANT_AUTO_CREATE_API_KEY)\n开启时,会自动创建一个 full_access API Key,并在响应体的 data.api_key 字段返回其明文 token。", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "创建空间", "parameters": [ { "description": "空间信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.createTenantRequest" } } ], "responses": { "201": { "description": "创建的空间(可选含 api_key)", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/tenants/all": { "get": { "security": [ { "Bearer": [] } ], "description": "获取系统中所有空间(需要跨空间访问权限)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "获取所有空间列表", "responses": { "200": { "description": "所有空间列表", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "权限不足", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/tenants/kv/prompt-templates": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取系统配置的提示词模板列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "获取提示词模板", "responses": { "200": { "description": "提示词模板配置", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/tenants/kv/web-search-config": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取空间的网络搜索配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "获取空间网络搜索配置", "responses": { "200": { "description": "网络搜索配置", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/tenants/kv/{key}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "获取空间级别的KV配置(支持web-search-config、prompt-templates、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "获取空间KV配置", "parameters": [ { "type": "string", "description": "配置键名", "name": "key", "in": "path", "required": true } ], "responses": { "200": { "description": "配置值", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "不支持的键", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新空间级别的KV配置(支持web-search-config、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "更新空间KV配置", "parameters": [ { "type": "string", "description": "配置键名", "name": "key", "in": "path", "required": true }, { "description": "配置值", "name": "request", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "更新成功", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "不支持的键", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/tenants/search": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "分页搜索空间(需要跨空间访问权限)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "搜索空间", "parameters": [ { "type": "string", "description": "搜索关键词", "name": "keyword", "in": "query" }, { "type": "integer", "description": "空间ID筛选", "name": "tenant_id", "in": "query" }, { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 20, "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "搜索结果", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "权限不足", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/tenants/{id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据ID获取空间详情", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "获取空间详情", "parameters": [ { "type": "integer", "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" } }, "404": { "description": "空间不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "put": { "security": [ { "Bearer": [] } ], "description": "更新空间信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "更新空间", "parameters": [ { "type": "integer", "description": "空间ID", "name": "id", "in": "path", "required": true }, { "description": "空间信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Tenant" } } ], "responses": { "200": { "description": "更新后的空间", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } }, "delete": { "security": [ { "Bearer": [] } ], "description": "删除指定的空间", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "删除空间", "parameters": [ { "type": "integer", "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" } } } } }, "/tenants/{id}/api-principal-config": { "get": { "security": [ { "Bearer": [] } ], "description": "返回 X-API-Key 请求如何映射为终端 Principal 的配置(Owner)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "获取空间 API Key 用户身份配置", "parameters": [ { "type": "integer", "description": "空间ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "API principal 配置", "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" } } } }, "put": { "security": [ { "Bearer": [] } ], "description": "配置 X-API-Key 请求如何映射为终端 Principal(Owner)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "更新空间 API Key 用户身份配置", "parameters": [ { "type": "integer", "description": "空间ID", "name": "id", "in": "path", "required": true }, { "description": "API principal 配置", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.apiPrincipalConfigRequest" } } ], "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" } } } } }, "/tenants/{id}/api-principal-test-token": { "post": { "security": [ { "Bearer": [] } ], "description": "使用空间已保存的 HMAC 密钥签发短期外部用户 JWT(Owner)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间管理" ], "summary": "生成 API Playground 测试 JWT", "parameters": [ { "type": "integer", "description": "空间ID", "name": "id", "in": "path", "required": true }, { "description": "测试 Token 参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.apiPrincipalTestTokenRequest" } } ], "responses": { "200": { "description": "短期 JWT", "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" } } } } }, "/tenants/{id}/audit-log": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "返回该空间最近的审计事件,按 id 倒序。游标分页:将上次响应的 next_cursor 作为下一次请求的 after_id。", "produces": [ "application/json" ], "tags": [ "审计日志" ], "summary": "获取空间审计日志", "parameters": [ { "type": "string", "description": "空间ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "游标:返回 id 小于此值的记录(默认从最新开始)", "name": "after_id", "in": "query" }, { "type": "integer", "description": "页大小,1-100,默认 50", "name": "limit", "in": "query" }, { "type": "string", "description": "按 action 精确过滤(如 rbac.member_added / rbac.access_denied)", "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" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/tenants/{id}/invitations": { "get": { "security": [ { "Bearer": [] } ], "description": "按空间列出待接受 / 历史邀请。query include_terminal=true 时附带 accepted/declined/revoked/expired。", "produces": [ "application/json" ], "tags": [ "空间邀请" ], "summary": "列出空间邀请", "parameters": [ { "type": "string", "description": "空间 ID", "name": "id", "in": "path", "required": true }, { "type": "boolean", "description": "是否包含终止态行(默认 false)", "name": "include_terminal", "in": "query" }, { "type": "integer", "default": 1, "description": "页码(从 1 起)", "name": "page", "in": "query" }, { "type": "integer", "default": 20, "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } }, "post": { "security": [ { "Bearer": [] } ], "description": "Owner 通过邮箱邀请已注册用户加入当前空间;被邀请人需要在 /me/invitations 接受后才会成为成员。", "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.createInvitationRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "type": "object", "additionalProperties": true } } } } }, "/tenants/{id}/invitations/{inv_id}": { "delete": { "security": [ { "Bearer": [] } ], "description": "Owner 取消一条还在 pending 的邀请;已 accepted/declined/revoked/expired 的行不可再撤销。", "produces": [ "application/json" ], "tags": [ "空间邀请" ], "summary": "撤销待接受邀请", "parameters": [ { "type": "string", "description": "空间 ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "邀请 ID", "name": "inv_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/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": [ { "Bearer": [] } ], "description": "调用方主动退出当前空间。等价于以自己的 user_id 调 RemoveMember,", "produces": [ "application/json" ], "tags": [ "空间成员" ], "summary": "退出当前空间", "parameters": [ { "type": "string", "description": "空间 ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/tenants/{id}/members": { "get": { "security": [ { "Bearer": [] } ], "description": "分页返回当前空间内 active 成员(含每位成员的角色、邮箱、头像);支持 q 按邮箱/用户名筛选", "produces": [ "application/json" ], "tags": [ "空间成员" ], "summary": "列出空间成员", "parameters": [ { "type": "string", "description": "空间 ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "按邮箱/用户名模糊筛选", "name": "q", "in": "query" }, { "type": "integer", "default": 1, "description": "页码(从 1 起)", "name": "page", "in": "query" }, { "type": "integer", "default": 20, "description": "每页数量(最大 100)", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } }, "post": { "security": [ { "Bearer": [] } ], "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.addMemberRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "type": "object", "additionalProperties": true } } } } }, "/tenants/{id}/members/{user_id}": { "put": { "security": [ { "Bearer": [] } ], "description": "Owner 修改某位成员在当前空间内的角色;不能将最后一位 Owner 降级", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "空间成员" ], "summary": "修改空间成员角色", "parameters": [ { "type": "string", "description": "空间 ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "用户 ID", "name": "user_id", "in": "path", "required": true }, { "description": "目标角色", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.updateMemberRoleRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } }, "delete": { "security": [ { "Bearer": [] } ], "description": "Owner 将某位成员从当前空间中移除(软删除 tenant_members 行);不能移除最后一位 Owner", "produces": [ "application/json" ], "tags": [ "空间成员" ], "summary": "移除空间成员", "parameters": [ { "type": "string", "description": "空间 ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "用户 ID", "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/user/favorites": { "get": { "description": "Lists this user's starred resources in the current workspace for a given type", "tags": [ "User" ], "summary": "List my favorites", "parameters": [ { "type": "string", "description": "Resource type (kb | agent)", "name": "type", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } }, "post": { "tags": [ "User" ], "summary": "Star a resource", "parameters": [ { "description": "Type + id", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.AddFavoriteRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/user/favorites/{type}/{id}": { "delete": { "tags": [ "User" ], "summary": "Unstar a resource", "parameters": [ { "type": "string", "description": "Resource type", "name": "type", "in": "path", "required": true }, { "type": "string", "description": "Resource id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/vector-stores": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "List all vector stores for the current workspace, including environment-configured and user-created stores", "produces": [ "application/json" ], "tags": [ "VectorStore" ], "summary": "List vector stores", "responses": { "200": { "description": "List of vector stores (env + DB)", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } } } }, "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Create a new vector store configuration for the current workspace", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "VectorStore" ], "summary": "Create vector store", "parameters": [ { "description": "Vector store configuration", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.CreateStoreRequest" } } ], "responses": { "201": { "description": "Created vector store", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Invalid request or validation error", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "409": { "description": "Duplicate endpoint and index", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } } } }, "/vector-stores/test": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Test connectivity using provided credentials without persisting. Returns detected server version.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "VectorStore" ], "summary": "Test vector store connection with raw credentials", "parameters": [ { "description": "Engine type and connection config", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.TestStoreRequest" } } ], "responses": { "200": { "description": "Connection test result (success, version)", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Invalid request", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } } } } }, "/vector-stores/types": { "get": { "description": "Return supported engine types with connection and index field schemas for UI form generation", "produces": [ "application/json" ], "tags": [ "VectorStore" ], "summary": "List vector store types", "responses": { "200": { "description": "List of engine types with config schemas", "schema": { "type": "object", "additionalProperties": true } } } } }, "/vector-stores/{id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Retrieve a single vector store by ID. Supports both DB stores and env stores (__env_* IDs)", "produces": [ "application/json" ], "tags": [ "VectorStore" ], "summary": "Get vector store", "parameters": [ { "type": "string", "description": "Vector store ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Vector store details", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Vector store not found", "schema": { "type": "object", "additionalProperties": true } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Update a vector store (name only). Engine type, connection config, and index config are immutable. Env stores cannot be modified.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "VectorStore" ], "summary": "Update vector store", "parameters": [ { "type": "string", "description": "Vector store ID", "name": "id", "in": "path", "required": true }, { "description": "Updated fields", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.UpdateStoreRequest" } } ], "responses": { "200": { "description": "Updated vector store", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Env store or validation error", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Vector store not found", "schema": { "type": "object", "additionalProperties": true } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Soft-delete a vector store. Env stores cannot be deleted.", "produces": [ "application/json" ], "tags": [ "VectorStore" ], "summary": "Delete vector store", "parameters": [ { "type": "string", "description": "Vector store ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Deletion success", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Env store cannot be deleted", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Vector store not found", "schema": { "type": "object", "additionalProperties": true } } } } }, "/vector-stores/{id}/test": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "Test connectivity of an existing saved or env store. Returns detected server version. For DB stores, the version is automatically saved to connection_config.", "produces": [ "application/json" ], "tags": [ "VectorStore" ], "summary": "Test vector store connection by ID", "parameters": [ { "type": "string", "description": "Vector store ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Connection test result (success, version)", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Vector store not found", "schema": { "type": "object", "additionalProperties": true } } } } }, "/web-search-providers/test": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "使用前端表单中尚未保存的凭证测试连通性,用于\"测试连接\"按钮", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "网络搜索" ], "summary": "使用原始凭证测试 Provider(不落库)", "parameters": [ { "description": "{provider, parameters}", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.TestProviderRequest" } } ], "responses": { "200": { "description": "测试结果", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "type": "object", "additionalProperties": true } } } } }, "/web-search-providers/types": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "返回 UI 表单需要的 provider 类型及参数定义", "produces": [ "application/json" ], "tags": [ "网络搜索" ], "summary": "获取网络搜索 Provider 类型元数据", "responses": { "200": { "description": "provider 类型列表", "schema": { "type": "object", "additionalProperties": true } } } } }, "/web-search-providers/{id}": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "根据 ID 获取指定 provider 配置", "produces": [ "application/json" ], "tags": [ "网络搜索" ], "summary": "获取网络搜索 Provider 详情", "parameters": [ { "type": "string", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Provider 详情", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WebSearchProviderEntity" } }, "404": { "description": "Provider 不存在", "schema": { "type": "object", "additionalProperties": true } } } }, "put": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "更新指定 provider 的名称/描述/参数/是否默认", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "网络搜索" ], "summary": "更新网络搜索 Provider", "parameters": [ { "type": "string", "description": "Provider ID", "name": "id", "in": "path", "required": true }, { "description": "更新字段", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_handler.UpdateProviderRequest" } } ], "responses": { "200": { "description": "更新后的 Provider", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WebSearchProviderEntity" } }, "400": { "description": "请求参数错误", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Provider 不存在", "schema": { "type": "object", "additionalProperties": true } } } }, "delete": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "删除指定 provider 配置", "produces": [ "application/json" ], "tags": [ "网络搜索" ], "summary": "删除网络搜索 Provider", "parameters": [ { "type": "string", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "success: true", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Provider 不存在", "schema": { "type": "object", "additionalProperties": true } } } } }, "/web-search-providers/{id}/test": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "使用数据库中已保存的凭证测试连通性", "produces": [ "application/json" ], "tags": [ "网络搜索" ], "summary": "测试已保存的 Provider", "parameters": [ { "type": "string", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "测试结果", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Provider 不存在", "schema": { "type": "object", "additionalProperties": true } } } } }, "/web-search/providers": { "get": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "返回所有已注册的网络搜索 provider(含元数据)", "produces": [ "application/json" ], "tags": [ "网络搜索" ], "summary": "获取可用网络搜索 Provider 列表", "responses": { "200": { "description": "provider 列表", "schema": { "type": "object", "additionalProperties": true } } } } }, "/wechat/qrcode": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "申请一个用于扫码登录绑定的微信二维码(无请求体)", "produces": [ "application/json" ], "tags": [ "IM 渠道" ], "summary": "获取微信扫码登录二维码", "responses": { "200": { "description": "二维码信息(qrcode_url + qrcode 标识)", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "二维码生成失败", "schema": { "type": "object", "additionalProperties": true } } } } }, "/wechat/qrcode/status": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "查询指定二维码是否已被扫描/确认/过期;confirmed 时返回凭证", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "IM 渠道" ], "summary": "轮询微信二维码状态", "parameters": [ { "description": "{qrcode: string}", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } } ], "responses": { "200": { "description": "扫码状态", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "服务器错误", "schema": { "type": "object", "additionalProperties": true } } } } }, "/weknoracloud/credentials": { "post": { "security": [ { "Bearer": [] }, { "ApiKeyAuth": [] } ], "description": "保存 APPID/APPSECRET 到当前空间配置(不自动创建模型)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "WeKnoraCloud" ], "summary": "保存 WeKnoraCloud 凭证", "parameters": [ { "description": "{app_id, app_secret}", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } } ], "responses": { "200": { "description": "success: true", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "请求参数错误", "schema": { "type": "object", "additionalProperties": true } } } } } }, "definitions": { "github_com_Tencent_WeKnora_internal_application_service.WikiLintIssue": { "type": "object", "properties": { "auto_fixable": { "type": "boolean" }, "description": { "type": "string" }, "page_slug": { "type": "string" }, "severity": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_application_service.WikiLintIssueSeverity" }, "target_slug": { "description": "TargetSlug identifies the other page involved in the issue (e.g. the\nbroken link target, or the entity slug for a missing cross-ref). It is\nthe structured field used by AutoFix instead of parsing Description.", "type": "string" }, "type": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_application_service.WikiLintIssueType" } } }, "github_com_Tencent_WeKnora_internal_application_service.WikiLintIssueSeverity": { "type": "string", "enum": [ "info", "warning", "error" ], "x-enum-varnames": [ "SeverityInfo", "SeverityWarning", "SeverityError" ] }, "github_com_Tencent_WeKnora_internal_application_service.WikiLintIssueType": { "type": "string", "enum": [ "orphan_page", "broken_link", "stale_ref", "missing_cross_ref", "empty_content", "duplicate_slug" ], "x-enum-varnames": [ "LintIssueOrphanPage", "LintIssueBrokenLink", "LintIssueStaleRef", "LintIssueMissingCrossRef", "LintIssueEmptyContent", "LintIssueDuplicateSlug" ] }, "github_com_Tencent_WeKnora_internal_application_service.WikiLintReport": { "type": "object", "properties": { "health_score": { "description": "0-100", "type": "integer" }, "issues": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_application_service.WikiLintIssue" } }, "knowledge_base_id": { "type": "string" }, "stats": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiStats" }, "summary": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_datasource.ConnectorMetadata": { "type": "object", "properties": { "auth_type": { "description": "\"oauth2\", \"api_key\", \"token\", etc.", "type": "string" }, "capabilities": { "description": "\"incremental\", \"webhook\", \"deletion_sync\", etc.", "type": "array", "items": { "type": "string" } }, "description": { "type": "string" }, "icon": { "type": "string" }, "name": { "type": "string" }, "priority": { "description": "Priority order for UI display (lower = higher priority)", "type": "integer" }, "type": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_errors.AppError": { "type": "object", "properties": { "code": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.ErrorCode" }, "details": {}, "message": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_errors.ErrorCode": { "type": "integer", "enum": [ 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 2000, 2001, 2002, 2003, 2004, 2005, 2100, 2101, 2102, 2103, 2200, 2201 ], "x-enum-varnames": [ "ErrBadRequest", "ErrUnauthorized", "ErrForbidden", "ErrNotFound", "ErrMethodNotAllowed", "ErrConflict", "ErrTooManyRequests", "ErrInternalServer", "ErrServiceUnavailable", "ErrTimeout", "ErrValidation", "ErrTenantNotFound", "ErrTenantAlreadyExists", "ErrTenantInactive", "ErrTenantNameRequired", "ErrTenantInvalidStatus", "ErrTenantCreationDisabled", "ErrAgentMissingThinkingModel", "ErrAgentMissingAllowedTools", "ErrAgentInvalidMaxIterations", "ErrAgentInvalidTemperature", "ErrVectorStoreBindingInvalid", "ErrVectorStoreUnavailable" ] }, "github_com_Tencent_WeKnora_internal_infrastructure_chunker.DocProfile": { "type": "object", "properties": { "all_caps_short_line_count": { "type": "integer" }, "avg_line_len": { "type": "number" }, "blank_paragraph_breaks": { "type": "integer" }, "chinese_chapter_count": { "type": "integer" }, "code_ratio": { "type": "number" }, "detected_langs": { "description": "Detected language hints (best-effort)", "type": "array", "items": { "type": "string" } }, "english_chapter_count": { "type": "integer" }, "form_feed_count": { "type": "integer" }, "german_chapter_count": { "type": "integer" }, "has_code": { "type": "boolean" }, "has_tables": { "description": "Content characteristics", "type": "boolean" }, "md_heading_counts": { "description": "Markdown structure", "type": "object", "additionalProperties": { "type": "integer" } }, "md_heading_total": { "type": "integer" }, "numbered_section_count": { "description": "Heuristic indicators", "type": "integer" }, "repeated_footer_count": { "type": "integer" }, "std_line_len": { "type": "number" }, "total_chars": { "type": "integer" }, "total_lines": { "type": "integer" }, "visual_sep_count": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_infrastructure_chunker.StrategyTier": { "type": "string", "enum": [ "heading", "heuristic", "legacy" ], "x-enum-varnames": [ "TierHeading", "TierHeuristic", "TierLegacy" ] }, "github_com_Tencent_WeKnora_internal_infrastructure_chunker.TierRejection": { "type": "object", "properties": { "reason": { "type": "string" }, "tier": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_infrastructure_chunker.StrategyTier" } } }, "github_com_Tencent_WeKnora_internal_models_limiter.RuntimeStat": { "type": "object", "properties": { "active": { "type": "integer" }, "limit": { "type": "integer" }, "model_id": { "type": "string" }, "name": { "type": "string" }, "waiting": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.APIPrincipalMode": { "type": "string", "enum": [ "tenant", "direct_header", "signed_token" ], "x-enum-varnames": [ "APIPrincipalModeTenant", "APIPrincipalModeDirect", "APIPrincipalModeSignedToken" ] }, "github_com_Tencent_WeKnora_internal_types.ASRConfig": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "language": { "description": "optional: language hint for transcription", "type": "string" }, "model_id": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.AgentStep": { "type": "object", "properties": { "iteration": { "description": "Iteration number (0-indexed)", "type": "integer" }, "reasoning_content": { "description": "ReasoningContent stores the OpenAI-protocol reasoning_content emitted by the\nmodel in this round. Persisted on AgentStep so cross-turn replay can put it\nback on the assistant message — required by MiMo / DeepSeek V3.2+ thinking\nmode, ignored by providers that don't recognize the field.", "type": "string" }, "thought": { "description": "LLM's reasoning/thinking (Think phase)", "type": "string" }, "timestamp": { "description": "When this step occurred", "type": "string" }, "tool_calls": { "description": "Tools called in this step (Act phase)", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ToolCall" } } } }, "github_com_Tencent_WeKnora_internal_types.AnswerStrategy": { "type": "string", "enum": [ "all", "random" ], "x-enum-varnames": [ "AnswerStrategyAll", "AnswerStrategyRandom" ] }, "github_com_Tencent_WeKnora_internal_types.AuditAction": { "type": "string", "enum": [ "rbac.member_added", "rbac.member_removed", "rbac.member_role_changed", "rbac.member_left", "rbac.access_denied", "rbac.invitation_sent", "rbac.invitation_accepted", "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", "system.user_password_reset", "system.api_key_created", "system.api_key_revoked", "system.queue_task_retried", "system.queue_task_deleted", "system.queue_task_run_now", "system.queue_task_cancelled", "system.queue_archived_purged", "kb.created", "kb.updated", "kb.deleted", "kb.duplicated", "kb.clone_started", "kb.clone_completed", "kb.clone_failed", "knowledge.created", "knowledge.updated", "knowledge.deleted", "knowledge.batch_deleted", "knowledge.reparse_started", "knowledge.parse_canceled", "knowledge.move_started", "knowledge.move_completed", "knowledge.move_failed", "tag.created", "tag.updated", "tag.deleted", "datasource.created", "datasource.updated", "datasource.deleted", "datasource.sync_started", "datasource.sync_completed", "datasource.sync_failed", "datasource.paused", "datasource.resumed", "kb.share_added", "kb.share_permission_changed", "kb.share_removed", "wiki.content_changed", "faq.import_started", "faq.import_completed", "faq.import_failed" ], "x-enum-varnames": [ "AuditActionMemberAdded", "AuditActionMemberRemoved", "AuditActionMemberRoleChanged", "AuditActionMemberLeft", "AuditActionAccessDenied", "AuditActionInvitationSent", "AuditActionInvitationAccepted", "AuditActionInvitationDeclined", "AuditActionInvitationRevoked", "AuditActionInvitationExpired", "AuditActionVectorStoreCreated", "AuditActionVectorStoreUpdated", "AuditActionVectorStoreDeleted", "AuditActionOpenSearchIndexCreated", "AuditActionOpenSearchIndexDeleted", "AuditActionOpenSearchReindexExecuted", "AuditActionSystemSettingChanged", "AuditActionSystemAdminPromoted", "AuditActionSystemAdminRevoked", "AuditActionSystemUserPasswordReset", "AuditActionSystemAPIKeyCreated", "AuditActionSystemAPIKeyRevoked", "AuditActionSystemQueueTaskRetried", "AuditActionSystemQueueTaskDeleted", "AuditActionSystemQueueTaskRunNow", "AuditActionSystemQueueTaskCancelled", "AuditActionSystemQueueArchivedPurged", "AuditActionKBCreated", "AuditActionKBUpdated", "AuditActionKBDeleted", "AuditActionKBDuplicated", "AuditActionKBCloneStarted", "AuditActionKBCloneCompleted", "AuditActionKBCloneFailed", "AuditActionKnowledgeCreated", "AuditActionKnowledgeUpdated", "AuditActionKnowledgeDeleted", "AuditActionKnowledgeBatchDeleted", "AuditActionKnowledgeReparseStarted", "AuditActionKnowledgeParseCanceled", "AuditActionKnowledgeMoveStarted", "AuditActionKnowledgeMoveCompleted", "AuditActionKnowledgeMoveFailed", "AuditActionTagCreated", "AuditActionTagUpdated", "AuditActionTagDeleted", "AuditActionDataSourceCreated", "AuditActionDataSourceUpdated", "AuditActionDataSourceDeleted", "AuditActionDataSourceSyncStarted", "AuditActionDataSourceSyncCompleted", "AuditActionDataSourceSyncFailed", "AuditActionDataSourcePaused", "AuditActionDataSourceResumed", "AuditActionKBShareAdded", "AuditActionKBSharePermissionChanged", "AuditActionKBShareRemoved", "AuditActionWikiContentChanged", "AuditActionFAQImportStarted", "AuditActionFAQImportCompleted", "AuditActionFAQImportFailed" ] }, "github_com_Tencent_WeKnora_internal_types.AuditLog": { "type": "object", "properties": { "action": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AuditAction" }, "actor_role": { "type": "string" }, "actor_user_id": { "type": "string" }, "created_at": { "type": "string" }, "details": { "type": "array", "items": { "type": "integer" } }, "id": { "type": "integer" }, "outcome": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AuditOutcome" }, "request_method": { "type": "string" }, "request_path": { "type": "string" }, "scope_id": { "type": "string" }, "scope_type": { "type": "string" }, "target_id": { "type": "string" }, "target_type": { "type": "string" }, "target_user_id": { "type": "string" }, "tenant_id": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.AuditOutcome": { "type": "string", "enum": [ "success", "accepted", "denied", "failed", "partial", "canceled" ], "x-enum-varnames": [ "AuditOutcomeSuccess", "AuditOutcomeAccepted", "AuditOutcomeDenied", "AuditOutcomeFailed", "AuditOutcomePartial", "AuditOutcomeCanceled" ] }, "github_com_Tencent_WeKnora_internal_types.COSEngineConfig": { "type": "object", "properties": { "app_id": { "type": "string" }, "bucket_name": { "type": "string" }, "path_prefix": { "type": "string" }, "region": { "type": "string" }, "secret_id": { "type": "string" }, "secret_key": { "type": "string" }, "temp_bucket_name": { "type": "string" }, "temp_region": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.ChatHistoryConfig": { "type": "object", "properties": { "embedding_model_id": { "description": "EmbeddingModelID is the ID of the embedding model used for vectorizing chat messages.\nOnce messages have been indexed, the model cannot be changed (requires re-indexing).", "type": "string" }, "enabled": { "description": "Enabled controls whether chat history indexing is active", "type": "boolean" }, "knowledge_base_id": { "description": "KnowledgeBaseID is the auto-managed hidden knowledge base for chat history.\nThis is set internally when the feature is first enabled; users should not set this directly.", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.ChunkingConfig": { "type": "object", "properties": { "child_chunk_size": { "description": "ChildChunkSize is the size of child chunks used for embedding (default: 384).\nOnly used when EnableParentChild is true.", "type": "integer" }, "chunk_overlap": { "description": "Chunk overlap", "type": "integer" }, "chunk_size": { "description": "Chunk size", "type": "integer" }, "enable_parent_child": { "description": "EnableParentChild enables two-level parent-child chunking strategy.\nWhen enabled, large parent chunks provide context while small child chunks\nare used for vector matching. Retrieval matches on child but returns parent content.", "type": "boolean" }, "languages": { "description": "Languages hints the heuristic patterns. Empty = auto-detect from content.\nExamples: [\"de\"], [\"en\", \"zh\"].", "type": "array", "items": { "type": "string" } }, "parent_chunk_size": { "description": "ParentChunkSize is the size of parent chunks (default: 4096).\nOnly used when EnableParentChild is true.", "type": "integer" }, "parser_engine_rules": { "description": "ParserEngineRules configures which parser engine to use for each file type.\nWhen empty, the builtin engine is used for all types.", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ParserEngineRule" } }, "separators": { "description": "Separators", "type": "array", "items": { "type": "string" } }, "strategy": { "description": "Strategy selects the adaptive chunking tier. Empty / \"legacy\" preserves\nthe historical recursive splitter; \"auto\" lets a profiler pick between\nheading-aware, heuristic and recursive tiers; \"heading\" / \"heuristic\" /\n\"recursive\" pin the tier explicitly.", "type": "string" }, "table_metadata_instructions": { "description": "TableMetadataInstructions contains optional business guidance used when\ngenerating searchable summaries for CSV/Excel tables. The system-owned\noutput contract remains fixed; these instructions only add domain context.", "type": "string" }, "token_limit": { "description": "TokenLimit caps chunk size in approximate tokens. 0 = use ChunkSize\nas a character count.", "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.ConnectionConfig": { "type": "object", "properties": { "addr": { "description": "Common", "type": "string" }, "api_key": { "description": "AES-GCM encrypted", "type": "string" }, "database": { "description": "Database name used by engines that support database-level namespaces\n(currently Milvus, Tencent VectorDB, and Doris).", "type": "string" }, "grpc_address": { "description": "Weaviate", "type": "string" }, "host": { "description": "Qdrant", "type": "string" }, "http_port": { "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" }, "port": { "type": "integer" }, "scheme": { "type": "string" }, "use_default_connection": { "description": "Postgres", "type": "boolean" }, "use_tls": { "type": "boolean" }, "username": { "type": "string" }, "version": { "description": "Version is the detected server version (e.g., \"7.10.1\", \"16.2\", \"1.12.6\").\nAuto-populated by TestConnection on successful connectivity check.", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.ContextCompressionStrategy": { "type": "string", "enum": [ "sliding_window", "smart" ], "x-enum-varnames": [ "ContextCompressionSlidingWindow", "ContextCompressionSmart" ] }, "github_com_Tencent_WeKnora_internal_types.ContextConfig": { "type": "object", "properties": { "compression_strategy": { "description": "Compression strategy: \"sliding_window\" or \"smart\"", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ContextCompressionStrategy" } ] }, "max_tokens": { "description": "Maximum tokens allowed in LLM context", "type": "integer" }, "recent_message_count": { "description": "For sliding_window: number of messages to keep\nFor smart: number of recent messages to keep uncompressed", "type": "integer" }, "summarize_threshold": { "description": "Summarize threshold: number of messages before summarization", "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.CreateOrganizationRequest": { "type": "object", "required": [ "name" ], "properties": { "avatar": { "description": "optional avatar URL", "type": "string", "maxLength": 512 }, "description": { "type": "string", "maxLength": 1000 }, "invite_code_validity_days": { "description": "optional: 0=never, 1, 7, 30; default 7", "type": "integer" }, "member_limit": { "description": "optional: max members; 0=unlimited; default 50", "type": "integer" }, "name": { "type": "string", "maxLength": 255, "minLength": 1 } } }, "github_com_Tencent_WeKnora_internal_types.CredentialsConfig": { "type": "object", "properties": { "weknoracloud": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WeKnoraCloudCredentials" } } }, "github_com_Tencent_WeKnora_internal_types.CustomAgentConfig": { "type": "object", "properties": { "agent_mode": { "description": "===== Basic Settings =====\nAgent mode: \"quick-answer\" for RAG mode, \"smart-reasoning\" for ReAct agent mode", "type": "string" }, "agent_type": { "description": "AgentType is a preset category under smart-reasoning mode that pre-fills\nsystem prompt, allowed tools and recommended KB compatibility.\nValid values: \"rag-qa\", \"wiki-qa\", \"hybrid-rag-wiki\", \"custom\".\nEmpty / unknown values are treated as \"custom\" (no preset applied).\nIgnored for quick-answer mode.", "type": "string" }, "allowed_tools": { "description": "Allowed tools (only for agent type)", "type": "array", "items": { "type": "string" } }, "asr_model_id": { "description": "ASR model ID for audio transcription (optional)", "type": "string" }, "attachment_image_understanding": { "description": "AttachmentImageUnderstanding enables VLM OCR fallback for image-only /\nscanned documents (PDF/PPT whose pages are images). Disabled by default\nbecause it materially increases parse latency; only triggers when the\nextracted text is below a threshold and a VLM model is configured.", "type": "boolean" }, "attachment_ocr_max_pages": { "description": "AttachmentOCRMaxPages caps how many pages of a scanned / image-only\ndocument this agent sends to the VLM for OCR. 0 falls back to the global\ndefault (WEKNORA_CHAT_ATTACHMENT_OCR_MAX_PAGES). More pages means higher\ncoverage but slower parsing and more VLM cost.", "type": "integer" }, "attachment_parse_wait_timeout_sec": { "description": "AttachmentParseWaitTimeoutSec bounds, in seconds, how long a chat turn\nwaits for this agent's still-parsing attachments before proceeding with\nonly the finished ones. 0 falls back to the global default\n(WEKNORA_CHAT_ATTACHMENT_WAIT_TIMEOUT_SEC).", "type": "integer" }, "audio_upload_enabled": { "description": "Whether audio upload (ASR transcription) is enabled for this agent (default: false)", "type": "boolean" }, "chat_parser_engine_rules": { "description": "===== Chat Attachment Parsing Settings =====\nChatParserEngineRules selects parser engines for session-scoped chat\nattachments by file type. Takes precedence over the tenant-level\nParserEngineConfig.ChatParserEngineRules; an explicit per-request\nparser_engine still overrides both.", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ParserEngineRule" } }, "citation_enabled": { "description": "Whether final answers include knowledge/web source citations. Nil defaults to true\nso agents saved before this option was introduced keep their existing behavior.", "type": "boolean" }, "context_template": { "description": "Context template for normal mode (how to format retrieved chunks)", "type": "string" }, "context_template_id": { "description": "ContextTemplateID references a template ID in prompt_templates/ YAML files.\nIf set and ContextTemplate is empty, the template content will be resolved at startup.", "type": "string" }, "data_analysis_enabled": { "description": "===== Data Analysis Settings =====\nWhether to run the legacy in-pipeline DuckDB SQL data-analysis stage when\nthe retrieved chunks include CSV/Excel files. This issues an extra LLM\ncall to generate a SQL query and is disabled by default because most\nquick-answer / RAG-style agents do not want the added latency.", "type": "boolean" }, "embedding_top_k": { "description": "===== Retrieval Strategy Settings (for both modes) =====\nEmbedding/Vector retrieval top K", "type": "integer" }, "enable_query_expansion": { "description": "===== Advanced Settings (mainly for normal mode) =====\nWhether to enable query expansion", "type": "boolean" }, "enable_rewrite": { "description": "Whether to enable query rewrite for multi-turn conversations", "type": "boolean" }, "fallback_prompt": { "description": "Fallback prompt (when FallbackStrategy is \"model\")", "type": "string" }, "fallback_response": { "description": "Fixed fallback response (when FallbackStrategy is \"fixed\")", "type": "string" }, "fallback_strategy": { "description": "Fallback strategy: \"fixed\" for fixed response, \"model\" for model generation", "type": "string" }, "faq_direct_answer_threshold": { "description": "FAQ direct answer threshold - if similarity \u003e this value, use FAQ answer directly", "type": "number" }, "faq_priority_enabled": { "description": "===== FAQ Strategy Settings =====\nWhether FAQ priority strategy is enabled (FAQ answers prioritized over document chunks)", "type": "boolean" }, "faq_score_boost": { "description": "FAQ score boost multiplier - FAQ results score multiplied by this factor", "type": "number" }, "history_turns": { "description": "Number of history turns to keep in context", "type": "integer" }, "image_storage_provider": { "description": "Storage provider for image uploads: \"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\".\nEmpty means use the global/workspace default provider.", "type": "string" }, "image_upload_enabled": { "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" }, "keyword_threshold": { "description": "Keyword retrieval threshold", "type": "number" }, "knowledge_bases": { "description": "Associated knowledge base IDs (only used when KBSelectionMode is \"selected\")", "type": "array", "items": { "type": "string" } }, "llm_call_timeout": { "description": "Timeout for a single LLM call in seconds (0 = use global default)", "type": "integer" }, "max_completion_tokens": { "description": "Maximum completion tokens (only for normal mode)", "type": "integer" }, "max_iterations": { "description": "===== Agent Mode Settings =====\nMaximum iterations for ReAct loop (only for agent type)", "type": "integer" }, "mcp_auth_wait_timeout": { "description": "MCPAuthWaitTimeout is how many seconds to wait for in-conversation OAuth\nauthorization before skipping. \u003c=0 uses the gate's configured timeout.", "type": "integer" }, "mcp_selection_mode": { "description": "MCP service selection mode: \"all\" = all enabled MCP services, \"selected\" = specific services, \"none\" = no MCP", "type": "string" }, "mcp_services": { "description": "Selected MCP service IDs (only used when MCPSelectionMode is \"selected\")", "type": "array", "items": { "type": "string" } }, "model_id": { "description": "===== Model Settings =====\nModel ID to use for conversations", "type": "string" }, "multi_turn_enabled": { "description": "===== Multi-turn Conversation Settings =====\nWhether multi-turn conversation is enabled", "type": "boolean" }, "query_understand_model_id": { "description": "Dedicated chat model ID for the query-understanding (rewrite + intent) step.\nWhen empty, the main conversation ModelID is used as a fallback.", "type": "string" }, "question_suggestions": { "description": "===== Conversation Question Suggestions =====\nQuestionSuggestions owns both the static/knowledge-backed prompts shown\nbefore the first user turn and the contextual follow-up questions shown\nafter a completed assistant answer.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionSuggestionConfig" } ] }, "rerank_model_id": { "description": "ReRank model ID for retrieval", "type": "string" }, "rerank_threshold": { "description": "Rerank threshold", "type": "number" }, "rerank_top_k": { "description": "Rerank top K", "type": "integer" }, "retain_retrieval_history": { "description": "Whether to retain retrieval history across turns", "type": "boolean" }, "retrieve_kb_only_when_mentioned": { "description": "Whether to retrieve knowledge base only when explicitly mentioned with @ (default: false)\nWhen true, knowledge base retrieval only happens if user explicitly mentions KB/files with @\nWhen false, knowledge base retrieval happens according to KBSelectionMode", "type": "boolean" }, "rewrite_prompt_system": { "description": "Rewrite prompt system message", "type": "string" }, "rewrite_prompt_user": { "description": "Rewrite prompt user message template", "type": "string" }, "selected_skills": { "description": "Selected skill names (only used when SkillsSelectionMode is \"selected\")", "type": "array", "items": { "type": "string" } }, "skills_selection_mode": { "description": "===== Skills Settings (only for smart-reasoning mode) =====\nSkills selection mode: \"all\" = all preloaded skills, \"selected\" = specific skills, \"none\" = no skills", "type": "string" }, "supported_file_types": { "description": "===== File Type Restriction Settings =====\nSupported file types for this agent (e.g., [\"csv\", \"xlsx\", \"xls\"])\nEmpty means all file types are supported\nWhen set, only files with matching extensions can be used with this agent", "type": "array", "items": { "type": "string" } }, "system_prompt": { "description": "System prompt for the agent (unified prompt, uses web_search_status placeholder for dynamic behavior)", "type": "string" }, "system_prompt_id": { "description": "SystemPromptID references a template ID in prompt_templates/ YAML files.\nIf set and SystemPrompt is empty, the template content will be resolved at startup.", "type": "string" }, "temperature": { "description": "Temperature for LLM (0-1)", "type": "number" }, "thinking": { "description": "Whether to enable thinking mode (for models that support extended thinking)", "type": "boolean" }, "vector_threshold": { "description": "Vector retrieval threshold", "type": "number" }, "vlm_model_id": { "description": "VLM model ID for image analysis (optional, falls back to workspace-level VLM)", "type": "string" }, "web_fetch_enabled": { "description": "Whether to auto-fetch full page content for reranked web search results", "type": "boolean" }, "web_fetch_top_n": { "description": "Max number of pages to fetch after rerank (default: 3)", "type": "integer" }, "web_search_enabled": { "description": "===== Web Search Settings =====\nWhether web search is enabled", "type": "boolean" }, "web_search_max_results": { "description": "Maximum web search results", "type": "integer" }, "web_search_provider_id": { "description": "WebSearchProviderID references a specific WebSearchProviderEntity.\nIf empty, the workspace's default provider (is_default=true) is used.", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.DataSource": { "type": "object", "properties": { "config": { "description": "Encrypted configuration (API credentials, tokens, etc.)\nStored as JSON with AES-256-GCM encryption", "type": "array", "items": { "type": "integer" } }, "conflict_strategy": { "description": "Conflict resolution strategy: overwrite or skip", "type": "string" }, "created_at": { "description": "Creation timestamp", "type": "string" }, "deleted_at": { "description": "Soft delete timestamp", "allOf": [ { "$ref": "#/definitions/gorm.DeletedAt" } ] }, "error_message": { "description": "Error message if status is \"error\"", "type": "string" }, "id": { "description": "Unique identifier", "type": "string" }, "knowledge_base_id": { "description": "Target knowledge base ID", "type": "string" }, "last_sync_at": { "description": "Last successful sync timestamp", "type": "string" }, "last_sync_cursor": { "description": "Cursor or state for incremental sync (connector-specific)", "type": "array", "items": { "type": "integer" } }, "last_sync_result": { "description": "Summary of last sync result", "type": "array", "items": { "type": "integer" } }, "latest_sync_log": { "description": "Latest sync log (not stored in DB, populated on query)", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog" } ] }, "name": { "description": "User-friendly name", "type": "string" }, "status": { "description": "Current status: active, paused, error", "type": "string" }, "sync_deletions": { "description": "Whether to sync deletions from source", "type": "boolean" }, "sync_log_retention_days": { "description": "Number of days to keep sync logs (default: 30)", "type": "integer" }, "sync_mode": { "description": "Sync mode: \"incremental\" (recommended) or \"full\"", "type": "string" }, "sync_schedule": { "description": "Cron expression for scheduled syncs (e.g., \"0 */6 * * *\" = every 6 hours)", "type": "string" }, "tenant_id": { "description": "Workspace ID for multi-workspace isolation", "type": "integer" }, "total_items_synced": { "description": "Total items synced (not stored in DB, calculated on query)", "type": "integer" }, "type": { "description": "Connector type (feishu, notion, confluence, etc.)", "type": "string" }, "updated_at": { "description": "Last update timestamp", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.EmbeddingParameters": { "type": "object", "properties": { "dimension": { "type": "integer" }, "supports_dimension_override": { "type": "boolean" }, "truncate_prompt_tokens": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.ExtractConfig": { "type": "object", "properties": { "custom_instructions": { "description": "CustomInstructions adds domain-specific extraction guidance while the\nsystem keeps ownership of the structured graph output protocol.", "type": "string" }, "enabled": { "type": "boolean" }, "nodes": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.GraphNode" } }, "relations": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.GraphRelation" } }, "tags": { "type": "array", "items": { "type": "string" } }, "text": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.FAQBatchUpsertPayload": { "type": "object", "required": [ "entries" ], "properties": { "dry_run": { "description": "仅验证,不实际导入", "type": "boolean" }, "entries": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload" } }, "knowledge_id": { "type": "string" }, "mode": { "type": "string", "enum": [ "append", "replace" ] }, "task_id": { "description": "可选,如果不传则自动生成UUID", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.FAQConfig": { "type": "object", "properties": { "index_mode": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQIndexMode" }, "question_index_mode": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQQuestionIndexMode" } } }, "github_com_Tencent_WeKnora_internal_types.FAQEntryFieldsBatchUpdate": { "type": "object", "properties": { "by_id": { "description": "ByID 按条目ID更新,key为条目ID (seq_id)", "type": "object", "additionalProperties": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryFieldsUpdate" } }, "by_tag": { "description": "ByTag 按Tag批量更新,key为TagID (seq_id)", "type": "object", "additionalProperties": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryFieldsUpdate" } }, "exclude_ids": { "description": "ExcludeIDs 在ByTag操作中需要排除的ID列表 (seq_id)", "type": "array", "items": { "type": "integer" } } } }, "github_com_Tencent_WeKnora_internal_types.FAQEntryFieldsUpdate": { "type": "object", "properties": { "is_enabled": { "type": "boolean" }, "is_recommended": { "type": "boolean" }, "tag_id": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.FAQEntryPayload": { "type": "object", "required": [ "standard_question" ], "properties": { "answer_strategy": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AnswerStrategy" }, "answers": { "type": "array", "items": { "type": "string" } }, "id": { "description": "ID 可选,用于数据迁移时指定 seq_id(必须小于自增起始值 100000000)", "type": "integer" }, "is_enabled": { "type": "boolean" }, "is_recommended": { "type": "boolean" }, "negative_questions": { "type": "array", "items": { "type": "string" } }, "similar_questions": { "type": "array", "items": { "type": "string" } }, "standard_question": { "type": "string" }, "tag_id": { "type": "integer" }, "tag_name": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.FAQIndexMode": { "type": "string", "enum": [ "question_only", "question_answer" ], "x-enum-varnames": [ "FAQIndexModeQuestionOnly", "FAQIndexModeQuestionAnswer" ] }, "github_com_Tencent_WeKnora_internal_types.FAQQuestionIndexMode": { "type": "string", "enum": [ "combined", "separate" ], "x-enum-varnames": [ "FAQQuestionIndexModeCombined", "FAQQuestionIndexModeSeparate" ] }, "github_com_Tencent_WeKnora_internal_types.FAQSearchRequest": { "type": "object", "required": [ "query_text" ], "properties": { "first_priority_tag_ids": { "description": "第一优先级标签ID列表,限定命中范围,优先级最高", "type": "array", "items": { "type": "integer" } }, "match_count": { "type": "integer" }, "only_recommended": { "description": "是否仅返回推荐的条目", "type": "boolean" }, "query_text": { "type": "string" }, "second_priority_tag_ids": { "description": "第二优先级标签ID列表,限定命中范围,优先级低于第一优先级", "type": "array", "items": { "type": "integer" } }, "vector_threshold": { "type": "number" } } }, "github_com_Tencent_WeKnora_internal_types.FollowUpSuggestionConfig": { "type": "object", "properties": { "additional_instruction": { "type": "string" }, "allow_regenerate": { "type": "boolean" }, "categories": { "type": "array", "items": { "type": "string" } }, "count": { "type": "integer" }, "enabled": { "type": "boolean" }, "knowledge_fallback": { "type": "boolean" }, "max_context_turns": { "type": "integer" }, "mode": { "type": "string" }, "model_id": { "type": "string" }, "suppress_on_fallback": { "type": "boolean" }, "suppress_when_answer_asks_question": { "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.GraphNode": { "type": "object", "properties": { "attributes": { "type": "array", "items": { "type": "string" } }, "chunks": { "type": "array", "items": { "type": "string" } }, "name": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.GraphRelation": { "type": "object", "properties": { "node1": { "type": "string" }, "node2": { "type": "string" }, "type": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig": { "type": "object", "properties": { "model_id": { "description": "Model ID", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.IndexConfig": { "type": "object", "properties": { "buckets_num": { "description": "Doris: number of buckets per table (DISTRIBUTED BY HASH ... BUCKETS N)", "type": "integer" }, "collection_name": { "description": "Milvus", "type": "string" }, "collection_prefix": { "description": "Qdrant, Weaviate", "type": "string" }, "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 ---\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" }, "number_of_shards": { "description": "ES, OpenSearch", "type": "integer" }, "replica_number": { "description": "Milvus LoadCollection / Tencent VectorDB CreateCollection replicas", "type": "integer" }, "replication_factor": { "description": "Qdrant, Weaviate: number of replicas", "type": "integer" }, "replication_num": { "description": "Doris: replication_num PROPERTIES", "type": "integer" }, "shard_number": { "description": "--- Scalability fields ---", "type": "integer" }, "shards_num": { "description": "Milvus: number of shards per collection (CreateCollection)", "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.IndexingStrategy": { "type": "object", "properties": { "graph_enabled": { "description": "GraphEnabled enables knowledge graph entity/relation extraction", "type": "boolean" }, "keyword_enabled": { "description": "KeywordEnabled enables keyword-based (BM25) search", "type": "boolean" }, "vector_enabled": { "description": "VectorEnabled enables semantic vector embedding and search", "type": "boolean" }, "wiki_enabled": { "description": "WikiEnabled enables automatic wiki page generation from documents", "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.InviteMemberRequest": { "type": "object", "required": [ "role" ], "properties": { "representative_user_id": { "description": "RepresentativeUserID identifies the user attached to the OTM row for\ndisplay/audit. Optional: when unset, the handler picks a stable default\n(the user from the legacy UserID field, or the workspace's owner).", "type": "string" }, "role": { "description": "Role to assign: admin/editor/viewer", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OrgMemberRole" } ] }, "tenant_id": { "description": "TenantID is the workspace to enrol as an org member. Preferred field.", "type": "integer" }, "user_id": { "description": "UserID is retained for backward compatibility. When set without\nTenantID, the handler resolves the user's TenantID and uses this\nuser as the representative.", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.JoinByOrganizationIDRequest": { "type": "object", "required": [ "organization_id" ], "properties": { "message": { "description": "Optional message for join request", "type": "string", "maxLength": 500 }, "organization_id": { "type": "string" }, "role": { "description": "Optional: requested role (admin/editor/viewer); default viewer", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OrgMemberRole" } ] } } }, "github_com_Tencent_WeKnora_internal_types.JoinOrganizationRequest": { "type": "object", "required": [ "invite_code" ], "properties": { "invite_code": { "type": "string", "maxLength": 32, "minLength": 8 } } }, "github_com_Tencent_WeKnora_internal_types.KBCloneTaskStatus": { "type": "string", "enum": [ "pending", "processing", "completed", "failed" ], "x-enum-varnames": [ "KBCloneStatusPending", "KBCloneStatusProcessing", "KBCloneStatusCompleted", "KBCloneStatusFailed" ] }, "github_com_Tencent_WeKnora_internal_types.KS3EngineConfig": { "type": "object", "properties": { "access_key": { "type": "string" }, "bucket_name": { "type": "string" }, "endpoint": { "type": "string" }, "path_prefix": { "type": "string" }, "region": { "type": "string" }, "secret_key": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.Knowledge": { "type": "object", "properties": { "channel": { "description": "Channel indicates through which channel the knowledge was ingested (web, api, browser_extension, wechat, etc.)", "type": "string" }, "created_at": { "description": "Creation time of the knowledge", "type": "string" }, "deleted_at": { "description": "Deletion time of the knowledge", "allOf": [ { "$ref": "#/definitions/gorm.DeletedAt" } ] }, "description": { "description": "Description of the knowledge", "type": "string" }, "embedding_model_id": { "description": "ID of the embedding model", "type": "string" }, "enable_status": { "description": "Enable status of the knowledge", "type": "string" }, "error_message": { "description": "Error message of the knowledge", "type": "string" }, "file_hash": { "description": "File hash of the knowledge", "type": "string" }, "file_name": { "description": "File name of the knowledge", "type": "string" }, "file_path": { "description": "File path of the knowledge", "type": "string" }, "file_size": { "description": "File size of the knowledge", "type": "integer" }, "file_type": { "description": "File type of the knowledge", "type": "string" }, "id": { "description": "Unique identifier of the knowledge", "type": "string" }, "knowledge_base_id": { "description": "ID of the knowledge base", "type": "string" }, "knowledge_base_name": { "description": "Knowledge base name (not stored in database, populated on query)", "type": "string" }, "last_faq_import_result": { "description": "Last FAQ import result (for FAQ type knowledge only)", "type": "array", "items": { "type": "integer" } }, "metadata": { "description": "Metadata of the knowledge", "type": "array", "items": { "type": "integer" } }, "parse_status": { "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" }, "source": { "description": "Source of the knowledge (e.g. URL address for url type, \"manual\" for manual type)", "type": "string" }, "storage_size": { "description": "Storage size of the knowledge", "type": "integer" }, "summary_status": { "description": "Summary status for async summary generation", "type": "string" }, "tags": { "description": "Tags holds the tags associated with this knowledge (populated on query, not persisted directly).", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeTag" } }, "tenant_id": { "description": "Workspace ID", "type": "integer" }, "title": { "description": "Title of the knowledge", "type": "string" }, "type": { "description": "Type of the knowledge", "type": "string" }, "updated_at": { "description": "Last updated time of the knowledge", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.KnowledgeBase": { "type": "object", "properties": { "asr_config": { "description": "ASR config (Automatic Speech Recognition)", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig" } ] }, "chunk_count": { "description": "Chunk count (not stored in database, calculated on query)", "type": "integer" }, "chunking_config": { "description": "Chunking configuration", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig" } ] }, "created_at": { "description": "Creation time of the knowledge base", "type": "string" }, "creator_id": { "description": "CreatorID records the user ID of whoever originally created the KB.\nUsed by the workspace-level RBAC middleware to let Contributors edit\ntheir own KBs without granting them access to everyone else's.\nNullable for backward compatibility with rows created before the\nRBAC migration backfilled the column to the workspace Owner.", "type": "string" }, "creator_name": { "description": "CreatorName 是 CreatorID 对应用户的展示名(username / email 等),\n仅在列表场景由 handler 批量回填,不落库;为空表示创建者无法解析(用户已删除、\nCreatorID 为空的老数据等)。前端用它在卡片来源徽章上做 mine vs workspace 的二分。", "type": "string" }, "deleted_at": { "description": "Deletion time of the knowledge base", "allOf": [ { "$ref": "#/definitions/gorm.DeletedAt" } ] }, "description": { "description": "Description of the knowledge base", "type": "string" }, "embedding_model_id": { "description": "ID of the embedding model", "type": "string" }, "extract_config": { "description": "Extract config", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig" } ] }, "faq_config": { "description": "FAQConfig stores FAQ specific configuration such as indexing strategy", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig" } ] }, "id": { "description": "Unique identifier of the knowledge base", "type": "string" }, "image_processing_config": { "description": "Image processing configuration", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig" } ] }, "indexing_strategy": { "description": "IndexingStrategy controls which indexing pipelines are active for this knowledge base.\nPipelines: vector search, keyword search, wiki generation, knowledge graph extraction.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.IndexingStrategy" } ] }, "is_pinned": { "description": "IsPinned and PinnedAt are computed per-caller from user_kb_pins\n(see migration 000050). They used to be stored on the row itself,\nwhich made pinning a workspace-wide ordering decision gated behind\nthe kb-edit RBAC guard. The columns are still present in legacy\nschemas for rollback safety but are no longer read or written by\nthe application — both fields are tagged `gorm:\"-\"` so GORM\nignores them on every CRUD call and the list handler stamps them\nafter enriching with the caller's pin set.", "type": "boolean" }, "is_processing": { "description": "IsProcessing indicates if there is a processing import task (for FAQ type knowledge bases)", "type": "boolean" }, "is_temporary": { "description": "Whether this knowledge base is temporary (ephemeral) and should be hidden from UI", "type": "boolean" }, "knowledge_count": { "description": "Knowledge count (not stored in database, calculated on query)", "type": "integer" }, "name": { "description": "Name of the knowledge base", "type": "string" }, "pinned_at": { "description": "PinnedAt records when the current caller pinned this knowledge\nbase; nil when they have not.", "type": "string" }, "processing_count": { "description": "ProcessingCount indicates the number of knowledge items being processed (for document type knowledge bases)", "type": "integer" }, "question_generation_config": { "description": "QuestionGenerationConfig stores question generation configuration for document knowledge bases", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig" } ] }, "share_count": { "description": "ShareCount indicates the number of organizations this knowledge base is shared with (not stored in database)", "type": "integer" }, "storage_backend_id": { "description": "StorageBackendID binds this KB to one concrete storage instance. The\nlegacy provider field remains readable during migration only.", "type": "string" }, "storage_config": { "description": "Deprecated: legacy COS config column. Kept for backward compatibility with old data.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.StorageConfig" } ] }, "storage_provider_config": { "description": "Storage provider config (new): only stores provider selection; credentials from workspace StorageEngineConfig", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.StorageProviderConfig" } ] }, "summary_model_id": { "description": "Summary model ID", "type": "string" }, "tenant_id": { "description": "Workspace ID", "type": "integer" }, "type": { "description": "Type of the knowledge base (document, faq, etc.)", "type": "string" }, "updated_at": { "description": "Last updated time of the knowledge base", "type": "string" }, "vector_store_id": { "description": "VectorStoreID references the VectorStore this knowledge base is bound to.\nWhen nil, the KB falls back to the workspace's effective engines derived from\nthe RETRIEVE_DRIVER environment variable (env store flow).\nThis field is set once at creation time and must not be modified afterwards;\nenforcement lives at the GORM layer (`\u003c-:create`) plus the service-layer\nKB update path, which omits this field from its update DTO.", "type": "string" }, "vlm_config": { "description": "VLM config", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig" } ] }, "wiki_config": { "description": "WikiConfig stores wiki-specific configuration (only for wiki type knowledge bases)", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig" } ] } } }, "github_com_Tencent_WeKnora_internal_types.KnowledgeBaseConfig": { "type": "object", "properties": { "chunking_config": { "description": "Chunking configuration", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig" } ] }, "faq_config": { "description": "FAQ configuration (only for FAQ type knowledge bases)", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig" } ] }, "image_processing_config": { "description": "Image processing configuration", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig" } ] }, "indexing_strategy": { "description": "IndexingStrategy controls which indexing pipelines are active.\nnil means \"no change\" when updating (preserves existing strategy).", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.IndexingStrategy" } ] }, "wiki_config": { "description": "Wiki configuration (only for wiki-enabled knowledge bases)", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig" } ] } } }, "github_com_Tencent_WeKnora_internal_types.KnowledgeBaseShareResponse": { "type": "object", "properties": { "chunk_count": { "type": "integer" }, "created_at": { "type": "string" }, "id": { "type": "string" }, "knowledge_base_id": { "type": "string" }, "knowledge_base_name": { "type": "string" }, "knowledge_base_type": { "type": "string" }, "knowledge_count": { "type": "integer" }, "my_permission": { "description": "Effective permission for current user = min(Permission, MyRoleInOrg)", "type": "string" }, "my_role_in_org": { "description": "Current user's role in this organization (admin/editor/viewer)", "type": "string" }, "organization_id": { "type": "string" }, "organization_name": { "type": "string" }, "permission": { "description": "Share permission (what the space was granted: viewer/editor)", "type": "string" }, "require_approval": { "type": "boolean" }, "shared_by_user_id": { "type": "string" }, "shared_by_username": { "type": "string" }, "source_tenant_id": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.KnowledgeMoveProgress": { "type": "object", "properties": { "created_at": { "description": "任务创建时间", "type": "integer" }, "error": { "description": "错误信息", "type": "string" }, "failed": { "description": "失败数", "type": "integer" }, "message": { "description": "状态消息", "type": "string" }, "processed": { "description": "已处理数", "type": "integer" }, "progress": { "description": "0-100", "type": "integer" }, "source_kb_id": { "type": "string" }, "status": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KBCloneTaskStatus" }, "target_kb_id": { "type": "string" }, "task_id": { "type": "string" }, "total": { "description": "总知识数", "type": "integer" }, "updated_at": { "description": "最后更新时间", "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.KnowledgeProcessOverrides": { "type": "object", "properties": { "asr_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig" }, "chunking_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig" }, "enable_multimodel": { "type": "boolean" }, "extract_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig" }, "graph_enabled": { "type": "boolean" }, "parser_engine_overrides": { "description": "ParserEngineOverrides passes key-value configuration to docreader parsers\n(e.g. pdf_force_scanned=true). Merged with workspace-level overrides in the\nparse pipeline; per-upload values take priority on conflict.", "type": "object", "additionalProperties": { "type": "string" } }, "parser_engine_rules": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ParserEngineRule" } }, "question_generation_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig" }, "vlm_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig" } } }, "github_com_Tencent_WeKnora_internal_types.KnowledgeTag": { "type": "object", "properties": { "color": { "description": "Optional display color", "type": "string" }, "created_at": { "description": "Creation time", "type": "string" }, "id": { "description": "Unique identifier of the tag (UUID)", "type": "string" }, "knowledge_base_id": { "description": "Knowledge base ID that this tag belongs to", "type": "string" }, "name": { "description": "Tag name, unique within the same knowledge base", "type": "string" }, "seq_id": { "description": "SeqID is an auto-increment integer ID for external API usage", "type": "integer" }, "sort_order": { "description": "Sort order within the same knowledge base", "type": "integer" }, "tenant_id": { "description": "Workspace ID", "type": "integer" }, "updated_at": { "description": "Last updated time", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.ListMembersResponse": { "type": "object", "properties": { "members": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OrganizationMemberResponse" } }, "total": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.ListOrganizationsResponse": { "type": "object", "properties": { "organizations": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OrganizationResponse" } }, "resource_counts": { "description": "各空间内知识库/智能体数量,供列表侧栏展示", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ResourceCountsByOrgResponse" } ] }, "total": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.ListSharesResponse": { "type": "object", "properties": { "shares": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseShareResponse" } }, "total": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.LocalEngineConfig": { "type": "object", "properties": { "path_prefix": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.LoginRequest": { "type": "object", "required": [ "email", "password" ], "properties": { "email": { "type": "string" }, "password": { "type": "string", "minLength": 6 } } }, "github_com_Tencent_WeKnora_internal_types.LoginResponse": { "type": "object", "properties": { "active_tenant": { "description": "ActiveTenant is the workspace whose ID is encoded in the issued JWT;\nfuture requests are scoped to it until the client calls /auth/switch-tenant.\nDefaults to the user's home workspace on a fresh login.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Tenant" } ] }, "memberships": { "description": "Memberships lists every workspace the user can authenticate into,\nalong with their role in each. Always populated (length 1 for users\nwho only belong to their home workspace) so frontends can render a\nworkspace switcher without a follow-up request. Serialised without\nomitempty so the field is always present as a JSON array (possibly\nempty) — the \"always populated\" contract relies on the server side\nguaranteeing a non-nil slice.", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Membership" } }, "message": { "type": "string" }, "refresh_token": { "type": "string" }, "success": { "type": "boolean" }, "token": { "type": "string" }, "user": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.User" } } }, "github_com_Tencent_WeKnora_internal_types.MCPAdvancedConfig": { "type": "object", "properties": { "retry_count": { "description": "Number of retries, default: 3", "type": "integer" }, "retry_delay": { "description": "Delay between retries in seconds, default: 1", "type": "integer" }, "timeout": { "description": "Timeout in seconds, default: 30", "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.MCPAuthConfig": { "type": "object", "properties": { "api_key": { "type": "string" }, "api_key_header": { "description": "APIKeyHeader is the header name that carries APIKey when AuthType is\napi_key. Empty defaults to \"X-API-Key\". This is non-secret structural\nconfig (the secret is APIKey), so it is not encrypted and is safe to echo\nback in responses. It lets services that expect the key in a different\nheader (e.g. the raw token directly in \"Authorization\") work without\nresorting to plaintext custom headers.", "type": "string" }, "auth_server_metadata_url": { "description": "AuthServerMetadataURL optionally pins the OAuth authorization server\nmetadata URL. When empty, the server is discovered automatically from\nthe MCP URL (RFC 9728 / RFC 8414).", "type": "string" }, "auth_type": { "description": "AuthType selects the authentication strategy. Empty (\"\") is treated as\nnone for backward compatibility with rows that pre-date this field.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MCPAuthType" } ] }, "custom_headers": { "type": "object", "additionalProperties": { "type": "string" } }, "scopes": { "description": "Scopes are the OAuth scopes requested during authorization. Optional.", "type": "array", "items": { "type": "string" } }, "token": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.MCPAuthType": { "type": "string", "enum": [ "", "api_key", "bearer", "oauth" ], "x-enum-varnames": [ "MCPAuthNone", "MCPAuthAPIKey", "MCPAuthBearer", "MCPAuthOAuth" ] }, "github_com_Tencent_WeKnora_internal_types.MCPEnvVars": { "type": "object", "additionalProperties": { "type": "string" } }, "github_com_Tencent_WeKnora_internal_types.MCPHeaders": { "type": "object", "additionalProperties": { "type": "string" } }, "github_com_Tencent_WeKnora_internal_types.MCPService": { "type": "object", "properties": { "advanced_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MCPAdvancedConfig" }, "auth_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MCPAuthConfig" }, "created_at": { "type": "string" }, "deleted_at": { "$ref": "#/definitions/gorm.DeletedAt" }, "description": { "type": "string" }, "enabled": { "type": "boolean" }, "env_vars": { "description": "Environment variables for stdio", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MCPEnvVars" } ] }, "headers": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MCPHeaders" }, "id": { "type": "string" }, "is_builtin": { "description": "Whether this is a builtin MCP service (visible to all workspaces)", "type": "boolean" }, "name": { "type": "string" }, "stdio_config": { "description": "Required for stdio transport", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MCPStdioConfig" } ] }, "tenant_id": { "type": "integer" }, "transport_type": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MCPTransportType" }, "updated_at": { "type": "string" }, "url": { "description": "Optional: required for SSE/HTTP Streamable", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.MCPStdioConfig": { "type": "object", "properties": { "args": { "description": "Command arguments array", "type": "array", "items": { "type": "string" } }, "command": { "description": "Command: \"uvx\" or \"npx\"", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.MCPTransportType": { "type": "string", "enum": [ "sse", "http-streamable", "stdio" ], "x-enum-comments": { "MCPTransportHTTPStreamable": "HTTP Streamable", "MCPTransportSSE": "Server-Sent Events", "MCPTransportStdio": "Stdio (Standard Input/Output)" }, "x-enum-descriptions": [ "Server-Sent Events", "HTTP Streamable", "Stdio (Standard Input/Output)" ], "x-enum-varnames": [ "MCPTransportSSE", "MCPTransportHTTPStreamable", "MCPTransportStdio" ] }, "github_com_Tencent_WeKnora_internal_types.ManualKnowledgePayload": { "type": "object", "properties": { "channel": { "type": "string" }, "content": { "type": "string" }, "process_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeProcessOverrides" }, "status": { "type": "string" }, "tag_ids": { "type": "array", "items": { "type": "string" } }, "title": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.MatchType": { "type": "integer", "enum": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], "x-enum-comments": { "MatchTypeDataAnalysis": "数据分析匹配类型", "MatchTypeDirectLoad": "Deprecated: reserved to preserve serialized enum values", "MatchTypeParentChunk": "父Chunk匹配类型", "MatchTypeRelationChunk": "关系Chunk匹配类型", "MatchTypeWebSearch": "网络搜索匹配类型" }, "x-enum-descriptions": [ "", "", "", "", "父Chunk匹配类型", "关系Chunk匹配类型", "", "网络搜索匹配类型", "Deprecated: reserved to preserve serialized enum values", "数据分析匹配类型" ], "x-enum-varnames": [ "MatchTypeEmbedding", "MatchTypeKeywords", "MatchTypeNearByChunk", "MatchTypeHistory", "MatchTypeParentChunk", "MatchTypeRelationChunk", "MatchTypeGraph", "MatchTypeWebSearch", "MatchTypeDirectLoad", "MatchTypeDataAnalysis" ] }, "github_com_Tencent_WeKnora_internal_types.Membership": { "type": "object", "properties": { "role": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.TenantRole" }, "tenant_id": { "type": "integer" }, "tenant_name": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.MentionedItem": { "type": "object", "properties": { "id": { "type": "string" }, "kb_id": { "description": "Parent knowledge base for file/tag mentions", "type": "string" }, "kb_name": { "description": "Display name for parent KB", "type": "string" }, "kb_type": { "description": "\"document\" or \"faq\" (only for kb type)", "type": "string" }, "name": { "type": "string" }, "service_id": { "description": "Parent MCP service for MCP tool mentions", "type": "string" }, "skill_name": { "description": "Preloaded agent skill name", "type": "string" }, "type": { "description": "\"kb\", \"file\", \"tag\", \"mcp\", \"skill\"", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.Message": { "type": "object", "properties": { "agent_duration_ms": { "description": "Agent total execution duration in milliseconds (from query start to answer start)", "type": "integer" }, "agent_id": { "description": "AgentID is the agent used for this individual assistant turn. Unlike the\nsession's last_request_state it remains stable when users switch agents.", "type": "string" }, "agent_steps": { "description": "Agent execution steps (only for assistant messages generated by agent)\nThis contains the detailed reasoning process and tool calls made by the agent\nStored for user history display, but NOT included in LLM context to avoid redundancy", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AgentStep" } }, "attachments": { "description": "Attached files (documents, audio, etc., for user messages)", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MessageAttachment" } }, "channel": { "description": "Channel indicates the source channel of this message (e.g., \"web\", \"api\", \"im\")", "type": "string" }, "content": { "description": "Message text content", "type": "string" }, "created_at": { "description": "Message creation timestamp", "type": "string" }, "deleted_at": { "description": "Soft delete timestamp", "allOf": [ { "$ref": "#/definitions/gorm.DeletedAt" } ] }, "id": { "description": "Unique identifier for the message", "type": "string" }, "images": { "description": "Attached images with OCR/Caption text (for user messages)", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MessageImage" } }, "is_completed": { "description": "Whether message generation is complete", "type": "boolean" }, "is_fallback": { "description": "Whether this response is a fallback (no knowledge base match found)", "type": "boolean" }, "knowledge_id": { "description": "KnowledgeID links this message to a Knowledge entry in the chat history knowledge base\nUsed for vector search indexing: when set, the message content has been indexed as a Knowledge passage", "type": "string" }, "knowledge_references": { "description": "References to knowledge chunks used in the response", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SearchResult" } }, "mentioned_items": { "description": "Mentioned knowledge bases and files (for user messages)\nStores the @mentioned items when user sends a message", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MentionedItem" } }, "model_id": { "description": "ModelID is the requested/effective chat model binding captured for this\nturn. It is useful for reproducibility and suggestion generation.", "type": "string" }, "request_id": { "description": "Request identifier for tracking API requests", "type": "string" }, "role": { "description": "Message role: \"user\", \"assistant\", \"system\"", "type": "string" }, "session_id": { "description": "ID of the session this message belongs to", "type": "string" }, "updated_at": { "description": "Last update timestamp", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.MessageAttachment": { "type": "object", "properties": { "content": { "description": "Extracted text content (for small text files)", "type": "string" }, "content_mode": { "description": "full or selected_chunks", "type": "string" }, "file_name": { "description": "Original filename", "type": "string" }, "file_size": { "description": "File size in bytes", "type": "integer" }, "file_type": { "description": "File extension (e.g., \".pdf\", \".docx\")", "type": "string" }, "id": { "description": "Temporary document ID for session-scoped uploads", "type": "string" }, "is_truncated": { "description": "Whether content was truncated", "type": "boolean" }, "line_count": { "description": "Total line count (for text files)", "type": "integer" }, "selected_chunks": { "description": "Chunks included in this message prompt", "type": "integer" }, "token_count": { "description": "Approximate tokens in the parsed document", "type": "integer" }, "total_chunks": { "description": "Total parsed chunks", "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.MessageImage": { "type": "object", "properties": { "caption": { "type": "string" }, "url": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.MinIOEngineConfig": { "type": "object", "properties": { "access_key_id": { "type": "string" }, "bucket_name": { "type": "string" }, "endpoint": { "type": "string" }, "mode": { "description": "\"docker\" or \"remote\"", "type": "string" }, "path_prefix": { "type": "string" }, "secret_access_key": { "type": "string" }, "use_ssl": { "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.ModelParameters": { "type": "object", "properties": { "api_key": { "type": "string" }, "app_id": { "description": "WeKnoraCloud 厂商专用凭证", "type": "string" }, "app_secret": { "description": "AES-256 加密存储,实际承载上游 API Key", "type": "string" }, "base_url": { "type": "string" }, "custom_headers": { "description": "CustomHeaders 允许在调用远程模型 API 时附加自定义 HTTP 请求头,\n用途类似 Python OpenAI SDK 的 extra_headers 参数,\n常见场景包括透传企业网关鉴权信息、追踪 ID、路由标识等。\n保留字段(Authorization、api-key、Content-Type、Accept 等)会在运行期被忽略以避免破坏签名/鉴权流程。", "type": "object", "additionalProperties": { "type": "string" } }, "embedding_parameters": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.EmbeddingParameters" }, "extra_config": { "description": "Provider-specific configuration", "type": "object", "additionalProperties": { "type": "string" } }, "interface_type": { "type": "string" }, "max_concurrency": { "description": "MaxConcurrency caps concurrent in-flight BACKGROUND (ingestion /\nenrichment) calls to THIS specific model, keyed by model ID and shared\nacross all replicas. 0 (the default) means \"fall back to the\nprocess-wide model.max_concurrency\". Interactive user-facing calls are\nnever gated. Only chat / vlm / embedding honour this (see limiter.Gate).", "type": "integer" }, "parameter_size": { "description": "Ollama model parameter size (e.g., \"7B\", \"13B\", \"70B\")", "type": "string" }, "provider": { "description": "Provider identifier: openai, aliyun, zhipu, generic", "type": "string" }, "supports_vision": { "description": "Whether the model accepts image/multimodal input", "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.ModelSource": { "type": "string", "enum": [ "local", "remote", "aliyun", "zhipu", "volcengine", "deepseek", "hunyuan", "minimax", "openai", "gemini", "mimo", "siliconflow", "jina", "openrouter", "requesty", "nvidia", "novita", "azure_openai" ], "x-enum-comments": { "ModelSourceAliyun": "Aliyun DashScope model", "ModelSourceAzureOpenAI": "Azure OpenAI model", "ModelSourceDeepseek": "Deepseek model", "ModelSourceGemini": "Gemini model", "ModelSourceHunyuan": "Hunyuan model", "ModelSourceJina": "Jina AI model", "ModelSourceLocal": "Local model", "ModelSourceMimo": "Mimo model", "ModelSourceMinimax": "Minimax mode", "ModelSourceNovita": "Novita AI model", "ModelSourceNvidia": "NVIDIA model", "ModelSourceOpenAI": "OpenAI model", "ModelSourceOpenRouter": "OpenRouter model", "ModelSourceRemote": "Remote model", "ModelSourceRequesty": "Requesty model", "ModelSourceSiliconFlow": "SiliconFlow model", "ModelSourceVolcengine": "Volcengine model", "ModelSourceZhipu": "Zhipu model" }, "x-enum-descriptions": [ "Local model", "Remote model", "Aliyun DashScope model", "Zhipu model", "Volcengine model", "Deepseek model", "Hunyuan model", "Minimax mode", "OpenAI model", "Gemini model", "Mimo model", "SiliconFlow model", "Jina AI model", "OpenRouter model", "Requesty model", "NVIDIA model", "Novita AI model", "Azure OpenAI model" ], "x-enum-varnames": [ "ModelSourceLocal", "ModelSourceRemote", "ModelSourceAliyun", "ModelSourceZhipu", "ModelSourceVolcengine", "ModelSourceDeepseek", "ModelSourceHunyuan", "ModelSourceMinimax", "ModelSourceOpenAI", "ModelSourceGemini", "ModelSourceMimo", "ModelSourceSiliconFlow", "ModelSourceJina", "ModelSourceOpenRouter", "ModelSourceRequesty", "ModelSourceNvidia", "ModelSourceNovita", "ModelSourceAzureOpenAI" ] }, "github_com_Tencent_WeKnora_internal_types.ModelType": { "type": "string", "enum": [ "Embedding", "Rerank", "KnowledgeQA", "VLLM", "ASR" ], "x-enum-comments": { "ModelTypeASR": "ASR (Automatic Speech Recognition) model", "ModelTypeEmbedding": "Embedding model", "ModelTypeKnowledgeQA": "KnowledgeQA model", "ModelTypeRerank": "Rerank model", "ModelTypeVLLM": "VLLM model" }, "x-enum-descriptions": [ "Embedding model", "Rerank model", "KnowledgeQA model", "VLLM model", "ASR (Automatic Speech Recognition) model" ], "x-enum-varnames": [ "ModelTypeEmbedding", "ModelTypeRerank", "ModelTypeKnowledgeQA", "ModelTypeVLLM", "ModelTypeASR" ] }, "github_com_Tencent_WeKnora_internal_types.OBSEngineConfig": { "type": "object", "properties": { "access_key": { "type": "string" }, "bucket_name": { "type": "string" }, "endpoint": { "type": "string" }, "path_prefix": { "type": "string" }, "region": { "type": "string" }, "secret_key": { "type": "string" }, "use_ssl": { "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.OIDCAuthURLResponse": { "type": "object", "properties": { "authorization_url": { "type": "string" }, "provider_display_name": { "type": "string" }, "state": { "type": "string" }, "success": { "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.OIDCConfigResponse": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "provider_display_name": { "type": "string" }, "success": { "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.OSSEngineConfig": { "type": "object", "properties": { "access_key": { "type": "string" }, "bucket_name": { "type": "string" }, "endpoint": { "type": "string" }, "path_prefix": { "type": "string" }, "region": { "type": "string" }, "secret_key": { "type": "string" }, "temp_bucket_name": { "type": "string" }, "temp_region": { "type": "string" }, "use_temp_bucket": { "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.OrgMemberRole": { "type": "string", "enum": [ "admin", "editor", "viewer" ], "x-enum-varnames": [ "OrgRoleAdmin", "OrgRoleEditor", "OrgRoleViewer" ] }, "github_com_Tencent_WeKnora_internal_types.OrganizationMemberResponse": { "type": "object", "properties": { "avatar": { "type": "string" }, "email": { "type": "string" }, "id": { "type": "string" }, "joined_at": { "type": "string" }, "representative_user_id": { "type": "string" }, "role": { "type": "string" }, "tenant_id": { "type": "integer" }, "tenant_name": { "type": "string" }, "user_id": { "type": "string" }, "username": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.OrganizationResponse": { "type": "object", "properties": { "agent_share_count": { "description": "共享到该组织的智能体数量", "type": "integer" }, "avatar": { "type": "string" }, "created_at": { "type": "string" }, "description": { "type": "string" }, "has_pending_upgrade": { "description": "当前用户是否有待处理的权限升级申请", "type": "boolean" }, "id": { "type": "string" }, "invite_code": { "type": "string" }, "invite_code_expires_at": { "type": "string" }, "invite_code_validity_days": { "type": "integer" }, "is_owner": { "type": "boolean" }, "member_count": { "type": "integer" }, "member_limit": { "description": "0 = unlimited", "type": "integer" }, "my_role": { "type": "string" }, "name": { "type": "string" }, "owner_id": { "type": "string" }, "owner_tenant_id": { "description": "OwnerTenantID is the persisted owner workspace of the organization\n(Plan 3, migration 000046). Frontend uses this to identify the\n\"owner row\" in the workspace-keyed members list — comparing\nmember.tenant_id against owner_tenant_id is the post-Plan-3\nequivalent of the old member.user_id == owner_id check.", "type": "integer" }, "pending_join_request_count": { "description": "待审批加入申请数(仅管理员可见)", "type": "integer" }, "require_approval": { "type": "boolean" }, "searchable": { "type": "boolean" }, "share_count": { "description": "共享到该组织的知识库数量", "type": "integer" }, "updated_at": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.ParserEngineConfig": { "type": "object", "properties": { "chat_parser_engine_rules": { "description": "ChatParserEngineRules selects parser engines for session-scoped chat\ndocuments. Knowledge bases keep their own rules in ChunkingConfig.", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ParserEngineRule" } }, "mineru_api_key": { "description": "MinerU 云 API Key", "type": "string" }, "mineru_cloud_enable_formula": { "type": "boolean" }, "mineru_cloud_enable_ocr": { "type": "boolean" }, "mineru_cloud_enable_table": { "type": "boolean" }, "mineru_cloud_language": { "type": "string" }, "mineru_cloud_model": { "description": "MinerU 云 API 解析参数", "type": "string" }, "mineru_enable_formula": { "type": "boolean" }, "mineru_enable_ocr": { "type": "boolean" }, "mineru_enable_table": { "type": "boolean" }, "mineru_endpoint": { "description": "MinerU 自建服务端点", "type": "string" }, "mineru_language": { "type": "string" }, "mineru_model": { "description": "MinerU 自建解析参数", "type": "string" }, "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" } } }, "github_com_Tencent_WeKnora_internal_types.ParserEngineRule": { "type": "object", "properties": { "engine": { "type": "string" }, "file_types": { "type": "array", "items": { "type": "string" } } } }, "github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig": { "type": "object", "properties": { "custom_instructions": { "description": "CustomInstructions describes the intended audience or question style.\nIt is appended to the stable system question-generation template.", "type": "string" }, "enabled": { "type": "boolean" }, "question_count": { "description": "Number of questions to generate per chunk (default: 3, max: 10)", "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.QuestionSuggestionConfig": { "type": "object", "properties": { "follow_ups": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FollowUpSuggestionConfig" }, "starters": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.StarterSuggestionConfig" } } }, "github_com_Tencent_WeKnora_internal_types.QueueStat": { "type": "object", "properties": { "active": { "type": "integer" }, "archived": { "type": "integer" }, "completed": { "type": "integer" }, "failed": { "type": "integer" }, "latency_ms": { "description": "LatencyMs is the age of the oldest pending task, in milliseconds.", "type": "integer" }, "memory_usage_bytes": { "description": "MemoryUsageBytes is the approximate Redis memory the queue occupies.", "type": "integer" }, "name": { "type": "string" }, "paused": { "description": "Paused reports whether the queue is paused (tasks not consumed).", "type": "boolean" }, "pending": { "type": "integer" }, "pool": { "description": "Pool is the independent worker pool that drains this queue.", "type": "string" }, "processed": { "description": "Processed / Failed are today's counters (reset daily).", "type": "integer" }, "retry": { "type": "integer" }, "scheduled": { "type": "integer" }, "size": { "description": "Size is the total number of tasks in the queue (pending + active +\nscheduled + retry + aggregating + archived).", "type": "integer" }, "weight": { "description": "Weight is the queue's scheduling weight inside its pool.", "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.RegisterRequest": { "type": "object", "required": [ "email", "password", "username" ], "properties": { "email": { "type": "string" }, "password": { "type": "string", "minLength": 6 }, "username": { "type": "string", "maxLength": 50, "minLength": 2 } } }, "github_com_Tencent_WeKnora_internal_types.RegisterResponse": { "type": "object", "properties": { "message": { "type": "string" }, "success": { "type": "boolean" }, "tenant": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Tenant" }, "user": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.User" } } }, "github_com_Tencent_WeKnora_internal_types.RequestRoleUpgradeRequest": { "type": "object", "required": [ "requested_role" ], "properties": { "message": { "description": "Optional message explaining the reason", "type": "string", "maxLength": 500 }, "requested_role": { "description": "The role user wants to upgrade to", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OrgMemberRole" } ] } } }, "github_com_Tencent_WeKnora_internal_types.Resource": { "type": "object", "properties": { "description": { "description": "Optional description", "type": "string" }, "external_id": { "description": "Unique identifier in the external system", "type": "string" }, "has_children": { "description": "Whether this resource has children that can be expanded", "type": "boolean" }, "metadata": { "description": "Additional metadata", "type": "object", "additionalProperties": true }, "modified_at": { "description": "Last modified time in external system", "type": "string" }, "name": { "description": "Display name", "type": "string" }, "parent_id": { "description": "For hierarchical resources (parent ID if applicable)", "type": "string" }, "type": { "description": "Resource type (document, folder, space, page, etc.)", "type": "string" }, "url": { "description": "URL to access in external system", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.ResourceCountsByOrgResponse": { "type": "object", "properties": { "agents": { "type": "object", "properties": { "by_organization": { "type": "object", "additionalProperties": { "type": "integer" } } } }, "knowledge_bases": { "type": "object", "properties": { "by_organization": { "type": "object", "additionalProperties": { "type": "integer" } } } } } }, "github_com_Tencent_WeKnora_internal_types.RetrievalConfig": { "type": "object", "properties": { "embedding_top_k": { "description": "EmbeddingTopK is the maximum number of chunks returned by vector search (default: 50)", "type": "integer" }, "keyword_threshold": { "description": "KeywordThreshold is the minimum keyword match score (0-1, default: 0.3)", "type": "number" }, "rerank_model_id": { "description": "RerankModelID is the ID of the rerank model to use (required for search)", "type": "string" }, "rerank_threshold": { "description": "RerankThreshold is the minimum rerank score (-10 to 10, default: 0.2)", "type": "number" }, "rerank_top_k": { "description": "RerankTopK is the maximum number of results after reranking (default: 10)", "type": "integer" }, "rrf_k": { "description": "RRFK is the smoothing constant of Reciprocal Rank Fusion. Larger values\nflatten the curve, reducing the bias towards top-1 results.\nDefault: 60. Sensible range: 30..100 depending on corpus size.", "type": "integer" }, "rrf_keyword_weight": { "description": "RRFKeywordWeight is the keyword counterpart. Default: 0.3.", "type": "number" }, "rrf_vector_weight": { "description": "RRFVectorWeight is the weight applied to the vector retriever inside RRF.\nRRFVectorWeight + RRFKeywordWeight should usually sum to 1.0 but the math\nworks for any positive weights. Default: 0.7.", "type": "number" }, "vector_threshold": { "description": "VectorThreshold is the minimum vector similarity score (0-1, default: 0.15)", "type": "number" } } }, "github_com_Tencent_WeKnora_internal_types.RetrieverEngineParams": { "type": "object", "properties": { "retriever_engine_type": { "description": "Retriever engine type", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RetrieverEngineType" } ] }, "retriever_type": { "description": "Retriever type", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RetrieverType" } ] } } }, "github_com_Tencent_WeKnora_internal_types.RetrieverEngineType": { "type": "string", "enum": [ "postgres", "elasticsearch", "infinity", "elasticfaiss", "qdrant", "milvus", "weaviate", "doris", "sqlite", "tencent_vectordb", "opensearch" ], "x-enum-varnames": [ "PostgresRetrieverEngineType", "ElasticsearchRetrieverEngineType", "InfinityRetrieverEngineType", "ElasticFaissRetrieverEngineType", "QdrantRetrieverEngineType", "MilvusRetrieverEngineType", "WeaviateRetrieverEngineType", "DorisRetrieverEngineType", "SQLiteRetrieverEngineType", "TencentVectorDBRetrieverEngineType", "OpenSearchRetrieverEngineType" ] }, "github_com_Tencent_WeKnora_internal_types.RetrieverEngines": { "type": "object", "properties": { "engines": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RetrieverEngineParams" } } } }, "github_com_Tencent_WeKnora_internal_types.RetrieverType": { "type": "string", "enum": [ "keywords", "vector", "websearch" ], "x-enum-comments": { "KeywordsRetrieverType": "Keywords retriever", "VectorRetrieverType": "Vector retriever", "WebSearchRetrieverType": "Web search retriever" }, "x-enum-descriptions": [ "Keywords retriever", "Vector retriever", "Web search retriever" ], "x-enum-varnames": [ "KeywordsRetrieverType", "VectorRetrieverType", "WebSearchRetrieverType" ] }, "github_com_Tencent_WeKnora_internal_types.ReviewJoinRequestRequest": { "type": "object", "properties": { "approved": { "type": "boolean" }, "message": { "type": "string", "maxLength": 500 }, "role": { "description": "Optional: role to assign when approving; overrides applicant's requested role", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OrgMemberRole" } ] } } }, "github_com_Tencent_WeKnora_internal_types.RuntimeTaskAction": { "type": "string", "enum": [ "cancel", "run_now", "delete" ], "x-enum-varnames": [ "RuntimeTaskActionCancel", "RuntimeTaskActionRunNow", "RuntimeTaskActionDelete" ] }, "github_com_Tencent_WeKnora_internal_types.RuntimeTaskInfo": { "type": "object", "properties": { "allowed_actions": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RuntimeTaskAction" } }, "completed_at": { "type": "string" }, "data_source_id": { "type": "string" }, "deadline": { "type": "string" }, "enqueued_at": { "type": "string" }, "id": { "type": "string" }, "is_orphaned": { "type": "boolean" }, "knowledge_base_id": { "type": "string" }, "knowledge_count": { "type": "integer" }, "knowledge_id": { "type": "string" }, "last_error": { "type": "string" }, "last_failed_at": { "type": "string" }, "max_retry": { "type": "integer" }, "next_process_at": { "type": "string" }, "queue": { "type": "string" }, "retried": { "type": "integer" }, "source_id": { "type": "string" }, "source_kb_id": { "type": "string" }, "started_at": { "type": "string" }, "state": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RuntimeTaskState" }, "sync_log_id": { "type": "string" }, "target_id": { "type": "string" }, "target_kb_id": { "type": "string" }, "task_id": { "type": "string" }, "tenant_id": { "type": "integer" }, "type": { "type": "string" }, "worker": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.RuntimeTaskState": { "type": "string", "enum": [ "pending", "active", "scheduled", "retry", "archived", "completed" ], "x-enum-varnames": [ "RuntimeTaskPending", "RuntimeTaskActive", "RuntimeTaskScheduled", "RuntimeTaskRetry", "RuntimeTaskArchived", "RuntimeTaskCompleted" ] }, "github_com_Tencent_WeKnora_internal_types.S3EngineConfig": { "type": "object", "properties": { "access_key": { "type": "string" }, "bucket_name": { "type": "string" }, "endpoint": { "type": "string" }, "force_path_style": { "type": "boolean" }, "path_prefix": { "type": "string" }, "region": { "type": "string" }, "secret_key": { "type": "string" }, "use_ssl": { "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.SearchParams": { "type": "object", "properties": { "disable_keywords_match": { "type": "boolean" }, "disable_vector_match": { "type": "boolean" }, "keyword_threshold": { "type": "number" }, "knowledge_base_ids": { "description": "KnowledgeBaseIDs overrides the single KB ID passed to HybridSearch,\nallowing a single retrieval call to span multiple KBs that share the\nsame embedding model. When empty, HybridSearch uses its own id parameter.", "type": "array", "items": { "type": "string" } }, "knowledge_ids": { "type": "array", "items": { "type": "string" } }, "match_count": { "type": "integer" }, "only_recommended": { "type": "boolean" }, "query_embedding": { "type": "array", "items": { "type": "number" } }, "query_text": { "description": "QueryText is required unless query_embedding is provided, keyword matching is disabled,\nand vector matching remains enabled.", "type": "string" }, "scope_tag_ids": { "type": "array", "items": { "type": "string" } }, "skip_context_enrichment": { "description": "SkipContextEnrichment skips fetching parent, nearby, and relation chunks\nin processSearchResults. Used by the chat pipeline where context assembly\nis handled separately in the merge stage.", "type": "boolean" }, "tag_ids": { "description": "Tag IDs for filtering (used for FAQ priority filtering)", "type": "array", "items": { "type": "string" } }, "vector_threshold": { "type": "number" } } }, "github_com_Tencent_WeKnora_internal_types.SearchResult": { "type": "object", "properties": { "chunk_index": { "description": "Chunk index", "type": "integer" }, "chunk_metadata": { "description": "ChunkMetadata stores chunk-level metadata (e.g., generated questions)", "type": "array", "items": { "type": "integer" } }, "chunk_type": { "description": "Chunk 类型", "type": "string" }, "content": { "description": "Content", "type": "string" }, "end_at": { "description": "End at", "type": "integer" }, "id": { "description": "ID", "type": "string" }, "image_info": { "description": "图片信息 (JSON 格式)", "type": "string" }, "knowledge_base_id": { "description": "KnowledgeBaseID is the ID of the knowledge base this result belongs to", "type": "string" }, "knowledge_channel": { "description": "KnowledgeChannel indicates through which channel the knowledge was ingested (web, api, wechat, etc.)", "type": "string" }, "knowledge_description": { "description": "KnowledgeDescription is the description of the knowledge document", "type": "string" }, "knowledge_filename": { "description": "Knowledge file name\nUsed for file type knowledge, contains the original file name", "type": "string" }, "knowledge_id": { "description": "Knowledge ID", "type": "string" }, "knowledge_source": { "description": "Knowledge source\nUsed to indicate the source of the knowledge, such as \"url\"", "type": "string" }, "knowledge_title": { "description": "Knowledge title", "type": "string" }, "match_type": { "description": "Match type", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MatchType" } ] }, "matched_content": { "description": "MatchedContent is the actual content that was matched in vector search\nFor FAQ: this is the matched question text (standard or similar question)", "type": "string" }, "metadata": { "description": "Metadata", "type": "object", "additionalProperties": { "type": "string" } }, "parent_chunk_id": { "description": "父 Chunk ID", "type": "string" }, "score": { "description": "Score", "type": "number" }, "seq": { "description": "Seq", "type": "integer" }, "start_at": { "description": "Start at", "type": "integer" }, "sub_chunk_id": { "description": "SubChunkIndex", "type": "array", "items": { "type": "string" } } } }, "github_com_Tencent_WeKnora_internal_types.Session": { "type": "object", "properties": { "created_at": { "type": "string" }, "deleted_at": { "$ref": "#/definitions/gorm.DeletedAt" }, "description": { "description": "Description", "type": "string" }, "id": { "description": "ID", "type": "string" }, "im_platform": { "description": "IMPlatform is the originating IM platform (e.g. \"feishu\", \"wecom\") when\nthis session is bound to an IM channel. It is not stored on the sessions\ntable (it lives in im_channel_sessions) and is populated on read so the\nWeb console can classify a session's origin folder without a list query.", "type": "string" }, "is_pinned": { "description": "IsPinned indicates whether the session is pinned in the list.", "type": "boolean" }, "last_request_state": { "description": "LastRequestState records the input-bar state used the last time this\nsession sent a question (agent, model, KB scope, web search, MCPs).\nPersisted on every successful POST to /knowledge-chat or /agent-chat so\nthat reopening the session can restore the original request context to\nthe chat UI. Stored in the legacy sessions.agent_config JSONB column to\navoid a new migration; the shape used today is `SessionLastRequestState`.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SessionLastRequestState" } ] }, "pinned_at": { "description": "PinnedAt records when the session was pinned; nil when not pinned.", "type": "string" }, "tenant_id": { "description": "Workspace ID", "type": "integer" }, "title": { "description": "Title", "type": "string" }, "updated_at": { "type": "string" }, "user_id": { "description": "UserID is the owner scope for this session. WeKnora user UUIDs, API\nexternal-user principals, and embed visitor principals all use this column.", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.SessionLastRequestState": { "type": "object", "properties": { "agent_enabled": { "type": "boolean" }, "agent_id": { "type": "string" }, "knowledge_base_ids": { "type": "array", "items": { "type": "string" } }, "knowledge_ids": { "type": "array", "items": { "type": "string" } }, "mcp_service_ids": { "type": "array", "items": { "type": "string" } }, "mentioned_items": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MentionedItem" } }, "model_id": { "type": "string" }, "skill_names": { "type": "array", "items": { "type": "string" } }, "tag_ids": { "type": "array", "items": { "type": "string" } }, "web_search_enabled": { "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.ShareKnowledgeBaseRequest": { "type": "object", "required": [ "organization_id", "permission" ], "properties": { "organization_id": { "type": "string" }, "permission": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OrgMemberRole" } } }, "github_com_Tencent_WeKnora_internal_types.StarterSuggestionConfig": { "type": "object", "properties": { "count": { "type": "integer" }, "enabled": { "type": "boolean" }, "items": { "type": "array", "items": { "type": "string" } }, "mode": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.StorageBackendConfig": { "type": "object", "properties": { "access_key_id": { "type": "string" }, "app_id": { "type": "string" }, "bucket_name": { "type": "string" }, "endpoint": { "type": "string" }, "force_path_style": { "type": "boolean" }, "mode": { "type": "string" }, "path_prefix": { "type": "string" }, "region": { "type": "string" }, "secret_access_key": { "type": "string" }, "temp_bucket_name": { "type": "string" }, "temp_region": { "type": "string" }, "use_ssl": { "type": "boolean" }, "use_temp_bucket": { "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.StorageConfig": { "type": "object", "properties": { "app_id": { "description": "App ID (COS specific)", "type": "string" }, "bucket_name": { "description": "Bucket Name", "type": "string" }, "endpoint": { "description": "Endpoint (S3 specific) - e.g., s3.amazonaws.com, oss-cn-hangzhou.aliyuncs.com", "type": "string" }, "force_path_style": { "description": "ForcePathStyle (S3 specific) - whether to use path-style URLs", "type": "boolean" }, "path_prefix": { "description": "Path Prefix", "type": "string" }, "provider": { "description": "Provider: \"cos\", \"minio\", \"s3\"", "type": "string" }, "region": { "description": "Region", "type": "string" }, "secret_id": { "description": "Secret ID (COS) / Access Key ID (S3, MinIO)", "type": "string" }, "secret_key": { "description": "Secret Key (COS) / Secret Access Key (S3, MinIO)", "type": "string" }, "use_ssl": { "description": "UseSSL (S3 specific) - whether to use HTTPS", "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.StorageEngineConfig": { "type": "object", "properties": { "cos": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.COSEngineConfig" }, "default_provider": { "description": "\"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\", \"obs\"", "type": "string" }, "ks3": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KS3EngineConfig" }, "local": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LocalEngineConfig" }, "minio": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MinIOEngineConfig" }, "obs": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OBSEngineConfig" }, "oss": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OSSEngineConfig" }, "s3": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.S3EngineConfig" }, "tos": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.TOSEngineConfig" } } }, "github_com_Tencent_WeKnora_internal_types.StorageProviderConfig": { "type": "object", "properties": { "provider": { "description": "\"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\", \"obs\"", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.SubmitJoinRequestRequest": { "type": "object", "required": [ "invite_code" ], "properties": { "invite_code": { "type": "string", "maxLength": 32, "minLength": 8 }, "message": { "type": "string", "maxLength": 500 }, "role": { "description": "Optional: role the applicant requests (admin/editor/viewer); default viewer", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OrgMemberRole" } ] } } }, "github_com_Tencent_WeKnora_internal_types.SuggestionAttribution": { "type": "object", "properties": { "question_id": { "type": "string" }, "suggestion_set_id": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.SyncLog": { "type": "object", "properties": { "created_at": { "description": "Creation timestamp (usually same as StartedAt)", "type": "string" }, "data_source_id": { "description": "Reference to the data source", "type": "string" }, "error_message": { "description": "Error details if status is \"failed\"", "type": "string" }, "finished_at": { "description": "Sync completion time", "type": "string" }, "id": { "description": "Unique identifier", "type": "string" }, "items_created": { "description": "New items created in knowledge base", "type": "integer" }, "items_deleted": { "description": "Items deleted from knowledge base", "type": "integer" }, "items_failed": { "description": "Items that failed to sync", "type": "integer" }, "items_skipped": { "description": "Items skipped (no changes detected)", "type": "integer" }, "items_total": { "description": "Total items fetched from source", "type": "integer" }, "items_updated": { "description": "Existing items updated", "type": "integer" }, "result": { "description": "Detailed sync result (JSON-encoded)", "type": "array", "items": { "type": "integer" } }, "started_at": { "description": "Sync start time", "type": "string" }, "status": { "description": "Sync status: running, success, partial, failed, canceled", "type": "string" }, "tenant_id": { "description": "Workspace ID", "type": "integer" }, "updated_at": { "description": "Last update timestamp", "type": "string" } } }, "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": { "access_key": { "type": "string" }, "bucket_name": { "type": "string" }, "endpoint": { "type": "string" }, "path_prefix": { "type": "string" }, "region": { "type": "string" }, "secret_key": { "type": "string" }, "temp_bucket_name": { "type": "string" }, "temp_region": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.Tenant": { "type": "object", "properties": { "business": { "description": "Business", "type": "string" }, "chat_history_config": { "description": "Chat history config: knowledge base configuration for indexing and searching chat messages via vector search", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ChatHistoryConfig" } ] }, "context_config": { "description": "Global Context configuration for this workspace (default for all sessions)", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ContextConfig" } ] }, "created_at": { "description": "Creation time", "type": "string" }, "credentials": { "description": "Credentials config: third-party provider credentials (e.g. WeKnoraCloud AppID/AppSecret)", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.CredentialsConfig" } ] }, "default_storage_backend_id": { "description": "DefaultStorageBackendID is the workspace default concrete storage instance.", "type": "string" }, "deleted_at": { "description": "Deletion time", "allOf": [ { "$ref": "#/definitions/gorm.DeletedAt" } ] }, "description": { "description": "Description", "type": "string" }, "id": { "description": "ID", "type": "integer" }, "name": { "description": "Name", "type": "string" }, "parser_engine_config": { "description": "Parser engine config overrides (MinerU endpoint, API key, etc.). Used when parsing documents; overrides env.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ParserEngineConfig" } ] }, "retrieval_config": { "description": "Retrieval config: global search/retrieval parameters shared by knowledge search and message search", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RetrievalConfig" } ] }, "retriever_engines": { "description": "Retriever engines", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RetrieverEngines" } ] }, "status": { "description": "Status", "type": "string" }, "storage_engine_config": { "description": "Storage engine config: parameters for Local, MinIO, COS. Used for document/file storage and docreader.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.StorageEngineConfig" } ] }, "storage_quota": { "description": "Storage quota (Bytes), default is 10GB, including vector, original file, text, index, etc.", "type": "integer" }, "storage_used": { "description": "Storage used (Bytes)", "type": "integer" }, "updated_at": { "description": "Last updated time", "type": "string" }, "web_search_config": { "description": "Global WebSearch configuration for this workspace", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WebSearchConfig" } ] } } }, "github_com_Tencent_WeKnora_internal_types.TenantRole": { "type": "string", "enum": [ "owner", "admin", "contributor", "viewer" ], "x-enum-varnames": [ "TenantRoleOwner", "TenantRoleAdmin", "TenantRoleContributor", "TenantRoleViewer" ] }, "github_com_Tencent_WeKnora_internal_types.ToolCall": { "type": "object", "properties": { "args": { "description": "Tool arguments", "type": "object", "additionalProperties": true }, "duration": { "description": "Execution time in milliseconds", "type": "integer" }, "id": { "description": "Function call ID from LLM", "type": "string" }, "name": { "description": "Tool name", "type": "string" }, "provider_metadata": { "description": "Provider-specific tool-call state for replay", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ToolCallMetadata" } ] }, "reflection": { "description": "Agent's reflection on this tool call result (if enabled)", "type": "string" }, "result": { "description": "Execution result (contains Output)", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ToolResult" } ] } } }, "github_com_Tencent_WeKnora_internal_types.ToolCallMetadata": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.ToolResult": { "type": "object", "properties": { "data": { "description": "Structured data for programmatic use", "type": "object", "additionalProperties": true }, "error": { "description": "Error message if execution failed", "type": "string" }, "images": { "description": "Base64 data URIs from tool (e.g. MCP image content)", "type": "array", "items": { "type": "string" } }, "output": { "description": "Human-readable output", "type": "string" }, "success": { "description": "Whether the tool executed successfully", "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.UpdateMemberRoleRequest": { "type": "object", "required": [ "role" ], "properties": { "role": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OrgMemberRole" } } }, "github_com_Tencent_WeKnora_internal_types.UpdateOrganizationRequest": { "type": "object", "properties": { "avatar": { "description": "optional avatar URL", "type": "string", "maxLength": 512 }, "description": { "type": "string", "maxLength": 1000 }, "invite_code_validity_days": { "description": "0=never, 1, 7, 30", "type": "integer" }, "member_limit": { "description": "max members; 0=unlimited", "type": "integer" }, "name": { "type": "string", "maxLength": 255, "minLength": 1 }, "require_approval": { "type": "boolean" }, "searchable": { "description": "open for search so others can discover and join", "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.UpdateSharePermissionRequest": { "type": "object", "required": [ "permission" ], "properties": { "permission": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OrgMemberRole" } } }, "github_com_Tencent_WeKnora_internal_types.User": { "type": "object", "properties": { "avatar": { "description": "Avatar URL of the user", "type": "string" }, "can_access_all_tenants": { "description": "Whether the user can access all workspaces (cross-workspace access)", "type": "boolean" }, "created_at": { "description": "Creation time of the user", "type": "string" }, "deleted_at": { "description": "Deletion time of the user", "allOf": [ { "$ref": "#/definitions/gorm.DeletedAt" } ] }, "email": { "description": "Email address of the user", "type": "string" }, "id": { "description": "Unique identifier of the user", "type": "string" }, "is_active": { "description": "Whether the user is active", "type": "boolean" }, "is_system_admin": { "description": "Whether the user is a system administrator (independent of workspace roles)", "type": "boolean" }, "preferences": { "description": "Per-user UI/feature preferences.\nStored as JSON (jsonb on Postgres, TEXT on SQLite) via the\ndriver.Valuer / sql.Scanner methods on UserPreferences.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UserPreferences" } ] }, "tenant": { "description": "Association relationship, not stored in the database", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Tenant" } ] }, "tenant_id": { "description": "Workspace ID that the user belongs to", "type": "integer" }, "updated_at": { "description": "Last updated time of the user", "type": "string" }, "username": { "description": "Username of the user", "type": "string" } } }, "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": { "last_active_tenant_id": { "description": "LastActiveTenantID remembers the last workspace the user actively\nswitched into, so a fresh login (new device, cleared browser, new\nrefresh token) lands them back in that workspace instead of always\nbouncing to their home workspace. Login / RefreshToken validate that\nthe workspace still exists and the user still has an active membership\n(or CanAccessAllTenants) before honouring this preference; an\ninvalid pointer is best-effort cleared and the user falls back to\nhome.\n\nnil = no preference (use user.TenantID, i.e. home)\n*0 = \"clear preference\" sentinel for the partial-update endpoint\n (UpdateUserPreferences turns this into nil). Otherwise treat\n a stored *0 the same as nil.\n*N = preferred workspace id.", "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.VLMConfig": { "type": "object", "properties": { "api_key": { "description": "API Key", "type": "string" }, "base_url": { "description": "Base URL", "type": "string" }, "custom_instructions": { "description": "CustomInstructions adds KB-specific image interpretation guidance without\nreplacing the system-owned OCR and Markdown output contract.", "type": "string" }, "description_language": { "description": "DescriptionLanguage controls the language used for generated image\ncaptions. Empty means follow the document/request language.", "type": "string" }, "enabled": { "type": "boolean" }, "interface_type": { "description": "Interface Type: \"ollama\" or \"openai\"", "type": "string" }, "model_id": { "type": "string" }, "model_name": { "description": "兼容老版本\nModel Name", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WeKnoraCloudCredentials": { "type": "object", "properties": { "app_id": { "type": "string" }, "app_secret": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WebSearchConfig": { "type": "object", "properties": { "api_key": { "description": "Deprecated: Use WebSearchProviderEntity.Parameters.APIKey instead.", "type": "string" }, "blacklist": { "description": "黑名单规则列表", "type": "array", "items": { "type": "string" } }, "compression_method": { "description": "压缩方法:none, summary, extract, rag", "type": "string" }, "document_fragments": { "description": "文档片段数量(用于RAG压缩)", "type": "integer" }, "embedding_dimension": { "description": "嵌入维度(用于RAG压缩)", "type": "integer" }, "embedding_model_id": { "description": "RAG压缩相关配置", "type": "string" }, "include_date": { "description": "是否包含日期", "type": "boolean" }, "max_results": { "description": "最大搜索结果数", "type": "integer" }, "provider": { "description": "Deprecated: Use WebSearchProviderEntity.Parameters.APIKey instead.", "type": "string" }, "proxy_url": { "description": "Optional per-request proxy override; normally empty — use WebSearchProviderEntity.Parameters.proxy_url. Merged at call time when set.", "type": "string" }, "rerank_model_id": { "description": "重排模型ID(用于RAG压缩)", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WebSearchProviderEntity": { "type": "object", "properties": { "created_at": { "description": "Timestamps", "type": "string" }, "deleted_at": { "$ref": "#/definitions/gorm.DeletedAt" }, "description": { "description": "Description", "type": "string" }, "id": { "description": "Unique identifier (UUID, auto-generated)", "type": "string" }, "is_default": { "description": "Whether this is the default provider for the workspace", "type": "boolean" }, "name": { "description": "User-friendly name, e.g., \"Production Bing Search\"", "type": "string" }, "parameters": { "description": "Provider-specific parameters (API key, engine ID, etc.) stored as encrypted JSON", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WebSearchProviderParameters" } ] }, "provider": { "description": "Provider type: bing, google, duckduckgo, tavily", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WebSearchProviderType" } ] }, "tenant_id": { "description": "Workspace ID for scoping", "type": "integer" }, "updated_at": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WebSearchProviderParameters": { "type": "object", "properties": { "api_key": { "description": "API key for the search provider (encrypted in DB)", "type": "string" }, "base_url": { "description": "Base URL for self-hosted search engines (e.g. SearXNG instance URL).\nValidated with utils.ValidateURLForSSRF; private hosts must be added to SSRF_WHITELIST.", "type": "string" }, "engine_id": { "description": "Google Custom Search Engine ID (only for Google provider)", "type": "string" }, "extra_config": { "description": "Provider-specific extra configuration for future extensibility", "type": "object", "additionalProperties": { "type": "string" } }, "proxy_url": { "description": "Optional HTTP/HTTPS proxy URL for outbound search requests (e.g. http://host:port); validated with utils.ValidateURLForSSRF.\nDoes not replace the search API endpoint; only tunnels traffic to the official APIs.", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WebSearchProviderType": { "type": "string", "enum": [ "bing", "google", "duckduckgo", "tavily", "ollama", "baidu", "searxng", "keenable", "zhipu" ], "x-enum-varnames": [ "WebSearchProviderTypeBing", "WebSearchProviderTypeGoogle", "WebSearchProviderTypeDuckDuckGo", "WebSearchProviderTypeTavily", "WebSearchProviderTypeOllama", "WebSearchProviderTypeBaidu", "WebSearchProviderTypeSearxng", "WebSearchProviderTypeKeenable", "WebSearchProviderTypeZhipu" ] }, "github_com_Tencent_WeKnora_internal_types.WikiConfig": { "type": "object", "properties": { "content_instructions": { "description": "ContentInstructions controls tone, structure and emphasis for generated\nsummary/entity/index prose. Citation and merge rules remain system-owned.", "type": "string" }, "extraction_granularity": { "description": "ExtractionGranularity controls how many candidate slugs Pass 0 extracts\nper document. Empty / unknown value is treated as WikiExtractionStandard.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiExtractionGranularity" } ] }, "extraction_instructions": { "description": "ExtractionInstructions tells candidate extraction which domain concepts\nto emphasize without replacing the stable JSON/citation protocol.", "type": "string" }, "ingest_batch_size": { "description": "IngestBatchSize controls how many pending ops a single batch claims and\nprocesses before scheduling a follow-up. 0 falls back to the hard-coded\ndefault (5). Larger batches amortize per-batch setup and let more docs\nshare the batch-internal Map/Reduce fan-out; smaller batches spread a\nKB's backlog across more concurrent batches (finer scheduling grain).", "type": "integer" }, "ingest_map_parallel": { "description": "IngestMapParallel sets the errgroup limit for the Map phase\n(per-document extraction + summary + chunk citation) WITHIN one batch.\n0 falls back to 10. Bound by the LLM provider's concurrency limit and\nthe worker's outbound HTTP pool. Remember it multiplies with the number\nof concurrent batches (IngestMaxInflight).", "type": "integer" }, "ingest_max_inflight": { "description": "IngestMaxInflight caps how many ingest batches for THIS KB may run\nconcurrently in the shared wiki worker pool (standard/Redis mode\nonly). 0 falls back to the hard-coded default (4). Since Phase 3\nremoved the exclusive per-KB lock, one KB's backlog could otherwise\nmonopolize the whole pool during a bulk import and starve other KBs;\nthis knob trades a single KB's peak throughput for cross-KB fairness.\nSet it \u003e= the wiki pool size to effectively disable the cap.", "type": "integer" }, "ingest_reduce_parallel": { "description": "IngestReduceParallel sets the errgroup limit for the Reduce phase\n(per-slug page write) WITHIN one batch. 0 falls back to 10. Bound by the\nsame LLM concurrency / HTTP pool considerations as the Map phase, plus\nDB connection pool size. Same multiplier caveat as IngestMapParallel.", "type": "integer" }, "max_pages_per_ingest": { "description": "MaxPagesPerIngest limits pages created/updated per ingest operation (0 = no limit)", "type": "integer" }, "synthesis_model_id": { "description": "SynthesisModelID is the LLM model ID used for wiki page generation and updates", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiExtractionGranularity": { "type": "string", "enum": [ "focused", "standard", "exhaustive" ], "x-enum-varnames": [ "WikiExtractionFocused", "WikiExtractionStandard", "WikiExtractionExhaustive" ] }, "github_com_Tencent_WeKnora_internal_types.WikiFolder": { "type": "object", "properties": { "created_at": { "type": "string" }, "deleted_at": { "$ref": "#/definitions/gorm.DeletedAt" }, "depth": { "type": "integer" }, "id": { "type": "string" }, "knowledge_base_id": { "type": "string" }, "name": { "type": "string" }, "parent_id": { "type": "string" }, "path": { "type": "string" }, "sort_order": { "type": "integer" }, "tenant_id": { "type": "integer" }, "updated_at": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiFolderCreateRequest": { "type": "object", "properties": { "name": { "type": "string" }, "parent_id": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiFolderListResponse": { "type": "object", "properties": { "folders": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiFolderNode" } }, "parent_id": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiFolderNode": { "type": "object", "properties": { "created_at": { "type": "string" }, "deleted_at": { "$ref": "#/definitions/gorm.DeletedAt" }, "depth": { "type": "integer" }, "has_children": { "type": "boolean" }, "id": { "type": "string" }, "knowledge_base_id": { "type": "string" }, "name": { "type": "string" }, "page_count": { "type": "integer" }, "parent_id": { "type": "string" }, "path": { "type": "string" }, "sort_order": { "type": "integer" }, "tenant_id": { "type": "integer" }, "updated_at": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiFolderUpdateRequest": { "type": "object", "properties": { "move_parent": { "type": "boolean" }, "name": { "type": "string" }, "parent_id": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiGraphData": { "type": "object", "properties": { "edges": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiGraphEdge" } }, "meta": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiGraphMeta" }, "nodes": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiGraphNode" } } } }, "github_com_Tencent_WeKnora_internal_types.WikiGraphEdge": { "type": "object", "properties": { "source": { "description": "source slug", "type": "string" }, "target": { "description": "target slug", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiGraphMeta": { "type": "object", "properties": { "center": { "description": "populated in ego mode", "type": "string" }, "depth": { "description": "populated in ego mode", "type": "integer" }, "mode": { "type": "string" }, "returned": { "description": "number of nodes actually returned", "type": "integer" }, "total": { "description": "total node count in the KB before filtering/limit", "type": "integer" }, "truncated": { "description": "true when Returned \u003c Total (after filters)", "type": "boolean" } } }, "github_com_Tencent_WeKnora_internal_types.WikiGraphNode": { "type": "object", "properties": { "link_count": { "description": "Number of inbound + outbound links", "type": "integer" }, "page_type": { "type": "string" }, "slug": { "type": "string" }, "title": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiIndexEntry": { "type": "object", "properties": { "category_path": { "type": "array", "items": { "type": "string" } }, "depth": { "type": "integer" }, "parent_slug": { "type": "string" }, "slug": { "type": "string" }, "sort_order": { "type": "integer" }, "summary": { "type": "string" }, "title": { "type": "string" }, "wiki_path": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiIndexGroup": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiIndexEntry" } }, "next_cursor": { "type": "string" }, "total": { "type": "integer" }, "type": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiIndexResponse": { "type": "object", "properties": { "groups": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiIndexGroup" } }, "intro": { "type": "string" }, "version": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.WikiPage": { "type": "object", "properties": { "aliases": { "description": "Alternate names, abbreviations, acronyms or translated names", "type": "array", "items": { "type": "string" } }, "category_path": { "description": "CategoryPath is the directory breadcrumb that groups this page in the\nwiki browser, e.g. [\"AI\", \"LLM 应用\", \"RAG\"]. Derived cache of the\nfolder chain identified by FolderID.", "type": "array", "items": { "type": "string" } }, "chunk_refs": { "description": "ChunkRefs records the specific source-document chunks this page was\nbuilt from — one UUID per cited chunk. Populated during ingest from\nthe chunk-citation pass; refreshed wholesale whenever the page is\nre-materialized. Empty for summary pages (they are document-level\nsynopses and don't carry chunk-level citations). Use this when you\nneed to surface the underlying evidence for a wiki page, or to\nretract citations when a source document is deleted.", "type": "array", "items": { "type": "string" } }, "content": { "description": "Full markdown content", "type": "string" }, "created_at": { "description": "Creation time", "type": "string" }, "deleted_at": { "description": "Soft delete", "allOf": [ { "$ref": "#/definitions/gorm.DeletedAt" } ] }, "depth": { "description": "Depth is len(CategoryPath), cached for filtering / display.", "type": "integer" }, "folder_id": { "description": "FolderID is the single source of truth for where this page sits in the\ndirectory tree — a reference to wiki_folders.id (\"\" = wiki root). The\nCategoryPath / WikiPath / Depth fields below are denormalized caches\nrecomputed from this folder's chain on every write so list/index/search\nqueries don't have to join wiki_folders.", "type": "string" }, "id": { "description": "Unique identifier (UUID)", "type": "string" }, "in_links": { "description": "Slugs of pages that link TO this page (backlinks)", "type": "array", "items": { "type": "string" } }, "knowledge_base_id": { "description": "Knowledge base this page belongs to", "type": "string" }, "last_edit_source": { "description": "LastEditSource records who authored the CURRENT version: pipeline |\nagent | user | revert. Empty for legacy rows (treated as pipeline).\nWhen the version is superseded this value travels into the revision\nsnapshot, so each historical version keeps its own author kind.", "type": "string" }, "last_editor_id": { "description": "LastEditorID is the user id of the caller that produced the current\nversion (empty for background pipeline writes).", "type": "string" }, "out_links": { "description": "Slugs of pages this page links to (outbound links)", "type": "array", "items": { "type": "string" } }, "page_metadata": { "description": "Arbitrary metadata (tags, categories, dates, etc.)", "type": "array", "items": { "type": "integer" } }, "page_type": { "description": "Page type: summary, entity, concept, index, synthesis, comparison", "type": "string" }, "parent_slug": { "description": "ParentSlug optionally points at the wiki page that should act as this\npage's semantic parent in the directory tree. The parent may be empty\nwhen the page is grouped only by FolderID.", "type": "string" }, "slug": { "description": "URL-friendly slug for addressing, e.g. \"entity/acme-corp\", \"concept/rag\"\nUnique within a knowledge base", "type": "string" }, "sort_order": { "description": "SortOrder allows generated or manually edited pages to control sibling\nordering before falling back to title.", "type": "integer" }, "source_refs": { "description": "References to source knowledge IDs that contributed to this page.\nFormat matches the legacy \"\u003cknowledge_id\u003e|\u003cdoc_title\u003e\" convention used\nacross the ingest pipeline, so retract / display code can split on `|`\nto recover the title. Document-level granularity.", "type": "array", "items": { "type": "string" } }, "status": { "description": "Page status: draft, published, archived", "type": "string" }, "summary": { "description": "One-line summary for index listing", "type": "string" }, "tenant_id": { "description": "Workspace ID for multi-workspace isolation", "type": "integer" }, "title": { "description": "Human-readable title", "type": "string" }, "updated_at": { "description": "Last update time", "type": "string" }, "version": { "description": "Version number. Incremented only when a user-visible content field\n(title, content, summary, page_type, status) actually changes; pure\nbookkeeping writes (link maintenance, same-content re-ingest, status\nsync from background jobs) leave it untouched so it can be used as a\nreal \"the page was edited\" signal.", "type": "integer" }, "wiki_path": { "description": "WikiPath is a normalized, sortable path derived from page_type,\ncategory_path, and title. It keeps large directory listings cheap to sort.", "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiPageIssue": { "type": "object", "properties": { "created_at": { "type": "string" }, "deleted_at": { "$ref": "#/definitions/gorm.DeletedAt" }, "description": { "type": "string" }, "id": { "type": "string" }, "issue_type": { "type": "string" }, "knowledge_base_id": { "type": "string" }, "reported_by": { "type": "string" }, "slug": { "type": "string" }, "status": { "type": "string" }, "suspected_knowledge_ids": { "type": "array", "items": { "type": "string" } }, "tenant_id": { "type": "integer" }, "updated_at": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiPageListResponse": { "type": "object", "properties": { "page": { "type": "integer" }, "page_size": { "type": "integer" }, "pages": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage" } }, "total": { "type": "integer" }, "total_pages": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.WikiPageMoveRequest": { "type": "object", "required": [ "slug" ], "properties": { "folder_id": { "type": "string" }, "slug": { "type": "string" } } }, "github_com_Tencent_WeKnora_internal_types.WikiPageRevertRequest": { "type": "object", "required": [ "slug", "version" ], "properties": { "slug": { "type": "string" }, "version": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.WikiPageRevision": { "type": "object", "properties": { "aliases": { "type": "array", "items": { "type": "string" } }, "content": { "type": "string" }, "created_at": { "type": "string" }, "edit_source": { "description": "Author of THIS version (same semantics as WikiPage.LastEditSource).", "type": "string" }, "edited_at": { "description": "When this version was authored (the page's updated_at while current).", "type": "string" }, "editor_id": { "type": "string" }, "id": { "type": "string" }, "knowledge_base_id": { "type": "string" }, "page_id": { "type": "string" }, "page_type": { "type": "string" }, "slug": { "type": "string" }, "status": { "type": "string" }, "summary": { "type": "string" }, "tenant_id": { "type": "integer" }, "title": { "type": "string" }, "version": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.WikiPageRevisionListResponse": { "type": "object", "properties": { "current_version": { "type": "integer" }, "revisions": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageRevision" } }, "total": { "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.WikiPageUpdateRequest": { "type": "object", "properties": { "aliases": { "type": "array", "items": { "type": "string" } }, "content": { "type": "string" }, "page_type": { "type": "string" }, "status": { "type": "string" }, "summary": { "type": "string" }, "title": { "type": "string" }, "version": { "description": "Version is the optimistic-lock guard: when \u003e 0 the update is rejected\nwith a conflict if the stored version differs (someone else edited the\npage since the client loaded it). 0 skips the check (legacy clients).", "type": "integer" } } }, "github_com_Tencent_WeKnora_internal_types.WikiStats": { "type": "object", "properties": { "is_active": { "description": "whether wiki ingestion is currently running", "type": "boolean" }, "orphan_count": { "description": "pages with no inbound links", "type": "integer" }, "pages_by_type": { "type": "object", "additionalProperties": { "type": "integer", "format": "int64" } }, "pending_issues": { "description": "number of pending wiki issues", "type": "integer" }, "pending_tasks": { "description": "number of documents waiting to be ingested", "type": "integer" }, "recent_updates": { "description": "last N updated pages", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage" } }, "total_links": { "type": "integer" }, "total_pages": { "type": "integer" } } }, "gorm.DeletedAt": { "type": "object", "properties": { "time": { "type": "string" }, "valid": { "description": "Valid is true if Time is not NULL", "type": "boolean" } } }, "internal_handler.AddFavoriteRequest": { "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string" } } }, "internal_handler.BatchDeleteKnowledgeRequest": { "type": "object", "required": [ "ids", "kb_id" ], "properties": { "ids": { "type": "array", "items": { "type": "string" } }, "kb_id": { "type": "string" } } }, "internal_handler.CopyKnowledgeBaseRequest": { "type": "object", "required": [ "source_id" ], "properties": { "source_id": { "type": "string" }, "target_id": { "type": "string" }, "task_id": { "type": "string" } } }, "internal_handler.CreateAgentRequest": { "type": "object", "required": [ "name" ], "properties": { "avatar": { "type": "string" }, "config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.CustomAgentConfig" }, "description": { "type": "string" }, "name": { "type": "string" } } }, "internal_handler.CreateModelRequest": { "type": "object", "required": [ "name", "parameters", "source", "type" ], "properties": { "description": { "type": "string" }, "display_name": { "type": "string" }, "name": { "type": "string" }, "parameters": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ModelParameters" }, "source": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ModelSource" }, "type": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ModelType" } } }, "internal_handler.CreateStoreRequest": { "type": "object", "required": [ "connection_config", "engine_type", "name" ], "properties": { "connection_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ConnectionConfig" }, "engine_type": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RetrieverEngineType" }, "index_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.IndexConfig" }, "name": { "type": "string" } } }, "internal_handler.DeleteTagRequest": { "type": "object", "properties": { "exclude_ids": { "description": "Chunk seq_ids to exclude from deletion", "type": "array", "items": { "type": "integer" } } } }, "internal_handler.EnsureMessageSuggestionsRequest": { "type": "object", "properties": { "regenerate": { "type": "boolean" } } }, "internal_handler.EvaluationRequest": { "type": "object", "properties": { "chat_id": { "description": "ID of chat model to use", "type": "string" }, "dataset_id": { "description": "ID of dataset to evaluate", "type": "string" }, "knowledge_base_id": { "description": "ID of knowledge base to use", "type": "string" }, "rerank_id": { "description": "ID of rerank model to use", "type": "string" } } }, "internal_handler.FabriTextRequest": { "type": "object", "required": [ "model_id" ], "properties": { "model_id": { "type": "string" }, "tags": { "type": "array", "items": { "type": "string" } } } }, "internal_handler.GetStorageEngineStatusResponse": { "type": "object", "properties": { "allowed_providers": { "type": "array", "items": { "type": "string" } }, "engines": { "type": "array", "items": { "$ref": "#/definitions/internal_handler.StorageEngineStatusItem" } }, "minio_env_available": { "type": "boolean" } } }, "internal_handler.GetSystemInfoResponse": { "type": "object", "properties": { "build_time": { "type": "string" }, "commit_id": { "type": "string" }, "db_migration_error": { "description": "DBMigrationError carries the human-readable error message recorded when\nthe most recent startup migration attempt failed. Empty when migrations\nsucceeded; non-empty values let the frontend surface a troubleshooting\nbanner instead of silently hiding the DB version row (see issue #1319).", "type": "string" }, "db_version": { "type": "string" }, "edition": { "type": "string" }, "go_version": { "type": "string" }, "graph_database_engine": { "type": "string" }, "keyword_index_engine": { "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": { "type": "string" } } }, "internal_handler.InitializationRequest": { "type": "object", "required": [ "documentSplitting", "embedding", "llm" ], "properties": { "documentSplitting": { "type": "object", "required": [ "chunkSize", "separators" ], "properties": { "chunkOverlap": { "type": "integer", "minimum": 0 }, "chunkSize": { "type": "integer", "maximum": 10000, "minimum": 100 }, "separators": { "type": "array", "minItems": 1, "items": { "type": "string" } } } }, "embedding": { "type": "object", "required": [ "modelName", "source" ], "properties": { "apiKey": { "type": "string" }, "baseUrl": { "type": "string" }, "dimension": { "description": "添加embedding维度字段", "type": "integer" }, "modelName": { "type": "string" }, "source": { "type": "string" } } }, "llm": { "type": "object", "required": [ "modelName", "source" ], "properties": { "apiKey": { "type": "string" }, "baseUrl": { "type": "string" }, "modelName": { "type": "string" }, "source": { "type": "string" } } }, "multimodal": { "type": "object", "properties": { "cos": { "type": "object", "properties": { "appId": { "type": "string" }, "bucketName": { "type": "string" }, "pathPrefix": { "type": "string" }, "region": { "type": "string" }, "secretId": { "type": "string" }, "secretKey": { "type": "string" } } }, "enabled": { "type": "boolean" }, "minio": { "type": "object", "properties": { "bucketName": { "type": "string" }, "pathPrefix": { "type": "string" } } }, "storageType": { "type": "string" }, "vlm": { "type": "object", "properties": { "apiKey": { "type": "string" }, "baseUrl": { "type": "string" }, "interfaceType": { "description": "\"ollama\" or \"openai\"", "type": "string" }, "modelName": { "type": "string" } } } } }, "nodeExtract": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "nodes": { "type": "array", "items": { "type": "object", "properties": { "attributes": { "type": "array", "items": { "type": "string" } }, "name": { "type": "string" } } } }, "relations": { "type": "array", "items": { "type": "object", "properties": { "node1": { "type": "string" }, "node2": { "type": "string" }, "type": { "type": "string" } } } }, "tags": { "type": "array", "items": { "type": "string" } }, "text": { "type": "string" } } }, "questionGeneration": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "questionCount": { "type": "integer" } } }, "rerank": { "type": "object", "properties": { "apiKey": { "type": "string" }, "baseUrl": { "type": "string" }, "enabled": { "type": "boolean" }, "modelName": { "type": "string" } } } } }, "internal_handler.KBModelConfigRequest": { "type": "object", "required": [ "llmModelId" ], "properties": { "asr_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig" }, "documentSplitting": { "description": "文档分块配置", "type": "object", "properties": { "childChunkSize": { "type": "integer" }, "chunkOverlap": { "type": "integer" }, "chunkSize": { "type": "integer" }, "enableParentChild": { "type": "boolean" }, "languages": { "type": "array", "items": { "type": "string" } }, "parentChunkSize": { "type": "integer" }, "parserEngineRules": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ParserEngineRule" } }, "separators": { "type": "array", "items": { "type": "string" } }, "strategy": { "description": "Strategy / TokenLimit / Languages use pointer types so the\nhandler can distinguish \"field absent in payload\" (no change)\nfrom \"field present with empty/zero value\" (clear / disable).\nWithout that distinction, users could set strategy=\"auto\" once\nbut never reset it back to legacy / unset.", "type": "string" }, "tableMetadataInstructions": { "type": "string" }, "tokenLimit": { "type": "integer" } } }, "embeddingModelId": { "description": "optional when RAG indexing is disabled", "type": "string" }, "llmModelId": { "type": "string" }, "multimodal": { "description": "多模态配置(仅模型相关;存储引擎在 storageProvider 中配置)", "type": "object", "properties": { "enabled": { "type": "boolean" } } }, "nodeExtract": { "description": "知识图谱配置", "type": "object", "properties": { "customInstructions": { "type": "string" }, "enabled": { "type": "boolean" }, "nodes": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.GraphNode" } }, "relations": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.GraphRelation" } }, "tags": { "type": "array", "items": { "type": "string" } }, "text": { "type": "string" } } }, "questionGeneration": { "description": "问题生成配置", "type": "object", "properties": { "customInstructions": { "type": "string" }, "enabled": { "type": "boolean" }, "questionCount": { "type": "integer" } } }, "storageBackendId": { "type": "string" }, "storageProvider": { "description": "存储引擎选择(\"local\" | \"minio\" | \"cos\"),影响文档上传与文档内图片存储,参数从全局设置读取", "type": "string" }, "vlm_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig" } } }, "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": [ "modelName" ], "properties": { "apiKey": { "type": "string" }, "appSecret": { "description": "AppSecret 用于 LKEAP / Volcengine Rerank 等需要第二段密钥的场景(对应模型 Parameters.AppSecret)。", "type": "string" }, "baseUrl": { "type": "string" }, "customHeaders": { "type": "object", "additionalProperties": { "type": "string" } }, "dimension": { "type": "integer" }, "extraConfig": { "type": "object", "additionalProperties": { "type": "string" } }, "interfaceType": { "type": "string" }, "modelId": { "description": "ModelID, when set, instructs the handler to substitute any missing\nsecrets (APIKey, AppSecret via ExtraConfig) from the stored model\nrecord before assembling the test client. This lets the \"Test\nconnection\" button work on existing models without making the\nfrontend reload — and ship — the plaintext API key. Other fields\n(BaseURL, ModelName, etc.) on this request still override the\nstored values, so a user can validate a new endpoint against the\nexisting credentials in one click.", "type": "string" }, "modelName": { "type": "string" }, "provider": { "type": "string" }, "source": { "description": "为空时按需默认为 \"remote\"", "type": "string" }, "supportsDimensionOverride": { "type": "boolean" } } }, "internal_handler.MoveKnowledgeRequest": { "type": "object", "required": [ "knowledge_ids", "mode", "source_kb_id", "target_kb_id" ], "properties": { "knowledge_ids": { "type": "array", "minItems": 1, "items": { "type": "string" } }, "mode": { "type": "string", "enum": [ "reuse_vectors", "reparse" ] }, "source_kb_id": { "type": "string" }, "target_kb_id": { "type": "string" } } }, "internal_handler.MoveKnowledgeResponse": { "type": "object", "properties": { "knowledge_count": { "type": "integer" }, "message": { "type": "string" }, "source_kb_id": { "type": "string" }, "target_kb_id": { "type": "string" }, "task_id": { "type": "string" } } }, "internal_handler.PreviewChunkResult": { "type": "object", "properties": { "content": { "type": "string" }, "context_header": { "type": "string" }, "end": { "type": "integer" }, "seq": { "type": "integer" }, "size_chars": { "type": "integer" }, "size_tokens_approx": { "type": "integer" }, "start": { "type": "integer" } } }, "internal_handler.PreviewChunkingPayload": { "type": "object", "properties": { "chunk_overlap": { "type": "integer" }, "chunk_size": { "type": "integer" }, "languages": { "type": "array", "items": { "type": "string" } }, "separators": { "type": "array", "items": { "type": "string" } }, "strategy": { "type": "string" }, "token_limit": { "type": "integer" } } }, "internal_handler.PreviewChunkingRequest": { "type": "object", "properties": { "chunking_config": { "$ref": "#/definitions/internal_handler.PreviewChunkingPayload" }, "text": { "type": "string" } } }, "internal_handler.PreviewChunkingResponse": { "type": "object", "properties": { "chunks": { "type": "array", "items": { "$ref": "#/definitions/internal_handler.PreviewChunkResult" } }, "profile": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_infrastructure_chunker.DocProfile" }, "rejected": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_infrastructure_chunker.TierRejection" } }, "selected_tier": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_infrastructure_chunker.StrategyTier" }, "stats": { "$ref": "#/definitions/internal_handler.PreviewChunkingStats" }, "tier_chain": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_infrastructure_chunker.StrategyTier" } } } }, "internal_handler.PreviewChunkingStats": { "type": "object", "properties": { "avg_chars": { "type": "integer" }, "count": { "type": "integer" }, "max_chars": { "type": "integer" }, "min_chars": { "type": "integer" }, "stddev_chars": { "type": "integer" }, "truncated_to": { "description": "TruncatedTo, when set, is the original chunk count before the\nresponse was truncated to previewMaxChunks for transport.", "type": "integer" } } }, "internal_handler.PromoteUserToSystemAdminRequest": { "type": "object", "properties": { "email": { "type": "string" }, "user_id": { "type": "string" } } }, "internal_handler.RemoteModelCheckRequest": { "type": "object", "required": [ "modelName" ], "properties": { "apiKey": { "type": "string" }, "appSecret": { "description": "AppSecret 用于 LKEAP / Volcengine Rerank 等需要第二段密钥的场景(对应模型 Parameters.AppSecret)。", "type": "string" }, "baseUrl": { "type": "string" }, "customHeaders": { "type": "object", "additionalProperties": { "type": "string" } }, "dimension": { "type": "integer" }, "extraConfig": { "type": "object", "additionalProperties": { "type": "string" } }, "interfaceType": { "type": "string" }, "modelId": { "description": "ModelID, when set, instructs the handler to substitute any missing\nsecrets (APIKey, AppSecret via ExtraConfig) from the stored model\nrecord before assembling the test client. This lets the \"Test\nconnection\" button work on existing models without making the\nfrontend reload — and ship — the plaintext API key. Other fields\n(BaseURL, ModelName, etc.) on this request still override the\nstored values, so a user can validate a new endpoint against the\nexisting credentials in one click.", "type": "string" }, "modelName": { "type": "string" }, "provider": { "type": "string" }, "source": { "description": "为空时按需默认为 \"remote\"", "type": "string" }, "supportsDimensionOverride": { "type": "boolean" } } }, "internal_handler.ResetUserPasswordRequest": { "type": "object", "required": [ "email", "new_password" ], "properties": { "email": { "type": "string" }, "new_password": { "type": "string" } } }, "internal_handler.RevokeSystemAdminRequest": { "type": "object", "required": [ "user_id" ], "properties": { "user_id": { "type": "string" } } }, "internal_handler.RuntimeQueuesResponse": { "type": "object", "properties": { "available": { "type": "boolean" }, "model_limiter_available": { "type": "boolean" }, "models": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_models_limiter.RuntimeStat" } }, "parse_concurrency": { "description": "compatibility alias for upstream_concurrency", "type": "integer" }, "pools": { "type": "array", "items": { "$ref": "#/definitions/internal_handler.RuntimeWorkerPool" } }, "queues": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QueueStat" } }, "timestamp": { "type": "integer" }, "upstream_concurrency": { "type": "integer" }, "wiki_concurrency": { "description": "compatibility field", "type": "integer" } } }, "internal_handler.RuntimeTasksResponse": { "type": "object", "properties": { "available": { "type": "boolean" }, "has_more": { "type": "boolean" }, "next_cursor": { "type": "string" }, "page_size": { "type": "integer" }, "tasks": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RuntimeTaskInfo" } } } }, "internal_handler.RuntimeWorkerPool": { "description": "Return every row in the system_settings table (system-scope, not workspace-scoped). SystemAdmin only.", "type": "object", "properties": { "active": { "description": "live workers assigned to this pool", "type": "integer" }, "cluster_capacity": { "description": "sum of live server concurrency", "type": "integer" }, "concurrency": { "description": "configured per instance", "type": "integer" }, "instances": { "description": "live asynq server heartbeats", "type": "integer" }, "name": { "type": "string" }, "queue_count": { "type": "integer" }, "utilization": { "description": "Active / ClusterCapacity", "type": "number" } } }, "internal_handler.SearchMessagesRequest": { "type": "object", "required": [ "query" ], "properties": { "limit": { "description": "Maximum number of results to return (default: 20)", "type": "integer" }, "mode": { "description": "Search mode: \"keyword\", \"vector\", \"hybrid\" (default: \"hybrid\")", "type": "string" }, "query": { "description": "Query text for search", "type": "string" }, "session_ids": { "description": "Filter by specific session IDs (optional)", "type": "array", "items": { "type": "string" } } } }, "internal_handler.StorageCheckRequest": { "type": "object", "properties": { "cos": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.COSEngineConfig" }, "ks3": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KS3EngineConfig" }, "minio": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MinIOEngineConfig" }, "obs": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OBSEngineConfig" }, "oss": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OSSEngineConfig" }, "provider": { "description": "\"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\", \"obs\"", "type": "string" }, "s3": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.S3EngineConfig" }, "tos": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.TOSEngineConfig" } } }, "internal_handler.StorageCheckResponse": { "type": "object", "properties": { "bucket_created": { "type": "boolean" }, "message": { "type": "string" }, "ok": { "type": "boolean" } } }, "internal_handler.StorageEngineStatusItem": { "type": "object", "properties": { "allowed": { "type": "boolean" }, "available": { "description": "whether the engine can be used", "type": "boolean" }, "description": { "description": "short description for UI", "type": "string" }, "name": { "description": "\"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\", \"obs\"", "type": "string" } } }, "internal_handler.SuggestionEventRequest": { "type": "object", "required": [ "event_type", "suggestion_set_id" ], "properties": { "event_type": { "type": "string" }, "question_id": { "type": "string" }, "suggestion_set_id": { "type": "string" } } }, "internal_handler.TestProviderRequest": { "type": "object", "required": [ "provider" ], "properties": { "parameters": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WebSearchProviderParameters" }, "provider": { "type": "string" } } }, "internal_handler.TestStoreRequest": { "type": "object", "required": [ "connection_config", "engine_type" ], "properties": { "connection_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ConnectionConfig" }, "engine_type": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RetrieverEngineType" } } }, "internal_handler.TextRelationExtractionRequest": { "type": "object", "required": [ "model_id", "tags", "text" ], "properties": { "model_id": { "type": "string" }, "tags": { "type": "array", "items": { "type": "string" } }, "text": { "type": "string" } } }, "internal_handler.UpdateAgentRequest": { "type": "object", "properties": { "avatar": { "type": "string" }, "config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.CustomAgentConfig" }, "description": { "type": "string" }, "name": { "type": "string" } } }, "internal_handler.UpdateChunkRequest": { "type": "object", "properties": { "chunk_index": { "type": "integer" }, "content": { "type": "string" }, "embedding": { "type": "array", "items": { "type": "number" } }, "end_at": { "type": "integer" }, "image_info": { "type": "string" }, "is_enabled": { "type": "boolean" }, "start_at": { "type": "integer" } } }, "internal_handler.UpdateKnowledgeBaseRequest": { "type": "object", "required": [ "name" ], "properties": { "config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseConfig" }, "description": { "type": "string" }, "name": { "type": "string" } } }, "internal_handler.UpdateModelRequest": { "type": "object", "properties": { "description": { "type": "string" }, "display_name": { "type": "string" }, "name": { "type": "string" }, "parameters": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ModelParameters" }, "source": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ModelSource" }, "type": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ModelType" } } }, "internal_handler.UpdateProviderRequest": { "type": "object", "properties": { "description": { "type": "string" }, "is_default": { "type": "boolean" }, "name": { "type": "string" }, "parameters": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WebSearchProviderParameters" } } }, "internal_handler.UpdateStoreRequest": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string" } } }, "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": [ "email", "role" ], "properties": { "email": { "type": "string" }, "role": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.TenantRole" } } }, "internal_handler.addSimilarQuestionsRequest": { "type": "object", "required": [ "similar_questions" ], "properties": { "similar_questions": { "type": "array", "minItems": 1, "items": { "type": "string" } } } }, "internal_handler.apiPrincipalConfigRequest": { "type": "object", "properties": { "direct_header_name": { "type": "string" }, "hmac_secret": { "type": "string" }, "mode": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.APIPrincipalMode" }, "require_direct_header": { "type": "boolean" }, "signed_token_header_name": { "type": "string" } } }, "internal_handler.apiPrincipalTestTokenRequest": { "type": "object", "properties": { "expires_in_seconds": { "type": "integer" }, "external_user_id": { "type": "string" } } }, "internal_handler.auditLogListResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AuditLog" } }, "next_cursor": { "type": "integer" }, "success": { "type": "boolean" } } }, "internal_handler.batchReparseKnowledgeRequest": { "type": "object", "required": [ "ids", "kb_id" ], "properties": { "ids": { "type": "array", "items": { "type": "string" } }, "kb_id": { "type": "string" }, "process_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeProcessOverrides" } } }, "internal_handler.createInvitationRequest": { "type": "object", "required": [ "email", "role" ], "properties": { "email": { "type": "string" }, "message": { "type": "string" }, "role": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.TenantRole" } } }, "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": [ "name" ], "properties": { "description": { "type": "string", "maxLength": 512 }, "name": { "type": "string", "maxLength": 128, "minLength": 1 } } }, "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.platformAPIKeyCreateRequest": { "type": "object", "properties": { "capabilities": { "type": "array", "items": { "type": "string" } }, "expires_at_unix": { "type": "integer" }, "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.resolveAncestorsRequest": { "type": "object", "properties": { "resource_ids": { "type": "array", "items": { "type": "string" } } } }, "internal_handler.storageBackendRequest": { "type": "object", "required": [ "name", "provider" ], "properties": { "config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.StorageBackendConfig" }, "name": { "type": "string" }, "provider": { "type": "string" }, "status": { "type": "string" } } }, "internal_handler.updateLastFAQImportResultDisplayStatusRequest": { "type": "object", "required": [ "display_status" ], "properties": { "display_status": { "type": "string", "enum": [ "open", "close" ] } } }, "internal_handler.updateMemberRoleRequest": { "type": "object", "required": [ "role" ], "properties": { "role": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.TenantRole" } } }, "internal_handler.updateMyPreferencesRequest": { "type": "object", "properties": { "last_active_tenant_id": { "description": "LastActiveTenantID lets the SPA persist \"after a fresh login,\ndrop me back into this workspace\" across devices. Send a positive\nworkspace id to set / replace, or 0 to clear. Membership is validated\nat next login, not here. Nil = field omitted from the PATCH and\nstays untouched.", "type": "integer" } } }, "internal_handler_session.AttachmentUpload": { "type": "object", "properties": { "data": { "description": "Base64-encoded file content", "type": "string" }, "file_name": { "description": "Original filename", "type": "string" }, "file_size": { "description": "File size in bytes", "type": "integer" } } }, "internal_handler_session.CreateKnowledgeQARequest": { "type": "object", "required": [ "query" ], "properties": { "agent_enabled": { "description": "Whether agent mode is enabled for this request", "type": "boolean" }, "agent_id": { "description": "Selected custom agent ID (backend resolves shared agent and its workspace from share relation)", "type": "string" }, "attachment_ids": { "description": "Pre-uploaded session-scoped document IDs", "type": "array", "items": { "type": "string" } }, "attachment_uploads": { "description": "Attached files (documents, audio, etc.)", "type": "array", "items": { "$ref": "#/definitions/internal_handler_session.AttachmentUpload" } }, "channel": { "description": "Source channel: \"web\", \"api\", \"im\", etc.", "type": "string" }, "disable_title": { "description": "Whether to disable auto title generation", "type": "boolean" }, "images": { "description": "Attached images for multimodal chat", "type": "array", "items": { "$ref": "#/definitions/internal_handler_session.ImageAttachment" } }, "knowledge_base_ids": { "description": "Selected knowledge base ID for this request", "type": "array", "items": { "type": "string" } }, "knowledge_ids": { "description": "Selected knowledge ID for this request", "type": "array", "items": { "type": "string" } }, "mcp_service_ids": { "description": "Per-request MCP services selected via @mention", "type": "array", "items": { "type": "string" } }, "mentioned_items": { "description": "@mentioned knowledge bases and files", "type": "array", "items": { "$ref": "#/definitions/internal_handler_session.MentionedItemRequest" } }, "query": { "description": "Query text for knowledge base search", "type": "string" }, "skill_names": { "description": "Per-request Skills selected via @mention", "type": "array", "items": { "type": "string" } }, "suggestion_attribution": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SuggestionAttribution" }, "summary_model_id": { "description": "Optional summary model ID for this request (overrides session default)", "type": "string" }, "tag_ids": { "description": "@mentioned tag IDs (display/debug; scoped via MentionedItems)", "type": "array", "items": { "type": "string" } }, "web_search_enabled": { "description": "Whether web search is enabled for this request", "type": "boolean" } } }, "internal_handler_session.CreateSessionRequest": { "type": "object", "properties": { "description": { "description": "Description for the session (optional)", "type": "string" }, "title": { "description": "Title for the session (optional)", "type": "string" } } }, "internal_handler_session.GenerateTitleRequest": { "type": "object", "required": [ "messages" ], "properties": { "messages": { "description": "Messages to use as context for title generation", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Message" } } } }, "internal_handler_session.ImageAttachment": { "type": "object", "properties": { "caption": { "description": "VLM analysis result (context-aware, single call)", "type": "string" }, "data": { "description": "base64 data URI from frontend (data:image/png;base64,...)", "type": "string" }, "url": { "description": "serving URL after saving to storage", "type": "string" } } }, "internal_handler_session.MentionedItemRequest": { "type": "object", "properties": { "id": { "type": "string" }, "kb_id": { "description": "Parent knowledge base for file/tag mentions", "type": "string" }, "kb_name": { "description": "Display name for parent KB", "type": "string" }, "kb_type": { "description": "\"document\" or \"faq\" (only for kb type)", "type": "string" }, "name": { "type": "string" }, "service_id": { "description": "Parent MCP service for MCP tool mentions", "type": "string" }, "skill_name": { "description": "Preloaded agent skill name", "type": "string" }, "type": { "description": "\"kb\", \"file\", \"tag\", \"mcp\", \"skill\"", "type": "string" } } }, "internal_handler_session.SearchKnowledgeRequest": { "type": "object", "required": [ "query" ], "properties": { "knowledge_base_id": { "description": "Single knowledge base ID (for backward compatibility)", "type": "string" }, "knowledge_base_ids": { "description": "IDs of knowledge bases to search (multi-KB support)", "type": "array", "items": { "type": "string" } }, "knowledge_ids": { "description": "IDs of specific knowledge (files) to search", "type": "array", "items": { "type": "string" } }, "mentioned_items": { "description": "Optional scoped tag mentions", "type": "array", "items": { "$ref": "#/definitions/internal_handler_session.MentionedItemRequest" } }, "query": { "description": "Query text to search for", "type": "string" }, "tag_ids": { "description": "Tag IDs for filtering within a single KB", "type": "array", "items": { "type": "string" } } } }, "internal_handler_session.StopSessionRequest": { "type": "object", "required": [ "message_id" ], "properties": { "message_id": { "type": "string" } } }, "internal_handler_session.batchDeleteRequest": { "type": "object", "properties": { "delete_all": { "type": "boolean" }, "ids": { "type": "array", "items": { "type": "string" } } } } }, "securityDefinitions": { "ApiKeyAuth": { "description": "API Key 认证:空间 Key 固定访问所属空间;平台 Key 调用空间接口时需同时传 X-Tenant-ID", "type": "apiKey", "name": "X-API-Key", "in": "header" }, "Bearer": { "description": "用户登录认证:输入 Bearer {token} 格式的 JWT 令牌", "type": "apiKey", "name": "Authorization", "in": "header" } } }