mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-06 00:12:11 +00:00
fix(desktop): summary flicker
This commit is contained in:
parent
b75575884a
commit
09a399d8d6
1 changed files with 42 additions and 2 deletions
|
|
@ -246,6 +246,7 @@ export function SessionTurn(
|
||||||
retrySeconds: 0,
|
retrySeconds: 0,
|
||||||
status: rawStatus(),
|
status: rawStatus(),
|
||||||
duration: duration(),
|
duration: duration(),
|
||||||
|
summaryWaitTimedOut: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
|
|
@ -286,6 +287,44 @@ export function SessionTurn(
|
||||||
onCleanup(() => clearInterval(timer))
|
onCleanup(() => clearInterval(timer))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Reset summary wait timeout when session starts working
|
||||||
|
createEffect(() => {
|
||||||
|
if (working()) {
|
||||||
|
setStore("summaryWaitTimedOut", false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Set timeout when waiting for summary body (only when diffs are present)
|
||||||
|
createEffect(() => {
|
||||||
|
if (working() || !derived().isLastUserMessage) return
|
||||||
|
|
||||||
|
const diffs = message()?.summary?.diffs
|
||||||
|
if (!diffs?.length) return
|
||||||
|
if (summary()) return
|
||||||
|
if (store.summaryWaitTimedOut) return
|
||||||
|
|
||||||
|
const timer = setTimeout(() => {
|
||||||
|
setStore("summaryWaitTimedOut", true)
|
||||||
|
}, 6000)
|
||||||
|
onCleanup(() => clearTimeout(timer))
|
||||||
|
})
|
||||||
|
|
||||||
|
const waitingForSummary = createMemo(() => {
|
||||||
|
if (!derived().isLastUserMessage) return false
|
||||||
|
if (working()) return false
|
||||||
|
|
||||||
|
const diffs = message()?.summary?.diffs
|
||||||
|
if (!diffs?.length) return false
|
||||||
|
if (summary()) return false
|
||||||
|
|
||||||
|
return !store.summaryWaitTimedOut
|
||||||
|
})
|
||||||
|
|
||||||
|
const showSummarySection = createMemo(() => {
|
||||||
|
if (working()) return false
|
||||||
|
return !waitingForSummary()
|
||||||
|
})
|
||||||
|
|
||||||
let lastStatusChange = Date.now()
|
let lastStatusChange = Date.now()
|
||||||
let statusTimeout: number | undefined
|
let statusTimeout: number | undefined
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
|
|
@ -362,7 +401,7 @@ export function SessionTurn(
|
||||||
size="small"
|
size="small"
|
||||||
onClick={props.onStepsExpandedToggle ?? (() => {})}
|
onClick={props.onStepsExpandedToggle ?? (() => {})}
|
||||||
>
|
>
|
||||||
<Show when={working()}>
|
<Show when={working() || waitingForSummary()}>
|
||||||
<Spinner />
|
<Spinner />
|
||||||
</Show>
|
</Show>
|
||||||
<Switch>
|
<Switch>
|
||||||
|
|
@ -379,6 +418,7 @@ export function SessionTurn(
|
||||||
</span>
|
</span>
|
||||||
<span data-slot="session-turn-retry-attempt">(#{retry()?.attempt})</span>
|
<span data-slot="session-turn-retry-attempt">(#{retry()?.attempt})</span>
|
||||||
</Match>
|
</Match>
|
||||||
|
<Match when={waitingForSummary()}>Generating summary</Match>
|
||||||
<Match when={working()}>{store.status ?? "Considering next steps"}</Match>
|
<Match when={working()}>{store.status ?? "Considering next steps"}</Match>
|
||||||
<Match when={props.stepsExpanded}>Hide steps</Match>
|
<Match when={props.stepsExpanded}>Hide steps</Match>
|
||||||
<Match when={!props.stepsExpanded}>Show steps</Match>
|
<Match when={!props.stepsExpanded}>Show steps</Match>
|
||||||
|
|
@ -425,7 +465,7 @@ export function SessionTurn(
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
{/* Summary */}
|
{/* Summary */}
|
||||||
<Show when={!working()}>
|
<Show when={showSummarySection()}>
|
||||||
<div data-slot="session-turn-summary-section">
|
<div data-slot="session-turn-summary-section">
|
||||||
<div data-slot="session-turn-summary-header">
|
<div data-slot="session-turn-summary-header">
|
||||||
<Switch>
|
<Switch>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue