@@ -12,15 +12,13 @@ import {
1212 moonshotModels ,
1313 geminiDefaultModelId ,
1414 geminiModels ,
15- legacyGeminiModels ,
1615 mistralDefaultModelId ,
1716 mistralModels ,
1817 openAiModelInfoSaneDefaults ,
1918 openAiNativeDefaultModelId ,
2019 openAiNativeModels ,
2120 vertexDefaultModelId ,
2221 vertexModels ,
23- legacyVertexModels ,
2422 xaiDefaultModelId ,
2523 xaiModels ,
2624 groqModels ,
@@ -40,6 +38,8 @@ import {
4038 sambaNovaDefaultModelId ,
4139 doubaoModels ,
4240 doubaoDefaultModelId ,
41+ mapLegacyGeminiModel ,
42+ mapLegacyVertexModel ,
4343} from "@roo-code/types"
4444
4545import type { ModelRecord , RouterModels } from "@roo/api"
@@ -48,98 +48,6 @@ import { useRouterModels } from "./useRouterModels"
4848import { useOpenRouterModelProviders } from "./useOpenRouterModelProviders"
4949import { useLmStudioModels } from "./useLmStudioModels"
5050
51- /**
52- * Maps legacy Gemini model IDs to current supported models
53- */
54- function mapLegacyGeminiModel ( modelId : string ) : string {
55- if ( modelId in geminiModels ) {
56- return modelId
57- }
58-
59- if ( modelId in legacyGeminiModels ) {
60- if ( modelId . startsWith ( "gemini-2.5-pro-preview-" ) ) {
61- return "gemini-2.5-pro"
62- }
63-
64- if ( modelId . startsWith ( "gemini-1.5-pro-" ) ) {
65- return geminiDefaultModelId
66- }
67-
68- if ( modelId . startsWith ( "gemini-1.5-flash-" ) ) {
69- return geminiDefaultModelId
70- }
71-
72- if ( modelId . startsWith ( "gemini-2.5-pro-exp-" ) ) {
73- return "gemini-2.5-pro"
74- }
75-
76- if ( modelId === "gemini-exp-1206" ) {
77- return geminiDefaultModelId
78- }
79-
80- if ( modelId === "gemini-2.0-pro-exp-02-05" ) {
81- return "gemini-2.5-pro"
82- }
83-
84- if (
85- modelId === "gemini-2.0-flash-thinking-exp-1219" ||
86- modelId === "gemini-2.0-flash-thinking-exp-01-21" ||
87- modelId === "gemini-2.5-flash-preview-04-17" ||
88- modelId === "gemini-2.5-flash-preview-04-17:thinking"
89- ) {
90- return "gemini-2.5-flash-preview-05-20"
91- }
92-
93- if ( modelId === "gemini-2.0-flash-exp" ) {
94- return geminiDefaultModelId
95- }
96- }
97-
98- return geminiDefaultModelId
99- }
100-
101- /**
102- * Maps legacy Vertex model IDs to current supported models
103- */
104- function mapLegacyVertexModel ( modelId : string ) : string {
105- if ( modelId in vertexModels ) {
106- return modelId
107- }
108-
109- if ( modelId in legacyVertexModels ) {
110- if ( modelId . startsWith ( "gemini-2.5-pro-preview-" ) ) {
111- return "gemini-2.5-pro"
112- }
113-
114- if ( modelId . startsWith ( "gemini-1.5-pro-" ) ) {
115- return "gemini-2.0-flash-001"
116- }
117-
118- if ( modelId . startsWith ( "gemini-1.5-flash-" ) ) {
119- return "gemini-2.0-flash-001"
120- }
121-
122- if ( modelId . startsWith ( "gemini-2.5-pro-exp-" ) ) {
123- return "gemini-2.5-pro"
124- }
125-
126- if ( modelId === "gemini-2.0-pro-exp-02-05" ) {
127- return "gemini-2.5-pro"
128- }
129-
130- if (
131- modelId === "gemini-2.0-flash-thinking-exp-1219" ||
132- modelId === "gemini-2.0-flash-thinking-exp-01-21" ||
133- modelId === "gemini-2.5-flash-preview-04-17" ||
134- modelId === "gemini-2.5-flash-preview-04-17:thinking"
135- ) {
136- return "gemini-2.5-flash-preview-05-20"
137- }
138- }
139-
140- return vertexDefaultModelId
141- }
142-
14351export const useSelectedModel = ( apiConfiguration ?: ProviderSettings ) => {
14452 const provider = apiConfiguration ?. apiProvider || "anthropic"
14553 const openRouterModelId = provider === "openrouter" ? apiConfiguration ?. openRouterModelId : undefined
0 commit comments