Skip to content

Commit

Permalink
fix: add msgId
Browse files Browse the repository at this point in the history
  • Loading branch information
xujingli authored and BroKun committed Nov 27, 2024
1 parent 8d17ec5 commit bb8bd8a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-planes-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@difizen/magent-chat': patch
---

add msgId to fit aistudio scene
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export class AIChatMessageItemModel extends DefaultChatMessageItemModel {
appendChunk(e: ChatEventChunk) {
this.state = AnswerState.RECEIVING;
this.content = `${this.content}${e.output}`;
if (!this.msgId && e.msgId) {
this.msgId = e.msgId;
}
}

handleResult(e: ChatEventResult) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class DefaultChatMessageItemModel {
};

id?: string;
msgId?: string;
sender: IChatMessageSender;

option: ChatMessageItemOption;
Expand Down
1 change: 1 addition & 0 deletions web-packages/magent-chat/src/chat-base/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export interface IChatEvent {
export interface ChatEventChunk extends IChatEvent {
output: string;
type: 'chunk';
msgId?: string;
[key: string]: any;
}

Expand Down

0 comments on commit bb8bd8a

Please sign in to comment.