Skip to content

Commit

Permalink
fix: chat streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
levanion committed Mar 5, 2024
1 parent ae1ae21 commit eee8c37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/ui/src/services/chat/useCreateChatMessageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export const useCreateChatMessageService = ({

const token = new TextDecoder('utf-8').decode(value)
aiMessage.message.data.content += token
aiMessage.message.data.content = aiMessage.message.data.content.replace(/\\n/g, '\n')

upsertChatMessageInCache(aiMessage, {
agentId,
Expand Down
1 change: 1 addition & 0 deletions apps/ui/src/services/chat/useCreateClientChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const useCreateClientChatMessageService = ({

const token = new TextDecoder('utf-8').decode(value)
aiMessage.message.data.content += token
aiMessage.message.data.content = aiMessage.message.data.content.replace(/\\n/g, '\n')

upsertChatMessageInCache(aiMessage, {
chatId: chat_id,
Expand Down

0 comments on commit eee8c37

Please sign in to comment.