Skip to content

Commit 0ad397c

Browse files
committed
refac
1 parent b1e8c7d commit 0ad397c

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/lib/components/chat/MessageInput.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@
12421242
<!-- Task list display -->
12431243
{#if chatTasks.length > 0}
12441244
<div class="mx-1">
1245-
<TaskList tasks={chatTasks} />
1245+
<TaskList tasks={chatTasks} done={!generating} />
12461246
</div>
12471247
{/if}
12481248

src/lib/components/chat/Messages/ResponseMessage/TaskList.svelte

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,21 @@
88
const i18n = getContext('i18n');
99
1010
export let tasks: Array<{ id: string; content: string; status: string }> = [];
11+
export let done = false;
1112
1213
let collapsed = false;
1314
1415
$: completedCount = tasks.filter((t) => t.status === 'completed').length;
1516
$: totalCount = tasks.length;
16-
$: hasActive = tasks.some((t) => t.status === 'pending' || t.status === 'in_progress');
17+
$: inProgressCount = tasks.filter((t) => t.status === 'in_progress').length;
18+
$: pendingCount = tasks.filter((t) => t.status === 'pending').length;
19+
20+
// Hide once all work is effectively done:
21+
// - no active tasks at all, OR
22+
// - message is done and the only remaining active tasks are in_progress (no pending)
23+
$: hasActive =
24+
tasks.some((t) => t.status === 'pending' || t.status === 'in_progress') &&
25+
!(done && pendingCount === 0 && inProgressCount > 0);
1726
</script>
1827

1928
{#if tasks.length > 0 && hasActive}

0 commit comments

Comments
 (0)