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
2153 }2153 }
2154 }2154 }
2155 const title = truncateTitle(titleSeed);2155 const title = truncateTitle(titleSeed);
2156 let threadCreateModel = selectedModel;2156 let threadCreateModel: ModelSlug = selectedModel || (activeProject.model as ModelSlug) || DEFAULT_MODEL;
2157 if (!threadCreateModel) {
2158 threadCreateModel = activeProject.model;
2159 }
2160 if (!threadCreateModel) {
2161 threadCreateModel = DEFAULT_MODEL;
2162 }
2163 2157
2164 if (isLocalDraftThread) {2158 if (isLocalDraftThread) {
2165 await api.orchestration.dispatchCommand({2159 await api.orchestration.dispatchCommand({
@@ -2228,7 +2222,7 @@ export default function ChatView({ threadId }: ChatViewProps) { · 62 unmodified lines
2228 },2222 },
2229 model: selectedModel || undefined,2223 model: selectedModel || undefined,
2230 provider: selectedProvider,2224 provider: selectedProvider,
2231 ...(supportsReasoningEffort ? { effort: selectedEffort } : {}),2225 ...(supportsReasoningEffort && selectedEffort ? { effort: selectedEffort } : {}),
2232 assistantDeliveryMode: settings.enableAssistantStreaming ? "streaming" : "buffered",2226 assistantDeliveryMode: settings.enableAssistantStreaming ? "streaming" : "buffered",
2233 approvalPolicy,2227 approvalPolicy,
2234 sandboxMode,2228 sandboxMode,
@@ -2387,7 +2381,7 @@ export default function ChatView({ threadId }: ChatViewProps) { · 152 unmodified lines
2387 );2381 );
2388 const onEffortSelect = useCallback(2382 const onEffortSelect = useCallback(
2389 (effort: CodexReasoningEffort) => {2383 (effort: CodexReasoningEffort) => {
2390 setSelectedEffort(effort);2384 setComposerDraftEffort(threadId, effort);
2391 scheduleComposerFocus();2385 scheduleComposerFocus();
2392 },2386 },
2393 [scheduleComposerFocus, setComposerDraftEffort, threadId],2387 [scheduleComposerFocus, setComposerDraftEffort, threadId],
@@ -2850,11 +2844,13 @@ export default function ChatView({ threadId }: ChatViewProps) { · 456 unmodified lines
2850 <Separator orientation="vertical" className="mx-0.5 hidden h-4 sm:block" />2844 <Separator orientation="vertical" className="mx-0.5 hidden h-4 sm:block" />
2851 2845
2852 {/* Reasoning effort */}2846 {/* Reasoning effort */}
2853 <ReasoningEffortPicker2847 {selectedEffort != null && (
2854 effort={selectedEffort}2848 <ReasoningEffortPicker
2855 options={reasoningOptions}2849 effort={selectedEffort}
2856 onEffortChange={onEffortSelect}2850 options={reasoningOptions}
2857 />2851 onEffortChange={onEffortSelect}
2852 />
2853 )}
2858 </>2854 </>
2859 ) : null}2855 ) : null}
2860 2856
packages/contracts/src/orchestration.ts+1−0
@@ -348,6 +348,7 @@ export const ClientThreadTurnStartCommand = Schema.Struct({ · 347 unmodified lines
348 text: Schema.String,348 text: Schema.String,
349 attachments: Schema.Array(UploadChatAttachment),349 attachments: Schema.Array(UploadChatAttachment),
350 }),350 }),
351 provider: Schema.optional(ProviderKind),
351 model: Schema.optional(TrimmedNonEmptyString),352 model: Schema.optional(TrimmedNonEmptyString),
352 effort: Schema.optional(TrimmedNonEmptyString),353 effort: Schema.optional(TrimmedNonEmptyString),
353 assistantDeliveryMode: Schema.optional(AssistantDeliveryMode),354 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