Skip to content
Snippets Groups Projects
Unverified Commit 67f4db85 authored by Alex Yang's avatar Alex Yang Committed by GitHub
Browse files

fix: steaming chat in ollama (#1463)

parent e4151a8b
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,22 @@ import { ...@@ -23,7 +23,22 @@ import {
type Options, type Options,
} from "ollama/browser"; } from "ollama/browser";
const messageAccessor = (part: OllamaChatResponse): ChatResponseChunk => { const messageAccessor = (
part: OllamaChatResponse,
): ChatResponseChunk<ToolCallLLMMessageOptions> => {
if (part.message.tool_calls) {
return {
raw: part,
delta: part.message.content,
options: {
toolCall: part.message.tool_calls.map((toolCall) => ({
name: toolCall.function.name,
input: toolCall.function.arguments,
id: randomUUID(),
})),
},
};
}
return { return {
raw: part, raw: part,
delta: part.message.content, delta: part.message.content,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment