Skip to content

Commit d6d646f

Browse files
committed
refactor: streamline configuration change checks in CodeIndexConfigManager
1 parent 3065ef0 commit d6d646f

File tree

1 file changed

+37
-38
lines changed

1 file changed

+37
-38
lines changed

src/services/code-index/config-manager.ts

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -256,50 +256,49 @@ export class CodeIndexConfigManager {
256256

257257
// 4. CRITICAL CHANGES - Always restart for these
258258
// Since feature is always enabled, we always check for critical changes
259-
{
260-
// Provider change
261-
if (prevProvider !== this.embedderProvider) {
262-
return true
263-
}
264259

265-
// Authentication changes (API keys)
266-
const currentOpenAiKey = this.openAiOptions?.openAiNativeApiKey ?? ""
267-
const currentOllamaBaseUrl = this.ollamaOptions?.ollamaBaseUrl ?? ""
268-
const currentOpenAiCompatibleBaseUrl = this.openAiCompatibleOptions?.baseUrl ?? ""
269-
const currentOpenAiCompatibleApiKey = this.openAiCompatibleOptions?.apiKey ?? ""
270-
const currentModelDimension = this.modelDimension
271-
const currentGeminiApiKey = this.geminiOptions?.apiKey ?? ""
272-
const currentQdrantUrl = this.qdrantUrl ?? ""
273-
const currentQdrantApiKey = this.qdrantApiKey ?? ""
274-
275-
if (prevOpenAiKey !== currentOpenAiKey) {
276-
return true
277-
}
260+
// Provider change
261+
if (prevProvider !== this.embedderProvider) {
262+
return true
263+
}
278264

279-
if (prevOllamaBaseUrl !== currentOllamaBaseUrl) {
280-
return true
281-
}
265+
// Authentication changes (API keys)
266+
const currentOpenAiKey = this.openAiOptions?.openAiNativeApiKey ?? ""
267+
const currentOllamaBaseUrl = this.ollamaOptions?.ollamaBaseUrl ?? ""
268+
const currentOpenAiCompatibleBaseUrl = this.openAiCompatibleOptions?.baseUrl ?? ""
269+
const currentOpenAiCompatibleApiKey = this.openAiCompatibleOptions?.apiKey ?? ""
270+
const currentModelDimension = this.modelDimension
271+
const currentGeminiApiKey = this.geminiOptions?.apiKey ?? ""
272+
const currentQdrantUrl = this.qdrantUrl ?? ""
273+
const currentQdrantApiKey = this.qdrantApiKey ?? ""
274+
275+
if (prevOpenAiKey !== currentOpenAiKey) {
276+
return true
277+
}
282278

283-
if (
284-
prevOpenAiCompatibleBaseUrl !== currentOpenAiCompatibleBaseUrl ||
285-
prevOpenAiCompatibleApiKey !== currentOpenAiCompatibleApiKey
286-
) {
287-
return true
288-
}
279+
if (prevOllamaBaseUrl !== currentOllamaBaseUrl) {
280+
return true
281+
}
289282

290-
// Check for model dimension changes (generic for all providers)
291-
if (prevModelDimension !== currentModelDimension) {
292-
return true
293-
}
283+
if (
284+
prevOpenAiCompatibleBaseUrl !== currentOpenAiCompatibleBaseUrl ||
285+
prevOpenAiCompatibleApiKey !== currentOpenAiCompatibleApiKey
286+
) {
287+
return true
288+
}
294289

295-
if (prevQdrantUrl !== currentQdrantUrl || prevQdrantApiKey !== currentQdrantApiKey) {
296-
return true
297-
}
290+
// Check for model dimension changes (generic for all providers)
291+
if (prevModelDimension !== currentModelDimension) {
292+
return true
293+
}
298294

299-
// Vector dimension changes (still important for compatibility)
300-
if (this._hasVectorDimensionChanged(prevProvider, prev?.modelId)) {
301-
return true
302-
}
295+
if (prevQdrantUrl !== currentQdrantUrl || prevQdrantApiKey !== currentQdrantApiKey) {
296+
return true
297+
}
298+
299+
// Vector dimension changes (still important for compatibility)
300+
if (this._hasVectorDimensionChanged(prevProvider, prev?.modelId)) {
301+
return true
303302
}
304303

305304
return false

0 commit comments

Comments
 (0)