mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 15:17:15 +00:00
feat(chatbot): implement chatbot sidebar, message view, history mode and sse stream
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user