From 8d3cc7fe7e6133169200876ceefafbebcea3c961 Mon Sep 17 00:00:00 2001 From: Jicheng Lu Date: Sat, 18 Apr 2026 00:08:02 -0500 Subject: [PATCH] use thought to get thinking text --- src/lib/helpers/types/conversationTypes.js | 1 + .../[conversationId]/chat-box.svelte | 24 +++++++++---------- .../rich-content/rc-message.svelte | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/lib/helpers/types/conversationTypes.js b/src/lib/helpers/types/conversationTypes.js index 82d2c68f..48b75a4b 100644 --- a/src/lib/helpers/types/conversationTypes.js +++ b/src/lib/helpers/types/conversationTypes.js @@ -180,6 +180,7 @@ IRichContent.prototype.language; * @property {boolean} is_dummy * @property {boolean} is_appended * @property {string} [indication] + * @property {any} [thought] * @property {any} [meta_data] */ diff --git a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte index f5a9adef..b7f3e8c5 100644 --- a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte +++ b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte @@ -582,9 +582,9 @@ ...message, is_chat_message: false, is_dummy: true, - meta_data: { - ...(message.meta_data || {}), - thinking_text: message.meta_data?.thinking_text || '' + thought: { + ...(message.thought || {}), + thinking_text: message.thought?.thinking_text || '' } }); } @@ -602,12 +602,12 @@ && lastMsg?.is_dummy ) { setTimeout(() => { - const thinkingText = message.meta_data?.thinking_text || ''; + const thinkingText = message.thought?.thinking_text || ''; if (thinkingText) { - if (!dialogs[dialogs.length - 1].meta_data) { - dialogs[dialogs.length - 1].meta_data = { thinking_text: '' }; + if (!dialogs[dialogs.length - 1].thought) { + dialogs[dialogs.length - 1].thought = { thinking_text: '' }; } - dialogs[dialogs.length - 1].meta_data.thinking_text += thinkingText; + dialogs[dialogs.length - 1].thought.thinking_text += thinkingText; } dialogs[dialogs.length - 1].text += message.text; refreshDialogs(); @@ -638,13 +638,13 @@ } try { - const thinkingText = item.meta_data?.thinking_text || ''; + const thinkingText = item.thought?.thinking_text || ''; if (thinkingText) { - if (!dialogs[dialogs.length - 1].meta_data) { - dialogs[dialogs.length - 1].meta_data = { thinking_text: '' }; + if (!dialogs[dialogs.length - 1].thought) { + dialogs[dialogs.length - 1].thought = { thinking_text: '' }; } for (const tt of thinkingText) { - dialogs[dialogs.length - 1].meta_data.thinking_text += tt; + dialogs[dialogs.length - 1].thought.thinking_text += tt; refreshDialogs(); await delay(10); } @@ -2014,7 +2014,7 @@ {#if message.sender.role == UserRole.Client} avatar {:else} - {@const isShowIcon = (message?.rich_content?.message?.text || message?.text || message?.meta_data?.thinking_text) || message?.uuid !== lastBotMsg?.uuid} + {@const isShowIcon = (message?.rich_content?.message?.text || message?.text || message?.thought?.thinking_text) || message?.uuid !== lastBotMsg?.uuid}