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)
|
const sse = new SSEClient(streamUrl)
|
||||||
sse.subscribe(['append', 'replace', 'done'], (type, e) => {
|
sse.subscribe(['append', 'replace', 'done'], (type, e) => {
|
||||||
|
const data = {
|
||||||
|
id: e.lastEventId,
|
||||||
|
text: e.data,
|
||||||
|
type: 'replace',
|
||||||
|
};
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'append':
|
case 'append':
|
||||||
Store.set('dialogMsgChange', {
|
data.type = 'append';
|
||||||
id: e.lastEventId,
|
Store.set('dialogMsgChange', data);
|
||||||
type: 'append',
|
|
||||||
text: e.data
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'replace':
|
case 'replace':
|
||||||
Store.set('dialogMsgChange', {
|
Store.set('dialogMsgChange', data);
|
||||||
id: e.lastEventId,
|
|
||||||
type: 'replace',
|
|
||||||
text: e.data
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'done':
|
case 'done':
|
||||||
|
if (data.text) {
|
||||||
|
Store.set('dialogMsgChange', data);
|
||||||
|
}
|
||||||
const index = state.dialogSseList.findIndex(item => sse === item.sse)
|
const index = state.dialogSseList.findIndex(item => sse === item.sse)
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.dialogSseList.splice(index, 1)
|
state.dialogSseList.splice(index, 1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user