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