Skip to content

Commit 8d3cc7f

Browse files
committed
use thought to get thinking text
1 parent 64c6a64 commit 8d3cc7f

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/lib/helpers/types/conversationTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ IRichContent.prototype.language;
180180
* @property {boolean} is_dummy
181181
* @property {boolean} is_appended
182182
* @property {string} [indication]
183+
* @property {any} [thought]
183184
* @property {any} [meta_data]
184185
*/
185186

src/routes/chat/[agentId]/[conversationId]/chat-box.svelte

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,9 @@
582582
...message,
583583
is_chat_message: false,
584584
is_dummy: true,
585-
meta_data: {
586-
...(message.meta_data || {}),
587-
thinking_text: message.meta_data?.thinking_text || ''
585+
thought: {
586+
...(message.thought || {}),
587+
thinking_text: message.thought?.thinking_text || ''
588588
}
589589
});
590590
}
@@ -602,12 +602,12 @@
602602
&& lastMsg?.is_dummy
603603
) {
604604
setTimeout(() => {
605-
const thinkingText = message.meta_data?.thinking_text || '';
605+
const thinkingText = message.thought?.thinking_text || '';
606606
if (thinkingText) {
607-
if (!dialogs[dialogs.length - 1].meta_data) {
608-
dialogs[dialogs.length - 1].meta_data = { thinking_text: '' };
607+
if (!dialogs[dialogs.length - 1].thought) {
608+
dialogs[dialogs.length - 1].thought = { thinking_text: '' };
609609
}
610-
dialogs[dialogs.length - 1].meta_data.thinking_text += thinkingText;
610+
dialogs[dialogs.length - 1].thought.thinking_text += thinkingText;
611611
}
612612
dialogs[dialogs.length - 1].text += message.text;
613613
refreshDialogs();
@@ -638,13 +638,13 @@
638638
}
639639
640640
try {
641-
const thinkingText = item.meta_data?.thinking_text || '';
641+
const thinkingText = item.thought?.thinking_text || '';
642642
if (thinkingText) {
643-
if (!dialogs[dialogs.length - 1].meta_data) {
644-
dialogs[dialogs.length - 1].meta_data = { thinking_text: '' };
643+
if (!dialogs[dialogs.length - 1].thought) {
644+
dialogs[dialogs.length - 1].thought = { thinking_text: '' };
645645
}
646646
for (const tt of thinkingText) {
647-
dialogs[dialogs.length - 1].meta_data.thinking_text += tt;
647+
dialogs[dialogs.length - 1].thought.thinking_text += tt;
648648
refreshDialogs();
649649
await delay(10);
650650
}
@@ -2014,7 +2014,7 @@
20142014
{#if message.sender.role == UserRole.Client}
20152015
<img src="images/users/user-dummy.jpg" class="rounded-circle avatar-sm" style="margin-bottom: -15px;" alt="avatar">
20162016
{:else}
2017-
{@const isShowIcon = (message?.rich_content?.message?.text || message?.text || message?.meta_data?.thinking_text) || message?.uuid !== lastBotMsg?.uuid}
2017+
{@const isShowIcon = (message?.rich_content?.message?.text || message?.text || message?.thought?.thinking_text) || message?.uuid !== lastBotMsg?.uuid}
20182018
<img
20192019
class="rounded-circle avatar-sm"
20202020
style={`display: ${isShowIcon ? 'block' : 'none'}; margin-bottom: -15px;`}

src/routes/chat/[agentId]/[conversationId]/rich-content/rc-message.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
} = $props();
2626
2727
let text = $derived(message?.rich_content?.message?.text || message?.text || '');
28-
let thinkingText = $derived(message?.meta_data?.thinking_text || '');
28+
let thinkingText = $derived(message?.thought?.thinking_text || '');
2929
let isThinking = $derived(thinkingText && !text && isStreaming);
3030
let isStoppedThinking = $derived(thinkingText && !text && !isStreaming);
3131

0 commit comments

Comments
 (0)