Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2816191
fix: creating a list of legacy Gemini models in both gemini.ts and ve…
HahaBill Jul 20, 2025
5f326c4
fix: progressive migration to new Gemini naming conventions on both f…
HahaBill Jul 20, 2025
6dab2cd
fix: gemini-1.5 and gemini-exp to be migrated to geminiDefaultModelId
HahaBill Jul 20, 2025
3122b41
fix: making changes based on the AI code reviewer
HahaBill Jul 20, 2025
642507e
fix: updating unit tests
HahaBill Jul 20, 2025
6c7f188
Merge branch 'RooCodeInc:main' into i/update-gemini-and-vertex-models
HahaBill Jul 21, 2025
c45802b
fix: adding more migration changes and unit tests
HahaBill Jul 24, 2025
136ff00
Merge branch 'RooCodeInc:main' into i/update-gemini-and-vertex-models
HahaBill Jul 24, 2025
43f10e3
fix: adding mapping on the frontend-side
HahaBill Jul 24, 2025
7f81d79
Merge branch 'i/update-gemini-and-vertex-models' of https://github.co…
HahaBill Jul 24, 2025
1a4a7a5
fix: updaing model id for existing unit tests and handling gemini-2.5…
HahaBill Jul 24, 2025
2f2df3f
fix: updating existing unit tests
HahaBill Jul 24, 2025
832d298
fix: updating the existing test to adapt to from
HahaBill Jul 25, 2025
a4f25a2
Merge branch 'RooCodeInc:main' into i/update-gemini-and-vertex-models
HahaBill Jul 27, 2025
9975e3e
Merge branch 'main' into i/update-gemini-and-vertex-models
HahaBill Jul 27, 2025
6530965
Merge branch 'RooCodeInc:main' into i/update-gemini-and-vertex-models
HahaBill Jul 31, 2025
9a1bc43
fix: remove duplicated function and tested the functionality in debug…
HahaBill Jul 31, 2025
ffb42ca
fix: preventing dirty state for Gemini naming convention migration
HahaBill Aug 1, 2025
fa7cd5d
Merge branch 'RooCodeInc:main' into i/update-gemini-and-vertex-models
HahaBill Aug 1, 2025
2d11ee3
fix: persistently storing new Gemini migrations
HahaBill Aug 1, 2025
f5c5590
Merge branch 'main' into i/update-gemini-and-vertex-models
HahaBill Aug 4, 2025
02874b5
Merge branch 'RooCodeInc:main' into i/update-gemini-and-vertex-models
HahaBill Aug 7, 2025
e053aad
Merge branch 'RooCodeInc:main' into i/update-gemini-and-vertex-models
HahaBill Aug 9, 2025
bf7a637
Merge branch 'RooCodeInc:main' into i/update-gemini-and-vertex-models
HahaBill Aug 12, 2025
07179ba
Merge branch 'RooCodeInc:main' into i/update-gemini-and-vertex-models
HahaBill Aug 19, 2025
432abe3
Merge branch 'RooCodeInc:main' into i/update-gemini-and-vertex-models
HahaBill Aug 23, 2025
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
57 changes: 45 additions & 12 deletions webview-ui/src/components/settings/SettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,38 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
})
}, [])

const handleLegacyGeminiModelMapping = useCallback(
<K extends keyof ProviderSettings>(
field: K,
previousValue: ProviderSettings[K],
value: ProviderSettings[K],
provider: string | undefined,
updatedApiConfiguration: ProviderSettings,
): boolean => {
if (field !== "apiModelId" || typeof previousValue !== "string" || typeof value !== "string") {
return false
}

let isLegacyMapping = false
if (provider === "gemini") {
isLegacyMapping = mapLegacyGeminiModel(previousValue) === value
} else if (provider === "vertex") {
isLegacyMapping = mapLegacyVertexModel(previousValue) === value
}

if (isLegacyMapping && currentApiConfigName) {
vscode.postMessage({
type: "upsertApiConfiguration",
text: currentApiConfigName,
apiConfiguration: updatedApiConfiguration,
})
}

return isLegacyMapping
},
[currentApiConfigName],
)

Comment on lines +222 to +253
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new change that I did, I realised that it wasn't persistently stored. We don't need the legacy mapping in gemini.ts anymore but we can leave it there just for the extra security.

Overall: we should have a clean ap state now with migrations being persistently stored with doing upsert

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new change that I did, I realised that it wasn't persistently stored. We don't need the legacy mapping in gemini.ts anymore but we can leave it there just for the extra security.

Overall: we should have a clean app state now with migrations being persistently stored with doing upsert

const setApiConfigurationField = useCallback(
<K extends keyof ProviderSettings>(field: K, value: ProviderSettings[K]) => {
setCachedState((prevState) => {
Expand All @@ -232,23 +264,24 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
// This prevents the dirty state when the component initializes and auto-syncs the model ID
const isInitialSync = previousValue === undefined && value !== undefined

let isLegacyGeminiMapping = false
if (field === "apiModelId" && typeof previousValue === "string" && typeof value === "string") {
const provider = prevState.apiConfiguration?.apiProvider
if (provider === "gemini") {
isLegacyGeminiMapping = mapLegacyGeminiModel(previousValue) === value
} else if (provider === "vertex") {
isLegacyGeminiMapping = mapLegacyVertexModel(previousValue) === value
}
}
const updatedApiConfiguration = { ...prevState.apiConfiguration, [field]: value }

const isLegacyMapping = handleLegacyGeminiModelMapping(
field,
previousValue,
value,
prevState.apiConfiguration?.apiProvider,
updatedApiConfiguration,
)

if (!isInitialSync && !isLegacyGeminiMapping) {
if (!isInitialSync && !isLegacyMapping) {
setChangeDetected(true)
}
return { ...prevState, apiConfiguration: { ...prevState.apiConfiguration, [field]: value } }

return { ...prevState, apiConfiguration: updatedApiConfiguration }
})
},
[],
[handleLegacyGeminiModelMapping],
)

const setExperimentEnabled: SetExperimentEnabled = useCallback((id: ExperimentId, enabled: boolean) => {
Expand Down