History

Fix effort and provider handling in thread turn start

- Only include `effort` in start command when a value is selected - Persist effort selection via composer draft state and hide picker when unavailable - Add optional `provider` to `ClientThreadTurnStartCommand` - Simplify thread model fallback selection in `ChatView`

Julius Marminge committed 8 months ago

Commit feff8661 parent ad28eaa2 files · +11 −14Browse files

Unified · Split

2 files
  1. apps/web/src/components/ChatView.tsx +10 −14
  2. packages/contracts/src/orchestration.ts +1 −0
apps/web/src/components/ChatView.tsx+10−14
@@ -2153,13 +2153,7 @@ export default function ChatView({ threadId }: ChatViewProps) { · 2152 unmodified lines
21532153 }
21542154 }
21552155 const title = truncateTitle(titleSeed);
2156− let threadCreateModel = selectedModel;
2157− if (!threadCreateModel) {
2158− threadCreateModel = activeProject.model;
2159− }
2160− if (!threadCreateModel) {
2161− threadCreateModel = DEFAULT_MODEL;
2162− }
2156+ let threadCreateModel: ModelSlug = selectedModel || (activeProject.model as ModelSlug) || DEFAULT_MODEL;
21632157
21642158 if (isLocalDraftThread) {
21652159 await api.orchestration.dispatchCommand({
@@ -2228,7 +2222,7 @@ export default function ChatView({ threadId }: ChatViewProps) { · 62 unmodified lines
22282222 },
22292223 model: selectedModel || undefined,
22302224 provider: selectedProvider,
2231− ...(supportsReasoningEffort ? { effort: selectedEffort } : {}),
2225+ ...(supportsReasoningEffort && selectedEffort ? { effort: selectedEffort } : {}),
22322226 assistantDeliveryMode: settings.enableAssistantStreaming ? "streaming" : "buffered",
22332227 approvalPolicy,
22342228 sandboxMode,
@@ -2387,7 +2381,7 @@ export default function ChatView({ threadId }: ChatViewProps) { · 152 unmodified lines
23872381 );
23882382 const onEffortSelect = useCallback(
23892383 (effort: CodexReasoningEffort) => {
2390− setSelectedEffort(effort);
2384+ setComposerDraftEffort(threadId, effort);
23912385 scheduleComposerFocus();
23922386 },
23932387 [scheduleComposerFocus, setComposerDraftEffort, threadId],
@@ -2850,11 +2844,13 @@ export default function ChatView({ threadId }: ChatViewProps) { · 456 unmodified lines
28502844 <Separator orientation="vertical" className="mx-0.5 hidden h-4 sm:block" />
28512845
28522846 {/* Reasoning effort */}
2853− <ReasoningEffortPicker
2854− effort={selectedEffort}
2855− options={reasoningOptions}
2856− onEffortChange={onEffortSelect}
2857− />
2847+ {selectedEffort != null && (
2848+ <ReasoningEffortPicker
2849+ effort={selectedEffort}
2850+ options={reasoningOptions}
2851+ onEffortChange={onEffortSelect}
2852+ />
2853+ )}
28582854 </>
28592855 ) : null}
28602856
packages/contracts/src/orchestration.ts+1−0
@@ -348,6 +348,7 @@ export const ClientThreadTurnStartCommand = Schema.Struct({ · 347 unmodified lines
348348 text: Schema.String,
349349 attachments: Schema.Array(UploadChatAttachment),
350350 }),
351+ provider: Schema.optional(ProviderKind),
351352 model: Schema.optional(TrimmedNonEmptyString),
352353 effort: Schema.optional(TrimmedNonEmptyString),
353354 assistantDeliveryMode: Schema.optional(AssistantDeliveryMode),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t