Skip to content

Commit 35219c7

Browse files
committed
remove complete event from chat stream
1 parent 5f60f1c commit 35219c7

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

src/client/components/ChatV2/ChatV2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
88
import { useTranslation } from 'react-i18next'
99
import { useParams, useSearchParams } from 'react-router-dom'
1010
import { DEFAULT_ASSISTANT_INSTRUCTIONS, DEFAULT_MODEL, DEFAULT_MODEL_TEMPERATURE, FREE_MODEL, inProduction, validModels } from '../../../config'
11-
import type { ChatMessage, Message, ToolCallResultEvent } from '../../../shared/chat'
11+
import type { ChatMessage, ToolCallResultEvent } from '../../../shared/chat'
1212
import type { RagIndexAttributes } from '../../../shared/types'
1313
import { getLanguageValue } from '../../../shared/utils'
1414
import { useIsEmbedded } from '../../contexts/EmbeddedContext'

src/client/components/ChatV2/useChatStream.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const useChatStream = ({
99
onError,
1010
onText,
1111
}: {
12-
onComplete: ({ previousResponseId, message }: { previousResponseId: string | undefined; message: AssistantMessage }) => void
12+
onComplete: ({ message }: { message: AssistantMessage }) => void
1313
onToolCallComplete: (toolResult: ToolCallResultEvent) => void
1414
onError: (error: unknown) => void
1515
onText: () => void
@@ -25,7 +25,6 @@ export const useChatStream = ({
2525
let content = ''
2626
let error = ''
2727
const toolCallResultsAccum: Record<string, ToolCallResultEvent> = {}
28-
let previousResponseId: string | undefined
2928

3029
try {
3130
const reader = stream.getReader()
@@ -78,10 +77,6 @@ export const useChatStream = ({
7877
error += parsedChunk.error
7978
break
8079

81-
case 'complete':
82-
previousResponseId = parsedChunk.prevResponseId
83-
break
84-
8580
default:
8681
break
8782
}
@@ -97,7 +92,6 @@ export const useChatStream = ({
9792
setIsStreaming(false)
9893

9994
onComplete({
100-
previousResponseId,
10195
message: {
10296
role: 'assistant',
10397
content,

src/shared/chat.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ export type WritingEvent = {
88
text: string
99
}
1010

11-
export type CompleteEvent = {
12-
type: 'complete'
13-
prevResponseId: string // Not yet sure what to put here in v3
14-
}
15-
1611
export type ToolCallStatusEvent = {
1712
type: 'toolCallStatus'
1813
callId: string
@@ -31,7 +26,7 @@ export type ErrorEvent = {
3126
error: string
3227
}
3328

34-
export type ChatEvent = WritingEvent | CompleteEvent | ToolCallStatusEvent | ToolCallResultEvent | ErrorEvent
29+
export type ChatEvent = WritingEvent | ToolCallStatusEvent | ToolCallResultEvent | ErrorEvent
3530

3631
export type SystemMessage = {
3732
role: 'system'

0 commit comments

Comments
 (0)