mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:19:56 +00:00
fix: AI聊天缺少最后一句话的情况
This commit is contained in:
parent
1f187ba8fb
commit
d4cccbeb09
21
resources/assets/js/store/actions.js
vendored
21
resources/assets/js/store/actions.js
vendored
@ -3423,24 +3423,25 @@ export default {
|
||||
}
|
||||
const sse = new SSEClient(streamUrl)
|
||||
sse.subscribe(['append', 'replace', 'done'], (type, e) => {
|
||||
const data = {
|
||||
id: e.lastEventId,
|
||||
text: e.data,
|
||||
type: 'replace',
|
||||
};
|
||||
switch (type) {
|
||||
case 'append':
|
||||
Store.set('dialogMsgChange', {
|
||||
id: e.lastEventId,
|
||||
type: 'append',
|
||||
text: e.data
|
||||
});
|
||||
data.type = 'append';
|
||||
Store.set('dialogMsgChange', data);
|
||||
break;
|
||||
|
||||
case 'replace':
|
||||
Store.set('dialogMsgChange', {
|
||||
id: e.lastEventId,
|
||||
type: 'replace',
|
||||
text: e.data
|
||||
});
|
||||
Store.set('dialogMsgChange', data);
|
||||
break;
|
||||
|
||||
case 'done':
|
||||
if (data.text) {
|
||||
Store.set('dialogMsgChange', data);
|
||||
}
|
||||
const index = state.dialogSseList.findIndex(item => sse === item.sse)
|
||||
if (index > -1) {
|
||||
state.dialogSseList.splice(index, 1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user