Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
docs(api): add and fix swag annotations on handlers
nullkeyc753c6760859
diff --git a/internal/handler/chunker_debug.go b/internal/handler/chunker_debug.goindex 609e59518..b7f7e818d 100644--- a/internal/handler/chunker_debug.go+++ b/internal/handler/chunker_debug.go@@ -102,6 +102,21 @@ type PreviewChunkingResponse struct {// through the adaptive chunker and returns the chunks plus diagnostic// information about which tier won. Read-only: no DB writes, no embedding// calls, no logging of the supplied text.+//+// PreviewChunking godoc+// @Summary 预览分块结果+// @Description 对提交的文本运行自适应分块器并返回分块预览,不写入数据库不生成 embedding。文本最大 64k 字符+// @Tags 分块+// @Accept json+// @Produce json+// @Param request body handler.PreviewChunkingRequest true "{text, chunking_config}"+// @Success 200 {object} handler.PreviewChunkingResponse "分块结果"+// @Failure 400 {object} map[string]interface{} "请求参数错误"+// @Failure 413 {object} map[string]interface{} "文本超过预览限制"+// @Failure 504 {object} map[string]interface{} "分块超时"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /chunker/preview [post]func PreviewChunking(c *gin.Context) {ctx, cancel := context.WithTimeout(c.Request.Context(), previewTimeout)defer cancel()diff --git a/internal/handler/im.go b/internal/handler/im.goindex f36a83e27..f9a24321f 100644--- a/internal/handler/im.go+++ b/internal/handler/im.go@@ -155,6 +155,21 @@ func (h *IMHandler) ListAllIMChannels(c *gin.Context) {}// UpdateIMChannel updates an IM channel.+//+// UpdateIMChannel godoc+// @Summary 更新 IM 渠道+// @Description 更新指定 IM 渠道的名称、模式、知识库、凭证或启用状态+// @Tags IM 渠道+// @Accept json+// @Produce json+// @Param id path string true "渠道 ID"+// @Param request body map[string]interface{} true "更新字段(name/mode/output_mode/knowledge_base_id/credentials/enabled)"+// @Success 200 {object} map[string]interface{} "更新后的渠道"+// @Failure 400 {object} map[string]interface{} "请求参数错误"+// @Failure 404 {object} map[string]interface{} "渠道不存在"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /im-channels/{id} [put]func (h *IMHandler) UpdateIMChannel(c *gin.Context) {channelID := c.Param("id")if channelID == "" {@@ -220,6 +235,19 @@ func (h *IMHandler) UpdateIMChannel(c *gin.Context) {}// DeleteIMChannel deletes an IM channel.+//+// DeleteIMChannel godoc+// @Summary 删除 IM 渠道+// @Description 删除指定 IM 渠道+// @Tags IM 渠道+// @Produce json+// @Param id path string true "渠道 ID"+// @Success 200 {object} map[string]interface{} "success: true"+// @Failure 400 {object} map[string]interface{} "请求参数错误"+// @Failure 404 {object} map[string]interface{} "渠道不存在"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /im-channels/{id} [delete]func (h *IMHandler) DeleteIMChannel(c *gin.Context) {channelID := c.Param("id")if channelID == "" {@@ -242,6 +270,19 @@ func (h *IMHandler) DeleteIMChannel(c *gin.Context) {}// ToggleIMChannel toggles the enabled state of an IM channel.+//+// ToggleIMChannel godoc+// @Summary 启用/停用 IM 渠道+// @Description 切换指定 IM 渠道的启用状态+// @Tags IM 渠道+// @Produce json+// @Param id path string true "渠道 ID"+// @Success 200 {object} map[string]interface{} "更新后的渠道"+// @Failure 400 {object} map[string]interface{} "请求参数错误"+// @Failure 404 {object} map[string]interface{} "渠道不存在"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /im-channels/{id}/toggle [post]func (h *IMHandler) ToggleIMChannel(c *gin.Context) {channelID := c.Param("id")if channelID == "" {@@ -268,6 +309,19 @@ func (h *IMHandler) ToggleIMChannel(c *gin.Context) {// IMCallback handles IM platform callback requests for a specific channel.// Route: POST /api/v1/im/callback/:channel_id+//+// IMCallback godoc+// @Summary IM 平台回调+// @Description 接收各 IM 平台的事件回调;走平台自身签名校验,不使用 API Key+// @Tags IM 回调+// @Accept json+// @Produce json+// @Param channel_id path string true "渠道 ID"+// @Success 200 {object} map[string]interface{} "处理结果"+// @Failure 400 {object} map[string]interface{} "请求参数错误"+// @Failure 401 {object} map[string]interface{} "签名校验失败"+// @Router /im/callback/{channel_id} [get]+// @Router /im/callback/{channel_id} [post]func (h *IMHandler) IMCallback(c *gin.Context) {ctx := c.Request.Context()channelID := c.Param("channel_id")diff --git a/internal/handler/initialization.go b/internal/handler/initialization.goindex 3e88c533c..53237365e 100644--- a/internal/handler/initialization.go+++ b/internal/handler/initialization.go@@ -223,7 +223,7 @@ type InitializationRequest struct {// @Failure 404 {object} errors.AppError "知识库不存在"// @Security Bearer// @Security ApiKeyAuth-// @Router /initialization/kb/{kbId}/config [put]+// @Router /initialization/config/{kbId} [put]func (h *InitializationHandler) UpdateKBConfig(c *gin.Context) {ctx := c.Request.Context()kbIdStr := utils.SanitizeForLog(c.Param("kbId"))@@ -435,12 +435,12 @@ func (h *InitializationHandler) UpdateKBConfig(c *gin.Context) {// @Accept json// @Produce json// @Param kbId path string true "知识库ID"-// @Param request body object true "初始化请求"+// @Param request body handler.InitializationRequest true "初始化请求"// @Success 200 {object} map[string]interface{} "初始化成功"// @Failure 400 {object} errors.AppError "请求参数错误"// @Security Bearer// @Security ApiKeyAuth-// @Router /initialization/kb/{kbId} [post]+// @Router /initialization/initialize/{kbId} [post]func (h *InitializationHandler) InitializeByKB(c *gin.Context) {ctx := c.Request.Context()kbIdStr := utils.SanitizeForLog(c.Param("kbId"))@@ -1096,7 +1096,7 @@ func (h *InitializationHandler) DownloadOllamaModel(c *gin.Context) {// @Failure 404 {object} errors.AppError "任务不存在"// @Security Bearer// @Security ApiKeyAuth-// @Router /initialization/ollama/download/{taskId} [get]+// @Router /initialization/ollama/download/progress/{taskId} [get]func (h *InitializationHandler) GetDownloadProgress(c *gin.Context) {taskID := c.Param("taskId")@@ -1293,7 +1293,7 @@ func (h *InitializationHandler) updateTaskStatus(// @Failure 404 {object} errors.AppError "知识库不存在"// @Security Bearer// @Security ApiKeyAuth-// @Router /initialization/kb/{kbId}/config [get]+// @Router /initialization/config/{kbId} [get]func (h *InitializationHandler) GetCurrentConfigByKB(c *gin.Context) {ctx := c.Request.Context()kbIdStr := utils.SanitizeForLog(c.Param("kbId"))@@ -1585,7 +1585,7 @@ func (h *InitializationHandler) resolveTenantWeKnoraCloudCreds(ctx context.Conte// @Failure 400 {object} errors.AppError "请求参数错误"// @Security Bearer// @Security ApiKeyAuth-// @Router /initialization/models/remote/check [post]+// @Router /initialization/remote/check [post]func (h *InitializationHandler) CheckRemoteModel(c *gin.Context) {ctx := c.Request.Context()@@ -1636,12 +1636,12 @@ func (h *InitializationHandler) CheckRemoteModel(c *gin.Context) {// @Tags 初始化// @Accept json// @Produce json-// @Param request body object true "Embedding测试请求"+// @Param request body handler.ModelTestRequest true "Embedding测试请求"// @Success 200 {object} map[string]interface{} "测试结果"// @Failure 400 {object} errors.AppError "请求参数错误"// @Security Bearer// @Security ApiKeyAuth-// @Router /initialization/models/embedding/test [post]+// @Router /initialization/embedding/test [post]func (h *InitializationHandler) TestEmbeddingModel(c *gin.Context) {ctx := c.Request.Context()@@ -1785,12 +1785,12 @@ func (h *InitializationHandler) checkRerankModelConnection(// @Tags 初始化// @Accept json// @Produce json-// @Param request body object true "Rerank检查请求"+// @Param request body handler.ModelTestRequest true "Rerank检查请求"// @Success 200 {object} map[string]interface{} "检查结果"// @Failure 400 {object} errors.AppError "请求参数错误"// @Security Bearer// @Security ApiKeyAuth-// @Router /initialization/models/rerank/check [post]+// @Router /initialization/rerank/check [post]func (h *InitializationHandler) CheckRerankModel(c *gin.Context) {ctx := c.Request.Context()@@ -1842,12 +1842,12 @@ func (h *InitializationHandler) CheckRerankModel(c *gin.Context) {// @Tags 初始化// @Accept json// @Produce json-// @Param request body object true "ASR检查请求"+// @Param request body handler.ModelTestRequest true "ASR检查请求"// @Success 200 {object} map[string]interface{} "检查结果"// @Failure 400 {object} errors.AppError "请求参数错误"// @Security Bearer// @Security ApiKeyAuth-// @Router /initialization/models/asr/check [post]+// @Router /initialization/asr/check [post]func (h *InitializationHandler) CheckASRModel(c *gin.Context) {ctx := c.Request.Context()@@ -2192,7 +2192,7 @@ type TextRelationExtractionResponse struct {// @Failure 400 {object} errors.AppError "请求参数错误"// @Security Bearer// @Security ApiKeyAuth-// @Router /initialization/extract/relations [post]+// @Router /initialization/extract/text-relation [post]func (h *InitializationHandler) ExtractTextRelations(c *gin.Context) {ctx := c.Request.Context()@@ -2293,7 +2293,7 @@ type FabriTextResponse struct {// @Failure 400 {object} errors.AppError "请求参数错误"// @Security Bearer// @Security ApiKeyAuth-// @Router /initialization/fabri/text [post]+// @Router /initialization/extract/fabri-text [post]func (h *InitializationHandler) FabriText(c *gin.Context) {ctx := c.Request.Context()@@ -2367,7 +2367,7 @@ var tagOptions = []string{// @Accept json// @Produce json// @Success 200 {object} map[string]interface{} "生成的标签"-// @Router /initialization/fabri/tag [get]+// @Router /initialization/extract/fabri-tag [post]func (h *InitializationHandler) FabriTag(c *gin.Context) {tagRandom := RandomSelect(tagOptions, rand.Intn(len(tagOptions)-1)+1)c.JSON(http.StatusOK, gin.H{diff --git a/internal/handler/knowledge.go b/internal/handler/knowledge.goindex 116cd959b..e6cdcc93c 100644--- a/internal/handler/knowledge.go+++ b/internal/handler/knowledge.go@@ -1583,6 +1583,19 @@ type MoveKnowledgeResponse struct {}// MoveKnowledge moves knowledge items from one knowledge base to another (async task).+//+// MoveKnowledge godoc+// @Summary 移动知识到其他知识库+// @Description 将一条或多条知识从源知识库移动到目标知识库(异步),返回任务 ID 用于查询进度+// @Tags 知识+// @Accept json+// @Produce json+// @Param request body handler.MoveKnowledgeRequest true "{source_kb_id, target_kb_id, knowledge_ids}"+// @Success 200 {object} handler.MoveKnowledgeResponse "任务信息"+// @Failure 400 {object} errors.AppError "请求参数错误"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /knowledge/move [post]func (h *KnowledgeHandler) MoveKnowledge(c *gin.Context) {ctx := c.Request.Context()@@ -1727,6 +1740,18 @@ func (h *KnowledgeHandler) MoveKnowledge(c *gin.Context) {}// GetKnowledgeMoveProgress retrieves the progress of a knowledge move task.+//+// GetKnowledgeMoveProgress godoc+// @Summary 获取知识移动进度+// @Description 按任务 ID 查询移动进度+// @Tags 知识+// @Produce json+// @Param task_id path string true "移动任务 ID"+// @Success 200 {object} types.KnowledgeMoveProgress "进度信息"+// @Failure 404 {object} errors.AppError "任务不存在"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /knowledge/move/progress/{task_id} [get]func (h *KnowledgeHandler) GetKnowledgeMoveProgress(c *gin.Context) {ctx := c.Request.Context()diff --git a/internal/handler/knowledgebase.go b/internal/handler/knowledgebase.goindex 394e50f72..c51a70461 100644--- a/internal/handler/knowledgebase.go+++ b/internal/handler/knowledgebase.go@@ -814,6 +814,19 @@ func validateExtractConfig(config *types.ExtractConfig) error {// ListMoveTargets returns knowledge bases eligible as move targets for the given source KB.// Filters: same Type, same EmbeddingModelID, different ID, not temporary.+//+// ListMoveTargets godoc+// @Summary 获取可移动目标知识库列表+// @Description 返回与源知识库 Type 一致、EmbeddingModelID 一致、非临时且不是自身的目标知识库列表+// @Tags 知识库+// @Produce json+// @Param id path string true "源知识库 ID"+// @Success 200 {object} map[string]interface{} "可移动目标列表"+// @Failure 400 {object} errors.AppError "请求参数错误"+// @Failure 404 {object} errors.AppError "知识库不存在"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /knowledge-bases/{id}/move-targets [get]func (h *KnowledgeBaseHandler) ListMoveTargets(c *gin.Context) {ctx := c.Request.Context()diff --git a/internal/handler/mcp_service.go b/internal/handler/mcp_service.goindex f7b0f759b..dad4200e2 100644--- a/internal/handler/mcp_service.go+++ b/internal/handler/mcp_service.go@@ -491,6 +491,22 @@ type setMCPToolApprovalBody struct {}// SetMCPToolApproval sets whether a tool requires human approval before the agent may call it.+//+// SetMCPToolApproval godoc+// @Summary 设置 MCP 工具人工审批策略+// @Description 为指定 MCP 服务下的某个工具设置/更新审批要求+// @Tags MCP服务+// @Accept json+// @Produce json+// @Param id path string true "MCP 服务 ID"+// @Param tool_name path string true "工具名"+// @Param request body map[string]interface{} true "{require_approval: bool}"+// @Success 200 {object} map[string]interface{} "更新结果"+// @Failure 400 {object} errors.AppError "请求参数错误"+// @Failure 404 {object} errors.AppError "MCP 服务或工具不存在"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /mcp-services/{id}/tool-approvals/{tool_name} [put]func (h *MCPServiceHandler) SetMCPToolApproval(c *gin.Context) {ctx := c.Request.Context()serviceID := secutils.SanitizeForLog(c.Param("id"))@@ -525,6 +541,21 @@ type resolveToolApprovalBody struct {}// ResolveToolApproval completes a pending MCP tool approval (agent execution resumes).+//+// ResolveToolApproval godoc+// @Summary 处理 MCP 工具调用待审批请求+// @Description 用户审批通过或驳回一次工具调用(用于 Agent 阻塞等待审批的场景)+// @Tags MCP服务+// @Accept json+// @Produce json+// @Param pending_id path string true "待审批记录 ID"+// @Param request body map[string]interface{} true "{decision: \"approve\"|\"reject\", reason?: string, modified_args?: object}"+// @Success 200 {object} map[string]interface{} "审批结果"+// @Failure 400 {object} errors.AppError "请求参数错误"+// @Failure 404 {object} errors.AppError "待审批记录不存在"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /agent/tool-approvals/{pending_id} [post]func (h *MCPServiceHandler) ResolveToolApproval(c *gin.Context) {ctx := c.Request.Context()pendingID := c.Param("pending_id")diff --git a/internal/handler/organization.go b/internal/handler/organization.goindex 38d430431..97ec6cd3d 100644--- a/internal/handler/organization.go+++ b/internal/handler/organization.go@@ -1296,7 +1296,20 @@ func (h *OrganizationHandler) ListAgentShares(c *gin.Context) {c.JSON(http.StatusOK, gin.H{"success": true, "data": gin.H{"shares": response, "total": len(response)}})}-// RemoveAgentShare removes an agent share+// RemoveAgentShare removes an agent share.+//+// RemoveAgentShare godoc+// @Summary 取消智能体共享+// @Description 从智能体的共享列表中移除指定共享关系+// @Tags 组织+// @Produce json+// @Param id path string true "智能体 ID"+// @Param share_id path string true "共享记录 ID"+// @Success 200 {object} map[string]interface{} "success: true"+// @Failure 403 {object} apperrors.AppError "无权限"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /agents/{id}/shares/{share_id} [delete]func (h *OrganizationHandler) RemoveAgentShare(c *gin.Context) {ctx := c.Request.Context()shareID := c.Param("share_id")@@ -1309,7 +1322,19 @@ func (h *OrganizationHandler) RemoveAgentShare(c *gin.Context) {c.JSON(http.StatusOK, gin.H{"success": true, "message": "Share removed successfully"})}-// ListOrgAgentShares lists all agents shared to an organization+// ListOrgAgentShares lists all agents shared to an organization.+//+// ListOrgAgentShares godoc+// @Summary 获取共享到本组织的智能体+// @Description 返回所有被共享到指定组织的智能体(含我的有效权限)+// @Tags 组织+// @Produce json+// @Param id path string true "组织 ID"+// @Success 200 {object} map[string]interface{} "智能体共享列表 + total"+// @Failure 403 {object} apperrors.AppError "非组织成员"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /organizations/{id}/agent-shares [get]func (h *OrganizationHandler) ListOrgAgentShares(c *gin.Context) {ctx := c.Request.Context()orgID := c.Param("id")@@ -1370,7 +1395,18 @@ func (h *OrganizationHandler) ListOrgAgentShares(c *gin.Context) {c.JSON(http.StatusOK, gin.H{"success": true, "data": gin.H{"shares": response, "total": len(response)}})}-// ListSharedAgents lists agents shared to the current user+// ListSharedAgents lists agents shared to the current user.+//+// ListSharedAgents godoc+// @Summary 获取我可访问的共享智能体+// @Description 返回所有共享给当前用户所在组织的智能体+// @Tags 组织+// @Produce json+// @Success 200 {object} map[string]interface{} "智能体列表 + total"+// @Failure 500 {object} apperrors.AppError "服务器错误"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /shared-agents [get]func (h *OrganizationHandler) ListSharedAgents(c *gin.Context) {ctx := c.Request.Context()userID := c.GetString(types.UserIDContextKey.String())diff --git a/internal/handler/session/stream.go b/internal/handler/session/stream.goindex dd1c694e3..3da31e029 100644--- a/internal/handler/session/stream.go+++ b/internal/handler/session/stream.go@@ -27,7 +27,7 @@ import (// @Failure 404 {object} errors.AppError "会话或消息不存在"// @Security Bearer// @Security ApiKeyAuth-// @Router /sessions/{session_id}/continue [get]+// @Router /sessions/continue-stream/{session_id} [get]func (h *Handler) ContinueStream(c *gin.Context) {ctx := c.Request.Context()diff --git a/internal/handler/web_search.go b/internal/handler/web_search.goindex f59694cba..1c7a5009f 100644--- a/internal/handler/web_search.go+++ b/internal/handler/web_search.go@@ -15,7 +15,17 @@ func NewWebSearchHandler() *WebSearchHandler {return &WebSearchHandler{}}-// GetProviders returns the list of available web search provider types+// GetProviders returns the list of available web search provider types.+//+// GetProviders godoc+// @Summary 获取可用网络搜索 Provider 列表+// @Description 返回所有已注册的网络搜索 provider(含元数据)+// @Tags 网络搜索+// @Produce json+// @Success 200 {object} map[string]interface{} "provider 列表"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /web-search/providers [get]func (h *WebSearchHandler) GetProviders(c *gin.Context) {c.JSON(http.StatusOK, gin.H{"success": true,diff --git a/internal/handler/web_search_provider.go b/internal/handler/web_search_provider.goindex 0c813385a..76b10f0b5 100644--- a/internal/handler/web_search_provider.go+++ b/internal/handler/web_search_provider.go@@ -137,7 +137,19 @@ func (h *WebSearchProviderHandler) ListProviders(c *gin.Context) {})}-// GetProvider retrieves a single web search provider by ID+// GetProvider retrieves a single web search provider by ID.+//+// GetProvider godoc+// @Summary 获取网络搜索 Provider 详情+// @Description 根据 ID 获取指定 provider 配置+// @Tags 网络搜索+// @Produce json+// @Param id path string true "Provider ID"+// @Success 200 {object} types.WebSearchProviderEntity "Provider 详情"+// @Failure 404 {object} map[string]interface{} "Provider 不存在"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /web-search-providers/{id} [get]func (h *WebSearchProviderHandler) GetProvider(c *gin.Context) {ctx := c.Request.Context()@@ -160,7 +172,22 @@ func (h *WebSearchProviderHandler) GetProvider(c *gin.Context) {})}-// UpdateProvider updates a web search provider+// UpdateProvider updates a web search provider.+//+// UpdateProvider godoc+// @Summary 更新网络搜索 Provider+// @Description 更新指定 provider 的名称/描述/参数/是否默认+// @Tags 网络搜索+// @Accept json+// @Produce json+// @Param id path string true "Provider ID"+// @Param request body handler.UpdateProviderRequest true "更新字段"+// @Success 200 {object} types.WebSearchProviderEntity "更新后的 Provider"+// @Failure 400 {object} map[string]interface{} "请求参数错误"+// @Failure 404 {object} map[string]interface{} "Provider 不存在"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /web-search-providers/{id} [put]func (h *WebSearchProviderHandler) UpdateProvider(c *gin.Context) {ctx := c.Request.Context()@@ -211,7 +238,19 @@ func (h *WebSearchProviderHandler) UpdateProvider(c *gin.Context) {}}-// DeleteProvider deletes a web search provider+// DeleteProvider deletes a web search provider.+//+// DeleteProvider godoc+// @Summary 删除网络搜索 Provider+// @Description 删除指定 provider 配置+// @Tags 网络搜索+// @Produce json+// @Param id path string true "Provider ID"+// @Success 200 {object} map[string]interface{} "success: true"+// @Failure 404 {object} map[string]interface{} "Provider 不存在"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /web-search-providers/{id} [delete]func (h *WebSearchProviderHandler) DeleteProvider(c *gin.Context) {ctx := c.Request.Context()@@ -238,7 +277,17 @@ func (h *WebSearchProviderHandler) DeleteProvider(c *gin.Context) {c.JSON(http.StatusOK, gin.H{"success": true})}-// ListProviderTypes returns available provider types and their parameter requirements+// ListProviderTypes returns available provider types and their parameter requirements.+//+// ListProviderTypes godoc+// @Summary 获取网络搜索 Provider 类型元数据+// @Description 返回 UI 表单需要的 provider 类型及参数定义+// @Tags 网络搜索+// @Produce json+// @Success 200 {object} map[string]interface{} "provider 类型列表"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /web-search-providers/types [get]func (h *WebSearchProviderHandler) ListProviderTypes(c *gin.Context) {c.JSON(http.StatusOK, gin.H{"success": true,@@ -246,7 +295,19 @@ func (h *WebSearchProviderHandler) ListProviderTypes(c *gin.Context) {})}-// TestProviderByID tests an existing saved provider by performing a sample search+// TestProviderByID tests an existing saved provider by performing a sample search.+//+// TestProviderByID godoc+// @Summary 测试已保存的 Provider+// @Description 使用数据库中已保存的凭证测试连通性+// @Tags 网络搜索+// @Produce json+// @Param id path string true "Provider ID"+// @Success 200 {object} map[string]interface{} "测试结果"+// @Failure 404 {object} map[string]interface{} "Provider 不存在"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /web-search-providers/{id}/test [post]func (h *WebSearchProviderHandler) TestProviderByID(c *gin.Context) {ctx := c.Request.Context()@@ -278,7 +339,20 @@ type TestProviderRequest struct {Parameters types.WebSearchProviderParameters `json:"parameters"`}-// TestProviderRaw tests a provider with raw credentials (no persistence)+// TestProviderRaw tests a provider with raw credentials (no persistence).+//+// TestProviderRaw godoc+// @Summary 使用原始凭证测试 Provider(不落库)+// @Description 使用前端表单中尚未保存的凭证测试连通性,用于"测试连接"按钮+// @Tags 网络搜索+// @Accept json+// @Produce json+// @Param request body handler.TestProviderRequest true "{provider, parameters}"+// @Success 200 {object} map[string]interface{} "测试结果"+// @Failure 400 {object} map[string]interface{} "请求参数错误"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /web-search-providers/test [post]func (h *WebSearchProviderHandler) TestProviderRaw(c *gin.Context) {ctx := c.Request.Context()diff --git a/internal/handler/wechat_qrcode.go b/internal/handler/wechat_qrcode.goindex 8a05dbed5..3624a30bb 100644--- a/internal/handler/wechat_qrcode.go+++ b/internal/handler/wechat_qrcode.go@@ -13,6 +13,17 @@ var qrCodeService = wechat.NewQRCodeService()// WeChatGetQRCode generates a QR code for WeChat login.// POST /api/v1/wechat/qrcode+//+// WeChatGetQRCode godoc+// @Summary 获取微信扫码登录二维码+// @Description 申请一个用于扫码登录绑定的微信二维码(无请求体)+// @Tags IM 渠道+// @Produce json+// @Success 200 {object} map[string]interface{} "二维码信息(qrcode_url + qrcode 标识)"+// @Failure 500 {object} map[string]interface{} "二维码生成失败"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /wechat/qrcode [post]func (h *IMHandler) WeChatGetQRCode(c *gin.Context) {ctx := c.Request.Context()@@ -33,6 +44,20 @@ func (h *IMHandler) WeChatGetQRCode(c *gin.Context) {// WeChatPollQRCodeStatus checks the scan status of a WeChat QR code.// POST /api/v1/wechat/qrcode/status+//+// WeChatPollQRCodeStatus godoc+// @Summary 轮询微信二维码状态+// @Description 查询指定二维码是否已被扫描/确认/过期;confirmed 时返回凭证+// @Tags IM 渠道+// @Accept json+// @Produce json+// @Param request body map[string]interface{} true "{qrcode: string}"+// @Success 200 {object} map[string]interface{} "扫码状态"+// @Failure 400 {object} map[string]interface{} "请求参数错误"+// @Failure 500 {object} map[string]interface{} "服务器错误"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /wechat/qrcode/status [post]func (h *IMHandler) WeChatPollQRCodeStatus(c *gin.Context) {ctx := c.Request.Context()diff --git a/internal/handler/weknoracloud.go b/internal/handler/weknoracloud.goindex c447272d0..d78dd9d06 100644--- a/internal/handler/weknoracloud.go+++ b/internal/handler/weknoracloud.go@@ -24,6 +24,19 @@ type weKnoraCloudCredentialsRequest struct {// SaveCredentials POST /api/v1/weknoracloud/credentials// 仅保存 APPID/APPSECRET 凭证到租户配置,不自动创建模型+//+// SaveCredentials godoc+// @Summary 保存 WeKnoraCloud 凭证+// @Description 保存 APPID/APPSECRET 到当前租户配置(不自动创建模型)+// @Tags WeKnoraCloud+// @Accept json+// @Produce json+// @Param request body map[string]interface{} true "{app_id, app_secret}"+// @Success 200 {object} map[string]interface{} "success: true"+// @Failure 400 {object} map[string]interface{} "请求参数错误"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /weknoracloud/credentials [post]func (h *WeKnoraCloudHandler) SaveCredentials(c *gin.Context) {var req weKnoraCloudCredentialsRequestif err := c.ShouldBindJSON(&req); err != nil {@@ -41,6 +54,17 @@ func (h *WeKnoraCloudHandler) SaveCredentials(c *gin.Context) {// Status GET /api/v1/models/weknoracloud/status// 检查当前租户的 WeKnoraCloud 凭证是否完好,如需重新初始化则返回 needs_reinit=true+//+// Status godoc+// @Summary 检查 WeKnoraCloud 凭证状态+// @Description 检查当前租户的 WeKnoraCloud 凭证是否完好;needs_reinit=true 表示需要重新保存+// @Tags WeKnoraCloud+// @Produce json+// @Success 200 {object} map[string]interface{} "凭证状态"+// @Failure 500 {object} map[string]interface{} "服务器错误"+// @Security Bearer+// @Security ApiKeyAuth+// @Router /models/weknoracloud/status [get]func (h *WeKnoraCloudHandler) Status(c *gin.Context) {result, err := h.svc.CheckStatus(c.Request.Context())if err != nil {