Skip to content

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

feat: 新增API Key认证支持,优化Swagger文档安全配置

wizardchenac21f81dda45
diff --git a/cmd/server/main.go b/cmd/server/main.go
index bb751d340..23b5cd8e3 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -15,7 +15,12 @@
// @securityDefinitions.apikey Bearer
// @in header
// @name Authorization
-// @description 输入 Bearer {token} 格式的 JWT 令牌
+// @description 用户登录认证:输入 Bearer {token} 格式的 JWT 令牌
+
+// @securityDefinitions.apikey ApiKeyAuth
+// @in header
+// @name X-API-Key
+// @description 租户身份认证:输入 sk- 开头的 API Key
package main
import (
diff --git a/docs/docs.go b/docs/docs.go
index dc56dac7f..037808a14 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -19,30 +19,6 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
- "/api/v1/web-search/providers": {
- "get": {
- "description": "Returns the list of available web search providers from configuration",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "web-search"
- ],
- "summary": "Get available web search providers",
- "responses": {
- "200": {
- "description": "List of providers",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- }
- }
- }
- },
"/auth/change-password": {
"post": {
"security": [
@@ -333,6 +309,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "仅通过分块ID获取分块详情(不需要knowledge_id)",
@@ -383,6 +362,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除分块中生成的问题",
@@ -447,6 +429,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取指定知识下的所有分块列表,支持分页",
@@ -503,6 +488,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定知识下的所有分块",
@@ -547,6 +535,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新指定分块的内容和属性",
@@ -611,6 +602,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定的分块",
@@ -668,6 +662,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据任务ID获取评估结果",
@@ -710,6 +707,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "对知识库进行评估测试",
@@ -751,11 +751,61 @@ const docTemplate = `{
}
}
},
+ "/faq/import/progress/{task_id}": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "获取FAQ导入任务的进度",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "FAQ管理"
+ ],
+ "summary": "获取FAQ导入进度",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "任务ID",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "导入进度",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "404": {
+ "description": "任务不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ }
+ }
+ }
+ },
"/initialization/extract/relations": {
"post": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "从文本中提取实体和关系",
@@ -826,6 +876,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据标签生成示例文本",
@@ -872,6 +925,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据知识库ID执行完整配置更新",
@@ -925,6 +981,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据知识库ID获取当前配置信息",
@@ -967,6 +1026,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据知识库ID更新模型和分块配置",
@@ -1026,6 +1088,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "测试Embedding接口是否可用并返回向量维度",
@@ -1072,6 +1137,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "检查远程API模型连接是否正常",
@@ -1118,6 +1186,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "检查Rerank模型连接和功能是否正常",
@@ -1164,6 +1235,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "上传图片测试多模态处理功能",
@@ -1241,6 +1315,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "列出所有Ollama模型下载任务",
@@ -1270,6 +1347,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取Ollama模型下载任务的进度",
@@ -1314,6 +1394,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "列出已安装的Ollama模型",
@@ -1349,6 +1432,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "检查指定的Ollama模型是否已安装",
@@ -1403,6 +1489,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "异步下载指定的Ollama模型",
@@ -1478,6 +1567,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取当前租户的所有知识库",
@@ -1511,6 +1603,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "创建新的知识库",
@@ -1557,9 +1652,12 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "将一个知识库的内容复制到另一个知识库",
+ "description": "将一个知识库的内容复制到另一个知识库(异步任务)",
"consumes": [
"application/json"
],
@@ -1583,7 +1681,7 @@ const docTemplate = `{
],
"responses": {
"200": {
- "description": "复制成功",
+ "description": "任务ID",
"schema": {
"type": "object",
"additionalProperties": true
@@ -1598,11 +1696,61 @@ const docTemplate = `{
}
}
},
+ "/knowledge-bases/copy/progress/{task_id}": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "获取知识库复制任务的进度",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "知识库"
+ ],
+ "summary": "获取知识库复制进度",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "任务ID",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "进度信息",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "404": {
+ "description": "任务不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ }
+ }
+ }
+ },
"/knowledge-bases/{id}": {
"get": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取知识库详情",
@@ -1651,6 +1799,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新知识库的名称、描述和配置",
@@ -1702,6 +1853,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定的知识库及其所有内容",
@@ -1746,6 +1900,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取知识库下的FAQ条目列表,支持分页和筛选",
@@ -1812,6 +1969,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "异步批量更新或插入FAQ条目",
@@ -1863,6 +2023,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "批量删除指定的FAQ条目",
@@ -1924,6 +2087,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "将所有FAQ条目导出为CSV文件",
@@ -1967,6 +2133,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "批量更新FAQ条目的多个字段(is_enabled, is_recommended, tag_id)",
@@ -2020,6 +2189,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "批量更新FAQ条目的标签",
@@ -2073,6 +2245,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新指定的FAQ条目",
@@ -2133,6 +2308,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "同步创建单个FAQ条目",
@@ -2186,6 +2364,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "使用混合搜索在FAQ中搜索",
@@ -2239,6 +2420,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "在知识库中执行向量和关键词混合搜索",
@@ -2292,6 +2476,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取知识库下的知识列表,支持分页和筛选",
@@ -2366,6 +2553,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "上传文件并创建知识条目",
@@ -2442,6 +2632,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "手工录入Markdown格式的知识内容",
@@ -2495,6 +2688,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "从指定URL抓取内容并创建知识条目",
@@ -2566,6 +2762,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取知识库下的所有标签及统计信息",
@@ -2626,6 +2825,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "在知识库下创建新标签",
@@ -2690,6 +2892,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新标签信息",
@@ -2748,6 +2953,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除标签,可使用force=true强制删除被引用的标签",
@@ -2805,6 +3013,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID列表批量获取知识条目",
@@ -2853,6 +3064,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新知识分块的图像信息",
@@ -2918,6 +3132,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新手工录入的Markdown知识内容",
@@ -2966,11 +3183,72 @@ const docTemplate = `{
}
}
},
+ "/knowledge/search": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Search knowledge files by keyword across all knowledge bases",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Knowledge"
+ ],
+ "summary": "Search knowledge",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "Keyword to search",
+ "name": "keyword",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "Offset for pagination",
+ "name": "offset",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "Limit for pagination (default 20)",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Search results",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "400": {
+ "description": "Invalid request",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ }
+ }
+ }
+ },
"/knowledge/tags": {
"put": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "批量更新知识条目的标签",
@@ -3017,6 +3295,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取知识条目详情",
@@ -3065,6 +3346,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新知识条目信息",
@@ -3116,6 +3400,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID删除知识条目",
@@ -3160,6 +3447,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "下载知识条目关联的原始文件",
@@ -3203,6 +3493,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取当前租户的所有MCP服务",
@@ -3236,6 +3529,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "创建新的MCP服务配置",
@@ -3282,6 +3578,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取MCP服务详情",
@@ -3324,6 +3623,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新MCP服务配置",
@@ -3375,6 +3677,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定的MCP服务",
@@ -3419,6 +3724,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取MCP服务提供的资源列表",
@@ -3463,6 +3771,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "测试MCP服务是否可以正常连接",
@@ -3507,6 +3818,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取MCP服务提供的工具列表",
@@ -3551,6 +3865,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "加载会话的消息历史,支持分页和时间筛选",
@@ -3608,6 +3925,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "从会话中删除指定消息",
@@ -3659,6 +3979,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取当前租户的所有模型",
@@ -3692,6 +4015,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "创建新的模型配置",
@@ -3738,6 +4064,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取模型详情",
@@ -3780,6 +4109,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新模型配置信息",
@@ -3831,6 +4163,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定的模型",
@@ -3875,6 +4210,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取当前租户的会话列表,支持分页",
@@ -3922,6 +4260,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "创建新的对话会话",
@@ -3968,6 +4309,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "在知识库中搜索(不使用LLM总结)",
@@ -4014,6 +4358,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取会话详情",
@@ -4056,6 +4403,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新会话属性",
@@ -4107,6 +4457,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定的会话",
@@ -4151,6 +4504,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "基于Agent的智能问答,支持多轮对话和SSE流式响应",
@@ -4204,6 +4560,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "继续获取正在进行的流式响应",
@@ -4255,6 +4614,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "基于知识库的问答(使用LLM总结),支持SSE流式响应",
@@ -4308,6 +4670,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "停止当前正在进行的生成任务",
@@ -4361,6 +4726,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据消息内容自动生成会话标题",
@@ -4551,6 +4919,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取租户的全局Agent配置(默认应用于所有会话)",
@@ -4586,6 +4957,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取租户的全局对话配置(默认应用于普通模式会话)",
@@ -4621,6 +4995,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取租户的网络搜索配置",
@@ -4656,6 +5033,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取租户级别的KV配置(支持agent-config、web-search-config、conversation-config)",
@@ -4698,6 +5078,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新租户级别的KV配置(支持agent-config、web-search-config、conversation-config)",
@@ -4751,6 +5134,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "分页搜索租户(需要跨租户访问权限)",
@@ -4814,6 +5200,9 @@ const docTemplate = `{
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取租户详情",
@@ -4951,6 +5340,38 @@ const docTemplate = `{
}
}
}
+ },
+ "/web-search/providers": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Returns the list of available web search providers from configuration",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "web-search"
+ ],
+ "summary": "Get available web search providers",
+ "responses": {
+ "200": {
+ "description": "List of providers",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ }
+ }
+ }
}
},
"definitions": {
@@ -5030,6 +5451,13 @@ const docTemplate = `{
"type": "string"
}
},
+ "knowledge_ids": {
+ "description": "Accessible knowledge IDs (individual documents)",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
"max_iterations": {
"description": "Maximum number of ReAct iterations",
"type": "integer"
@@ -5548,6 +5976,10 @@ const docTemplate = `{
"description": "ID of the knowledge base",
"type": "string"
},
+ "knowledge_base_name": {
+ "description": "Knowledge base name (not stored in database, populated on query)",
+ "type": "string"
+ },
"metadata": {
"description": "Metadata of the knowledge",
"type": "array",
@@ -5960,9 +6392,11 @@ const docTemplate = `{
4,
5,
6,
- 7
+ 7,
+ 8
],
"x-enum-comments": {
+ "MatchTypeDirectLoad": "直接加载匹配类型",
"MatchTypeParentChunk": "父Chunk匹配类型",
"MatchTypeRelationChunk": "关系Chunk匹配类型",
"MatchTypeWebSearch": "网络搜索匹配类型"
@@ -5975,7 +6409,8 @@ const docTemplate = `{
"父Chunk匹配类型",
"关系Chunk匹配类型",
"",
- "网络搜索匹配类型"
+ "网络搜索匹配类型",
+ "直接加载匹配类型"
],
"x-enum-varnames": [
"MatchTypeEmbedding",
@@ -5985,9 +6420,29 @@ const docTemplate = `{
"MatchTypeParentChunk",
"MatchTypeRelationChunk",
"MatchTypeGraph",
- "MatchTypeWebSearch"
+ "MatchTypeWebSearch",
+ "MatchTypeDirectLoad"
]
},
+ "github_com_Tencent_WeKnora_internal_types.MentionedItem": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "kb_type": {
+ "description": "\"document\" or \"faq\" (only for kb type)",
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "type": {
+ "description": "\"kb\" for knowledge base, \"file\" for file",
+ "type": "string"
+ }
+ }
+ },
"github_com_Tencent_WeKnora_internal_types.Message": {
"type": "object",
"properties": {
@@ -6029,6 +6484,13 @@ const docTemplate = `{
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SearchResult"
}
},
+ "mentioned_items": {
+ "description": "Mentioned knowledge bases and files (for user messages)\nStores the @mentioned items when user sends a message",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MentionedItem"
+ }
+ },
"request_id": {
"description": "Request identifier for tracking API requests",
"type": "string"
@@ -6253,6 +6715,12 @@ const docTemplate = `{
"keyword_threshold": {
"type": "number"
},
+ "knowledge_ids": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
"match_count": {
"type": "integer"
},
@@ -6474,6 +6942,13 @@ const docTemplate = `{
"type": "string"
}
},
+ "knowledge_ids": {
+ "description": "Accessible knowledge IDs (individual documents) for this session",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
"web_search_enabled": {
"description": "Whether web search is enabled for this session",
"type": "boolean"
@@ -7231,6 +7706,20 @@ const docTemplate = `{
"type": "string"
}
},
+ "knowledge_ids": {
+ "description": "Selected knowledge ID for this request",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "mentioned_items": {
+ "description": "@mentioned knowledge bases and files",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/internal_handler_session.MentionedItemRequest"
+ }
+ },
"query": {
"description": "Query text for knowledge base search",
"type": "string"
@@ -7285,6 +7774,25 @@ const docTemplate = `{
}
}
},
+ "internal_handler_session.MentionedItemRequest": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "kb_type": {
+ "description": "\"document\" or \"faq\" (only for kb type)",
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "type": {
+ "description": "\"kb\" for knowledge base, \"file\" for file",
+ "type": "string"
+ }
+ }
+ },
"internal_handler_session.SearchKnowledgeRequest": {
"type": "object",
"required": [
@@ -7380,8 +7888,14 @@ const docTemplate = `{
}
},
"securityDefinitions": {
+ "ApiKeyAuth": {
+ "description": "租户身份认证:输入 sk- 开头的 API Key",
+ "type": "apiKey",
+ "name": "X-API-Key",
+ "in": "header"
+ },
"Bearer": {
- "description": "输入 Bearer {token} 格式的 JWT 令牌",
+ "description": "用户登录认证:输入 Bearer {token} 格式的 JWT 令牌",
"type": "apiKey",
"name": "Authorization",
"in": "header"
diff --git a/docs/swagger.json b/docs/swagger.json
index 6c7a25a90..757c13486 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -13,30 +13,6 @@
"host": "localhost:8080",
"basePath": "/api/v1",
"paths": {
- "/api/v1/web-search/providers": {
- "get": {
- "description": "Returns the list of available web search providers from configuration",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "web-search"
- ],
- "summary": "Get available web search providers",
- "responses": {
- "200": {
- "description": "List of providers",
- "schema": {
- "type": "object",
- "additionalProperties": true
- }
- }
- }
- }
- },
"/auth/change-password": {
"post": {
"security": [
@@ -327,6 +303,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "仅通过分块ID获取分块详情(不需要knowledge_id)",
@@ -377,6 +356,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除分块中生成的问题",
@@ -441,6 +423,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取指定知识下的所有分块列表,支持分页",
@@ -497,6 +482,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定知识下的所有分块",
@@ -541,6 +529,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新指定分块的内容和属性",
@@ -605,6 +596,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定的分块",
@@ -662,6 +656,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据任务ID获取评估结果",
@@ -704,6 +701,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "对知识库进行评估测试",
@@ -745,11 +745,61 @@
}
}
},
+ "/faq/import/progress/{task_id}": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "获取FAQ导入任务的进度",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "FAQ管理"
+ ],
+ "summary": "获取FAQ导入进度",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "任务ID",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "导入进度",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "404": {
+ "description": "任务不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ }
+ }
+ }
+ },
"/initialization/extract/relations": {
"post": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "从文本中提取实体和关系",
@@ -820,6 +870,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据标签生成示例文本",
@@ -866,6 +919,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据知识库ID执行完整配置更新",
@@ -919,6 +975,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据知识库ID获取当前配置信息",
@@ -961,6 +1020,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据知识库ID更新模型和分块配置",
@@ -1020,6 +1082,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "测试Embedding接口是否可用并返回向量维度",
@@ -1066,6 +1131,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "检查远程API模型连接是否正常",
@@ -1112,6 +1180,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "检查Rerank模型连接和功能是否正常",
@@ -1158,6 +1229,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "上传图片测试多模态处理功能",
@@ -1235,6 +1309,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "列出所有Ollama模型下载任务",
@@ -1264,6 +1341,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取Ollama模型下载任务的进度",
@@ -1308,6 +1388,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "列出已安装的Ollama模型",
@@ -1343,6 +1426,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "检查指定的Ollama模型是否已安装",
@@ -1397,6 +1483,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "异步下载指定的Ollama模型",
@@ -1472,6 +1561,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取当前租户的所有知识库",
@@ -1505,6 +1597,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "创建新的知识库",
@@ -1551,9 +1646,12 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
- "description": "将一个知识库的内容复制到另一个知识库",
+ "description": "将一个知识库的内容复制到另一个知识库(异步任务)",
"consumes": [
"application/json"
],
@@ -1577,7 +1675,7 @@
],
"responses": {
"200": {
- "description": "复制成功",
+ "description": "任务ID",
"schema": {
"type": "object",
"additionalProperties": true
@@ -1592,11 +1690,61 @@
}
}
},
+ "/knowledge-bases/copy/progress/{task_id}": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "获取知识库复制任务的进度",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "知识库"
+ ],
+ "summary": "获取知识库复制进度",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "任务ID",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "进度信息",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "404": {
+ "description": "任务不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ }
+ }
+ }
+ },
"/knowledge-bases/{id}": {
"get": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取知识库详情",
@@ -1645,6 +1793,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新知识库的名称、描述和配置",
@@ -1696,6 +1847,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定的知识库及其所有内容",
@@ -1740,6 +1894,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取知识库下的FAQ条目列表,支持分页和筛选",
@@ -1806,6 +1963,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "异步批量更新或插入FAQ条目",
@@ -1857,6 +2017,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "批量删除指定的FAQ条目",
@@ -1918,6 +2081,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "将所有FAQ条目导出为CSV文件",
@@ -1961,6 +2127,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "批量更新FAQ条目的多个字段(is_enabled, is_recommended, tag_id)",
@@ -2014,6 +2183,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "批量更新FAQ条目的标签",
@@ -2067,6 +2239,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新指定的FAQ条目",
@@ -2127,6 +2302,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "同步创建单个FAQ条目",
@@ -2180,6 +2358,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "使用混合搜索在FAQ中搜索",
@@ -2233,6 +2414,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "在知识库中执行向量和关键词混合搜索",
@@ -2286,6 +2470,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取知识库下的知识列表,支持分页和筛选",
@@ -2360,6 +2547,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "上传文件并创建知识条目",
@@ -2436,6 +2626,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "手工录入Markdown格式的知识内容",
@@ -2489,6 +2682,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "从指定URL抓取内容并创建知识条目",
@@ -2560,6 +2756,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取知识库下的所有标签及统计信息",
@@ -2620,6 +2819,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "在知识库下创建新标签",
@@ -2684,6 +2886,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新标签信息",
@@ -2742,6 +2947,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除标签,可使用force=true强制删除被引用的标签",
@@ -2799,6 +3007,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID列表批量获取知识条目",
@@ -2847,6 +3058,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新知识分块的图像信息",
@@ -2912,6 +3126,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新手工录入的Markdown知识内容",
@@ -2960,11 +3177,72 @@
}
}
},
+ "/knowledge/search": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Search knowledge files by keyword across all knowledge bases",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Knowledge"
+ ],
+ "summary": "Search knowledge",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "Keyword to search",
+ "name": "keyword",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "Offset for pagination",
+ "name": "offset",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "Limit for pagination (default 20)",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Search results",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "400": {
+ "description": "Invalid request",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ }
+ }
+ }
+ },
"/knowledge/tags": {
"put": {
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "批量更新知识条目的标签",
@@ -3011,6 +3289,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取知识条目详情",
@@ -3059,6 +3340,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新知识条目信息",
@@ -3110,6 +3394,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID删除知识条目",
@@ -3154,6 +3441,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "下载知识条目关联的原始文件",
@@ -3197,6 +3487,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取当前租户的所有MCP服务",
@@ -3230,6 +3523,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "创建新的MCP服务配置",
@@ -3276,6 +3572,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取MCP服务详情",
@@ -3318,6 +3617,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新MCP服务配置",
@@ -3369,6 +3671,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定的MCP服务",
@@ -3413,6 +3718,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取MCP服务提供的资源列表",
@@ -3457,6 +3765,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "测试MCP服务是否可以正常连接",
@@ -3501,6 +3812,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取MCP服务提供的工具列表",
@@ -3545,6 +3859,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "加载会话的消息历史,支持分页和时间筛选",
@@ -3602,6 +3919,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "从会话中删除指定消息",
@@ -3653,6 +3973,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取当前租户的所有模型",
@@ -3686,6 +4009,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "创建新的模型配置",
@@ -3732,6 +4058,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取模型详情",
@@ -3774,6 +4103,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新模型配置信息",
@@ -3825,6 +4157,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定的模型",
@@ -3869,6 +4204,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取当前租户的会话列表,支持分页",
@@ -3916,6 +4254,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "创建新的对话会话",
@@ -3962,6 +4303,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "在知识库中搜索(不使用LLM总结)",
@@ -4008,6 +4352,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取会话详情",
@@ -4050,6 +4397,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新会话属性",
@@ -4101,6 +4451,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "删除指定的会话",
@@ -4145,6 +4498,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "基于Agent的智能问答,支持多轮对话和SSE流式响应",
@@ -4198,6 +4554,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "继续获取正在进行的流式响应",
@@ -4249,6 +4608,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "基于知识库的问答(使用LLM总结),支持SSE流式响应",
@@ -4302,6 +4664,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "停止当前正在进行的生成任务",
@@ -4355,6 +4720,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据消息内容自动生成会话标题",
@@ -4545,6 +4913,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取租户的全局Agent配置(默认应用于所有会话)",
@@ -4580,6 +4951,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取租户的全局对话配置(默认应用于普通模式会话)",
@@ -4615,6 +4989,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取租户的网络搜索配置",
@@ -4650,6 +5027,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "获取租户级别的KV配置(支持agent-config、web-search-config、conversation-config)",
@@ -4692,6 +5072,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "更新租户级别的KV配置(支持agent-config、web-search-config、conversation-config)",
@@ -4745,6 +5128,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "分页搜索租户(需要跨租户访问权限)",
@@ -4808,6 +5194,9 @@
"security": [
{
"Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
}
],
"description": "根据ID获取租户详情",
@@ -4945,6 +5334,38 @@
}
}
}
+ },
+ "/web-search/providers": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Returns the list of available web search providers from configuration",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "web-search"
+ ],
+ "summary": "Get available web search providers",
+ "responses": {
+ "200": {
+ "description": "List of providers",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ }
+ }
+ }
}
},
"definitions": {
@@ -5024,6 +5445,13 @@
"type": "string"
}
},
+ "knowledge_ids": {
+ "description": "Accessible knowledge IDs (individual documents)",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
"max_iterations": {
"description": "Maximum number of ReAct iterations",
"type": "integer"
@@ -5542,6 +5970,10 @@
"description": "ID of the knowledge base",
"type": "string"
},
+ "knowledge_base_name": {
+ "description": "Knowledge base name (not stored in database, populated on query)",
+ "type": "string"
+ },
"metadata": {
"description": "Metadata of the knowledge",
"type": "array",
@@ -5954,9 +6386,11 @@
4,
5,
6,
- 7
+ 7,
+ 8
],
"x-enum-comments": {
+ "MatchTypeDirectLoad": "直接加载匹配类型",
"MatchTypeParentChunk": "父Chunk匹配类型",
"MatchTypeRelationChunk": "关系Chunk匹配类型",
"MatchTypeWebSearch": "网络搜索匹配类型"
@@ -5969,7 +6403,8 @@
"父Chunk匹配类型",
"关系Chunk匹配类型",
"",
- "网络搜索匹配类型"
+ "网络搜索匹配类型",
+ "直接加载匹配类型"
],
"x-enum-varnames": [
"MatchTypeEmbedding",
@@ -5979,9 +6414,29 @@
"MatchTypeParentChunk",
"MatchTypeRelationChunk",
"MatchTypeGraph",
- "MatchTypeWebSearch"
+ "MatchTypeWebSearch",
+ "MatchTypeDirectLoad"
]
},
+ "github_com_Tencent_WeKnora_internal_types.MentionedItem": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "kb_type": {
+ "description": "\"document\" or \"faq\" (only for kb type)",
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "type": {
+ "description": "\"kb\" for knowledge base, \"file\" for file",
+ "type": "string"
+ }
+ }
+ },
"github_com_Tencent_WeKnora_internal_types.Message": {
"type": "object",
"properties": {
@@ -6023,6 +6478,13 @@
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SearchResult"
}
},
+ "mentioned_items": {
+ "description": "Mentioned knowledge bases and files (for user messages)\nStores the @mentioned items when user sends a message",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MentionedItem"
+ }
+ },
"request_id": {
"description": "Request identifier for tracking API requests",
"type": "string"
@@ -6247,6 +6709,12 @@
"keyword_threshold": {
"type": "number"
},
+ "knowledge_ids": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
"match_count": {
"type": "integer"
},
@@ -6468,6 +6936,13 @@
"type": "string"
}
},
+ "knowledge_ids": {
+ "description": "Accessible knowledge IDs (individual documents) for this session",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
"web_search_enabled": {
"description": "Whether web search is enabled for this session",
"type": "boolean"
@@ -7225,6 +7700,20 @@
"type": "string"
}
},
+ "knowledge_ids": {
+ "description": "Selected knowledge ID for this request",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "mentioned_items": {
+ "description": "@mentioned knowledge bases and files",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/internal_handler_session.MentionedItemRequest"
+ }
+ },
"query": {
"description": "Query text for knowledge base search",
"type": "string"
@@ -7279,6 +7768,25 @@
}
}
},
+ "internal_handler_session.MentionedItemRequest": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "kb_type": {
+ "description": "\"document\" or \"faq\" (only for kb type)",
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "type": {
+ "description": "\"kb\" for knowledge base, \"file\" for file",
+ "type": "string"
+ }
+ }
+ },
"internal_handler_session.SearchKnowledgeRequest": {
"type": "object",
"required": [
@@ -7374,8 +7882,14 @@
}
},
"securityDefinitions": {
+ "ApiKeyAuth": {
+ "description": "租户身份认证:输入 sk- 开头的 API Key",
+ "type": "apiKey",
+ "name": "X-API-Key",
+ "in": "header"
+ },
"Bearer": {
- "description": "输入 Bearer {token} 格式的 JWT 令牌",
+ "description": "用户登录认证:输入 Bearer {token} 格式的 JWT 令牌",
"type": "apiKey",
"name": "Authorization",
"in": "header"
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 1fad1d10e..5025deb16 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -64,6 +64,11 @@ definitions:
items:
type: string
type: array
+ knowledge_ids:
+ description: Accessible knowledge IDs (individual documents)
+ items:
+ type: string
+ type: array
max_iterations:
description: Maximum number of ReAct iterations
type: integer
@@ -424,6 +429,9 @@ definitions:
knowledge_base_id:
description: ID of the knowledge base
type: string
+ knowledge_base_name:
+ description: Knowledge base name (not stored in database, populated on query)
+ type: string
metadata:
description: Metadata of the knowledge
items:
@@ -700,8 +708,10 @@ definitions:
- 5
- 6
- 7
+ - 8
type: integer
x-enum-comments:
+ MatchTypeDirectLoad: 直接加载匹配类型
MatchTypeParentChunk: 父Chunk匹配类型
MatchTypeRelationChunk: 关系Chunk匹配类型
MatchTypeWebSearch: 网络搜索匹配类型
@@ -714,6 +724,7 @@ definitions:
- 关系Chunk匹配类型
- ""
- 网络搜索匹配类型
+ - 直接加载匹配类型
x-enum-varnames:
- MatchTypeEmbedding
- MatchTypeKeywords
@@ -723,6 +734,20 @@ definitions:
- MatchTypeRelationChunk
- MatchTypeGraph
- MatchTypeWebSearch
+ - MatchTypeDirectLoad
+ github_com_Tencent_WeKnora_internal_types.MentionedItem:
+ properties:
+ id:
+ type: string
+ kb_type:
+ description: '"document" or "faq" (only for kb type)'
+ type: string
+ name:
+ type: string
+ type:
+ description: '"kb" for knowledge base, "file" for file'
+ type: string
+ type: object
github_com_Tencent_WeKnora_internal_types.Message:
properties:
agent_steps:
@@ -754,6 +779,13 @@ definitions:
items:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SearchResult'
type: array
+ mentioned_items:
+ description: |-
+ Mentioned knowledge bases and files (for user messages)
+ Stores the @mentioned items when user sends a message
+ items:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.MentionedItem'
+ type: array
request_id:
description: Request identifier for tracking API requests
type: string
@@ -915,6 +947,10 @@ definitions:
type: boolean
keyword_threshold:
type: number
+ knowledge_ids:
+ items:
+ type: string
+ type: array
match_count:
type: integer
query_text:
@@ -1070,6 +1106,11 @@ definitions:
items:
type: string
type: array
+ knowledge_ids:
+ description: Accessible knowledge IDs (individual documents) for this session
+ items:
+ type: string
+ type: array
web_search_enabled:
description: Whether web search is enabled for this session
type: boolean
@@ -1584,6 +1625,16 @@ definitions:
items:
type: string
type: array
+ knowledge_ids:
+ description: Selected knowledge ID for this request
+ items:
+ type: string
+ type: array
+ mentioned_items:
+ description: '@mentioned knowledge bases and files'
+ items:
+ $ref: '#/definitions/internal_handler_session.MentionedItemRequest'
+ type: array
query:
description: Query text for knowledge base search
type: string
@@ -1623,6 +1674,19 @@ definitions:
required:
- messages
type: object
+ internal_handler_session.MentionedItemRequest:
+ properties:
+ id:
+ type: string
+ kb_type:
+ description: '"document" or "faq" (only for kb type)'
+ type: string
+ name:
+ type: string
+ type:
+ description: '"kb" for knowledge base, "file" for file'
+ type: string
+ type: object
internal_handler_session.SearchKnowledgeRequest:
properties:
knowledge_base_id:
@@ -1696,22 +1760,6 @@ info:
title: WeKnora API
version: "1.0"
paths:
- /api/v1/web-search/providers:
- get:
- consumes:
- - application/json
- description: Returns the list of available web search providers from configuration
- produces:
- - application/json
- responses:
- "200":
- description: List of providers
- schema:
- additionalProperties: true
- type: object
- summary: Get available web search providers
- tags:
- - web-search
/auth/change-password:
post:
consumes:
@@ -1919,6 +1967,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 删除知识下所有分块
tags:
- 分块管理
@@ -1956,6 +2005,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取知识分块列表
tags:
- 分块管理
@@ -1993,6 +2043,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 删除分块
tags:
- 分块管理
@@ -2035,6 +2086,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 更新分块
tags:
- 分块管理
@@ -2067,6 +2119,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 通过ID获取分块
tags:
- 分块管理
@@ -2108,6 +2161,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 删除生成的问题
tags:
- 分块管理
@@ -2136,6 +2190,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取评估结果
tags:
- 评估
@@ -2164,9 +2219,39 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 执行评估
tags:
- 评估
+ /faq/import/progress/{task_id}:
+ get:
+ consumes:
+ - application/json
+ description: 获取FAQ导入任务的进度
+ parameters:
+ - description: 任务ID
+ in: path
+ name: task_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: 获取FAQ导入进度
+ tags:
+ - FAQ管理
/initialization/extract/relations:
post:
consumes:
@@ -2193,6 +2278,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 提取文本关系
tags:
- 初始化
@@ -2238,6 +2324,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 生成示例文本
tags:
- 初始化
@@ -2272,6 +2359,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 初始化知识库配置
tags:
- 初始化
@@ -2300,6 +2388,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取知识库配置
tags:
- 初始化
@@ -2337,6 +2426,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 更新知识库配置
tags:
- 初始化
@@ -2366,6 +2456,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 测试Embedding模型
tags:
- 初始化
@@ -2395,6 +2486,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 检查远程模型
tags:
- 初始化
@@ -2424,6 +2516,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 检查Rerank模型
tags:
- 初始化
@@ -2475,6 +2568,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 测试多模态功能
tags:
- 初始化
@@ -2503,6 +2597,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取下载进度
tags:
- 初始化
@@ -2521,6 +2616,7 @@ paths:
type: object
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 列出下载任务
tags:
- 初始化
@@ -2543,6 +2639,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 列出Ollama模型
tags:
- 初始化
@@ -2577,6 +2674,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 检查Ollama模型状态
tags:
- 初始化
@@ -2609,6 +2707,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 下载Ollama模型
tags:
- 初始化
@@ -2647,6 +2746,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取知识库列表
tags:
- 知识库
@@ -2675,6 +2775,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 创建知识库
tags:
- 知识库
@@ -2703,6 +2804,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 删除知识库
tags:
- 知识库
@@ -2734,6 +2836,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取知识库详情
tags:
- 知识库
@@ -2767,6 +2870,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 更新知识库
tags:
- 知识库
@@ -2806,6 +2910,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 批量删除FAQ条目
tags:
- FAQ管理
@@ -2849,6 +2954,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取FAQ条目列表
tags:
- FAQ管理
@@ -2882,6 +2988,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 批量更新/插入FAQ条目
tags:
- FAQ管理
@@ -2921,6 +3028,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 更新FAQ条目
tags:
- FAQ管理
@@ -2948,6 +3056,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 导出FAQ条目
tags:
- FAQ管理
@@ -2982,6 +3091,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 批量更新FAQ字段
tags:
- FAQ管理
@@ -3016,6 +3126,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 批量更新FAQ标签
tags:
- FAQ管理
@@ -3050,6 +3161,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 创建单个FAQ条目
tags:
- FAQ管理
@@ -3084,6 +3196,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 搜索FAQ
tags:
- FAQ管理
@@ -3118,6 +3231,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 混合搜索
tags:
- 知识库
@@ -3166,6 +3280,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取知识列表
tags:
- 知识管理
@@ -3216,6 +3331,7 @@ paths:
type: object
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 从文件创建知识
tags:
- 知识管理
@@ -3250,6 +3366,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 手工创建知识
tags:
- 知识管理
@@ -3296,6 +3413,7 @@ paths:
type: object
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 从URL创建知识
tags:
- 知识管理
@@ -3336,6 +3454,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取标签列表
tags:
- 标签管理
@@ -3376,6 +3495,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 创建标签
tags:
- 标签管理
@@ -3413,6 +3533,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 删除标签
tags:
- 标签管理
@@ -3451,6 +3572,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 更新标签
tags:
- 标签管理
@@ -3458,7 +3580,7 @@ paths:
post:
consumes:
- application/json
- description: 将一个知识库的内容复制到另一个知识库
+ description: 将一个知识库的内容复制到另一个知识库(异步任务)
parameters:
- description: 复制请求
in: body
@@ -3470,7 +3592,7 @@ paths:
- application/json
responses:
"200":
- description: 复制成功
+ description: 任务ID
schema:
additionalProperties: true
type: object
@@ -3480,9 +3602,39 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
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: 进度信息
+ schema:
+ additionalProperties: true
+ type: object
+ "404":
+ description: 任务不存在
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: 获取知识库复制进度
+ tags:
+ - 知识库
/knowledge/{id}:
delete:
consumes:
@@ -3508,6 +3660,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 删除知识
tags:
- 知识管理
@@ -3539,6 +3692,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取知识详情
tags:
- 知识管理
@@ -3572,6 +3726,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 更新知识
tags:
- 知识管理
@@ -3599,6 +3754,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 下载知识文件
tags:
- 知识管理
@@ -3630,6 +3786,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 批量获取知识
tags:
- 知识管理
@@ -3672,6 +3829,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 更新图像信息
tags:
- 知识管理
@@ -3706,9 +3864,46 @@ paths:
$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 across all knowledge bases
+ parameters:
+ - description: Keyword to search
+ in: query
+ name: keyword
+ type: string
+ - description: Offset for pagination
+ in: query
+ name: offset
+ type: integer
+ - description: Limit for pagination (default 20)
+ in: query
+ name: limit
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: Search results
+ schema:
+ additionalProperties: true
+ type: object
+ "400":
+ description: Invalid request
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: Search knowledge
+ tags:
+ - Knowledge
/knowledge/tags:
put:
consumes:
@@ -3735,6 +3930,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 批量更新知识标签
tags:
- 知识管理
@@ -3757,6 +3953,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取MCP服务列表
tags:
- MCP服务
@@ -3785,6 +3982,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 创建MCP服务
tags:
- MCP服务
@@ -3813,6 +4011,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 删除MCP服务
tags:
- MCP服务
@@ -3840,6 +4039,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取MCP服务详情
tags:
- MCP服务
@@ -3873,6 +4073,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 更新MCP服务
tags:
- MCP服务
@@ -3901,6 +4102,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取MCP服务资源列表
tags:
- MCP服务
@@ -3929,6 +4131,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 测试MCP服务连接
tags:
- MCP服务
@@ -3957,6 +4160,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取MCP服务工具列表
tags:
- MCP服务
@@ -3990,6 +4194,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 删除消息
tags:
- 消息
@@ -4027,6 +4232,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 加载消息历史
tags:
- 消息
@@ -4049,6 +4255,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取模型列表
tags:
- 模型管理
@@ -4077,6 +4284,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 创建模型
tags:
- 模型管理
@@ -4105,6 +4313,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 删除模型
tags:
- 模型管理
@@ -4132,6 +4341,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取模型详情
tags:
- 模型管理
@@ -4165,6 +4375,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 更新模型
tags:
- 模型管理
@@ -4196,6 +4407,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取会话列表
tags:
- 会话
@@ -4224,6 +4436,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 创建会话
tags:
- 会话
@@ -4252,6 +4465,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 删除会话
tags:
- 会话
@@ -4279,6 +4493,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取会话详情
tags:
- 会话
@@ -4312,6 +4527,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 更新会话
tags:
- 会话
@@ -4346,6 +4562,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: Agent问答
tags:
- 问答
@@ -4379,6 +4596,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 继续流式响应
tags:
- 问答
@@ -4413,6 +4631,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 知识问答
tags:
- 问答
@@ -4447,6 +4666,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 停止生成
tags:
- 问答
@@ -4481,6 +4701,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 生成会话标题
tags:
- 会话
@@ -4510,6 +4731,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 知识搜索
tags:
- 问答
@@ -4634,6 +4856,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取租户详情
tags:
- 租户管理
@@ -4717,6 +4940,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取租户KV配置
tags:
- 租户管理
@@ -4750,6 +4974,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 更新租户KV配置
tags:
- 租户管理
@@ -4772,6 +4997,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取租户Agent配置
tags:
- 租户管理
@@ -4794,6 +5020,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取租户对话配置
tags:
- 租户管理
@@ -4816,6 +5043,7 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 获取租户网络搜索配置
tags:
- 租户管理
@@ -4857,12 +5085,37 @@ paths:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
security:
- Bearer: []
+ - ApiKeyAuth: []
summary: 搜索租户
tags:
- 租户管理
+ /web-search/providers:
+ get:
+ consumes:
+ - application/json
+ description: Returns the list of available web search providers from configuration
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: List of providers
+ schema:
+ additionalProperties: true
+ type: object
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: Get available web search providers
+ tags:
+ - web-search
securityDefinitions:
+ ApiKeyAuth:
+ description: 租户身份认证:输入 sk- 开头的 API Key
+ in: header
+ name: X-API-Key
+ type: apiKey
Bearer:
- description: 输入 Bearer {token} 格式的 JWT 令牌
+ description: 用户登录认证:输入 Bearer {token} 格式的 JWT 令牌
in: header
name: Authorization
type: apiKey
diff --git a/internal/handler/chunk.go b/internal/handler/chunk.go
index 907b9d92b..e11a02ea5 100644
--- a/internal/handler/chunk.go
+++ b/internal/handler/chunk.go
@@ -33,6 +33,7 @@ func NewChunkHandler(service interfaces.ChunkService) *ChunkHandler {
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Failure 404 {object} errors.AppError "分块不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /chunks/by-id/{id} [get]
func (h *ChunkHandler) GetChunkByIDOnly(c *gin.Context) {
ctx := c.Request.Context()
@@ -102,6 +103,7 @@ func (h *ChunkHandler) GetChunkByIDOnly(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "分块列表"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /chunks/{knowledge_id} [get]
func (h *ChunkHandler) ListKnowledgeChunks(c *gin.Context) {
ctx := c.Request.Context()
@@ -236,6 +238,7 @@ func (h *ChunkHandler) validateAndGetChunk(c *gin.Context) (*types.Chunk, string
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Failure 404 {object} errors.AppError "分块不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /chunks/{knowledge_id}/{id} [put]
func (h *ChunkHandler) UpdateChunk(c *gin.Context) {
ctx := c.Request.Context()
@@ -287,6 +290,7 @@ func (h *ChunkHandler) UpdateChunk(c *gin.Context) {
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Failure 404 {object} errors.AppError "分块不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /chunks/{knowledge_id}/{id} [delete]
func (h *ChunkHandler) DeleteChunk(c *gin.Context) {
ctx := c.Request.Context()
@@ -321,6 +325,7 @@ func (h *ChunkHandler) DeleteChunk(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "删除成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /chunks/{knowledge_id} [delete]
func (h *ChunkHandler) DeleteChunksByKnowledgeID(c *gin.Context) {
ctx := c.Request.Context()
@@ -359,6 +364,7 @@ func (h *ChunkHandler) DeleteChunksByKnowledgeID(c *gin.Context) {
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Failure 404 {object} errors.AppError "分块不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /chunks/by-id/{id}/questions [delete]
func (h *ChunkHandler) DeleteGeneratedQuestion(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/evaluation.go b/internal/handler/evaluation.go
index 0fbce3953..62356e8d0 100644
--- a/internal/handler/evaluation.go
+++ b/internal/handler/evaluation.go
@@ -39,6 +39,7 @@ type EvaluationRequest struct {
// @Success 200 {object} map[string]interface{} "评估任务"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /evaluation/ [post]
func (e *EvaluationHandler) Evaluation(c *gin.Context) {
ctx := c.Request.Context()
@@ -101,6 +102,7 @@ type GetEvaluationRequest struct {
// @Success 200 {object} map[string]interface{} "评估结果"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /evaluation/ [get]
func (e *EvaluationHandler) GetEvaluationResult(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/faq.go b/internal/handler/faq.go
index 4b0cdd2d4..bca93ddd1 100644
--- a/internal/handler/faq.go
+++ b/internal/handler/faq.go
@@ -36,6 +36,7 @@ func NewFAQHandler(knowledgeService interfaces.KnowledgeService) *FAQHandler {
// @Success 200 {object} map[string]interface{} "FAQ列表"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/faq/entries [get]
func (h *FAQHandler) ListEntries(c *gin.Context) {
ctx := c.Request.Context()
@@ -73,6 +74,7 @@ func (h *FAQHandler) ListEntries(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "任务ID"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/faq/entries [post]
func (h *FAQHandler) UpsertEntries(c *gin.Context) {
ctx := c.Request.Context()
@@ -109,6 +111,7 @@ func (h *FAQHandler) UpsertEntries(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "创建的FAQ条目"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/faq/entry [post]
func (h *FAQHandler) CreateEntry(c *gin.Context) {
ctx := c.Request.Context()
@@ -144,6 +147,7 @@ func (h *FAQHandler) CreateEntry(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "更新成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/faq/entries/{entry_id} [put]
func (h *FAQHandler) UpdateEntry(c *gin.Context) {
ctx := c.Request.Context()
@@ -177,6 +181,7 @@ func (h *FAQHandler) UpdateEntry(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "更新成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/faq/entries/tags [put]
func (h *FAQHandler) UpdateEntryTagBatch(c *gin.Context) {
ctx := c.Request.Context()
@@ -208,6 +213,7 @@ func (h *FAQHandler) UpdateEntryTagBatch(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "更新成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/faq/entries/fields [put]
func (h *FAQHandler) UpdateEntryFieldsBatch(c *gin.Context) {
ctx := c.Request.Context()
@@ -249,6 +255,7 @@ type faqEntryTagBatchRequest struct {
// @Success 200 {object} map[string]interface{} "删除成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/faq/entries [delete]
func (h *FAQHandler) DeleteEntries(c *gin.Context) {
ctx := c.Request.Context()
@@ -283,6 +290,7 @@ func (h *FAQHandler) DeleteEntries(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "搜索结果"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/faq/search [post]
func (h *FAQHandler) SearchFAQ(c *gin.Context) {
ctx := c.Request.Context()
@@ -322,6 +330,7 @@ func (h *FAQHandler) SearchFAQ(c *gin.Context) {
// @Success 200 {file} file "CSV文件"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/faq/entries/export [get]
func (h *FAQHandler) ExportEntries(c *gin.Context) {
ctx := c.Request.Context()
@@ -352,6 +361,7 @@ func (h *FAQHandler) ExportEntries(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "导入进度"
// @Failure 404 {object} errors.AppError "任务不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /faq/import/progress/{task_id} [get]
func (h *FAQHandler) GetImportProgress(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/initialization.go b/internal/handler/initialization.go
index 73b2be758..b80add7cd 100644
--- a/internal/handler/initialization.go
+++ b/internal/handler/initialization.go
@@ -217,6 +217,7 @@ type InitializationRequest struct {
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Failure 404 {object} errors.AppError "知识库不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/kb/{kbId}/config [put]
func (h *InitializationHandler) UpdateKBConfig(c *gin.Context) {
ctx := c.Request.Context()
@@ -397,6 +398,7 @@ func (h *InitializationHandler) UpdateKBConfig(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "初始化成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/kb/{kbId} [post]
func (h *InitializationHandler) InitializeByKB(c *gin.Context) {
ctx := c.Request.Context()
@@ -849,6 +851,7 @@ func (h *InitializationHandler) CheckOllamaStatus(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "模型状态"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/ollama/models/check [post]
func (h *InitializationHandler) CheckOllamaModels(c *gin.Context) {
ctx := c.Request.Context()
@@ -910,6 +913,7 @@ func (h *InitializationHandler) CheckOllamaModels(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "下载任务信息"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/ollama/models/download [post]
func (h *InitializationHandler) DownloadOllamaModel(c *gin.Context) {
ctx := c.Request.Context()
@@ -1021,6 +1025,7 @@ func (h *InitializationHandler) DownloadOllamaModel(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "下载进度"
// @Failure 404 {object} errors.AppError "任务不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/ollama/download/{taskId} [get]
func (h *InitializationHandler) GetDownloadProgress(c *gin.Context) {
taskID := c.Param("taskId")
@@ -1053,6 +1058,7 @@ func (h *InitializationHandler) GetDownloadProgress(c *gin.Context) {
// @Produce json
// @Success 200 {object} map[string]interface{} "任务列表"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/ollama/download/tasks [get]
func (h *InitializationHandler) ListDownloadTasks(c *gin.Context) {
tasksMutex.RLock()
@@ -1077,6 +1083,7 @@ func (h *InitializationHandler) ListDownloadTasks(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "模型列表"
// @Failure 500 {object} errors.AppError "服务器错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/ollama/models [get]
func (h *InitializationHandler) ListOllamaModels(c *gin.Context) {
ctx := c.Request.Context()
@@ -1215,6 +1222,7 @@ func (h *InitializationHandler) updateTaskStatus(
// @Success 200 {object} map[string]interface{} "配置信息"
// @Failure 404 {object} errors.AppError "知识库不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/kb/{kbId}/config [get]
func (h *InitializationHandler) GetCurrentConfigByKB(c *gin.Context) {
ctx := c.Request.Context()
@@ -1429,6 +1437,7 @@ type RemoteModelCheckRequest struct {
// @Success 200 {object} map[string]interface{} "检查结果"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/models/remote/check [post]
func (h *InitializationHandler) CheckRemoteModel(c *gin.Context) {
ctx := c.Request.Context()
@@ -1484,6 +1493,7 @@ func (h *InitializationHandler) CheckRemoteModel(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "测试结果"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/models/embedding/test [post]
func (h *InitializationHandler) TestEmbeddingModel(c *gin.Context) {
ctx := c.Request.Context()
@@ -1647,6 +1657,7 @@ func (h *InitializationHandler) checkRerankModelConnection(ctx context.Context,
// @Success 200 {object} map[string]interface{} "检查结果"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/models/rerank/check [post]
func (h *InitializationHandler) CheckRerankModel(c *gin.Context) {
ctx := c.Request.Context()
@@ -1730,6 +1741,7 @@ type testMultimodalForm struct {
// @Success 200 {object} map[string]interface{} "测试结果"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/multimodal/test [post]
func (h *InitializationHandler) TestMultimodalFunction(c *gin.Context) {
ctx := c.Request.Context()
@@ -1999,6 +2011,7 @@ type TextRelationExtractionResponse struct {
// @Success 200 {object} map[string]interface{} "提取结果"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/extract/relations [post]
func (h *InitializationHandler) ExtractTextRelations(c *gin.Context) {
ctx := c.Request.Context()
@@ -2103,6 +2116,7 @@ type FabriTextResponse struct {
// @Success 200 {object} map[string]interface{} "生成的文本"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /initialization/fabri/text [post]
func (h *InitializationHandler) FabriText(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/knowledge.go b/internal/handler/knowledge.go
index fa683b775..9347c25b8 100644
--- a/internal/handler/knowledge.go
+++ b/internal/handler/knowledge.go
@@ -97,6 +97,7 @@ func (h *KnowledgeHandler) handleDuplicateKnowledgeError(c *gin.Context,
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Failure 409 {object} map[string]interface{} "文件重复"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/knowledge/file [post]
func (h *KnowledgeHandler) CreateKnowledgeFromFile(c *gin.Context) {
ctx := c.Request.Context()
@@ -194,6 +195,7 @@ func (h *KnowledgeHandler) CreateKnowledgeFromFile(c *gin.Context) {
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Failure 409 {object} map[string]interface{} "URL重复"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/knowledge/url [post]
func (h *KnowledgeHandler) CreateKnowledgeFromURL(c *gin.Context) {
ctx := c.Request.Context()
@@ -261,6 +263,7 @@ func (h *KnowledgeHandler) CreateKnowledgeFromURL(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "创建的知识"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/knowledge/manual [post]
func (h *KnowledgeHandler) CreateManualKnowledge(c *gin.Context) {
ctx := c.Request.Context()
@@ -311,6 +314,7 @@ func (h *KnowledgeHandler) CreateManualKnowledge(c *gin.Context) {
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Failure 404 {object} errors.AppError "知识不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge/{id} [get]
func (h *KnowledgeHandler) GetKnowledge(c *gin.Context) {
ctx := c.Request.Context()
@@ -360,6 +364,7 @@ func (h *KnowledgeHandler) GetKnowledge(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "知识列表"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/knowledge [get]
func (h *KnowledgeHandler) ListKnowledge(c *gin.Context) {
ctx := c.Request.Context()
@@ -430,6 +435,7 @@ func (h *KnowledgeHandler) ListKnowledge(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "删除成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge/{id} [delete]
func (h *KnowledgeHandler) DeleteKnowledge(c *gin.Context) {
ctx := c.Request.Context()
@@ -469,6 +475,7 @@ func (h *KnowledgeHandler) DeleteKnowledge(c *gin.Context) {
// @Success 200 {file} file "文件内容"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge/{id}/download [get]
func (h *KnowledgeHandler) DownloadKnowledgeFile(c *gin.Context) {
ctx := c.Request.Context()
@@ -536,6 +543,7 @@ type GetKnowledgeBatchRequest struct {
// @Success 200 {object} map[string]interface{} "知识列表"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge/batch [get]
func (h *KnowledgeHandler) GetKnowledgeBatch(c *gin.Context) {
ctx := c.Request.Context()
@@ -594,6 +602,7 @@ func (h *KnowledgeHandler) GetKnowledgeBatch(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "更新成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge/{id} [put]
func (h *KnowledgeHandler) UpdateKnowledge(c *gin.Context) {
ctx := c.Request.Context()
@@ -636,6 +645,7 @@ func (h *KnowledgeHandler) UpdateKnowledge(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "更新后的知识"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge/manual/{id} [put]
func (h *KnowledgeHandler) UpdateManualKnowledge(c *gin.Context) {
ctx := c.Request.Context()
@@ -689,6 +699,7 @@ type knowledgeTagBatchRequest struct {
// @Success 200 {object} map[string]interface{} "更新成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge/tags [put]
func (h *KnowledgeHandler) UpdateKnowledgeTagBatch(c *gin.Context) {
ctx := c.Request.Context()
@@ -720,6 +731,7 @@ func (h *KnowledgeHandler) UpdateKnowledgeTagBatch(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "更新成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge/image/{id}/{chunk_id} [put]
func (h *KnowledgeHandler) UpdateImageInfo(c *gin.Context) {
ctx := c.Request.Context()
@@ -777,6 +789,7 @@ func (h *KnowledgeHandler) UpdateImageInfo(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "Search results"
// @Failure 400 {object} errors.AppError "Invalid request"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge/search [get]
func (h *KnowledgeHandler) SearchKnowledge(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/knowledgebase.go b/internal/handler/knowledgebase.go
index d19265409..bbfcc36d0 100644
--- a/internal/handler/knowledgebase.go
+++ b/internal/handler/knowledgebase.go
@@ -48,6 +48,7 @@ func NewKnowledgeBaseHandler(
// @Success 200 {object} map[string]interface{} "搜索结果"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/hybrid-search [get]
func (h *KnowledgeBaseHandler) HybridSearch(c *gin.Context) {
ctx := c.Request.Context()
@@ -99,6 +100,7 @@ func (h *KnowledgeBaseHandler) HybridSearch(c *gin.Context) {
// @Success 201 {object} map[string]interface{} "创建的知识库"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases [post]
func (h *KnowledgeBaseHandler) CreateKnowledgeBase(c *gin.Context) {
ctx := c.Request.Context()
@@ -186,6 +188,7 @@ func (h *KnowledgeBaseHandler) validateAndGetKnowledgeBase(c *gin.Context) (*typ
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Failure 404 {object} errors.AppError "知识库不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id} [get]
func (h *KnowledgeBaseHandler) GetKnowledgeBase(c *gin.Context) {
// Validate and get the knowledge base
@@ -209,6 +212,7 @@ func (h *KnowledgeBaseHandler) GetKnowledgeBase(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "知识库列表"
// @Failure 500 {object} errors.AppError "服务器错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases [get]
func (h *KnowledgeBaseHandler) ListKnowledgeBases(c *gin.Context) {
ctx := c.Request.Context()
@@ -245,6 +249,7 @@ type UpdateKnowledgeBaseRequest struct {
// @Success 200 {object} map[string]interface{} "更新后的知识库"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id} [put]
func (h *KnowledgeBaseHandler) UpdateKnowledgeBase(c *gin.Context) {
ctx := c.Request.Context()
@@ -294,6 +299,7 @@ func (h *KnowledgeBaseHandler) UpdateKnowledgeBase(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "删除成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id} [delete]
func (h *KnowledgeBaseHandler) DeleteKnowledgeBase(c *gin.Context) {
ctx := c.Request.Context()
@@ -347,6 +353,7 @@ type CopyKnowledgeBaseResponse struct {
// @Success 200 {object} map[string]interface{} "任务ID"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/copy [post]
func (h *KnowledgeBaseHandler) CopyKnowledgeBase(c *gin.Context) {
ctx := c.Request.Context()
@@ -432,6 +439,7 @@ func (h *KnowledgeBaseHandler) CopyKnowledgeBase(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "进度信息"
// @Failure 404 {object} errors.AppError "任务不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/copy/progress/{task_id} [get]
func (h *KnowledgeBaseHandler) GetKBCloneProgress(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/mcp_service.go b/internal/handler/mcp_service.go
index b8f959797..36795b62f 100644
--- a/internal/handler/mcp_service.go
+++ b/internal/handler/mcp_service.go
@@ -33,6 +33,7 @@ func NewMCPServiceHandler(mcpServiceService interfaces.MCPServiceService) *MCPSe
// @Success 200 {object} map[string]interface{} "创建的MCP服务"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /mcp-services [post]
func (h *MCPServiceHandler) CreateMCPService(c *gin.Context) {
ctx := c.Request.Context()
@@ -73,6 +74,7 @@ func (h *MCPServiceHandler) CreateMCPService(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "MCP服务列表"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /mcp-services [get]
func (h *MCPServiceHandler) ListMCPServices(c *gin.Context) {
ctx := c.Request.Context()
@@ -107,6 +109,7 @@ func (h *MCPServiceHandler) ListMCPServices(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "MCP服务详情"
// @Failure 404 {object} errors.AppError "服务不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /mcp-services/{id} [get]
func (h *MCPServiceHandler) GetMCPService(c *gin.Context) {
ctx := c.Request.Context()
@@ -143,6 +146,7 @@ func (h *MCPServiceHandler) GetMCPService(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "更新后的MCP服务"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /mcp-services/{id} [put]
func (h *MCPServiceHandler) UpdateMCPService(c *gin.Context) {
ctx := c.Request.Context()
@@ -273,6 +277,7 @@ func (h *MCPServiceHandler) UpdateMCPService(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "删除成功"
// @Failure 500 {object} errors.AppError "服务器错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /mcp-services/{id} [delete]
func (h *MCPServiceHandler) DeleteMCPService(c *gin.Context) {
ctx := c.Request.Context()
@@ -308,6 +313,7 @@ func (h *MCPServiceHandler) DeleteMCPService(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "测试结果"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /mcp-services/{id}/test [post]
func (h *MCPServiceHandler) TestMCPService(c *gin.Context) {
ctx := c.Request.Context()
@@ -352,6 +358,7 @@ func (h *MCPServiceHandler) TestMCPService(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "工具列表"
// @Failure 500 {object} errors.AppError "服务器错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /mcp-services/{id}/tools [get]
func (h *MCPServiceHandler) GetMCPServiceTools(c *gin.Context) {
ctx := c.Request.Context()
@@ -387,6 +394,7 @@ func (h *MCPServiceHandler) GetMCPServiceTools(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "资源列表"
// @Failure 500 {object} errors.AppError "服务器错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /mcp-services/{id}/resources [get]
func (h *MCPServiceHandler) GetMCPServiceResources(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/message.go b/internal/handler/message.go
index 7ff97de7b..2d26fb0f2 100644
--- a/internal/handler/message.go
+++ b/internal/handler/message.go
@@ -42,6 +42,7 @@ func NewMessageHandler(messageService interfaces.MessageService) *MessageHandler
// @Success 200 {object} map[string]interface{} "消息列表"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /messages/{session_id}/load [get]
func (h *MessageHandler) LoadMessages(c *gin.Context) {
ctx := c.Request.Context()
@@ -129,6 +130,7 @@ func (h *MessageHandler) LoadMessages(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "删除成功"
// @Failure 500 {object} errors.AppError "服务器错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /messages/{session_id}/{id} [delete]
func (h *MessageHandler) DeleteMessage(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/model.go b/internal/handler/model.go
index 1dd7ff23c..fbd847c71 100644
--- a/internal/handler/model.go
+++ b/internal/handler/model.go
@@ -78,6 +78,7 @@ type CreateModelRequest struct {
// @Success 201 {object} map[string]interface{} "创建的模型"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /models [post]
func (h *ModelHandler) CreateModel(c *gin.Context) {
ctx := c.Request.Context()
@@ -141,6 +142,7 @@ func (h *ModelHandler) CreateModel(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "模型详情"
// @Failure 404 {object} errors.AppError "模型不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /models/{id} [get]
func (h *ModelHandler) GetModel(c *gin.Context) {
ctx := c.Request.Context()
@@ -190,6 +192,7 @@ func (h *ModelHandler) GetModel(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "模型列表"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /models [get]
func (h *ModelHandler) ListModels(c *gin.Context) {
ctx := c.Request.Context()
@@ -248,6 +251,7 @@ type UpdateModelRequest struct {
// @Success 200 {object} map[string]interface{} "更新后的模型"
// @Failure 404 {object} errors.AppError "模型不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /models/{id} [put]
func (h *ModelHandler) UpdateModel(c *gin.Context) {
ctx := c.Request.Context()
@@ -320,6 +324,7 @@ func (h *ModelHandler) UpdateModel(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "删除成功"
// @Failure 404 {object} errors.AppError "模型不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /models/{id} [delete]
func (h *ModelHandler) DeleteModel(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/session/handler.go b/internal/handler/session/handler.go
index 8334b33fd..0ed065e6b 100644
--- a/internal/handler/session/handler.go
+++ b/internal/handler/session/handler.go
@@ -49,6 +49,7 @@ func NewHandler(
// @Success 201 {object} map[string]interface{} "创建的会话"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /sessions [post]
func (h *Handler) CreateSession(c *gin.Context) {
ctx := c.Request.Context()
@@ -207,6 +208,7 @@ func (h *Handler) applyConversationDefaults(ctx context.Context, session *types.
// @Success 200 {object} map[string]interface{} "会话详情"
// @Failure 404 {object} errors.AppError "会话不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /sessions/{id} [get]
func (h *Handler) GetSession(c *gin.Context) {
ctx := c.Request.Context()
@@ -254,6 +256,7 @@ func (h *Handler) GetSession(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "会话列表"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /sessions [get]
func (h *Handler) GetSessionsByTenant(c *gin.Context) {
ctx := c.Request.Context()
@@ -295,6 +298,7 @@ func (h *Handler) GetSessionsByTenant(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "更新后的会话"
// @Failure 404 {object} errors.AppError "会话不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /sessions/{id} [put]
func (h *Handler) UpdateSession(c *gin.Context) {
ctx := c.Request.Context()
@@ -356,6 +360,7 @@ func (h *Handler) UpdateSession(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "删除成功"
// @Failure 404 {object} errors.AppError "会话不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /sessions/{id} [delete]
func (h *Handler) DeleteSession(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/session/qa.go b/internal/handler/session/qa.go
index 533ab008c..7c7ad8a6c 100644
--- a/internal/handler/session/qa.go
+++ b/internal/handler/session/qa.go
@@ -26,6 +26,7 @@ import (
// @Success 200 {object} map[string]interface{} "搜索结果"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /sessions/search [post]
func (h *Handler) SearchKnowledge(c *gin.Context) {
ctx := logger.CloneContext(c.Request.Context())
@@ -88,6 +89,7 @@ func (h *Handler) SearchKnowledge(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "问答结果(SSE流)"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /sessions/{session_id}/knowledge-qa [post]
func (h *Handler) KnowledgeQA(c *gin.Context) {
ctx := logger.CloneContext(c.Request.Context())
@@ -170,6 +172,7 @@ func (h *Handler) KnowledgeQA(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "问答结果(SSE流)"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /sessions/{session_id}/agent-qa [post]
func (h *Handler) AgentQA(c *gin.Context) {
ctx := logger.CloneContext(c.Request.Context())
diff --git a/internal/handler/session/stream.go b/internal/handler/session/stream.go
index 9a134cd22..dd1c694e3 100644
--- a/internal/handler/session/stream.go
+++ b/internal/handler/session/stream.go
@@ -26,6 +26,7 @@ import (
// @Success 200 {object} map[string]interface{} "流式响应"
// @Failure 404 {object} errors.AppError "会话或消息不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /sessions/{session_id}/continue [get]
func (h *Handler) ContinueStream(c *gin.Context) {
ctx := c.Request.Context()
@@ -185,6 +186,7 @@ func (h *Handler) ContinueStream(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "停止成功"
// @Failure 404 {object} errors.AppError "会话或消息不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /sessions/{session_id}/stop [post]
func (h *Handler) StopSession(c *gin.Context) {
ctx := logger.CloneContext(c.Request.Context())
diff --git a/internal/handler/session/title.go b/internal/handler/session/title.go
index 21122d8e1..7d235e428 100644
--- a/internal/handler/session/title.go
+++ b/internal/handler/session/title.go
@@ -19,6 +19,7 @@ import (
// @Success 200 {object} map[string]interface{} "生成的标题"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /sessions/{session_id}/title [post]
func (h *Handler) GenerateTitle(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/tag.go b/internal/handler/tag.go
index 02593564d..43397d6f3 100644
--- a/internal/handler/tag.go
+++ b/internal/handler/tag.go
@@ -35,6 +35,7 @@ func NewTagHandler(tagService interfaces.KnowledgeTagService) *TagHandler {
// @Success 200 {object} map[string]interface{} "标签列表"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/tags [get]
func (h *TagHandler) ListTags(c *gin.Context) {
ctx := c.Request.Context()
@@ -79,6 +80,7 @@ type createTagRequest struct {
// @Success 200 {object} map[string]interface{} "创建的标签"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/tags [post]
func (h *TagHandler) CreateTag(c *gin.Context) {
ctx := c.Request.Context()
@@ -125,6 +127,7 @@ type updateTagRequest struct {
// @Success 200 {object} map[string]interface{} "更新后的标签"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/tags/{tag_id} [put]
func (h *TagHandler) UpdateTag(c *gin.Context) {
ctx := c.Request.Context()
@@ -164,6 +167,7 @@ func (h *TagHandler) UpdateTag(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "删除成功"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /knowledge-bases/{id}/tags/{tag_id} [delete]
func (h *TagHandler) DeleteTag(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/tenant.go b/internal/handler/tenant.go
index f268c08b5..eac5b405a 100644
--- a/internal/handler/tenant.go
+++ b/internal/handler/tenant.go
@@ -102,6 +102,7 @@ func (h *TenantHandler) CreateTenant(c *gin.Context) {
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Failure 404 {object} errors.AppError "租户不存在"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /tenants/{id} [get]
func (h *TenantHandler) GetTenant(c *gin.Context) {
ctx := c.Request.Context()
@@ -338,6 +339,7 @@ func (h *TenantHandler) ListAllTenants(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "搜索结果"
// @Failure 403 {object} errors.AppError "权限不足"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /tenants/search [get]
func (h *TenantHandler) SearchTenants(c *gin.Context) {
ctx := c.Request.Context()
@@ -435,6 +437,7 @@ type AgentConfigRequest struct {
// @Success 200 {object} map[string]interface{} "Agent配置"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /tenants/kv/agent-config [get]
func (h *TenantHandler) GetTenantAgentConfig(c *gin.Context) {
ctx := c.Request.Context()
@@ -591,6 +594,7 @@ func (h *TenantHandler) updateTenantAgentConfigInternal(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "配置值"
// @Failure 400 {object} errors.AppError "不支持的键"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /tenants/kv/{key} [get]
func (h *TenantHandler) GetTenantKV(c *gin.Context) {
ctx := c.Request.Context()
@@ -624,6 +628,7 @@ func (h *TenantHandler) GetTenantKV(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "更新成功"
// @Failure 400 {object} errors.AppError "不支持的键"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /tenants/kv/{key} [put]
func (h *TenantHandler) UpdateTenantKV(c *gin.Context) {
ctx := c.Request.Context()
@@ -699,6 +704,7 @@ func (h *TenantHandler) updateTenantWebSearchConfigInternal(c *gin.Context) {
// @Success 200 {object} map[string]interface{} "网络搜索配置"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /tenants/kv/web-search-config [get]
func (h *TenantHandler) GetTenantWebSearchConfig(c *gin.Context) {
ctx := c.Request.Context()
@@ -784,6 +790,7 @@ func validateConversationConfig(req *types.ConversationConfig) error {
// @Success 200 {object} map[string]interface{} "对话配置"
// @Failure 400 {object} errors.AppError "请求参数错误"
// @Security Bearer
+// @Security ApiKeyAuth
// @Router /tenants/kv/conversation-config [get]
func (h *TenantHandler) GetTenantConversationConfig(c *gin.Context) {
ctx := c.Request.Context()
diff --git a/internal/handler/web_search.go b/internal/handler/web_search.go
index 2262b8797..7df81ca05 100644
--- a/internal/handler/web_search.go
+++ b/internal/handler/web_search.go
@@ -28,7 +28,9 @@ func NewWebSearchHandler(cfg *config.Config) *WebSearchHandler {
// @Accept json
// @Produce json
// @Success 200 {object} map[string]interface{} "List of providers"
-// @Router /api/v1/web-search/providers [get]
+// @Security Bearer
+// @Security ApiKeyAuth
+// @Router /web-search/providers [get]
func (h *WebSearchHandler) GetProviders(c *gin.Context) {
ctx := c.Request.Context()
logger.Info(ctx, "Getting web search providers")