Send Sina Message
Sends a message to an existing Sina chat session.
Request
final response = await sendSinaMessage("Hello, how are you?", "session-123");
Response Example
{
"statusCode": 200,
"body": {
"user_message": {
"id": 1,
"sender": "user",
"text": "Hello, how are you?",
"chat_id": "session-123",
"created_at": "2024-03-20T10:00:00Z",
"updated_at": "2024-03-20T10:00:00Z",
"media": null,
"data": null
},
"sina_message": {
"id": 2,
"sender": "sina",
"text": "I'm doing well, thank you! How can I help you today?",
"chat_id": "session-123",
"created_at": "2024-03-20T10:00:01Z",
"updated_at": "2024-03-20T10:00:01Z",
"media": null,
"data": {
"content_type": "text",
"found_in_rag": false,
"links": []
}
}
}
}
Error Handling
The function will throw an Exception if the API request fails.
Example
try {
final response = await sendSinaMessage("Hello", "session-123");
} catch (e) {
print('Failed to send message: $e');
}
Initialization
Before using the Sina API, you need to initialize the endpoint:
void init() {
sinaModelEndPoint = 'your-endpoint-here';
}