mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
fix: sync model picker search terms with selected models
Added useEffect hooks to GlamaModelPicker, OpenAiModelPicker, and OpenRouterModelPicker components to ensure the search term stays synchronized with the selected model ID from apiConfiguration. This prevents the search term from getting out of sync when the model is changed.
This commit is contained in:
@@ -37,6 +37,15 @@ const GlamaModelPicker: React.FC = () => {
|
|||||||
return normalizeApiConfiguration(apiConfiguration)
|
return normalizeApiConfiguration(apiConfiguration)
|
||||||
}, [apiConfiguration])
|
}, [apiConfiguration])
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (apiConfiguration?.glamaModelId) {
|
||||||
|
if (apiConfiguration?.glamaModelId !== searchTerm) {
|
||||||
|
setSearchTerm(apiConfiguration?.glamaModelId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [apiConfiguration, searchTerm])
|
||||||
|
|
||||||
useMount(() => {
|
useMount(() => {
|
||||||
vscode.postMessage({ type: "refreshGlamaModels" })
|
vscode.postMessage({ type: "refreshGlamaModels" })
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -28,6 +28,14 @@ const OpenAiModelPicker: React.FC = () => {
|
|||||||
setSearchTerm(newModelId)
|
setSearchTerm(newModelId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (apiConfiguration?.openAiModelId) {
|
||||||
|
if (apiConfiguration?.openAiModelId !== searchTerm) {
|
||||||
|
setSearchTerm(apiConfiguration?.openAiModelId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [apiConfiguration, searchTerm])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!apiConfiguration?.openAiBaseUrl || !apiConfiguration?.openAiApiKey) {
|
if (!apiConfiguration?.openAiBaseUrl || !apiConfiguration?.openAiApiKey) {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -37,6 +37,14 @@ const OpenRouterModelPicker: React.FC = () => {
|
|||||||
return normalizeApiConfiguration(apiConfiguration)
|
return normalizeApiConfiguration(apiConfiguration)
|
||||||
}, [apiConfiguration])
|
}, [apiConfiguration])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (apiConfiguration?.openRouterModelId) {
|
||||||
|
if (apiConfiguration?.openRouterModelId !== searchTerm) {
|
||||||
|
setSearchTerm(apiConfiguration?.openRouterModelId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [apiConfiguration, searchTerm])
|
||||||
|
|
||||||
useMount(() => {
|
useMount(() => {
|
||||||
vscode.postMessage({ type: "refreshOpenRouterModels" })
|
vscode.postMessage({ type: "refreshOpenRouterModels" })
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user