Skip to content

Commit 76e080b

Browse files
committed
wip: desktop work
1 parent ffc889b commit 76e080b

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

packages/desktop/src/pages/index.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,17 @@ export default function Page() {
588588
const parts = createMemo(() => sync.data.part[message.id])
589589
const title = createMemo(() => message.summary?.title)
590590
const summary = createMemo(() => message.summary?.body)
591+
const diffs = createMemo(() => message.summary?.diffs ?? [])
591592
const assistantMessages = createMemo(() => {
592593
return sync.data.message[activeSession().id]?.filter(
593594
(m) => m.role === "assistant" && m.parentID == message.id,
594595
) as AssistantMessageType[]
595596
})
597+
const hasToolPart = createMemo(() =>
598+
assistantMessages()
599+
?.flatMap((m) => sync.data.part[m.id])
600+
.some((p) => p.type === "tool"),
601+
)
596602
const working = createMemo(() => !summary())
597603
createEffect(() => {
598604
setTimeout(() => setInitialized(!!title()), 10_000)
@@ -619,11 +625,16 @@ export default function Page() {
619625
<Show when={!working()}>
620626
<div class="w-full flex flex-col gap-6 items-start self-stretch">
621627
<div class="flex flex-col items-start gap-1 self-stretch">
622-
<h2 class="text-12-medium text-text-weak">Summary</h2>
628+
<h2 class="text-12-medium text-text-weak">
629+
<Switch>
630+
<Match when={diffs().length}>Summary</Match>
631+
<Match when={true}>Response</Match>
632+
</Switch>
633+
</h2>
623634
<Show when={summary()}>{(summary) => <Markdown text={summary()} />}</Show>
624635
</div>
625636
<Accordion class="w-full" multiple>
626-
<For each={message.summary?.diffs || []}>
637+
<For each={diffs()}>
627638
{(diff) => (
628639
<Accordion.Item value={diff.file}>
629640
<Accordion.Header>
@@ -676,7 +687,7 @@ export default function Page() {
676687
<Match when={working()}>
677688
<MessageProgress assistantMessages={assistantMessages} />
678689
</Match>
679-
<Match when={!working()}>
690+
<Match when={!working() && hasToolPart()}>
680691
<Collapsible variant="ghost" open={expanded()} onOpenChange={setExpanded}>
681692
<Collapsible.Trigger class="text-text-weak hover:text-text-strong">
682693
<div class="flex items-center gap-1 self-stretch">

0 commit comments

Comments
 (0)