chore
This commit is contained in:
parent
2d853f92b9
commit
40c5368deb
@ -599,14 +599,15 @@ const ChatPanel: FC = observer(() => {
|
|||||||
if (data.model)
|
if (data.model)
|
||||||
commonStore.setLastModelName(data.model);
|
commonStore.setLastModelName(data.model);
|
||||||
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
||||||
if (data.choices[0]?.finish_reason) {
|
|
||||||
finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
answer += data.choices[0]?.delta?.content || '';
|
answer += data.choices[0]?.delta?.content || '';
|
||||||
commonStore.conversation[answerId!].content = answer;
|
commonStore.conversation[answerId!].content = answer;
|
||||||
commonStore.setConversation(commonStore.conversation);
|
commonStore.setConversation(commonStore.conversation);
|
||||||
commonStore.setConversationOrder([...commonStore.conversationOrder]);
|
commonStore.setConversationOrder([...commonStore.conversationOrder]);
|
||||||
|
|
||||||
|
if (data.choices[0]?.finish_reason) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async onopen(response) {
|
async onopen(response) {
|
||||||
|
@ -125,12 +125,13 @@ const CompletionPanel: FC = observer(() => {
|
|||||||
if (data.model)
|
if (data.model)
|
||||||
commonStore.setLastModelName(data.model);
|
commonStore.setLastModelName(data.model);
|
||||||
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
||||||
|
answer += data.choices[0]?.text || data.choices[0]?.delta?.content || '';
|
||||||
|
setPrompt(prompt + answer.replace(/\s+$/, '') + params.injectEnd.replaceAll('\\n', '\n'));
|
||||||
|
|
||||||
if (data.choices[0]?.finish_reason) {
|
if (data.choices[0]?.finish_reason) {
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
answer += data.choices[0]?.text || data.choices[0]?.delta?.content || '';
|
|
||||||
setPrompt(prompt + answer.replace(/\s+$/, '') + params.injectEnd.replaceAll('\\n', '\n'));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async onopen(response) {
|
async onopen(response) {
|
||||||
|
@ -230,12 +230,13 @@ const CompositionPanel: FC = observer(() => {
|
|||||||
if (data.model)
|
if (data.model)
|
||||||
commonStore.setLastModelName(data.model);
|
commonStore.setLastModelName(data.model);
|
||||||
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
||||||
|
answer += data.choices[0]?.text || data.choices[0]?.delta?.content || '';
|
||||||
|
setPrompt(prompt + answer.replace(/\s+$/, ''));
|
||||||
|
|
||||||
if (data.choices[0]?.finish_reason) {
|
if (data.choices[0]?.finish_reason) {
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
answer += data.choices[0]?.text || data.choices[0]?.delta?.content || '';
|
|
||||||
setPrompt(prompt + answer.replace(/\s+$/, ''));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async onopen(response) {
|
async onopen(response) {
|
||||||
|
Loading…
Reference in New Issue
Block a user