diff --git a/.changeset/violet-planes-repeat.md b/.changeset/violet-planes-repeat.md new file mode 100644 index 00000000..a93d3a37 --- /dev/null +++ b/.changeset/violet-planes-repeat.md @@ -0,0 +1,5 @@ +--- +'@difizen/magent-chat': patch +--- + +add msgId to fit aistudio scene diff --git a/web-packages/magent-chat/src/chat-base/ai-message-item-model.ts b/web-packages/magent-chat/src/chat-base/ai-message-item-model.ts index 9a875f19..3f2b0cd3 100644 --- a/web-packages/magent-chat/src/chat-base/ai-message-item-model.ts +++ b/web-packages/magent-chat/src/chat-base/ai-message-item-model.ts @@ -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) { diff --git a/web-packages/magent-chat/src/chat-base/chat-message-item-model.ts b/web-packages/magent-chat/src/chat-base/chat-message-item-model.ts index b1e17659..30f255fc 100644 --- a/web-packages/magent-chat/src/chat-base/chat-message-item-model.ts +++ b/web-packages/magent-chat/src/chat-base/chat-message-item-model.ts @@ -23,6 +23,7 @@ export class DefaultChatMessageItemModel { }; id?: string; + msgId?: string; sender: IChatMessageSender; option: ChatMessageItemOption; diff --git a/web-packages/magent-chat/src/chat-base/protocol.ts b/web-packages/magent-chat/src/chat-base/protocol.ts index decb6243..7deddfd1 100644 --- a/web-packages/magent-chat/src/chat-base/protocol.ts +++ b/web-packages/magent-chat/src/chat-base/protocol.ts @@ -107,6 +107,7 @@ export interface IChatEvent { export interface ChatEventChunk extends IChatEvent { output: string; type: 'chunk'; + msgId?: string; [key: string]: any; }