Skip to content

Commit

Permalink
fix: umi版本较低时流失输出无效
Browse files Browse the repository at this point in the history
  • Loading branch information
xujingli committed Sep 4, 2024
1 parent 6d32242 commit 5567868
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions web-apps/platform/src/modules/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ export class Chat extends AsyncModel<Chat, ChatOption> {
const newMessageModel: ChatMessageModel = JSON.parse(e.data);
const message = this.getOrCreateMessage(newMessageModel);
this.messages = [...this.messages, message];
setImmediate(() => this.scrollToBottom(true, false));
setImmediate(() => {
if (!this.showToBottomBtn) {
this.scrollToBottom(true, false);
}
});
}

if (e.event === 'chunk') {
Expand All @@ -241,7 +245,11 @@ export class Chat extends AsyncModel<Chat, ChatOption> {
if (msg) {
this.processingChunk = msg;
msg.appendChunk(chunk);
setImmediate(() => this.scrollToBottom(true, false));
setImmediate(() => {
if (!this.showToBottomBtn) {
this.scrollToBottom(true, false);
}
});
}
}
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion web-apps/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"remark-breaks": "^4.0.0",
"remark-gfm": "^4.0.0",
"timeago.js": "^4.0.2",
"umi": "^4.1.1"
"umi": "^4.3.18"
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.23.7",
Expand Down

0 comments on commit 5567868

Please sign in to comment.