fix web chat features
This commit is contained in:
@@ -123,6 +123,22 @@ function AiChatPage() {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
|
||||
try {
|
||||
for (const msg of messages) {
|
||||
const prefix = msg.role === "assistant" ? "[AI Assistant] " : "[Customer] ";
|
||||
await fetch(`${API_BASE}/api/v1/chat/conversations/${conv.id}/messages`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
body: JSON.stringify({ content: prefix + msg.content }),
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// Navigate anyway — agent has partial context
|
||||
}
|
||||
|
||||
setHumanRequested(true);
|
||||
router.push(`/chat?id=${conv.id}`);
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user