mirror of
https://github.com/ollama/ollama.git
synced 2025-08-30 21:31:44 +02:00
desktop: capture text from last chunk of response
This commit is contained in:
@@ -46,11 +46,12 @@ async function generate(prompt: string, model: string, callback: (res: string) =
|
||||
|
||||
for (const message of messages) {
|
||||
const choice = message.choices[0]
|
||||
|
||||
callback(choice.text)
|
||||
|
||||
if (choice.finish_reason === 'stop') {
|
||||
break
|
||||
}
|
||||
|
||||
callback(choice.text)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user