@wendongfly/myhi 1.3.44 → 1.3.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat.html +7 -2
- package/package.json +1 -1
package/dist/chat.html
CHANGED
|
@@ -821,7 +821,7 @@
|
|
|
821
821
|
|
|
822
822
|
let _streamEl = null; // 当前流式输出的 assistant 元素
|
|
823
823
|
let _streamText = ''; // 累积的原始文本
|
|
824
|
-
let _streamedTextThisMessage = false; //
|
|
824
|
+
let _streamedTextThisMessage = false; // 当前轮(自上次用户提问起)是否已渲染过答复文本(来自 content_block_delta 流式或 assistant 事件的完整 text 块);用于在末尾 assistant / result 事件中跳过重复渲染
|
|
825
825
|
|
|
826
826
|
function addAssistantMessage(raw) {
|
|
827
827
|
removeThinking(); endToolGroup();
|
|
@@ -1320,7 +1320,12 @@
|
|
|
1320
1320
|
if (block.type === 'thinking' && block.thinking) {
|
|
1321
1321
|
showThinking(block.thinking);
|
|
1322
1322
|
} else if (block.type === 'text' && block.text) {
|
|
1323
|
-
if (!_streamedTextThisMessage)
|
|
1323
|
+
if (!_streamedTextThisMessage) {
|
|
1324
|
+
addAssistantMessage(block.text);
|
|
1325
|
+
// 非流式适配器(如 MiniMax)不会发 content_block_delta,
|
|
1326
|
+
// 这里渲染后也要置位,避免后续 result 事件再渲染同样的文本
|
|
1327
|
+
_streamedTextThisMessage = true;
|
|
1328
|
+
}
|
|
1324
1329
|
} else if (block.type === 'tool_use') {
|
|
1325
1330
|
if (block.name === 'AskUserQuestion' && block.input) {
|
|
1326
1331
|
openAskSheet(block.input);
|