From 1cbff3b71ae883a1499b1fee050331b525415a85 Mon Sep 17 00:00:00 2001 From: Lakshmi Tanmay Date: Fri, 30 Oct 2026 10:47:48 +0530 Subject: [PATCH 1/3] fix(web): keep unselected thinking controls visible --- .../client-runtime/src/modelTraits.test.ts | 35 +++++++++++++++++++ packages/client-runtime/src/modelTraits.ts | 4 +-- 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 packages/client-runtime/src/modelTraits.test.ts diff --git a/packages/client-runtime/src/modelTraits.test.ts b/packages/client-runtime/src/modelTraits.test.ts new file mode 100644 index 0000000000000..5e1e68c3634cb --- /dev/null +++ b/packages/client-runtime/src/modelTraits.test.ts @@ -0,0 +1,35 @@ +import { ProviderDriverKind, type ProviderOptionDescriptor } from "@t3tools/contracts"; +import { describe, expect, it } from "vite-plus/test"; + +import { buildTraitsTriggerDisplay, getDescriptorStringValue } from "./modelTraits.ts"; + +describe("buildTraitsTriggerDisplay", () => { + it.each([ + { currentValue: undefined, defaultValue: undefined, value: null, label: "Thinking" }, + { currentValue: undefined, defaultValue: "high", value: "high", label: "High" }, + { currentValue: "low", defaultValue: undefined, value: "low", label: "Low" }, + { currentValue: "max", defaultValue: "high", value: "max", label: "Max" }, + ])("labels Pi thinking without inventing a selection: $label ($value)", (input) => { + const descriptor: Extract = { + id: "thinking", + label: "Thinking", + type: "select", + options: ["low", "high", "max"].map((id) => ({ + id, + label: id[0]!.toUpperCase() + id.slice(1), + ...(id === input.defaultValue ? { isDefault: true } : {}), + })), + ...(input.currentValue ? { currentValue: input.currentValue } : {}), + }; + + expect( + buildTraitsTriggerDisplay({ + provider: ProviderDriverKind.make("pi"), + descriptors: [descriptor], + primarySelectDescriptorId: descriptor.id, + ultrathinkPromptControlled: false, + }).label, + ).toBe(input.label); + expect(getDescriptorStringValue(descriptor)).toBe(input.value); + }); +}); diff --git a/packages/client-runtime/src/modelTraits.ts b/packages/client-runtime/src/modelTraits.ts index 9a3dc06a15173..c31d1820cc5cb 100644 --- a/packages/client-runtime/src/modelTraits.ts +++ b/packages/client-runtime/src/modelTraits.ts @@ -169,11 +169,11 @@ export function buildTraitsTriggerDisplay(input: { ? "Ultrathink" : descriptor.type === "boolean" ? `${descriptor.label} ${descriptor.currentValue === true ? "On" : "Off"}` - : getProviderOptionCurrentLabel( + : (getProviderOptionCurrentLabel( descriptor, input.modelSelection, input.reportedModelSelection, - ); + ) ?? (REASONING_SELECT_DESCRIPTOR_IDS.has(descriptor.id) ? descriptor.label : null)); if (typeof label === "string" && label.length > 0) { if (reasoningLabelIndex === -1 && isReasoningSelect(descriptor)) { reasoningLabelIndex = labels.length; From b199e363b016c8333075456331454507ca48422c Mon Sep 17 00:00:00 2001 From: maria-rcks Date: Sat, 31 Oct 2026 01:13:14 +0000 Subject: [PATCH 2/3] fix(web): limit the empty trait label fallback to thinking --- packages/client-runtime/src/modelTraits.test.ts | 3 ++- packages/client-runtime/src/modelTraits.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/client-runtime/src/modelTraits.test.ts b/packages/client-runtime/src/modelTraits.test.ts index 5e1e68c3634cb..67b22e3099464 100644 --- a/packages/client-runtime/src/modelTraits.test.ts +++ b/packages/client-runtime/src/modelTraits.test.ts @@ -9,9 +9,10 @@ describe("buildTraitsTriggerDisplay", () => { { currentValue: undefined, defaultValue: "high", value: "high", label: "High" }, { currentValue: "low", defaultValue: undefined, value: "low", label: "Low" }, { currentValue: "max", defaultValue: "high", value: "max", label: "Max" }, + { id: "effort", currentValue: undefined, defaultValue: undefined, value: null, label: "" }, ])("labels Pi thinking without inventing a selection: $label ($value)", (input) => { const descriptor: Extract = { - id: "thinking", + id: input.id ?? "thinking", label: "Thinking", type: "select", options: ["low", "high", "max"].map((id) => ({ diff --git a/packages/client-runtime/src/modelTraits.ts b/packages/client-runtime/src/modelTraits.ts index c31d1820cc5cb..3782b79e567f8 100644 --- a/packages/client-runtime/src/modelTraits.ts +++ b/packages/client-runtime/src/modelTraits.ts @@ -173,7 +173,7 @@ export function buildTraitsTriggerDisplay(input: { descriptor, input.modelSelection, input.reportedModelSelection, - ) ?? (REASONING_SELECT_DESCRIPTOR_IDS.has(descriptor.id) ? descriptor.label : null)); + ) ?? (descriptor.id === "thinking" ? descriptor.label : null)); if (typeof label === "string" && label.length > 0) { if (reasoningLabelIndex === -1 && isReasoningSelect(descriptor)) { reasoningLabelIndex = labels.length; From 097486060052801fba19b9e8f56553755212863b Mon Sep 17 00:00:00 2001 From: maria-rcks Date: Sun, 1 Nov 2026 07:10:38 +0000 Subject: [PATCH 3/3] fix(web): show unset thinking in the composer model control --- apps/web/src/components/chat/ComposerModelEffort.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/chat/ComposerModelEffort.tsx b/apps/web/src/components/chat/ComposerModelEffort.tsx index 35fd11c98be7c..10a4f7fa91892 100644 --- a/apps/web/src/components/chat/ComposerModelEffort.tsx +++ b/apps/web/src/components/chat/ComposerModelEffort.tsx @@ -130,7 +130,11 @@ export function describeComposerEffort( ? `${reasoning.label} ${reasoning.currentValue === true ? "On" : "Off"}` : ultrathink ? "Ultrathink" - : getProviderOptionCurrentLabel(reasoning, modelSelection, traits.reportedModelSelection); + : (getProviderOptionCurrentLabel( + reasoning, + modelSelection, + traits.reportedModelSelection, + ) ?? (reasoning.id === "thinking" ? reasoning.label : null)); const fast = display.speedLabel === "Fast" || display.speedLabel === "Ultrafast"; // Agent options such as modes live in the picker; the trigger adds only the context window. const contextWindow =