desktop: capture text from last chunk of response
This commit is contained in:
parent
ab828602f2
commit
4ef886b1d8
1 changed files with 3 additions and 2 deletions
|
@ -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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue