docs: 更新 Agent Chat Messages 协议文档
This commit is contained in:
@@ -88,7 +88,7 @@ Frontend Backend
|
|||||||
{bucket, path, mime_type, url: signed_url}
|
{bucket, path, mime_type, url: signed_url}
|
||||||
|
|
||||||
2. Send message with binary block
|
2. Send message with binary block
|
||||||
POST /api/v1/agent/run
|
POST /api/v1/agent/runs
|
||||||
content: [
|
content: [
|
||||||
{type: "text", text: "..."},
|
{type: "text", text: "..."},
|
||||||
{type: "binary", mimeType: "image/jpeg", url: signed_url}
|
{type: "binary", mimeType: "image/jpeg", url: signed_url}
|
||||||
@@ -104,12 +104,21 @@ Frontend Backend
|
|||||||
5. Return history (GET /history)
|
5. Return history (GET /history)
|
||||||
<──────────────────────────────
|
<──────────────────────────────
|
||||||
messages: [{
|
messages: [{
|
||||||
|
id: "msg-1",
|
||||||
|
seq: 1,
|
||||||
role: "user",
|
role: "user",
|
||||||
content: [
|
content: "...",
|
||||||
{type: "text", text: "..."},
|
metadata: {
|
||||||
{type: "binary", mimeType: "image/jpeg", url: new_signed_url}
|
user_message_attachments: {bucket, path, mime_type}
|
||||||
]
|
},
|
||||||
|
timestamp: "2026-03-13T10:00:00Z"
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
6. Resolve temporary URL for rendering
|
||||||
|
GET /api/v1/agent/attachments/signed-url?bucket=...&path=...
|
||||||
|
──────────────────────────────>
|
||||||
|
<──────────────────────────────
|
||||||
|
{bucket, path, url}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Signed URL Format
|
### Signed URL Format
|
||||||
@@ -146,7 +155,7 @@ interface AgentChatMessageMetadata {
|
|||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
**Request (POST /run):**
|
**Request (POST /runs):**
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"threadId": "thread-123",
|
"threadId": "thread-123",
|
||||||
@@ -185,16 +194,27 @@ interface AgentChatMessageMetadata {
|
|||||||
"messages": [
|
"messages": [
|
||||||
{
|
{
|
||||||
"id": "msg-1",
|
"id": "msg-1",
|
||||||
|
"seq": 1,
|
||||||
"role": "user",
|
"role": "user",
|
||||||
"content": [
|
"content": "帮我看看这张图",
|
||||||
{"type": "text", "text": "帮我看看这张图"},
|
"metadata": {
|
||||||
{
|
"user_message_attachments": {
|
||||||
"type": "binary",
|
"bucket": "agent-files",
|
||||||
"mimeType": "image/jpeg",
|
"path": "agent-inputs/u/t/r/img.jpg",
|
||||||
"url": "https://xxx.supabase.co/storage/v1/object/sign/agent-files/agent-inputs/u/t/r/img.jpg?token=yyy"
|
"mime_type": "image/jpeg"
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
|
"timestamp": "2026-03-13T10:00:00Z"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Attachment URL Response (GET /attachments/signed-url):**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"bucket": "agent-files",
|
||||||
|
"path": "agent-inputs/u/t/r/img.jpg",
|
||||||
|
"url": "https://xxx.supabase.co/storage/v1/object/sign/agent-files/agent-inputs/u/t/r/img.jpg?token=yyy"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user