feat(api): 数据源统一列举与添加前校验
build / build (push) Failing after 16s

GET /source-catalog/available 四类同一形状(wiki/drive/doc/pp),类型差异只放在 content_type;
POST /source-catalog/validate 真读一次:文档表格校验可读、知识库钉盘校验账号仍可见,失败不让添加。
This commit is contained in:
hermes
2026-10-26 17:22:09 +08:00
parent b3992bfa0f
commit 017cbcb851
5 changed files with 423 additions and 2 deletions
+35
View File
@@ -1126,6 +1126,41 @@
}
}
},
"/api/v1/source-catalog/available": {
"get": {
"tags": ["Source catalog"],
"operationId": "listAvailableSources",
"summary": "列出可加入的数据源(wiki 知识库 / drive 钉盘 / doc 在线文档表格 / pp 资料中心);四类同一形状,类型差异只体现在 content_type",
"parameters": [
{"name": "type", "in": "query", "required": true, "schema": {"type": "string", "enum": ["wiki", "drive", "doc", "pp"]}},
{"name": "q", "in": "query", "schema": {"type": "string", "maxLength": 120}},
{"name": "limit", "in": "query", "schema": {"type": "integer", "minimum": 1, "maximum": 200, "default": 50}}
],
"responses": {
"200": {"$ref": "#/components/responses/Envelope"},
"400": {"$ref": "#/components/responses/BadRequest"},
"401": {"description": "需要登录"},
"500": {"$ref": "#/components/responses/InternalError"},
"503": {"description": "dws 未登录或缺少读权限"}
}
}
},
"/api/v1/source-catalog/validate": {
"post": {
"tags": ["Source catalog"],
"operationId": "validateSourceSelection",
"summary": "添加前真读一次:文档/表格校验可读、知识库与钉盘校验账号仍可见;读不到返回 503/409,不让进入下一步",
"requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "additionalProperties": false, "required": ["type", "refs"], "properties": {"type": {"type": "string", "enum": ["wiki", "drive", "doc", "pp"]}, "refs": {"type": "array", "minItems": 1, "maxItems": 50, "items": {"type": "string", "maxLength": 512}}}}}}},
"responses": {
"200": {"$ref": "#/components/responses/Envelope"},
"400": {"$ref": "#/components/responses/BadRequest"},
"401": {"description": "需要登录"},
"409": {"description": "账号已看不到所选来源"},
"500": {"$ref": "#/components/responses/InternalError"},
"503": {"description": "dws 不可用或文档不可读"}
}
}
},
"/api/v1/source-catalog/sources": {
"get": {
"tags": [