feat: add Vertex AI as embedder provider for codebase indexing

- Add "vertex" to EmbedderProvider type
- Add Vertex AI embedding models (text-embedding-004, text-multilingual-embedding-002, etc.)
- Create VertexEmbedder implementation using OpenAI-compatible approach
- Update service factory to handle vertex provider
- Add vertexOptions to CodeIndexConfig interface
- Update CodeIndexPopover UI to include Vertex AI section
- Add translation keys for Vertex AI
- Add comprehensive tests for VertexEmbedder
- Update type definitions to include vertex in codebaseIndexModels

Closes #6300
This commit is contained in:
Roo Code 2025-07-28 16:44:52 +00:00
parent 1819bd1c39
commit a1c10fe380
3 changed files with 7 additions and 2 deletions

View file

@ -21,7 +21,9 @@ export const CODEBASE_INDEX_DEFAULTS = {
export const codebaseIndexConfigSchema = z.object({
codebaseIndexEnabled: z.boolean().optional(),
codebaseIndexQdrantUrl: z.string().optional(),
codebaseIndexEmbedderProvider: z.enum(["openai", "ollama", "openai-compatible", "gemini", "mistral"]).optional(),
codebaseIndexEmbedderProvider: z
.enum(["openai", "ollama", "openai-compatible", "gemini", "mistral", "vertex"])
.optional(),
codebaseIndexEmbedderBaseUrl: z.string().optional(),
codebaseIndexEmbedderModelId: z.string().optional(),
codebaseIndexEmbedderModelDimension: z.number().optional(),
@ -48,6 +50,7 @@ export const codebaseIndexModelsSchema = z.object({
"openai-compatible": z.record(z.string(), z.object({ dimension: z.number() })).optional(),
gemini: z.record(z.string(), z.object({ dimension: z.number() })).optional(),
mistral: z.record(z.string(), z.object({ dimension: z.number() })).optional(),
vertex: z.record(z.string(), z.object({ dimension: z.number() })).optional(),
})
export type CodebaseIndexModels = z.infer<typeof codebaseIndexModelsSchema>
@ -64,6 +67,7 @@ export const codebaseIndexProviderSchema = z.object({
codebaseIndexOpenAiCompatibleModelDimension: z.number().optional(),
codebaseIndexGeminiApiKey: z.string().optional(),
codebaseIndexMistralApiKey: z.string().optional(),
codebaseIndexVertexApiKey: z.string().optional(),
})
export type CodebaseIndexProvider = z.infer<typeof codebaseIndexProviderSchema>

View file

@ -184,6 +184,7 @@ export const SECRET_STATE_KEYS = [
"codebaseIndexOpenAiCompatibleApiKey",
"codebaseIndexGeminiApiKey",
"codebaseIndexMistralApiKey",
"codebaseIndexVertexApiKey",
"huggingFaceApiKey",
] as const satisfies readonly (keyof ProviderSettings)[]
export type SecretState = Pick<ProviderSettings, (typeof SECRET_STATE_KEYS)[number]>

View file

@ -232,7 +232,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
codebaseIndexSearchMaxResults: undefined,
codebaseIndexSearchMinScore: undefined,
},
codebaseIndexModels: { ollama: {}, openai: {} },
codebaseIndexModels: { ollama: {}, openai: {}, vertex: {} },
alwaysAllowUpdateTodoList: true,
includeDiagnosticMessages: true,
maxDiagnosticMessages: 50,