refac
This commit is contained in:
@@ -122,6 +122,8 @@
|
||||
export let history;
|
||||
export let taskIds = null;
|
||||
|
||||
$: isActive = (taskIds && taskIds.length > 0) || (history.currentId && history.messages[history.currentId]?.done != true) || generating;
|
||||
|
||||
export let prompt = '';
|
||||
export let files = [];
|
||||
|
||||
@@ -1240,9 +1242,9 @@
|
||||
/>
|
||||
|
||||
<!-- Task list display -->
|
||||
{#if chatTasks.length > 0}
|
||||
{#if isActive && chatTasks.length > 0}
|
||||
<div class="mx-1">
|
||||
<TaskList tasks={chatTasks} done={!generating} />
|
||||
<TaskList tasks={chatTasks} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1857,7 +1859,7 @@
|
||||
</div>
|
||||
|
||||
<div class="self-end flex space-x-1 mr-1 shrink-0 gap-[0.5px]">
|
||||
{#if (taskIds && taskIds.length > 0) || (history.currentId && history.messages[history.currentId]?.done != true) || generating}
|
||||
{#if isActive}
|
||||
<div class=" flex items-center">
|
||||
<Tooltip content={$i18n.t('Stop')}>
|
||||
<button
|
||||
|
||||
@@ -8,21 +8,12 @@
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
export let tasks: Array<{ id: string; content: string; status: string }> = [];
|
||||
export let done = false;
|
||||
|
||||
let collapsed = false;
|
||||
|
||||
$: completedCount = tasks.filter((t) => t.status === 'completed').length;
|
||||
$: totalCount = tasks.length;
|
||||
$: inProgressCount = tasks.filter((t) => t.status === 'in_progress').length;
|
||||
$: pendingCount = tasks.filter((t) => t.status === 'pending').length;
|
||||
|
||||
// Hide once all work is effectively done:
|
||||
// - no active tasks at all, OR
|
||||
// - message is done and the only remaining active tasks are in_progress (no pending)
|
||||
$: hasActive =
|
||||
tasks.some((t) => t.status === 'pending' || t.status === 'in_progress') &&
|
||||
!(done && pendingCount === 0 && inProgressCount > 0);
|
||||
$: hasActive = tasks.some((t) => t.status === 'pending' || t.status === 'in_progress');
|
||||
</script>
|
||||
|
||||
{#if tasks.length > 0 && hasActive}
|
||||
|
||||
Reference in New Issue
Block a user