fix web chat features

This commit is contained in:
2026-04-15 01:23:15 -06:00
parent f9cd2ed758
commit 638b15fb40
2 changed files with 378 additions and 30 deletions

View File

@@ -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 {