diff --git a/src/react/useChatStream.test.ts b/src/react/useChatStream.test.ts index dc4ade7..1b94f97 100644 --- a/src/react/useChatStream.test.ts +++ b/src/react/useChatStream.test.ts @@ -1090,7 +1090,9 @@ describe("useAIStream", () => { This is the joke: Why do Czechs always carry a pencil and paper? In case they need to draw a red line somewhere!`, + "handled_tool_result": true, "role": "tool", + "tool_call_id": "call_uTSra7MsEkzrL8VffnRtHsdW", }, { role: 'assistant', content: "End of assistant message!" } ]) diff --git a/src/react/useChatStream.ts b/src/react/useChatStream.ts index ee7d7ae..2b2d19d 100644 --- a/src/react/useChatStream.ts +++ b/src/react/useChatStream.ts @@ -97,7 +97,9 @@ export function combineAIMessageChunkWithCompleteMessages( finish_reason: 'length' as const, index: choice.index, logprobs: null, + delta: choice.delta, message: { + ...choice.delta, content: choice.delta.content ?? "", // @ts-expect-error - mantain the original role here role: choice.delta.role ?? "assistant" as const,