Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/hooks/useAIStreamHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ const useAIChatStreamHandler = () => {
created_at: Math.floor(Date.now() / 1000) + 1
})

let lastContent = ''
let newSessionId = sessionId
try {
const endpointUrl = constructEndpointUrl(selectedEndpoint)
Expand Down Expand Up @@ -230,9 +229,7 @@ const useAIChatStreamHandler = () => {
lastMessage.role === 'agent' &&
typeof chunk.content === 'string'
) {
const uniqueContent = chunk.content.replace(lastContent, '')
lastMessage.content += uniqueContent
lastContent = chunk.content
lastMessage.content += chunk.content

// Handle tool calls streaming
lastMessage.tool_calls = processChunkToolCalls(
Expand Down Expand Up @@ -273,7 +270,6 @@ const useAIChatStreamHandler = () => {
const jsonBlock = getJsonMarkdown(chunk?.content)

lastMessage.content += jsonBlock
lastContent = jsonBlock
} else if (
chunk.response_audio?.transcript &&
typeof chunk.response_audio?.transcript === 'string'
Expand Down