Skip to content

Commit 1cf1b2c

Browse files
committed
refac
1 parent 8b6fa1f commit 1cf1b2c

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/lib/components/chat/Messages/Markdown/ConsecutiveDetailsGroup.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
3030
$: toolCallCount = tokens.filter((t) => t?.attributes?.type === 'tool_calls').length;
3131
$: reasoningCount = tokens.filter((t) => t?.attributes?.type === 'reasoning').length;
32-
$: hasPending = tokens.some(
32+
$: hasPending = !messageDone && tokens.some(
3333
(t) => t?.attributes?.done !== undefined && t?.attributes?.done !== 'true'
3434
);
3535

src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@
384384
title={detailToken.summary}
385385
open={$settings?.expandDetails ?? false}
386386
attributes={detailToken?.attributes}
387+
messageDone={done}
387388
className="w-full space-y-1"
388389
dir="auto"
389390
>
@@ -406,6 +407,7 @@
406407
open={false}
407408
disabled={true}
408409
attributes={detailToken?.attributes}
410+
messageDone={done}
409411
className="w-full space-y-1"
410412
dir="auto"
411413
/>
@@ -429,6 +431,7 @@
429431
title={token.summary}
430432
open={$settings?.expandDetails ?? false}
431433
attributes={token?.attributes}
434+
messageDone={done}
432435
className="w-full space-y-1"
433436
dir="auto"
434437
>
@@ -451,6 +454,7 @@
451454
open={false}
452455
disabled={true}
453456
attributes={token?.attributes}
457+
messageDone={done}
454458
className="w-full space-y-1"
455459
dir="auto"
456460
/>

src/lib/components/common/Collapsible.svelte

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
export let grow = false;
5151
5252
export let disabled = false;
53+
export let messageDone = false;
5354
export let hide = false;
5455
5556
export let onChange: Function = () => {};
@@ -73,20 +74,20 @@
7374
>
7475
<div
7576
class=" w-full flex items-center justify-between gap-2 {attributes?.done &&
76-
attributes?.done !== 'true'
77+
attributes?.done !== 'true' && !messageDone
7778
? 'shimmer'
7879
: ''}
7980
"
8081
>
81-
{#if attributes?.done && attributes?.done !== 'true'}
82+
{#if attributes?.done && attributes?.done !== 'true' && !messageDone}
8283
<div>
8384
<Spinner className="size-4" />
8485
</div>
8586
{/if}
8687

8788
<div class="">
8889
{#if attributes?.type === 'reasoning'}
89-
{#if attributes?.done === 'true' && attributes?.duration}
90+
{#if (attributes?.done === 'true' || messageDone) && attributes?.duration}
9091
{#if attributes.duration < 1}
9192
{$i18n.t('Thought for less than a second')}
9293
{:else if attributes.duration < 60}
@@ -98,11 +99,13 @@
9899
DURATION: dayjs.duration(attributes.duration, 'seconds').humanize()
99100
})}
100101
{/if}
102+
{:else if attributes?.done === 'true' || messageDone}
103+
{$i18n.t('Thought')}
101104
{:else}
102105
{$i18n.t('Thinking...')}
103106
{/if}
104107
{:else if attributes?.type === 'code_interpreter'}
105-
{#if attributes?.done === 'true'}
108+
{#if attributes?.done === 'true' || messageDone}
106109
{$i18n.t('Analyzed')}
107110
{:else}
108111
{$i18n.t('Analyzing...')}

0 commit comments

Comments
 (0)