Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(swagger): Fix some Swagger API endpoints returning 404 errors and regenerate the Swagger documentation

ChenRussell09f0f5b8a952
diff --git a/docs/docs.go b/docs/docs.go
index 71f656e7e..4abaf5f8c 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -576,48 +576,43 @@ const docTemplate = `{
}
}
},
- "/api/v1/datasource": {
- "get": {
- "description": "List all data sources for a specific knowledge base",
+ "/auth/auto-setup": {
+ "post": {
+ "description": "Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程",
+ "consumes": [
+ "application/json"
+ ],
"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
- }
+ "认证"
],
+ "summary": "自动初始化(Lite 桌面版)",
"responses": {
"200": {
"description": "OK",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse"
}
},
- "400": {
- "description": "Bad Request",
+ "403": {
+ "description": "非 Lite 版本",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- },
+ }
+ },
+ "/auth/change-password": {
"post": {
- "description": "Create a new data source configuration for a knowledge base",
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "修改当前用户的登录密码",
"consumes": [
"application/json"
],
@@ -625,103 +620,117 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "Create a new data source",
+ "summary": "修改密码",
"parameters": [
{
- "description": "Data source configuration",
+ "description": "密码修改请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ "type": "object",
+ "properties": {
+ "new_password": {
+ "type": "string"
+ },
+ "old_password": {
+ "type": "string"
+ }
+ }
}
}
],
"responses": {
- "201": {
- "description": "Created",
+ "200": {
+ "description": "修改成功",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/logs/{log_id}": {
+ "/auth/config": {
"get": {
- "description": "Retrieve a specific sync log entry",
+ "description": "返回当前部署的注册模式等公开认证配置,供前端决定是否展示注册入口",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "DataSource"
- ],
- "summary": "Get specific sync log",
- "parameters": [
- {
- "type": "string",
- "description": "Sync log ID",
- "name": "log_id",
- "in": "path",
- "required": true
- }
+ "认证"
],
+ "summary": "获取认证配置",
"responses": {
"200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog"
- }
- },
- "404": {
- "description": "Not Found",
+ "description": "认证配置",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
}
}
}
},
- "/api/v1/datasource/types": {
- "get": {
- "description": "Get list of available data source connectors",
+ "/auth/login": {
+ "post": {
+ "description": "用户登录并获取访问令牌",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "DataSource"
+ "认证"
+ ],
+ "summary": "用户登录",
+ "parameters": [
+ {
+ "description": "登录请求参数",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginRequest"
+ }
+ }
],
- "summary": "Get available connectors",
"responses": {
"200": {
"description": "OK",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_datasource.ConnectorMetadata"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse"
+ }
+ },
+ "401": {
+ "description": "认证失败",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/validate-credentials": {
+ "/auth/logout": {
"post": {
- "description": "Validate connectivity to an external data source using type + credentials",
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "撤销当前访问令牌并登出",
"consumes": [
"application/json"
],
@@ -729,81 +738,69 @@ const docTemplate = `{
"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"
- }
- }
+ "认证"
],
+ "summary": "用户登出",
"responses": {
"200": {
- "description": "OK",
+ "description": "登出成功",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/{id}": {
+ "/auth/me": {
"get": {
- "description": "Retrieve a data source configuration by ID",
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "获取当前登录用户的详细信息",
+ "consumes": [
+ "application/json"
+ ],
"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
- }
+ "认证"
],
+ "summary": "获取当前用户信息",
"responses": {
"200": {
- "description": "OK",
+ "description": "用户信息",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ "type": "object",
+ "additionalProperties": true
}
},
- "404": {
- "description": "Not Found",
+ "401": {
+ "description": "未授权",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- },
+ }
+ },
+ "/auth/me/preferences": {
"put": {
- "description": "Update an existing data source configuration",
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "按 PATCH 语义合并用户偏好(仅覆盖请求体里出现的字段,其余字段保持不变),\n数据存放在 users.preferences (JSON),跨设备/浏览器自动同步。",
"consumes": [
"application/json"
],
@@ -811,527 +808,636 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "Update a data source",
+ "summary": "更新当前用户的个性化设置",
"parameters": [
{
- "type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
- },
- {
- "description": "Updated configuration",
+ "description": "Preferences patch",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ "$ref": "#/definitions/internal_handler.updateMyPreferencesRequest"
}
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "更新后的偏好",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- }
- }
- },
- "delete": {
- "description": "Delete a data source (soft delete)",
+ },
+ "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": [
- "DataSource"
+ "认证"
],
- "summary": "Delete a data source",
+ "summary": "OIDC登录重定向回调",
"parameters": [
{
"type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "OIDC授权码",
+ "name": "code",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "OIDC状态",
+ "name": "state",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "OIDC错误码",
+ "name": "error",
+ "in": "query"
}
],
"responses": {
- "204": {
- "description": "No Content"
- },
- "404": {
- "description": "Not Found",
+ "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": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCConfigResponse"
}
}
}
}
},
- "/api/v1/datasource/{id}/logs": {
+ "/auth/oidc/url": {
"get": {
- "description": "Retrieve sync history for a data source",
+ "description": "根据后端OIDC配置生成第三方登录跳转地址",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "Get sync logs",
+ "summary": "获取OIDC授权地址",
"parameters": [
{
"type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
+ "description": "OIDC回调地址",
+ "name": "redirect_uri",
+ "in": "query",
"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"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCAuthURLResponse"
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ },
+ "403": {
+ "description": "OIDC未启用",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/{id}/pause": {
+ "/auth/refresh": {
"post": {
- "description": "Pause a data source's scheduled syncs",
+ "description": "使用刷新令牌获取新的访问令牌",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "Pause data source",
+ "summary": "刷新令牌",
"parameters": [
{
- "type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "刷新令牌",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "refreshToken": {
+ "type": "string"
+ }
+ }
+ }
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "新令牌",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
},
- "400": {
- "description": "Bad Request",
+ "401": {
+ "description": "令牌无效",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/{id}/resources": {
- "get": {
- "description": "List resources available for sync in the external system",
+ "/auth/register": {
+ "post": {
+ "description": "注册新用户账号",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "List available resources in data source",
+ "summary": "用户注册",
"parameters": [
{
- "type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "注册请求参数",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterRequest"
+ }
}
],
"responses": {
- "200": {
- "description": "OK",
+ "201": {
+ "description": "Created",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Resource"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterResponse"
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ },
+ "403": {
+ "description": "注册功能已禁用",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/{id}/resume": {
+ "/auth/switch-tenant": {
"post": {
- "description": "Resume a paused data source",
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "为当前用户在目标租户重新签发访问令牌;要求该用户在目标租户存在 active 成员关系",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "Resume data source",
+ "summary": "切换激活租户",
"parameters": [
{
- "type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
+ "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": "OK",
+ "description": "令牌有效",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
},
- "400": {
- "description": "Bad Request",
+ "401": {
+ "description": "令牌无效",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/{id}/sync": {
+ "/chunker/preview": {
"post": {
- "description": "Trigger an immediate sync for a data source",
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "对提交的文本运行自适应分块器并返回分块预览,不写入数据库不生成 embedding。文本最大 64k 字符",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "DataSource"
+ "分块"
],
- "summary": "Trigger immediate sync",
+ "summary": "预览分块结果",
"parameters": [
{
- "type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "{text, chunking_config}",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/internal_handler.PreviewChunkingRequest"
+ }
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "分块结果",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog"
+ "$ref": "#/definitions/internal_handler.PreviewChunkingResponse"
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
- }
- }
- }
- },
- "/api/v1/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",
+ },
+ "413": {
+ "description": "文本超过预览限制",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
},
- "400": {
- "description": "Bad Request",
+ "504": {
+ "description": "分块超时",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
}
}
}
},
- "/api/v1/knowledgebase/{kb_id}/wiki/auto-fix": {
- "post": {
+ "/chunks/by-id/{id}": {
+ "get": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "Automatically fix fixable wiki issues (broken links, etc.)",
+ "description": "仅通过分块ID获取分块详情(不需要knowledge_id);支持共享知识库下的分块访问",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "Auto-fix wiki issues",
+ "summary": "通过ID获取分块",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "分块ID",
+ "name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "OK",
+ "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/knowledgebase/{kb_id}/wiki/graph": {
- "get": {
+ "/chunks/by-id/{id}/questions": {
+ "delete": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "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.",
+ "description": "删除分块中生成的问题",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "Get wiki link graph",
+ "summary": "删除生成的问题",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "分块ID",
+ "name": "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"
+ "description": "问题ID",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "question_id": {
+ "type": "string"
+ }
+ }
+ }
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "删除成功",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiGraphData"
+ "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/knowledgebase/{kb_id}/wiki/index": {
+ "/chunks/{knowledge_id}": {
"get": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "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.",
+ "description": "获取指定知识下的所有分块列表,支持分页",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "Get wiki index view",
+ "summary": "获取知识分块列表",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "知识ID",
+ "name": "knowledge_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",
+ "default": 1,
+ "description": "页码",
+ "name": "page",
"in": "query"
},
{
- "type": "string",
- "description": "Opaque offset cursor from previous response",
- "name": "cursor",
+ "type": "integer",
+ "default": 10,
+ "description": "每页数量",
+ "name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "分块列表",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiIndexResponse"
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "400": {
+ "description": "请求参数错误",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/api/v1/knowledgebase/{kb_id}/wiki/issues": {
- "get": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "List issues flagged on wiki pages with optional filtering",
+ "description": "删除指定知识下的所有分块",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "List wiki page issues",
+ "summary": "删除知识下所有分块",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "知识ID",
+ "name": "knowledge_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",
+ "description": "删除成功",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageIssue"
- }
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "400": {
+ "description": "请求参数错误",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/knowledgebase/{kb_id}/wiki/issues/{issue_id}/status": {
+ "/chunks/{knowledge_id}/{id}": {
"put": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "Update the status of a flagged wiki page issue",
+ "description": "更新指定分块的内容和属性",
"consumes": [
"application/json"
],
@@ -1339,221 +1445,261 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "Update wiki page issue status",
+ "summary": "更新分块",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "知识ID",
+ "name": "knowledge_id",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "Issue ID",
- "name": "issue_id",
+ "description": "分块ID",
+ "name": "id",
"in": "path",
"required": true
},
{
- "description": "New status {'status': 'ignored'}",
- "name": "status",
+ "description": "更新请求",
+ "name": "request",
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "$ref": "#/definitions/internal_handler.UpdateChunkRequest"
}
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "更新后的分块",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
},
"400": {
- "description": "Bad Request",
+ "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/knowledgebase/{kb_id}/wiki/lint": {
- "get": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "Perform a comprehensive health check on the wiki",
+ "description": "删除指定的分块",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "Run wiki lint",
+ "summary": "删除分块",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "知识ID",
+ "name": "knowledge_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "分块ID",
+ "name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "删除成功",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_application_service.WikiLintReport"
+ "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/knowledgebase/{kb_id}/wiki/log": {
+ "/datasource": {
"get": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Returns a paginated feed of wiki operation events (ingest, retract, ...)\nnewest-first. Pagination is cursor-based: pass ` + "`" + `next_cursor` + "`" + ` from the\nprevious response back as ` + "`" + `cursor` + "`" + ` to fetch the next page.",
+ "description": "List all data sources for a specific knowledge base",
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Get wiki operation log",
+ "summary": "List data sources for a knowledge base",
"parameters": [
{
"type": "string",
"description": "Knowledge base ID",
"name": "kb_id",
- "in": "path",
+ "in": "query",
"required": true
- },
- {
- "type": "string",
- "description": "Opaque cursor from the previous page (empty = newest)",
- "name": "cursor",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "Page size, 1-200 (default 50)",
- "name": "limit",
- "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiLogEntryListResponse"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
- }
- },
- "/api/v1/knowledgebase/{kb_id}/wiki/pages": {
- "get": {
- "security": [
- {
- "Bearer": []
- }
+ },
+ "post": {
+ "description": "Create a new data source configuration for a knowledge base",
+ "consumes": [
+ "application/json"
],
- "description": "List wiki pages with optional filtering and pagination",
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "List wiki pages",
+ "summary": "Create a new data source",
"parameters": [
{
- "type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "Filter by page type",
- "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"
+ "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": "Sort order (asc/desc)",
- "name": "sort_order",
- "in": "query"
+ "description": "Sync log ID",
+ "name": "log_id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageListResponse"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog"
}
},
- "400": {
- "description": "Bad Request",
+ "404": {
+ "description": "Not Found",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
- },
- "post": {
- "security": [
- {
- "Bearer": []
- }
+ }
+ },
+ "/datasource/types": {
+ "get": {
+ "description": "Get list of available data source connectors",
+ "produces": [
+ "application/json"
],
- "description": "Create a new wiki page in the knowledge base",
+ "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"
],
@@ -1561,70 +1707,57 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Create a wiki page",
+ "summary": "Test connection with raw credentials (no persistence)",
"parameters": [
{
- "type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
- "in": "path",
- "required": true
- },
- {
- "description": "Wiki page data",
- "name": "page",
+ "description": "type and credentials",
+ "name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "type": "object"
}
}
],
"responses": {
- "201": {
- "description": "Created",
+ "200": {
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"400": {
"description": "Bad Request",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/api/v1/knowledgebase/{kb_id}/wiki/pages/{slug}": {
+ "/datasource/{id}": {
"get": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Retrieve a wiki page by its slug",
+ "description": "Retrieve a data source configuration by ID",
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Get a wiki page by slug",
+ "summary": "Get a data source by ID",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "Page slug",
- "name": "slug",
+ "description": "Data source ID",
+ "name": "id",
"in": "path",
"required": true
}
@@ -1633,24 +1766,22 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
}
},
"404": {
"description": "Not Found",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
},
"put": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Update an existing wiki page by slug",
+ "description": "Update an existing data source configuration",
"consumes": [
"application/json"
],
@@ -1658,31 +1789,24 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Update a wiki page",
+ "summary": "Update a data source",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "Page slug",
- "name": "slug",
+ "description": "Data source ID",
+ "name": "id",
"in": "path",
"required": true
},
{
- "description": "Updated wiki page data",
- "name": "page",
+ "description": "Updated configuration",
+ "name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
}
}
],
@@ -1690,40 +1814,31 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
}
},
- "404": {
- "description": "Not Found",
+ "400": {
+ "description": "Bad Request",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
},
"delete": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Soft-delete a wiki page by slug",
+ "description": "Delete a data source (soft delete)",
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Delete a wiki page",
+ "summary": "Delete a data source",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "Page slug",
- "name": "slug",
+ "description": "Data source ID",
+ "name": "id",
"in": "path",
"required": true
}
@@ -1734,37 +1849,6 @@ const docTemplate = `{
},
"404": {
"description": "Not Found",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
- }
- }
- }
- },
- "/api/v1/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": {
@@ -1775,40 +1859,34 @@ const docTemplate = `{
}
}
},
- "/api/v1/knowledgebase/{kb_id}/wiki/search": {
+ "/datasource/{id}/logs": {
"get": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Full-text search over wiki pages",
+ "description": "Retrieve sync history for a data source",
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Search wiki pages",
+ "summary": "Get sync logs",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "Data source ID",
+ "name": "id",
"in": "path",
"required": true
},
{
- "type": "string",
- "description": "Search query",
- "name": "q",
- "in": "query",
- "required": true
+ "type": "integer",
+ "description": "Limit (default: 10)",
+ "name": "limit",
+ "in": "query"
},
{
"type": "integer",
- "description": "Max results (default 10)",
- "name": "limit",
+ "description": "Offset (default: 0)",
+ "name": "offset",
"in": "query"
}
],
@@ -1818,33 +1896,34 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog"
}
}
- }
- }
- }
- },
- "/api/v1/knowledgebase/{kb_id}/wiki/stats": {
- "get": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Returns aggregate statistics about the wiki",
- "produces": [
- "application/json"
- ],
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "/datasource/{id}/pause": {
+ "post": {
+ "description": "Pause a data source's scheduled syncs",
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Get wiki statistics",
+ "summary": "Pause data source",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "Data source ID",
+ "name": "id",
"in": "path",
"required": true
}
@@ -1853,202 +1932,187 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiStats"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/auth/auto-setup": {
- "post": {
- "description": "Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程",
- "consumes": [
- "application/json"
- ],
+ "/datasource/{id}/resources": {
+ "get": {
+ "description": "List resources available for sync in the external system",
"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
+ }
],
- "summary": "自动初始化(Lite 桌面版)",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Resource"
+ }
}
},
- "403": {
- "description": "非 Lite 版本",
+ "400": {
+ "description": "Bad Request",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/auth/change-password": {
+ "/datasource/{id}/resume": {
"post": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "修改当前用户的登录密码",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "Resume a paused data source",
"tags": [
- "认证"
+ "DataSource"
],
- "summary": "修改密码",
+ "summary": "Resume data source",
"parameters": [
{
- "description": "密码修改请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "type": "object",
- "properties": {
- "new_password": {
- "type": "string"
- },
- "old_password": {
- "type": "string"
- }
- }
- }
+ "type": "string",
+ "description": "Data source ID",
+ "name": "id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
- "description": "修改成功",
+ "description": "OK",
"schema": {
"type": "object",
- "additionalProperties": true
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"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": "认证配置",
+ "description": "Bad Request",
"schema": {
"type": "object",
- "additionalProperties": true
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/auth/login": {
+ "/datasource/{id}/sync": {
"post": {
- "description": "用户登录并获取访问令牌",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "Trigger an immediate sync for a data source",
"tags": [
- "认证"
+ "DataSource"
],
- "summary": "用户登录",
+ "summary": "Trigger immediate sync",
"parameters": [
{
- "description": "登录请求参数",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginRequest"
- }
+ "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.LoginResponse"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog"
}
},
- "401": {
- "description": "认证失败",
+ "400": {
+ "description": "Bad Request",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/auth/logout": {
+ "/datasource/{id}/validate": {
"post": {
- "security": [
+ "description": "Validate the connection to an external data source",
+ "tags": [
+ "DataSource"
+ ],
+ "summary": "Test data source connection",
+ "parameters": [
{
- "Bearer": []
+ "type": "string",
+ "description": "Data source ID",
+ "name": "id",
+ "in": "path",
+ "required": true
}
],
- "description": "撤销当前访问令牌并登出",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "认证"
- ],
- "summary": "用户登出",
"responses": {
"200": {
- "description": "登出成功",
+ "description": "OK",
"schema": {
"type": "object",
- "additionalProperties": true
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"400": {
- "description": "请求参数错误",
+ "description": "Bad Request",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/auth/me": {
+ "/evaluation/": {
"get": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "获取当前登录用户的详细信息",
+ "description": "根据任务ID获取评估结果",
"consumes": [
"application/json"
],
@@ -2056,34 +2120,44 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "认证"
+ "评估"
+ ],
+ "summary": "获取评估结果",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "评估任务ID",
+ "name": "task_id",
+ "in": "query",
+ "required": true
+ }
],
- "summary": "获取当前用户信息",
"responses": {
"200": {
- "description": "用户信息",
+ "description": "评估结果",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "401": {
- "description": "未授权",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/auth/me/preferences": {
- "put": {
+ },
+ "post": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "按 PATCH 语义合并用户偏好(仅覆盖请求体里出现的字段,其余字段保持不变),\n数据存放在 users.preferences (JSON),跨设备/浏览器自动同步。",
+ "description": "对知识库进行评估测试",
"consumes": [
"application/json"
],
@@ -2091,23 +2165,23 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "认证"
+ "评估"
],
- "summary": "更新当前用户的个性化设置",
+ "summary": "执行评估",
"parameters": [
{
- "description": "Preferences patch",
+ "description": "评估请求参数",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.updateMyPreferencesRequest"
+ "$ref": "#/definitions/internal_handler.EvaluationRequest"
}
}
],
"responses": {
"200": {
- "description": "更新后的偏好",
+ "description": "评估任务",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2118,59 +2192,21 @@ const docTemplate = `{
"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": {
+ "/faq/import/progress/{task_id}": {
"get": {
- "description": "接收OIDC provider回调并由后端完成code交换,随后重定向回前端登录页",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "认证"
- ],
- "summary": "OIDC登录重定向回调",
- "parameters": [
- {
- "type": "string",
- "description": "OIDC授权码",
- "name": "code",
- "in": "query"
- },
+ "security": [
{
- "type": "string",
- "description": "OIDC状态",
- "name": "state",
- "in": "query"
+ "Bearer": []
},
{
- "type": "string",
- "description": "OIDC错误码",
- "name": "error",
- "in": "query"
+ "ApiKeyAuth": []
}
],
- "responses": {
- "302": {
- "description": "Found"
- }
- }
- }
- },
- "/auth/oidc/config": {
- "get": {
- "description": "返回OIDC是否启用以及provider展示名称,供前端决定是否展示OIDC登录入口",
+ "description": "获取FAQ导入任务的进度",
"consumes": [
"application/json"
],
@@ -2178,22 +2214,46 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "认证"
+ "FAQ管理"
+ ],
+ "summary": "获取FAQ导入进度",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "任务ID",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取OIDC登录配置",
"responses": {
"200": {
- "description": "OK",
+ "description": "导入进度",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCConfigResponse"
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "404": {
+ "description": "任务不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/auth/oidc/url": {
- "get": {
- "description": "根据后端OIDC配置生成第三方登录跳转地址",
+ "/im-channels/{id}": {
+ "put": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "更新指定 IM 渠道的名称、模式、知识库、凭证或启用状态",
"consumes": [
"application/json"
],
@@ -2201,140 +2261,158 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "认证"
+ "IM 渠道"
],
- "summary": "获取OIDC授权地址",
+ "summary": "更新 IM 渠道",
"parameters": [
{
"type": "string",
- "description": "OIDC回调地址",
- "name": "redirect_uri",
- "in": "query",
+ "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": "OK",
+ "description": "更新后的渠道",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCAuthURLResponse"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
"description": "请求参数错误",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
},
- "403": {
- "description": "OIDC未启用",
+ "404": {
+ "description": "渠道不存在",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
}
}
- }
- },
- "/auth/refresh": {
- "post": {
- "description": "使用刷新令牌获取新的访问令牌",
- "consumes": [
- "application/json"
+ },
+ "delete": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
],
+ "description": "删除指定 IM 渠道",
"produces": [
"application/json"
],
"tags": [
- "认证"
+ "IM 渠道"
],
- "summary": "刷新令牌",
+ "summary": "删除 IM 渠道",
"parameters": [
{
- "description": "刷新令牌",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "type": "object",
- "properties": {
- "refreshToken": {
- "type": "string"
- }
- }
- }
+ "type": "string",
+ "description": "渠道 ID",
+ "name": "id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
- "description": "新令牌",
+ "description": "success: true",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "401": {
- "description": "令牌无效",
+ "400": {
+ "description": "请求参数错误",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "404": {
+ "description": "渠道不存在",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
}
}
}
}
},
- "/auth/register": {
+ "/im-channels/{id}/toggle": {
"post": {
- "description": "注册新用户账号",
- "consumes": [
- "application/json"
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
],
+ "description": "切换指定 IM 渠道的启用状态",
"produces": [
"application/json"
],
"tags": [
- "认证"
+ "IM 渠道"
],
- "summary": "用户注册",
+ "summary": "启用/停用 IM 渠道",
"parameters": [
{
- "description": "注册请求参数",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterRequest"
- }
+ "type": "string",
+ "description": "渠道 ID",
+ "name": "id",
+ "in": "path",
+ "required": true
}
],
"responses": {
- "201": {
- "description": "Created",
+ "200": {
+ "description": "更新后的渠道",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterResponse"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
"description": "请求参数错误",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
},
- "403": {
- "description": "注册功能已禁用",
+ "404": {
+ "description": "渠道不存在",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
}
}
}
},
- "/auth/switch-tenant": {
- "post": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "为当前用户在目标租户重新签发访问令牌;要求该用户在目标租户存在 active 成员关系",
+ "/im/callback/{channel_id}": {
+ "get": {
+ "description": "接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key",
"consumes": [
"application/json"
],
@@ -2342,58 +2420,44 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "认证"
- ],
- "summary": "切换激活租户",
- "parameters": [
- {
- "description": "切换请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "type": "object",
- "properties": {
- "refresh_token": {
- "type": "string"
- },
- "tenant_id": {
- "type": "integer"
- }
- }
- }
+ "IM 回调"
+ ],
+ "summary": "IM 平台回调",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "渠道 ID",
+ "name": "channel_id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "处理结果",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
- "description": "参数错误",
+ "description": "请求参数错误",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
},
- "403": {
- "description": "无该租户成员关系",
+ "401": {
+ "description": "签名校验失败",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
}
}
- }
- },
- "/auth/validate": {
- "get": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "验证访问令牌是否有效",
+ },
+ "post": {
+ "description": "接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key",
"consumes": [
"application/json"
],
@@ -2401,27 +2465,44 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "认证"
+ "IM 回调"
+ ],
+ "summary": "IM 平台回调",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "渠道 ID",
+ "name": "channel_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "验证令牌",
"responses": {
"200": {
- "description": "令牌有效",
+ "description": "处理结果",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "400": {
+ "description": "请求参数错误",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"401": {
- "description": "令牌无效",
+ "description": "签名校验失败",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
}
}
}
},
- "/chunker/preview": {
+ "/initialization/asr/check": {
"post": {
"security": [
{
@@ -2431,7 +2512,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "对提交的文本运行自适应分块器并返回分块预览,不写入数据库不生成 embedding。文本最大 64k 字符",
+ "description": "检查ASR(语音识别)模型连接是否正常,通过发送一段静默音频测试 /v1/audio/transcriptions 端点",
"consumes": [
"application/json"
],
@@ -2439,52 +2520,38 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "分块"
+ "初始化"
],
- "summary": "预览分块结果",
+ "summary": "检查ASR模型",
"parameters": [
{
- "description": "{text, chunking_config}",
+ "description": "ASR检查请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.PreviewChunkingRequest"
+ "$ref": "#/definitions/internal_handler.ModelTestRequest"
}
}
],
"responses": {
"200": {
- "description": "分块结果",
- "schema": {
- "$ref": "#/definitions/internal_handler.PreviewChunkingResponse"
- }
- },
- "400": {
- "description": "请求参数错误",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "413": {
- "description": "文本超过预览限制",
+ "description": "检查结果",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "504": {
- "description": "分块超时",
+ "400": {
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/chunks/by-id/{id}": {
+ "/initialization/config/{kbId}": {
"get": {
"security": [
{
@@ -2494,7 +2561,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "仅通过分块ID获取分块详情(不需要knowledge_id);支持共享知识库下的分块访问",
+ "description": "根据知识库ID获取当前配置信息",
"consumes": [
"application/json"
],
@@ -2502,43 +2569,35 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "分块管理"
+ "初始化"
],
- "summary": "通过ID获取分块",
+ "summary": "获取知识库配置",
"parameters": [
{
"type": "string",
- "description": "分块ID",
- "name": "id",
+ "description": "知识库ID",
+ "name": "kbId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "分块详情",
+ "description": "配置信息",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
- },
"404": {
- "description": "分块不存在",
+ "description": "知识库不存在",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/chunks/by-id/{id}/questions": {
- "delete": {
+ },
+ "put": {
"security": [
{
"Bearer": []
@@ -2547,7 +2606,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "删除分块中生成的问题",
+ "description": "根据知识库ID更新模型和分块配置",
"consumes": [
"application/json"
],
@@ -2555,35 +2614,30 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "分块管理"
+ "初始化"
],
- "summary": "删除生成的问题",
+ "summary": "更新知识库配置",
"parameters": [
{
"type": "string",
- "description": "分块ID",
- "name": "id",
+ "description": "知识库ID",
+ "name": "kbId",
"in": "path",
"required": true
},
{
- "description": "问题ID",
+ "description": "配置请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "type": "object",
- "properties": {
- "question_id": {
- "type": "string"
- }
- }
+ "$ref": "#/definitions/internal_handler.KBModelConfigRequest"
}
}
],
"responses": {
"200": {
- "description": "删除成功",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2596,7 +2650,7 @@ const docTemplate = `{
}
},
"404": {
- "description": "分块不存在",
+ "description": "知识库不存在",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -2604,8 +2658,8 @@ const docTemplate = `{
}
}
},
- "/chunks/{knowledge_id}": {
- "get": {
+ "/initialization/embedding/test": {
+ "post": {
"security": [
{
"Bearer": []
@@ -2614,7 +2668,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "获取指定知识下的所有分块列表,支持分页",
+ "description": "测试Embedding接口是否可用并返回向量维度",
"consumes": [
"application/json"
],
@@ -2622,35 +2676,23 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "分块管理"
+ "初始化"
],
- "summary": "获取知识分块列表",
+ "summary": "测试Embedding模型",
"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"
+ "description": "Embedding测试请求",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/internal_handler.ModelTestRequest"
+ }
}
],
"responses": {
"200": {
- "description": "分块列表",
+ "description": "测试结果",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2663,17 +2705,11 @@ const docTemplate = `{
}
}
}
- },
- "delete": {
- "security": [
- {
- "Bearer": []
- },
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "删除指定知识下的所有分块",
+ }
+ },
+ "/initialization/extract/fabri-tag": {
+ "post": {
+ "description": "随机生成一组标签",
"consumes": [
"application/json"
],
@@ -2681,37 +2717,22 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "分块管理"
- ],
- "summary": "删除知识下所有分块",
- "parameters": [
- {
- "type": "string",
- "description": "知识ID",
- "name": "knowledge_id",
- "in": "path",
- "required": true
- }
+ "初始化"
],
+ "summary": "生成随机标签",
"responses": {
"200": {
- "description": "删除成功",
+ "description": "生成的标签",
"schema": {
"type": "object",
"additionalProperties": true
}
- },
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
}
}
}
},
- "/chunks/{knowledge_id}/{id}": {
- "put": {
+ "/initialization/extract/fabri-text": {
+ "post": {
"security": [
{
"Bearer": []
@@ -2720,7 +2741,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "更新指定分块的内容和属性",
+ "description": "根据标签生成示例文本",
"consumes": [
"application/json"
],
@@ -2728,37 +2749,23 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "分块管理"
+ "初始化"
],
- "summary": "更新分块",
+ "summary": "生成示例文本",
"parameters": [
{
- "type": "string",
- "description": "知识ID",
- "name": "knowledge_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "分块ID",
- "name": "id",
- "in": "path",
- "required": true
- },
- {
- "description": "更新请求",
+ "description": "生成请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.UpdateChunkRequest"
+ "$ref": "#/definitions/internal_handler.FabriTextRequest"
}
}
],
"responses": {
"200": {
- "description": "更新后的分块",
+ "description": "生成的文本",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2769,16 +2776,12 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- },
- "404": {
- "description": "分块不存在",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
}
}
- },
- "delete": {
+ }
+ },
+ "/initialization/extract/text-relation": {
+ "post": {
"security": [
{
"Bearer": []
@@ -2787,7 +2790,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "删除指定的分块",
+ "description": "从文本中提取实体和关系",
"consumes": [
"application/json"
],
@@ -2795,28 +2798,23 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "分块管理"
+ "初始化"
],
- "summary": "删除分块",
+ "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.TextRelationExtractionRequest"
+ }
}
],
"responses": {
"200": {
- "description": "删除成功",
+ "description": "提取结果",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2827,18 +2825,12 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- },
- "404": {
- "description": "分块不存在",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
}
}
}
},
- "/evaluation/": {
- "get": {
+ "/initialization/initialize/{kbId}": {
+ "post": {
"security": [
{
"Bearer": []
@@ -2847,7 +2839,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "根据任务ID获取评估结果",
+ "description": "根据知识库ID执行完整配置更新",
"consumes": [
"application/json"
],
@@ -2855,21 +2847,30 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "评估"
+ "初始化"
],
- "summary": "获取评估结果",
+ "summary": "初始化知识库配置",
"parameters": [
{
"type": "string",
- "description": "评估任务ID",
- "name": "task_id",
- "in": "query",
+ "description": "知识库ID",
+ "name": "kbId",
+ "in": "path",
"required": true
+ },
+ {
+ "description": "初始化请求",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/internal_handler.InitializationRequest"
+ }
}
],
"responses": {
"200": {
- "description": "评估结果",
+ "description": "初始化成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2882,7 +2883,9 @@ const docTemplate = `{
}
}
}
- },
+ }
+ },
+ "/initialization/multimodal/test": {
"post": {
"security": [
{
@@ -2892,31 +2895,62 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "对知识库进行评估测试",
+ "description": "上传图片测试多模态处理功能",
"consumes": [
- "application/json"
+ "multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
- "评估"
+ "初始化"
],
- "summary": "执行评估",
+ "summary": "测试多模态功能",
"parameters": [
{
- "description": "评估请求参数",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.EvaluationRequest"
- }
+ "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": "评估任务",
+ "description": "测试结果",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2931,7 +2965,7 @@ const docTemplate = `{
}
}
},
- "/faq/import/progress/{task_id}": {
+ "/initialization/ollama/download/progress/{taskId}": {
"get": {
"security": [
{
@@ -2941,7 +2975,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "获取FAQ导入任务的进度",
+ "description": "获取Ollama模型下载任务的进度",
"consumes": [
"application/json"
],
@@ -2949,21 +2983,21 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "FAQ管理"
+ "初始化"
],
- "summary": "获取FAQ导入进度",
+ "summary": "获取下载进度",
"parameters": [
{
"type": "string",
"description": "任务ID",
- "name": "task_id",
+ "name": "taskId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "导入进度",
+ "description": "下载进度",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2978,8 +3012,8 @@ const docTemplate = `{
}
}
},
- "/im-channels/{id}": {
- "put": {
+ "/initialization/ollama/download/tasks": {
+ "get": {
"security": [
{
"Bearer": []
@@ -2988,7 +3022,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "更新指定 IM 渠道的名称、模式、知识库、凭证或启用状态",
+ "description": "列出所有Ollama模型下载任务",
"consumes": [
"application/json"
],
@@ -2996,53 +3030,60 @@ const docTemplate = `{
"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,
+ "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
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "模型列表",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "404": {
- "description": "渠道不存在",
+ "500": {
+ "description": "服务器错误",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/initialization/ollama/models/check": {
+ "post": {
"security": [
{
"Bearer": []
@@ -3051,26 +3092,39 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "删除指定 IM 渠道",
+ "description": "检查指定的Ollama模型是否已安装",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "IM 渠道"
+ "初始化"
],
- "summary": "删除 IM 渠道",
+ "summary": "检查Ollama模型状态",
"parameters": [
{
- "type": "string",
- "description": "渠道 ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "模型名称列表",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "models": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
}
],
"responses": {
"200": {
- "description": "success: true",
+ "description": "模型状态",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3079,21 +3133,13 @@ const docTemplate = `{
"400": {
"description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "404": {
- "description": "渠道不存在",
- "schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/im-channels/{id}/toggle": {
+ "/initialization/ollama/models/download": {
"post": {
"security": [
{
@@ -3103,26 +3149,36 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "切换指定 IM 渠道的启用状态",
+ "description": "异步下载指定的Ollama模型",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "IM 渠道"
+ "初始化"
],
- "summary": "启用/停用 IM 渠道",
+ "summary": "下载Ollama模型",
"parameters": [
{
- "type": "string",
- "description": "渠道 ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "模型名称",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "modelName": {
+ "type": "string"
+ }
+ }
+ }
}
],
"responses": {
"200": {
- "description": "更新后的渠道",
+ "description": "下载任务信息",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3131,23 +3187,15 @@ const docTemplate = `{
"400": {
"description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "404": {
- "description": "渠道不存在",
- "schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/im/callback/{channel_id}": {
+ "/initialization/ollama/status": {
"get": {
- "description": "接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key",
+ "description": "检查Ollama服务是否可用",
"consumes": [
"application/json"
],
@@ -3155,44 +3203,31 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "IM 回调"
- ],
- "summary": "IM 平台回调",
- "parameters": [
- {
- "type": "string",
- "description": "渠道 ID",
- "name": "channel_id",
- "in": "path",
- "required": true
- }
+ "初始化"
],
+ "summary": "检查Ollama服务状态",
"responses": {
"200": {
- "description": "处理结果",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "401": {
- "description": "签名校验失败",
+ "description": "Ollama状态",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
- },
+ }
+ },
+ "/initialization/remote/check": {
"post": {
- "description": "接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key",
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "检查远程API模型连接是否正常",
"consumes": [
"application/json"
],
@@ -3200,21 +3235,23 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "IM 回调"
+ "初始化"
],
- "summary": "IM 平台回调",
+ "summary": "检查远程模型",
"parameters": [
{
- "type": "string",
- "description": "渠道 ID",
- "name": "channel_id",
- "in": "path",
- "required": true
+ "description": "模型检查请求",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/internal_handler.RemoteModelCheckRequest"
+ }
}
],
"responses": {
"200": {
- "description": "处理结果",
+ "description": "检查结果",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3223,21 +3260,13 @@ const docTemplate = `{
"400": {
"description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "401": {
- "description": "签名校验失败",
- "schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/initialization/asr/check": {
+ "/initialization/rerank/check": {
"post": {
"security": [
{
@@ -3247,7 +3276,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "检查ASR(语音识别)模型连接是否正常,通过发送一段静默音频测试 /v1/audio/transcriptions 端点",
+ "description": "检查Rerank模型连接和功能是否正常",
"consumes": [
"application/json"
],
@@ -3257,10 +3286,10 @@ const docTemplate = `{
"tags": [
"初始化"
],
- "summary": "检查ASR模型",
+ "summary": "检查Rerank模型",
"parameters": [
{
- "description": "ASR检查请求",
+ "description": "Rerank检查请求",
"name": "request",
"in": "body",
"required": true,
@@ -3286,7 +3315,7 @@ const docTemplate = `{
}
}
},
- "/initialization/config/{kbId}": {
+ "/knowledge-bases": {
"get": {
"security": [
{
@@ -3296,7 +3325,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "根据知识库ID获取当前配置信息",
+ "description": "获取当前租户的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及)",
"consumes": [
"application/json"
],
@@ -3304,35 +3333,34 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "获取知识库配置",
+ "summary": "获取知识库列表",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
- "name": "kbId",
- "in": "path",
- "required": true
+ "description": "共享智能体 ID(传入时返回该智能体可用的知识库)",
+ "name": "agent_id",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "配置信息",
+ "description": "知识库列表",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "404": {
- "description": "知识库不存在",
+ "500": {
+ "description": "服务器错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
},
- "put": {
+ "post": {
"security": [
{
"Bearer": []
@@ -3341,7 +3369,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "根据知识库ID更新模型和分块配置",
+ "description": "创建新的知识库",
"consumes": [
"application/json"
],
@@ -3349,30 +3377,23 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "更新知识库配置",
+ "summary": "创建知识库",
"parameters": [
{
- "type": "string",
- "description": "知识库ID",
- "name": "kbId",
- "in": "path",
- "required": true
- },
- {
- "description": "配置请求",
+ "description": "知识库信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.KBModelConfigRequest"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBase"
}
}
],
"responses": {
- "200": {
- "description": "更新成功",
+ "201": {
+ "description": "创建的知识库",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3383,17 +3404,11 @@ const docTemplate = `{
"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": {
+ "/knowledge-bases/copy": {
"post": {
"security": [
{
@@ -3403,7 +3418,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "测试Embedding接口是否可用并返回向量维度",
+ "description": "将一个知识库的内容复制到另一个知识库(异步任务)",
"consumes": [
"application/json"
],
@@ -3411,23 +3426,23 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "测试Embedding模型",
+ "summary": "复制知识库",
"parameters": [
{
- "description": "Embedding测试请求",
+ "description": "复制请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.ModelTestRequest"
+ "$ref": "#/definitions/internal_handler.CopyKnowledgeBaseRequest"
}
}
],
"responses": {
"200": {
- "description": "测试结果",
+ "description": "任务ID",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3442,9 +3457,17 @@ const docTemplate = `{
}
}
},
- "/initialization/extract/fabri-tag": {
- "post": {
- "description": "随机生成一组标签",
+ "/knowledge-bases/copy/progress/{task_id}": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "获取知识库复制任务的进度",
"consumes": [
"application/json"
],
@@ -3452,22 +3475,37 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
+ ],
+ "summary": "获取知识库复制进度",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "任务ID",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "生成随机标签",
"responses": {
"200": {
- "description": "生成的标签",
+ "description": "进度信息",
"schema": {
"type": "object",
"additionalProperties": true
}
+ },
+ "404": {
+ "description": "任务不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
}
},
- "/initialization/extract/fabri-text": {
- "post": {
+ "/knowledge-bases/{id}": {
+ "get": {
"security": [
{
"Bearer": []
@@ -3476,7 +3514,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "根据标签生成示例文本",
+ "description": "根据ID获取知识库详情。当使用共享智能体时,可传 agent_id 以校验该智能体是否有权访问该知识库。",
"consumes": [
"application/json"
],
@@ -3484,23 +3522,27 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "生成示例文本",
+ "summary": "获取知识库详情",
"parameters": [
{
- "description": "生成请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.FabriTextRequest"
- }
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "共享智能体 ID(用于校验智能体是否有权访问该知识库)",
+ "name": "agent_id",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "生成的文本",
+ "description": "知识库详情",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3511,12 +3553,16 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "404": {
+ "description": "知识库不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
- }
- },
- "/initialization/extract/text-relation": {
- "post": {
+ },
+ "put": {
"security": [
{
"Bearer": []
@@ -3525,7 +3571,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "从文本中提取实体和关系",
+ "description": "更新知识库的名称、描述和配置",
"consumes": [
"application/json"
],
@@ -3533,23 +3579,30 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "提取文本关系",
+ "summary": "更新知识库",
"parameters": [
{
- "description": "提取请求",
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "更新请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.TextRelationExtractionRequest"
+ "$ref": "#/definitions/internal_handler.UpdateKnowledgeBaseRequest"
}
}
],
"responses": {
"200": {
- "description": "提取结果",
+ "description": "更新后的知识库",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3562,10 +3615,8 @@ const docTemplate = `{
}
}
}
- }
- },
- "/initialization/initialize/{kbId}": {
- "post": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
@@ -3574,7 +3625,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "根据知识库ID执行完整配置更新",
+ "description": "删除指定的知识库及其所有内容",
"consumes": [
"application/json"
],
@@ -3582,30 +3633,21 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "初始化知识库配置",
+ "summary": "删除知识库",
"parameters": [
{
"type": "string",
"description": "知识库ID",
- "name": "kbId",
+ "name": "id",
"in": "path",
"required": true
- },
- {
- "description": "初始化请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.InitializationRequest"
- }
}
],
"responses": {
"200": {
- "description": "初始化成功",
+ "description": "删除成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3620,8 +3662,8 @@ const docTemplate = `{
}
}
},
- "/initialization/multimodal/test": {
- "post": {
+ "/knowledge-bases/{id}/faq/entries": {
+ "get": {
"security": [
{
"Bearer": []
@@ -3630,62 +3672,65 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "上传图片测试多模态处理功能",
+ "description": "获取知识库下的FAQ条目列表,支持分页和筛选",
"consumes": [
- "multipart/form-data"
+ "application/json"
],
"produces": [
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "测试多模态功能",
+ "summary": "获取FAQ条目列表",
"parameters": [
{
- "type": "file",
- "description": "测试图片",
- "name": "image",
- "in": "formData",
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
"required": true
},
{
- "type": "string",
- "description": "VLM模型名称",
- "name": "vlm_model",
- "in": "formData",
- "required": true
+ "type": "integer",
+ "description": "页码",
+ "name": "page",
+ "in": "query"
},
{
- "type": "string",
- "description": "VLM Base URL",
- "name": "vlm_base_url",
- "in": "formData",
- "required": true
+ "type": "integer",
+ "description": "每页数量",
+ "name": "page_size",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "标签ID筛选(seq_id)",
+ "name": "tag_id",
+ "in": "query"
},
{
"type": "string",
- "description": "VLM API Key",
- "name": "vlm_api_key",
- "in": "formData"
+ "description": "关键词搜索",
+ "name": "keyword",
+ "in": "query"
},
{
"type": "string",
- "description": "VLM接口类型",
- "name": "vlm_interface_type",
- "in": "formData"
+ "description": "搜索字段: standard_question(标准问题), similar_questions(相似问法), answers(答案), 默认搜索全部",
+ "name": "search_field",
+ "in": "query"
},
{
"type": "string",
- "description": "存储类型(cos/minio)",
- "name": "storage_type",
- "in": "formData",
- "required": true
+ "description": "排序方式: asc(按更新时间正序), 默认按更新时间倒序",
+ "name": "sort_order",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "测试结果",
+ "description": "FAQ列表",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3698,10 +3743,8 @@ const docTemplate = `{
}
}
}
- }
- },
- "/initialization/ollama/download/progress/{taskId}": {
- "get": {
+ },
+ "post": {
"security": [
{
"Bearer": []
@@ -3710,7 +3753,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "获取Ollama模型下载任务的进度",
+ "description": "异步批量更新或插入FAQ条目。支持 dry_run 模式(设置 dry_run=true),异步验证不实际导入。\ndry_run 模式是异步操作,返回 task_id,通过 /faq/import/progress/{task_id} 查询进度和结果。\n验证内容包括:1) 条目基本格式 2) 重复问题(批次内和知识库已有) 3) 内容安全检查。",
"consumes": [
"application/json"
],
@@ -3718,37 +3761,44 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "获取下载进度",
+ "summary": "批量更新/插入FAQ条目",
"parameters": [
{
"type": "string",
- "description": "任务ID",
- "name": "taskId",
+ "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": "下载进度",
+ "description": "任务ID",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "404": {
- "description": "任务不存在",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/initialization/ollama/download/tasks": {
- "get": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
@@ -3757,7 +3807,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "列出所有Ollama模型下载任务",
+ "description": "批量删除指定的FAQ条目",
"consumes": [
"application/json"
],
@@ -3765,21 +3815,53 @@ const docTemplate = `{
"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"
+ }
+ }
+ }
+ }
+ }
],
- "summary": "列出下载任务",
"responses": {
"200": {
- "description": "任务列表",
+ "description": "删除成功",
"schema": {
"type": "object",
"additionalProperties": true
}
+ },
+ "400": {
+ "description": "请求参数错误",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
}
},
- "/initialization/ollama/models": {
+ "/knowledge-bases/{id}/faq/entries/export": {
"get": {
"security": [
{
@@ -3789,27 +3871,35 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "列出已安装的Ollama模型",
+ "description": "将所有FAQ条目导出为CSV文件",
"consumes": [
"application/json"
],
"produces": [
- "application/json"
+ "text/csv"
],
"tags": [
- "初始化"
+ "FAQ管理"
+ ],
+ "summary": "导出FAQ条目",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "列出Ollama模型",
"responses": {
"200": {
- "description": "模型列表",
+ "description": "CSV文件",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "type": "file"
}
},
- "500": {
- "description": "服务器错误",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -3817,8 +3907,8 @@ const docTemplate = `{
}
}
},
- "/initialization/ollama/models/check": {
- "post": {
+ "/knowledge-bases/{id}/faq/entries/fields": {
+ "put": {
"security": [
{
"Bearer": []
@@ -3827,7 +3917,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "检查指定的Ollama模型是否已安装",
+ "description": "批量更新FAQ条目的多个字段(is_enabled, is_recommended, tag_id)",
"consumes": [
"application/json"
],
@@ -3835,31 +3925,30 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "检查Ollama模型状态",
+ "summary": "批量更新FAQ字段",
"parameters": [
{
- "description": "模型名称列表",
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "字段更新请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "type": "object",
- "properties": {
- "models": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryFieldsBatchUpdate"
}
}
],
"responses": {
"200": {
- "description": "模型状态",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3874,8 +3963,8 @@ const docTemplate = `{
}
}
},
- "/initialization/ollama/models/download": {
- "post": {
+ "/knowledge-bases/{id}/faq/entries/tags": {
+ "put": {
"security": [
{
"Bearer": []
@@ -3884,7 +3973,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "异步下载指定的Ollama模型",
+ "description": "批量更新FAQ条目的标签",
"consumes": [
"application/json"
],
@@ -3892,28 +3981,30 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "下载Ollama模型",
+ "summary": "批量更新FAQ标签",
"parameters": [
{
- "description": "模型名称",
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "标签更新请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "type": "object",
- "properties": {
- "modelName": {
- "type": "string"
- }
- }
+ "type": "object"
}
}
],
"responses": {
"200": {
- "description": "下载任务信息",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3928,32 +4019,8 @@ const docTemplate = `{
}
}
},
- "/initialization/ollama/status": {
+ "/knowledge-bases/{id}/faq/entries/{entry_id}": {
"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": []
@@ -3962,7 +4029,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "检查远程API模型连接是否正常",
+ "description": "根据ID获取单个FAQ条目的详情",
"consumes": [
"application/json"
],
@@ -3970,23 +4037,28 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "检查远程模型",
+ "summary": "获取FAQ条目详情",
"parameters": [
{
- "description": "模型检查请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.RemoteModelCheckRequest"
- }
+ "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": "检查结果",
+ "description": "FAQ条目详情",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3997,12 +4069,16 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "404": {
+ "description": "条目不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
- }
- },
- "/initialization/rerank/check": {
- "post": {
+ },
+ "put": {
"security": [
{
"Bearer": []
@@ -4011,7 +4087,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "检查Rerank模型连接和功能是否正常",
+ "description": "更新指定的FAQ条目",
"consumes": [
"application/json"
],
@@ -4019,23 +4095,37 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "检查Rerank模型",
+ "summary": "更新FAQ条目",
"parameters": [
{
- "description": "Rerank检查请求",
+ "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/internal_handler.ModelTestRequest"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload"
}
}
],
"responses": {
"200": {
- "description": "检查结果",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4050,8 +4140,8 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases": {
- "get": {
+ "/knowledge-bases/{id}/faq/entries/{entry_id}/similar-questions": {
+ "post": {
"security": [
{
"Bearer": []
@@ -4060,7 +4150,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "获取当前租户的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及)",
+ "description": "向指定的FAQ条目添加相似问题",
"consumes": [
"application/json"
],
@@ -4068,33 +4158,58 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识库"
+ "FAQ管理"
],
- "summary": "获取知识库列表",
+ "summary": "添加相似问",
"parameters": [
{
"type": "string",
- "description": "共享智能体 ID(传入时返回该智能体可用的知识库)",
- "name": "agent_id",
- "in": "query"
+ "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": "知识库列表",
+ "description": "更新后的FAQ条目",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "500": {
- "description": "服务器错误",
+ "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": [
{
@@ -4104,7 +4219,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "创建新的知识库",
+ "description": "同步创建单个FAQ条目",
"consumes": [
"application/json"
],
@@ -4112,23 +4227,30 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识库"
+ "FAQ管理"
],
- "summary": "创建知识库",
+ "summary": "创建单个FAQ条目",
"parameters": [
{
- "description": "知识库信息",
+ "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.KnowledgeBase"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload"
}
}
],
"responses": {
- "201": {
- "description": "创建的知识库",
+ "200": {
+ "description": "创建的FAQ条目",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4143,8 +4265,8 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases/copy": {
- "post": {
+ "/knowledge-bases/{id}/faq/import/last-result/display": {
+ "put": {
"security": [
{
"Bearer": []
@@ -4153,7 +4275,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "将一个知识库的内容复制到另一个知识库(异步任务)",
+ "description": "更新FAQ知识库导入结果统计卡片的显示或隐藏状态",
"consumes": [
"application/json"
],
@@ -4161,23 +4283,30 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识库"
+ "FAQ管理"
],
- "summary": "复制知识库",
+ "summary": "更新FAQ最后一次导入结果显示状态",
"parameters": [
{
- "description": "复制请求",
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "状态更新请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.CopyKnowledgeBaseRequest"
+ "$ref": "#/definitions/internal_handler.updateLastFAQImportResultDisplayStatusRequest"
}
}
],
"responses": {
"200": {
- "description": "任务ID",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4188,12 +4317,18 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "404": {
+ "description": "知识库不存在或无导入记录",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
}
},
- "/knowledge-bases/copy/progress/{task_id}": {
- "get": {
+ "/knowledge-bases/{id}/faq/search": {
+ "post": {
"security": [
{
"Bearer": []
@@ -4202,7 +4337,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "获取知识库复制任务的进度",
+ "description": "使用混合搜索在FAQ中搜索,支持两级优先级标签召回:first_priority_tag_ids优先级最高,second_priority_tag_ids次之",
"consumes": [
"application/json"
],
@@ -4210,28 +4345,37 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识库"
+ "FAQ管理"
],
- "summary": "获取知识库复制进度",
+ "summary": "搜索FAQ",
"parameters": [
{
"type": "string",
- "description": "任务ID",
- "name": "task_id",
+ "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": "进度信息",
+ "description": "搜索结果",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "404": {
- "description": "任务不存在",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -4239,7 +4383,7 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases/{id}": {
+ "/knowledge-bases/{id}/hybrid-search": {
"get": {
"security": [
{
@@ -4249,7 +4393,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "根据ID获取知识库详情。当使用共享智能体时,可传 agent_id 以校验该智能体是否有权访问该知识库。",
+ "description": "在知识库中执行向量和关键词混合搜索",
"consumes": [
"application/json"
],
@@ -4259,7 +4403,7 @@ const docTemplate = `{
"tags": [
"知识库"
],
- "summary": "获取知识库详情",
+ "summary": "混合搜索",
"parameters": [
{
"type": "string",
@@ -4267,17 +4411,20 @@ const docTemplate = `{
"name": "id",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "共享智能体 ID(用于校验智能体是否有权访问该知识库)",
- "name": "agent_id",
- "in": "query"
+ },
+ {
+ "description": "搜索参数",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SearchParams"
+ }
}
],
"responses": {
"200": {
- "description": "知识库详情",
+ "description": "搜索结果",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4288,16 +4435,12 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- },
- "404": {
- "description": "知识库不存在",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
}
}
- },
- "put": {
+ }
+ },
+ "/knowledge-bases/{id}/knowledge": {
+ "get": {
"security": [
{
"Bearer": []
@@ -4306,7 +4449,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "更新知识库的名称、描述和配置",
+ "description": "获取知识库下的知识列表,支持分页和筛选",
"consumes": [
"application/json"
],
@@ -4314,9 +4457,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识库"
+ "知识管理"
],
- "summary": "更新知识库",
+ "summary": "获取知识列表",
"parameters": [
{
"type": "string",
@@ -4326,18 +4469,63 @@ const docTemplate = `{
"required": true
},
{
- "description": "更新请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.UpdateKnowledgeBaseRequest"
- }
+ "type": "integer",
+ "description": "页码",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "每页数量",
+ "name": "page_size",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "标签ID筛选",
+ "name": "tag_id",
+ "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": "更新后的知识库",
+ "description": "知识列表",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4360,7 +4548,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "删除指定的知识库及其所有内容",
+ "description": "删除知识库下的所有知识条目(异步任务)。知识库本身保留,仅清空其中的内容",
"consumes": [
"application/json"
],
@@ -4368,9 +4556,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识库"
+ "知识管理"
],
- "summary": "删除知识库",
+ "summary": "清空知识库内容",
"parameters": [
{
"type": "string",
@@ -4382,7 +4570,7 @@ const docTemplate = `{
],
"responses": {
"200": {
- "description": "删除成功",
+ "description": "清空任务已提交",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4393,12 +4581,18 @@ const docTemplate = `{
"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}/faq/entries": {
- "get": {
+ "/knowledge-bases/{id}/knowledge/file": {
+ "post": {
"security": [
{
"Bearer": []
@@ -4407,17 +4601,17 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "获取知识库下的FAQ条目列表,支持分页和筛选",
+ "description": "上传文件并创建知识条目",
"consumes": [
- "application/json"
+ "multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识管理"
],
- "summary": "获取FAQ条目列表",
+ "summary": "从文件创建知识",
"parameters": [
{
"type": "string",
@@ -4427,45 +4621,34 @@ const docTemplate = `{
"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": "file",
+ "description": "上传的文件",
+ "name": "file",
+ "in": "formData",
+ "required": true
},
{
"type": "string",
- "description": "关键词搜索",
- "name": "keyword",
- "in": "query"
+ "description": "自定义文件名",
+ "name": "fileName",
+ "in": "formData"
},
{
"type": "string",
- "description": "搜索字段: standard_question(标准问题), similar_questions(相似问法), answers(答案), 默认搜索全部",
- "name": "search_field",
- "in": "query"
+ "description": "元数据JSON",
+ "name": "metadata",
+ "in": "formData"
},
{
- "type": "string",
- "description": "排序方式: asc(按更新时间正序), 默认按更新时间倒序",
- "name": "sort_order",
- "in": "query"
+ "type": "boolean",
+ "description": "启用多模态处理",
+ "name": "enable_multimodel",
+ "in": "formData"
}
],
"responses": {
"200": {
- "description": "FAQ列表",
+ "description": "创建的知识",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4476,9 +4659,18 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "409": {
+ "description": "文件重复",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
}
}
- },
+ }
+ },
+ "/knowledge-bases/{id}/knowledge/manual": {
"post": {
"security": [
{
@@ -4488,7 +4680,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "异步批量更新或插入FAQ条目。支持 dry_run 模式(设置 dry_run=true),异步验证不实际导入。\ndry_run 模式是异步操作,返回 task_id,通过 /faq/import/progress/{task_id} 查询进度和结果。\n验证内容包括:1) 条目基本格式 2) 重复问题(批次内和知识库已有) 3) 内容安全检查。",
+ "description": "手工录入Markdown格式的知识内容",
"consumes": [
"application/json"
],
@@ -4496,9 +4688,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识管理"
],
- "summary": "批量更新/插入FAQ条目",
+ "summary": "手工创建知识",
"parameters": [
{
"type": "string",
@@ -4508,18 +4700,18 @@ const docTemplate = `{
"required": true
},
{
- "description": "批量操作请求",
+ "description": "手工知识内容",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQBatchUpsertPayload"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ManualKnowledgePayload"
}
}
],
"responses": {
"200": {
- "description": "任务ID",
+ "description": "创建的知识",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4532,8 +4724,10 @@ const docTemplate = `{
}
}
}
- },
- "delete": {
+ }
+ },
+ "/knowledge-bases/{id}/knowledge/url": {
+ "post": {
"security": [
{
"Bearer": []
@@ -4542,7 +4736,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "批量删除指定的FAQ条目",
+ "description": "从指定URL抓取内容并创建知识条目。当提供 file_name/file_type 或 URL 路径含已知文件扩展名时,自动切换为文件下载模式",
"consumes": [
"application/json"
],
@@ -4550,9 +4744,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识管理"
],
- "summary": "批量删除FAQ条目",
+ "summary": "从URL创建知识",
"parameters": [
{
"type": "string",
@@ -4562,26 +4756,38 @@ const docTemplate = `{
"required": true
},
{
- "description": "要删除的FAQ ID列表(seq_id)",
+ "description": "URL请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
- "ids": {
- "type": "array",
- "items": {
- "type": "integer"
- }
+ "enable_multimodel": {
+ "type": "boolean"
+ },
+ "file_name": {
+ "type": "string"
+ },
+ "file_type": {
+ "type": "string"
+ },
+ "tag_id": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string"
}
}
}
}
],
"responses": {
- "200": {
- "description": "删除成功",
+ "201": {
+ "description": "创建的知识",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4592,11 +4798,18 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "409": {
+ "description": "URL重复",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
}
}
}
},
- "/knowledge-bases/{id}/faq/entries/export": {
+ "/knowledge-bases/{id}/move-targets": {
"get": {
"security": [
{
@@ -4606,21 +4819,18 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "将所有FAQ条目导出为CSV文件",
- "consumes": [
- "application/json"
- ],
+ "description": "返回与源知识库 Type 一致、EmbeddingModelID 一致、非临时且不是自身的目标知识库列表",
"produces": [
- "text/csv"
+ "application/json"
],
"tags": [
- "FAQ管理"
+ "知识库"
],
- "summary": "导出FAQ条目",
+ "summary": "获取可移动目标知识库列表",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "description": "源知识库 ID",
"name": "id",
"in": "path",
"required": true
@@ -4628,9 +4838,10 @@ const docTemplate = `{
],
"responses": {
"200": {
- "description": "CSV文件",
+ "description": "可移动目标列表",
"schema": {
- "type": "file"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
@@ -4638,11 +4849,17 @@ const docTemplate = `{
"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/entries/fields": {
+ "/knowledge-bases/{id}/pin": {
"put": {
"security": [
{
@@ -4652,7 +4869,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "批量更新FAQ条目的多个字段(is_enabled, is_recommended, tag_id)",
+ "description": "切换知识库的置顶状态",
"consumes": [
"application/json"
],
@@ -4660,9 +4877,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识库"
],
- "summary": "批量更新FAQ字段",
+ "summary": "置顶/取消置顶知识库",
"parameters": [
{
"type": "string",
@@ -4670,27 +4887,18 @@ const docTemplate = `{
"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": "更新成功",
+ "description": "更新后的知识库",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "400": {
- "description": "请求参数错误",
+ "404": {
+ "description": "知识库不存在",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -4698,27 +4906,21 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases/{id}/faq/entries/tags": {
- "put": {
+ "/knowledge-bases/{id}/shares": {
+ "get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "批量更新FAQ条目的标签",
- "consumes": [
- "application/json"
- ],
+ "description": "获取知识库的所有共享记录",
"produces": [
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识库共享"
],
- "summary": "批量更新FAQ标签",
+ "summary": "获取知识库的共享列表",
"parameters": [
{
"type": "string",
@@ -4726,45 +4928,24 @@ const docTemplate = `{
"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": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ListSharesResponse"
}
}
}
- }
- },
- "/knowledge-bases/{id}/faq/entries/{entry_id}": {
- "get": {
+ },
+ "post": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "根据ID获取单个FAQ条目的详情",
+ "description": "将知识库共享到指定组织",
"consumes": [
"application/json"
],
@@ -4772,9 +4953,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识库共享"
],
- "summary": "获取FAQ条目详情",
+ "summary": "共享知识库到组织",
"parameters": [
{
"type": "string",
@@ -4784,45 +4965,40 @@ const docTemplate = `{
"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/github_com_Tencent_WeKnora_internal_types.ShareKnowledgeBaseRequest"
+ }
}
],
"responses": {
- "200": {
- "description": "FAQ条目详情",
+ "201": {
+ "description": "Created",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
- },
- "404": {
- "description": "条目不存在",
+ "403": {
+ "description": "Forbidden",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- },
+ }
+ },
+ "/knowledge-bases/{id}/shares/{share_id}": {
"put": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "更新指定的FAQ条目",
+ "description": "更新知识库共享的权限级别",
"consumes": [
"application/json"
],
@@ -4830,9 +5006,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识库共享"
],
- "summary": "更新FAQ条目",
+ "summary": "更新共享权限",
"parameters": [
{
"type": "string",
@@ -4842,60 +5018,49 @@ const docTemplate = `{
"required": true
},
{
- "type": "integer",
- "description": "FAQ条目ID(seq_id)",
- "name": "entry_id",
+ "type": "string",
+ "description": "共享记录ID",
+ "name": "share_id",
"in": "path",
"required": true
},
{
- "description": "FAQ条目",
+ "description": "权限信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UpdateSharePermissionRequest"
}
}
],
"responses": {
"200": {
- "description": "更新成功",
+ "description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "400": {
- "description": "请求参数错误",
+ "403": {
+ "description": "Forbidden",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/knowledge-bases/{id}/faq/entries/{entry_id}/similar-questions": {
- "post": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "向指定的FAQ条目添加相似问题",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "取消知识库的共享",
"tags": [
- "FAQ管理"
+ "知识库共享"
],
- "summary": "添加相似问",
+ "summary": "取消共享",
"parameters": [
{
"type": "string",
@@ -4905,38 +5070,23 @@ const docTemplate = `{
"required": true
},
{
- "type": "integer",
- "description": "FAQ条目ID(seq_id)",
- "name": "entry_id",
+ "type": "string",
+ "description": "共享记录ID",
+ "name": "share_id",
"in": "path",
"required": true
- },
- {
- "description": "相似问列表",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.addSimilarQuestionsRequest"
- }
}
],
"responses": {
"200": {
- "description": "更新后的FAQ条目",
+ "description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
- },
- "404": {
- "description": "条目不存在",
+ "403": {
+ "description": "Forbidden",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -4944,8 +5094,8 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases/{id}/faq/entry": {
- "post": {
+ "/knowledge-bases/{id}/tags": {
+ "get": {
"security": [
{
"Bearer": []
@@ -4954,7 +5104,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "同步创建单个FAQ条目",
+ "description": "获取知识库下的所有标签及统计信息",
"consumes": [
"application/json"
],
@@ -4962,9 +5112,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "FAQ管理"
+ "标签管理"
],
- "summary": "创建单个FAQ条目",
+ "summary": "获取标签列表",
"parameters": [
{
"type": "string",
@@ -4974,18 +5124,27 @@ const docTemplate = `{
"required": true
},
{
- "description": "FAQ条目",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload"
- }
+ "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": "创建的FAQ条目",
+ "description": "标签列表",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4998,10 +5157,8 @@ const docTemplate = `{
}
}
}
- }
- },
- "/knowledge-bases/{id}/faq/import/last-result/display": {
- "put": {
+ },
+ "post": {
"security": [
{
"Bearer": []
@@ -5010,7 +5167,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "更新FAQ知识库导入结果统计卡片的显示或隐藏状态",
+ "description": "在知识库下创建新标签",
"consumes": [
"application/json"
],
@@ -5018,9 +5175,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "FAQ管理"
+ "标签管理"
],
- "summary": "更新FAQ最后一次导入结果显示状态",
+ "summary": "创建标签",
"parameters": [
{
"type": "string",
@@ -5030,18 +5187,29 @@ const docTemplate = `{
"required": true
},
{
- "description": "状态更新请求",
+ "description": "标签信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.updateLastFAQImportResultDisplayStatusRequest"
+ "type": "object",
+ "properties": {
+ "color": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "sort_order": {
+ "type": "integer"
+ }
+ }
}
}
],
"responses": {
"200": {
- "description": "更新成功",
+ "description": "创建的标签",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5052,18 +5220,12 @@ const docTemplate = `{
"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": {
+ "/knowledge-bases/{id}/tags/{tag_id}": {
+ "put": {
"security": [
{
"Bearer": []
@@ -5072,7 +5234,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "使用混合搜索在FAQ中搜索,支持两级优先级标签召回:first_priority_tag_ids优先级最高,second_priority_tag_ids次之",
+ "description": "更新标签信息",
"consumes": [
"application/json"
],
@@ -5080,9 +5242,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "FAQ管理"
+ "标签管理"
],
- "summary": "搜索FAQ",
+ "summary": "更新标签",
"parameters": [
{
"type": "string",
@@ -5092,18 +5254,25 @@ const docTemplate = `{
"required": true
},
{
- "description": "搜索请求",
+ "type": "string",
+ "description": "标签ID (UUID或seq_id)",
+ "name": "tag_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "标签更新信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQSearchRequest"
+ "type": "object"
}
}
],
"responses": {
"200": {
- "description": "搜索结果",
+ "description": "更新后的标签",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5116,10 +5285,8 @@ const docTemplate = `{
}
}
}
- }
- },
- "/knowledge-bases/{id}/hybrid-search": {
- "get": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
@@ -5128,7 +5295,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "在知识库中执行向量和关键词混合搜索",
+ "description": "删除标签,可使用force=true强制删除被引用的标签,content_only=true仅删除标签下的内容而保留标签本身",
"consumes": [
"application/json"
],
@@ -5136,9 +5303,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识库"
+ "标签管理"
],
- "summary": "混合搜索",
+ "summary": "删除标签",
"parameters": [
{
"type": "string",
@@ -5148,18 +5315,36 @@ const docTemplate = `{
"required": true
},
{
- "description": "搜索参数",
- "name": "request",
+ "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",
- "required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SearchParams"
+ "$ref": "#/definitions/internal_handler.DeleteTagRequest"
}
}
],
"responses": {
"200": {
- "description": "搜索结果",
+ "description": "删除成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5174,7 +5359,7 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases/{id}/knowledge": {
+ "/knowledge/batch": {
"get": {
"security": [
{
@@ -5184,7 +5369,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "获取知识库下的知识列表,支持分页和筛选",
+ "description": "根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的租户解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属租户查询(用于刷新后恢复共享知识库下的文件)",
"consumes": [
"application/json"
],
@@ -5194,67 +5379,29 @@ const docTemplate = `{
"tags": [
"知识管理"
],
- "summary": "获取知识列表",
+ "summary": "批量获取知识",
"parameters": [
{
- "type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "collectionFormat": "csv",
+ "description": "知识ID列表",
+ "name": "ids",
+ "in": "query",
"required": true
},
- {
- "type": "integer",
- "description": "页码",
- "name": "page",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "每页数量",
- "name": "page_size",
- "in": "query"
- },
- {
- "type": "string",
- "description": "标签ID筛选",
- "name": "tag_id",
- "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",
+ "description": "可选,知识库ID(用于共享知识库时指定范围)",
+ "name": "kb_id",
"in": "query"
},
{
"type": "string",
- "description": "更新时间终点,RFC3339 格式",
- "name": "end_time",
+ "description": "可选,共享智能体ID(用于按智能体租户批量拉取文件详情)",
+ "name": "agent_id",
"in": "query"
}
],
@@ -5273,8 +5420,10 @@ const docTemplate = `{
}
}
}
- },
- "delete": {
+ }
+ },
+ "/knowledge/batch-delete": {
+ "post": {
"security": [
{
"Bearer": []
@@ -5283,7 +5432,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "删除知识库下的所有知识条目(异步任务)。知识库本身保留,仅清空其中的内容",
+ "description": "按 ID 列表批量删除单个知识库下的多个知识条目",
"consumes": [
"application/json"
],
@@ -5293,19 +5442,21 @@ const docTemplate = `{
"tags": [
"知识管理"
],
- "summary": "清空知识库内容",
+ "summary": "批量删除知识",
"parameters": [
{
- "type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "批量删除请求",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/internal_handler.BatchDeleteKnowledgeRequest"
+ }
}
],
"responses": {
"200": {
- "description": "清空任务已提交",
+ "description": "删除成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5326,8 +5477,8 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases/{id}/knowledge/file": {
- "post": {
+ "/knowledge/image/{id}/{chunk_id}": {
+ "put": {
"security": [
{
"Bearer": []
@@ -5336,9 +5487,9 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "上传文件并创建知识条目",
+ "description": "更新知识分块的图像信息",
"consumes": [
- "multipart/form-data"
+ "application/json"
],
"produces": [
"application/json"
@@ -5346,44 +5497,40 @@ const docTemplate = `{
"tags": [
"知识管理"
],
- "summary": "从文件创建知识",
+ "summary": "更新图像信息",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "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"
+ "description": "分块ID",
+ "name": "chunk_id",
+ "in": "path",
+ "required": true
},
{
- "type": "boolean",
- "description": "启用多模态处理",
- "name": "enable_multimodel",
- "in": "formData"
+ "description": "图像信息",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "image_info": {
+ "type": "string"
+ }
+ }
+ }
}
],
"responses": {
"200": {
- "description": "创建的知识",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5394,19 +5541,12 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- },
- "409": {
- "description": "文件重复",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
}
}
}
},
- "/knowledge-bases/{id}/knowledge/manual": {
- "post": {
+ "/knowledge/manual/{id}": {
+ "put": {
"security": [
{
"Bearer": []
@@ -5415,7 +5555,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "手工录入Markdown格式的知识内容",
+ "description": "更新手工录入的Markdown知识内容",
"consumes": [
"application/json"
],
@@ -5425,11 +5565,11 @@ const docTemplate = `{
"tags": [
"知识管理"
],
- "summary": "手工创建知识",
+ "summary": "更新手工知识",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "description": "知识ID",
"name": "id",
"in": "path",
"required": true
@@ -5446,7 +5586,7 @@ const docTemplate = `{
],
"responses": {
"200": {
- "description": "创建的知识",
+ "description": "更新后的知识",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5461,7 +5601,7 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases/{id}/knowledge/url": {
+ "/knowledge/move": {
"post": {
"security": [
{
@@ -5471,7 +5611,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "从指定URL抓取内容并创建知识条目。当提供 file_name/file_type 或 URL 路径含已知文件扩展名时,自动切换为文件下载模式",
+ "description": "将一条或多条知识从源知识库移动到目标知识库(异步),返回任务 ID 用于查询进度",
"consumes": [
"application/json"
],
@@ -5479,53 +5619,25 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识管理"
+ "知识"
],
- "summary": "从URL创建知识",
+ "summary": "移动知识到其他知识库",
"parameters": [
{
- "type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
- "required": true
- },
- {
- "description": "URL请求",
+ "description": "{source_kb_id, target_kb_id, knowledge_ids}",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "type": "object",
- "properties": {
- "enable_multimodel": {
- "type": "boolean"
- },
- "file_name": {
- "type": "string"
- },
- "file_type": {
- "type": "string"
- },
- "tag_id": {
- "type": "string"
- },
- "title": {
- "type": "string"
- },
- "url": {
- "type": "string"
- }
- }
+ "$ref": "#/definitions/internal_handler.MoveKnowledgeRequest"
}
}
],
- "responses": {
- "201": {
- "description": "创建的知识",
+ "responses": {
+ "200": {
+ "description": "任务信息",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/internal_handler.MoveKnowledgeResponse"
}
},
"400": {
@@ -5533,18 +5645,11 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- },
- "409": {
- "description": "URL重复",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
}
}
}
},
- "/knowledge-bases/{id}/move-targets": {
+ "/knowledge/move/progress/{task_id}": {
"get": {
"security": [
{
@@ -5554,39 +5659,32 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "返回与源知识库 Type 一致、EmbeddingModelID 一致、非临时且不是自身的目标知识库列表",
+ "description": "按任务 ID 查询移动进度",
"produces": [
"application/json"
],
"tags": [
- "知识库"
+ "知识"
],
- "summary": "获取可移动目标知识库列表",
+ "summary": "获取知识移动进度",
"parameters": [
{
"type": "string",
- "description": "源知识库 ID",
- "name": "id",
+ "description": "移动任务 ID",
+ "name": "task_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "可移动目标列表",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "进度信息",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeMoveProgress"
}
},
"404": {
- "description": "知识库不存在",
+ "description": "任务不存在",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -5594,8 +5692,8 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases/{id}/pin": {
- "put": {
+ "/knowledge/search": {
+ "get": {
"security": [
{
"Bearer": []
@@ -5604,7 +5702,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "切换知识库的置顶状态",
+ "description": "Search knowledge files by keyword. When agent_id is set (shared agent), scope is the agent's configured knowledge bases.",
"consumes": [
"application/json"
],
@@ -5612,28 +5710,51 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识库"
+ "Knowledge"
],
- "summary": "置顶/取消置顶知识库",
+ "summary": "Search knowledge",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
- "required": true
+ "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"
}
],
"responses": {
"200": {
- "description": "更新后的知识库",
+ "description": "Search results",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "404": {
- "description": "知识库不存在",
+ "400": {
+ "description": "Invalid request",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -5641,46 +5762,66 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases/{id}/shares": {
- "get": {
+ "/knowledge/tags": {
+ "put": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "获取知识库的所有共享记录",
+ "description": "批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的租户解析",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "知识库共享"
+ "知识管理"
],
- "summary": "获取知识库的共享列表",
+ "summary": "批量更新知识标签",
"parameters": [
{
- "type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "标签更新请求(updates 必填,kb_id 可选)",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object"
+ }
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "更新成功",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ListSharesResponse"
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "400": {
+ "description": "请求参数错误",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- },
- "post": {
+ }
+ },
+ "/knowledge/{id}": {
+ "get": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "将知识库共享到指定组织",
+ "description": "根据ID获取知识条目详情",
"consumes": [
"application/json"
],
@@ -5688,52 +5829,50 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识库共享"
+ "知识管理"
],
- "summary": "共享知识库到组织",
+ "summary": "获取知识详情",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "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",
+ "200": {
+ "description": "知识详情",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "403": {
- "description": "Forbidden",
+ "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}/shares/{share_id}": {
+ },
"put": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "更新知识库共享的权限级别",
+ "description": "更新知识条目信息",
"consumes": [
"application/json"
],
@@ -5741,44 +5880,37 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识库共享"
+ "知识管理"
],
- "summary": "更新共享权限",
+ "summary": "更新知识",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "description": "知识ID",
"name": "id",
"in": "path",
"required": true
},
{
- "type": "string",
- "description": "共享记录ID",
- "name": "share_id",
- "in": "path",
- "required": true
- },
- {
- "description": "权限信息",
+ "description": "知识信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UpdateSharePermissionRequest"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Knowledge"
}
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "403": {
- "description": "Forbidden",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -5789,39 +5921,41 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "取消知识库的共享",
+ "description": "根据ID删除知识条目",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "知识库共享"
+ "知识管理"
],
- "summary": "取消共享",
+ "summary": "删除知识",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "description": "知识ID",
"name": "id",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "共享记录ID",
- "name": "share_id",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "删除成功",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "403": {
- "description": "Forbidden",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -5829,7 +5963,7 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases/{id}/tags": {
+ "/knowledge/{id}/download": {
"get": {
"security": [
{
@@ -5839,50 +5973,31 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "获取知识库下的所有标签及统计信息",
+ "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"
- },
+ "application/octet-stream"
+ ],
+ "tags": [
+ "知识管理"
+ ],
+ "summary": "下载知识文件",
+ "parameters": [
{
"type": "string",
- "description": "关键词搜索",
- "name": "keyword",
- "in": "query"
+ "description": "知识ID",
+ "name": "id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
- "description": "标签列表",
+ "description": "文件内容",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "type": "file"
}
},
"400": {
@@ -5892,8 +6007,10 @@ const docTemplate = `{
}
}
}
- },
- "post": {
+ }
+ },
+ "/knowledge/{id}/preview": {
+ "get": {
"security": [
{
"Bearer": []
@@ -5902,52 +6019,34 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "在知识库下创建新标签",
+ "description": "返回知识条目关联的原始文件,Content-Type 根据文件类型设置,用于浏览器内嵌预览",
"consumes": [
"application/json"
],
"produces": [
- "application/json"
+ "application/pdf",
+ "image/jpeg",
+ "image/png",
+ "text/plain"
],
"tags": [
- "标签管理"
+ "知识管理"
],
- "summary": "创建标签",
+ "summary": "预览知识文件",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "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": "创建的标签",
+ "description": "文件内容",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "type": "file"
}
},
"400": {
@@ -5959,8 +6058,8 @@ const docTemplate = `{
}
}
},
- "/knowledge-bases/{id}/tags/{tag_id}": {
- "put": {
+ "/knowledge/{id}/reparse": {
+ "post": {
"security": [
{
"Bearer": []
@@ -5969,7 +6068,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "更新标签信息",
+ "description": "删除知识中现有的文档内容并重新解析,使用异步任务方式处理",
"consumes": [
"application/json"
],
@@ -5977,37 +6076,21 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "标签管理"
+ "知识管理"
],
- "summary": "更新标签",
+ "summary": "重新解析知识",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "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": "更新后的标签",
+ "description": "重新解析任务已提交",
"schema": {
"type": "object",
"additionalProperties": true
@@ -6018,279 +6101,224 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "403": {
+ "description": "权限不足",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
- },
- "delete": {
+ }
+ },
+ "/knowledgebase/{kb_id}/wiki/auto-fix": {
+ "post": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "删除标签,可使用force=true强制删除被引用的标签,content_only=true仅删除标签下的内容而保留标签本身",
- "consumes": [
- "application/json"
- ],
+ "description": "Automatically fix fixable wiki issues (broken links, etc.)",
"produces": [
"application/json"
],
"tags": [
- "标签管理"
+ "Wiki"
],
- "summary": "删除标签",
+ "summary": "Auto-fix wiki issues",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "标签ID (UUID或seq_id)",
- "name": "tag_id",
+ "description": "Knowledge base ID",
+ "name": "kb_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": "删除成功",
+ "description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
- },
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
}
}
}
},
- "/knowledge/batch": {
+ "/knowledgebase/{kb_id}/wiki/graph": {
"get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的租户解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属租户查询(用于刷新后恢复共享知识库下的文件)",
- "consumes": [
- "application/json"
- ],
+ "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": "批量获取知识",
+ "summary": "Get wiki link graph",
"parameters": [
{
- "type": "array",
- "items": {
- "type": "string"
- },
- "collectionFormat": "csv",
- "description": "知识ID列表",
- "name": "ids",
- "in": "query",
+ "type": "string",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
+ "in": "path",
"required": true
},
{
"type": "string",
- "description": "可选,知识库ID(用于共享知识库时指定范围)",
- "name": "kb_id",
+ "description": "overview (default) | ego",
+ "name": "mode",
"in": "query"
},
{
"type": "string",
- "description": "可选,共享智能体ID(用于按智能体租户批量拉取文件详情)",
- "name": "agent_id",
+ "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": "知识列表",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiGraphData"
}
}
}
}
},
- "/knowledge/batch-delete": {
- "post": {
+ "/knowledgebase/{kb_id}/wiki/index": {
+ "get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "按 ID 列表批量删除单个知识库下的多个知识条目",
- "consumes": [
- "application/json"
- ],
+ "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": "批量删除知识",
+ "summary": "Get wiki index view",
"parameters": [
{
- "description": "批量删除请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.BatchDeleteKnowledgeRequest"
- }
+ "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": "删除成功",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
- },
- "403": {
- "description": "权限不足",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiIndexResponse"
}
}
}
}
},
- "/knowledge/image/{id}/{chunk_id}": {
- "put": {
+ "/knowledgebase/{kb_id}/wiki/issues": {
+ "get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "更新知识分块的图像信息",
- "consumes": [
- "application/json"
- ],
+ "description": "List issues flagged on wiki pages with optional filtering",
"produces": [
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "更新图像信息",
+ "summary": "List wiki page issues",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "分块ID",
- "name": "chunk_id",
- "in": "path",
- "required": true
+ "description": "Filter by page slug",
+ "name": "slug",
+ "in": "query"
},
{
- "description": "图像信息",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "type": "object",
- "properties": {
- "image_info": {
- "type": "string"
- }
- }
- }
+ "type": "string",
+ "description": "Filter by status (pending, ignored, resolved)",
+ "name": "status",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "更新成功",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageIssue"
+ }
}
}
}
}
},
- "/knowledge/manual/{id}": {
+ "/knowledgebase/{kb_id}/wiki/issues/{issue_id}/status": {
"put": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "更新手工录入的Markdown知识内容",
+ "description": "Update the status of a flagged wiki page issue",
"consumes": [
"application/json"
],
@@ -6298,37 +6326,46 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "更新手工知识",
+ "summary": "Update wiki page issue status",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
"in": "path",
"required": true
},
{
- "description": "手工知识内容",
- "name": "request",
+ "type": "string",
+ "description": "Issue ID",
+ "name": "issue_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "New status {'status': 'ignored'}",
+ "name": "status",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ManualKnowledgePayload"
+ "type": "object"
}
}
],
"responses": {
"200": {
- "description": "更新后的知识",
+ "description": "OK",
"schema": {
"type": "object",
- "additionalProperties": true
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"400": {
- "description": "请求参数错误",
+ "description": "Bad Request",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -6336,178 +6373,174 @@ const docTemplate = `{
}
}
},
- "/knowledge/move": {
- "post": {
+ "/knowledgebase/{kb_id}/wiki/lint": {
+ "get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "将一条或多条知识从源知识库移动到目标知识库(异步),返回任务 ID 用于查询进度",
- "consumes": [
- "application/json"
- ],
+ "description": "Perform a comprehensive health check on the wiki",
"produces": [
"application/json"
],
"tags": [
- "知识"
+ "Wiki"
],
- "summary": "移动知识到其他知识库",
+ "summary": "Run wiki lint",
"parameters": [
{
- "description": "{source_kb_id, target_kb_id, knowledge_ids}",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.MoveKnowledgeRequest"
- }
+ "type": "string",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
- "description": "任务信息",
- "schema": {
- "$ref": "#/definitions/internal_handler.MoveKnowledgeResponse"
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_application_service.WikiLintReport"
}
}
}
}
},
- "/knowledge/move/progress/{task_id}": {
+ "/knowledgebase/{kb_id}/wiki/log": {
"get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "按任务 ID 查询移动进度",
+ "description": "Returns a paginated feed of wiki operation events (ingest, retract, ...)\nnewest-first. Pagination is cursor-based: pass ` + "`" + `next_cursor` + "`" + ` from the\nprevious response back as ` + "`" + `cursor` + "`" + ` to fetch the next page.",
"produces": [
"application/json"
],
"tags": [
- "知识"
+ "Wiki"
],
- "summary": "获取知识移动进度",
+ "summary": "Get wiki operation log",
"parameters": [
{
"type": "string",
- "description": "移动任务 ID",
- "name": "task_id",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
"in": "path",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "Opaque cursor from the previous page (empty = newest)",
+ "name": "cursor",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "Page size, 1-200 (default 50)",
+ "name": "limit",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "进度信息",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeMoveProgress"
- }
- },
- "404": {
- "description": "任务不存在",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiLogEntryListResponse"
}
}
}
}
},
- "/knowledge/search": {
+ "/knowledgebase/{kb_id}/wiki/pages": {
"get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "Search knowledge files by keyword. When agent_id is set (shared agent), scope is the agent's configured knowledge bases.",
- "consumes": [
- "application/json"
- ],
+ "description": "List wiki pages with optional filtering and pagination",
"produces": [
"application/json"
],
"tags": [
- "Knowledge"
+ "Wiki"
],
- "summary": "Search knowledge",
+ "summary": "List wiki pages",
"parameters": [
{
"type": "string",
- "description": "Keyword to search",
- "name": "keyword",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Filter by page type",
+ "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": "Offset for pagination",
- "name": "offset",
+ "description": "Page number",
+ "name": "page",
"in": "query"
},
{
"type": "integer",
- "description": "Limit for pagination (default 20)",
- "name": "limit",
+ "description": "Page size",
+ "name": "page_size",
"in": "query"
},
{
"type": "string",
- "description": "Comma-separated file extensions to filter (e.g., csv,xlsx)",
- "name": "file_types",
+ "description": "Sort field",
+ "name": "sort_by",
"in": "query"
},
{
"type": "string",
- "description": "Shared agent ID (search within agent's KB scope)",
- "name": "agent_id",
+ "description": "Sort order (asc/desc)",
+ "name": "sort_order",
"in": "query"
}
],
"responses": {
"200": {
- "description": "Search results",
+ "description": "OK",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageListResponse"
}
},
"400": {
- "description": "Invalid request",
+ "description": "Bad Request",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/knowledge/tags": {
- "put": {
+ },
+ "post": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的租户解析",
+ "description": "Create a new wiki page in the knowledge base",
"consumes": [
"application/json"
],
@@ -6515,30 +6548,36 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "批量更新知识标签",
+ "summary": "Create a wiki page",
"parameters": [
{
- "description": "标签更新请求(updates 必填,kb_id 可选)",
- "name": "request",
+ "type": "string",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "Wiki page data",
+ "name": "page",
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
}
}
],
"responses": {
- "200": {
- "description": "更新成功",
+ "201": {
+ "description": "Created",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
}
},
"400": {
- "description": "请求参数错误",
+ "description": "Bad Request",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -6546,52 +6585,46 @@ const docTemplate = `{
}
}
},
- "/knowledge/{id}": {
+ "/knowledgebase/{kb_id}/wiki/pages/{slug}": {
"get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "根据ID获取知识条目详情",
- "consumes": [
- "application/json"
- ],
+ "description": "Retrieve a wiki page by its slug",
"produces": [
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "获取知识详情",
+ "summary": "Get a wiki page by slug",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "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": "知识详情",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
}
},
"404": {
- "description": "知识不存在",
+ "description": "Not Found",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -6602,12 +6635,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "更新知识条目信息",
+ "description": "Update an existing wiki page by slug",
"consumes": [
"application/json"
],
@@ -6615,37 +6645,43 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "更新知识",
+ "summary": "Update a wiki page",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
"in": "path",
"required": true
},
{
- "description": "知识信息",
- "name": "request",
+ "type": "string",
+ "description": "Page slug",
+ "name": "slug",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "Updated wiki page data",
+ "name": "page",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Knowledge"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
}
}
],
"responses": {
"200": {
- "description": "更新成功",
+ "description": "OK",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
}
},
- "400": {
- "description": "请求参数错误",
+ "404": {
+ "description": "Not Found",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -6656,41 +6692,35 @@ const docTemplate = `{
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "根据ID删除知识条目",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "Soft-delete a wiki page by slug",
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "删除知识",
+ "summary": "Delete a wiki page",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "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": "删除成功",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
+ "204": {
+ "description": "No Content"
},
- "400": {
- "description": "请求参数错误",
+ "404": {
+ "description": "Not Found",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -6698,149 +6728,119 @@ const docTemplate = `{
}
}
},
- "/knowledge/{id}/download": {
- "get": {
+ "/knowledgebase/{kb_id}/wiki/rebuild-links": {
+ "post": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "下载知识条目关联的原始文件",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/octet-stream"
- ],
+ "description": "Re-parse all pages and rebuild bidirectional link references",
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "下载知识文件",
+ "summary": "Rebuild wiki links",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "文件内容",
- "schema": {
- "type": "file"
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/knowledge/{id}/preview": {
+ "/knowledgebase/{kb_id}/wiki/search": {
"get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "返回知识条目关联的原始文件,Content-Type 根据文件类型设置,用于浏览器内嵌预览",
- "consumes": [
- "application/json"
- ],
+ "description": "Full-text search over wiki pages",
"produces": [
- "application/pdf",
- "image/jpeg",
- "image/png",
- "text/plain"
+ "application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "预览知识文件",
+ "summary": "Search wiki pages",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "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": "文件内容",
- "schema": {
- "type": "file"
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ }
}
}
}
}
},
- "/knowledge/{id}/reparse": {
- "post": {
+ "/knowledgebase/{kb_id}/wiki/stats": {
+ "get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "删除知识中现有的文档内容并重新解析,使用异步任务方式处理",
- "consumes": [
- "application/json"
- ],
+ "description": "Returns aggregate statistics about the wiki",
"produces": [
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "重新解析知识",
+ "summary": "Get wiki statistics",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "description": "Knowledge base ID",
+ "name": "kb_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": "权限不足",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiStats"
}
}
}
diff --git a/docs/swagger.json b/docs/swagger.json
index cc48de52c..d1ee5297d 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -569,48 +569,43 @@
}
}
},
- "/api/v1/datasource": {
- "get": {
- "description": "List all data sources for a specific knowledge base",
+ "/auth/auto-setup": {
+ "post": {
+ "description": "Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程",
+ "consumes": [
+ "application/json"
+ ],
"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
- }
+ "认证"
],
+ "summary": "自动初始化(Lite 桌面版)",
"responses": {
"200": {
"description": "OK",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse"
}
},
- "400": {
- "description": "Bad Request",
+ "403": {
+ "description": "非 Lite 版本",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- },
+ }
+ },
+ "/auth/change-password": {
"post": {
- "description": "Create a new data source configuration for a knowledge base",
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "修改当前用户的登录密码",
"consumes": [
"application/json"
],
@@ -618,103 +613,117 @@
"application/json"
],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "Create a new data source",
+ "summary": "修改密码",
"parameters": [
{
- "description": "Data source configuration",
+ "description": "密码修改请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ "type": "object",
+ "properties": {
+ "new_password": {
+ "type": "string"
+ },
+ "old_password": {
+ "type": "string"
+ }
+ }
}
}
],
"responses": {
- "201": {
- "description": "Created",
+ "200": {
+ "description": "修改成功",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/logs/{log_id}": {
+ "/auth/config": {
"get": {
- "description": "Retrieve a specific sync log entry",
+ "description": "返回当前部署的注册模式等公开认证配置,供前端决定是否展示注册入口",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "DataSource"
- ],
- "summary": "Get specific sync log",
- "parameters": [
- {
- "type": "string",
- "description": "Sync log ID",
- "name": "log_id",
- "in": "path",
- "required": true
- }
+ "认证"
],
+ "summary": "获取认证配置",
"responses": {
"200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog"
- }
- },
- "404": {
- "description": "Not Found",
+ "description": "认证配置",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
}
}
}
},
- "/api/v1/datasource/types": {
- "get": {
- "description": "Get list of available data source connectors",
+ "/auth/login": {
+ "post": {
+ "description": "用户登录并获取访问令牌",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "DataSource"
+ "认证"
+ ],
+ "summary": "用户登录",
+ "parameters": [
+ {
+ "description": "登录请求参数",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginRequest"
+ }
+ }
],
- "summary": "Get available connectors",
"responses": {
"200": {
"description": "OK",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_datasource.ConnectorMetadata"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse"
+ }
+ },
+ "401": {
+ "description": "认证失败",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/validate-credentials": {
+ "/auth/logout": {
"post": {
- "description": "Validate connectivity to an external data source using type + credentials",
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "撤销当前访问令牌并登出",
"consumes": [
"application/json"
],
@@ -722,81 +731,69 @@
"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"
- }
- }
+ "认证"
],
+ "summary": "用户登出",
"responses": {
"200": {
- "description": "OK",
+ "description": "登出成功",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/{id}": {
+ "/auth/me": {
"get": {
- "description": "Retrieve a data source configuration by ID",
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "获取当前登录用户的详细信息",
+ "consumes": [
+ "application/json"
+ ],
"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
- }
+ "认证"
],
+ "summary": "获取当前用户信息",
"responses": {
"200": {
- "description": "OK",
+ "description": "用户信息",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ "type": "object",
+ "additionalProperties": true
}
},
- "404": {
- "description": "Not Found",
+ "401": {
+ "description": "未授权",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- },
+ }
+ },
+ "/auth/me/preferences": {
"put": {
- "description": "Update an existing data source configuration",
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "按 PATCH 语义合并用户偏好(仅覆盖请求体里出现的字段,其余字段保持不变),\n数据存放在 users.preferences (JSON),跨设备/浏览器自动同步。",
"consumes": [
"application/json"
],
@@ -804,527 +801,636 @@
"application/json"
],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "Update a data source",
+ "summary": "更新当前用户的个性化设置",
"parameters": [
{
- "type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
- },
- {
- "description": "Updated configuration",
+ "description": "Preferences patch",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ "$ref": "#/definitions/internal_handler.updateMyPreferencesRequest"
}
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "更新后的偏好",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- }
- }
- },
- "delete": {
- "description": "Delete a data source (soft delete)",
+ },
+ "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": [
- "DataSource"
+ "认证"
],
- "summary": "Delete a data source",
+ "summary": "OIDC登录重定向回调",
"parameters": [
{
"type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "OIDC授权码",
+ "name": "code",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "OIDC状态",
+ "name": "state",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "OIDC错误码",
+ "name": "error",
+ "in": "query"
}
],
"responses": {
- "204": {
- "description": "No Content"
- },
- "404": {
- "description": "Not Found",
+ "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": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCConfigResponse"
}
}
}
}
},
- "/api/v1/datasource/{id}/logs": {
+ "/auth/oidc/url": {
"get": {
- "description": "Retrieve sync history for a data source",
+ "description": "根据后端OIDC配置生成第三方登录跳转地址",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "Get sync logs",
+ "summary": "获取OIDC授权地址",
"parameters": [
{
"type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
+ "description": "OIDC回调地址",
+ "name": "redirect_uri",
+ "in": "query",
"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"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCAuthURLResponse"
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ },
+ "403": {
+ "description": "OIDC未启用",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/{id}/pause": {
+ "/auth/refresh": {
"post": {
- "description": "Pause a data source's scheduled syncs",
+ "description": "使用刷新令牌获取新的访问令牌",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "Pause data source",
+ "summary": "刷新令牌",
"parameters": [
{
- "type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "刷新令牌",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "refreshToken": {
+ "type": "string"
+ }
+ }
+ }
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "新令牌",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
},
- "400": {
- "description": "Bad Request",
+ "401": {
+ "description": "令牌无效",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/{id}/resources": {
- "get": {
- "description": "List resources available for sync in the external system",
+ "/auth/register": {
+ "post": {
+ "description": "注册新用户账号",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "List available resources in data source",
+ "summary": "用户注册",
"parameters": [
{
- "type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "注册请求参数",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterRequest"
+ }
}
],
"responses": {
- "200": {
- "description": "OK",
+ "201": {
+ "description": "Created",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Resource"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterResponse"
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ },
+ "403": {
+ "description": "注册功能已禁用",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/{id}/resume": {
+ "/auth/switch-tenant": {
"post": {
- "description": "Resume a paused data source",
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "为当前用户在目标租户重新签发访问令牌;要求该用户在目标租户存在 active 成员关系",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "DataSource"
+ "认证"
],
- "summary": "Resume data source",
+ "summary": "切换激活租户",
"parameters": [
{
- "type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
+ "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": "OK",
+ "description": "令牌有效",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
},
- "400": {
- "description": "Bad Request",
+ "401": {
+ "description": "令牌无效",
"schema": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/datasource/{id}/sync": {
+ "/chunker/preview": {
"post": {
- "description": "Trigger an immediate sync for a data source",
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "对提交的文本运行自适应分块器并返回分块预览,不写入数据库不生成 embedding。文本最大 64k 字符",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "DataSource"
+ "分块"
],
- "summary": "Trigger immediate sync",
+ "summary": "预览分块结果",
"parameters": [
{
- "type": "string",
- "description": "Data source ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "{text, chunking_config}",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/internal_handler.PreviewChunkingRequest"
+ }
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "分块结果",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog"
+ "$ref": "#/definitions/internal_handler.PreviewChunkingResponse"
}
},
"400": {
- "description": "Bad Request",
+ "description": "请求参数错误",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
- }
- }
- }
- },
- "/api/v1/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",
+ },
+ "413": {
+ "description": "文本超过预览限制",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
},
- "400": {
- "description": "Bad Request",
+ "504": {
+ "description": "分块超时",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
}
}
}
},
- "/api/v1/knowledgebase/{kb_id}/wiki/auto-fix": {
- "post": {
+ "/chunks/by-id/{id}": {
+ "get": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "Automatically fix fixable wiki issues (broken links, etc.)",
+ "description": "仅通过分块ID获取分块详情(不需要knowledge_id);支持共享知识库下的分块访问",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "Auto-fix wiki issues",
+ "summary": "通过ID获取分块",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "分块ID",
+ "name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "OK",
+ "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/knowledgebase/{kb_id}/wiki/graph": {
- "get": {
+ "/chunks/by-id/{id}/questions": {
+ "delete": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "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.",
+ "description": "删除分块中生成的问题",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "Get wiki link graph",
+ "summary": "删除生成的问题",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "分块ID",
+ "name": "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"
+ "description": "问题ID",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "question_id": {
+ "type": "string"
+ }
+ }
+ }
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "删除成功",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiGraphData"
+ "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/knowledgebase/{kb_id}/wiki/index": {
+ "/chunks/{knowledge_id}": {
"get": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "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.",
+ "description": "获取指定知识下的所有分块列表,支持分页",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "Get wiki index view",
+ "summary": "获取知识分块列表",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "知识ID",
+ "name": "knowledge_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",
+ "default": 1,
+ "description": "页码",
+ "name": "page",
"in": "query"
},
{
- "type": "string",
- "description": "Opaque offset cursor from previous response",
- "name": "cursor",
+ "type": "integer",
+ "default": 10,
+ "description": "每页数量",
+ "name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "分块列表",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiIndexResponse"
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "400": {
+ "description": "请求参数错误",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/api/v1/knowledgebase/{kb_id}/wiki/issues": {
- "get": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "List issues flagged on wiki pages with optional filtering",
+ "description": "删除指定知识下的所有分块",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "List wiki page issues",
+ "summary": "删除知识下所有分块",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "知识ID",
+ "name": "knowledge_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",
+ "description": "删除成功",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageIssue"
- }
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "400": {
+ "description": "请求参数错误",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/api/v1/knowledgebase/{kb_id}/wiki/issues/{issue_id}/status": {
+ "/chunks/{knowledge_id}/{id}": {
"put": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "Update the status of a flagged wiki page issue",
+ "description": "更新指定分块的内容和属性",
"consumes": [
"application/json"
],
@@ -1332,221 +1438,261 @@
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "Update wiki page issue status",
+ "summary": "更新分块",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "知识ID",
+ "name": "knowledge_id",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "Issue ID",
- "name": "issue_id",
+ "description": "分块ID",
+ "name": "id",
"in": "path",
"required": true
},
{
- "description": "New status {'status': 'ignored'}",
- "name": "status",
+ "description": "更新请求",
+ "name": "request",
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "$ref": "#/definitions/internal_handler.UpdateChunkRequest"
}
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "更新后的分块",
"schema": {
"type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "additionalProperties": true
}
},
"400": {
- "description": "Bad Request",
+ "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/knowledgebase/{kb_id}/wiki/lint": {
- "get": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "Perform a comprehensive health check on the wiki",
+ "description": "删除指定的分块",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "分块管理"
],
- "summary": "Run wiki lint",
+ "summary": "删除分块",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "知识ID",
+ "name": "knowledge_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "分块ID",
+ "name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "删除成功",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_application_service.WikiLintReport"
+ "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/knowledgebase/{kb_id}/wiki/log": {
+ "/datasource": {
"get": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Returns a paginated feed of wiki operation events (ingest, retract, ...)\nnewest-first. Pagination is cursor-based: pass `next_cursor` from the\nprevious response back as `cursor` to fetch the next page.",
+ "description": "List all data sources for a specific knowledge base",
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Get wiki operation log",
+ "summary": "List data sources for a knowledge base",
"parameters": [
{
"type": "string",
"description": "Knowledge base ID",
"name": "kb_id",
- "in": "path",
+ "in": "query",
"required": true
- },
- {
- "type": "string",
- "description": "Opaque cursor from the previous page (empty = newest)",
- "name": "cursor",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "Page size, 1-200 (default 50)",
- "name": "limit",
- "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiLogEntryListResponse"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
- }
- },
- "/api/v1/knowledgebase/{kb_id}/wiki/pages": {
- "get": {
- "security": [
- {
- "Bearer": []
- }
+ },
+ "post": {
+ "description": "Create a new data source configuration for a knowledge base",
+ "consumes": [
+ "application/json"
],
- "description": "List wiki pages with optional filtering and pagination",
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "List wiki pages",
+ "summary": "Create a new data source",
"parameters": [
{
- "type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "Filter by page type",
- "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"
+ "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": "Sort order (asc/desc)",
- "name": "sort_order",
- "in": "query"
+ "description": "Sync log ID",
+ "name": "log_id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageListResponse"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog"
}
},
- "400": {
- "description": "Bad Request",
+ "404": {
+ "description": "Not Found",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
- },
- "post": {
- "security": [
- {
- "Bearer": []
- }
+ }
+ },
+ "/datasource/types": {
+ "get": {
+ "description": "Get list of available data source connectors",
+ "produces": [
+ "application/json"
],
- "description": "Create a new wiki page in the knowledge base",
+ "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"
],
@@ -1554,70 +1700,57 @@
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Create a wiki page",
+ "summary": "Test connection with raw credentials (no persistence)",
"parameters": [
{
- "type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
- "in": "path",
- "required": true
- },
- {
- "description": "Wiki page data",
- "name": "page",
+ "description": "type and credentials",
+ "name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "type": "object"
}
}
],
"responses": {
- "201": {
- "description": "Created",
+ "200": {
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"400": {
"description": "Bad Request",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/api/v1/knowledgebase/{kb_id}/wiki/pages/{slug}": {
+ "/datasource/{id}": {
"get": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Retrieve a wiki page by its slug",
+ "description": "Retrieve a data source configuration by ID",
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Get a wiki page by slug",
+ "summary": "Get a data source by ID",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "Page slug",
- "name": "slug",
+ "description": "Data source ID",
+ "name": "id",
"in": "path",
"required": true
}
@@ -1626,24 +1759,22 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
}
},
"404": {
"description": "Not Found",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
},
"put": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Update an existing wiki page by slug",
+ "description": "Update an existing data source configuration",
"consumes": [
"application/json"
],
@@ -1651,31 +1782,24 @@
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Update a wiki page",
+ "summary": "Update a data source",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "Page slug",
- "name": "slug",
+ "description": "Data source ID",
+ "name": "id",
"in": "path",
"required": true
},
{
- "description": "Updated wiki page data",
- "name": "page",
+ "description": "Updated configuration",
+ "name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
}
}
],
@@ -1683,40 +1807,31 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource"
}
},
- "404": {
- "description": "Not Found",
+ "400": {
+ "description": "Bad Request",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
},
"delete": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Soft-delete a wiki page by slug",
+ "description": "Delete a data source (soft delete)",
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Delete a wiki page",
+ "summary": "Delete a data source",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "Page slug",
- "name": "slug",
+ "description": "Data source ID",
+ "name": "id",
"in": "path",
"required": true
}
@@ -1727,37 +1842,6 @@
},
"404": {
"description": "Not Found",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
- }
- }
- }
- },
- "/api/v1/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": {
@@ -1768,40 +1852,34 @@
}
}
},
- "/api/v1/knowledgebase/{kb_id}/wiki/search": {
+ "/datasource/{id}/logs": {
"get": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Full-text search over wiki pages",
+ "description": "Retrieve sync history for a data source",
"produces": [
"application/json"
],
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Search wiki pages",
+ "summary": "Get sync logs",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "Data source ID",
+ "name": "id",
"in": "path",
"required": true
},
{
- "type": "string",
- "description": "Search query",
- "name": "q",
- "in": "query",
- "required": true
+ "type": "integer",
+ "description": "Limit (default: 10)",
+ "name": "limit",
+ "in": "query"
},
{
"type": "integer",
- "description": "Max results (default 10)",
- "name": "limit",
+ "description": "Offset (default: 0)",
+ "name": "offset",
"in": "query"
}
],
@@ -1811,33 +1889,34 @@
"schema": {
"type": "array",
"items": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog"
}
}
- }
- }
- }
- },
- "/api/v1/knowledgebase/{kb_id}/wiki/stats": {
- "get": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "Returns aggregate statistics about the wiki",
- "produces": [
- "application/json"
- ],
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "/datasource/{id}/pause": {
+ "post": {
+ "description": "Pause a data source's scheduled syncs",
"tags": [
- "Wiki"
+ "DataSource"
],
- "summary": "Get wiki statistics",
+ "summary": "Pause data source",
"parameters": [
{
"type": "string",
- "description": "Knowledge base ID",
- "name": "kb_id",
+ "description": "Data source ID",
+ "name": "id",
"in": "path",
"required": true
}
@@ -1846,202 +1925,187 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiStats"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/auth/auto-setup": {
- "post": {
- "description": "Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程",
- "consumes": [
- "application/json"
- ],
+ "/datasource/{id}/resources": {
+ "get": {
+ "description": "List resources available for sync in the external system",
"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
+ }
],
- "summary": "自动初始化(Lite 桌面版)",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Resource"
+ }
}
},
- "403": {
- "description": "非 Lite 版本",
+ "400": {
+ "description": "Bad Request",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/auth/change-password": {
+ "/datasource/{id}/resume": {
"post": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "修改当前用户的登录密码",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "Resume a paused data source",
"tags": [
- "认证"
+ "DataSource"
],
- "summary": "修改密码",
+ "summary": "Resume data source",
"parameters": [
{
- "description": "密码修改请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "type": "object",
- "properties": {
- "new_password": {
- "type": "string"
- },
- "old_password": {
- "type": "string"
- }
- }
- }
+ "type": "string",
+ "description": "Data source ID",
+ "name": "id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
- "description": "修改成功",
+ "description": "OK",
"schema": {
"type": "object",
- "additionalProperties": true
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"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": "认证配置",
+ "description": "Bad Request",
"schema": {
"type": "object",
- "additionalProperties": true
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/auth/login": {
+ "/datasource/{id}/sync": {
"post": {
- "description": "用户登录并获取访问令牌",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "Trigger an immediate sync for a data source",
"tags": [
- "认证"
+ "DataSource"
],
- "summary": "用户登录",
+ "summary": "Trigger immediate sync",
"parameters": [
{
- "description": "登录请求参数",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginRequest"
- }
+ "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.LoginResponse"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog"
}
},
- "401": {
- "description": "认证失败",
+ "400": {
+ "description": "Bad Request",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/auth/logout": {
+ "/datasource/{id}/validate": {
"post": {
- "security": [
+ "description": "Validate the connection to an external data source",
+ "tags": [
+ "DataSource"
+ ],
+ "summary": "Test data source connection",
+ "parameters": [
{
- "Bearer": []
+ "type": "string",
+ "description": "Data source ID",
+ "name": "id",
+ "in": "path",
+ "required": true
}
],
- "description": "撤销当前访问令牌并登出",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "认证"
- ],
- "summary": "用户登出",
"responses": {
"200": {
- "description": "登出成功",
+ "description": "OK",
"schema": {
"type": "object",
- "additionalProperties": true
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"400": {
- "description": "请求参数错误",
+ "description": "Bad Request",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/auth/me": {
+ "/evaluation/": {
"get": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "获取当前登录用户的详细信息",
+ "description": "根据任务ID获取评估结果",
"consumes": [
"application/json"
],
@@ -2049,34 +2113,44 @@
"application/json"
],
"tags": [
- "认证"
+ "评估"
+ ],
+ "summary": "获取评估结果",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "评估任务ID",
+ "name": "task_id",
+ "in": "query",
+ "required": true
+ }
],
- "summary": "获取当前用户信息",
"responses": {
"200": {
- "description": "用户信息",
+ "description": "评估结果",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "401": {
- "description": "未授权",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/auth/me/preferences": {
- "put": {
+ },
+ "post": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "按 PATCH 语义合并用户偏好(仅覆盖请求体里出现的字段,其余字段保持不变),\n数据存放在 users.preferences (JSON),跨设备/浏览器自动同步。",
+ "description": "对知识库进行评估测试",
"consumes": [
"application/json"
],
@@ -2084,23 +2158,23 @@
"application/json"
],
"tags": [
- "认证"
+ "评估"
],
- "summary": "更新当前用户的个性化设置",
+ "summary": "执行评估",
"parameters": [
{
- "description": "Preferences patch",
+ "description": "评估请求参数",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.updateMyPreferencesRequest"
+ "$ref": "#/definitions/internal_handler.EvaluationRequest"
}
}
],
"responses": {
"200": {
- "description": "更新后的偏好",
+ "description": "评估任务",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2111,59 +2185,21 @@
"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": {
+ "/faq/import/progress/{task_id}": {
"get": {
- "description": "接收OIDC provider回调并由后端完成code交换,随后重定向回前端登录页",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "认证"
- ],
- "summary": "OIDC登录重定向回调",
- "parameters": [
- {
- "type": "string",
- "description": "OIDC授权码",
- "name": "code",
- "in": "query"
- },
+ "security": [
{
- "type": "string",
- "description": "OIDC状态",
- "name": "state",
- "in": "query"
+ "Bearer": []
},
{
- "type": "string",
- "description": "OIDC错误码",
- "name": "error",
- "in": "query"
+ "ApiKeyAuth": []
}
],
- "responses": {
- "302": {
- "description": "Found"
- }
- }
- }
- },
- "/auth/oidc/config": {
- "get": {
- "description": "返回OIDC是否启用以及provider展示名称,供前端决定是否展示OIDC登录入口",
+ "description": "获取FAQ导入任务的进度",
"consumes": [
"application/json"
],
@@ -2171,22 +2207,46 @@
"application/json"
],
"tags": [
- "认证"
+ "FAQ管理"
+ ],
+ "summary": "获取FAQ导入进度",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "任务ID",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取OIDC登录配置",
"responses": {
"200": {
- "description": "OK",
+ "description": "导入进度",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCConfigResponse"
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "404": {
+ "description": "任务不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/auth/oidc/url": {
- "get": {
- "description": "根据后端OIDC配置生成第三方登录跳转地址",
+ "/im-channels/{id}": {
+ "put": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "更新指定 IM 渠道的名称、模式、知识库、凭证或启用状态",
"consumes": [
"application/json"
],
@@ -2194,140 +2254,158 @@
"application/json"
],
"tags": [
- "认证"
+ "IM 渠道"
],
- "summary": "获取OIDC授权地址",
+ "summary": "更新 IM 渠道",
"parameters": [
{
"type": "string",
- "description": "OIDC回调地址",
- "name": "redirect_uri",
- "in": "query",
+ "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": "OK",
+ "description": "更新后的渠道",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCAuthURLResponse"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
"description": "请求参数错误",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
},
- "403": {
- "description": "OIDC未启用",
+ "404": {
+ "description": "渠道不存在",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
}
}
- }
- },
- "/auth/refresh": {
- "post": {
- "description": "使用刷新令牌获取新的访问令牌",
- "consumes": [
- "application/json"
+ },
+ "delete": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
],
+ "description": "删除指定 IM 渠道",
"produces": [
"application/json"
],
"tags": [
- "认证"
+ "IM 渠道"
],
- "summary": "刷新令牌",
+ "summary": "删除 IM 渠道",
"parameters": [
{
- "description": "刷新令牌",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "type": "object",
- "properties": {
- "refreshToken": {
- "type": "string"
- }
- }
- }
+ "type": "string",
+ "description": "渠道 ID",
+ "name": "id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
- "description": "新令牌",
+ "description": "success: true",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "401": {
- "description": "令牌无效",
+ "400": {
+ "description": "请求参数错误",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "404": {
+ "description": "渠道不存在",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
}
}
}
}
},
- "/auth/register": {
+ "/im-channels/{id}/toggle": {
"post": {
- "description": "注册新用户账号",
- "consumes": [
- "application/json"
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
],
+ "description": "切换指定 IM 渠道的启用状态",
"produces": [
"application/json"
],
"tags": [
- "认证"
+ "IM 渠道"
],
- "summary": "用户注册",
+ "summary": "启用/停用 IM 渠道",
"parameters": [
{
- "description": "注册请求参数",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterRequest"
- }
+ "type": "string",
+ "description": "渠道 ID",
+ "name": "id",
+ "in": "path",
+ "required": true
}
],
"responses": {
- "201": {
- "description": "Created",
+ "200": {
+ "description": "更新后的渠道",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterResponse"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
"description": "请求参数错误",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
},
- "403": {
- "description": "注册功能已禁用",
+ "404": {
+ "description": "渠道不存在",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
}
}
}
},
- "/auth/switch-tenant": {
- "post": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "为当前用户在目标租户重新签发访问令牌;要求该用户在目标租户存在 active 成员关系",
+ "/im/callback/{channel_id}": {
+ "get": {
+ "description": "接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key",
"consumes": [
"application/json"
],
@@ -2335,58 +2413,44 @@
"application/json"
],
"tags": [
- "认证"
- ],
- "summary": "切换激活租户",
- "parameters": [
- {
- "description": "切换请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "type": "object",
- "properties": {
- "refresh_token": {
- "type": "string"
- },
- "tenant_id": {
- "type": "integer"
- }
- }
- }
+ "IM 回调"
+ ],
+ "summary": "IM 平台回调",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "渠道 ID",
+ "name": "channel_id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "处理结果",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
- "description": "参数错误",
+ "description": "请求参数错误",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
},
- "403": {
- "description": "无该租户成员关系",
+ "401": {
+ "description": "签名校验失败",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
}
}
- }
- },
- "/auth/validate": {
- "get": {
- "security": [
- {
- "Bearer": []
- }
- ],
- "description": "验证访问令牌是否有效",
+ },
+ "post": {
+ "description": "接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key",
"consumes": [
"application/json"
],
@@ -2394,27 +2458,44 @@
"application/json"
],
"tags": [
- "认证"
+ "IM 回调"
+ ],
+ "summary": "IM 平台回调",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "渠道 ID",
+ "name": "channel_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "验证令牌",
"responses": {
"200": {
- "description": "令牌有效",
+ "description": "处理结果",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "400": {
+ "description": "请求参数错误",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"401": {
- "description": "令牌无效",
+ "description": "签名校验失败",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": true
}
}
}
}
},
- "/chunker/preview": {
+ "/initialization/asr/check": {
"post": {
"security": [
{
@@ -2424,7 +2505,7 @@
"ApiKeyAuth": []
}
],
- "description": "对提交的文本运行自适应分块器并返回分块预览,不写入数据库不生成 embedding。文本最大 64k 字符",
+ "description": "检查ASR(语音识别)模型连接是否正常,通过发送一段静默音频测试 /v1/audio/transcriptions 端点",
"consumes": [
"application/json"
],
@@ -2432,52 +2513,38 @@
"application/json"
],
"tags": [
- "分块"
+ "初始化"
],
- "summary": "预览分块结果",
+ "summary": "检查ASR模型",
"parameters": [
{
- "description": "{text, chunking_config}",
+ "description": "ASR检查请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.PreviewChunkingRequest"
+ "$ref": "#/definitions/internal_handler.ModelTestRequest"
}
}
],
"responses": {
"200": {
- "description": "分块结果",
- "schema": {
- "$ref": "#/definitions/internal_handler.PreviewChunkingResponse"
- }
- },
- "400": {
- "description": "请求参数错误",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "413": {
- "description": "文本超过预览限制",
+ "description": "检查结果",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "504": {
- "description": "分块超时",
+ "400": {
+ "description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/chunks/by-id/{id}": {
+ "/initialization/config/{kbId}": {
"get": {
"security": [
{
@@ -2487,7 +2554,7 @@
"ApiKeyAuth": []
}
],
- "description": "仅通过分块ID获取分块详情(不需要knowledge_id);支持共享知识库下的分块访问",
+ "description": "根据知识库ID获取当前配置信息",
"consumes": [
"application/json"
],
@@ -2495,43 +2562,35 @@
"application/json"
],
"tags": [
- "分块管理"
+ "初始化"
],
- "summary": "通过ID获取分块",
+ "summary": "获取知识库配置",
"parameters": [
{
"type": "string",
- "description": "分块ID",
- "name": "id",
+ "description": "知识库ID",
+ "name": "kbId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "分块详情",
+ "description": "配置信息",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
- },
"404": {
- "description": "分块不存在",
+ "description": "知识库不存在",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/chunks/by-id/{id}/questions": {
- "delete": {
+ },
+ "put": {
"security": [
{
"Bearer": []
@@ -2540,7 +2599,7 @@
"ApiKeyAuth": []
}
],
- "description": "删除分块中生成的问题",
+ "description": "根据知识库ID更新模型和分块配置",
"consumes": [
"application/json"
],
@@ -2548,35 +2607,30 @@
"application/json"
],
"tags": [
- "分块管理"
+ "初始化"
],
- "summary": "删除生成的问题",
+ "summary": "更新知识库配置",
"parameters": [
{
"type": "string",
- "description": "分块ID",
- "name": "id",
+ "description": "知识库ID",
+ "name": "kbId",
"in": "path",
"required": true
},
{
- "description": "问题ID",
+ "description": "配置请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "type": "object",
- "properties": {
- "question_id": {
- "type": "string"
- }
- }
+ "$ref": "#/definitions/internal_handler.KBModelConfigRequest"
}
}
],
"responses": {
"200": {
- "description": "删除成功",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2589,7 +2643,7 @@
}
},
"404": {
- "description": "分块不存在",
+ "description": "知识库不存在",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -2597,8 +2651,8 @@
}
}
},
- "/chunks/{knowledge_id}": {
- "get": {
+ "/initialization/embedding/test": {
+ "post": {
"security": [
{
"Bearer": []
@@ -2607,7 +2661,7 @@
"ApiKeyAuth": []
}
],
- "description": "获取指定知识下的所有分块列表,支持分页",
+ "description": "测试Embedding接口是否可用并返回向量维度",
"consumes": [
"application/json"
],
@@ -2615,35 +2669,23 @@
"application/json"
],
"tags": [
- "分块管理"
+ "初始化"
],
- "summary": "获取知识分块列表",
+ "summary": "测试Embedding模型",
"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"
+ "description": "Embedding测试请求",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/internal_handler.ModelTestRequest"
+ }
}
],
"responses": {
"200": {
- "description": "分块列表",
+ "description": "测试结果",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2656,17 +2698,11 @@
}
}
}
- },
- "delete": {
- "security": [
- {
- "Bearer": []
- },
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "删除指定知识下的所有分块",
+ }
+ },
+ "/initialization/extract/fabri-tag": {
+ "post": {
+ "description": "随机生成一组标签",
"consumes": [
"application/json"
],
@@ -2674,37 +2710,22 @@
"application/json"
],
"tags": [
- "分块管理"
- ],
- "summary": "删除知识下所有分块",
- "parameters": [
- {
- "type": "string",
- "description": "知识ID",
- "name": "knowledge_id",
- "in": "path",
- "required": true
- }
+ "初始化"
],
+ "summary": "生成随机标签",
"responses": {
"200": {
- "description": "删除成功",
+ "description": "生成的标签",
"schema": {
"type": "object",
"additionalProperties": true
}
- },
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
}
}
}
},
- "/chunks/{knowledge_id}/{id}": {
- "put": {
+ "/initialization/extract/fabri-text": {
+ "post": {
"security": [
{
"Bearer": []
@@ -2713,7 +2734,7 @@
"ApiKeyAuth": []
}
],
- "description": "更新指定分块的内容和属性",
+ "description": "根据标签生成示例文本",
"consumes": [
"application/json"
],
@@ -2721,37 +2742,23 @@
"application/json"
],
"tags": [
- "分块管理"
+ "初始化"
],
- "summary": "更新分块",
+ "summary": "生成示例文本",
"parameters": [
{
- "type": "string",
- "description": "知识ID",
- "name": "knowledge_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "分块ID",
- "name": "id",
- "in": "path",
- "required": true
- },
- {
- "description": "更新请求",
+ "description": "生成请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.UpdateChunkRequest"
+ "$ref": "#/definitions/internal_handler.FabriTextRequest"
}
}
],
"responses": {
"200": {
- "description": "更新后的分块",
+ "description": "生成的文本",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2762,16 +2769,12 @@
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- },
- "404": {
- "description": "分块不存在",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
}
}
- },
- "delete": {
+ }
+ },
+ "/initialization/extract/text-relation": {
+ "post": {
"security": [
{
"Bearer": []
@@ -2780,7 +2783,7 @@
"ApiKeyAuth": []
}
],
- "description": "删除指定的分块",
+ "description": "从文本中提取实体和关系",
"consumes": [
"application/json"
],
@@ -2788,28 +2791,23 @@
"application/json"
],
"tags": [
- "分块管理"
+ "初始化"
],
- "summary": "删除分块",
+ "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.TextRelationExtractionRequest"
+ }
}
],
"responses": {
"200": {
- "description": "删除成功",
+ "description": "提取结果",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2820,18 +2818,12 @@
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- },
- "404": {
- "description": "分块不存在",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
}
}
}
},
- "/evaluation/": {
- "get": {
+ "/initialization/initialize/{kbId}": {
+ "post": {
"security": [
{
"Bearer": []
@@ -2840,7 +2832,7 @@
"ApiKeyAuth": []
}
],
- "description": "根据任务ID获取评估结果",
+ "description": "根据知识库ID执行完整配置更新",
"consumes": [
"application/json"
],
@@ -2848,21 +2840,30 @@
"application/json"
],
"tags": [
- "评估"
+ "初始化"
],
- "summary": "获取评估结果",
+ "summary": "初始化知识库配置",
"parameters": [
{
"type": "string",
- "description": "评估任务ID",
- "name": "task_id",
- "in": "query",
+ "description": "知识库ID",
+ "name": "kbId",
+ "in": "path",
"required": true
+ },
+ {
+ "description": "初始化请求",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/internal_handler.InitializationRequest"
+ }
}
],
"responses": {
"200": {
- "description": "评估结果",
+ "description": "初始化成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2875,7 +2876,9 @@
}
}
}
- },
+ }
+ },
+ "/initialization/multimodal/test": {
"post": {
"security": [
{
@@ -2885,31 +2888,62 @@
"ApiKeyAuth": []
}
],
- "description": "对知识库进行评估测试",
+ "description": "上传图片测试多模态处理功能",
"consumes": [
- "application/json"
+ "multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
- "评估"
+ "初始化"
],
- "summary": "执行评估",
+ "summary": "测试多模态功能",
"parameters": [
{
- "description": "评估请求参数",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.EvaluationRequest"
- }
+ "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": "评估任务",
+ "description": "测试结果",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2924,7 +2958,7 @@
}
}
},
- "/faq/import/progress/{task_id}": {
+ "/initialization/ollama/download/progress/{taskId}": {
"get": {
"security": [
{
@@ -2934,7 +2968,7 @@
"ApiKeyAuth": []
}
],
- "description": "获取FAQ导入任务的进度",
+ "description": "获取Ollama模型下载任务的进度",
"consumes": [
"application/json"
],
@@ -2942,21 +2976,21 @@
"application/json"
],
"tags": [
- "FAQ管理"
+ "初始化"
],
- "summary": "获取FAQ导入进度",
+ "summary": "获取下载进度",
"parameters": [
{
"type": "string",
"description": "任务ID",
- "name": "task_id",
+ "name": "taskId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "导入进度",
+ "description": "下载进度",
"schema": {
"type": "object",
"additionalProperties": true
@@ -2971,8 +3005,8 @@
}
}
},
- "/im-channels/{id}": {
- "put": {
+ "/initialization/ollama/download/tasks": {
+ "get": {
"security": [
{
"Bearer": []
@@ -2981,7 +3015,7 @@
"ApiKeyAuth": []
}
],
- "description": "更新指定 IM 渠道的名称、模式、知识库、凭证或启用状态",
+ "description": "列出所有Ollama模型下载任务",
"consumes": [
"application/json"
],
@@ -2989,53 +3023,60 @@
"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,
+ "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
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "模型列表",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "404": {
- "description": "渠道不存在",
+ "500": {
+ "description": "服务器错误",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/initialization/ollama/models/check": {
+ "post": {
"security": [
{
"Bearer": []
@@ -3044,26 +3085,39 @@
"ApiKeyAuth": []
}
],
- "description": "删除指定 IM 渠道",
+ "description": "检查指定的Ollama模型是否已安装",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "IM 渠道"
+ "初始化"
],
- "summary": "删除 IM 渠道",
+ "summary": "检查Ollama模型状态",
"parameters": [
{
- "type": "string",
- "description": "渠道 ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "模型名称列表",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "models": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
}
],
"responses": {
"200": {
- "description": "success: true",
+ "description": "模型状态",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3072,21 +3126,13 @@
"400": {
"description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "404": {
- "description": "渠道不存在",
- "schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/im-channels/{id}/toggle": {
+ "/initialization/ollama/models/download": {
"post": {
"security": [
{
@@ -3096,26 +3142,36 @@
"ApiKeyAuth": []
}
],
- "description": "切换指定 IM 渠道的启用状态",
+ "description": "异步下载指定的Ollama模型",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "IM 渠道"
+ "初始化"
],
- "summary": "启用/停用 IM 渠道",
+ "summary": "下载Ollama模型",
"parameters": [
{
- "type": "string",
- "description": "渠道 ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "模型名称",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "modelName": {
+ "type": "string"
+ }
+ }
+ }
}
],
"responses": {
"200": {
- "description": "更新后的渠道",
+ "description": "下载任务信息",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3124,23 +3180,15 @@
"400": {
"description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "404": {
- "description": "渠道不存在",
- "schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/im/callback/{channel_id}": {
+ "/initialization/ollama/status": {
"get": {
- "description": "接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key",
+ "description": "检查Ollama服务是否可用",
"consumes": [
"application/json"
],
@@ -3148,44 +3196,31 @@
"application/json"
],
"tags": [
- "IM 回调"
- ],
- "summary": "IM 平台回调",
- "parameters": [
- {
- "type": "string",
- "description": "渠道 ID",
- "name": "channel_id",
- "in": "path",
- "required": true
- }
+ "初始化"
],
+ "summary": "检查Ollama服务状态",
"responses": {
"200": {
- "description": "处理结果",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "401": {
- "description": "签名校验失败",
+ "description": "Ollama状态",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
- },
+ }
+ },
+ "/initialization/remote/check": {
"post": {
- "description": "接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key",
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "检查远程API模型连接是否正常",
"consumes": [
"application/json"
],
@@ -3193,21 +3228,23 @@
"application/json"
],
"tags": [
- "IM 回调"
+ "初始化"
],
- "summary": "IM 平台回调",
+ "summary": "检查远程模型",
"parameters": [
{
- "type": "string",
- "description": "渠道 ID",
- "name": "channel_id",
- "in": "path",
- "required": true
+ "description": "模型检查请求",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/internal_handler.RemoteModelCheckRequest"
+ }
}
],
"responses": {
"200": {
- "description": "处理结果",
+ "description": "检查结果",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3216,21 +3253,13 @@
"400": {
"description": "请求参数错误",
"schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "401": {
- "description": "签名校验失败",
- "schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
}
},
- "/initialization/asr/check": {
+ "/initialization/rerank/check": {
"post": {
"security": [
{
@@ -3240,7 +3269,7 @@
"ApiKeyAuth": []
}
],
- "description": "检查ASR(语音识别)模型连接是否正常,通过发送一段静默音频测试 /v1/audio/transcriptions 端点",
+ "description": "检查Rerank模型连接和功能是否正常",
"consumes": [
"application/json"
],
@@ -3250,10 +3279,10 @@
"tags": [
"初始化"
],
- "summary": "检查ASR模型",
+ "summary": "检查Rerank模型",
"parameters": [
{
- "description": "ASR检查请求",
+ "description": "Rerank检查请求",
"name": "request",
"in": "body",
"required": true,
@@ -3279,7 +3308,7 @@
}
}
},
- "/initialization/config/{kbId}": {
+ "/knowledge-bases": {
"get": {
"security": [
{
@@ -3289,7 +3318,7 @@
"ApiKeyAuth": []
}
],
- "description": "根据知识库ID获取当前配置信息",
+ "description": "获取当前租户的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及)",
"consumes": [
"application/json"
],
@@ -3297,35 +3326,34 @@
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "获取知识库配置",
+ "summary": "获取知识库列表",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
- "name": "kbId",
- "in": "path",
- "required": true
+ "description": "共享智能体 ID(传入时返回该智能体可用的知识库)",
+ "name": "agent_id",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "配置信息",
+ "description": "知识库列表",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "404": {
- "description": "知识库不存在",
+ "500": {
+ "description": "服务器错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
},
- "put": {
+ "post": {
"security": [
{
"Bearer": []
@@ -3334,7 +3362,7 @@
"ApiKeyAuth": []
}
],
- "description": "根据知识库ID更新模型和分块配置",
+ "description": "创建新的知识库",
"consumes": [
"application/json"
],
@@ -3342,30 +3370,23 @@
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "更新知识库配置",
+ "summary": "创建知识库",
"parameters": [
{
- "type": "string",
- "description": "知识库ID",
- "name": "kbId",
- "in": "path",
- "required": true
- },
- {
- "description": "配置请求",
+ "description": "知识库信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.KBModelConfigRequest"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBase"
}
}
],
"responses": {
- "200": {
- "description": "更新成功",
+ "201": {
+ "description": "创建的知识库",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3376,17 +3397,11 @@
"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": {
+ "/knowledge-bases/copy": {
"post": {
"security": [
{
@@ -3396,7 +3411,7 @@
"ApiKeyAuth": []
}
],
- "description": "测试Embedding接口是否可用并返回向量维度",
+ "description": "将一个知识库的内容复制到另一个知识库(异步任务)",
"consumes": [
"application/json"
],
@@ -3404,23 +3419,23 @@
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "测试Embedding模型",
+ "summary": "复制知识库",
"parameters": [
{
- "description": "Embedding测试请求",
+ "description": "复制请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.ModelTestRequest"
+ "$ref": "#/definitions/internal_handler.CopyKnowledgeBaseRequest"
}
}
],
"responses": {
"200": {
- "description": "测试结果",
+ "description": "任务ID",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3435,9 +3450,17 @@
}
}
},
- "/initialization/extract/fabri-tag": {
- "post": {
- "description": "随机生成一组标签",
+ "/knowledge-bases/copy/progress/{task_id}": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "获取知识库复制任务的进度",
"consumes": [
"application/json"
],
@@ -3445,22 +3468,37 @@
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
+ ],
+ "summary": "获取知识库复制进度",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "任务ID",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "生成随机标签",
"responses": {
"200": {
- "description": "生成的标签",
+ "description": "进度信息",
"schema": {
"type": "object",
"additionalProperties": true
}
+ },
+ "404": {
+ "description": "任务不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
}
},
- "/initialization/extract/fabri-text": {
- "post": {
+ "/knowledge-bases/{id}": {
+ "get": {
"security": [
{
"Bearer": []
@@ -3469,7 +3507,7 @@
"ApiKeyAuth": []
}
],
- "description": "根据标签生成示例文本",
+ "description": "根据ID获取知识库详情。当使用共享智能体时,可传 agent_id 以校验该智能体是否有权访问该知识库。",
"consumes": [
"application/json"
],
@@ -3477,23 +3515,27 @@
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "生成示例文本",
+ "summary": "获取知识库详情",
"parameters": [
{
- "description": "生成请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.FabriTextRequest"
- }
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "共享智能体 ID(用于校验智能体是否有权访问该知识库)",
+ "name": "agent_id",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "生成的文本",
+ "description": "知识库详情",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3504,12 +3546,16 @@
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "404": {
+ "description": "知识库不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
- }
- },
- "/initialization/extract/text-relation": {
- "post": {
+ },
+ "put": {
"security": [
{
"Bearer": []
@@ -3518,7 +3564,7 @@
"ApiKeyAuth": []
}
],
- "description": "从文本中提取实体和关系",
+ "description": "更新知识库的名称、描述和配置",
"consumes": [
"application/json"
],
@@ -3526,23 +3572,30 @@
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "提取文本关系",
+ "summary": "更新知识库",
"parameters": [
{
- "description": "提取请求",
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "更新请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.TextRelationExtractionRequest"
+ "$ref": "#/definitions/internal_handler.UpdateKnowledgeBaseRequest"
}
}
],
"responses": {
"200": {
- "description": "提取结果",
+ "description": "更新后的知识库",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3555,10 +3608,8 @@
}
}
}
- }
- },
- "/initialization/initialize/{kbId}": {
- "post": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
@@ -3567,7 +3618,7 @@
"ApiKeyAuth": []
}
],
- "description": "根据知识库ID执行完整配置更新",
+ "description": "删除指定的知识库及其所有内容",
"consumes": [
"application/json"
],
@@ -3575,30 +3626,21 @@
"application/json"
],
"tags": [
- "初始化"
+ "知识库"
],
- "summary": "初始化知识库配置",
+ "summary": "删除知识库",
"parameters": [
{
"type": "string",
"description": "知识库ID",
- "name": "kbId",
+ "name": "id",
"in": "path",
"required": true
- },
- {
- "description": "初始化请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.InitializationRequest"
- }
}
],
"responses": {
"200": {
- "description": "初始化成功",
+ "description": "删除成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3613,8 +3655,8 @@
}
}
},
- "/initialization/multimodal/test": {
- "post": {
+ "/knowledge-bases/{id}/faq/entries": {
+ "get": {
"security": [
{
"Bearer": []
@@ -3623,62 +3665,65 @@
"ApiKeyAuth": []
}
],
- "description": "上传图片测试多模态处理功能",
+ "description": "获取知识库下的FAQ条目列表,支持分页和筛选",
"consumes": [
- "multipart/form-data"
+ "application/json"
],
"produces": [
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "测试多模态功能",
+ "summary": "获取FAQ条目列表",
"parameters": [
{
- "type": "file",
- "description": "测试图片",
- "name": "image",
- "in": "formData",
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
"required": true
},
{
- "type": "string",
- "description": "VLM模型名称",
- "name": "vlm_model",
- "in": "formData",
- "required": true
+ "type": "integer",
+ "description": "页码",
+ "name": "page",
+ "in": "query"
},
{
- "type": "string",
- "description": "VLM Base URL",
- "name": "vlm_base_url",
- "in": "formData",
- "required": true
+ "type": "integer",
+ "description": "每页数量",
+ "name": "page_size",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "标签ID筛选(seq_id)",
+ "name": "tag_id",
+ "in": "query"
},
{
"type": "string",
- "description": "VLM API Key",
- "name": "vlm_api_key",
- "in": "formData"
+ "description": "关键词搜索",
+ "name": "keyword",
+ "in": "query"
},
{
"type": "string",
- "description": "VLM接口类型",
- "name": "vlm_interface_type",
- "in": "formData"
+ "description": "搜索字段: standard_question(标准问题), similar_questions(相似问法), answers(答案), 默认搜索全部",
+ "name": "search_field",
+ "in": "query"
},
{
"type": "string",
- "description": "存储类型(cos/minio)",
- "name": "storage_type",
- "in": "formData",
- "required": true
+ "description": "排序方式: asc(按更新时间正序), 默认按更新时间倒序",
+ "name": "sort_order",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "测试结果",
+ "description": "FAQ列表",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3691,10 +3736,8 @@
}
}
}
- }
- },
- "/initialization/ollama/download/progress/{taskId}": {
- "get": {
+ },
+ "post": {
"security": [
{
"Bearer": []
@@ -3703,7 +3746,7 @@
"ApiKeyAuth": []
}
],
- "description": "获取Ollama模型下载任务的进度",
+ "description": "异步批量更新或插入FAQ条目。支持 dry_run 模式(设置 dry_run=true),异步验证不实际导入。\ndry_run 模式是异步操作,返回 task_id,通过 /faq/import/progress/{task_id} 查询进度和结果。\n验证内容包括:1) 条目基本格式 2) 重复问题(批次内和知识库已有) 3) 内容安全检查。",
"consumes": [
"application/json"
],
@@ -3711,37 +3754,44 @@
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "获取下载进度",
+ "summary": "批量更新/插入FAQ条目",
"parameters": [
{
"type": "string",
- "description": "任务ID",
- "name": "taskId",
+ "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": "下载进度",
+ "description": "任务ID",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "404": {
- "description": "任务不存在",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/initialization/ollama/download/tasks": {
- "get": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
@@ -3750,7 +3800,7 @@
"ApiKeyAuth": []
}
],
- "description": "列出所有Ollama模型下载任务",
+ "description": "批量删除指定的FAQ条目",
"consumes": [
"application/json"
],
@@ -3758,21 +3808,53 @@
"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"
+ }
+ }
+ }
+ }
+ }
],
- "summary": "列出下载任务",
"responses": {
"200": {
- "description": "任务列表",
+ "description": "删除成功",
"schema": {
"type": "object",
"additionalProperties": true
}
+ },
+ "400": {
+ "description": "请求参数错误",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
}
},
- "/initialization/ollama/models": {
+ "/knowledge-bases/{id}/faq/entries/export": {
"get": {
"security": [
{
@@ -3782,27 +3864,35 @@
"ApiKeyAuth": []
}
],
- "description": "列出已安装的Ollama模型",
+ "description": "将所有FAQ条目导出为CSV文件",
"consumes": [
"application/json"
],
"produces": [
- "application/json"
+ "text/csv"
],
"tags": [
- "初始化"
+ "FAQ管理"
+ ],
+ "summary": "导出FAQ条目",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "列出Ollama模型",
"responses": {
"200": {
- "description": "模型列表",
+ "description": "CSV文件",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "type": "file"
}
},
- "500": {
- "description": "服务器错误",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -3810,8 +3900,8 @@
}
}
},
- "/initialization/ollama/models/check": {
- "post": {
+ "/knowledge-bases/{id}/faq/entries/fields": {
+ "put": {
"security": [
{
"Bearer": []
@@ -3820,7 +3910,7 @@
"ApiKeyAuth": []
}
],
- "description": "检查指定的Ollama模型是否已安装",
+ "description": "批量更新FAQ条目的多个字段(is_enabled, is_recommended, tag_id)",
"consumes": [
"application/json"
],
@@ -3828,31 +3918,30 @@
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "检查Ollama模型状态",
+ "summary": "批量更新FAQ字段",
"parameters": [
{
- "description": "模型名称列表",
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "字段更新请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "type": "object",
- "properties": {
- "models": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryFieldsBatchUpdate"
}
}
],
"responses": {
"200": {
- "description": "模型状态",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3867,8 +3956,8 @@
}
}
},
- "/initialization/ollama/models/download": {
- "post": {
+ "/knowledge-bases/{id}/faq/entries/tags": {
+ "put": {
"security": [
{
"Bearer": []
@@ -3877,7 +3966,7 @@
"ApiKeyAuth": []
}
],
- "description": "异步下载指定的Ollama模型",
+ "description": "批量更新FAQ条目的标签",
"consumes": [
"application/json"
],
@@ -3885,28 +3974,30 @@
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "下载Ollama模型",
+ "summary": "批量更新FAQ标签",
"parameters": [
{
- "description": "模型名称",
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "标签更新请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "type": "object",
- "properties": {
- "modelName": {
- "type": "string"
- }
- }
+ "type": "object"
}
}
],
"responses": {
"200": {
- "description": "下载任务信息",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3921,32 +4012,8 @@
}
}
},
- "/initialization/ollama/status": {
+ "/knowledge-bases/{id}/faq/entries/{entry_id}": {
"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": []
@@ -3955,7 +4022,7 @@
"ApiKeyAuth": []
}
],
- "description": "检查远程API模型连接是否正常",
+ "description": "根据ID获取单个FAQ条目的详情",
"consumes": [
"application/json"
],
@@ -3963,23 +4030,28 @@
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "检查远程模型",
+ "summary": "获取FAQ条目详情",
"parameters": [
{
- "description": "模型检查请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.RemoteModelCheckRequest"
- }
+ "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": "检查结果",
+ "description": "FAQ条目详情",
"schema": {
"type": "object",
"additionalProperties": true
@@ -3990,12 +4062,16 @@
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "404": {
+ "description": "条目不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
- }
- },
- "/initialization/rerank/check": {
- "post": {
+ },
+ "put": {
"security": [
{
"Bearer": []
@@ -4004,7 +4080,7 @@
"ApiKeyAuth": []
}
],
- "description": "检查Rerank模型连接和功能是否正常",
+ "description": "更新指定的FAQ条目",
"consumes": [
"application/json"
],
@@ -4012,23 +4088,37 @@
"application/json"
],
"tags": [
- "初始化"
+ "FAQ管理"
],
- "summary": "检查Rerank模型",
+ "summary": "更新FAQ条目",
"parameters": [
{
- "description": "Rerank检查请求",
+ "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/internal_handler.ModelTestRequest"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload"
}
}
],
"responses": {
"200": {
- "description": "检查结果",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4043,8 +4133,8 @@
}
}
},
- "/knowledge-bases": {
- "get": {
+ "/knowledge-bases/{id}/faq/entries/{entry_id}/similar-questions": {
+ "post": {
"security": [
{
"Bearer": []
@@ -4053,7 +4143,7 @@
"ApiKeyAuth": []
}
],
- "description": "获取当前租户的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及)",
+ "description": "向指定的FAQ条目添加相似问题",
"consumes": [
"application/json"
],
@@ -4061,33 +4151,58 @@
"application/json"
],
"tags": [
- "知识库"
+ "FAQ管理"
],
- "summary": "获取知识库列表",
+ "summary": "添加相似问",
"parameters": [
{
"type": "string",
- "description": "共享智能体 ID(传入时返回该智能体可用的知识库)",
- "name": "agent_id",
- "in": "query"
+ "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": "知识库列表",
+ "description": "更新后的FAQ条目",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "500": {
- "description": "服务器错误",
+ "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": [
{
@@ -4097,7 +4212,7 @@
"ApiKeyAuth": []
}
],
- "description": "创建新的知识库",
+ "description": "同步创建单个FAQ条目",
"consumes": [
"application/json"
],
@@ -4105,23 +4220,30 @@
"application/json"
],
"tags": [
- "知识库"
+ "FAQ管理"
],
- "summary": "创建知识库",
+ "summary": "创建单个FAQ条目",
"parameters": [
{
- "description": "知识库信息",
+ "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.KnowledgeBase"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload"
}
}
],
"responses": {
- "201": {
- "description": "创建的知识库",
+ "200": {
+ "description": "创建的FAQ条目",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4136,8 +4258,8 @@
}
}
},
- "/knowledge-bases/copy": {
- "post": {
+ "/knowledge-bases/{id}/faq/import/last-result/display": {
+ "put": {
"security": [
{
"Bearer": []
@@ -4146,7 +4268,7 @@
"ApiKeyAuth": []
}
],
- "description": "将一个知识库的内容复制到另一个知识库(异步任务)",
+ "description": "更新FAQ知识库导入结果统计卡片的显示或隐藏状态",
"consumes": [
"application/json"
],
@@ -4154,23 +4276,30 @@
"application/json"
],
"tags": [
- "知识库"
+ "FAQ管理"
],
- "summary": "复制知识库",
+ "summary": "更新FAQ最后一次导入结果显示状态",
"parameters": [
{
- "description": "复制请求",
+ "type": "string",
+ "description": "知识库ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "状态更新请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.CopyKnowledgeBaseRequest"
+ "$ref": "#/definitions/internal_handler.updateLastFAQImportResultDisplayStatusRequest"
}
}
],
"responses": {
"200": {
- "description": "任务ID",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4181,12 +4310,18 @@
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "404": {
+ "description": "知识库不存在或无导入记录",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
}
},
- "/knowledge-bases/copy/progress/{task_id}": {
- "get": {
+ "/knowledge-bases/{id}/faq/search": {
+ "post": {
"security": [
{
"Bearer": []
@@ -4195,7 +4330,7 @@
"ApiKeyAuth": []
}
],
- "description": "获取知识库复制任务的进度",
+ "description": "使用混合搜索在FAQ中搜索,支持两级优先级标签召回:first_priority_tag_ids优先级最高,second_priority_tag_ids次之",
"consumes": [
"application/json"
],
@@ -4203,28 +4338,37 @@
"application/json"
],
"tags": [
- "知识库"
+ "FAQ管理"
],
- "summary": "获取知识库复制进度",
+ "summary": "搜索FAQ",
"parameters": [
{
"type": "string",
- "description": "任务ID",
- "name": "task_id",
+ "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": "进度信息",
+ "description": "搜索结果",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "404": {
- "description": "任务不存在",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -4232,7 +4376,7 @@
}
}
},
- "/knowledge-bases/{id}": {
+ "/knowledge-bases/{id}/hybrid-search": {
"get": {
"security": [
{
@@ -4242,7 +4386,7 @@
"ApiKeyAuth": []
}
],
- "description": "根据ID获取知识库详情。当使用共享智能体时,可传 agent_id 以校验该智能体是否有权访问该知识库。",
+ "description": "在知识库中执行向量和关键词混合搜索",
"consumes": [
"application/json"
],
@@ -4252,7 +4396,7 @@
"tags": [
"知识库"
],
- "summary": "获取知识库详情",
+ "summary": "混合搜索",
"parameters": [
{
"type": "string",
@@ -4260,17 +4404,20 @@
"name": "id",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "共享智能体 ID(用于校验智能体是否有权访问该知识库)",
- "name": "agent_id",
- "in": "query"
+ },
+ {
+ "description": "搜索参数",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SearchParams"
+ }
}
],
"responses": {
"200": {
- "description": "知识库详情",
+ "description": "搜索结果",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4281,16 +4428,12 @@
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- },
- "404": {
- "description": "知识库不存在",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
}
}
- },
- "put": {
+ }
+ },
+ "/knowledge-bases/{id}/knowledge": {
+ "get": {
"security": [
{
"Bearer": []
@@ -4299,7 +4442,7 @@
"ApiKeyAuth": []
}
],
- "description": "更新知识库的名称、描述和配置",
+ "description": "获取知识库下的知识列表,支持分页和筛选",
"consumes": [
"application/json"
],
@@ -4307,9 +4450,9 @@
"application/json"
],
"tags": [
- "知识库"
+ "知识管理"
],
- "summary": "更新知识库",
+ "summary": "获取知识列表",
"parameters": [
{
"type": "string",
@@ -4319,18 +4462,63 @@
"required": true
},
{
- "description": "更新请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.UpdateKnowledgeBaseRequest"
- }
+ "type": "integer",
+ "description": "页码",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "每页数量",
+ "name": "page_size",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "标签ID筛选",
+ "name": "tag_id",
+ "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": "更新后的知识库",
+ "description": "知识列表",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4353,7 +4541,7 @@
"ApiKeyAuth": []
}
],
- "description": "删除指定的知识库及其所有内容",
+ "description": "删除知识库下的所有知识条目(异步任务)。知识库本身保留,仅清空其中的内容",
"consumes": [
"application/json"
],
@@ -4361,9 +4549,9 @@
"application/json"
],
"tags": [
- "知识库"
+ "知识管理"
],
- "summary": "删除知识库",
+ "summary": "清空知识库内容",
"parameters": [
{
"type": "string",
@@ -4375,7 +4563,7 @@
],
"responses": {
"200": {
- "description": "删除成功",
+ "description": "清空任务已提交",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4386,12 +4574,18 @@
"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}/faq/entries": {
- "get": {
+ "/knowledge-bases/{id}/knowledge/file": {
+ "post": {
"security": [
{
"Bearer": []
@@ -4400,17 +4594,17 @@
"ApiKeyAuth": []
}
],
- "description": "获取知识库下的FAQ条目列表,支持分页和筛选",
+ "description": "上传文件并创建知识条目",
"consumes": [
- "application/json"
+ "multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识管理"
],
- "summary": "获取FAQ条目列表",
+ "summary": "从文件创建知识",
"parameters": [
{
"type": "string",
@@ -4420,45 +4614,34 @@
"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": "file",
+ "description": "上传的文件",
+ "name": "file",
+ "in": "formData",
+ "required": true
},
{
"type": "string",
- "description": "关键词搜索",
- "name": "keyword",
- "in": "query"
+ "description": "自定义文件名",
+ "name": "fileName",
+ "in": "formData"
},
{
"type": "string",
- "description": "搜索字段: standard_question(标准问题), similar_questions(相似问法), answers(答案), 默认搜索全部",
- "name": "search_field",
- "in": "query"
+ "description": "元数据JSON",
+ "name": "metadata",
+ "in": "formData"
},
{
- "type": "string",
- "description": "排序方式: asc(按更新时间正序), 默认按更新时间倒序",
- "name": "sort_order",
- "in": "query"
+ "type": "boolean",
+ "description": "启用多模态处理",
+ "name": "enable_multimodel",
+ "in": "formData"
}
],
"responses": {
"200": {
- "description": "FAQ列表",
+ "description": "创建的知识",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4469,9 +4652,18 @@
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "409": {
+ "description": "文件重复",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
}
}
- },
+ }
+ },
+ "/knowledge-bases/{id}/knowledge/manual": {
"post": {
"security": [
{
@@ -4481,7 +4673,7 @@
"ApiKeyAuth": []
}
],
- "description": "异步批量更新或插入FAQ条目。支持 dry_run 模式(设置 dry_run=true),异步验证不实际导入。\ndry_run 模式是异步操作,返回 task_id,通过 /faq/import/progress/{task_id} 查询进度和结果。\n验证内容包括:1) 条目基本格式 2) 重复问题(批次内和知识库已有) 3) 内容安全检查。",
+ "description": "手工录入Markdown格式的知识内容",
"consumes": [
"application/json"
],
@@ -4489,9 +4681,9 @@
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识管理"
],
- "summary": "批量更新/插入FAQ条目",
+ "summary": "手工创建知识",
"parameters": [
{
"type": "string",
@@ -4501,18 +4693,18 @@
"required": true
},
{
- "description": "批量操作请求",
+ "description": "手工知识内容",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQBatchUpsertPayload"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ManualKnowledgePayload"
}
}
],
"responses": {
"200": {
- "description": "任务ID",
+ "description": "创建的知识",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4525,8 +4717,10 @@
}
}
}
- },
- "delete": {
+ }
+ },
+ "/knowledge-bases/{id}/knowledge/url": {
+ "post": {
"security": [
{
"Bearer": []
@@ -4535,7 +4729,7 @@
"ApiKeyAuth": []
}
],
- "description": "批量删除指定的FAQ条目",
+ "description": "从指定URL抓取内容并创建知识条目。当提供 file_name/file_type 或 URL 路径含已知文件扩展名时,自动切换为文件下载模式",
"consumes": [
"application/json"
],
@@ -4543,9 +4737,9 @@
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识管理"
],
- "summary": "批量删除FAQ条目",
+ "summary": "从URL创建知识",
"parameters": [
{
"type": "string",
@@ -4555,26 +4749,38 @@
"required": true
},
{
- "description": "要删除的FAQ ID列表(seq_id)",
+ "description": "URL请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
- "ids": {
- "type": "array",
- "items": {
- "type": "integer"
- }
+ "enable_multimodel": {
+ "type": "boolean"
+ },
+ "file_name": {
+ "type": "string"
+ },
+ "file_type": {
+ "type": "string"
+ },
+ "tag_id": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string"
}
}
}
}
],
"responses": {
- "200": {
- "description": "删除成功",
+ "201": {
+ "description": "创建的知识",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4585,11 +4791,18 @@
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "409": {
+ "description": "URL重复",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
}
}
}
},
- "/knowledge-bases/{id}/faq/entries/export": {
+ "/knowledge-bases/{id}/move-targets": {
"get": {
"security": [
{
@@ -4599,21 +4812,18 @@
"ApiKeyAuth": []
}
],
- "description": "将所有FAQ条目导出为CSV文件",
- "consumes": [
- "application/json"
- ],
+ "description": "返回与源知识库 Type 一致、EmbeddingModelID 一致、非临时且不是自身的目标知识库列表",
"produces": [
- "text/csv"
+ "application/json"
],
"tags": [
- "FAQ管理"
+ "知识库"
],
- "summary": "导出FAQ条目",
+ "summary": "获取可移动目标知识库列表",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "description": "源知识库 ID",
"name": "id",
"in": "path",
"required": true
@@ -4621,9 +4831,10 @@
],
"responses": {
"200": {
- "description": "CSV文件",
+ "description": "可移动目标列表",
"schema": {
- "type": "file"
+ "type": "object",
+ "additionalProperties": true
}
},
"400": {
@@ -4631,11 +4842,17 @@
"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/entries/fields": {
+ "/knowledge-bases/{id}/pin": {
"put": {
"security": [
{
@@ -4645,7 +4862,7 @@
"ApiKeyAuth": []
}
],
- "description": "批量更新FAQ条目的多个字段(is_enabled, is_recommended, tag_id)",
+ "description": "切换知识库的置顶状态",
"consumes": [
"application/json"
],
@@ -4653,9 +4870,9 @@
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识库"
],
- "summary": "批量更新FAQ字段",
+ "summary": "置顶/取消置顶知识库",
"parameters": [
{
"type": "string",
@@ -4663,27 +4880,18 @@
"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": "更新成功",
+ "description": "更新后的知识库",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "400": {
- "description": "请求参数错误",
+ "404": {
+ "description": "知识库不存在",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -4691,27 +4899,21 @@
}
}
},
- "/knowledge-bases/{id}/faq/entries/tags": {
- "put": {
+ "/knowledge-bases/{id}/shares": {
+ "get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "批量更新FAQ条目的标签",
- "consumes": [
- "application/json"
- ],
+ "description": "获取知识库的所有共享记录",
"produces": [
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识库共享"
],
- "summary": "批量更新FAQ标签",
+ "summary": "获取知识库的共享列表",
"parameters": [
{
"type": "string",
@@ -4719,45 +4921,24 @@
"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": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ListSharesResponse"
}
}
}
- }
- },
- "/knowledge-bases/{id}/faq/entries/{entry_id}": {
- "get": {
+ },
+ "post": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "根据ID获取单个FAQ条目的详情",
+ "description": "将知识库共享到指定组织",
"consumes": [
"application/json"
],
@@ -4765,9 +4946,9 @@
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识库共享"
],
- "summary": "获取FAQ条目详情",
+ "summary": "共享知识库到组织",
"parameters": [
{
"type": "string",
@@ -4777,45 +4958,40 @@
"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/github_com_Tencent_WeKnora_internal_types.ShareKnowledgeBaseRequest"
+ }
}
],
"responses": {
- "200": {
- "description": "FAQ条目详情",
+ "201": {
+ "description": "Created",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
- },
- "404": {
- "description": "条目不存在",
+ "403": {
+ "description": "Forbidden",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- },
+ }
+ },
+ "/knowledge-bases/{id}/shares/{share_id}": {
"put": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "更新指定的FAQ条目",
+ "description": "更新知识库共享的权限级别",
"consumes": [
"application/json"
],
@@ -4823,9 +4999,9 @@
"application/json"
],
"tags": [
- "FAQ管理"
+ "知识库共享"
],
- "summary": "更新FAQ条目",
+ "summary": "更新共享权限",
"parameters": [
{
"type": "string",
@@ -4835,60 +5011,49 @@
"required": true
},
{
- "type": "integer",
- "description": "FAQ条目ID(seq_id)",
- "name": "entry_id",
+ "type": "string",
+ "description": "共享记录ID",
+ "name": "share_id",
"in": "path",
"required": true
},
{
- "description": "FAQ条目",
+ "description": "权限信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UpdateSharePermissionRequest"
}
}
],
"responses": {
"200": {
- "description": "更新成功",
+ "description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "400": {
- "description": "请求参数错误",
+ "403": {
+ "description": "Forbidden",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/knowledge-bases/{id}/faq/entries/{entry_id}/similar-questions": {
- "post": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "向指定的FAQ条目添加相似问题",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "取消知识库的共享",
"tags": [
- "FAQ管理"
+ "知识库共享"
],
- "summary": "添加相似问",
+ "summary": "取消共享",
"parameters": [
{
"type": "string",
@@ -4898,38 +5063,23 @@
"required": true
},
{
- "type": "integer",
- "description": "FAQ条目ID(seq_id)",
- "name": "entry_id",
+ "type": "string",
+ "description": "共享记录ID",
+ "name": "share_id",
"in": "path",
"required": true
- },
- {
- "description": "相似问列表",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.addSimilarQuestionsRequest"
- }
}
],
"responses": {
"200": {
- "description": "更新后的FAQ条目",
+ "description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
- },
- "404": {
- "description": "条目不存在",
+ "403": {
+ "description": "Forbidden",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -4937,8 +5087,8 @@
}
}
},
- "/knowledge-bases/{id}/faq/entry": {
- "post": {
+ "/knowledge-bases/{id}/tags": {
+ "get": {
"security": [
{
"Bearer": []
@@ -4947,7 +5097,7 @@
"ApiKeyAuth": []
}
],
- "description": "同步创建单个FAQ条目",
+ "description": "获取知识库下的所有标签及统计信息",
"consumes": [
"application/json"
],
@@ -4955,9 +5105,9 @@
"application/json"
],
"tags": [
- "FAQ管理"
+ "标签管理"
],
- "summary": "创建单个FAQ条目",
+ "summary": "获取标签列表",
"parameters": [
{
"type": "string",
@@ -4967,18 +5117,27 @@
"required": true
},
{
- "description": "FAQ条目",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload"
- }
+ "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": "创建的FAQ条目",
+ "description": "标签列表",
"schema": {
"type": "object",
"additionalProperties": true
@@ -4991,10 +5150,8 @@
}
}
}
- }
- },
- "/knowledge-bases/{id}/faq/import/last-result/display": {
- "put": {
+ },
+ "post": {
"security": [
{
"Bearer": []
@@ -5003,7 +5160,7 @@
"ApiKeyAuth": []
}
],
- "description": "更新FAQ知识库导入结果统计卡片的显示或隐藏状态",
+ "description": "在知识库下创建新标签",
"consumes": [
"application/json"
],
@@ -5011,9 +5168,9 @@
"application/json"
],
"tags": [
- "FAQ管理"
+ "标签管理"
],
- "summary": "更新FAQ最后一次导入结果显示状态",
+ "summary": "创建标签",
"parameters": [
{
"type": "string",
@@ -5023,18 +5180,29 @@
"required": true
},
{
- "description": "状态更新请求",
+ "description": "标签信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/internal_handler.updateLastFAQImportResultDisplayStatusRequest"
+ "type": "object",
+ "properties": {
+ "color": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "sort_order": {
+ "type": "integer"
+ }
+ }
}
}
],
"responses": {
"200": {
- "description": "更新成功",
+ "description": "创建的标签",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5045,18 +5213,12 @@
"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": {
+ "/knowledge-bases/{id}/tags/{tag_id}": {
+ "put": {
"security": [
{
"Bearer": []
@@ -5065,7 +5227,7 @@
"ApiKeyAuth": []
}
],
- "description": "使用混合搜索在FAQ中搜索,支持两级优先级标签召回:first_priority_tag_ids优先级最高,second_priority_tag_ids次之",
+ "description": "更新标签信息",
"consumes": [
"application/json"
],
@@ -5073,9 +5235,9 @@
"application/json"
],
"tags": [
- "FAQ管理"
+ "标签管理"
],
- "summary": "搜索FAQ",
+ "summary": "更新标签",
"parameters": [
{
"type": "string",
@@ -5085,18 +5247,25 @@
"required": true
},
{
- "description": "搜索请求",
+ "type": "string",
+ "description": "标签ID (UUID或seq_id)",
+ "name": "tag_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "标签更新信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQSearchRequest"
+ "type": "object"
}
}
],
"responses": {
"200": {
- "description": "搜索结果",
+ "description": "更新后的标签",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5109,10 +5278,8 @@
}
}
}
- }
- },
- "/knowledge-bases/{id}/hybrid-search": {
- "get": {
+ },
+ "delete": {
"security": [
{
"Bearer": []
@@ -5121,7 +5288,7 @@
"ApiKeyAuth": []
}
],
- "description": "在知识库中执行向量和关键词混合搜索",
+ "description": "删除标签,可使用force=true强制删除被引用的标签,content_only=true仅删除标签下的内容而保留标签本身",
"consumes": [
"application/json"
],
@@ -5129,9 +5296,9 @@
"application/json"
],
"tags": [
- "知识库"
+ "标签管理"
],
- "summary": "混合搜索",
+ "summary": "删除标签",
"parameters": [
{
"type": "string",
@@ -5141,18 +5308,36 @@
"required": true
},
{
- "description": "搜索参数",
- "name": "request",
+ "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",
- "required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SearchParams"
+ "$ref": "#/definitions/internal_handler.DeleteTagRequest"
}
}
],
"responses": {
"200": {
- "description": "搜索结果",
+ "description": "删除成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5167,7 +5352,7 @@
}
}
},
- "/knowledge-bases/{id}/knowledge": {
+ "/knowledge/batch": {
"get": {
"security": [
{
@@ -5177,7 +5362,7 @@
"ApiKeyAuth": []
}
],
- "description": "获取知识库下的知识列表,支持分页和筛选",
+ "description": "根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的租户解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属租户查询(用于刷新后恢复共享知识库下的文件)",
"consumes": [
"application/json"
],
@@ -5187,67 +5372,29 @@
"tags": [
"知识管理"
],
- "summary": "获取知识列表",
+ "summary": "批量获取知识",
"parameters": [
{
- "type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "collectionFormat": "csv",
+ "description": "知识ID列表",
+ "name": "ids",
+ "in": "query",
"required": true
},
- {
- "type": "integer",
- "description": "页码",
- "name": "page",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "每页数量",
- "name": "page_size",
- "in": "query"
- },
- {
- "type": "string",
- "description": "标签ID筛选",
- "name": "tag_id",
- "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",
+ "description": "可选,知识库ID(用于共享知识库时指定范围)",
+ "name": "kb_id",
"in": "query"
},
{
"type": "string",
- "description": "更新时间终点,RFC3339 格式",
- "name": "end_time",
+ "description": "可选,共享智能体ID(用于按智能体租户批量拉取文件详情)",
+ "name": "agent_id",
"in": "query"
}
],
@@ -5266,8 +5413,10 @@
}
}
}
- },
- "delete": {
+ }
+ },
+ "/knowledge/batch-delete": {
+ "post": {
"security": [
{
"Bearer": []
@@ -5276,7 +5425,7 @@
"ApiKeyAuth": []
}
],
- "description": "删除知识库下的所有知识条目(异步任务)。知识库本身保留,仅清空其中的内容",
+ "description": "按 ID 列表批量删除单个知识库下的多个知识条目",
"consumes": [
"application/json"
],
@@ -5286,19 +5435,21 @@
"tags": [
"知识管理"
],
- "summary": "清空知识库内容",
+ "summary": "批量删除知识",
"parameters": [
{
- "type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "批量删除请求",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/internal_handler.BatchDeleteKnowledgeRequest"
+ }
}
],
"responses": {
"200": {
- "description": "清空任务已提交",
+ "description": "删除成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5319,8 +5470,8 @@
}
}
},
- "/knowledge-bases/{id}/knowledge/file": {
- "post": {
+ "/knowledge/image/{id}/{chunk_id}": {
+ "put": {
"security": [
{
"Bearer": []
@@ -5329,9 +5480,9 @@
"ApiKeyAuth": []
}
],
- "description": "上传文件并创建知识条目",
+ "description": "更新知识分块的图像信息",
"consumes": [
- "multipart/form-data"
+ "application/json"
],
"produces": [
"application/json"
@@ -5339,44 +5490,40 @@
"tags": [
"知识管理"
],
- "summary": "从文件创建知识",
+ "summary": "更新图像信息",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "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"
+ "description": "分块ID",
+ "name": "chunk_id",
+ "in": "path",
+ "required": true
},
{
- "type": "boolean",
- "description": "启用多模态处理",
- "name": "enable_multimodel",
- "in": "formData"
+ "description": "图像信息",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "image_info": {
+ "type": "string"
+ }
+ }
+ }
}
],
"responses": {
"200": {
- "description": "创建的知识",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5387,19 +5534,12 @@
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- },
- "409": {
- "description": "文件重复",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
}
}
}
},
- "/knowledge-bases/{id}/knowledge/manual": {
- "post": {
+ "/knowledge/manual/{id}": {
+ "put": {
"security": [
{
"Bearer": []
@@ -5408,7 +5548,7 @@
"ApiKeyAuth": []
}
],
- "description": "手工录入Markdown格式的知识内容",
+ "description": "更新手工录入的Markdown知识内容",
"consumes": [
"application/json"
],
@@ -5418,11 +5558,11 @@
"tags": [
"知识管理"
],
- "summary": "手工创建知识",
+ "summary": "更新手工知识",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "description": "知识ID",
"name": "id",
"in": "path",
"required": true
@@ -5439,7 +5579,7 @@
],
"responses": {
"200": {
- "description": "创建的知识",
+ "description": "更新后的知识",
"schema": {
"type": "object",
"additionalProperties": true
@@ -5454,7 +5594,7 @@
}
}
},
- "/knowledge-bases/{id}/knowledge/url": {
+ "/knowledge/move": {
"post": {
"security": [
{
@@ -5464,7 +5604,7 @@
"ApiKeyAuth": []
}
],
- "description": "从指定URL抓取内容并创建知识条目。当提供 file_name/file_type 或 URL 路径含已知文件扩展名时,自动切换为文件下载模式",
+ "description": "将一条或多条知识从源知识库移动到目标知识库(异步),返回任务 ID 用于查询进度",
"consumes": [
"application/json"
],
@@ -5472,53 +5612,25 @@
"application/json"
],
"tags": [
- "知识管理"
+ "知识"
],
- "summary": "从URL创建知识",
+ "summary": "移动知识到其他知识库",
"parameters": [
{
- "type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
- "required": true
- },
- {
- "description": "URL请求",
+ "description": "{source_kb_id, target_kb_id, knowledge_ids}",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "type": "object",
- "properties": {
- "enable_multimodel": {
- "type": "boolean"
- },
- "file_name": {
- "type": "string"
- },
- "file_type": {
- "type": "string"
- },
- "tag_id": {
- "type": "string"
- },
- "title": {
- "type": "string"
- },
- "url": {
- "type": "string"
- }
- }
+ "$ref": "#/definitions/internal_handler.MoveKnowledgeRequest"
}
}
],
- "responses": {
- "201": {
- "description": "创建的知识",
+ "responses": {
+ "200": {
+ "description": "任务信息",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/internal_handler.MoveKnowledgeResponse"
}
},
"400": {
@@ -5526,18 +5638,11 @@
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
- },
- "409": {
- "description": "URL重复",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
}
}
}
},
- "/knowledge-bases/{id}/move-targets": {
+ "/knowledge/move/progress/{task_id}": {
"get": {
"security": [
{
@@ -5547,39 +5652,32 @@
"ApiKeyAuth": []
}
],
- "description": "返回与源知识库 Type 一致、EmbeddingModelID 一致、非临时且不是自身的目标知识库列表",
+ "description": "按任务 ID 查询移动进度",
"produces": [
"application/json"
],
"tags": [
- "知识库"
+ "知识"
],
- "summary": "获取可移动目标知识库列表",
+ "summary": "获取知识移动进度",
"parameters": [
{
"type": "string",
- "description": "源知识库 ID",
- "name": "id",
+ "description": "移动任务 ID",
+ "name": "task_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "可移动目标列表",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "进度信息",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeMoveProgress"
}
},
"404": {
- "description": "知识库不存在",
+ "description": "任务不存在",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -5587,8 +5685,8 @@
}
}
},
- "/knowledge-bases/{id}/pin": {
- "put": {
+ "/knowledge/search": {
+ "get": {
"security": [
{
"Bearer": []
@@ -5597,7 +5695,7 @@
"ApiKeyAuth": []
}
],
- "description": "切换知识库的置顶状态",
+ "description": "Search knowledge files by keyword. When agent_id is set (shared agent), scope is the agent's configured knowledge bases.",
"consumes": [
"application/json"
],
@@ -5605,28 +5703,51 @@
"application/json"
],
"tags": [
- "知识库"
+ "Knowledge"
],
- "summary": "置顶/取消置顶知识库",
+ "summary": "Search knowledge",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
- "required": true
+ "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"
}
],
"responses": {
"200": {
- "description": "更新后的知识库",
+ "description": "Search results",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "404": {
- "description": "知识库不存在",
+ "400": {
+ "description": "Invalid request",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -5634,46 +5755,66 @@
}
}
},
- "/knowledge-bases/{id}/shares": {
- "get": {
+ "/knowledge/tags": {
+ "put": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "获取知识库的所有共享记录",
+ "description": "批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的租户解析",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "知识库共享"
+ "知识管理"
],
- "summary": "获取知识库的共享列表",
+ "summary": "批量更新知识标签",
"parameters": [
{
- "type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
- "required": true
+ "description": "标签更新请求(updates 必填,kb_id 可选)",
+ "name": "request",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "object"
+ }
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "更新成功",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ListSharesResponse"
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "400": {
+ "description": "请求参数错误",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- },
- "post": {
+ }
+ },
+ "/knowledge/{id}": {
+ "get": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "将知识库共享到指定组织",
+ "description": "根据ID获取知识条目详情",
"consumes": [
"application/json"
],
@@ -5681,52 +5822,50 @@
"application/json"
],
"tags": [
- "知识库共享"
+ "知识管理"
],
- "summary": "共享知识库到组织",
+ "summary": "获取知识详情",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "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",
+ "200": {
+ "description": "知识详情",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "403": {
- "description": "Forbidden",
+ "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}/shares/{share_id}": {
+ },
"put": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "更新知识库共享的权限级别",
+ "description": "更新知识条目信息",
"consumes": [
"application/json"
],
@@ -5734,44 +5873,37 @@
"application/json"
],
"tags": [
- "知识库共享"
+ "知识管理"
],
- "summary": "更新共享权限",
+ "summary": "更新知识",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "description": "知识ID",
"name": "id",
"in": "path",
"required": true
},
{
- "type": "string",
- "description": "共享记录ID",
- "name": "share_id",
- "in": "path",
- "required": true
- },
- {
- "description": "权限信息",
+ "description": "知识信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.UpdateSharePermissionRequest"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Knowledge"
}
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "更新成功",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "403": {
- "description": "Forbidden",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -5782,39 +5914,41 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "取消知识库的共享",
+ "description": "根据ID删除知识条目",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "知识库共享"
+ "知识管理"
],
- "summary": "取消共享",
+ "summary": "删除知识",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "description": "知识ID",
"name": "id",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "共享记录ID",
- "name": "share_id",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "删除成功",
"schema": {
"type": "object",
"additionalProperties": true
}
},
- "403": {
- "description": "Forbidden",
+ "400": {
+ "description": "请求参数错误",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -5822,7 +5956,7 @@
}
}
},
- "/knowledge-bases/{id}/tags": {
+ "/knowledge/{id}/download": {
"get": {
"security": [
{
@@ -5832,50 +5966,31 @@
"ApiKeyAuth": []
}
],
- "description": "获取知识库下的所有标签及统计信息",
+ "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"
- },
+ "application/octet-stream"
+ ],
+ "tags": [
+ "知识管理"
+ ],
+ "summary": "下载知识文件",
+ "parameters": [
{
"type": "string",
- "description": "关键词搜索",
- "name": "keyword",
- "in": "query"
+ "description": "知识ID",
+ "name": "id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
- "description": "标签列表",
+ "description": "文件内容",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "type": "file"
}
},
"400": {
@@ -5885,8 +6000,10 @@
}
}
}
- },
- "post": {
+ }
+ },
+ "/knowledge/{id}/preview": {
+ "get": {
"security": [
{
"Bearer": []
@@ -5895,52 +6012,34 @@
"ApiKeyAuth": []
}
],
- "description": "在知识库下创建新标签",
+ "description": "返回知识条目关联的原始文件,Content-Type 根据文件类型设置,用于浏览器内嵌预览",
"consumes": [
"application/json"
],
"produces": [
- "application/json"
+ "application/pdf",
+ "image/jpeg",
+ "image/png",
+ "text/plain"
],
"tags": [
- "标签管理"
+ "知识管理"
],
- "summary": "创建标签",
+ "summary": "预览知识文件",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "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": "创建的标签",
+ "description": "文件内容",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "type": "file"
}
},
"400": {
@@ -5952,8 +6051,8 @@
}
}
},
- "/knowledge-bases/{id}/tags/{tag_id}": {
- "put": {
+ "/knowledge/{id}/reparse": {
+ "post": {
"security": [
{
"Bearer": []
@@ -5962,7 +6061,7 @@
"ApiKeyAuth": []
}
],
- "description": "更新标签信息",
+ "description": "删除知识中现有的文档内容并重新解析,使用异步任务方式处理",
"consumes": [
"application/json"
],
@@ -5970,37 +6069,21 @@
"application/json"
],
"tags": [
- "标签管理"
+ "知识管理"
],
- "summary": "更新标签",
+ "summary": "重新解析知识",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
+ "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": "更新后的标签",
+ "description": "重新解析任务已提交",
"schema": {
"type": "object",
"additionalProperties": true
@@ -6011,279 +6094,224 @@
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
+ },
+ "403": {
+ "description": "权限不足",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
}
}
- },
- "delete": {
+ }
+ },
+ "/knowledgebase/{kb_id}/wiki/auto-fix": {
+ "post": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "删除标签,可使用force=true强制删除被引用的标签,content_only=true仅删除标签下的内容而保留标签本身",
- "consumes": [
- "application/json"
- ],
+ "description": "Automatically fix fixable wiki issues (broken links, etc.)",
"produces": [
"application/json"
],
"tags": [
- "标签管理"
+ "Wiki"
],
- "summary": "删除标签",
+ "summary": "Auto-fix wiki issues",
"parameters": [
{
"type": "string",
- "description": "知识库ID",
- "name": "id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "标签ID (UUID或seq_id)",
- "name": "tag_id",
+ "description": "Knowledge base ID",
+ "name": "kb_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": "删除成功",
+ "description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
- },
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
}
}
}
},
- "/knowledge/batch": {
+ "/knowledgebase/{kb_id}/wiki/graph": {
"get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的租户解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属租户查询(用于刷新后恢复共享知识库下的文件)",
- "consumes": [
- "application/json"
- ],
+ "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": "批量获取知识",
+ "summary": "Get wiki link graph",
"parameters": [
{
- "type": "array",
- "items": {
- "type": "string"
- },
- "collectionFormat": "csv",
- "description": "知识ID列表",
- "name": "ids",
- "in": "query",
+ "type": "string",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
+ "in": "path",
"required": true
},
{
"type": "string",
- "description": "可选,知识库ID(用于共享知识库时指定范围)",
- "name": "kb_id",
+ "description": "overview (default) | ego",
+ "name": "mode",
"in": "query"
},
{
"type": "string",
- "description": "可选,共享智能体ID(用于按智能体租户批量拉取文件详情)",
- "name": "agent_id",
+ "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": "知识列表",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiGraphData"
}
}
}
}
},
- "/knowledge/batch-delete": {
- "post": {
+ "/knowledgebase/{kb_id}/wiki/index": {
+ "get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "按 ID 列表批量删除单个知识库下的多个知识条目",
- "consumes": [
- "application/json"
- ],
+ "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": "批量删除知识",
+ "summary": "Get wiki index view",
"parameters": [
{
- "description": "批量删除请求",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.BatchDeleteKnowledgeRequest"
- }
+ "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": "删除成功",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
- }
- },
- "403": {
- "description": "权限不足",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiIndexResponse"
}
}
}
}
},
- "/knowledge/image/{id}/{chunk_id}": {
- "put": {
+ "/knowledgebase/{kb_id}/wiki/issues": {
+ "get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "更新知识分块的图像信息",
- "consumes": [
- "application/json"
- ],
+ "description": "List issues flagged on wiki pages with optional filtering",
"produces": [
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "更新图像信息",
+ "summary": "List wiki page issues",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "分块ID",
- "name": "chunk_id",
- "in": "path",
- "required": true
+ "description": "Filter by page slug",
+ "name": "slug",
+ "in": "query"
},
{
- "description": "图像信息",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "type": "object",
- "properties": {
- "image_info": {
- "type": "string"
- }
- }
- }
+ "type": "string",
+ "description": "Filter by status (pending, ignored, resolved)",
+ "name": "status",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "更新成功",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageIssue"
+ }
}
}
}
}
},
- "/knowledge/manual/{id}": {
+ "/knowledgebase/{kb_id}/wiki/issues/{issue_id}/status": {
"put": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "更新手工录入的Markdown知识内容",
+ "description": "Update the status of a flagged wiki page issue",
"consumes": [
"application/json"
],
@@ -6291,37 +6319,46 @@
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "更新手工知识",
+ "summary": "Update wiki page issue status",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
"in": "path",
"required": true
},
{
- "description": "手工知识内容",
- "name": "request",
+ "type": "string",
+ "description": "Issue ID",
+ "name": "issue_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "New status {'status': 'ignored'}",
+ "name": "status",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ManualKnowledgePayload"
+ "type": "object"
}
}
],
"responses": {
"200": {
- "description": "更新后的知识",
+ "description": "OK",
"schema": {
"type": "object",
- "additionalProperties": true
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"400": {
- "description": "请求参数错误",
+ "description": "Bad Request",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -6329,178 +6366,174 @@
}
}
},
- "/knowledge/move": {
- "post": {
+ "/knowledgebase/{kb_id}/wiki/lint": {
+ "get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "将一条或多条知识从源知识库移动到目标知识库(异步),返回任务 ID 用于查询进度",
- "consumes": [
- "application/json"
- ],
+ "description": "Perform a comprehensive health check on the wiki",
"produces": [
"application/json"
],
"tags": [
- "知识"
+ "Wiki"
],
- "summary": "移动知识到其他知识库",
+ "summary": "Run wiki lint",
"parameters": [
{
- "description": "{source_kb_id, target_kb_id, knowledge_ids}",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/internal_handler.MoveKnowledgeRequest"
- }
+ "type": "string",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
- "description": "任务信息",
- "schema": {
- "$ref": "#/definitions/internal_handler.MoveKnowledgeResponse"
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_application_service.WikiLintReport"
}
}
}
}
},
- "/knowledge/move/progress/{task_id}": {
+ "/knowledgebase/{kb_id}/wiki/log": {
"get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "按任务 ID 查询移动进度",
+ "description": "Returns a paginated feed of wiki operation events (ingest, retract, ...)\nnewest-first. Pagination is cursor-based: pass `next_cursor` from the\nprevious response back as `cursor` to fetch the next page.",
"produces": [
"application/json"
],
"tags": [
- "知识"
+ "Wiki"
],
- "summary": "获取知识移动进度",
+ "summary": "Get wiki operation log",
"parameters": [
{
"type": "string",
- "description": "移动任务 ID",
- "name": "task_id",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
"in": "path",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "Opaque cursor from the previous page (empty = newest)",
+ "name": "cursor",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "Page size, 1-200 (default 50)",
+ "name": "limit",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "进度信息",
- "schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeMoveProgress"
- }
- },
- "404": {
- "description": "任务不存在",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiLogEntryListResponse"
}
}
}
}
},
- "/knowledge/search": {
+ "/knowledgebase/{kb_id}/wiki/pages": {
"get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "Search knowledge files by keyword. When agent_id is set (shared agent), scope is the agent's configured knowledge bases.",
- "consumes": [
- "application/json"
- ],
+ "description": "List wiki pages with optional filtering and pagination",
"produces": [
"application/json"
],
"tags": [
- "Knowledge"
+ "Wiki"
],
- "summary": "Search knowledge",
+ "summary": "List wiki pages",
"parameters": [
{
"type": "string",
- "description": "Keyword to search",
- "name": "keyword",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Filter by page type",
+ "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": "Offset for pagination",
- "name": "offset",
+ "description": "Page number",
+ "name": "page",
"in": "query"
},
{
"type": "integer",
- "description": "Limit for pagination (default 20)",
- "name": "limit",
+ "description": "Page size",
+ "name": "page_size",
"in": "query"
},
{
"type": "string",
- "description": "Comma-separated file extensions to filter (e.g., csv,xlsx)",
- "name": "file_types",
+ "description": "Sort field",
+ "name": "sort_by",
"in": "query"
},
{
"type": "string",
- "description": "Shared agent ID (search within agent's KB scope)",
- "name": "agent_id",
+ "description": "Sort order (asc/desc)",
+ "name": "sort_order",
"in": "query"
}
],
"responses": {
"200": {
- "description": "Search results",
+ "description": "OK",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageListResponse"
}
},
"400": {
- "description": "Invalid request",
+ "description": "Bad Request",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
}
}
- }
- },
- "/knowledge/tags": {
- "put": {
+ },
+ "post": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的租户解析",
+ "description": "Create a new wiki page in the knowledge base",
"consumes": [
"application/json"
],
@@ -6508,30 +6541,36 @@
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "批量更新知识标签",
+ "summary": "Create a wiki page",
"parameters": [
{
- "description": "标签更新请求(updates 必填,kb_id 可选)",
- "name": "request",
+ "type": "string",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "Wiki page data",
+ "name": "page",
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
}
}
],
"responses": {
- "200": {
- "description": "更新成功",
+ "201": {
+ "description": "Created",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
}
},
"400": {
- "description": "请求参数错误",
+ "description": "Bad Request",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -6539,52 +6578,46 @@
}
}
},
- "/knowledge/{id}": {
+ "/knowledgebase/{kb_id}/wiki/pages/{slug}": {
"get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "根据ID获取知识条目详情",
- "consumes": [
- "application/json"
- ],
+ "description": "Retrieve a wiki page by its slug",
"produces": [
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "获取知识详情",
+ "summary": "Get a wiki page by slug",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "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": "知识详情",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
}
},
"404": {
- "description": "知识不存在",
+ "description": "Not Found",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -6595,12 +6628,9 @@
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "更新知识条目信息",
+ "description": "Update an existing wiki page by slug",
"consumes": [
"application/json"
],
@@ -6608,37 +6638,43 @@
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "更新知识",
+ "summary": "Update a wiki page",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
"in": "path",
"required": true
},
{
- "description": "知识信息",
- "name": "request",
+ "type": "string",
+ "description": "Page slug",
+ "name": "slug",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "Updated wiki page data",
+ "name": "page",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Knowledge"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
}
}
],
"responses": {
"200": {
- "description": "更新成功",
+ "description": "OK",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
}
},
- "400": {
- "description": "请求参数错误",
+ "404": {
+ "description": "Not Found",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -6649,41 +6685,35 @@
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "根据ID删除知识条目",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "Soft-delete a wiki page by slug",
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "删除知识",
+ "summary": "Delete a wiki page",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "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": "删除成功",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
+ "204": {
+ "description": "No Content"
},
- "400": {
- "description": "请求参数错误",
+ "404": {
+ "description": "Not Found",
"schema": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
}
@@ -6691,149 +6721,119 @@
}
}
},
- "/knowledge/{id}/download": {
- "get": {
+ "/knowledgebase/{kb_id}/wiki/rebuild-links": {
+ "post": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "下载知识条目关联的原始文件",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/octet-stream"
- ],
+ "description": "Re-parse all pages and rebuild bidirectional link references",
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "下载知识文件",
+ "summary": "Rebuild wiki links",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "description": "Knowledge base ID",
+ "name": "kb_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "文件内容",
- "schema": {
- "type": "file"
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
}
},
- "/knowledge/{id}/preview": {
+ "/knowledgebase/{kb_id}/wiki/search": {
"get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "返回知识条目关联的原始文件,Content-Type 根据文件类型设置,用于浏览器内嵌预览",
- "consumes": [
- "application/json"
- ],
+ "description": "Full-text search over wiki pages",
"produces": [
- "application/pdf",
- "image/jpeg",
- "image/png",
- "text/plain"
+ "application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "预览知识文件",
+ "summary": "Search wiki pages",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "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": "文件内容",
- "schema": {
- "type": "file"
- }
- },
- "400": {
- "description": "请求参数错误",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage"
+ }
}
}
}
}
},
- "/knowledge/{id}/reparse": {
- "post": {
+ "/knowledgebase/{kb_id}/wiki/stats": {
+ "get": {
"security": [
{
"Bearer": []
- },
- {
- "ApiKeyAuth": []
}
],
- "description": "删除知识中现有的文档内容并重新解析,使用异步任务方式处理",
- "consumes": [
- "application/json"
- ],
+ "description": "Returns aggregate statistics about the wiki",
"produces": [
"application/json"
],
"tags": [
- "知识管理"
+ "Wiki"
],
- "summary": "重新解析知识",
+ "summary": "Get wiki statistics",
"parameters": [
{
"type": "string",
- "description": "知识ID",
- "name": "id",
+ "description": "Knowledge base ID",
+ "name": "kb_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": "权限不足",
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiStats"
}
}
}
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index f2415fd33..a7c6cb08e 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -4854,693 +4854,693 @@ paths:
summary: 获取智能体类型预设列表
tags:
- 智能体
- /api/v1/datasource:
- get:
- description: List all data sources for a specific knowledge base
- parameters:
- - description: Knowledge base ID
- in: query
- name: kb_id
- required: true
- type: string
+ /auth/auto-setup:
+ post:
+ consumes:
+ - application/json
+ description: Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程
produces:
- application/json
responses:
"200":
description: OK
schema:
- items:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
- type: array
- "400":
- description: Bad Request
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse'
+ "403":
+ description: 非 Lite 版本
schema:
- additionalProperties:
- type: string
- type: object
- summary: List data sources for a knowledge base
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ summary: 自动初始化(Lite 桌面版)
tags:
- - DataSource
+ - 认证
+ /auth/change-password:
post:
consumes:
- application/json
- description: Create a new data source configuration for a knowledge base
+ description: 修改当前用户的登录密码
parameters:
- - description: Data source configuration
+ - description: 密码修改请求
in: body
name: request
required: true
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
+ properties:
+ new_password:
+ type: string
+ old_password:
+ type: string
+ type: object
produces:
- application/json
responses:
- "201":
- description: Created
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
- "400":
- description: Bad Request
+ "200":
+ description: 修改成功
schema:
- additionalProperties:
- type: string
+ additionalProperties: true
type: object
- summary: Create a new data source
- tags:
- - DataSource
- /api/v1/datasource/{id}:
- delete:
- description: Delete a data source (soft delete)
- parameters:
- - description: Data source ID
- in: path
- name: id
- required: true
- type: string
- responses:
- "204":
- description: No Content
- "404":
- description: Not Found
+ "400":
+ description: 请求参数错误
schema:
- additionalProperties:
- type: string
- type: object
- summary: Delete a data source
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ summary: 修改密码
tags:
- - DataSource
+ - 认证
+ /auth/config:
get:
- description: Retrieve a data source configuration by ID
- parameters:
- - description: Data source ID
- in: path
- name: id
- required: true
- type: string
+ consumes:
+ - application/json
+ description: 返回当前部署的注册模式等公开认证配置,供前端决定是否展示注册入口
produces:
- application/json
responses:
"200":
- description: OK
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
- "404":
- description: Not Found
+ description: 认证配置
schema:
- additionalProperties:
- type: string
+ additionalProperties: true
type: object
- summary: Get a data source by ID
+ summary: 获取认证配置
tags:
- - DataSource
- put:
+ - 认证
+ /auth/login:
+ post:
consumes:
- application/json
- description: Update an existing data source configuration
+ description: 用户登录并获取访问令牌
parameters:
- - description: Data source ID
- in: path
- name: id
- required: true
- type: string
- - description: Updated configuration
+ - description: 登录请求参数
in: body
name: request
required: true
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.LoginRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
- "400":
- description: Bad Request
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse'
+ "401":
+ description: 认证失败
schema:
- additionalProperties:
- type: string
- type: object
- summary: Update a data source
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ summary: 用户登录
tags:
- - DataSource
- /api/v1/datasource/{id}/logs:
- get:
- description: Retrieve sync history for a data source
- parameters:
- - description: Data source ID
- in: path
- name: id
- required: true
- type: string
- - description: 'Limit (default: 10)'
- in: query
- name: limit
- type: integer
- - description: 'Offset (default: 0)'
- in: query
- name: offset
- type: integer
+ - 认证
+ /auth/logout:
+ post:
+ consumes:
+ - application/json
+ description: 撤销当前访问令牌并登出
produces:
- application/json
responses:
"200":
- description: OK
+ description: 登出成功
schema:
- items:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog'
- type: array
+ additionalProperties: true
+ type: object
"400":
- description: Bad Request
+ description: 请求参数错误
schema:
- additionalProperties:
- type: string
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ summary: 用户登出
+ tags:
+ - 认证
+ /auth/me:
+ get:
+ consumes:
+ - application/json
+ description: 获取当前登录用户的详细信息
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 用户信息
+ schema:
+ additionalProperties: true
type: object
- summary: Get sync logs
+ "401":
+ description: 未授权
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ summary: 获取当前用户信息
tags:
- - DataSource
- /api/v1/datasource/{id}/pause:
- post:
- description: Pause a data source's scheduled syncs
+ - 认证
+ /auth/me/preferences:
+ put:
+ consumes:
+ - application/json
+ description: |-
+ 按 PATCH 语义合并用户偏好(仅覆盖请求体里出现的字段,其余字段保持不变),
+ 数据存放在 users.preferences (JSON),跨设备/浏览器自动同步。
parameters:
- - description: Data source ID
- in: path
- name: id
+ - description: Preferences patch
+ in: body
+ name: request
required: true
- type: string
+ schema:
+ $ref: '#/definitions/internal_handler.updateMyPreferencesRequest'
+ produces:
+ - application/json
responses:
"200":
- description: OK
+ description: 更新后的偏好
schema:
- additionalProperties:
- type: string
+ additionalProperties: true
type: object
"400":
- description: Bad Request
+ description: 请求参数错误
schema:
- additionalProperties:
- type: string
- type: object
- summary: Pause data source
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "401":
+ description: 未授权
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ summary: 更新当前用户的个性化设置
tags:
- - DataSource
- /api/v1/datasource/{id}/resources:
+ - 认证
+ /auth/oidc/callback:
get:
- description: List resources available for sync in the external system
+ consumes:
+ - application/json
+ description: 接收OIDC provider回调并由后端完成code交换,随后重定向回前端登录页
parameters:
- - description: Data source ID
- in: path
- name: id
- required: true
+ - description: OIDC授权码
+ in: query
+ name: code
+ type: string
+ - description: OIDC状态
+ in: query
+ name: state
+ type: string
+ - description: OIDC错误码
+ in: query
+ name: error
type: string
produces:
- application/json
+ responses:
+ "302":
+ description: Found
+ summary: OIDC登录重定向回调
+ tags:
+ - 认证
+ /auth/oidc/config:
+ get:
+ consumes:
+ - application/json
+ description: 返回OIDC是否启用以及provider展示名称,供前端决定是否展示OIDC登录入口
+ produces:
+ - application/json
responses:
"200":
description: OK
schema:
- items:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.Resource'
- type: array
- "400":
- description: Bad Request
- schema:
- additionalProperties:
- type: string
- type: object
- summary: List available resources in data source
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCConfigResponse'
+ summary: 获取OIDC登录配置
tags:
- - DataSource
- /api/v1/datasource/{id}/resume:
- post:
- description: Resume a paused data source
+ - 认证
+ /auth/oidc/url:
+ get:
+ consumes:
+ - application/json
+ description: 根据后端OIDC配置生成第三方登录跳转地址
parameters:
- - description: Data source ID
- in: path
- name: id
+ - description: OIDC回调地址
+ in: query
+ name: redirect_uri
required: true
type: string
+ produces:
+ - application/json
responses:
"200":
description: OK
schema:
- additionalProperties:
- type: string
- type: object
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCAuthURLResponse'
"400":
- description: Bad Request
+ description: 请求参数错误
schema:
- additionalProperties:
- type: string
- type: object
- summary: Resume data source
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "403":
+ description: OIDC未启用
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ summary: 获取OIDC授权地址
tags:
- - DataSource
- /api/v1/datasource/{id}/sync:
+ - 认证
+ /auth/refresh:
post:
- description: Trigger an immediate sync for a data source
+ consumes:
+ - application/json
+ description: 使用刷新令牌获取新的访问令牌
parameters:
- - description: Data source ID
- in: path
- name: id
+ - description: 刷新令牌
+ in: body
+ name: request
required: true
- type: string
+ schema:
+ properties:
+ refreshToken:
+ type: string
+ type: object
+ produces:
+ - application/json
responses:
"200":
- description: OK
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog'
- "400":
- description: Bad Request
+ description: 新令牌
schema:
- additionalProperties:
- type: string
+ additionalProperties: true
type: object
- summary: Trigger immediate sync
+ "401":
+ description: 令牌无效
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ summary: 刷新令牌
tags:
- - DataSource
- /api/v1/datasource/{id}/validate:
+ - 认证
+ /auth/register:
post:
- description: Validate the connection to an external data source
+ consumes:
+ - application/json
+ description: 注册新用户账号
parameters:
- - description: Data source ID
- in: path
- name: id
+ - description: 注册请求参数
+ in: body
+ name: request
required: true
- type: string
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterRequest'
+ produces:
+ - application/json
responses:
- "200":
- description: OK
+ "201":
+ description: Created
schema:
- additionalProperties:
- type: string
- type: object
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterResponse'
"400":
- description: Bad Request
+ description: 请求参数错误
schema:
- additionalProperties:
- type: string
- type: object
- summary: Test data source connection
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "403":
+ description: 注册功能已禁用
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ summary: 用户注册
tags:
- - DataSource
- /api/v1/datasource/logs/{log_id}:
- get:
- description: Retrieve a specific sync log entry
+ - 认证
+ /auth/switch-tenant:
+ post:
+ consumes:
+ - application/json
+ description: 为当前用户在目标租户重新签发访问令牌;要求该用户在目标租户存在 active 成员关系
parameters:
- - description: Sync log ID
- in: path
- name: log_id
+ - description: 切换请求
+ in: body
+ name: request
required: true
- type: string
+ schema:
+ properties:
+ refresh_token:
+ type: string
+ tenant_id:
+ type: integer
+ type: object
produces:
- application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog'
- "404":
- description: Not Found
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse'
+ "400":
+ description: 参数错误
schema:
- additionalProperties:
- type: string
- type: object
- summary: Get specific sync log
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "403":
+ description: 无该租户成员关系
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ summary: 切换激活租户
tags:
- - DataSource
- /api/v1/datasource/types:
+ - 认证
+ /auth/validate:
get:
- description: Get list of available data source connectors
+ consumes:
+ - application/json
+ description: 验证访问令牌是否有效
produces:
- application/json
responses:
"200":
- description: OK
+ description: 令牌有效
schema:
- items:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_datasource.ConnectorMetadata'
- type: array
- summary: Get available connectors
+ additionalProperties: true
+ type: object
+ "401":
+ description: 令牌无效
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ summary: 验证令牌
tags:
- - DataSource
- /api/v1/datasource/validate-credentials:
+ - 认证
+ /chunker/preview:
post:
consumes:
- application/json
- description: Validate connectivity to an external data source using type + credentials
+ description: 对提交的文本运行自适应分块器并返回分块预览,不写入数据库不生成 embedding。文本最大 64k 字符
parameters:
- - description: type and credentials
+ - description: '{text, chunking_config}'
in: body
name: request
required: true
schema:
- type: object
+ $ref: '#/definitions/internal_handler.PreviewChunkingRequest'
produces:
- application/json
responses:
"200":
- description: OK
+ description: 分块结果
schema:
- additionalProperties:
- type: string
- type: object
+ $ref: '#/definitions/internal_handler.PreviewChunkingResponse'
"400":
- description: Bad Request
+ description: 请求参数错误
schema:
- additionalProperties:
- type: string
+ additionalProperties: true
type: object
- summary: Test connection with raw credentials (no persistence)
- tags:
- - DataSource
- /api/v1/knowledgebase/{kb_id}/wiki/auto-fix:
- post:
- description: Automatically fix fixable wiki issues (broken links, etc.)
- parameters:
- - description: Knowledge base ID
- in: path
- name: kb_id
- required: true
- type: string
- produces:
- - application/json
- responses:
- "200":
- description: OK
+ "413":
+ description: 文本超过预览限制
+ schema:
+ additionalProperties: true
+ type: object
+ "504":
+ description: 分块超时
schema:
additionalProperties: true
type: object
security:
- Bearer: []
- summary: Auto-fix wiki issues
+ - ApiKeyAuth: []
+ summary: 预览分块结果
tags:
- - Wiki
- /api/v1/knowledgebase/{kb_id}/wiki/graph:
- get:
- description: |-
- Returns a slice of the wiki link graph for visualization. Supports
- `mode=overview` (top-N most-connected pages, default) and
- `mode=ego` (BFS neighborhood of a center slug) to keep response
- size tractable for knowledge bases with tens of thousands of pages.
+ - 分块
+ /chunks/{knowledge_id}:
+ delete:
+ consumes:
+ - application/json
+ description: 删除指定知识下的所有分块
parameters:
- - description: Knowledge base ID
+ - description: 知识ID
in: path
- name: kb_id
+ name: knowledge_id
required: true
type: string
- - description: overview (default) | ego
- in: query
- name: mode
- type: string
- - description: Center slug for ego mode
- in: query
- name: center
- type: string
- - description: Ego BFS depth (1-3, default 1)
- in: query
- name: depth
- type: integer
- - description: Comma-separated page_type allow-list
- in: query
- name: types
- type: string
- - description: Max nodes to return (default 500, max 2000)
- in: query
- name: limit
- type: integer
produces:
- application/json
responses:
"200":
- description: OK
+ description: 删除成功
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiGraphData'
+ additionalProperties: true
+ type: object
+ "400":
+ description: 请求参数错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- summary: Get wiki link graph
+ - ApiKeyAuth: []
+ summary: 删除知识下所有分块
tags:
- - Wiki
- /api/v1/knowledgebase/{kb_id}/wiki/index:
+ - 分块管理
get:
- description: |-
- Returns the wiki index as intro text plus per-type paginated
- directory groups. The heavy directory markdown that used to
- live in wiki_pages.content was replaced with this structured
- response so a KB with tens of thousands of pages no longer
- materializes megabytes of TEXT on every index open.
+ consumes:
+ - application/json
+ description: 获取指定知识下的所有分块列表,支持分页
parameters:
- - description: Knowledge base ID
+ - description: 知识ID
in: path
- name: kb_id
+ name: knowledge_id
required: true
type: string
- - description: 'Comma-separated page types (default: all content types)'
- in: query
- name: types
- type: string
- - description: Per-group window size, 1-200 (default 50)
+ - default: 1
+ description: 页码
in: query
- name: limit
+ name: page
type: integer
- - description: Opaque offset cursor from previous response
+ - default: 10
+ description: 每页数量
in: query
- name: cursor
- type: string
+ name: page_size
+ type: integer
produces:
- application/json
responses:
"200":
- description: OK
+ description: 分块列表
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiIndexResponse'
+ additionalProperties: true
+ type: object
+ "400":
+ description: 请求参数错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- summary: Get wiki index view
+ - ApiKeyAuth: []
+ summary: 获取知识分块列表
tags:
- - Wiki
- /api/v1/knowledgebase/{kb_id}/wiki/issues:
- get:
- description: List issues flagged on wiki pages with optional filtering
+ - 分块管理
+ /chunks/{knowledge_id}/{id}:
+ delete:
+ consumes:
+ - application/json
+ description: 删除指定的分块
parameters:
- - description: Knowledge base ID
+ - description: 知识ID
in: path
- name: kb_id
+ name: knowledge_id
required: true
type: string
- - description: Filter by page slug
- in: query
- name: slug
- type: string
- - description: Filter by status (pending, ignored, resolved)
- in: query
- name: status
+ - description: 分块ID
+ in: path
+ name: id
+ required: true
type: string
produces:
- application/json
responses:
"200":
- description: OK
+ description: 删除成功
schema:
- items:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageIssue'
- type: array
+ additionalProperties: true
+ type: object
+ "400":
+ description: 请求参数错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "404":
+ description: 分块不存在
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- summary: List wiki page issues
+ - ApiKeyAuth: []
+ summary: 删除分块
tags:
- - Wiki
- /api/v1/knowledgebase/{kb_id}/wiki/issues/{issue_id}/status:
+ - 分块管理
put:
consumes:
- application/json
- description: Update the status of a flagged wiki page issue
+ description: 更新指定分块的内容和属性
parameters:
- - description: Knowledge base ID
+ - description: 知识ID
in: path
- name: kb_id
+ name: knowledge_id
required: true
type: string
- - description: Issue ID
+ - description: 分块ID
in: path
- name: issue_id
+ name: id
required: true
type: string
- - description: 'New status {''status'': ''ignored''}'
+ - description: 更新请求
in: body
- name: status
+ name: request
required: true
schema:
- type: object
+ $ref: '#/definitions/internal_handler.UpdateChunkRequest'
produces:
- application/json
responses:
"200":
- description: OK
+ description: 更新后的分块
schema:
- additionalProperties:
- type: string
+ additionalProperties: true
type: object
"400":
- description: Bad Request
+ description: 请求参数错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "404":
+ description: 分块不存在
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- summary: Update wiki page issue status
+ - ApiKeyAuth: []
+ summary: 更新分块
tags:
- - Wiki
- /api/v1/knowledgebase/{kb_id}/wiki/lint:
+ - 分块管理
+ /chunks/by-id/{id}:
get:
- description: Perform a comprehensive health check on the wiki
+ consumes:
+ - application/json
+ description: 仅通过分块ID获取分块详情(不需要knowledge_id);支持共享知识库下的分块访问
parameters:
- - description: Knowledge base ID
+ - description: 分块ID
in: path
- name: kb_id
+ name: id
required: true
type: string
produces:
- application/json
responses:
"200":
- description: OK
+ description: 分块详情
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_application_service.WikiLintReport'
+ additionalProperties: true
+ type: object
+ "400":
+ description: 请求参数错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "404":
+ description: 分块不存在
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- summary: Run wiki lint
+ - ApiKeyAuth: []
+ summary: 通过ID获取分块
tags:
- - Wiki
- /api/v1/knowledgebase/{kb_id}/wiki/log:
- get:
- description: |-
- Returns a paginated feed of wiki operation events (ingest, retract, ...)
- newest-first. Pagination is cursor-based: pass `next_cursor` from the
- previous response back as `cursor` to fetch the next page.
+ - 分块管理
+ /chunks/by-id/{id}/questions:
+ delete:
+ consumes:
+ - application/json
+ description: 删除分块中生成的问题
parameters:
- - description: Knowledge base ID
+ - description: 分块ID
in: path
- name: kb_id
+ name: id
required: true
type: string
- - description: Opaque cursor from the previous page (empty = newest)
- in: query
- name: cursor
- type: string
- - description: Page size, 1-200 (default 50)
- in: query
- name: limit
- type: integer
+ - description: 问题ID
+ in: body
+ name: request
+ required: true
+ schema:
+ properties:
+ question_id:
+ type: string
+ type: object
produces:
- application/json
responses:
"200":
- description: OK
+ description: 删除成功
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiLogEntryListResponse'
+ additionalProperties: true
+ type: object
+ "400":
+ description: 请求参数错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "404":
+ description: 分块不存在
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- summary: Get wiki operation log
+ - ApiKeyAuth: []
+ summary: 删除生成的问题
tags:
- - Wiki
- /api/v1/knowledgebase/{kb_id}/wiki/pages:
+ - 分块管理
+ /datasource:
get:
- description: List wiki pages with optional filtering and pagination
+ description: List all data sources for a specific knowledge base
parameters:
- description: Knowledge base ID
- in: path
+ in: query
name: kb_id
required: true
type: string
- - description: Filter by page type
- in: query
- name: page_type
- type: string
- - description: Filter by status
- in: query
- name: status
- type: string
- - description: Full-text search
- in: query
- name: query
- type: string
- - description: Page number
- in: query
- name: page
- type: integer
- - description: Page size
- in: query
- name: page_size
- type: integer
- - description: Sort field
- in: query
- name: sort_by
- type: string
- - description: Sort order (asc/desc)
- in: query
- name: sort_order
- type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageListResponse'
+ items:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
+ type: array
"400":
description: Bad Request
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- summary: List wiki pages
+ additionalProperties:
+ type: string
+ type: object
+ summary: List data sources for a knowledge base
tags:
- - Wiki
+ - DataSource
post:
consumes:
- application/json
- description: Create a new wiki page in the knowledge base
+ description: Create a new data source configuration for a knowledge base
parameters:
- - description: Knowledge base ID
- in: path
- name: kb_id
- required: true
- type: string
- - description: Wiki page data
+ - description: Data source configuration
in: body
- name: page
+ name: request
required: true
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
produces:
- application/json
responses:
"201":
description: Created
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
"400":
description: Bad Request
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- summary: Create a wiki page
+ additionalProperties:
+ type: string
+ type: object
+ summary: Create a new data source
tags:
- - Wiki
- /api/v1/knowledgebase/{kb_id}/wiki/pages/{slug}:
+ - DataSource
+ /datasource/{id}:
delete:
- description: Soft-delete a wiki page by slug
+ description: Delete a data source (soft delete)
parameters:
- - description: Knowledge base ID
- in: path
- name: kb_id
- required: true
- type: string
- - description: Page slug
+ - description: Data source ID
in: path
- name: slug
+ name: id
required: true
type: string
responses:
@@ -5549,117 +5549,85 @@ paths:
"404":
description: Not Found
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- summary: Delete a wiki page
+ additionalProperties:
+ type: string
+ type: object
+ summary: Delete a data source
tags:
- - Wiki
+ - DataSource
get:
- description: Retrieve a wiki page by its slug
- parameters:
- - description: Knowledge base ID
- in: path
- name: kb_id
- required: true
- type: string
- - description: Page slug
- in: path
- name: slug
- required: true
- type: string
- produces:
- - application/json
- 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'
- security:
- - Bearer: []
- summary: Get a wiki page by slug
- tags:
- - Wiki
- put:
- consumes:
- - application/json
- description: Update an existing wiki page by slug
+ description: Retrieve a data source configuration by ID
parameters:
- - description: Knowledge base ID
- in: path
- name: kb_id
- required: true
- type: string
- - description: Page slug
+ - description: Data source ID
in: path
- name: slug
- required: true
- type: string
- - description: Updated wiki page data
- in: body
- name: page
- required: true
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage'
+ name: id
+ required: true
+ type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
"404":
description: Not Found
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- summary: Update a wiki page
+ additionalProperties:
+ type: string
+ type: object
+ summary: Get a data source by ID
tags:
- - Wiki
- /api/v1/knowledgebase/{kb_id}/wiki/rebuild-links:
- post:
- description: Re-parse all pages and rebuild bidirectional link references
+ - DataSource
+ put:
+ consumes:
+ - application/json
+ description: Update an existing data source configuration
parameters:
- - description: Knowledge base ID
+ - description: Data source ID
in: path
- name: kb_id
+ name: id
required: true
type: string
+ - description: Updated configuration
+ in: body
+ name: request
+ required: true
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
+ produces:
+ - application/json
responses:
"200":
description: OK
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.DataSource'
+ "400":
+ description: Bad Request
schema:
additionalProperties:
type: string
type: object
- security:
- - Bearer: []
- summary: Rebuild wiki links
+ summary: Update a data source
tags:
- - Wiki
- /api/v1/knowledgebase/{kb_id}/wiki/search:
+ - DataSource
+ /datasource/{id}/logs:
get:
- description: Full-text search over wiki pages
+ description: Retrieve sync history for a data source
parameters:
- - description: Knowledge base ID
+ - description: Data source ID
in: path
- name: kb_id
- required: true
- type: string
- - description: Search query
- in: query
- name: q
+ name: id
required: true
type: string
- - description: Max results (default 10)
+ - description: 'Limit (default: 10)'
in: query
name: limit
type: integer
+ - description: 'Offset (default: 0)'
+ in: query
+ name: offset
+ type: integer
produces:
- application/json
responses:
@@ -5667,491 +5635,486 @@ paths:
description: OK
schema:
items:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog'
type: array
- security:
- - Bearer: []
- summary: Search wiki pages
+ "400":
+ description: Bad Request
+ schema:
+ additionalProperties:
+ type: string
+ type: object
+ summary: Get sync logs
tags:
- - Wiki
- /api/v1/knowledgebase/{kb_id}/wiki/stats:
- get:
- description: Returns aggregate statistics about the wiki
+ - DataSource
+ /datasource/{id}/pause:
+ post:
+ description: Pause a data source's scheduled syncs
parameters:
- - description: Knowledge base ID
+ - description: Data source ID
in: path
- name: kb_id
+ name: id
required: true
type: string
- produces:
- - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiStats'
- security:
- - Bearer: []
- summary: Get wiki statistics
+ additionalProperties:
+ type: string
+ type: object
+ "400":
+ description: Bad Request
+ schema:
+ additionalProperties:
+ type: string
+ type: object
+ summary: Pause data source
tags:
- - Wiki
- /auth/auto-setup:
- post:
- consumes:
- - application/json
- description: Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程
+ - DataSource
+ /datasource/{id}/resources:
+ get:
+ description: List resources available for sync in the external system
+ parameters:
+ - description: Data source ID
+ in: path
+ name: id
+ required: true
+ type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse'
- "403":
- description: 非 Lite 版本
+ items:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.Resource'
+ type: array
+ "400":
+ description: Bad Request
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- summary: 自动初始化(Lite 桌面版)
+ additionalProperties:
+ type: string
+ type: object
+ summary: List available resources in data source
tags:
- - 认证
- /auth/change-password:
+ - DataSource
+ /datasource/{id}/resume:
post:
- consumes:
- - application/json
- description: 修改当前用户的登录密码
+ description: Resume a paused data source
parameters:
- - description: 密码修改请求
- in: body
- name: request
+ - description: Data source ID
+ in: path
+ name: id
required: true
- schema:
- properties:
- new_password:
- type: string
- old_password:
- type: string
- type: object
- produces:
- - application/json
+ type: string
responses:
"200":
- description: 修改成功
+ description: OK
schema:
- additionalProperties: true
+ additionalProperties:
+ type: string
type: object
"400":
- description: 请求参数错误
+ description: Bad Request
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- summary: 修改密码
+ additionalProperties:
+ type: string
+ type: object
+ summary: Resume data source
tags:
- - 认证
- /auth/config:
- get:
- consumes:
- - application/json
- description: 返回当前部署的注册模式等公开认证配置,供前端决定是否展示注册入口
- produces:
- - application/json
+ - DataSource
+ /datasource/{id}/sync:
+ post:
+ description: Trigger an immediate sync for a data source
+ parameters:
+ - description: Data source ID
+ in: path
+ name: id
+ required: true
+ type: string
responses:
"200":
- description: 认证配置
+ description: OK
schema:
- additionalProperties: true
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog'
+ "400":
+ description: Bad Request
+ schema:
+ additionalProperties:
+ type: string
type: object
- summary: 获取认证配置
+ summary: Trigger immediate sync
tags:
- - 认证
- /auth/login:
+ - DataSource
+ /datasource/{id}/validate:
post:
- consumes:
- - application/json
- description: 用户登录并获取访问令牌
+ description: Validate the connection to an external data source
parameters:
- - description: 登录请求参数
- in: body
- name: request
+ - description: Data source ID
+ in: path
+ name: id
required: true
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.LoginRequest'
- produces:
- - application/json
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse'
- "401":
- description: 认证失败
+ additionalProperties:
+ type: string
+ type: object
+ "400":
+ description: Bad Request
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- summary: 用户登录
+ additionalProperties:
+ type: string
+ type: object
+ summary: Test data source connection
tags:
- - 认证
- /auth/logout:
- post:
- consumes:
- - application/json
- description: 撤销当前访问令牌并登出
+ - DataSource
+ /datasource/logs/{log_id}:
+ get:
+ description: Retrieve a specific sync log entry
+ parameters:
+ - description: Sync log ID
+ in: path
+ name: log_id
+ required: true
+ type: string
produces:
- application/json
responses:
"200":
- description: 登出成功
+ description: OK
schema:
- additionalProperties: true
- type: object
- "400":
- description: 请求参数错误
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SyncLog'
+ "404":
+ description: Not Found
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- summary: 用户登出
+ additionalProperties:
+ type: string
+ type: object
+ summary: Get specific sync log
tags:
- - 认证
- /auth/me:
+ - DataSource
+ /datasource/types:
get:
- consumes:
- - application/json
- description: 获取当前登录用户的详细信息
+ description: Get list of available data source connectors
produces:
- application/json
responses:
"200":
- description: 用户信息
- schema:
- additionalProperties: true
- type: object
- "401":
- description: 未授权
+ description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- summary: 获取当前用户信息
+ items:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_datasource.ConnectorMetadata'
+ type: array
+ summary: Get available connectors
tags:
- - 认证
- /auth/me/preferences:
- put:
+ - DataSource
+ /datasource/validate-credentials:
+ post:
consumes:
- application/json
- description: |-
- 按 PATCH 语义合并用户偏好(仅覆盖请求体里出现的字段,其余字段保持不变),
- 数据存放在 users.preferences (JSON),跨设备/浏览器自动同步。
+ description: Validate connectivity to an external data source using type + credentials
parameters:
- - description: Preferences patch
+ - description: type and credentials
in: body
name: request
required: true
schema:
- $ref: '#/definitions/internal_handler.updateMyPreferencesRequest'
+ type: object
produces:
- application/json
responses:
"200":
- description: 更新后的偏好
+ description: OK
schema:
- additionalProperties: true
+ additionalProperties:
+ type: string
type: object
"400":
- description: 请求参数错误
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "401":
- description: 未授权
+ description: Bad Request
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- summary: 更新当前用户的个性化设置
+ additionalProperties:
+ type: string
+ type: object
+ summary: Test connection with raw credentials (no persistence)
tags:
- - 认证
- /auth/oidc/callback:
+ - DataSource
+ /evaluation/:
get:
consumes:
- application/json
- description: 接收OIDC provider回调并由后端完成code交换,随后重定向回前端登录页
+ description: 根据任务ID获取评估结果
parameters:
- - description: OIDC授权码
- in: query
- name: code
- type: string
- - description: OIDC状态
- in: query
- name: state
- type: string
- - description: OIDC错误码
+ - description: 评估任务ID
in: query
- name: error
+ name: task_id
+ required: true
type: string
produces:
- application/json
- responses:
- "302":
- description: Found
- summary: OIDC登录重定向回调
- tags:
- - 认证
- /auth/oidc/config:
- get:
- consumes:
- - application/json
- description: 返回OIDC是否启用以及provider展示名称,供前端决定是否展示OIDC登录入口
- produces:
- - application/json
responses:
"200":
- description: OK
+ description: 评估结果
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCConfigResponse'
- summary: 获取OIDC登录配置
+ additionalProperties: true
+ type: object
+ "400":
+ description: 请求参数错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: 获取评估结果
tags:
- - 认证
- /auth/oidc/url:
- get:
+ - 评估
+ post:
consumes:
- application/json
- description: 根据后端OIDC配置生成第三方登录跳转地址
+ description: 对知识库进行评估测试
parameters:
- - description: OIDC回调地址
- in: query
- name: redirect_uri
+ - description: 评估请求参数
+ in: body
+ name: request
required: true
- type: string
+ schema:
+ $ref: '#/definitions/internal_handler.EvaluationRequest'
produces:
- application/json
responses:
"200":
- description: OK
+ description: 评估任务
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.OIDCAuthURLResponse'
+ additionalProperties: true
+ type: object
"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'
- summary: 获取OIDC授权地址
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: 执行评估
tags:
- - 认证
- /auth/refresh:
- post:
+ - 评估
+ /faq/import/progress/{task_id}:
+ get:
consumes:
- application/json
- description: 使用刷新令牌获取新的访问令牌
+ description: 获取FAQ导入任务的进度
parameters:
- - description: 刷新令牌
- in: body
- name: request
+ - description: 任务ID
+ in: path
+ name: task_id
required: true
- schema:
- properties:
- refreshToken:
- type: string
- type: object
+ type: string
produces:
- application/json
responses:
"200":
- description: 新令牌
+ description: 导入进度
schema:
additionalProperties: true
type: object
- "401":
- description: 令牌无效
+ "404":
+ description: 任务不存在
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- summary: 刷新令牌
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: 获取FAQ导入进度
tags:
- - 认证
- /auth/register:
- post:
- consumes:
- - application/json
- description: 注册新用户账号
+ - FAQ管理
+ /im-channels/{id}:
+ delete:
+ description: 删除指定 IM 渠道
parameters:
- - description: 注册请求参数
- in: body
- name: request
+ - description: 渠道 ID
+ in: path
+ name: id
required: true
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterRequest'
+ type: string
produces:
- application/json
responses:
- "201":
- description: Created
+ "200":
+ description: 'success: true'
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.RegisterResponse'
+ additionalProperties: true
+ type: object
"400":
description: 请求参数错误
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "403":
- description: 注册功能已禁用
+ additionalProperties: true
+ type: object
+ "404":
+ description: 渠道不存在
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- summary: 用户注册
+ additionalProperties: true
+ type: object
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: 删除 IM 渠道
tags:
- - 认证
- /auth/switch-tenant:
- post:
+ - IM 渠道
+ put:
consumes:
- application/json
- description: 为当前用户在目标租户重新签发访问令牌;要求该用户在目标租户存在 active 成员关系
+ description: 更新指定 IM 渠道的名称、模式、知识库、凭证或启用状态
parameters:
- - description: 切换请求
+ - description: 渠道 ID
+ in: path
+ name: id
+ required: true
+ type: string
+ - description: 更新字段(name/mode/output_mode/knowledge_base_id/credentials/enabled)
in: body
name: request
required: true
schema:
- properties:
- refresh_token:
- type: string
- tenant_id:
- type: integer
+ additionalProperties: true
type: object
produces:
- application/json
responses:
"200":
- description: OK
+ description: 更新后的渠道
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.LoginResponse'
+ additionalProperties: true
+ type: object
"400":
- description: 参数错误
+ description: 请求参数错误
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "403":
- description: 无该租户成员关系
+ additionalProperties: true
+ type: object
+ "404":
+ description: 渠道不存在
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ additionalProperties: true
+ type: object
security:
- Bearer: []
- summary: 切换激活租户
+ - ApiKeyAuth: []
+ summary: 更新 IM 渠道
tags:
- - 认证
- /auth/validate:
- get:
- consumes:
- - application/json
- description: 验证访问令牌是否有效
+ - IM 渠道
+ /im-channels/{id}/toggle:
+ post:
+ description: 切换指定 IM 渠道的启用状态
+ parameters:
+ - description: 渠道 ID
+ in: path
+ name: id
+ required: true
+ type: string
produces:
- application/json
responses:
"200":
- description: 令牌有效
+ description: 更新后的渠道
schema:
additionalProperties: true
type: object
- "401":
- description: 令牌无效
+ "400":
+ description: 请求参数错误
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ additionalProperties: true
+ type: object
+ "404":
+ description: 渠道不存在
+ schema:
+ additionalProperties: true
+ type: object
security:
- Bearer: []
- summary: 验证令牌
+ - ApiKeyAuth: []
+ summary: 启用/停用 IM 渠道
tags:
- - 认证
- /chunker/preview:
- post:
+ - IM 渠道
+ /im/callback/{channel_id}:
+ get:
consumes:
- application/json
- description: 对提交的文本运行自适应分块器并返回分块预览,不写入数据库不生成 embedding。文本最大 64k 字符
+ description: 接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key
parameters:
- - description: '{text, chunking_config}'
- in: body
- name: request
+ - description: 渠道 ID
+ in: path
+ name: channel_id
required: true
- schema:
- $ref: '#/definitions/internal_handler.PreviewChunkingRequest'
+ type: string
produces:
- application/json
responses:
"200":
- description: 分块结果
- schema:
- $ref: '#/definitions/internal_handler.PreviewChunkingResponse'
- "400":
- description: 请求参数错误
+ description: 处理结果
schema:
additionalProperties: true
type: object
- "413":
- description: 文本超过预览限制
+ "400":
+ description: 请求参数错误
schema:
additionalProperties: true
type: object
- "504":
- description: 分块超时
+ "401":
+ description: 签名校验失败
schema:
additionalProperties: true
type: object
- security:
- - Bearer: []
- - ApiKeyAuth: []
- summary: 预览分块结果
+ summary: IM 平台回调
tags:
- - 分块
- /chunks/{knowledge_id}:
- delete:
+ - IM 回调
+ post:
consumes:
- application/json
- description: 删除指定知识下的所有分块
+ description: 接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key
parameters:
- - description: 知识ID
+ - description: 渠道 ID
in: path
- name: knowledge_id
+ name: channel_id
required: true
type: string
produces:
- application/json
responses:
"200":
- description: 删除成功
+ description: 处理结果
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- - ApiKeyAuth: []
- summary: 删除知识下所有分块
+ additionalProperties: true
+ type: object
+ "401":
+ description: 签名校验失败
+ schema:
+ additionalProperties: true
+ type: object
+ summary: IM 平台回调
tags:
- - 分块管理
- get:
+ - IM 回调
+ /initialization/asr/check:
+ post:
consumes:
- application/json
- description: 获取指定知识下的所有分块列表,支持分页
+ description: 检查ASR(语音识别)模型连接是否正常,通过发送一段静默音频测试 /v1/audio/transcriptions 端点
parameters:
- - description: 知识ID
- in: path
- name: knowledge_id
+ - description: ASR检查请求
+ in: body
+ name: request
required: true
- type: string
- - default: 1
- description: 页码
- in: query
- name: page
- type: integer
- - default: 10
- description: 每页数量
- in: query
- name: page_size
- type: integer
+ schema:
+ $ref: '#/definitions/internal_handler.ModelTestRequest'
produces:
- application/json
responses:
"200":
- description: 分块列表
+ description: 检查结果
schema:
additionalProperties: true
type: object
@@ -6162,73 +6125,59 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取知识分块列表
+ summary: 检查ASR模型
tags:
- - 分块管理
- /chunks/{knowledge_id}/{id}:
- delete:
+ - 初始化
+ /initialization/config/{kbId}:
+ get:
consumes:
- application/json
- description: 删除指定的分块
+ description: 根据知识库ID获取当前配置信息
parameters:
- - description: 知识ID
- in: path
- name: knowledge_id
- required: true
- type: string
- - description: 分块ID
+ - description: 知识库ID
in: path
- name: id
+ name: kbId
required: true
type: string
produces:
- application/json
responses:
"200":
- description: 删除成功
+ description: 配置信息
schema:
additionalProperties: true
type: object
- "400":
- description: 请求参数错误
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
"404":
- description: 分块不存在
+ description: 知识库不存在
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 删除分块
+ summary: 获取知识库配置
tags:
- - 分块管理
+ - 初始化
put:
consumes:
- application/json
- description: 更新指定分块的内容和属性
+ description: 根据知识库ID更新模型和分块配置
parameters:
- - description: 知识ID
- in: path
- name: knowledge_id
- required: true
- type: string
- - description: 分块ID
+ - description: 知识库ID
in: path
- name: id
+ name: kbId
required: true
type: string
- - description: 更新请求
+ - description: 配置请求
in: body
name: request
required: true
schema:
- $ref: '#/definitions/internal_handler.UpdateChunkRequest'
+ $ref: '#/definitions/internal_handler.KBModelConfigRequest'
produces:
- application/json
responses:
"200":
- description: 更新后的分块
+ description: 更新成功
schema:
additionalProperties: true
type: object
@@ -6237,31 +6186,32 @@ paths:
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
"404":
- description: 分块不存在
+ description: 知识库不存在
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 更新分块
+ summary: 更新知识库配置
tags:
- - 分块管理
- /chunks/by-id/{id}:
- get:
+ - 初始化
+ /initialization/embedding/test:
+ post:
consumes:
- application/json
- description: 仅通过分块ID获取分块详情(不需要knowledge_id);支持共享知识库下的分块访问
+ description: 测试Embedding接口是否可用并返回向量维度
parameters:
- - description: 分块ID
- in: path
- name: id
+ - description: Embedding测试请求
+ in: body
+ name: request
required: true
- type: string
+ schema:
+ $ref: '#/definitions/internal_handler.ModelTestRequest'
produces:
- application/json
responses:
"200":
- description: 分块详情
+ description: 测试结果
schema:
additionalProperties: true
type: object
@@ -6269,74 +6219,45 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "404":
- description: 分块不存在
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 通过ID获取分块
+ summary: 测试Embedding模型
tags:
- - 分块管理
- /chunks/by-id/{id}/questions:
- delete:
+ - 初始化
+ /initialization/extract/fabri-tag:
+ post:
consumes:
- application/json
- description: 删除分块中生成的问题
- parameters:
- - description: 分块ID
- in: path
- name: id
- required: true
- type: string
- - description: 问题ID
- in: body
- name: request
- required: true
- schema:
- properties:
- question_id:
- type: string
- type: object
+ description: 随机生成一组标签
produces:
- application/json
responses:
"200":
- description: 删除成功
+ description: 生成的标签
schema:
additionalProperties: true
type: object
- "400":
- description: 请求参数错误
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "404":
- description: 分块不存在
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- - ApiKeyAuth: []
- summary: 删除生成的问题
+ summary: 生成随机标签
tags:
- - 分块管理
- /evaluation/:
- get:
+ - 初始化
+ /initialization/extract/fabri-text:
+ post:
consumes:
- application/json
- description: 根据任务ID获取评估结果
+ description: 根据标签生成示例文本
parameters:
- - description: 评估任务ID
- in: query
- name: task_id
+ - description: 生成请求
+ in: body
+ name: request
required: true
- type: string
+ schema:
+ $ref: '#/definitions/internal_handler.FabriTextRequest'
produces:
- application/json
responses:
"200":
- description: 评估结果
+ description: 生成的文本
schema:
additionalProperties: true
type: object
@@ -6347,25 +6268,26 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取评估结果
+ summary: 生成示例文本
tags:
- - 评估
+ - 初始化
+ /initialization/extract/text-relation:
post:
consumes:
- application/json
- description: 对知识库进行评估测试
+ description: 从文本中提取实体和关系
parameters:
- - description: 评估请求参数
+ - description: 提取请求
in: body
name: request
required: true
schema:
- $ref: '#/definitions/internal_handler.EvaluationRequest'
+ $ref: '#/definitions/internal_handler.TextRelationExtractionRequest'
produces:
- application/json
responses:
"200":
- description: 评估任务
+ description: 提取结果
schema:
additionalProperties: true
type: object
@@ -6376,225 +6298,222 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 执行评估
+ summary: 提取文本关系
tags:
- - 评估
- /faq/import/progress/{task_id}:
- get:
+ - 初始化
+ /initialization/initialize/{kbId}:
+ post:
consumes:
- application/json
- description: 获取FAQ导入任务的进度
+ description: 根据知识库ID执行完整配置更新
parameters:
- - description: 任务ID
+ - description: 知识库ID
in: path
- name: task_id
+ name: kbId
required: true
type: string
+ - description: 初始化请求
+ in: body
+ name: request
+ required: true
+ schema:
+ $ref: '#/definitions/internal_handler.InitializationRequest'
produces:
- application/json
responses:
"200":
- description: 导入进度
+ description: 初始化成功
schema:
additionalProperties: true
type: object
- "404":
- description: 任务不存在
+ "400":
+ description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取FAQ导入进度
+ summary: 初始化知识库配置
tags:
- - FAQ管理
- /im-channels/{id}:
- delete:
- description: 删除指定 IM 渠道
+ - 初始化
+ /initialization/multimodal/test:
+ post:
+ consumes:
+ - multipart/form-data
+ description: 上传图片测试多模态处理功能
parameters:
- - description: 渠道 ID
- in: path
- name: id
+ - description: 测试图片
+ in: formData
+ name: image
+ required: true
+ type: file
+ - description: VLM模型名称
+ in: formData
+ name: vlm_model
+ required: true
+ type: string
+ - description: VLM Base URL
+ in: formData
+ name: vlm_base_url
+ required: true
+ type: string
+ - description: VLM API Key
+ in: formData
+ name: vlm_api_key
+ type: string
+ - description: VLM接口类型
+ in: formData
+ name: vlm_interface_type
+ type: string
+ - description: 存储类型(cos/minio)
+ in: formData
+ name: storage_type
required: true
type: string
produces:
- application/json
responses:
"200":
- description: 'success: true'
+ description: 测试结果
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
- additionalProperties: true
- type: object
- "404":
- description: 渠道不存在
- schema:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 删除 IM 渠道
+ summary: 测试多模态功能
tags:
- - IM 渠道
- put:
+ - 初始化
+ /initialization/ollama/download/progress/{taskId}:
+ get:
consumes:
- application/json
- description: 更新指定 IM 渠道的名称、模式、知识库、凭证或启用状态
+ description: 获取Ollama模型下载任务的进度
parameters:
- - description: 渠道 ID
+ - description: 任务ID
in: path
- name: id
+ name: taskId
required: true
type: string
- - description: 更新字段(name/mode/output_mode/knowledge_base_id/credentials/enabled)
- in: body
- name: request
- required: true
- schema:
- additionalProperties: true
- type: object
produces:
- application/json
responses:
"200":
- description: 更新后的渠道
- schema:
- additionalProperties: true
- type: object
- "400":
- description: 请求参数错误
+ description: 下载进度
schema:
additionalProperties: true
type: object
"404":
- description: 渠道不存在
+ description: 任务不存在
schema:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 更新 IM 渠道
+ summary: 获取下载进度
tags:
- - IM 渠道
- /im-channels/{id}/toggle:
- post:
- description: 切换指定 IM 渠道的启用状态
- parameters:
- - description: 渠道 ID
- in: path
- name: id
- required: true
- type: string
+ - 初始化
+ /initialization/ollama/download/tasks:
+ get:
+ consumes:
+ - application/json
+ description: 列出所有Ollama模型下载任务
produces:
- application/json
responses:
"200":
- description: 更新后的渠道
- schema:
- additionalProperties: true
- type: object
- "400":
- description: 请求参数错误
- schema:
- additionalProperties: true
- type: object
- "404":
- description: 渠道不存在
+ description: 任务列表
schema:
additionalProperties: true
type: object
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 启用/停用 IM 渠道
+ summary: 列出下载任务
tags:
- - IM 渠道
- /im/callback/{channel_id}:
+ - 初始化
+ /initialization/ollama/models:
get:
consumes:
- application/json
- description: 接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key
- parameters:
- - description: 渠道 ID
- in: path
- name: channel_id
- required: true
- type: string
+ description: 列出已安装的Ollama模型
produces:
- application/json
responses:
"200":
- description: 处理结果
- schema:
- additionalProperties: true
- type: object
- "400":
- description: 请求参数错误
+ description: 模型列表
schema:
additionalProperties: true
type: object
- "401":
- description: 签名校验失败
+ "500":
+ description: 服务器错误
schema:
- additionalProperties: true
- type: object
- summary: IM 平台回调
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: 列出Ollama模型
tags:
- - IM 回调
+ - 初始化
+ /initialization/ollama/models/check:
post:
consumes:
- application/json
- description: 接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key
+ description: 检查指定的Ollama模型是否已安装
parameters:
- - description: 渠道 ID
- in: path
- name: channel_id
+ - description: 模型名称列表
+ in: body
+ name: request
required: true
- type: string
+ schema:
+ properties:
+ models:
+ items:
+ type: string
+ type: array
+ type: object
produces:
- application/json
responses:
"200":
- description: 处理结果
+ description: 模型状态
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
- additionalProperties: true
- type: object
- "401":
- description: 签名校验失败
- schema:
- additionalProperties: true
- type: object
- summary: IM 平台回调
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: 检查Ollama模型状态
tags:
- - IM 回调
- /initialization/asr/check:
+ - 初始化
+ /initialization/ollama/models/download:
post:
consumes:
- application/json
- description: 检查ASR(语音识别)模型连接是否正常,通过发送一段静默音频测试 /v1/audio/transcriptions 端点
+ description: 异步下载指定的Ollama模型
parameters:
- - description: ASR检查请求
+ - description: 模型名称
in: body
name: request
required: true
schema:
- $ref: '#/definitions/internal_handler.ModelTestRequest'
+ properties:
+ modelName:
+ type: string
+ type: object
produces:
- application/json
responses:
"200":
- description: 检查结果
+ description: 下载任务信息
schema:
additionalProperties: true
type: object
@@ -6605,59 +6524,42 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 检查ASR模型
+ summary: 下载Ollama模型
tags:
- 初始化
- /initialization/config/{kbId}:
+ /initialization/ollama/status:
get:
consumes:
- application/json
- description: 根据知识库ID获取当前配置信息
- parameters:
- - description: 知识库ID
- in: path
- name: kbId
- required: true
- type: string
+ description: 检查Ollama服务是否可用
produces:
- application/json
responses:
"200":
- description: 配置信息
+ description: Ollama状态
schema:
additionalProperties: true
type: object
- "404":
- description: 知识库不存在
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- - ApiKeyAuth: []
- summary: 获取知识库配置
+ summary: 检查Ollama服务状态
tags:
- 初始化
- put:
+ /initialization/remote/check:
+ post:
consumes:
- - application/json
- description: 根据知识库ID更新模型和分块配置
- parameters:
- - description: 知识库ID
- in: path
- name: kbId
- required: true
- type: string
- - description: 配置请求
+ - application/json
+ description: 检查远程API模型连接是否正常
+ parameters:
+ - description: 模型检查请求
in: body
name: request
required: true
schema:
- $ref: '#/definitions/internal_handler.KBModelConfigRequest'
+ $ref: '#/definitions/internal_handler.RemoteModelCheckRequest'
produces:
- application/json
responses:
"200":
- description: 更新成功
+ description: 检查结果
schema:
additionalProperties: true
type: object
@@ -6665,23 +6567,19 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "404":
- description: 知识库不存在
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 更新知识库配置
+ summary: 检查远程模型
tags:
- 初始化
- /initialization/embedding/test:
+ /initialization/rerank/check:
post:
consumes:
- application/json
- description: 测试Embedding接口是否可用并返回向量维度
+ description: 检查Rerank模型连接和功能是否正常
parameters:
- - description: Embedding测试请求
+ - description: Rerank检查请求
in: body
name: request
required: true
@@ -6691,7 +6589,7 @@ paths:
- application/json
responses:
"200":
- description: 测试结果
+ description: 检查结果
schema:
additionalProperties: true
type: object
@@ -6702,42 +6600,82 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 测试Embedding模型
+ summary: 检查Rerank模型
tags:
- 初始化
- /initialization/extract/fabri-tag:
- post:
+ /knowledge-bases:
+ get:
consumes:
- application/json
- description: 随机生成一组标签
+ description: 获取当前租户的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及)
+ parameters:
+ - description: 共享智能体 ID(传入时返回该智能体可用的知识库)
+ in: query
+ name: agent_id
+ type: string
produces:
- application/json
responses:
"200":
- description: 生成的标签
+ description: 知识库列表
schema:
additionalProperties: true
type: object
- summary: 生成随机标签
+ "500":
+ description: 服务器错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: 获取知识库列表
tags:
- - 初始化
- /initialization/extract/fabri-text:
+ - 知识库
post:
consumes:
- application/json
- description: 根据标签生成示例文本
+ description: 创建新的知识库
parameters:
- - description: 生成请求
+ - description: 知识库信息
in: body
name: request
required: true
schema:
- $ref: '#/definitions/internal_handler.FabriTextRequest'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBase'
+ produces:
+ - application/json
+ responses:
+ "201":
+ description: 创建的知识库
+ schema:
+ additionalProperties: true
+ type: object
+ "400":
+ description: 请求参数错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: 创建知识库
+ tags:
+ - 知识库
+ /knowledge-bases/{id}:
+ delete:
+ consumes:
+ - application/json
+ description: 删除指定的知识库及其所有内容
+ parameters:
+ - description: 知识库ID
+ in: path
+ name: id
+ required: true
+ type: string
produces:
- application/json
responses:
"200":
- description: 生成的文本
+ description: 删除成功
schema:
additionalProperties: true
type: object
@@ -6748,26 +6686,28 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 生成示例文本
+ summary: 删除知识库
tags:
- - 初始化
- /initialization/extract/text-relation:
- post:
+ - 知识库
+ get:
consumes:
- application/json
- description: 从文本中提取实体和关系
+ description: 根据ID获取知识库详情。当使用共享智能体时,可传 agent_id 以校验该智能体是否有权访问该知识库。
parameters:
- - description: 提取请求
- in: body
- name: request
+ - description: 知识库ID
+ in: path
+ name: id
required: true
- schema:
- $ref: '#/definitions/internal_handler.TextRelationExtractionRequest'
+ type: string
+ - description: 共享智能体 ID(用于校验智能体是否有权访问该知识库)
+ in: query
+ name: agent_id
+ type: string
produces:
- application/json
responses:
"200":
- description: 提取结果
+ description: 知识库详情
schema:
additionalProperties: true
type: object
@@ -6775,34 +6715,37 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "404":
+ description: 知识库不存在
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 提取文本关系
+ summary: 获取知识库详情
tags:
- - 初始化
- /initialization/initialize/{kbId}:
- post:
+ - 知识库
+ put:
consumes:
- application/json
- description: 根据知识库ID执行完整配置更新
+ description: 更新知识库的名称、描述和配置
parameters:
- description: 知识库ID
in: path
- name: kbId
+ name: id
required: true
type: string
- - description: 初始化请求
+ - description: 更新请求
in: body
name: request
required: true
schema:
- $ref: '#/definitions/internal_handler.InitializationRequest'
+ $ref: '#/definitions/internal_handler.UpdateKnowledgeBaseRequest'
produces:
- application/json
responses:
"200":
- description: 初始化成功
+ description: 更新后的知识库
schema:
additionalProperties: true
type: object
@@ -6813,48 +6756,36 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 初始化知识库配置
+ summary: 更新知识库
tags:
- - 初始化
- /initialization/multimodal/test:
- post:
+ - 知识库
+ /knowledge-bases/{id}/faq/entries:
+ delete:
consumes:
- - multipart/form-data
- description: 上传图片测试多模态处理功能
+ - application/json
+ description: 批量删除指定的FAQ条目
parameters:
- - description: 测试图片
- in: formData
- name: image
- required: true
- type: file
- - description: VLM模型名称
- in: formData
- name: vlm_model
- required: true
- type: string
- - description: VLM Base URL
- in: formData
- name: vlm_base_url
+ - description: 知识库ID
+ in: path
+ name: id
required: true
type: string
- - description: VLM API Key
- in: formData
- name: vlm_api_key
- type: string
- - description: VLM接口类型
- in: formData
- name: vlm_interface_type
- type: string
- - description: 存储类型(cos/minio)
- in: formData
- name: storage_type
+ - description: 要删除的FAQ ID列表(seq_id)
+ in: body
+ name: request
required: true
- type: string
+ schema:
+ properties:
+ ids:
+ items:
+ type: integer
+ type: array
+ type: object
produces:
- application/json
responses:
"200":
- description: 测试结果
+ description: 删除成功
schema:
additionalProperties: true
type: object
@@ -6865,102 +6796,163 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 测试多模态功能
+ summary: 批量删除FAQ条目
tags:
- - 初始化
- /initialization/ollama/download/progress/{taskId}:
+ - FAQ管理
get:
consumes:
- application/json
- description: 获取Ollama模型下载任务的进度
+ description: 获取知识库下的FAQ条目列表,支持分页和筛选
parameters:
- - description: 任务ID
+ - description: 知识库ID
in: path
- name: taskId
+ name: id
required: true
type: string
+ - description: 页码
+ in: query
+ name: page
+ type: integer
+ - description: 每页数量
+ in: query
+ name: page_size
+ type: integer
+ - description: 标签ID筛选(seq_id)
+ in: query
+ name: tag_id
+ type: integer
+ - description: 关键词搜索
+ in: query
+ name: keyword
+ type: string
+ - description: '搜索字段: standard_question(标准问题), similar_questions(相似问法), answers(答案),
+ 默认搜索全部'
+ in: query
+ name: search_field
+ type: string
+ - description: '排序方式: asc(按更新时间正序), 默认按更新时间倒序'
+ in: query
+ name: sort_order
+ type: string
produces:
- application/json
responses:
"200":
- description: 下载进度
+ description: FAQ列表
schema:
additionalProperties: true
type: object
- "404":
- description: 任务不存在
+ "400":
+ description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取下载进度
+ summary: 获取FAQ条目列表
tags:
- - 初始化
- /initialization/ollama/download/tasks:
- get:
+ - FAQ管理
+ post:
consumes:
- application/json
- description: 列出所有Ollama模型下载任务
+ description: |-
+ 异步批量更新或插入FAQ条目。支持 dry_run 模式(设置 dry_run=true),异步验证不实际导入。
+ dry_run 模式是异步操作,返回 task_id,通过 /faq/import/progress/{task_id} 查询进度和结果。
+ 验证内容包括:1) 条目基本格式 2) 重复问题(批次内和知识库已有) 3) 内容安全检查。
+ parameters:
+ - description: 知识库ID
+ in: path
+ name: id
+ required: true
+ type: string
+ - description: 批量操作请求
+ in: body
+ name: request
+ required: true
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQBatchUpsertPayload'
produces:
- application/json
responses:
"200":
- description: 任务列表
+ description: 任务ID
+ schema:
+ additionalProperties: true
+ type: object
+ "400":
+ description: 请求参数错误
schema:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 列出下载任务
+ summary: 批量更新/插入FAQ条目
tags:
- - 初始化
- /initialization/ollama/models:
+ - FAQ管理
+ /knowledge-bases/{id}/faq/entries/{entry_id}:
get:
consumes:
- application/json
- description: 列出已安装的Ollama模型
+ description: 根据ID获取单个FAQ条目的详情
+ parameters:
+ - description: 知识库ID
+ in: path
+ name: id
+ required: true
+ type: string
+ - description: FAQ条目ID(seq_id)
+ in: path
+ name: entry_id
+ required: true
+ type: integer
produces:
- application/json
responses:
"200":
- description: 模型列表
+ description: FAQ条目详情
schema:
additionalProperties: true
type: object
- "500":
- description: 服务器错误
+ "400":
+ description: 请求参数错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "404":
+ description: 条目不存在
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 列出Ollama模型
+ summary: 获取FAQ条目详情
tags:
- - 初始化
- /initialization/ollama/models/check:
- post:
+ - FAQ管理
+ put:
consumes:
- application/json
- description: 检查指定的Ollama模型是否已安装
+ description: 更新指定的FAQ条目
parameters:
- - description: 模型名称列表
+ - description: 知识库ID
+ in: path
+ name: id
+ required: true
+ type: string
+ - description: FAQ条目ID(seq_id)
+ in: path
+ name: entry_id
+ required: true
+ type: integer
+ - description: FAQ条目
in: body
name: request
required: true
schema:
- properties:
- models:
- items:
- type: string
- type: array
- type: object
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload'
produces:
- application/json
responses:
"200":
- description: 模型状态
+ description: 更新成功
schema:
additionalProperties: true
type: object
@@ -6971,29 +6963,36 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 检查Ollama模型状态
+ summary: 更新FAQ条目
tags:
- - 初始化
- /initialization/ollama/models/download:
+ - FAQ管理
+ /knowledge-bases/{id}/faq/entries/{entry_id}/similar-questions:
post:
consumes:
- application/json
- description: 异步下载指定的Ollama模型
+ description: 向指定的FAQ条目添加相似问题
parameters:
- - description: 模型名称
+ - description: 知识库ID
+ in: path
+ name: id
+ required: true
+ type: string
+ - description: FAQ条目ID(seq_id)
+ in: path
+ name: entry_id
+ required: true
+ type: integer
+ - description: 相似问列表
in: body
name: request
required: true
schema:
- properties:
- modelName:
- type: string
- type: object
+ $ref: '#/definitions/internal_handler.addSimilarQuestionsRequest'
produces:
- application/json
responses:
"200":
- description: 下载任务信息
+ description: 更新后的FAQ条目
schema:
additionalProperties: true
type: object
@@ -7001,48 +7000,34 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "404":
+ description: 条目不存在
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 下载Ollama模型
+ summary: 添加相似问
tags:
- - 初始化
- /initialization/ollama/status:
+ - FAQ管理
+ /knowledge-bases/{id}/faq/entries/export:
get:
consumes:
- application/json
- description: 检查Ollama服务是否可用
- produces:
- - application/json
- responses:
- "200":
- description: Ollama状态
- schema:
- additionalProperties: true
- type: object
- summary: 检查Ollama服务状态
- tags:
- - 初始化
- /initialization/remote/check:
- post:
- consumes:
- - application/json
- description: 检查远程API模型连接是否正常
+ description: 将所有FAQ条目导出为CSV文件
parameters:
- - description: 模型检查请求
- in: body
- name: request
+ - description: 知识库ID
+ in: path
+ name: id
required: true
- schema:
- $ref: '#/definitions/internal_handler.RemoteModelCheckRequest'
+ type: string
produces:
- - application/json
+ - text/csv
responses:
"200":
- description: 检查结果
+ description: CSV文件
schema:
- additionalProperties: true
- type: object
+ type: file
"400":
description: 请求参数错误
schema:
@@ -7050,26 +7035,31 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 检查远程模型
+ summary: 导出FAQ条目
tags:
- - 初始化
- /initialization/rerank/check:
- post:
+ - FAQ管理
+ /knowledge-bases/{id}/faq/entries/fields:
+ put:
consumes:
- application/json
- description: 检查Rerank模型连接和功能是否正常
+ description: 批量更新FAQ条目的多个字段(is_enabled, is_recommended, tag_id)
parameters:
- - description: Rerank检查请求
+ - description: 知识库ID
+ in: path
+ name: id
+ required: true
+ type: string
+ - description: 字段更新请求
in: body
name: request
required: true
schema:
- $ref: '#/definitions/internal_handler.ModelTestRequest'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryFieldsBatchUpdate'
produces:
- application/json
responses:
"200":
- description: 检查结果
+ description: 更新成功
schema:
additionalProperties: true
type: object
@@ -7080,53 +7070,66 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 检查Rerank模型
+ summary: 批量更新FAQ字段
tags:
- - 初始化
- /knowledge-bases:
- get:
+ - FAQ管理
+ /knowledge-bases/{id}/faq/entries/tags:
+ put:
consumes:
- application/json
- description: 获取当前租户的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及)
+ description: 批量更新FAQ条目的标签
parameters:
- - description: 共享智能体 ID(传入时返回该智能体可用的知识库)
- in: query
- name: agent_id
+ - description: 知识库ID
+ in: path
+ name: id
+ required: true
type: string
+ - description: 标签更新请求
+ in: body
+ name: request
+ required: true
+ schema:
+ type: object
produces:
- application/json
responses:
"200":
- description: 知识库列表
+ description: 更新成功
schema:
additionalProperties: true
type: object
- "500":
- description: 服务器错误
+ "400":
+ description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取知识库列表
+ summary: 批量更新FAQ标签
tags:
- - 知识库
+ - FAQ管理
+ /knowledge-bases/{id}/faq/entry:
post:
consumes:
- application/json
- description: 创建新的知识库
+ description: 同步创建单个FAQ条目
parameters:
- - description: 知识库信息
+ - description: 知识库ID
+ in: path
+ name: id
+ required: true
+ type: string
+ - description: FAQ条目
in: body
name: request
required: true
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBase'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload'
produces:
- application/json
responses:
- "201":
- description: 创建的知识库
+ "200":
+ description: 创建的FAQ条目
schema:
additionalProperties: true
type: object
@@ -7137,25 +7140,31 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 创建知识库
+ summary: 创建单个FAQ条目
tags:
- - 知识库
- /knowledge-bases/{id}:
- delete:
+ - FAQ管理
+ /knowledge-bases/{id}/faq/import/last-result/display:
+ put:
consumes:
- application/json
- description: 删除指定的知识库及其所有内容
+ description: 更新FAQ知识库导入结果统计卡片的显示或隐藏状态
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
+ - description: 状态更新请求
+ in: body
+ name: request
+ required: true
+ schema:
+ $ref: '#/definitions/internal_handler.updateLastFAQImportResultDisplayStatusRequest'
produces:
- application/json
responses:
"200":
- description: 删除成功
+ description: 更新成功
schema:
additionalProperties: true
type: object
@@ -7163,31 +7172,38 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "404":
+ description: 知识库不存在或无导入记录
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 删除知识库
+ summary: 更新FAQ最后一次导入结果显示状态
tags:
- - 知识库
- get:
+ - FAQ管理
+ /knowledge-bases/{id}/faq/search:
+ post:
consumes:
- application/json
- description: 根据ID获取知识库详情。当使用共享智能体时,可传 agent_id 以校验该智能体是否有权访问该知识库。
+ description: 使用混合搜索在FAQ中搜索,支持两级优先级标签召回:first_priority_tag_ids优先级最高,second_priority_tag_ids次之
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: 共享智能体 ID(用于校验智能体是否有权访问该知识库)
- in: query
- name: agent_id
- type: string
+ - description: 搜索请求
+ in: body
+ name: request
+ required: true
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQSearchRequest'
produces:
- application/json
responses:
"200":
- description: 知识库详情
+ description: 搜索结果
schema:
additionalProperties: true
type: object
@@ -7195,37 +7211,34 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "404":
- description: 知识库不存在
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取知识库详情
+ summary: 搜索FAQ
tags:
- - 知识库
- put:
+ - FAQ管理
+ /knowledge-bases/{id}/hybrid-search:
+ get:
consumes:
- application/json
- description: 更新知识库的名称、描述和配置
+ description: 在知识库中执行向量和关键词混合搜索
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: 更新请求
+ - description: 搜索参数
in: body
name: request
required: true
schema:
- $ref: '#/definitions/internal_handler.UpdateKnowledgeBaseRequest'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SearchParams'
produces:
- application/json
responses:
"200":
- description: 更新后的知识库
+ description: 搜索结果
schema:
additionalProperties: true
type: object
@@ -7236,36 +7249,25 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 更新知识库
+ summary: 混合搜索
tags:
- 知识库
- /knowledge-bases/{id}/faq/entries:
+ /knowledge-bases/{id}/knowledge:
delete:
consumes:
- application/json
- description: 批量删除指定的FAQ条目
+ description: 删除知识库下的所有知识条目(异步任务)。知识库本身保留,仅清空其中的内容
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: 要删除的FAQ ID列表(seq_id)
- in: body
- name: request
- required: true
- schema:
- properties:
- ids:
- items:
- type: integer
- type: array
- type: object
produces:
- application/json
responses:
"200":
- description: 删除成功
+ description: 清空任务已提交
schema:
additionalProperties: true
type: object
@@ -7273,16 +7275,20 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "403":
+ description: 权限不足
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 批量删除FAQ条目
+ summary: 清空知识库内容
tags:
- - FAQ管理
+ - 知识管理
get:
consumes:
- application/json
- description: 获取知识库下的FAQ条目列表,支持分页和筛选
+ description: 获取知识库下的知识列表,支持分页和筛选
parameters:
- description: 知识库ID
in: path
@@ -7297,28 +7303,40 @@ paths:
in: query
name: page_size
type: integer
- - description: 标签ID筛选(seq_id)
+ - description: 标签ID筛选
in: query
name: tag_id
- type: integer
+ type: string
- description: 关键词搜索
in: query
name: keyword
type: string
- - description: '搜索字段: standard_question(标准问题), similar_questions(相似问法), answers(答案),
- 默认搜索全部'
+ - description: 文件类型筛选
in: query
- name: search_field
+ name: file_type
type: string
- - description: '排序方式: asc(按更新时间正序), 默认按更新时间倒序'
+ - description: 解析状态筛选 (pending/processing/completed/failed)
in: query
- name: sort_order
+ name: parse_status
+ type: string
+ - description: 来源/渠道筛选 (web/api/feishu/notion/yuque/wechat/...,或 manual/url
+ 按 type 过滤)
+ in: query
+ name: source
+ type: string
+ - description: 更新时间起点,RFC3339 格式
+ in: query
+ name: start_time
+ type: string
+ - description: 更新时间终点,RFC3339 格式
+ in: query
+ name: end_time
type: string
produces:
- application/json
responses:
"200":
- description: FAQ列表
+ description: 知识列表
schema:
additionalProperties: true
type: object
@@ -7329,33 +7347,42 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取FAQ条目列表
+ summary: 获取知识列表
tags:
- - FAQ管理
+ - 知识管理
+ /knowledge-bases/{id}/knowledge/file:
post:
consumes:
- - application/json
- description: |-
- 异步批量更新或插入FAQ条目。支持 dry_run 模式(设置 dry_run=true),异步验证不实际导入。
- dry_run 模式是异步操作,返回 task_id,通过 /faq/import/progress/{task_id} 查询进度和结果。
- 验证内容包括:1) 条目基本格式 2) 重复问题(批次内和知识库已有) 3) 内容安全检查。
+ - multipart/form-data
+ description: 上传文件并创建知识条目
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: 批量操作请求
- in: body
- name: request
+ - description: 上传的文件
+ in: formData
+ name: file
required: true
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQBatchUpsertPayload'
+ type: file
+ - description: 自定义文件名
+ in: formData
+ name: fileName
+ type: string
+ - description: 元数据JSON
+ in: formData
+ name: metadata
+ type: string
+ - description: 启用多模态处理
+ in: formData
+ name: enable_multimodel
+ type: boolean
produces:
- application/json
responses:
"200":
- description: 任务ID
+ description: 创建的知识
schema:
additionalProperties: true
type: object
@@ -7363,33 +7390,39 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "409":
+ description: 文件重复
+ schema:
+ additionalProperties: true
+ type: object
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 批量更新/插入FAQ条目
+ summary: 从文件创建知识
tags:
- - FAQ管理
- /knowledge-bases/{id}/faq/entries/{entry_id}:
- get:
+ - 知识管理
+ /knowledge-bases/{id}/knowledge/manual:
+ post:
consumes:
- application/json
- description: 根据ID获取单个FAQ条目的详情
+ description: 手工录入Markdown格式的知识内容
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: FAQ条目ID(seq_id)
- in: path
- name: entry_id
+ - description: 手工知识内容
+ in: body
+ name: request
required: true
- type: integer
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ManualKnowledgePayload'
produces:
- application/json
responses:
"200":
- description: FAQ条目详情
+ description: 创建的知识
schema:
additionalProperties: true
type: object
@@ -7397,42 +7430,47 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "404":
- description: 条目不存在
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取FAQ条目详情
+ summary: 手工创建知识
tags:
- - FAQ管理
- put:
+ - 知识管理
+ /knowledge-bases/{id}/knowledge/url:
+ post:
consumes:
- application/json
- description: 更新指定的FAQ条目
+ description: 从指定URL抓取内容并创建知识条目。当提供 file_name/file_type 或 URL 路径含已知文件扩展名时,自动切换为文件下载模式
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: FAQ条目ID(seq_id)
- in: path
- name: entry_id
- required: true
- type: integer
- - description: FAQ条目
+ - description: URL请求
in: body
name: request
required: true
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload'
+ properties:
+ enable_multimodel:
+ type: boolean
+ file_name:
+ type: string
+ file_type:
+ type: string
+ tag_id:
+ type: string
+ title:
+ type: string
+ url:
+ type: string
+ type: object
produces:
- application/json
responses:
- "200":
- description: 更新成功
+ "201":
+ description: 创建的知识
schema:
additionalProperties: true
type: object
@@ -7440,39 +7478,31 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "409":
+ description: URL重复
+ schema:
+ additionalProperties: true
+ type: object
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 更新FAQ条目
+ summary: 从URL创建知识
tags:
- - FAQ管理
- /knowledge-bases/{id}/faq/entries/{entry_id}/similar-questions:
- post:
- consumes:
- - application/json
- description: 向指定的FAQ条目添加相似问题
+ - 知识管理
+ /knowledge-bases/{id}/move-targets:
+ get:
+ description: 返回与源知识库 Type 一致、EmbeddingModelID 一致、非临时且不是自身的目标知识库列表
parameters:
- - description: 知识库ID
+ - description: 源知识库 ID
in: path
name: id
required: true
type: string
- - description: FAQ条目ID(seq_id)
- in: path
- name: entry_id
- required: true
- type: integer
- - description: 相似问列表
- in: body
- name: request
- required: true
- schema:
- $ref: '#/definitions/internal_handler.addSimilarQuestionsRequest'
produces:
- application/json
responses:
"200":
- description: 更新后的FAQ条目
+ description: 可移动目标列表
schema:
additionalProperties: true
type: object
@@ -7481,135 +7511,193 @@ paths:
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
"404":
- description: 条目不存在
+ description: 知识库不存在
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 添加相似问
+ summary: 获取可移动目标知识库列表
tags:
- - FAQ管理
- /knowledge-bases/{id}/faq/entries/export:
+ - 知识库
+ /knowledge-bases/{id}/pin:
+ put:
+ consumes:
+ - application/json
+ description: 切换知识库的置顶状态
+ parameters:
+ - description: 知识库ID
+ in: path
+ name: id
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 更新后的知识库
+ schema:
+ additionalProperties: true
+ type: object
+ "404":
+ description: 知识库不存在
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: 置顶/取消置顶知识库
+ tags:
+ - 知识库
+ /knowledge-bases/{id}/shares:
get:
+ description: 获取知识库的所有共享记录
+ parameters:
+ - description: 知识库ID
+ in: path
+ name: id
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ListSharesResponse'
+ security:
+ - Bearer: []
+ summary: 获取知识库的共享列表
+ tags:
+ - 知识库共享
+ post:
consumes:
- application/json
- description: 将所有FAQ条目导出为CSV文件
+ description: 将知识库共享到指定组织
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
+ - description: 共享信息
+ in: body
+ name: request
+ required: true
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ShareKnowledgeBaseRequest'
produces:
- - text/csv
+ - application/json
responses:
- "200":
- description: CSV文件
+ "201":
+ description: Created
schema:
- type: file
- "400":
- description: 请求参数错误
+ additionalProperties: true
+ type: object
+ "403":
+ description: Forbidden
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 导出FAQ条目
+ summary: 共享知识库到组织
tags:
- - FAQ管理
- /knowledge-bases/{id}/faq/entries/fields:
- put:
- consumes:
- - application/json
- description: 批量更新FAQ条目的多个字段(is_enabled, is_recommended, tag_id)
+ - 知识库共享
+ /knowledge-bases/{id}/shares/{share_id}:
+ delete:
+ description: 取消知识库的共享
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: 字段更新请求
- in: body
- name: request
+ - description: 共享记录ID
+ in: path
+ name: share_id
required: true
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryFieldsBatchUpdate'
- produces:
- - application/json
+ type: string
responses:
"200":
- description: 更新成功
+ description: OK
schema:
additionalProperties: true
type: object
- "400":
- description: 请求参数错误
+ "403":
+ description: Forbidden
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 批量更新FAQ字段
+ summary: 取消共享
tags:
- - FAQ管理
- /knowledge-bases/{id}/faq/entries/tags:
+ - 知识库共享
put:
consumes:
- application/json
- description: 批量更新FAQ条目的标签
+ description: 更新知识库共享的权限级别
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: 标签更新请求
+ - description: 共享记录ID
+ in: path
+ name: share_id
+ required: true
+ type: string
+ - description: 权限信息
in: body
name: request
required: true
schema:
- type: object
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.UpdateSharePermissionRequest'
produces:
- application/json
responses:
"200":
- description: 更新成功
+ description: OK
schema:
additionalProperties: true
type: object
- "400":
- description: 请求参数错误
+ "403":
+ description: Forbidden
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 批量更新FAQ标签
+ summary: 更新共享权限
tags:
- - FAQ管理
- /knowledge-bases/{id}/faq/entry:
- post:
+ - 知识库共享
+ /knowledge-bases/{id}/tags:
+ get:
consumes:
- application/json
- description: 同步创建单个FAQ条目
+ description: 获取知识库下的所有标签及统计信息
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: FAQ条目
- in: body
- name: request
- required: true
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQEntryPayload'
+ - description: 页码
+ in: query
+ name: page
+ type: integer
+ - description: 每页数量
+ in: query
+ name: page_size
+ type: integer
+ - description: 关键词搜索
+ in: query
+ name: keyword
+ type: string
produces:
- application/json
responses:
"200":
- description: 创建的FAQ条目
+ description: 标签列表
schema:
additionalProperties: true
type: object
@@ -7620,31 +7708,37 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 创建单个FAQ条目
+ summary: 获取标签列表
tags:
- - FAQ管理
- /knowledge-bases/{id}/faq/import/last-result/display:
- put:
+ - 标签管理
+ post:
consumes:
- application/json
- description: 更新FAQ知识库导入结果统计卡片的显示或隐藏状态
+ description: 在知识库下创建新标签
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: 状态更新请求
+ - description: 标签信息
in: body
name: request
required: true
schema:
- $ref: '#/definitions/internal_handler.updateLastFAQImportResultDisplayStatusRequest'
+ properties:
+ color:
+ type: string
+ name:
+ type: string
+ sort_order:
+ type: integer
+ type: object
produces:
- application/json
responses:
"200":
- description: 更新成功
+ description: 创建的标签
schema:
additionalProperties: true
type: object
@@ -7652,38 +7746,46 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "404":
- description: 知识库不存在或无导入记录
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 更新FAQ最后一次导入结果显示状态
+ summary: 创建标签
tags:
- - FAQ管理
- /knowledge-bases/{id}/faq/search:
- post:
+ - 标签管理
+ /knowledge-bases/{id}/tags/{tag_id}:
+ delete:
consumes:
- application/json
- description: 使用混合搜索在FAQ中搜索,支持两级优先级标签召回:first_priority_tag_ids优先级最高,second_priority_tag_ids次之
+ description: 删除标签,可使用force=true强制删除被引用的标签,content_only=true仅删除标签下的内容而保留标签本身
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: 搜索请求
- in: body
- name: request
+ - description: 标签ID (UUID或seq_id)
+ in: path
+ name: tag_id
required: true
+ type: string
+ - description: 强制删除
+ in: query
+ name: force
+ type: boolean
+ - description: 仅删除内容,保留标签
+ in: query
+ name: content_only
+ type: boolean
+ - description: 删除选项
+ in: body
+ name: body
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQSearchRequest'
+ $ref: '#/definitions/internal_handler.DeleteTagRequest'
produces:
- application/json
responses:
"200":
- description: 搜索结果
+ description: 删除成功
schema:
additionalProperties: true
type: object
@@ -7694,31 +7796,35 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 搜索FAQ
+ summary: 删除标签
tags:
- - FAQ管理
- /knowledge-bases/{id}/hybrid-search:
- get:
+ - 标签管理
+ put:
consumes:
- application/json
- description: 在知识库中执行向量和关键词混合搜索
+ description: 更新标签信息
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- - description: 搜索参数
+ - description: 标签ID (UUID或seq_id)
+ in: path
+ name: tag_id
+ required: true
+ type: string
+ - description: 标签更新信息
in: body
name: request
required: true
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SearchParams'
+ type: object
produces:
- application/json
responses:
"200":
- description: 搜索结果
+ description: 更新后的标签
schema:
additionalProperties: true
type: object
@@ -7729,25 +7835,26 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 混合搜索
+ summary: 更新标签
tags:
- - 知识库
- /knowledge-bases/{id}/knowledge:
- delete:
+ - 标签管理
+ /knowledge-bases/copy:
+ post:
consumes:
- application/json
- description: 删除知识库下的所有知识条目(异步任务)。知识库本身保留,仅清空其中的内容
+ description: 将一个知识库的内容复制到另一个知识库(异步任务)
parameters:
- - description: 知识库ID
- in: path
- name: id
+ - description: 复制请求
+ in: body
+ name: request
required: true
- type: string
+ schema:
+ $ref: '#/definitions/internal_handler.CopyKnowledgeBaseRequest'
produces:
- application/json
responses:
"200":
- description: 清空任务已提交
+ description: 任务ID
schema:
additionalProperties: true
type: object
@@ -7755,114 +7862,57 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "403":
- description: 权限不足
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 清空知识库内容
- tags:
- - 知识管理
- get:
- consumes:
- - application/json
- description: 获取知识库下的知识列表,支持分页和筛选
- parameters:
- - description: 知识库ID
- in: path
- name: id
- required: true
- type: string
- - description: 页码
- in: query
- name: page
- type: integer
- - description: 每页数量
- in: query
- name: page_size
- type: integer
- - description: 标签ID筛选
- in: query
- name: tag_id
- type: string
- - description: 关键词搜索
- in: query
- name: keyword
- type: string
- - description: 文件类型筛选
- in: query
- name: file_type
- type: string
- - description: 解析状态筛选 (pending/processing/completed/failed)
- in: query
- name: parse_status
- type: string
- - description: 来源/渠道筛选 (web/api/feishu/notion/yuque/wechat/...,或 manual/url
- 按 type 过滤)
- in: query
- name: source
- type: string
- - description: 更新时间起点,RFC3339 格式
- in: query
- name: start_time
- type: string
- - description: 更新时间终点,RFC3339 格式
- in: query
- name: end_time
+ summary: 复制知识库
+ tags:
+ - 知识库
+ /knowledge-bases/copy/progress/{task_id}:
+ get:
+ consumes:
+ - application/json
+ description: 获取知识库复制任务的进度
+ parameters:
+ - description: 任务ID
+ in: path
+ name: task_id
+ required: true
type: string
produces:
- application/json
responses:
"200":
- description: 知识列表
+ description: 进度信息
schema:
additionalProperties: true
type: object
- "400":
- description: 请求参数错误
+ "404":
+ description: 任务不存在
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取知识列表
+ summary: 获取知识库复制进度
tags:
- - 知识管理
- /knowledge-bases/{id}/knowledge/file:
- post:
+ - 知识库
+ /knowledge/{id}:
+ delete:
consumes:
- - multipart/form-data
- description: 上传文件并创建知识条目
+ - application/json
+ description: 根据ID删除知识条目
parameters:
- - description: 知识库ID
+ - description: 知识ID
in: path
name: id
required: true
type: string
- - description: 上传的文件
- in: formData
- name: file
- required: true
- type: file
- - description: 自定义文件名
- in: formData
- name: fileName
- type: string
- - description: 元数据JSON
- in: formData
- name: metadata
- type: string
- - description: 启用多模态处理
- in: formData
- name: enable_multimodel
- type: boolean
produces:
- application/json
responses:
"200":
- description: 创建的知识
+ description: 删除成功
schema:
additionalProperties: true
type: object
@@ -7870,39 +7920,27 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "409":
- description: 文件重复
- schema:
- additionalProperties: true
- type: object
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 从文件创建知识
+ summary: 删除知识
tags:
- 知识管理
- /knowledge-bases/{id}/knowledge/manual:
- post:
+ get:
consumes:
- application/json
- description: 手工录入Markdown格式的知识内容
+ description: 根据ID获取知识条目详情
parameters:
- - description: 知识库ID
+ - description: 知识ID
in: path
name: id
required: true
type: string
- - description: 手工知识内容
- in: body
- name: request
- required: true
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ManualKnowledgePayload'
produces:
- application/json
responses:
"200":
- description: 创建的知识
+ description: 知识详情
schema:
additionalProperties: true
type: object
@@ -7910,47 +7948,37 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "404":
+ description: 知识不存在
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 手工创建知识
+ summary: 获取知识详情
tags:
- 知识管理
- /knowledge-bases/{id}/knowledge/url:
- post:
+ put:
consumes:
- application/json
- description: 从指定URL抓取内容并创建知识条目。当提供 file_name/file_type 或 URL 路径含已知文件扩展名时,自动切换为文件下载模式
+ description: 更新知识条目信息
parameters:
- - description: 知识库ID
+ - description: 知识ID
in: path
name: id
required: true
type: string
- - description: URL请求
+ - description: 知识信息
in: body
name: request
required: true
schema:
- properties:
- enable_multimodel:
- type: boolean
- file_name:
- type: string
- file_type:
- type: string
- tag_id:
- type: string
- title:
- type: string
- url:
- type: string
- type: object
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.Knowledge'
produces:
- application/json
responses:
- "201":
- description: 创建的知识
+ "200":
+ description: 更新成功
schema:
additionalProperties: true
type: object
@@ -7958,82 +7986,78 @@ paths:
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "409":
- description: URL重复
- schema:
- additionalProperties: true
- type: object
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 从URL创建知识
+ summary: 更新知识
tags:
- 知识管理
- /knowledge-bases/{id}/move-targets:
+ /knowledge/{id}/download:
get:
- description: 返回与源知识库 Type 一致、EmbeddingModelID 一致、非临时且不是自身的目标知识库列表
+ consumes:
+ - application/json
+ description: 下载知识条目关联的原始文件
parameters:
- - description: 源知识库 ID
+ - description: 知识ID
in: path
name: id
required: true
type: string
produces:
- - application/json
+ - application/octet-stream
responses:
"200":
- description: 可移动目标列表
+ description: 文件内容
schema:
- additionalProperties: true
- type: object
+ type: file
"400":
description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "404":
- description: 知识库不存在
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取可移动目标知识库列表
+ summary: 下载知识文件
tags:
- - 知识库
- /knowledge-bases/{id}/pin:
- put:
+ - 知识管理
+ /knowledge/{id}/preview:
+ get:
consumes:
- application/json
- description: 切换知识库的置顶状态
+ description: 返回知识条目关联的原始文件,Content-Type 根据文件类型设置,用于浏览器内嵌预览
parameters:
- - description: 知识库ID
+ - description: 知识ID
in: path
name: id
required: true
type: string
produces:
- - application/json
+ - application/pdf
+ - image/jpeg
+ - image/png
+ - text/plain
responses:
"200":
- description: 更新后的知识库
+ description: 文件内容
schema:
- additionalProperties: true
- type: object
- "404":
- description: 知识库不存在
+ type: file
+ "400":
+ description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 置顶/取消置顶知识库
+ summary: 预览知识文件
tags:
- - 知识库
- /knowledge-bases/{id}/shares:
- get:
- description: 获取知识库的所有共享记录
+ - 知识管理
+ /knowledge/{id}/reparse:
+ post:
+ consumes:
+ - application/json
+ description: 删除知识中现有的文档内容并重新解析,使用异步任务方式处理
parameters:
- - description: 知识库ID
+ - description: 知识ID
in: path
name: id
required: true
@@ -8042,142 +8066,163 @@ paths:
- application/json
responses:
"200":
- description: OK
+ description: 重新解析任务已提交
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ListSharesResponse'
+ additionalProperties: true
+ type: object
+ "400":
+ description: 请求参数错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ "403":
+ description: 权限不足
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- summary: 获取知识库的共享列表
+ - ApiKeyAuth: []
+ summary: 重新解析知识
tags:
- - 知识库共享
- post:
+ - 知识管理
+ /knowledge/batch:
+ get:
consumes:
- application/json
- description: 将知识库共享到指定组织
+ description: 根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的租户解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属租户查询(用于刷新后恢复共享知识库下的文件)
parameters:
- - description: 知识库ID
- in: path
- name: id
+ - collectionFormat: csv
+ description: 知识ID列表
+ in: query
+ items:
+ type: string
+ name: ids
required: true
+ type: array
+ - description: 可选,知识库ID(用于共享知识库时指定范围)
+ in: query
+ name: kb_id
+ type: string
+ - description: 可选,共享智能体ID(用于按智能体租户批量拉取文件详情)
+ in: query
+ name: agent_id
type: string
- - description: 共享信息
- in: body
- name: request
- required: true
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ShareKnowledgeBaseRequest'
produces:
- application/json
responses:
- "201":
- description: Created
+ "200":
+ description: 知识列表
schema:
additionalProperties: true
type: object
- "403":
- description: Forbidden
+ "400":
+ description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- summary: 共享知识库到组织
+ - ApiKeyAuth: []
+ summary: 批量获取知识
tags:
- - 知识库共享
- /knowledge-bases/{id}/shares/{share_id}:
- delete:
- description: 取消知识库的共享
+ - 知识管理
+ /knowledge/batch-delete:
+ post:
+ consumes:
+ - application/json
+ description: 按 ID 列表批量删除单个知识库下的多个知识条目
parameters:
- - description: 知识库ID
- in: path
- name: id
- required: true
- type: string
- - description: 共享记录ID
- in: path
- name: share_id
+ - description: 批量删除请求
+ in: body
+ name: request
required: true
- type: string
+ schema:
+ $ref: '#/definitions/internal_handler.BatchDeleteKnowledgeRequest'
+ produces:
+ - application/json
responses:
"200":
- description: OK
+ description: 删除成功
schema:
additionalProperties: true
type: object
+ "400":
+ description: 请求参数错误
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
"403":
- description: Forbidden
+ description: 权限不足
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- summary: 取消共享
+ - ApiKeyAuth: []
+ summary: 批量删除知识
tags:
- - 知识库共享
+ - 知识管理
+ /knowledge/image/{id}/{chunk_id}:
put:
consumes:
- application/json
- description: 更新知识库共享的权限级别
+ description: 更新知识分块的图像信息
parameters:
- - description: 知识库ID
+ - description: 知识ID
in: path
name: id
required: true
type: string
- - description: 共享记录ID
+ - description: 分块ID
in: path
- name: share_id
+ name: chunk_id
required: true
type: string
- - description: 权限信息
+ - description: 图像信息
in: body
name: request
required: true
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.UpdateSharePermissionRequest'
+ properties:
+ image_info:
+ type: string
+ type: object
produces:
- application/json
responses:
"200":
- description: OK
+ description: 更新成功
schema:
additionalProperties: true
type: object
- "403":
- description: Forbidden
+ "400":
+ description: 请求参数错误
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- summary: 更新共享权限
+ - ApiKeyAuth: []
+ summary: 更新图像信息
tags:
- - 知识库共享
- /knowledge-bases/{id}/tags:
- get:
+ - 知识管理
+ /knowledge/manual/{id}:
+ put:
consumes:
- application/json
- description: 获取知识库下的所有标签及统计信息
+ description: 更新手工录入的Markdown知识内容
parameters:
- - description: 知识库ID
+ - description: 知识ID
in: path
name: id
required: true
type: string
- - description: 页码
- in: query
- name: page
- type: integer
- - description: 每页数量
- in: query
- name: page_size
- type: integer
- - description: 关键词搜索
- in: query
- name: keyword
- type: string
+ - description: 手工知识内容
+ in: body
+ name: request
+ required: true
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ManualKnowledgePayload'
produces:
- application/json
responses:
"200":
- description: 标签列表
+ description: 更新后的知识
schema:
additionalProperties: true
type: object
@@ -8188,40 +8233,28 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取标签列表
+ summary: 更新手工知识
tags:
- - 标签管理
+ - 知识管理
+ /knowledge/move:
post:
consumes:
- application/json
- description: 在知识库下创建新标签
+ description: 将一条或多条知识从源知识库移动到目标知识库(异步),返回任务 ID 用于查询进度
parameters:
- - description: 知识库ID
- in: path
- name: id
- required: true
- type: string
- - description: 标签信息
+ - description: '{source_kb_id, target_kb_id, knowledge_ids}'
in: body
name: request
required: true
schema:
- properties:
- color:
- type: string
- name:
- type: string
- sort_order:
- type: integer
- type: object
+ $ref: '#/definitions/internal_handler.MoveKnowledgeRequest'
produces:
- application/json
responses:
"200":
- description: 创建的标签
+ description: 任务信息
schema:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/internal_handler.MoveKnowledgeResponse'
"400":
description: 请求参数错误
schema:
@@ -8229,72 +8262,87 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 创建标签
+ summary: 移动知识到其他知识库
tags:
- - 标签管理
- /knowledge-bases/{id}/tags/{tag_id}:
- delete:
- consumes:
- - application/json
- description: 删除标签,可使用force=true强制删除被引用的标签,content_only=true仅删除标签下的内容而保留标签本身
+ - 知识
+ /knowledge/move/progress/{task_id}:
+ get:
+ description: 按任务 ID 查询移动进度
parameters:
- - description: 知识库ID
+ - description: 移动任务 ID
in: path
- name: id
+ name: task_id
required: true
type: string
- - description: 标签ID (UUID或seq_id)
- in: path
- name: tag_id
- required: true
+ produces:
+ - application/json
+ 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'
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: 获取知识移动进度
+ tags:
+ - 知识
+ /knowledge/search:
+ get:
+ consumes:
+ - application/json
+ description: Search knowledge files by keyword. When agent_id is set (shared
+ agent), scope is the agent's configured knowledge bases.
+ parameters:
+ - description: Keyword to search
+ in: query
+ name: keyword
type: string
- - description: 强制删除
+ - description: Offset for pagination
in: query
- name: force
- type: boolean
- - description: 仅删除内容,保留标签
+ name: offset
+ type: integer
+ - description: Limit for pagination (default 20)
in: query
- name: content_only
- type: boolean
- - description: 删除选项
- in: body
- name: body
- schema:
- $ref: '#/definitions/internal_handler.DeleteTagRequest'
+ name: limit
+ type: integer
+ - description: Comma-separated file extensions to filter (e.g., csv,xlsx)
+ in: query
+ name: file_types
+ type: string
+ - description: Shared agent ID (search within agent's KB scope)
+ in: query
+ name: agent_id
+ type: string
produces:
- application/json
responses:
"200":
- description: 删除成功
+ description: Search results
schema:
additionalProperties: true
type: object
"400":
- description: 请求参数错误
+ description: Invalid request
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 删除标签
+ summary: Search knowledge
tags:
- - 标签管理
+ - Knowledge
+ /knowledge/tags:
put:
consumes:
- application/json
- description: 更新标签信息
+ description: 批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的租户解析
parameters:
- - description: 知识库ID
- in: path
- name: id
- required: true
- type: string
- - description: 标签ID (UUID或seq_id)
- in: path
- name: tag_id
- required: true
- type: string
- - description: 标签更新信息
+ - description: 标签更新请求(updates 必填,kb_id 可选)
in: body
name: request
required: true
@@ -8304,7 +8352,7 @@ paths:
- application/json
responses:
"200":
- description: 更新后的标签
+ description: 更新成功
schema:
additionalProperties: true
type: object
@@ -8315,537 +8363,489 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 更新标签
+ summary: 批量更新知识标签
tags:
- - 标签管理
- /knowledge-bases/copy:
+ - 知识管理
+ /knowledgebase/{kb_id}/wiki/auto-fix:
post:
- consumes:
- - application/json
- description: 将一个知识库的内容复制到另一个知识库(异步任务)
+ description: Automatically fix fixable wiki issues (broken links, etc.)
parameters:
- - description: 复制请求
- in: body
- name: request
+ - description: Knowledge base ID
+ in: path
+ name: kb_id
required: true
- schema:
- $ref: '#/definitions/internal_handler.CopyKnowledgeBaseRequest'
+ type: string
produces:
- application/json
responses:
"200":
- description: 任务ID
+ description: OK
schema:
additionalProperties: true
type: object
- "400":
- description: 请求参数错误
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 复制知识库
+ summary: Auto-fix wiki issues
tags:
- - 知识库
- /knowledge-bases/copy/progress/{task_id}:
+ - Wiki
+ /knowledgebase/{kb_id}/wiki/graph:
get:
- consumes:
- - application/json
- description: 获取知识库复制任务的进度
+ description: |-
+ Returns a slice of the wiki link graph for visualization. Supports
+ `mode=overview` (top-N most-connected pages, default) and
+ `mode=ego` (BFS neighborhood of a center slug) to keep response
+ size tractable for knowledge bases with tens of thousands of pages.
parameters:
- - description: 任务ID
+ - description: Knowledge base ID
in: path
- name: task_id
+ name: kb_id
required: true
type: string
+ - description: overview (default) | ego
+ in: query
+ name: mode
+ type: string
+ - description: Center slug for ego mode
+ in: query
+ name: center
+ type: string
+ - description: Ego BFS depth (1-3, default 1)
+ in: query
+ name: depth
+ type: integer
+ - description: Comma-separated page_type allow-list
+ in: query
+ name: types
+ type: string
+ - description: Max nodes to return (default 500, max 2000)
+ in: query
+ name: limit
+ type: integer
produces:
- application/json
responses:
"200":
- description: 进度信息
- schema:
- additionalProperties: true
- type: object
- "404":
- description: 任务不存在
+ description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiGraphData'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 获取知识库复制进度
+ summary: Get wiki link graph
tags:
- - 知识库
- /knowledge/{id}:
- delete:
- consumes:
- - application/json
- description: 根据ID删除知识条目
+ - Wiki
+ /knowledgebase/{kb_id}/wiki/index:
+ get:
+ description: |-
+ Returns the wiki index as intro text plus per-type paginated
+ directory groups. The heavy directory markdown that used to
+ live in wiki_pages.content was replaced with this structured
+ response so a KB with tens of thousands of pages no longer
+ materializes megabytes of TEXT on every index open.
parameters:
- - description: 知识ID
+ - description: Knowledge base ID
in: path
- name: id
+ name: kb_id
required: true
type: string
+ - description: 'Comma-separated page types (default: all content types)'
+ in: query
+ name: types
+ type: string
+ - description: Per-group window size, 1-200 (default 50)
+ in: query
+ name: limit
+ type: integer
+ - description: Opaque offset cursor from previous response
+ in: query
+ name: cursor
+ type: string
produces:
- application/json
responses:
"200":
- description: 删除成功
- schema:
- additionalProperties: true
- type: object
- "400":
- description: 请求参数错误
+ description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiIndexResponse'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 删除知识
+ summary: Get wiki index view
tags:
- - 知识管理
+ - Wiki
+ /knowledgebase/{kb_id}/wiki/issues:
get:
- consumes:
- - application/json
- description: 根据ID获取知识条目详情
+ description: List issues flagged on wiki pages with optional filtering
parameters:
- - description: 知识ID
+ - description: Knowledge base ID
in: path
- name: id
+ name: kb_id
required: true
type: string
+ - description: Filter by page slug
+ in: query
+ name: slug
+ type: string
+ - description: Filter by status (pending, ignored, resolved)
+ in: query
+ name: status
+ type: string
produces:
- application/json
responses:
"200":
- description: 知识详情
- schema:
- additionalProperties: true
- type: object
- "400":
- description: 请求参数错误
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "404":
- description: 知识不存在
+ description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ items:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageIssue'
+ type: array
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 获取知识详情
+ summary: List wiki page issues
tags:
- - 知识管理
+ - Wiki
+ /knowledgebase/{kb_id}/wiki/issues/{issue_id}/status:
put:
consumes:
- application/json
- description: 更新知识条目信息
+ description: Update the status of a flagged wiki page issue
parameters:
- - description: 知识ID
+ - description: Knowledge base ID
in: path
- name: id
+ name: kb_id
required: true
type: string
- - description: 知识信息
+ - description: Issue ID
+ in: path
+ name: issue_id
+ required: true
+ type: string
+ - description: 'New status {''status'': ''ignored''}'
in: body
- name: request
+ name: status
required: true
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.Knowledge'
+ type: object
produces:
- application/json
responses:
"200":
- description: 更新成功
+ description: OK
schema:
- additionalProperties: true
+ additionalProperties:
+ type: string
type: object
"400":
- description: 请求参数错误
+ description: Bad Request
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 更新知识
+ summary: Update wiki page issue status
tags:
- - 知识管理
- /knowledge/{id}/download:
+ - Wiki
+ /knowledgebase/{kb_id}/wiki/lint:
get:
- consumes:
- - application/json
- description: 下载知识条目关联的原始文件
+ description: Perform a comprehensive health check on the wiki
parameters:
- - description: 知识ID
+ - description: Knowledge base ID
in: path
- name: id
+ name: kb_id
required: true
type: string
produces:
- - application/octet-stream
+ - application/json
responses:
"200":
- description: 文件内容
- schema:
- type: file
- "400":
- description: 请求参数错误
+ description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_application_service.WikiLintReport'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 下载知识文件
+ summary: Run wiki lint
tags:
- - 知识管理
- /knowledge/{id}/preview:
+ - Wiki
+ /knowledgebase/{kb_id}/wiki/log:
get:
- consumes:
- - application/json
- description: 返回知识条目关联的原始文件,Content-Type 根据文件类型设置,用于浏览器内嵌预览
+ description: |-
+ Returns a paginated feed of wiki operation events (ingest, retract, ...)
+ newest-first. Pagination is cursor-based: pass `next_cursor` from the
+ previous response back as `cursor` to fetch the next page.
parameters:
- - description: 知识ID
+ - description: Knowledge base ID
in: path
- name: id
+ name: kb_id
required: true
type: string
- produces:
- - application/pdf
- - image/jpeg
- - image/png
- - text/plain
- responses:
- "200":
- description: 文件内容
- schema:
- type: file
- "400":
- description: 请求参数错误
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- security:
- - Bearer: []
- - ApiKeyAuth: []
- summary: 预览知识文件
- tags:
- - 知识管理
- /knowledge/{id}/reparse:
- post:
- consumes:
- - application/json
- description: 删除知识中现有的文档内容并重新解析,使用异步任务方式处理
- parameters:
- - description: 知识ID
- in: path
- name: id
- required: true
+ - description: Opaque cursor from the previous page (empty = newest)
+ in: query
+ name: cursor
type: string
+ - description: Page size, 1-200 (default 50)
+ in: query
+ name: limit
+ type: integer
produces:
- application/json
responses:
"200":
- description: 重新解析任务已提交
- schema:
- additionalProperties: true
- type: object
- "400":
- description: 请求参数错误
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "403":
- description: 权限不足
+ description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiLogEntryListResponse'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 重新解析知识
+ summary: Get wiki operation log
tags:
- - 知识管理
- /knowledge/batch:
+ - Wiki
+ /knowledgebase/{kb_id}/wiki/pages:
get:
- consumes:
- - application/json
- description: 根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的租户解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属租户查询(用于刷新后恢复共享知识库下的文件)
+ description: List wiki pages with optional filtering and pagination
parameters:
- - collectionFormat: csv
- description: 知识ID列表
- in: query
- items:
- type: string
- name: ids
+ - description: Knowledge base ID
+ in: path
+ name: kb_id
required: true
- type: array
- - description: 可选,知识库ID(用于共享知识库时指定范围)
+ type: string
+ - description: Filter by page type
in: query
- name: kb_id
+ name: page_type
type: string
- - description: 可选,共享智能体ID(用于按智能体租户批量拉取文件详情)
+ - description: Filter by status
in: query
- name: agent_id
+ name: status
+ type: string
+ - description: Full-text search
+ in: query
+ name: query
+ type: string
+ - description: Page number
+ in: query
+ name: page
+ type: integer
+ - description: Page size
+ in: query
+ name: page_size
+ type: integer
+ - description: Sort field
+ in: query
+ name: sort_by
+ type: string
+ - description: Sort order (asc/desc)
+ in: query
+ name: sort_order
type: string
produces:
- application/json
responses:
"200":
- description: 知识列表
+ description: OK
schema:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPageListResponse'
"400":
- description: 请求参数错误
+ description: Bad Request
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 批量获取知识
+ summary: List wiki pages
tags:
- - 知识管理
- /knowledge/batch-delete:
+ - Wiki
post:
consumes:
- application/json
- description: 按 ID 列表批量删除单个知识库下的多个知识条目
+ description: Create a new wiki page in the knowledge base
parameters:
- - description: 批量删除请求
+ - description: Knowledge base ID
+ in: path
+ name: kb_id
+ required: true
+ type: string
+ - description: Wiki page data
in: body
- name: request
+ name: page
required: true
schema:
- $ref: '#/definitions/internal_handler.BatchDeleteKnowledgeRequest'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage'
produces:
- application/json
responses:
- "200":
- description: 删除成功
+ "201":
+ description: Created
schema:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage'
"400":
- description: 请求参数错误
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
- "403":
- description: 权限不足
+ description: Bad Request
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 批量删除知识
+ summary: Create a wiki page
tags:
- - 知识管理
- /knowledge/image/{id}/{chunk_id}:
- put:
- consumes:
- - application/json
- description: 更新知识分块的图像信息
+ - Wiki
+ /knowledgebase/{kb_id}/wiki/pages/{slug}:
+ delete:
+ description: Soft-delete a wiki page by slug
parameters:
- - description: 知识ID
+ - description: Knowledge base ID
in: path
- name: id
+ name: kb_id
required: true
type: string
- - description: 分块ID
+ - description: Page slug
in: path
- name: chunk_id
+ name: slug
required: true
type: string
- - description: 图像信息
- in: body
- name: request
- required: true
- schema:
- properties:
- image_info:
- type: string
- type: object
- produces:
- - application/json
responses:
- "200":
- description: 更新成功
- schema:
- additionalProperties: true
- type: object
- "400":
- description: 请求参数错误
+ "204":
+ description: No Content
+ "404":
+ description: Not Found
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 更新图像信息
+ summary: Delete a wiki page
tags:
- - 知识管理
- /knowledge/manual/{id}:
- put:
- consumes:
- - application/json
- description: 更新手工录入的Markdown知识内容
+ - Wiki
+ get:
+ description: Retrieve a wiki page by its slug
parameters:
- - description: 知识ID
+ - description: Knowledge base ID
in: path
- name: id
+ name: kb_id
required: true
type: string
- - description: 手工知识内容
- in: body
- name: request
+ - description: Page slug
+ in: path
+ name: slug
required: true
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ManualKnowledgePayload'
+ type: string
produces:
- application/json
responses:
"200":
- description: 更新后的知识
+ description: OK
schema:
- additionalProperties: true
- type: object
- "400":
- description: 请求参数错误
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage'
+ "404":
+ description: Not Found
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 更新手工知识
+ summary: Get a wiki page by slug
tags:
- - 知识管理
- /knowledge/move:
- post:
+ - Wiki
+ put:
consumes:
- application/json
- description: 将一条或多条知识从源知识库移动到目标知识库(异步),返回任务 ID 用于查询进度
+ description: Update an existing wiki page by slug
parameters:
- - description: '{source_kb_id, target_kb_id, knowledge_ids}'
+ - description: Knowledge base ID
+ in: path
+ name: kb_id
+ required: true
+ type: string
+ - description: Page slug
+ in: path
+ name: slug
+ required: true
+ type: string
+ - description: Updated wiki page data
in: body
- name: request
+ name: page
required: true
schema:
- $ref: '#/definitions/internal_handler.MoveKnowledgeRequest'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage'
produces:
- application/json
responses:
"200":
- description: 任务信息
+ description: OK
schema:
- $ref: '#/definitions/internal_handler.MoveKnowledgeResponse'
- "400":
- description: 请求参数错误
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage'
+ "404":
+ description: Not Found
schema:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 移动知识到其他知识库
+ summary: Update a wiki page
tags:
- - 知识
- /knowledge/move/progress/{task_id}:
- get:
- description: 按任务 ID 查询移动进度
+ - Wiki
+ /knowledgebase/{kb_id}/wiki/rebuild-links:
+ post:
+ description: Re-parse all pages and rebuild bidirectional link references
parameters:
- - description: 移动任务 ID
+ - description: Knowledge base ID
in: path
- name: task_id
+ name: kb_id
required: true
type: string
- produces:
- - application/json
responses:
"200":
- description: 进度信息
- schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeMoveProgress'
- "404":
- description: 任务不存在
+ description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ additionalProperties:
+ type: string
+ type: object
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 获取知识移动进度
+ summary: Rebuild wiki links
tags:
- - 知识
- /knowledge/search:
+ - Wiki
+ /knowledgebase/{kb_id}/wiki/search:
get:
- consumes:
- - application/json
- description: Search knowledge files by keyword. When agent_id is set (shared
- agent), scope is the agent's configured knowledge bases.
+ description: Full-text search over wiki pages
parameters:
- - description: Keyword to search
- in: query
- name: keyword
+ - description: Knowledge base ID
+ in: path
+ name: kb_id
+ required: true
type: string
- - description: Offset for pagination
+ - description: Search query
in: query
- name: offset
- type: integer
- - description: Limit for pagination (default 20)
+ name: q
+ required: true
+ type: string
+ - description: Max results (default 10)
in: query
name: limit
type: integer
- - description: Comma-separated file extensions to filter (e.g., csv,xlsx)
- in: query
- name: file_types
- type: string
- - description: Shared agent ID (search within agent's KB scope)
- in: query
- name: agent_id
- type: string
produces:
- application/json
responses:
"200":
- description: Search results
- schema:
- additionalProperties: true
- type: object
- "400":
- description: Invalid request
+ description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ items:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiPage'
+ type: array
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: Search knowledge
+ summary: Search wiki pages
tags:
- - Knowledge
- /knowledge/tags:
- put:
- consumes:
- - application/json
- description: 批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的租户解析
+ - Wiki
+ /knowledgebase/{kb_id}/wiki/stats:
+ get:
+ description: Returns aggregate statistics about the wiki
parameters:
- - description: 标签更新请求(updates 必填,kb_id 可选)
- in: body
- name: request
+ - description: Knowledge base ID
+ in: path
+ name: kb_id
required: true
- schema:
- type: object
+ type: string
produces:
- application/json
responses:
"200":
- description: 更新成功
- schema:
- additionalProperties: true
- type: object
- "400":
- description: 请求参数错误
+ description: OK
schema:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiStats'
security:
- Bearer: []
- - ApiKeyAuth: []
- summary: 批量更新知识标签
+ summary: Get wiki statistics
tags:
- - 知识管理
+ - Wiki
/mcp-services:
get:
consumes:
diff --git a/internal/handler/datasource.go b/internal/handler/datasource.go
index 42915c03f..e9d684bba 100644
--- a/internal/handler/datasource.go
+++ b/internal/handler/datasource.go
@@ -84,7 +84,7 @@ func (h *DataSourceHandler) getOwnedDataSource(
// @Param request body types.DataSource true "Data source configuration"
// @Success 201 {object} types.DataSource
// @Failure 400 {object} map[string]string
-// @Router /api/v1/datasource [post]
+// @Router /datasource [post]
func (h *DataSourceHandler) CreateDataSource(c *gin.Context) {
ctx := c.Request.Context()
@@ -126,7 +126,7 @@ func (h *DataSourceHandler) CreateDataSource(c *gin.Context) {
// @Param id path string true "Data source ID"
// @Success 200 {object} types.DataSource
// @Failure 404 {object} map[string]string
-// @Router /api/v1/datasource/{id} [get]
+// @Router /datasource/{id} [get]
func (h *DataSourceHandler) GetDataSource(c *gin.Context) {
ctx := c.Request.Context()
tenantID := h.getTenantID(c)
@@ -154,7 +154,7 @@ func (h *DataSourceHandler) GetDataSource(c *gin.Context) {
// @Param kb_id query string true "Knowledge base ID"
// @Success 200 {object} []types.DataSource
// @Failure 400 {object} map[string]string
-// @Router /api/v1/datasource [get]
+// @Router /datasource [get]
func (h *DataSourceHandler) ListDataSources(c *gin.Context) {
ctx := c.Request.Context()
@@ -193,7 +193,7 @@ func (h *DataSourceHandler) ListDataSources(c *gin.Context) {
// @Param request body types.DataSource true "Updated configuration"
// @Success 200 {object} types.DataSource
// @Failure 400 {object} map[string]string
-// @Router /api/v1/datasource/{id} [put]
+// @Router /datasource/{id} [put]
func (h *DataSourceHandler) UpdateDataSource(c *gin.Context) {
ctx := c.Request.Context()
tenantID := h.getTenantID(c)
@@ -235,7 +235,7 @@ func (h *DataSourceHandler) UpdateDataSource(c *gin.Context) {
// @Param id path string true "Data source ID"
// @Success 204
// @Failure 404 {object} map[string]string
-// @Router /api/v1/datasource/{id} [delete]
+// @Router /datasource/{id} [delete]
func (h *DataSourceHandler) DeleteDataSource(c *gin.Context) {
ctx := c.Request.Context()
tenantID := h.getTenantID(c)
@@ -266,7 +266,7 @@ func (h *DataSourceHandler) DeleteDataSource(c *gin.Context) {
// @Param id path string true "Data source ID"
// @Success 200 {object} map[string]string
// @Failure 400 {object} map[string]string
-// @Router /api/v1/datasource/{id}/validate [post]
+// @Router /datasource/{id}/validate [post]
func (h *DataSourceHandler) ValidateConnection(c *gin.Context) {
ctx := c.Request.Context()
tenantID := h.getTenantID(c)
@@ -303,7 +303,7 @@ func (h *DataSourceHandler) ValidateConnection(c *gin.Context) {
// @Param request body object true "type and credentials"
// @Success 200 {object} map[string]string
// @Failure 400 {object} map[string]string
-// @Router /api/v1/datasource/validate-credentials [post]
+// @Router /datasource/validate-credentials [post]
func (h *DataSourceHandler) ValidateCredentials(c *gin.Context) {
ctx := c.Request.Context()
tenantID := h.getTenantID(c)
@@ -336,7 +336,7 @@ func (h *DataSourceHandler) ValidateCredentials(c *gin.Context) {
// @Param id path string true "Data source ID"
// @Success 200 {object} []types.Resource
// @Failure 400 {object} map[string]string
-// @Router /api/v1/datasource/{id}/resources [get]
+// @Router /datasource/{id}/resources [get]
func (h *DataSourceHandler) ListAvailableResources(c *gin.Context) {
ctx := c.Request.Context()
tenantID := h.getTenantID(c)
@@ -371,7 +371,7 @@ func (h *DataSourceHandler) ListAvailableResources(c *gin.Context) {
// @Param id path string true "Data source ID"
// @Success 200 {object} types.SyncLog
// @Failure 400 {object} map[string]string
-// @Router /api/v1/datasource/{id}/sync [post]
+// @Router /datasource/{id}/sync [post]
func (h *DataSourceHandler) ManualSync(c *gin.Context) {
ctx := c.Request.Context()
tenantID := h.getTenantID(c)
@@ -403,7 +403,7 @@ func (h *DataSourceHandler) ManualSync(c *gin.Context) {
// @Param id path string true "Data source ID"
// @Success 200 {object} map[string]string
// @Failure 400 {object} map[string]string
-// @Router /api/v1/datasource/{id}/pause [post]
+// @Router /datasource/{id}/pause [post]
func (h *DataSourceHandler) PauseDataSource(c *gin.Context) {
ctx := c.Request.Context()
tenantID := h.getTenantID(c)
@@ -434,7 +434,7 @@ func (h *DataSourceHandler) PauseDataSource(c *gin.Context) {
// @Param id path string true "Data source ID"
// @Success 200 {object} map[string]string
// @Failure 400 {object} map[string]string
-// @Router /api/v1/datasource/{id}/resume [post]
+// @Router /datasource/{id}/resume [post]
func (h *DataSourceHandler) ResumeDataSource(c *gin.Context) {
ctx := c.Request.Context()
tenantID := h.getTenantID(c)
@@ -468,7 +468,7 @@ func (h *DataSourceHandler) ResumeDataSource(c *gin.Context) {
// @Param offset query int false "Offset (default: 0)"
// @Success 200 {object} []types.SyncLog
// @Failure 400 {object} map[string]string
-// @Router /api/v1/datasource/{id}/logs [get]
+// @Router /datasource/{id}/logs [get]
func (h *DataSourceHandler) GetSyncLogs(c *gin.Context) {
ctx := c.Request.Context()
tenantID := h.getTenantID(c)
@@ -519,7 +519,7 @@ func (h *DataSourceHandler) GetSyncLogs(c *gin.Context) {
// @Param log_id path string true "Sync log ID"
// @Success 200 {object} types.SyncLog
// @Failure 404 {object} map[string]string
-// @Router /api/v1/datasource/logs/{log_id} [get]
+// @Router /datasource/logs/{log_id} [get]
func (h *DataSourceHandler) GetSyncLog(c *gin.Context) {
ctx := c.Request.Context()
tenantID := h.getTenantID(c)
@@ -550,7 +550,7 @@ func (h *DataSourceHandler) GetSyncLog(c *gin.Context) {
// @Tags DataSource
// @Produce json
// @Success 200 {object} []datasource.ConnectorMetadata
-// @Router /api/v1/datasource/types [get]
+// @Router /datasource/types [get]
func (h *DataSourceHandler) GetAvailableConnectors(c *gin.Context) {
connectors := datasource.ListAvailableConnectors()
c.JSON(http.StatusOK, connectors)
diff --git a/internal/handler/wiki_page.go b/internal/handler/wiki_page.go
index 4a354c3b6..3b626aef8 100644
--- a/internal/handler/wiki_page.go
+++ b/internal/handler/wiki_page.go
@@ -87,7 +87,7 @@ func getSlugParam(c *gin.Context) string {
// @Success 200 {object} types.WikiPageListResponse
// @Failure 400 {object} errors.AppError
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/pages [get]
+// @Router /knowledgebase/{kb_id}/wiki/pages [get]
func (h *WikiPageHandler) ListPages(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {
@@ -129,7 +129,7 @@ func (h *WikiPageHandler) ListPages(c *gin.Context) {
// @Success 201 {object} types.WikiPage
// @Failure 400 {object} errors.AppError
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/pages [post]
+// @Router /knowledgebase/{kb_id}/wiki/pages [post]
func (h *WikiPageHandler) CreatePage(c *gin.Context) {
kbID, tenantID, err := h.validateWikiKB(c)
if err != nil {
@@ -165,7 +165,7 @@ func (h *WikiPageHandler) CreatePage(c *gin.Context) {
// @Success 200 {object} types.WikiPage
// @Failure 404 {object} errors.AppError
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/pages/{slug} [get]
+// @Router /knowledgebase/{kb_id}/wiki/pages/{slug} [get]
func (h *WikiPageHandler) GetPage(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {
@@ -204,7 +204,7 @@ func (h *WikiPageHandler) GetPage(c *gin.Context) {
// @Success 200 {object} types.WikiPage
// @Failure 404 {object} errors.AppError
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/pages/{slug} [put]
+// @Router /knowledgebase/{kb_id}/wiki/pages/{slug} [put]
func (h *WikiPageHandler) UpdatePage(c *gin.Context) {
kbID, tenantID, err := h.validateWikiKB(c)
if err != nil {
@@ -250,7 +250,7 @@ func (h *WikiPageHandler) UpdatePage(c *gin.Context) {
// @Success 204
// @Failure 404 {object} errors.AppError
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/pages/{slug} [delete]
+// @Router /knowledgebase/{kb_id}/wiki/pages/{slug} [delete]
func (h *WikiPageHandler) DeletePage(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {
@@ -291,7 +291,7 @@ func (h *WikiPageHandler) DeletePage(c *gin.Context) {
// @Param cursor query string false "Opaque offset cursor from previous response"
// @Success 200 {object} types.WikiIndexResponse
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/index [get]
+// @Router /knowledgebase/{kb_id}/wiki/index [get]
func (h *WikiPageHandler) GetIndex(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {
@@ -337,7 +337,7 @@ func (h *WikiPageHandler) GetIndex(c *gin.Context) {
// @Param limit query int false "Page size, 1-200 (default 50)"
// @Success 200 {object} types.WikiLogEntryListResponse
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/log [get]
+// @Router /knowledgebase/{kb_id}/wiki/log [get]
func (h *WikiPageHandler) GetLog(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {
@@ -391,7 +391,7 @@ const (
// @Param limit query int false "Max nodes to return (default 500, max 2000)"
// @Success 200 {object} types.WikiGraphData
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/graph [get]
+// @Router /knowledgebase/{kb_id}/wiki/graph [get]
func (h *WikiPageHandler) GetGraph(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {
@@ -476,7 +476,7 @@ func (h *WikiPageHandler) GetGraph(c *gin.Context) {
// @Param kb_id path string true "Knowledge base ID"
// @Success 200 {object} types.WikiStats
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/stats [get]
+// @Router /knowledgebase/{kb_id}/wiki/stats [get]
func (h *WikiPageHandler) GetStats(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {
@@ -503,7 +503,7 @@ func (h *WikiPageHandler) GetStats(c *gin.Context) {
// @Param status query string false "Filter by status (pending, ignored, resolved)"
// @Success 200 {array} types.WikiPageIssue
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/issues [get]
+// @Router /knowledgebase/{kb_id}/wiki/issues [get]
func (h *WikiPageHandler) ListIssues(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {
@@ -535,7 +535,7 @@ func (h *WikiPageHandler) ListIssues(c *gin.Context) {
// @Success 200 {object} map[string]string
// @Failure 400 {object} errors.AppError
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/issues/{issue_id}/status [put]
+// @Router /knowledgebase/{kb_id}/wiki/issues/{issue_id}/status [put]
func (h *WikiPageHandler) UpdateIssueStatus(c *gin.Context) {
_, _, err := h.validateWikiKB(c)
if err != nil {
@@ -581,7 +581,7 @@ func (h *WikiPageHandler) UpdateIssueStatus(c *gin.Context) {
// @Param limit query int false "Max results (default 10)"
// @Success 200 {array} types.WikiPage
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/search [get]
+// @Router /knowledgebase/{kb_id}/wiki/search [get]
func (h *WikiPageHandler) SearchPages(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {
@@ -613,7 +613,7 @@ func (h *WikiPageHandler) SearchPages(c *gin.Context) {
// @Param kb_id path string true "Knowledge base ID"
// @Success 200 {object} map[string]string
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/rebuild-links [post]
+// @Router /knowledgebase/{kb_id}/wiki/rebuild-links [post]
func (h *WikiPageHandler) RebuildLinks(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {
@@ -637,7 +637,7 @@ func (h *WikiPageHandler) RebuildLinks(c *gin.Context) {
// @Param kb_id path string true "Knowledge base ID"
// @Success 200 {object} service.WikiLintReport
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/lint [get]
+// @Router /knowledgebase/{kb_id}/wiki/lint [get]
func (h *WikiPageHandler) Lint(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {
@@ -662,7 +662,7 @@ func (h *WikiPageHandler) Lint(c *gin.Context) {
// @Param kb_id path string true "Knowledge base ID"
// @Success 200 {object} map[string]interface{}
// @Security Bearer
-// @Router /api/v1/knowledgebase/{kb_id}/wiki/auto-fix [post]
+// @Router /knowledgebase/{kb_id}/wiki/auto-fix [post]
func (h *WikiPageHandler) AutoFix(c *gin.Context) {
kbID, _, err := h.validateWikiKB(c)
if err != nil {