From 2c38f7f1696aec218799427aa3a5038c35460da6 Mon Sep 17 00:00:00 2001 From: Chris Scott Date: Sun, 14 Dec 2025 18:33:43 -0500 Subject: [PATCH 1/9] Fix branch switching UI updates and simplify model display - Use setQueryData for immediate branch switch UI updates - Replace model selector with SessionStatusIndicator during active streams - Remove async model name fetching in favor of existing modelString --- .../src/components/message/PromptInput.tsx | 52 +++++++------------ .../src/components/repo/BranchSwitcher.tsx | 4 +- 2 files changed, 21 insertions(+), 35 deletions(-) diff --git a/frontend/src/components/message/PromptInput.tsx b/frontend/src/components/message/PromptInput.tsx index 18eda291..2a4c9daa 100644 --- a/frontend/src/components/message/PromptInput.tsx +++ b/frontend/src/components/message/PromptInput.tsx @@ -15,7 +15,8 @@ import { CommandSuggestions } from '@/components/command/CommandSuggestions' import { MentionSuggestions, type MentionItem } from './MentionSuggestions' import { SessionStatusIndicator } from '@/components/ui/session-status-indicator' import { detectMentionTrigger, parsePromptToParts, getFilename, filterAgentsByQuery } from '@/lib/promptParser' -import { getModel, formatModelName } from '@/api/providers' + + import type { components } from '@/api/opencode-types' import type { MessageWithParts, FileInfo } from '@/api/types' import { @@ -55,7 +56,7 @@ export function PromptInput({ onExportSession }: PromptInputProps) { const [prompt, setPrompt] = useState('') - const [modelName, setModelName] = useState('') + const [isBashMode, setIsBashMode] = useState(false) const [showSuggestions, setShowSuggestions] = useState(false) const [suggestionQuery, setSuggestionQuery] = useState('') @@ -452,33 +453,16 @@ export function PromptInput({ const modeColor = currentMode === 'plan' ? 'text-yellow-600 dark:text-yellow-500' : 'text-green-600 dark:text-green-500' const modeBg = currentMode === 'plan' ? 'bg-yellow-500/10 border-yellow-500/30' : 'bg-green-500/10 border-green-500/30' - const { model: selectedModel, modelString } = useModelSelection(opcodeUrl, directory) + const { modelString } = useModelSelection(opcodeUrl, directory) const currentModel = modelString || '' const isMobile = useMobile() const sessionStatus = useSessionStatusForSession(sessionID) const showStopButton = hasActiveStream && (sessionStatus.type === 'busy' || sessionStatus.type === 'retry') const hideSecondaryButtons = isMobile && hasActiveStream - useEffect(() => { - const loadModelName = async () => { - if (selectedModel) { - try { - const model = await getModel(selectedModel.providerID, selectedModel.modelID) - if (model) { - setModelName(formatModelName(model)) - } else { - setModelName(currentModel) - } - } catch { - setModelName(currentModel) - } - } else { - setModelName('No model selected') - } - } + - loadModelName() - }, [selectedModel, currentModel]) + useEffect(() => { if (textareaRef.current && !disabled) { @@ -490,11 +474,7 @@ export function PromptInput({ return (
- {hasActiveStream && ( -
- -
- )} +