feat(aia): Complete AIA V2.0 with universal streaming capabilities
Major Changes: - Add StreamingService with OpenAI Compatible format - Upgrade Chat component V2 with Ant Design X integration - Implement AIA module with 12 intelligent agents - Update API routes to unified /api/v1 prefix - Update system documentation Backend (~1300 lines): - common/streaming: OpenAI Compatible adapter - modules/aia: 12 agents, conversation service, streaming integration - Update route versions (RVW, PKB to v1) Frontend (~3500 lines): - modules/aia: AgentHub + ChatWorkspace (100% prototype restoration) - shared/Chat: AIStreamChat, ThinkingBlock, useAIStream Hook - Update API endpoints to v1 Documentation: - AIA module status guide - Universal capabilities catalog - System overview updates - All module documentation sync Tested: Stream response verified, authentication working Status: AIA V2.0 core completed (85%)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# AIA V2.1 <20>𡒊垢 API 霈曇恣
|
||||
|
||||
> **<2A><>𧋦**嚗间2.1
|
||||
> **创建日期**:2026-01-11
|
||||
> **基础路径**:`/api/v2/aia`
|
||||
> **<EFBFBD>𥕦遣<EFBFBD>交<EFBFBD>**嚗?026-01-11
|
||||
> **<EFBFBD>箇<EFBFBD>頝臬<EFBFBD>**嚗䫤/api/v1/aia`
|
||||
|
||||
---
|
||||
|
||||
@@ -10,23 +10,23 @@
|
||||
|
||||
| <20>寞<EFBFBD> | 頝臬<E9A09D> | <20>讛膩 | 霈方<E99C88> |
|
||||
|------|------|------|------|
|
||||
| GET | `/agents` | 获取智能体列表 | ✅ |
|
||||
| GET | `/agents/:id` | 获取智能体详情 | ✅ |
|
||||
| POST | `/intent/route` | 意图路由 | ✅ |
|
||||
| GET | `/conversations` | 获取对话列表 | ✅ |
|
||||
| POST | `/conversations` | 创建对话 | ✅ |
|
||||
| GET | `/conversations/:id` | 获取对话详情 | ✅ |
|
||||
| DELETE | `/conversations/:id` | 删除对话 | ✅ |
|
||||
| POST | `/conversations/:id/messages/stream` | 发送消息(流式) | ✅ |
|
||||
| POST | `/conversations/:id/attachments` | 上传附件 | ✅ |
|
||||
| GET | `/projects` | 获取项目列表 | ✅ |
|
||||
| GET | `/projects/:id` | 获取项目详情 | ✅ |
|
||||
| GET | `/agents` | <EFBFBD>瑕<EFBFBD><EFBFBD>箄<EFBFBD>雿枏<EFBFBD>銵?| <20>?|
|
||||
| GET | `/agents/:id` | <EFBFBD>瑕<EFBFBD><EFBFBD>箄<EFBFBD>雿栞祕<EFBFBD>?| <20>?|
|
||||
| POST | `/intent/route` | <EFBFBD>誩㦛頝舐眏 | <EFBFBD>?|
|
||||
| GET | `/conversations` | <EFBFBD>瑕<EFBFBD>撖寡<EFBFBD><EFBFBD>𡑒” | <EFBFBD>?|
|
||||
| POST | `/conversations` | <EFBFBD>𥕦遣撖寡<EFBFBD> | <EFBFBD>?|
|
||||
| GET | `/conversations/:id` | <EFBFBD>瑕<EFBFBD>撖寡<EFBFBD>霂行<EFBFBD> | <EFBFBD>?|
|
||||
| DELETE | `/conversations/:id` | <EFBFBD>𣳇膄撖寡<EFBFBD> | <EFBFBD>?|
|
||||
| POST | `/conversations/:id/messages/stream` | <EFBFBD>煾<EFBFBD><EFBFBD><EFBFBD><EFBFBD>荔<EFBFBD>瘚<EFBFBD><EFBFBD>嚗?| <20>?|
|
||||
| POST | `/conversations/:id/attachments` | 銝𠹺<EFBFBD><EFBFBD><EFBFBD>辣 | <EFBFBD>?|
|
||||
| GET | `/projects` | <EFBFBD>瑕<EFBFBD>憿寧𤌍<EFBFBD>𡑒” | <EFBFBD>?|
|
||||
| GET | `/projects/:id` | <EFBFBD>瑕<EFBFBD>憿寧𤌍霂行<EFBFBD> | <EFBFBD>?|
|
||||
|
||||
---
|
||||
|
||||
## <20><> 霈方<E99C88>
|
||||
|
||||
所有 API 需要在请求头中携带 JWT Token:
|
||||
<EFBFBD><EFBFBD><EFBFBD>?API <20><>閬<EFBFBD>銁霂瑟<E99C82>憭港葉<E6B8AF>箏蒂 JWT Token嚗?
|
||||
|
||||
```
|
||||
Authorization: Bearer <token>
|
||||
@@ -36,21 +36,21 @@ Authorization: Bearer <token>
|
||||
|
||||
## <20><> API 霂衣<E99C82>摰帋<E691B0>
|
||||
|
||||
### 1. 智能体相关
|
||||
### 1. <EFBFBD>箄<EFBFBD>雿梶㮾<EFBFBD>?
|
||||
|
||||
#### 1.1 获取智能体列表
|
||||
#### 1.1 <EFBFBD>瑕<EFBFBD><EFBFBD>箄<EFBFBD>雿枏<EFBFBD>銵?
|
||||
|
||||
```http
|
||||
GET /api/v2/aia/agents
|
||||
GET /api/v1/aia/agents
|
||||
```
|
||||
|
||||
**查询参数**:
|
||||
**<EFBFBD>亥砭<EFBFBD><EFBFBD>㺭**嚗?
|
||||
|
||||
| <20><>㺭 | 蝐餃<E89D90> | 敹<>‵ | <20>讛膩 |
|
||||
|------|------|------|------|
|
||||
| stage | string | 否 | 筛选阶段:`design`, `data`, `analysis`, `write`, `publish` |
|
||||
| stage | string | <EFBFBD>?| 蝑偦<E89D91>厰𧫴畾蛛<E795BE>`design`, `data`, `analysis`, `write`, `publish` |
|
||||
|
||||
**响应**:
|
||||
**<EFBFBD>滚<EFBFBD>**嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -59,7 +59,7 @@ GET /api/v2/aia/agents
|
||||
"agents": [
|
||||
{
|
||||
"id": "research-design",
|
||||
"name": "科研设计小助手",
|
||||
"name": "蝘𤑳<EFBFBD>霈曇恣撠誩𨭌<EFBFBD>?,
|
||||
"description": "撣桀𨭌<EFBFBD>典<EFBFBD><EFBFBD>鞟<EFBFBD>蝛嗆䲮獢<EFBFBD>挽霈~<EFBFBD><EFBFBD><EFBFBD><EFBFBD>格<EFBFBD>蝝U<EFBFBD><EFBFBD>䲮瘜訫郎<EFBFBD><EFBFBD>紡",
|
||||
"icon": "<EFBFBD>𥈡",
|
||||
"stage": "design",
|
||||
@@ -70,7 +70,7 @@ GET /api/v2/aia/agents
|
||||
{
|
||||
"id": "dc-tool",
|
||||
"name": "<EFBFBD>唳旿<EFBFBD><EFBFBD><EFBFBD>撌亙<EFBFBD>",
|
||||
"description": "跳转到数据采集模块",
|
||||
"description": "頝唾蓮<EFBFBD>唳㺭<EFBFBD>桅<EFBFBD><EFBFBD><EFBFBD>芋<EFBFBD>?,
|
||||
"icon": "<22><>",
|
||||
"stage": "data",
|
||||
"color": "#8B5CF6",
|
||||
@@ -82,20 +82,20 @@ GET /api/v2/aia/agents
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.2 获取智能体详情
|
||||
#### 1.2 <EFBFBD>瑕<EFBFBD><EFBFBD>箄<EFBFBD>雿栞祕<EFBFBD>?
|
||||
|
||||
```http
|
||||
GET /api/v2/aia/agents/:id
|
||||
GET /api/v1/aia/agents/:id
|
||||
```
|
||||
|
||||
**响应**:
|
||||
**<EFBFBD>滚<EFBFBD>**嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 0,
|
||||
"data": {
|
||||
"id": "research-design",
|
||||
"name": "科研设计小助手",
|
||||
"name": "蝘𤑳<EFBFBD>霈曇恣撠誩𨭌<EFBFBD>?,
|
||||
"description": "撣桀𨭌<EFBFBD>典<EFBFBD><EFBFBD>鞟<EFBFBD>蝛嗆䲮獢<EFBFBD>挽霈~<EFBFBD><EFBFBD><EFBFBD><EFBFBD>格<EFBFBD>蝝U<EFBFBD><EFBFBD>䲮瘜訫郎<EFBFBD><EFBFBD>紡",
|
||||
"icon": "<EFBFBD>𥈡",
|
||||
"stage": "design",
|
||||
@@ -104,7 +104,7 @@ GET /api/v2/aia/agents/:id
|
||||
"systemPrompt": "雿䭾糓銝<EFBFBD>銝芯<EFBFBD>銝𡁶<EFBFBD><EFBFBD>餃郎蝘𤑳<EFBFBD>霈曇恣銝枏振...",
|
||||
"welcomeMessage": "<EFBFBD>典末嚗<EFBFBD><EFBFBD><EFBFBD>舐<EFBFBD><EFBFBD>磰挽霈∪<EFBFBD><EFBFBD>拇<EFBFBD>嚗峕<EFBFBD><EFBFBD>臭誑撣格<EFBFBD>嚗䨵n- 霈曇恣<EFBFBD>𠉛弦<EFBFBD>寞<EFBFBD>\n- 璉<EFBFBD>蝝Y㮾<EFBFBD>單<EFBFBD><EFBFBD>娉n- <EFBFBD><EFBFBD>紡<EFBFBD>𠉛弦<EFBFBD>寞<EFBFBD>",
|
||||
"suggestedQuestions": [
|
||||
"如何设计一个RCT研究?",
|
||||
"憒<EFBFBD><EFBFBD>霈曇恣銝<EFBFBD>銝析CT<EFBFBD>𠉛弦嚗?,
|
||||
"撣格<E692A3>璉<EFBFBD>蝝Z<E89D9D>5撟渡<E6929F>撠輻<E692A0><E8BCBB>𠉛弦<F0A0899B><E5BCA6>讃",
|
||||
"隞<>銋<EFBFBD><E98A8B><EFBFBD>萎<EFBFBD>雿輻鍂<E8BCBB>曉<EFBFBD><E69B89>扯<EFBFBD><E689AF><EFBFBD>龪<EFBFBD>㵪<EFBFBD>"
|
||||
]
|
||||
@@ -119,27 +119,27 @@ GET /api/v2/aia/agents/:id
|
||||
#### 2.1 <20>箄<EFBFBD><E7AE84>誩㦛霂<E3A69B><E99C82>
|
||||
|
||||
```http
|
||||
POST /api/v2/aia/intent/route
|
||||
POST /api/v1/aia/intent/route
|
||||
```
|
||||
|
||||
**请求体**:
|
||||
**霂瑟<EFBFBD>雿?*嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
"query": "帮我分析一下这份数据"
|
||||
"query": "撣格<EFBFBD><EFBFBD><EFBFBD><EFBFBD>銝<EFBFBD>銝贝<EFBFBD>隞賣㺭<EFBFBD>?
|
||||
}
|
||||
```
|
||||
|
||||
**响应**:
|
||||
**<EFBFBD>滚<EFBFBD>**嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 0,
|
||||
"data": {
|
||||
"agentId": "data-analysis",
|
||||
"agentName": "统计分析小助手",
|
||||
"agentName": "蝏蠘恣<EFBFBD><EFBFBD><EFBFBD>撠誩𨭌<EFBFBD>?,
|
||||
"confidence": 0.92,
|
||||
"prefillPrompt": "请帮我分析这份数据,包括描述性统计和相关性分析"
|
||||
"prefillPrompt": "霂瑕葬<EFBFBD>穃<EFBFBD><EFBFBD>鞱<EFBFBD>隞賣㺭<EFBFBD>殷<EFBFBD><EFBFBD><EFBFBD>𡠺<EFBFBD>讛膩<EFBFBD>抒<EFBFBD>霈∪<EFBFBD><EFBFBD>詨<EFBFBD><EFBFBD>批<EFBFBD><EFBFBD>?
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -151,19 +151,19 @@ POST /api/v2/aia/intent/route
|
||||
#### 3.1 <20>瑕<EFBFBD>撖寡<E69296><E5AFA1>𡑒”
|
||||
|
||||
```http
|
||||
GET /api/v2/aia/conversations
|
||||
GET /api/v1/aia/conversations
|
||||
```
|
||||
|
||||
**查询参数**:
|
||||
**<EFBFBD>亥砭<EFBFBD><EFBFBD>㺭**嚗?
|
||||
|
||||
| <20><>㺭 | 蝐餃<E89D90> | 敹<>‵ | <20>讛膩 |
|
||||
|------|------|------|------|
|
||||
| agentId | string | 否 | 按智能体筛选 |
|
||||
| projectId | string | 否 | 按项目筛选(NULL 表示通用对话) |
|
||||
| page | number | 否 | 页码,默认 1 |
|
||||
| pageSize | number | 否 | 每页数量,默认 20 |
|
||||
| agentId | string | <EFBFBD>?| <20>㗇惣<E39787>賭<EFBFBD>蝑偦<E89D91>?|
|
||||
| projectId | string | <EFBFBD>?| <20>厰★<E58EB0>桃<EFBFBD><E6A183>㚁<EFBFBD>NULL 銵函內<E587BD>𡁶鍂撖寡<E69296>嚗?|
|
||||
| page | number | <EFBFBD>?| 憿萇<E686BF>嚗屸<E59A97>霈?1 |
|
||||
| pageSize | number | <EFBFBD>?| 瘥誯△<E8AAAF>圈<EFBFBD>嚗屸<E59A97>霈?20 |
|
||||
|
||||
**响应**:
|
||||
**<EFBFBD>滚<EFBFBD>**嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -174,10 +174,10 @@ GET /api/v2/aia/conversations
|
||||
"id": "conv-001",
|
||||
"title": "RCT<43>𠉛弦霈曇恣<E69B87>刻砭",
|
||||
"agentId": "research-design",
|
||||
"agentName": "科研设计小助手",
|
||||
"agentName": "蝘𤑳<EFBFBD>霈曇恣撠誩𨭌<EFBFBD>?,
|
||||
"projectId": null,
|
||||
"messageCount": 12,
|
||||
"lastMessage": "好的,我来帮您设计研究方案...",
|
||||
"lastMessage": "憟賜<EFBFBD>嚗峕<EFBFBD><EFBFBD>亙葬<EFBFBD>刻挽霈∠<EFBFBD>蝛嗆䲮獢?..",
|
||||
"createdAt": "2026-01-11T10:00:00Z",
|
||||
"updatedAt": "2026-01-11T12:30:00Z"
|
||||
}
|
||||
@@ -195,27 +195,27 @@ GET /api/v2/aia/conversations
|
||||
#### 3.2 <20>𥕦遣撖寡<E69296>
|
||||
|
||||
```http
|
||||
POST /api/v2/aia/conversations
|
||||
POST /api/v1/aia/conversations
|
||||
```
|
||||
|
||||
**请求体**:
|
||||
**霂瑟<EFBFBD>雿?*嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
"agentId": "research-design",
|
||||
"projectId": null,
|
||||
"title": "新对话"
|
||||
"title": "<EFBFBD>啣笆霂?
|
||||
}
|
||||
```
|
||||
|
||||
**响应**:
|
||||
**<EFBFBD>滚<EFBFBD>**嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 0,
|
||||
"data": {
|
||||
"id": "conv-002",
|
||||
"title": "新对话",
|
||||
"title": "<EFBFBD>啣笆霂?,
|
||||
"agentId": "research-design",
|
||||
"projectId": null,
|
||||
"createdAt": "2026-01-11T14:00:00Z"
|
||||
@@ -223,19 +223,19 @@ POST /api/v2/aia/conversations
|
||||
}
|
||||
```
|
||||
|
||||
#### 3.3 获取对话详情(含历史消息)
|
||||
#### 3.3 <EFBFBD>瑕<EFBFBD>撖寡<EFBFBD>霂行<EFBFBD>嚗<EFBFBD>鉄<EFBFBD><EFBFBD>蟮瘨<EFBFBD><EFBFBD>嚗?
|
||||
|
||||
```http
|
||||
GET /api/v2/aia/conversations/:id
|
||||
GET /api/v1/aia/conversations/:id
|
||||
```
|
||||
|
||||
**查询参数**:
|
||||
**<EFBFBD>亥砭<EFBFBD><EFBFBD>㺭**嚗?
|
||||
|
||||
| <20><>㺭 | 蝐餃<E89D90> | 敹<>‵ | <20>讛膩 |
|
||||
|------|------|------|------|
|
||||
| limit | number | 否 | 获取最近N条消息,默认 50 |
|
||||
| limit | number | <EFBFBD>?| <20>瑕<EFBFBD><E79195><EFBFBD>餈𤨩<E9A488>⊥<EFBFBD><E28AA5>荔<EFBFBD>暺䁅恕 50 |
|
||||
|
||||
**响应**:
|
||||
**<EFBFBD>滚<EFBFBD>**嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -244,7 +244,7 @@ GET /api/v2/aia/conversations/:id
|
||||
"id": "conv-001",
|
||||
"title": "RCT<43>𠉛弦霈曇恣<E69B87>刻砭",
|
||||
"agentId": "research-design",
|
||||
"agentName": "科研设计小助手",
|
||||
"agentName": "蝘𤑳<EFBFBD>霈曇恣撠誩𨭌<EFBFBD>?,
|
||||
"projectId": null,
|
||||
"createdAt": "2026-01-11T10:00:00Z",
|
||||
"updatedAt": "2026-01-11T12:30:00Z",
|
||||
@@ -260,7 +260,7 @@ GET /api/v2/aia/conversations/:id
|
||||
"id": "msg-002",
|
||||
"role": "assistant",
|
||||
"content": "憟賜<EFBFBD>嚗峕<EFBFBD><EFBFBD>亙葬<EFBFBD>刻挽霈∩<EFBFBD>銝芰<EFBFBD>撠輻<EFBFBD>RCT<EFBFBD>𠉛弦<EFBFBD>寞<EFBFBD>...",
|
||||
"thinkingContent": "用户想设计RCT研究,需要考虑:1)研究目的 2)入排标准 3)样本量 4)随机化方法 5)盲法 6)结局指标...",
|
||||
"thinkingContent": "<EFBFBD>冽<EFBFBD><EFBFBD>唾挽霈﹕CT<EFBFBD>𠉛弦嚗屸<EFBFBD>閬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>嚗?嚗厩<EFBFBD>蝛嗥𤌍<EFBFBD>?2嚗匧<EFBFBD><EFBFBD>埝<EFBFBD><EFBFBD>?3嚗㗇甅<EFBFBD>祇<EFBFBD> 4嚗厰<EFBFBD><EFBFBD>箏<EFBFBD><EFBFBD>寞<EFBFBD> 5嚗厩𤩅瘜?6嚗厩<EFBFBD>撅<EFBFBD><EFBFBD><EFBFBD><EFBFBD>...",
|
||||
"model": "deepseek-v3",
|
||||
"tokens": 1250,
|
||||
"createdAt": "2026-01-11T10:00:30Z"
|
||||
@@ -273,10 +273,10 @@ GET /api/v2/aia/conversations/:id
|
||||
#### 3.4 <20>𣳇膄撖寡<E69296>
|
||||
|
||||
```http
|
||||
DELETE /api/v2/aia/conversations/:id
|
||||
DELETE /api/v1/aia/conversations/:id
|
||||
```
|
||||
|
||||
**响应**:
|
||||
**<EFBFBD>滚<EFBFBD>**嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -289,22 +289,22 @@ DELETE /api/v2/aia/conversations/:id
|
||||
|
||||
---
|
||||
|
||||
### 4. 消息发送(流式)
|
||||
### 4. 瘨<EFBFBD><EFBFBD><EFBFBD>煾<EFBFBD><EFBFBD><EFBFBD>瘚<EFBFBD><EFBFBD>嚗?
|
||||
|
||||
#### 4.1 <20>煾<EFBFBD><E785BE><EFBFBD><EFBFBD>臬僎<E887AC>瑕<EFBFBD>瘚<EFBFBD><E7989A><EFBFBD>滚<EFBFBD>
|
||||
|
||||
```http
|
||||
POST /api/v2/aia/conversations/:id/messages/stream
|
||||
POST /api/v1/aia/conversations/:id/messages/stream
|
||||
```
|
||||
|
||||
**请求头**:
|
||||
**霂瑟<EFBFBD>憭?*嚗?
|
||||
|
||||
```
|
||||
Content-Type: application/json
|
||||
Accept: text/event-stream
|
||||
```
|
||||
|
||||
**请求体**:
|
||||
**霂瑟<EFBFBD>雿?*嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -314,17 +314,17 @@ Accept: text/event-stream
|
||||
}
|
||||
```
|
||||
|
||||
**响应(SSE 格式)**:
|
||||
**<EFBFBD>滚<EFBFBD>嚗𠄎SE <20>澆<EFBFBD>嚗?*嚗?
|
||||
|
||||
```
|
||||
event: thinking_start
|
||||
data: {}
|
||||
|
||||
event: thinking_delta
|
||||
data: {"content": "用户上传了数据文件,需要"}
|
||||
data: {"content": "<EFBFBD>冽<EFBFBD>銝𠹺<EFBFBD>鈭<EFBFBD>㺭<EFBFBD>格<EFBFBD>隞塚<EFBFBD><EFBFBD><EFBFBD>閬?}
|
||||
|
||||
event: thinking_delta
|
||||
data: {"content": "进行描述性统计分析..."}
|
||||
data: {"content": "餈𥡝<EFBFBD><EFBFBD>讛膩<EFBFBD>抒<EFBFBD>霈∪<EFBFBD><EFBFBD>?.."}
|
||||
|
||||
event: thinking_end
|
||||
data: {"duration": 3200}
|
||||
@@ -333,7 +333,7 @@ event: message_start
|
||||
data: {"id": "msg-003"}
|
||||
|
||||
event: delta
|
||||
data: {"content": "根据您上传的数据,"}
|
||||
data: {"content": "<EFBFBD>寞旿<EFBFBD>其<EFBFBD>隡删<EFBFBD><EFBFBD>唳旿嚗?}
|
||||
|
||||
event: delta
|
||||
data: {"content": "<22>烐䔉銝箸<E98A9D>餈𥡝<E9A488><F0A5A19D><EFBFBD><EFBFBD>..."}
|
||||
@@ -345,18 +345,18 @@ event: done
|
||||
data: {}
|
||||
```
|
||||
|
||||
**SSE 事件类型**:
|
||||
**SSE 鈭衤辣蝐餃<EFBFBD>**嚗?
|
||||
|
||||
| 鈭衤辣 | <20>讛膩 | <20>唳旿<E594B3>澆<EFBFBD> |
|
||||
|------|------|---------|
|
||||
| `thinking_start` | 开始深度思考 | `{}` |
|
||||
| `thinking_delta` | 思考内容片段 | `{"content": "..."}` |
|
||||
| `thinking_end` | 思考结束 | `{"duration": number}` |
|
||||
| `message_start` | 开始生成回复 | `{"id": "..."}` |
|
||||
| `thinking_start` | 撘<EFBFBD>憪𧢲楛摨行<EFBFBD>肽<EFBFBD>?| `{}` |
|
||||
| `thinking_delta` | <EFBFBD>肽<EFBFBD><EFBFBD><EFBFBD>摰寧<EFBFBD>畾?| `{"content": "..."}` |
|
||||
| `thinking_end` | <EFBFBD>肽<EFBFBD><EFBFBD><EFBFBD><EFBFBD>?| `{"duration": number}` |
|
||||
| `message_start` | 撘<EFBFBD>憪讠<EFBFBD><EFBFBD>𣂼<EFBFBD>憭?| `{"id": "..."}` |
|
||||
| `delta` | <20>𧼮<EFBFBD><F0A7BCAE><EFBFBD>捆<EFBFBD><E68D86>挾 | `{"content": "..."}` |
|
||||
| `message_end` | <20>𧼮<EFBFBD>蝏𤘪<E89D8F> | `{"id": "...", "tokens": number, "model": "..."}` |
|
||||
| `error` | <20>𤑳<EFBFBD><F0A491B3>躰秤 | `{"code": "...", "message": "..."}` |
|
||||
| `done` | 流结束 | `{}` |
|
||||
| `done` | 瘚<EFBFBD><EFBFBD><EFBFBD>?| `{}` |
|
||||
|
||||
---
|
||||
|
||||
@@ -365,22 +365,22 @@ data: {}
|
||||
#### 5.1 銝𠹺<E98A9D><F0A0B9BA><EFBFBD>辣
|
||||
|
||||
```http
|
||||
POST /api/v2/aia/conversations/:id/attachments
|
||||
POST /api/v1/aia/conversations/:id/attachments
|
||||
```
|
||||
|
||||
**请求头**:
|
||||
**霂瑟<EFBFBD>憭?*嚗?
|
||||
|
||||
```
|
||||
Content-Type: multipart/form-data
|
||||
```
|
||||
|
||||
**请求体(FormData)**:
|
||||
**霂瑟<EFBFBD>雿橒<EFBFBD>FormData嚗?*嚗?
|
||||
|
||||
| 摮埈挾 | 蝐餃<E89D90> | 敹<>‵ | <20>讛膩 |
|
||||
|------|------|------|------|
|
||||
| file | File | 是 | 文件(PDF/Word/TXT/Excel,最大20MB) |
|
||||
| file | File | <EFBFBD>?| <20><>辣嚗㇊DF/Word/TXT/Excel嚗峕<EFBFBD>憭?0MB嚗?|
|
||||
|
||||
**响应**:
|
||||
**<EFBFBD>滚<EFBFBD>**嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -399,13 +399,13 @@ Content-Type: multipart/form-data
|
||||
}
|
||||
```
|
||||
|
||||
**错误码**:
|
||||
**<EFBFBD>躰秤<EFBFBD>?*嚗?
|
||||
|
||||
| 错误码 | 描述 |
|
||||
| <EFBFBD>躰秤<EFBFBD>?| <20>讛膩 |
|
||||
|--------|------|
|
||||
| `ATTACHMENT_TOO_LARGE` | <20><>辣頞<E8BEA3><E9A09E> 20MB |
|
||||
| `ATTACHMENT_TYPE_NOT_SUPPORTED` | 銝齿𣈲<E9BDBF><F0A388B2><EFBFBD><EFBFBD><EFBFBD>辣蝐餃<E89D90> |
|
||||
| `ATTACHMENT_LIMIT_EXCEEDED` | 附件数量超过上限(5个) |
|
||||
| `ATTACHMENT_LIMIT_EXCEEDED` | <EFBFBD><EFBFBD>辣<EFBFBD>圈<EFBFBD>頞<EFBFBD><EFBFBD>銝𢠃<EFBFBD>嚗?銝迎<E98A9D> |
|
||||
| `TEXT_EXTRACTION_FAILED` | <20><>𧋦<EFBFBD>𣂼<EFBFBD>憭梯揖 |
|
||||
|
||||
---
|
||||
@@ -415,10 +415,10 @@ Content-Type: multipart/form-data
|
||||
#### 6.1 <20>瑕<EFBFBD>憿寧𤌍<E5AFA7>𡑒”
|
||||
|
||||
```http
|
||||
GET /api/v2/aia/projects
|
||||
GET /api/v1/aia/projects
|
||||
```
|
||||
|
||||
**响应**:
|
||||
**<EFBFBD>滚<EFBFBD>**嚗?
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -427,8 +427,8 @@ GET /api/v2/aia/projects
|
||||
"projects": [
|
||||
{
|
||||
"id": "proj-001",
|
||||
"name": "糖尿病研究项目",
|
||||
"description": "2型糖尿病患者生活方式干预研究",
|
||||
"name": "蝟硋倏<EFBFBD><EFBFBD><EFBFBD>蝛園★<EFBFBD>?,
|
||||
"description": "2<EFBFBD>讠<EFBFBD>撠輻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>瘣餅䲮撘誩僕憸<EFBFBD><EFBFBD>蝛?,
|
||||
"conversationCount": 5,
|
||||
"createdAt": "2026-01-01T10:00:00Z",
|
||||
"updatedAt": "2026-01-11T12:00:00Z"
|
||||
@@ -449,20 +449,20 @@ GET /api/v2/aia/projects
|
||||
"code": -1,
|
||||
"error": {
|
||||
"code": "CONVERSATION_NOT_FOUND",
|
||||
"message": "对话不存在"
|
||||
"message": "撖寡<EFBFBD>銝滚<EFBFBD><EFBFBD>?
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 通用错误码
|
||||
### <EFBFBD>𡁶鍂<EFBFBD>躰秤<EFBFBD>?
|
||||
|
||||
| 错误码 | HTTP 状态码 | 描述 |
|
||||
| <EFBFBD>躰秤<EFBFBD>?| HTTP <EFBFBD>嗆<EFBFBD><EFBFBD><EFBFBD> | <20>讛膩 |
|
||||
|--------|------------|------|
|
||||
| `UNAUTHORIZED` | 401 | 未授权 |
|
||||
| `FORBIDDEN` | 403 | 无权限 |
|
||||
| `NOT_FOUND` | 404 | 资源不存在 |
|
||||
| `UNAUTHORIZED` | 401 | <EFBFBD>芣<EFBFBD><EFBFBD>?|
|
||||
| `FORBIDDEN` | 403 | <EFBFBD>䭾<EFBFBD><EFBFBD>?|
|
||||
| `NOT_FOUND` | 404 | 韏<EFBFBD><EFBFBD>銝滚<EFBFBD><EFBFBD>?|
|
||||
| `VALIDATION_ERROR` | 400 | <20><>㺭撉諹<E69289>憭梯揖 |
|
||||
| `INTERNAL_ERROR` | 500 | 服务器内部错误 |
|
||||
| `INTERNAL_ERROR` | 500 | <EFBFBD>滚𦛚<EFBFBD>典<EFBFBD><EFBFBD>券<EFBFBD>霂?|
|
||||
| `LLM_ERROR` | 500 | LLM 靚<>鍂憭梯揖 |
|
||||
| `RATE_LIMITED` | 429 | 霂瑟<E99C82>餈<EFBFBD><E9A488>憸𤑳<E686B8> |
|
||||
|
||||
@@ -475,13 +475,13 @@ GET /api/v2/aia/projects
|
||||
```typescript
|
||||
interface Attachment {
|
||||
id: string; // <20><>辣ID
|
||||
filename: string; // 原始文件名
|
||||
filename: string; // <EFBFBD>笔<EFBFBD><EFBFBD><EFBFBD>辣<EFBFBD>?
|
||||
mimeType: string; // MIME 蝐餃<E89D90>
|
||||
size: number; // <20><>辣憭批<E686AD>嚗<EFBFBD><E59A97><EFBFBD><EFBFBD><EFBFBD>
|
||||
ossUrl: string; // OSS 摮睃<E691AE><E79D83>啣<EFBFBD>
|
||||
textContent?: string; // <20>𣂼<EFBFBD><F0A382BC><EFBFBD><EFBFBD><EFBFBD>砍<EFBFBD>摰對<E691B0>摮睃<E691AE><E79D83>嗆⏛<E59786>哨<EFBFBD>
|
||||
tokenCount: number; // 文本 Token 数
|
||||
truncated: boolean; // 是否被截断(超过30K tokens)
|
||||
tokenCount: number; // <EFBFBD><EFBFBD>𧋦 Token <EFBFBD>?
|
||||
truncated: boolean; // <EFBFBD>臬炏鋡急⏛<EFBFBD>哨<EFBFBD>頞<EFBFBD><EFBFBD>30K tokens嚗?
|
||||
createdAt: string; // <20>𥕦遣<F0A595A6>園𡢿
|
||||
}
|
||||
```
|
||||
@@ -494,7 +494,7 @@ interface Message {
|
||||
conversationId: string;
|
||||
role: 'user' | 'assistant';
|
||||
content: string;
|
||||
thinkingContent?: string; // 深度思考内容
|
||||
thinkingContent?: string; // 瘛勗漲<EFBFBD>肽<EFBFBD><EFBFBD><EFBFBD>摰?
|
||||
attachments?: Attachment[];
|
||||
model?: string;
|
||||
tokens?: number;
|
||||
@@ -505,15 +505,15 @@ interface Message {
|
||||
|
||||
---
|
||||
|
||||
## 🧪 测试示例(REST Client)
|
||||
## <EFBFBD>妒 瘚贝<E7989A>蝷箔<E89DB7>嚗㇌EST Client嚗?
|
||||
|
||||
```http
|
||||
### 获取智能体列表
|
||||
GET {{baseUrl}}/api/v2/aia/agents
|
||||
### <EFBFBD>瑕<EFBFBD><EFBFBD>箄<EFBFBD>雿枏<EFBFBD>銵?
|
||||
GET {{baseUrl}}/api/v1/aia/agents
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
### <EFBFBD>誩㦛頝舐眏
|
||||
POST {{baseUrl}}/api/v2/aia/intent/route
|
||||
POST {{baseUrl}}/api/v1/aia/intent/route
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type: application/json
|
||||
|
||||
@@ -522,7 +522,7 @@ Content-Type: application/json
|
||||
}
|
||||
|
||||
### <EFBFBD>𥕦遣撖寡<EFBFBD>
|
||||
POST {{baseUrl}}/api/v2/aia/conversations
|
||||
POST {{baseUrl}}/api/v1/aia/conversations
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type: application/json
|
||||
|
||||
@@ -531,8 +531,8 @@ Content-Type: application/json
|
||||
"title": "瘚贝<EFBFBD>撖寡<EFBFBD>"
|
||||
}
|
||||
|
||||
### 发送消息(流式)
|
||||
POST {{baseUrl}}/api/v2/aia/conversations/{{conversationId}}/messages/stream
|
||||
### <EFBFBD>煾<EFBFBD><EFBFBD><EFBFBD><EFBFBD>荔<EFBFBD>瘚<EFBFBD><EFBFBD>嚗?
|
||||
POST {{baseUrl}}/api/v1/aia/conversations/{{conversationId}}/messages/stream
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type: application/json
|
||||
Accept: text/event-stream
|
||||
@@ -543,7 +543,7 @@ Accept: text/event-stream
|
||||
}
|
||||
|
||||
### 銝𠹺<EFBFBD><EFBFBD><EFBFBD>辣
|
||||
POST {{baseUrl}}/api/v2/aia/conversations/{{conversationId}}/attachments
|
||||
POST {{baseUrl}}/api/v1/aia/conversations/{{conversationId}}/attachments
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary
|
||||
|
||||
@@ -568,3 +568,4 @@ Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user