feat(ai-chat): 实现文档分片功能与SSE连接优化
- 新增文档分片相关API接口定义及请求方法 - 文档分片VO接口补充,调整项目ID等类型为字符串 - ai-chat视图中用新的带鉴权Header的SSE工具替换EventSource - SSE连接支持事件处理及错误处理完善,提供连接关闭回调 - 知识库视图中添加文档分片查看功能,包括分片列表与详情对话框 - 界面增加分片列表操作按钮及分页数据显示 - 路由枚举调整,修正 AI Chat 相关命名混淆 - 增加SSE连接工具函数chatSSE.ts,实现带鉴权Header的SSE连接管理
This commit is contained in:
184
src/api/AI知识库.openapi.json
Normal file
184
src/api/AI知识库.openapi.json
Normal file
@@ -0,0 +1,184 @@
|
||||
{
|
||||
"openapi": "3.0.1",
|
||||
"info": {
|
||||
"title": "默认模块",
|
||||
"description": "",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"tags": [],
|
||||
"paths": {
|
||||
"/api/v1/ai/kb/document/{docId}/chunks": {
|
||||
"get": {
|
||||
"summary": "获取文档分片列表",
|
||||
"deprecated": false,
|
||||
"description": "获取文档分片列表\n获取文档分片列表\n获取指定文档的所有分片信息",
|
||||
"tags": [],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "docId",
|
||||
"in": "path",
|
||||
"description": "文档UUID",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"description": "",
|
||||
"example": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"default": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/BaseResponseListDocumentChunkVO",
|
||||
"description": "分片列表"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": []
|
||||
}
|
||||
},
|
||||
"/api/v1/ai/kb/chunk/{chunkId}": {
|
||||
"get": {
|
||||
"summary": "获取分片详情",
|
||||
"deprecated": false,
|
||||
"description": "获取分片详情\n获取分片详情\n获取指定分片的详细信息",
|
||||
"tags": [],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "chunkId",
|
||||
"in": "path",
|
||||
"description": "分片ID",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"description": "",
|
||||
"example": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"default": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/BaseResponseDocumentChunkVO",
|
||||
"description": "分片详情"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"DocumentChunkVO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "分片ID"
|
||||
},
|
||||
"docId": {
|
||||
"type": "string",
|
||||
"description": "原始文档ID"
|
||||
},
|
||||
"content": {
|
||||
"type": "string",
|
||||
"description": "分片内容"
|
||||
},
|
||||
"chunkIndex": {
|
||||
"type": "integer",
|
||||
"description": "分片序号"
|
||||
},
|
||||
"chunkTotal": {
|
||||
"type": "integer",
|
||||
"description": "总分片数"
|
||||
},
|
||||
"title": {
|
||||
"type": "string",
|
||||
"description": "文档标题"
|
||||
},
|
||||
"docType": {
|
||||
"type": "string",
|
||||
"description": "文档类型"
|
||||
},
|
||||
"sourceType": {
|
||||
"type": "string",
|
||||
"description": "来源类型"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"description": "状态"
|
||||
}
|
||||
}
|
||||
},
|
||||
"BaseResponseListDocumentChunkVO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"description": ""
|
||||
},
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DocumentChunkVO",
|
||||
"description": "文档分片VO"
|
||||
},
|
||||
"description": ""
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"BaseResponseDocumentChunkVO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"description": ""
|
||||
},
|
||||
"data": {
|
||||
"$ref": "#/components/schemas/DocumentChunkVO",
|
||||
"description": ""
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"servers": [],
|
||||
"security": []
|
||||
}
|
||||
Reference in New Issue
Block a user