Added if statement
This commit is contained in:
parent
3573fa8e7b
commit
78357f630e
1 changed files with 10 additions and 9 deletions
|
@ -339,15 +339,16 @@ const mainApp = createApp({
|
||||||
endpoint: '/chat/completions',
|
endpoint: '/chat/completions',
|
||||||
};
|
};
|
||||||
for await (const chunk of llama(prompt, params, config)) {
|
for await (const chunk of llama(prompt, params, config)) {
|
||||||
const stop = chunk.data.stop;
|
if (chunk.data.choices) {
|
||||||
const addedContent = chunk.data.choices[0].delta.content;
|
const addedContent = chunk.data.choices[0].delta.content;
|
||||||
const lastContent = this.pendingMsg.content || '';
|
const lastContent = this.pendingMsg.content || '';
|
||||||
if (addedContent) {
|
if (addedContent) {
|
||||||
this.pendingMsg = {
|
this.pendingMsg = {
|
||||||
id: this.pendingMsg.id,
|
id: this.pendingMsg.id,
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
content: lastContent + addedContent,
|
content: lastContent + addedContent,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue