Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
5 changes: 5 additions & 0 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,11 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
this.contextProxy.setProviderSettings(providerSettings),
])

// Notify CodeIndexManager about the settings change
if (this.codeIndexManager) {
await this.codeIndexManager.handleExternalSettingsChange()
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider wrapping the call to codeIndexManager.handleExternalSettingsChange() in a try/catch (or handling its errors) so that a failure in reloading configuration doesn't break the profile activation flow.

}

// Change the provider for the current task.
// TODO: We should rename `buildApiHandler` for clarity (e.g. `getProviderClient`).
const task = this.getCurrentCline()
Expand Down
14 changes: 11 additions & 3 deletions src/services/code-index/config-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class CodeIndexConfigManager {
private modelId?: string
private openAiOptions?: ApiHandlerOptions
private ollamaOptions?: ApiHandlerOptions
private qdrantUrl?: string
private qdrantUrl?: string = "http://localhost:6333"
private qdrantApiKey?: string
private searchMinScore?: number

Expand Down Expand Up @@ -103,11 +103,19 @@ export class CodeIndexConfigManager {
* Checks if the service is properly configured based on the embedder type.
*/
public isConfigured(): boolean {
console.log("[CodeIndexConfigManager.isConfigured] Entry. EmbedderProvider:", this.embedderProvider)

if (this.embedderProvider === "openai") {
return !!(this.openAiOptions?.openAiNativeApiKey && this.qdrantUrl)
const openAiKey = this.openAiOptions?.openAiNativeApiKey
const qdrantUrl = this.qdrantUrl
const isConfigured = !!(openAiKey && qdrantUrl)
return isConfigured
} else if (this.embedderProvider === "ollama") {
// Ollama model ID has a default, so only base URL is strictly required for config
return !!(this.ollamaOptions?.ollamaBaseUrl && this.qdrantUrl)
const ollamaBaseUrl = this.ollamaOptions?.ollamaBaseUrl
const qdrantUrl = this.qdrantUrl
const isConfigured = !!(ollamaBaseUrl && qdrantUrl)
return isConfigured
}
return false // Should not happen if embedderProvider is always set correctly
}
Expand Down
11 changes: 11 additions & 0 deletions src/services/code-index/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,15 @@ export class CodeIndexManager {
this.assertInitialized()
return this._searchService!.searchIndex(query, directoryPrefix)
}

/**
* Handles external settings changes by reloading configuration.
* This method should be called when API provider settings are updated
* to ensure the CodeIndexConfigManager picks up the new configuration.
*/
public async handleExternalSettingsChange(): Promise<void> {
if (this._configManager) {
await this._configManager.loadConfiguration()
}
}
}
2 changes: 1 addition & 1 deletion webview-ui/src/components/settings/CodeIndexSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export const CodeIndexSettings: React.FC<CodeIndexSettingsProps> = ({
</div>
<div>
<VSCodeTextField
value={codebaseIndexConfig.codebaseIndexQdrantUrl}
value={codebaseIndexConfig.codebaseIndexQdrantUrl || "http://localhost:6333"}
onInput={(e: any) =>
setCachedStateField("codebaseIndexConfig", {
...codebaseIndexConfig,
Expand Down