Skip to content

Commit 90bc192

Browse files
committed
🤖 fix: restore model favorites in ChatInput
The ORPC migration PR accidentally removed the model favorites integration from ChatInput. Restored: - defaultModel and setDefaultModel from useModelLRU() - useEffect to reset model to default when entering creation mode - defaultModel and onSetDefaultModel props passed to ModelSelector
1 parent 470e4eb commit 90bc192

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/browser/components/ChatInput/index.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
140140
const inputRef = useRef<HTMLTextAreaElement>(null);
141141
const modelSelectorRef = useRef<ModelSelectorRef>(null);
142142
const [mode, setMode] = useMode();
143-
const { recentModels, addModel, evictModel } = useModelLRU();
143+
const { recentModels, addModel, evictModel, defaultModel, setDefaultModel } = useModelLRU();
144144
const commandListId = useId();
145145
const telemetry = useTelemetry();
146146
const [vimEnabled, setVimEnabled] = usePersistedState<boolean>(VIM_ENABLED_KEY, false, {
@@ -178,6 +178,16 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
178178
[storageKeys.modelKey, addModel]
179179
);
180180

181+
182+
// When entering creation mode (or when the default model changes), reset the
183+
// project-scoped model to the explicit default so manual picks don't bleed
184+
// into subsequent creation flows.
185+
useEffect(() => {
186+
if (variant === "creation" && defaultModel) {
187+
updatePersistedState(storageKeys.modelKey, defaultModel);
188+
}
189+
}, [variant, defaultModel, storageKeys.modelKey]);
190+
181191
// Creation-specific state (hook always called, but only used when variant === "creation")
182192
// This avoids conditional hook calls which violate React rules
183193
const creationState = useCreationWorkspace(
@@ -972,6 +982,8 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
972982
recentModels={recentModels}
973983
onRemoveModel={evictModel}
974984
onComplete={() => inputRef.current?.focus()}
985+
defaultModel={defaultModel}
986+
onSetDefaultModel={setDefaultModel}
975987
/>
976988
<TooltipWrapper inline>
977989
<HelpIndicator>?</HelpIndicator>

0 commit comments

Comments
 (0)