Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions components/task-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ export function TaskForm({
maxSandboxDuration = 300,
}: TaskFormProps) {
const [prompt, setPrompt] = useAtom(taskPromptAtom)
const [savedAgent, setSavedAgent] = useAtom(lastSelectedAgentAtom)
const [selectedAgent, setSelectedAgent] = useState(savedAgent || 'claude')
const [selectedAgent, setSelectedAgent] = useAtom(lastSelectedAgentAtom)
const [selectedModel, setSelectedModel] = useState<string>(DEFAULT_MODELS.claude)
const [selectedModels, setSelectedModels] = useState<string[]>([])
const [repos, setRepos] = useAtom(githubReposAtomFamily(selectedOwner))
Expand Down Expand Up @@ -235,11 +234,9 @@ export function TaskForm({
setSelectedModel(urlModel)
}
}
} else if (savedAgent) {
// Fall back to saved agent from Jotai atom
if (CODING_AGENTS.some((agent) => agent.value === savedAgent && !('isDivider' in agent && agent.isDivider))) {
setSelectedAgent(savedAgent)
}
} else if (selectedAgent === null) {
// Initialize with default agent only if explicitly null (never set before)
setSelectedAgent('claude')
}

// Options are now initialized from server props, no need to load from cookies
Expand All @@ -252,7 +249,7 @@ export function TaskForm({
}, [])

// Get saved model atom for current agent
const savedModelAtom = lastSelectedModelAtomFamily(selectedAgent)
const savedModelAtom = lastSelectedModelAtomFamily(selectedAgent || 'claude')
const savedModel = useAtomValue(savedModelAtom)
const setSavedModel = useSetAtom(savedModelAtom)

Expand Down Expand Up @@ -326,7 +323,7 @@ export function TaskForm({
onSubmit({
prompt: prompt.trim(),
repoUrl: '',
selectedAgent,
selectedAgent: selectedAgent || 'claude',
selectedModel,
selectedModels: selectedAgent === 'multi-agent' ? selectedModels : undefined,
installDependencies,
Expand Down Expand Up @@ -370,7 +367,7 @@ export function TaskForm({
onSubmit({
prompt: prompt.trim(),
repoUrl: selectedRepoData?.clone_url || '',
selectedAgent,
selectedAgent: selectedAgent || 'claude',
selectedModel,
selectedModels: selectedAgent === 'multi-agent' ? selectedModels : undefined,
installDependencies,
Expand Down Expand Up @@ -430,11 +427,9 @@ export function TaskForm({
<div className="flex items-center gap-2 flex-1 min-w-0">
{/* Agent Selection - Icon only on mobile, minimal width */}
<Select
value={selectedAgent}
value={selectedAgent || 'claude'}
onValueChange={(value) => {
setSelectedAgent(value)
// Save to Jotai atom immediately
setSavedAgent(value)
}}
disabled={isSubmitting}
>
Expand Down
Loading