Get Sina Chat Messages
Retrieves messages from a specific Sina chat session with pagination support.
Request
const messages = await getSinaChatMessages("session-123", 1, 20);
Response Example
{
"status": 200,
"data": [
{
"id": 1,
"sender": "user",
"text": "Hello, how are you?",
"chatId": "session-123",
"createdAt": "2024-03-20T10:00:00Z",
"updatedAt": "2024-03-20T10:00:00Z",
"media": null,
"data": null
},
{
"id": 2,
"sender": "sina",
"text": "I'm doing well, thank you! How can I help you today?",
"chatId": "session-123",
"createdAt": "2024-03-20T10:00:01Z",
"updatedAt": "2024-03-20T10:00:01Z",
"media": null,
"data": {
"contentType": "text",
"foundInRag": false,
"links": []
}
}
]
}
Error Handling
The function will throw an error if the API request fails. The error will contain the full response object as a string.
Example
try {
const messages = await getSinaChatMessages("session-123", 1, 20);
} catch (error) {
console.error('Failed to get messages:', error);
}