|
|
@@ -18,6 +18,7 @@ export class CodeIndexConfigManager {
|
|
|
private ollamaOptions?: ApiHandlerOptions
|
|
|
private openAiCompatibleOptions?: { baseUrl: string; apiKey: string }
|
|
|
private geminiOptions?: { apiKey: string }
|
|
|
+ private mistralOptions?: { apiKey: string }
|
|
|
private qdrantUrl?: string = "http://localhost:6333"
|
|
|
private qdrantApiKey?: string
|
|
|
private searchMinScore?: number
|
|
|
@@ -67,6 +68,7 @@ export class CodeIndexConfigManager {
|
|
|
const openAiCompatibleBaseUrl = codebaseIndexConfig.codebaseIndexOpenAiCompatibleBaseUrl ?? ""
|
|
|
const openAiCompatibleApiKey = this.contextProxy?.getSecret("codebaseIndexOpenAiCompatibleApiKey") ?? ""
|
|
|
const geminiApiKey = this.contextProxy?.getSecret("codebaseIndexGeminiApiKey") ?? ""
|
|
|
+ const mistralApiKey = this.contextProxy?.getSecret("codebaseIndexMistralApiKey") ?? ""
|
|
|
|
|
|
// Update instance variables with configuration
|
|
|
this.codebaseIndexEnabled = codebaseIndexEnabled ?? true
|
|
|
@@ -100,6 +102,8 @@ export class CodeIndexConfigManager {
|
|
|
this.embedderProvider = "openai-compatible"
|
|
|
} else if (codebaseIndexEmbedderProvider === "gemini") {
|
|
|
this.embedderProvider = "gemini"
|
|
|
+ } else if (codebaseIndexEmbedderProvider === "mistral") {
|
|
|
+ this.embedderProvider = "mistral"
|
|
|
} else {
|
|
|
this.embedderProvider = "openai"
|
|
|
}
|
|
|
@@ -119,6 +123,7 @@ export class CodeIndexConfigManager {
|
|
|
: undefined
|
|
|
|
|
|
this.geminiOptions = geminiApiKey ? { apiKey: geminiApiKey } : undefined
|
|
|
+ this.mistralOptions = mistralApiKey ? { apiKey: mistralApiKey } : undefined
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -135,6 +140,7 @@ export class CodeIndexConfigManager {
|
|
|
ollamaOptions?: ApiHandlerOptions
|
|
|
openAiCompatibleOptions?: { baseUrl: string; apiKey: string }
|
|
|
geminiOptions?: { apiKey: string }
|
|
|
+ mistralOptions?: { apiKey: string }
|
|
|
qdrantUrl?: string
|
|
|
qdrantApiKey?: string
|
|
|
searchMinScore?: number
|
|
|
@@ -153,6 +159,7 @@ export class CodeIndexConfigManager {
|
|
|
openAiCompatibleBaseUrl: this.openAiCompatibleOptions?.baseUrl ?? "",
|
|
|
openAiCompatibleApiKey: this.openAiCompatibleOptions?.apiKey ?? "",
|
|
|
geminiApiKey: this.geminiOptions?.apiKey ?? "",
|
|
|
+ mistralApiKey: this.mistralOptions?.apiKey ?? "",
|
|
|
qdrantUrl: this.qdrantUrl ?? "",
|
|
|
qdrantApiKey: this.qdrantApiKey ?? "",
|
|
|
}
|
|
|
@@ -176,6 +183,7 @@ export class CodeIndexConfigManager {
|
|
|
ollamaOptions: this.ollamaOptions,
|
|
|
openAiCompatibleOptions: this.openAiCompatibleOptions,
|
|
|
geminiOptions: this.geminiOptions,
|
|
|
+ mistralOptions: this.mistralOptions,
|
|
|
qdrantUrl: this.qdrantUrl,
|
|
|
qdrantApiKey: this.qdrantApiKey,
|
|
|
searchMinScore: this.currentSearchMinScore,
|
|
|
@@ -208,6 +216,11 @@ export class CodeIndexConfigManager {
|
|
|
const qdrantUrl = this.qdrantUrl
|
|
|
const isConfigured = !!(apiKey && qdrantUrl)
|
|
|
return isConfigured
|
|
|
+ } else if (this.embedderProvider === "mistral") {
|
|
|
+ const apiKey = this.mistralOptions?.apiKey
|
|
|
+ const qdrantUrl = this.qdrantUrl
|
|
|
+ const isConfigured = !!(apiKey && qdrantUrl)
|
|
|
+ return isConfigured
|
|
|
}
|
|
|
return false // Should not happen if embedderProvider is always set correctly
|
|
|
}
|
|
|
@@ -241,6 +254,7 @@ export class CodeIndexConfigManager {
|
|
|
const prevOpenAiCompatibleApiKey = prev?.openAiCompatibleApiKey ?? ""
|
|
|
const prevModelDimension = prev?.modelDimension
|
|
|
const prevGeminiApiKey = prev?.geminiApiKey ?? ""
|
|
|
+ const prevMistralApiKey = prev?.mistralApiKey ?? ""
|
|
|
const prevQdrantUrl = prev?.qdrantUrl ?? ""
|
|
|
const prevQdrantApiKey = prev?.qdrantApiKey ?? ""
|
|
|
|
|
|
@@ -277,6 +291,7 @@ export class CodeIndexConfigManager {
|
|
|
const currentOpenAiCompatibleApiKey = this.openAiCompatibleOptions?.apiKey ?? ""
|
|
|
const currentModelDimension = this.modelDimension
|
|
|
const currentGeminiApiKey = this.geminiOptions?.apiKey ?? ""
|
|
|
+ const currentMistralApiKey = this.mistralOptions?.apiKey ?? ""
|
|
|
const currentQdrantUrl = this.qdrantUrl ?? ""
|
|
|
const currentQdrantApiKey = this.qdrantApiKey ?? ""
|
|
|
|
|
|
@@ -295,6 +310,14 @@ export class CodeIndexConfigManager {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
+ if (prevGeminiApiKey !== currentGeminiApiKey) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ if (prevMistralApiKey !== currentMistralApiKey) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
// Check for model dimension changes (generic for all providers)
|
|
|
if (prevModelDimension !== currentModelDimension) {
|
|
|
return true
|
|
|
@@ -351,6 +374,7 @@ export class CodeIndexConfigManager {
|
|
|
ollamaOptions: this.ollamaOptions,
|
|
|
openAiCompatibleOptions: this.openAiCompatibleOptions,
|
|
|
geminiOptions: this.geminiOptions,
|
|
|
+ mistralOptions: this.mistralOptions,
|
|
|
qdrantUrl: this.qdrantUrl,
|
|
|
qdrantApiKey: this.qdrantApiKey,
|
|
|
searchMinScore: this.currentSearchMinScore,
|