diff --git a/docs/docs.go b/docs/docs.go index 72db5524..b728451a 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -2081,9 +2081,65 @@ const docTemplate = `{ } } }, + "/datasource/{id}/resource-ancestors": { + "post": { + "description": "Resolve the ancestor ExternalIDs that must be expanded to reveal the given (possibly deeply nested) resources in a lazily-loaded picker. Used to restore an existing selection when editing a data source.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "DataSource" + ], + "summary": "Resolve resource ancestors", + "parameters": [ + { + "type": "string", + "description": "Data source ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Resource IDs to resolve", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.resolveAncestorsRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, "/datasource/{id}/resources": { "get": { - "description": "List resources available for sync in the external system", + "description": "List resources available for sync in the external system. Pass parent_id to lazily load the direct children of a resource (used for large hierarchical sources such as Feishu wiki).", "produces": [ "application/json" ], @@ -2098,6 +2154,12 @@ const docTemplate = `{ "name": "id", "in": "path", "required": true + }, + { + "type": "string", + "description": "Parent resource ExternalID; empty lists the top level", + "name": "parent_id", + "in": "query" } ], "responses": { @@ -4667,8 +4729,8 @@ const docTemplate = `{ }, { "type": "string", - "description": "标签ID筛选", - "name": "tag_id", + "description": "标签ID筛选,逗号分隔(OR语义)", + "name": "tag_ids", "in": "query" }, { @@ -4830,6 +4892,12 @@ const docTemplate = `{ "name": "enable_multimodel", "in": "formData" }, + { + "type": "string", + "description": "分类ID列表,逗号分隔", + "name": "tag_ids", + "in": "formData" + }, { "type": "string", "description": "处理配置JSON(KnowledgeProcessOverrides)", @@ -4963,8 +5031,11 @@ const docTemplate = `{ "file_type": { "type": "string" }, - "tag_id": { - "type": "string" + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } }, "title": { "type": "string" @@ -5668,6 +5739,61 @@ const docTemplate = `{ } } }, + "/knowledge/batch-reparse": { + "post": { + "security": [ + { + "Bearer": [] + }, + { + "ApiKeyAuth": [] + } + ], + "description": "按 ID 列表批量重新解析单个知识库下的多个知识条目", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "知识管理" + ], + "summary": "批量重新解析知识", + "parameters": [ + { + "description": "批量重解析请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.batchReparseKnowledgeRequest" + } + } + ], + "responses": { + "200": { + "description": "任务已提交", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "403": { + "description": "权限不足", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, "/knowledge/image/{id}/{chunk_id}": { "put": { "security": [ @@ -5893,7 +6019,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "Search knowledge files by keyword. When agent_id is set (shared agent), scope is the agent's configured knowledge bases.", + "description": "Search knowledge files by keyword. Pass recent=true without a keyword to browse recent files. When agent_id is set (shared agent), scope is the agent's configured knowledge bases.", "consumes": [ "application/json" ], @@ -5934,6 +6060,12 @@ const docTemplate = `{ "description": "Shared agent ID (search within agent's KB scope)", "name": "agent_id", "in": "query" + }, + { + "type": "boolean", + "description": "Return recent files when keyword is empty", + "name": "recent", + "in": "query" } ], "responses": { @@ -7459,6 +7591,40 @@ const docTemplate = `{ } } }, + "/mcp-services/oauth/callback": { + "get": { + "description": "接收授权服务器回调并完成 code 交换,随后重定向回前端", + "tags": [ + "MCP服务" + ], + "summary": "MCP OAuth 回调", + "parameters": [ + { + "type": "string", + "description": "授权码", + "name": "code", + "in": "query" + }, + { + "type": "string", + "description": "状态参数", + "name": "state", + "in": "query" + }, + { + "type": "string", + "description": "授权错误码", + "name": "error", + "in": "query" + } + ], + "responses": { + "302": { + "description": "Found" + } + } + } + }, "/mcp-services/{id}": { "get": { "security": [ @@ -7721,6 +7887,126 @@ const docTemplate = `{ } } }, + "/mcp-services/{id}/oauth/authorize-url": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "对使用 OAuth 的 MCP 服务执行发现与动态客户端注册,返回浏览器应跳转的授权地址(当前用户维度)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "MCP服务" + ], + "summary": "发起 MCP OAuth 授权", + "parameters": [ + { + "type": "string", + "description": "MCP 服务 ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "{redirect_uri: string, frontend_redirect?: string}", + "name": "request", + "in": "body", + "required": true, + "schema": { + "type": "object", + "additionalProperties": true + } + } + ], + "responses": { + "200": { + "description": "{authorization_url: string}", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, + "/mcp-services/{id}/oauth/status": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "返回当前用户对指定 MCP 服务是否已完成 OAuth 授权", + "produces": [ + "application/json" + ], + "tags": [ + "MCP服务" + ], + "summary": "查询 MCP OAuth 授权状态", + "parameters": [ + { + "type": "string", + "description": "MCP 服务 ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{authorized: bool}", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/mcp-services/{id}/oauth/token": { + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除当前用户对指定 MCP 服务的 OAuth 令牌", + "produces": [ + "application/json" + ], + "tags": [ + "MCP服务" + ], + "summary": "撤销 MCP OAuth 授权", + "parameters": [ + { + "type": "string", + "description": "MCP 服务 ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content" + } + } + } + }, "/mcp-services/{id}/resources": { "get": { "security": [ @@ -14370,7 +14656,7 @@ const docTemplate = `{ "type": "integer" }, "replica_number": { - "description": "Milvus: in-memory replica count (LoadCollection)", + "description": "Milvus LoadCollection / Tencent VectorDB CreateCollection replicas", "type": "integer" }, "replication_factor": { @@ -14620,9 +14906,12 @@ const docTemplate = `{ "description": "Summary status for async summary generation", "type": "string" }, - "tag_id": { - "description": "Optional tag ID for categorization within a knowledge base", - "type": "string" + "tags": { + "description": "Tags holds the tags associated with this knowledge (populated on query, not persisted directly).", + "type": "array", + "items": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeTag" + } }, "tenant_id": { "description": "Tenant ID", @@ -14991,6 +15280,13 @@ const docTemplate = `{ "graph_enabled": { "type": "boolean" }, + "parser_engine_overrides": { + "description": "ParserEngineOverrides passes key-value configuration to docreader parsers\n(e.g. pdf_force_scanned=true). Merged with tenant-level overrides in the\nparse pipeline; per-upload values take priority on conflict.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "parser_engine_rules": { "type": "array", "items": { @@ -15005,6 +15301,47 @@ const docTemplate = `{ } } }, + "github_com_Tencent_WeKnora_internal_types.KnowledgeTag": { + "type": "object", + "properties": { + "color": { + "description": "Optional display color", + "type": "string" + }, + "created_at": { + "description": "Creation time", + "type": "string" + }, + "id": { + "description": "Unique identifier of the tag (UUID)", + "type": "string" + }, + "knowledge_base_id": { + "description": "Knowledge base ID that this tag belongs to", + "type": "string" + }, + "name": { + "description": "Tag name, unique within the same knowledge base", + "type": "string" + }, + "seq_id": { + "description": "SeqID is an auto-increment integer ID for external API usage", + "type": "integer" + }, + "sort_order": { + "description": "Sort order within the same knowledge base", + "type": "integer" + }, + "tenant_id": { + "description": "Tenant ID", + "type": "integer" + }, + "updated_at": { + "description": "Last updated time", + "type": "string" + } + } + }, "github_com_Tencent_WeKnora_internal_types.ListMembersResponse": { "type": "object", "properties": { @@ -15137,17 +15474,51 @@ const docTemplate = `{ "api_key": { "type": "string" }, + "auth_server_metadata_url": { + "description": "AuthServerMetadataURL optionally pins the OAuth authorization server\nmetadata URL. When empty, the server is discovered automatically from\nthe MCP URL (RFC 9728 / RFC 8414).", + "type": "string" + }, + "auth_type": { + "description": "AuthType selects the authentication strategy. Empty (\"\") is treated as\nnone for backward compatibility with rows that pre-date this field.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MCPAuthType" + } + ] + }, "custom_headers": { "type": "object", "additionalProperties": { "type": "string" } }, + "scopes": { + "description": "Scopes are the OAuth scopes requested during authorization. Optional.", + "type": "array", + "items": { + "type": "string" + } + }, "token": { "type": "string" } } }, + "github_com_Tencent_WeKnora_internal_types.MCPAuthType": { + "type": "string", + "enum": [ + "", + "api_key", + "bearer", + "oauth" + ], + "x-enum-varnames": [ + "MCPAuthNone", + "MCPAuthAPIKey", + "MCPAuthBearer", + "MCPAuthOAuth" + ] + }, "github_com_Tencent_WeKnora_internal_types.MCPEnvVars": { "type": "object", "additionalProperties": { @@ -15279,8 +15650,11 @@ const docTemplate = `{ "status": { "type": "string" }, - "tag_id": { - "type": "string" + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } }, "title": { "type": "string" @@ -19275,6 +19649,27 @@ const docTemplate = `{ } } }, + "internal_handler.batchReparseKnowledgeRequest": { + "type": "object", + "required": [ + "ids", + "kb_id" + ], + "properties": { + "ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "kb_id": { + "type": "string" + }, + "process_config": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeProcessOverrides" + } + } + }, "internal_handler.createInvitationRequest": { "type": "object", "required": [ @@ -19376,6 +19771,17 @@ const docTemplate = `{ } } }, + "internal_handler.resolveAncestorsRequest": { + "type": "object", + "properties": { + "resource_ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "internal_handler.updateLastFAQImportResultDisplayStatusRequest": { "type": "object", "required": [ diff --git a/docs/swagger.json b/docs/swagger.json index c881897e..5b656d99 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -2074,9 +2074,65 @@ } } }, + "/datasource/{id}/resource-ancestors": { + "post": { + "description": "Resolve the ancestor ExternalIDs that must be expanded to reveal the given (possibly deeply nested) resources in a lazily-loaded picker. Used to restore an existing selection when editing a data source.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "DataSource" + ], + "summary": "Resolve resource ancestors", + "parameters": [ + { + "type": "string", + "description": "Data source ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Resource IDs to resolve", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.resolveAncestorsRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, "/datasource/{id}/resources": { "get": { - "description": "List resources available for sync in the external system", + "description": "List resources available for sync in the external system. Pass parent_id to lazily load the direct children of a resource (used for large hierarchical sources such as Feishu wiki).", "produces": [ "application/json" ], @@ -2091,6 +2147,12 @@ "name": "id", "in": "path", "required": true + }, + { + "type": "string", + "description": "Parent resource ExternalID; empty lists the top level", + "name": "parent_id", + "in": "query" } ], "responses": { @@ -4660,8 +4722,8 @@ }, { "type": "string", - "description": "标签ID筛选", - "name": "tag_id", + "description": "标签ID筛选,逗号分隔(OR语义)", + "name": "tag_ids", "in": "query" }, { @@ -4823,6 +4885,12 @@ "name": "enable_multimodel", "in": "formData" }, + { + "type": "string", + "description": "分类ID列表,逗号分隔", + "name": "tag_ids", + "in": "formData" + }, { "type": "string", "description": "处理配置JSON(KnowledgeProcessOverrides)", @@ -4956,8 +5024,11 @@ "file_type": { "type": "string" }, - "tag_id": { - "type": "string" + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } }, "title": { "type": "string" @@ -5661,6 +5732,61 @@ } } }, + "/knowledge/batch-reparse": { + "post": { + "security": [ + { + "Bearer": [] + }, + { + "ApiKeyAuth": [] + } + ], + "description": "按 ID 列表批量重新解析单个知识库下的多个知识条目", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "知识管理" + ], + "summary": "批量重新解析知识", + "parameters": [ + { + "description": "批量重解析请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.batchReparseKnowledgeRequest" + } + } + ], + "responses": { + "200": { + "description": "任务已提交", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "403": { + "description": "权限不足", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, "/knowledge/image/{id}/{chunk_id}": { "put": { "security": [ @@ -5886,7 +6012,7 @@ "ApiKeyAuth": [] } ], - "description": "Search knowledge files by keyword. When agent_id is set (shared agent), scope is the agent's configured knowledge bases.", + "description": "Search knowledge files by keyword. Pass recent=true without a keyword to browse recent files. When agent_id is set (shared agent), scope is the agent's configured knowledge bases.", "consumes": [ "application/json" ], @@ -5927,6 +6053,12 @@ "description": "Shared agent ID (search within agent's KB scope)", "name": "agent_id", "in": "query" + }, + { + "type": "boolean", + "description": "Return recent files when keyword is empty", + "name": "recent", + "in": "query" } ], "responses": { @@ -7452,6 +7584,40 @@ } } }, + "/mcp-services/oauth/callback": { + "get": { + "description": "接收授权服务器回调并完成 code 交换,随后重定向回前端", + "tags": [ + "MCP服务" + ], + "summary": "MCP OAuth 回调", + "parameters": [ + { + "type": "string", + "description": "授权码", + "name": "code", + "in": "query" + }, + { + "type": "string", + "description": "状态参数", + "name": "state", + "in": "query" + }, + { + "type": "string", + "description": "授权错误码", + "name": "error", + "in": "query" + } + ], + "responses": { + "302": { + "description": "Found" + } + } + } + }, "/mcp-services/{id}": { "get": { "security": [ @@ -7714,6 +7880,126 @@ } } }, + "/mcp-services/{id}/oauth/authorize-url": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "对使用 OAuth 的 MCP 服务执行发现与动态客户端注册,返回浏览器应跳转的授权地址(当前用户维度)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "MCP服务" + ], + "summary": "发起 MCP OAuth 授权", + "parameters": [ + { + "type": "string", + "description": "MCP 服务 ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "{redirect_uri: string, frontend_redirect?: string}", + "name": "request", + "in": "body", + "required": true, + "schema": { + "type": "object", + "additionalProperties": true + } + } + ], + "responses": { + "200": { + "description": "{authorization_url: string}", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + } + } + }, + "/mcp-services/{id}/oauth/status": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "返回当前用户对指定 MCP 服务是否已完成 OAuth 授权", + "produces": [ + "application/json" + ], + "tags": [ + "MCP服务" + ], + "summary": "查询 MCP OAuth 授权状态", + "parameters": [ + { + "type": "string", + "description": "MCP 服务 ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{authorized: bool}", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/mcp-services/{id}/oauth/token": { + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除当前用户对指定 MCP 服务的 OAuth 令牌", + "produces": [ + "application/json" + ], + "tags": [ + "MCP服务" + ], + "summary": "撤销 MCP OAuth 授权", + "parameters": [ + { + "type": "string", + "description": "MCP 服务 ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content" + } + } + } + }, "/mcp-services/{id}/resources": { "get": { "security": [ @@ -14363,7 +14649,7 @@ "type": "integer" }, "replica_number": { - "description": "Milvus: in-memory replica count (LoadCollection)", + "description": "Milvus LoadCollection / Tencent VectorDB CreateCollection replicas", "type": "integer" }, "replication_factor": { @@ -14613,9 +14899,12 @@ "description": "Summary status for async summary generation", "type": "string" }, - "tag_id": { - "description": "Optional tag ID for categorization within a knowledge base", - "type": "string" + "tags": { + "description": "Tags holds the tags associated with this knowledge (populated on query, not persisted directly).", + "type": "array", + "items": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeTag" + } }, "tenant_id": { "description": "Tenant ID", @@ -14984,6 +15273,13 @@ "graph_enabled": { "type": "boolean" }, + "parser_engine_overrides": { + "description": "ParserEngineOverrides passes key-value configuration to docreader parsers\n(e.g. pdf_force_scanned=true). Merged with tenant-level overrides in the\nparse pipeline; per-upload values take priority on conflict.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "parser_engine_rules": { "type": "array", "items": { @@ -14998,6 +15294,47 @@ } } }, + "github_com_Tencent_WeKnora_internal_types.KnowledgeTag": { + "type": "object", + "properties": { + "color": { + "description": "Optional display color", + "type": "string" + }, + "created_at": { + "description": "Creation time", + "type": "string" + }, + "id": { + "description": "Unique identifier of the tag (UUID)", + "type": "string" + }, + "knowledge_base_id": { + "description": "Knowledge base ID that this tag belongs to", + "type": "string" + }, + "name": { + "description": "Tag name, unique within the same knowledge base", + "type": "string" + }, + "seq_id": { + "description": "SeqID is an auto-increment integer ID for external API usage", + "type": "integer" + }, + "sort_order": { + "description": "Sort order within the same knowledge base", + "type": "integer" + }, + "tenant_id": { + "description": "Tenant ID", + "type": "integer" + }, + "updated_at": { + "description": "Last updated time", + "type": "string" + } + } + }, "github_com_Tencent_WeKnora_internal_types.ListMembersResponse": { "type": "object", "properties": { @@ -15130,17 +15467,51 @@ "api_key": { "type": "string" }, + "auth_server_metadata_url": { + "description": "AuthServerMetadataURL optionally pins the OAuth authorization server\nmetadata URL. When empty, the server is discovered automatically from\nthe MCP URL (RFC 9728 / RFC 8414).", + "type": "string" + }, + "auth_type": { + "description": "AuthType selects the authentication strategy. Empty (\"\") is treated as\nnone for backward compatibility with rows that pre-date this field.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MCPAuthType" + } + ] + }, "custom_headers": { "type": "object", "additionalProperties": { "type": "string" } }, + "scopes": { + "description": "Scopes are the OAuth scopes requested during authorization. Optional.", + "type": "array", + "items": { + "type": "string" + } + }, "token": { "type": "string" } } }, + "github_com_Tencent_WeKnora_internal_types.MCPAuthType": { + "type": "string", + "enum": [ + "", + "api_key", + "bearer", + "oauth" + ], + "x-enum-varnames": [ + "MCPAuthNone", + "MCPAuthAPIKey", + "MCPAuthBearer", + "MCPAuthOAuth" + ] + }, "github_com_Tencent_WeKnora_internal_types.MCPEnvVars": { "type": "object", "additionalProperties": { @@ -15272,8 +15643,11 @@ "status": { "type": "string" }, - "tag_id": { - "type": "string" + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } }, "title": { "type": "string" @@ -19268,6 +19642,27 @@ } } }, + "internal_handler.batchReparseKnowledgeRequest": { + "type": "object", + "required": [ + "ids", + "kb_id" + ], + "properties": { + "ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "kb_id": { + "type": "string" + }, + "process_config": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeProcessOverrides" + } + } + }, "internal_handler.createInvitationRequest": { "type": "object", "required": [ @@ -19369,6 +19764,17 @@ } } }, + "internal_handler.resolveAncestorsRequest": { + "type": "object", + "properties": { + "resource_ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "internal_handler.updateLastFAQImportResultDisplayStatusRequest": { "type": "object", "required": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index d0258311..0b72877a 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1071,7 +1071,7 @@ definitions: description: ES, OpenSearch type: integer replica_number: - description: 'Milvus: in-memory replica count (LoadCollection)' + description: Milvus LoadCollection / Tencent VectorDB CreateCollection replicas type: integer replication_factor: description: 'Qdrant, Weaviate: number of replicas' @@ -1257,9 +1257,12 @@ definitions: summary_status: description: Summary status for async summary generation type: string - tag_id: - description: Optional tag ID for categorization within a knowledge base - type: string + tags: + description: Tags holds the tags associated with this knowledge (populated + on query, not persisted directly). + items: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeTag' + type: array tenant_id: description: Tenant ID type: integer @@ -1529,6 +1532,14 @@ definitions: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig' graph_enabled: type: boolean + parser_engine_overrides: + additionalProperties: + type: string + description: |- + ParserEngineOverrides passes key-value configuration to docreader parsers + (e.g. pdf_force_scanned=true). Merged with tenant-level overrides in the + parse pipeline; per-upload values take priority on conflict. + type: object parser_engine_rules: items: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ParserEngineRule' @@ -1538,6 +1549,36 @@ definitions: vlm_config: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig' type: object + github_com_Tencent_WeKnora_internal_types.KnowledgeTag: + properties: + color: + description: Optional display color + type: string + created_at: + description: Creation time + type: string + id: + description: Unique identifier of the tag (UUID) + type: string + knowledge_base_id: + description: Knowledge base ID that this tag belongs to + type: string + name: + description: Tag name, unique within the same knowledge base + type: string + seq_id: + description: SeqID is an auto-increment integer ID for external API usage + type: integer + sort_order: + description: Sort order within the same knowledge base + type: integer + tenant_id: + description: Tenant ID + type: integer + updated_at: + description: Last updated time + type: string + type: object github_com_Tencent_WeKnora_internal_types.ListMembersResponse: properties: members: @@ -1633,13 +1674,42 @@ definitions: properties: api_key: type: string + auth_server_metadata_url: + description: |- + AuthServerMetadataURL optionally pins the OAuth authorization server + metadata URL. When empty, the server is discovered automatically from + the MCP URL (RFC 9728 / RFC 8414). + type: string + auth_type: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.MCPAuthType' + description: |- + AuthType selects the authentication strategy. Empty ("") is treated as + none for backward compatibility with rows that pre-date this field. custom_headers: additionalProperties: type: string type: object + scopes: + description: Scopes are the OAuth scopes requested during authorization. Optional. + items: + type: string + type: array token: type: string type: object + github_com_Tencent_WeKnora_internal_types.MCPAuthType: + enum: + - "" + - api_key + - bearer + - oauth + type: string + x-enum-varnames: + - MCPAuthNone + - MCPAuthAPIKey + - MCPAuthBearer + - MCPAuthOAuth github_com_Tencent_WeKnora_internal_types.MCPEnvVars: additionalProperties: type: string @@ -1728,8 +1798,10 @@ definitions: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeProcessOverrides' status: type: string - tag_id: - type: string + tag_ids: + items: + type: string + type: array title: type: string type: object @@ -4685,6 +4757,20 @@ definitions: success: type: boolean type: object + internal_handler.batchReparseKnowledgeRequest: + properties: + ids: + items: + type: string + type: array + kb_id: + type: string + process_config: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeProcessOverrides' + required: + - ids + - kb_id + type: object internal_handler.createInvitationRequest: properties: email: @@ -4753,6 +4839,13 @@ definitions: - token - username type: object + internal_handler.resolveAncestorsRequest: + properties: + resource_ids: + items: + type: string + type: array + type: object internal_handler.updateLastFAQImportResultDisplayStatusRequest: properties: display_status: @@ -6209,15 +6302,60 @@ paths: summary: Pause data source tags: - DataSource - /datasource/{id}/resources: - get: - description: List resources available for sync in the external system + /datasource/{id}/resource-ancestors: + post: + consumes: + - application/json + description: Resolve the ancestor ExternalIDs that must be expanded to reveal + the given (possibly deeply nested) resources in a lazily-loaded picker. Used + to restore an existing selection when editing a data source. parameters: - description: Data source ID in: path name: id required: true type: string + - description: Resource IDs to resolve + in: body + name: request + required: true + schema: + $ref: '#/definitions/internal_handler.resolveAncestorsRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: + items: + type: string + type: array + type: object + "400": + description: Bad Request + schema: + additionalProperties: + type: string + type: object + summary: Resolve resource ancestors + tags: + - DataSource + /datasource/{id}/resources: + get: + description: List resources available for sync in the external system. Pass + parent_id to lazily load the direct children of a resource (used for large + hierarchical sources such as Feishu wiki). + parameters: + - description: Data source ID + in: path + name: id + required: true + type: string + - description: Parent resource ExternalID; empty lists the top level + in: query + name: parent_id + type: string produces: - application/json responses: @@ -7875,9 +8013,9 @@ paths: in: query name: page_size type: integer - - description: 标签ID筛选 + - description: 标签ID筛选,逗号分隔(OR语义) in: query - name: tag_id + name: tag_ids type: string - description: 关键词搜索 in: query @@ -7950,6 +8088,10 @@ paths: in: formData name: enable_multimodel type: boolean + - description: 分类ID列表,逗号分隔 + in: formData + name: tag_ids + type: string - description: 处理配置JSON(KnowledgeProcessOverrides) in: formData name: process_config @@ -8035,8 +8177,10 @@ paths: type: string file_type: type: string - tag_id: - type: string + tag_ids: + items: + type: string + type: array title: type: string url: @@ -8779,6 +8923,40 @@ paths: summary: 批量删除知识 tags: - 知识管理 + /knowledge/batch-reparse: + post: + consumes: + - application/json + description: 按 ID 列表批量重新解析单个知识库下的多个知识条目 + parameters: + - description: 批量重解析请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/internal_handler.batchReparseKnowledgeRequest' + produces: + - application/json + responses: + "200": + description: 任务已提交 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + "403": + description: 权限不足 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + security: + - Bearer: [] + - ApiKeyAuth: [] + summary: 批量重新解析知识 + tags: + - 知识管理 /knowledge/image/{id}/{chunk_id}: put: consumes: @@ -8916,8 +9094,9 @@ paths: get: consumes: - application/json - description: Search knowledge files by keyword. When agent_id is set (shared - agent), scope is the agent's configured knowledge bases. + description: Search knowledge files by keyword. Pass recent=true without a keyword + to browse recent files. When agent_id is set (shared agent), scope is the + agent's configured knowledge bases. parameters: - description: Keyword to search in: query @@ -8939,6 +9118,10 @@ paths: in: query name: agent_id type: string + - description: Return recent files when keyword is empty + in: query + name: recent + type: boolean produces: - application/json responses: @@ -9860,6 +10043,82 @@ paths: summary: 移除 MCP 服务的单个凭据字段 tags: - MCP服务 + /mcp-services/{id}/oauth/authorize-url: + post: + consumes: + - application/json + description: 对使用 OAuth 的 MCP 服务执行发现与动态客户端注册,返回浏览器应跳转的授权地址(当前用户维度) + parameters: + - description: MCP 服务 ID + in: path + name: id + required: true + type: string + - description: '{redirect_uri: string, frontend_redirect?: string}' + in: body + name: request + required: true + schema: + additionalProperties: true + type: object + produces: + - application/json + responses: + "200": + description: '{authorization_url: string}' + schema: + additionalProperties: true + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + security: + - Bearer: [] + summary: 发起 MCP OAuth 授权 + tags: + - MCP服务 + /mcp-services/{id}/oauth/status: + get: + description: 返回当前用户对指定 MCP 服务是否已完成 OAuth 授权 + parameters: + - description: MCP 服务 ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: '{authorized: bool}' + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 查询 MCP OAuth 授权状态 + tags: + - MCP服务 + /mcp-services/{id}/oauth/token: + delete: + description: 删除当前用户对指定 MCP 服务的 OAuth 令牌 + parameters: + - description: MCP 服务 ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "204": + description: No Content + security: + - Bearer: [] + summary: 撤销 MCP OAuth 授权 + tags: + - MCP服务 /mcp-services/{id}/resources: get: consumes: @@ -9992,6 +10251,28 @@ paths: summary: 获取MCP服务工具列表 tags: - MCP服务 + /mcp-services/oauth/callback: + get: + description: 接收授权服务器回调并完成 code 交换,随后重定向回前端 + parameters: + - description: 授权码 + in: query + name: code + type: string + - description: 状态参数 + in: query + name: state + type: string + - description: 授权错误码 + in: query + name: error + type: string + responses: + "302": + description: Found + summary: MCP OAuth 回调 + tags: + - MCP服务 /me/invitations: get: description: 返回当前登录用户的待接受邀请(默认仅 pending),用于头像入口和 /invitations 收件箱页。 diff --git a/frontend/src/composables/useTagChipsOverflow.ts b/frontend/src/composables/useTagChipsOverflow.ts new file mode 100644 index 00000000..453bc30d --- /dev/null +++ b/frontend/src/composables/useTagChipsOverflow.ts @@ -0,0 +1,70 @@ +import { onBeforeUnmount, reactive } from 'vue'; + +const TAG_EST_WIDTH = 82; +const TAG_OVERFLOW_MIN = 32; + +export function useTagChipsOverflow(datasetKey: 'tagItemId' | 'listTagItemId') { + const tagVisibleLimit = reactive>({}); + const tagItemTotalMap = new Map(); + const observedElements = new WeakSet(); + let tagChipsRO: ResizeObserver | null = null; + + const computeLimit = (width: number, total: number) => { + if (total <= 0) return 99; + const maxFit = Math.floor((width - TAG_OVERFLOW_MIN) / TAG_EST_WIDTH); + const limit = Math.max(1, Math.min(maxFit, total)); + return limit >= total ? 99 : limit; + }; + + const ensureObserver = () => { + if (tagChipsRO) return; + tagChipsRO = new ResizeObserver((entries) => { + for (const entry of entries) { + const target = entry.target as HTMLElement; + const id = target.dataset[datasetKey]; + if (!id) continue; + const total = tagItemTotalMap.get(id) ?? 0; + tagVisibleLimit[id] = computeLimit(entry.contentRect.width, total); + } + }); + }; + + function setupTagChipsObserver(el: Element | null, itemId: string, totalCount: number) { + if (!el) return; + const htmlEl = el as HTMLElement; + htmlEl.dataset[datasetKey] = itemId; + tagItemTotalMap.set(itemId, totalCount); + ensureObserver(); + if (!observedElements.has(htmlEl)) { + observedElements.add(htmlEl); + tagChipsRO!.observe(htmlEl); + } + requestAnimationFrame(() => { + tagVisibleLimit[itemId] = computeLimit(htmlEl.clientWidth, totalCount); + }); + } + + function getTagLimit(itemId: string): number { + return tagVisibleLimit[itemId] ?? 99; + } + + function hasTagOverflow(itemId: string, total: number): boolean { + return total > getTagLimit(itemId); + } + + function getOverflowCount(itemId: string, total: number): number { + return Math.max(0, total - getTagLimit(itemId)); + } + + onBeforeUnmount(() => { + tagChipsRO?.disconnect(); + tagChipsRO = null; + }); + + return { + setupTagChipsObserver, + getTagLimit, + hasTagOverflow, + getOverflowCount, + }; +} diff --git a/frontend/src/views/knowledge/components/DocumentListView.vue b/frontend/src/views/knowledge/components/DocumentListView.vue index a76b0a89..a89fb873 100644 --- a/frontend/src/views/knowledge/components/DocumentListView.vue +++ b/frontend/src/views/knowledge/components/DocumentListView.vue @@ -1,7 +1,8 @@