feat(chatbot): implement chatbot sidebar, message view, history mode and sse stream

This commit is contained in:
yiling
2026-07-11 10:49:40 +08:00
parent 77718a3e1a
commit d19200e9ef
21 changed files with 809 additions and 57 deletions
+10
View File
@@ -36,7 +36,17 @@ const route = new Hono<{ Variables: { user: User } }>()
const { sessionId, taskId } = await chatService.startOrContinueChat(user, req)
c.header('x-session-id', sessionId)
return streamSSE(c, async (stream) => {
// Send session ID as the first event
await stream.writeSSE({
data: JSON.stringify({
type: 'session',
sessionId,
}),
})
let lastEntryId = ''
const timeoutMs = 5 * 60 * 1000 // 5 minutes timeout
const startTime = Date.now()