mirror of
https://github.com/ollama/ollama.git
synced 2025-09-01 11:42:27 +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) {
|
for (const message of messages) {
|
||||||
const choice = message.choices[0]
|
const choice = message.choices[0]
|
||||||
|
|
||||||
|
callback(choice.text)
|
||||||
|
|
||||||
if (choice.finish_reason === 'stop') {
|
if (choice.finish_reason === 'stop') {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(choice.text)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user