Files
oh-my-pi/packages/coding-agent/src/modes/utils/interactive-context-helpers.ts
T
oldschoola 579ba6a1dc fix(tui): auto-hide thinking blocks when thinking level is off
Some providers (MiniMax, GLM, DeepSeek) return thinking blocks in
their responses even when reasoning is disabled — the model generates
thinking content regardless of the reasoning_effort parameter.

When the user sets thinking level to "off", they expect no thinking
content to be visible. Previously, thinking blocks would still appear
because the hideThinkingBlock setting was independent of the thinking
level and defaulted to false (show).

Fix: add effectiveHideThinkingBlock computed property that returns
true when hideThinkingBlock is true OR the session thinking level is
"off". All render paths (streaming, transcript rebuild, component
construction) now read the effective value instead of the raw setting.

The toggle (Ctrl+T) is guarded: when thinking is off, it shows a
status message ("Thinking is off — enable thinking to show blocks")
instead of silently no-op'ing or corrupting the persisted setting.

Fixes #626
2026-06-23 16:02:10 -07:00

28 lines
1007 B
TypeScript

/**
* Small helpers over {@link InteractiveModeContext} shared between
* {@link UiHelpers} and the input/event controllers, so the live chat surfaces
* construct components and reset editor state identically.
*/
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
import { AssistantMessageComponent } from "../components/assistant-message";
import type { InteractiveModeContext } from "../types";
/**
* Construct an {@link AssistantMessageComponent} wired to the live context's
* thinking/image settings. `message` is omitted for the streaming placeholder
* component and supplied when rendering a persisted turn.
*/
export function createAssistantMessageComponent(
ctx: InteractiveModeContext,
message?: AssistantMessage,
): AssistantMessageComponent {
return new AssistantMessageComponent(
message,
ctx.effectiveHideThinkingBlock,
() => ctx.ui.requestRender(),
ctx.viewSession.extensionRunner?.getAssistantThinkingRenderers(),
ctx.ui.imageBudget,
ctx.proseOnlyThinking,
);
}