Skip to content

Commit 178a06a

Browse files
authored
Merge pull request #17 from VapiAI/arvind/fix-cutoff-error
VAP-9999 Fix cutoff error
2 parents 835bc39 + e055cee commit 178a06a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/hooks/useVapiChat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ export const handleStreamChunk = (
127127

128128
// Since we pre-allocated, we know the index is always valid
129129
if (assistantMessageIndexRef.current !== null) {
130+
const targetIndex = assistantMessageIndexRef.current!;
130131
setMessages((prev) => {
131132
const newMessages = [...prev];
132-
const targetIndex = assistantMessageIndexRef.current!;
133133

134134
if (targetIndex < newMessages.length) {
135135
newMessages[targetIndex] = {

0 commit comments

Comments
 (0)