Commit 4ef886b1 authored by Jeffrey Morgan's avatar Jeffrey Morgan
Browse files

desktop: capture text from last chunk of response

parent ab828602
...@@ -46,11 +46,12 @@ async function generate(prompt: string, model: string, callback: (res: string) = ...@@ -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)
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment