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

This commit is contained in:
wizardchen
2025-12-22 14:36:29 +08:00
committed by lyingbug
parent 86347d4c16
commit ac21f81dda
20 changed files with 1459 additions and 81 deletions
+6 -1
View File
@@ -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 (
+544 -30
View File
File diff suppressed because it is too large Load Diff
+544 -30
View File
File diff suppressed because it is too large Load Diff
+272 -19
View File
@@ -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
+6
View File
@@ -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()
+2
View File
@@ -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()
+10
View File
@@ -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()
+14
View File
@@ -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()
+13
View File
@@ -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()
+8
View File
@@ -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()
+8
View File
@@ -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()
+2
View File
@@ -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()
+5
View File
@@ -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()
+5
View File
@@ -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()
+3
View File
@@ -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())
+2
View File
@@ -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())
+1
View File
@@ -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()
+4
View File
@@ -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()
+7
View File
@@ -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()
+3 -1
View File
@@ -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")