desktop: capture text from last chunk of response

This commit is contained in:
Jeffrey Morgan 2023-06-27 22:08:53 -04:00
parent ab828602f2
commit 4ef886b1d8

View file

@ -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)
}
}