راهنمای کامل برای استفاده از API های پلتفرم ایجنت هوشمند
v1.0
POST/stream-chat-with-assistant/
Initiates or continues a chat session with streaming responses. For a new conversation, omit the thread_id to create a new thread. The server will return a thread_id in the first response chunk, which should be used in subsequent requests to continue the conversation. The server streams multiple JSON responses as they become available. Each response is a separate JSON object that can contain different types of data (thread_id, text, or products).
درخواست
JSON
{
"assistant_id": "string",
"thread_id": "string (optional - omit for new conversation, include for continuing a thread)",
"message": "string"
}
پاسخ
JSON
{
"Stream Response Format": "Multiple JSON objects are streamed, each can be one of the following types:",
"Type 1: Thread ID": {
"thread_id": "string (conversation thread identifier)"
},
"Type 2: Message": {
"text": "string (assistant's response text)"
},
"Type 3: Products": {
"products": [
{
"price": "number (product price)",
"url": "string (product URL)",
"image": "string (product image URL)",
"name": "string (product name)"
}
]
},
"Type 4: Wait Status": {
"wait": "boolean (assistant is processing, e.g. searching products)"
},
"Type 5: Suggestions": {
"suggestions": "string[] (suggested follow-up messages)"
}
}
یادداشتها
The response is streamed as separate JSON objects
Each JSON object can contain thread_id, text, products, wait, or suggestions
Multiple text responses may be streamed for a single message
Product recommendations and suggestions are optional and may not be present in all responses
Initiates or continues a chat session without streaming. For a new conversation, omit the thread_id to create a new thread. The server will return a thread_id in the response, which should be used in subsequent requests to continue the conversation. Returns a complete response at once.
درخواست
JSON
{
"assistant_id": "string",
"thread_id": "string (optional - omit for new conversation, include for continuing a thread)",
"message": "string"
}