refac
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
$: toolCallCount = tokens.filter((t) => t?.attributes?.type === 'tool_calls').length;
|
$: toolCallCount = tokens.filter((t) => t?.attributes?.type === 'tool_calls').length;
|
||||||
$: reasoningCount = tokens.filter((t) => t?.attributes?.type === 'reasoning').length;
|
$: reasoningCount = tokens.filter((t) => t?.attributes?.type === 'reasoning').length;
|
||||||
$: hasPending = tokens.some(
|
$: hasPending = !messageDone && tokens.some(
|
||||||
(t) => t?.attributes?.done !== undefined && t?.attributes?.done !== 'true'
|
(t) => t?.attributes?.done !== undefined && t?.attributes?.done !== 'true'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -384,6 +384,7 @@
|
|||||||
title={detailToken.summary}
|
title={detailToken.summary}
|
||||||
open={$settings?.expandDetails ?? false}
|
open={$settings?.expandDetails ?? false}
|
||||||
attributes={detailToken?.attributes}
|
attributes={detailToken?.attributes}
|
||||||
|
messageDone={done}
|
||||||
className="w-full space-y-1"
|
className="w-full space-y-1"
|
||||||
dir="auto"
|
dir="auto"
|
||||||
>
|
>
|
||||||
@@ -406,6 +407,7 @@
|
|||||||
open={false}
|
open={false}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
attributes={detailToken?.attributes}
|
attributes={detailToken?.attributes}
|
||||||
|
messageDone={done}
|
||||||
className="w-full space-y-1"
|
className="w-full space-y-1"
|
||||||
dir="auto"
|
dir="auto"
|
||||||
/>
|
/>
|
||||||
@@ -429,6 +431,7 @@
|
|||||||
title={token.summary}
|
title={token.summary}
|
||||||
open={$settings?.expandDetails ?? false}
|
open={$settings?.expandDetails ?? false}
|
||||||
attributes={token?.attributes}
|
attributes={token?.attributes}
|
||||||
|
messageDone={done}
|
||||||
className="w-full space-y-1"
|
className="w-full space-y-1"
|
||||||
dir="auto"
|
dir="auto"
|
||||||
>
|
>
|
||||||
@@ -451,6 +454,7 @@
|
|||||||
open={false}
|
open={false}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
attributes={token?.attributes}
|
attributes={token?.attributes}
|
||||||
|
messageDone={done}
|
||||||
className="w-full space-y-1"
|
className="w-full space-y-1"
|
||||||
dir="auto"
|
dir="auto"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
export let grow = false;
|
export let grow = false;
|
||||||
|
|
||||||
export let disabled = false;
|
export let disabled = false;
|
||||||
|
export let messageDone = false;
|
||||||
export let hide = false;
|
export let hide = false;
|
||||||
|
|
||||||
export let onChange: Function = () => {};
|
export let onChange: Function = () => {};
|
||||||
@@ -73,12 +74,12 @@
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class=" w-full flex items-center justify-between gap-2 {attributes?.done &&
|
class=" w-full flex items-center justify-between gap-2 {attributes?.done &&
|
||||||
attributes?.done !== 'true'
|
attributes?.done !== 'true' && !messageDone
|
||||||
? 'shimmer'
|
? 'shimmer'
|
||||||
: ''}
|
: ''}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{#if attributes?.done && attributes?.done !== 'true'}
|
{#if attributes?.done && attributes?.done !== 'true' && !messageDone}
|
||||||
<div>
|
<div>
|
||||||
<Spinner className="size-4" />
|
<Spinner className="size-4" />
|
||||||
</div>
|
</div>
|
||||||
@@ -86,7 +87,7 @@
|
|||||||
|
|
||||||
<div class="">
|
<div class="">
|
||||||
{#if attributes?.type === 'reasoning'}
|
{#if attributes?.type === 'reasoning'}
|
||||||
{#if attributes?.done === 'true' && attributes?.duration}
|
{#if (attributes?.done === 'true' || messageDone) && attributes?.duration}
|
||||||
{#if attributes.duration < 1}
|
{#if attributes.duration < 1}
|
||||||
{$i18n.t('Thought for less than a second')}
|
{$i18n.t('Thought for less than a second')}
|
||||||
{:else if attributes.duration < 60}
|
{:else if attributes.duration < 60}
|
||||||
@@ -98,11 +99,13 @@
|
|||||||
DURATION: dayjs.duration(attributes.duration, 'seconds').humanize()
|
DURATION: dayjs.duration(attributes.duration, 'seconds').humanize()
|
||||||
})}
|
})}
|
||||||
{/if}
|
{/if}
|
||||||
|
{:else if attributes?.done === 'true' || messageDone}
|
||||||
|
{$i18n.t('Thought')}
|
||||||
{:else}
|
{:else}
|
||||||
{$i18n.t('Thinking...')}
|
{$i18n.t('Thinking...')}
|
||||||
{/if}
|
{/if}
|
||||||
{:else if attributes?.type === 'code_interpreter'}
|
{:else if attributes?.type === 'code_interpreter'}
|
||||||
{#if attributes?.done === 'true'}
|
{#if attributes?.done === 'true' || messageDone}
|
||||||
{$i18n.t('Analyzed')}
|
{$i18n.t('Analyzed')}
|
||||||
{:else}
|
{:else}
|
||||||
{$i18n.t('Analyzing...')}
|
{$i18n.t('Analyzing...')}
|
||||||
|
|||||||
Reference in New Issue
Block a user