Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
71 changes: 69 additions & 2 deletions src/core/webview/webviewMessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as fs from "fs/promises"
import pWaitFor from "p-wait-for"
import * as vscode from "vscode"
import * as yaml from "yaml"
import { serializeError } from "serialize-error"

import { type Language, type ProviderSettings, type GlobalState, TelemetryEventName } from "@roo-code/types"
import { CloudService } from "@roo-code/cloud"
Expand Down Expand Up @@ -1807,6 +1808,43 @@ export const webviewMessageHandler = async (
break
}
case "codebaseIndexConfig": {
// Handle test action separately
if (message.action === "test") {
try {
if (!provider.codeIndexManager) {
throw new Error("Code index manager not available")
}

// Get the service factory from the manager
const serviceFactory = provider.codeIndexManager.getServiceFactory()
if (!serviceFactory) {
throw new Error("Service factory not available")
}

// Test the configuration with the UI values
const isValid = await serviceFactory.validateEmbedderConfig(message.values)

// Send test result back to webview
provider.postMessageToWebview({
type: "codebaseIndexTestResult",
success: isValid,
message: isValid ? "Configuration is valid" : "Configuration test failed",
})
} catch (error) {
const serializedError = serializeError(error)
provider.log(`[CodeIndexManager] Configuration test error: ${serializedError.message}`)

// Send error result back to webview with serialized error
provider.postMessageToWebview({
type: "codebaseIndexTestResult",
success: false,
message: serializedError.message || "Configuration test failed",
})
}
break
}

// Normal configuration update flow
const codebaseIndexConfig = message.values ?? {
codebaseIndexEnabled: false,
codebaseIndexQdrantUrl: "http://localhost:6333",
Expand All @@ -1823,16 +1861,45 @@ export const webviewMessageHandler = async (
// If now configured and enabled, start indexing automatically
if (provider.codeIndexManager.isFeatureEnabled && provider.codeIndexManager.isFeatureConfigured) {
if (!provider.codeIndexManager.isInitialized) {
await provider.codeIndexManager.initialize(provider.contextProxy)
try {
await provider.codeIndexManager.initialize(provider.contextProxy)
} catch (initError) {
// Initialization failed - send error status to webview
const serializedError = serializeError(initError)
provider.log(`[CodeIndexManager] Initialization error: ${serializedError.message}`)

// Send error status update to webview with serialized error details
const status = provider.codeIndexManager.getCurrentStatus()
provider.postMessageToWebview({
type: "indexingStatusUpdate",
values: {
...status,
errorDetails: serializedError,
},
})

// Re-throw to prevent indexing attempt
throw initError
}
}
// Start indexing in background (no await)
provider.codeIndexManager.startIndexing()
}
}
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error)
provider.log(
`[CodeIndexManager] Error during background CodeIndexManager configuration/indexing: ${error.message || error}`,
`[CodeIndexManager] Error during background CodeIndexManager configuration/indexing: ${errorMessage}`,
)

// Send error notification to webview if manager exists
if (provider.codeIndexManager) {
const status = provider.codeIndexManager.getCurrentStatus()
provider.postMessageToWebview({
type: "indexingStatusUpdate",
values: status,
})
}
}

await provider.postStateToWebview()
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/ca/embeddings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@
"failedWithError": "No s'han pogut crear les incrustacions després de {{attempts}} intents: {{errorMessage}}",
"failedMaxAttempts": "No s'han pogut crear les incrustacions després de {{attempts}} intents",
"textExceedsTokenLimit": "El text a l'índex {{index}} supera el límit màxim de testimonis ({{itemTokens}} > {{maxTokens}}). S'està ometent.",
"textWithPrefixExceedsTokenLimit": "El text a l'índex {{index}} amb prefix supera el límit màxim de testimonis ({{estimatedTokens}} > {{maxTokens}}). S'utilitza el text original sense prefix.",
"rateLimitRetry": "S'ha assolit el límit de velocitat, es torna a intentar en {{delayMs}}ms (intent {{attempt}}/{{maxRetries}})",
"genericError": "Error de {{provider}}: {{errorDetails}}",
"validation": {
"modelNotFound": "No s'ha trobat el model '{{modelId}}'. Models disponibles: {{availableModels}}",
"invalidApiKey": "Clau API no vàlida. Comprova la teva clau API de {{provider}}.",
"rateLimitExceeded": "S'ha superat el límit de velocitat. Torna-ho a provar més tard.",
"networkError": "Error de xarxa. Comprova la teva connexió a Internet.",
"configurationFailed": "Ha fallat la validació de la configuració de {{provider}}",
"baseUrlRequired": "Es requereix l'URL base per a l'embedder {{provider}}",
"apiKeyRequired": "Es requereix la clau API per a l'embedder {{provider}}",
"endpointNotFound": "Punt final no trobat: {{baseUrl}}",
"cannotConnect": "No es pot connectar a {{provider}} a {{baseUrl}}. Assegura't que {{provider}} s'està executant.",
"apiNotFound": "API de {{provider}} no trobada a {{baseUrl}}. S'està executant {{provider}}?",
"connectionFailed": "Ha fallat la connexió a {{provider}}: {{status}} {{statusText}}"
},
"ollama": {
"couldNotReadErrorBody": "No s'ha pogut llegir el cos de l'error",
"requestFailed": "La sol·licitud de l'API d'Ollama ha fallat amb l'estat {{status}} {{statusText}}: {{errorBody}}",
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/de/embeddings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@
"failedWithError": "Erstellung von Einbettungen nach {{attempts}} Versuchen fehlgeschlagen: {{errorMessage}}",
"failedMaxAttempts": "Erstellung von Einbettungen nach {{attempts}} Versuchen fehlgeschlagen",
"textExceedsTokenLimit": "Text bei Index {{index}} überschreitet das maximale Token-Limit ({{itemTokens}} > {{maxTokens}}). Wird übersprungen.",
"textWithPrefixExceedsTokenLimit": "Text bei Index {{index}} mit Präfix überschreitet das maximale Token-Limit ({{estimatedTokens}} > {{maxTokens}}). Verwende Originaltext ohne Präfix.",
"rateLimitRetry": "Ratenlimit erreicht, Wiederholung in {{delayMs}}ms (Versuch {{attempt}}/{{maxRetries}})",
"genericError": "{{provider}}-Fehler: {{errorDetails}}",
"validation": {
"modelNotFound": "Modell '{{modelId}}' nicht gefunden. Verfügbare Modelle: {{availableModels}}",
"invalidApiKey": "Ungültiger API-Schlüssel. Überprüfe deinen {{provider}} API-Schlüssel.",
"rateLimitExceeded": "Ratenlimit überschritten. Versuche es später erneut.",
"networkError": "Netzwerkfehler. Überprüfe deine Internetverbindung.",
"configurationFailed": "{{provider}}-Konfigurationsvalidierung fehlgeschlagen",
"baseUrlRequired": "Basis-URL für {{provider}}-Embedder erforderlich",
"apiKeyRequired": "API-Schlüssel für {{provider}}-Embedder erforderlich",
"endpointNotFound": "Endpunkt nicht gefunden: {{baseUrl}}",
"cannotConnect": "Kann keine Verbindung zu {{provider}} unter {{baseUrl}} herstellen. Stelle sicher, dass {{provider}} läuft.",
"apiNotFound": "{{provider}} API nicht gefunden unter {{baseUrl}}. Läuft {{provider}}?",
"connectionFailed": "Verbindung zu {{provider}} fehlgeschlagen: {{status}} {{statusText}}"
},
"ollama": {
"couldNotReadErrorBody": "Fehlerinhalt konnte nicht gelesen werden",
"requestFailed": "Ollama API-Anfrage fehlgeschlagen mit Status {{status}} {{statusText}}: {{errorBody}}",
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/en/embeddings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@
"failedWithError": "Failed to create embeddings after {{attempts}} attempts: {{errorMessage}}",
"failedMaxAttempts": "Failed to create embeddings after {{attempts}} attempts",
"textExceedsTokenLimit": "Text at index {{index}} exceeds maximum token limit ({{itemTokens}} > {{maxTokens}}). Skipping.",
"textWithPrefixExceedsTokenLimit": "Text at index {{index}} with prefix exceeds maximum token limit ({{estimatedTokens}} > {{maxTokens}}). Using original text without prefix.",
"rateLimitRetry": "Rate limit hit, retrying in {{delayMs}}ms (attempt {{attempt}}/{{maxRetries}})",
"genericError": "{{provider}} error: {{errorDetails}}",
"validation": {
"modelNotFound": "Model '{{modelId}}' not found. Available models: {{availableModels}}",
"invalidApiKey": "Invalid API key. Please check your {{provider}} API key.",
"rateLimitExceeded": "Rate limit exceeded. Please try again later.",
"networkError": "Network error. Please check your internet connection.",
"configurationFailed": "Failed to validate {{provider}} configuration",
"baseUrlRequired": "Base URL is required for {{provider}} embedder",
"apiKeyRequired": "API key is required for {{provider}} embedder",
"endpointNotFound": "Endpoint not found: {{baseUrl}}",
"cannotConnect": "Cannot connect to {{provider}} at {{baseUrl}}. Please ensure {{provider}} is running.",
"apiNotFound": "{{provider}} API not found at {{baseUrl}}. Is {{provider}} running?",
"connectionFailed": "Failed to connect to {{provider}}: {{status}} {{statusText}}"
},
"ollama": {
"couldNotReadErrorBody": "Could not read error body",
"requestFailed": "Ollama API request failed with status {{status}} {{statusText}}: {{errorBody}}",
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/es/embeddings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@
"failedWithError": "No se pudieron crear las incrustaciones después de {{attempts}} intentos: {{errorMessage}}",
"failedMaxAttempts": "No se pudieron crear las incrustaciones después de {{attempts}} intentos",
"textExceedsTokenLimit": "El texto en el índice {{index}} supera el límite máximo de tokens ({{itemTokens}} > {{maxTokens}}). Omitiendo.",
"textWithPrefixExceedsTokenLimit": "El texto en el índice {{index}} con prefijo supera el límite máximo de tokens ({{estimatedTokens}} > {{maxTokens}}). Usando texto original sin prefijo.",
"rateLimitRetry": "Límite de velocidad alcanzado, reintentando en {{delayMs}}ms (intento {{attempt}}/{{maxRetries}})",
"genericError": "Error de {{provider}}: {{errorDetails}}",
"validation": {
"modelNotFound": "Modelo '{{modelId}}' no encontrado. Modelos disponibles: {{availableModels}}",
"invalidApiKey": "Clave API inválida. Verifica tu clave API de {{provider}}.",
"rateLimitExceeded": "Límite de velocidad excedido. Intenta de nuevo más tarde.",
"networkError": "Error de red. Verifica tu conexión a Internet.",
"configurationFailed": "Falló la validación de configuración de {{provider}}",
"baseUrlRequired": "Se requiere URL base para el embedder {{provider}}",
"apiKeyRequired": "Se requiere clave API para el embedder {{provider}}",
"endpointNotFound": "Punto final no encontrado: {{baseUrl}}",
"cannotConnect": "No se puede conectar a {{provider}} en {{baseUrl}}. Asegúrate de que {{provider}} esté ejecutándose.",
"apiNotFound": "API de {{provider}} no encontrada en {{baseUrl}}. ¿Está ejecutándose {{provider}}?",
"connectionFailed": "Falló la conexión a {{provider}}: {{status}} {{statusText}}"
},
"ollama": {
"couldNotReadErrorBody": "No se pudo leer el cuerpo del error",
"requestFailed": "La solicitud de la API de Ollama falló con estado {{status}} {{statusText}}: {{errorBody}}",
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/fr/embeddings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@
"failedWithError": "Échec de la création des embeddings après {{attempts}} tentatives : {{errorMessage}}",
"failedMaxAttempts": "Échec de la création des embeddings après {{attempts}} tentatives",
"textExceedsTokenLimit": "Le texte à l'index {{index}} dépasse la limite maximale de tokens ({{itemTokens}} > {{maxTokens}}). Ignoré.",
"textWithPrefixExceedsTokenLimit": "Le texte à l'index {{index}} avec préfixe dépasse la limite maximale de tokens ({{estimatedTokens}} > {{maxTokens}}). Utilisation du texte original sans préfixe.",
"rateLimitRetry": "Limite de débit atteinte, nouvelle tentative dans {{delayMs}}ms (tentative {{attempt}}/{{maxRetries}})",
"genericError": "Erreur {{provider}} : {{errorDetails}}",
"validation": {
"modelNotFound": "Modèle '{{modelId}}' introuvable. Modèles disponibles : {{availableModels}}",
"invalidApiKey": "Clé API invalide. Vérifie ta clé API {{provider}}.",
"rateLimitExceeded": "Limite de débit dépassée. Réessaye plus tard.",
"networkError": "Erreur réseau. Vérifie ta connexion Internet.",
"configurationFailed": "Échec de la validation de la configuration {{provider}}",
"baseUrlRequired": "URL de base requise pour l'embedder {{provider}}",
"apiKeyRequired": "Clé API requise pour l'embedder {{provider}}",
"endpointNotFound": "Point de terminaison introuvable : {{baseUrl}}",
"cannotConnect": "Impossible de se connecter à {{provider}} à {{baseUrl}}. Assure-toi que {{provider}} est en cours d'exécution.",
"apiNotFound": "API {{provider}} introuvable à {{baseUrl}}. {{provider}} est-il en cours d'exécution ?",
"connectionFailed": "Échec de la connexion à {{provider}} : {{status}} {{statusText}}"
},
"ollama": {
"couldNotReadErrorBody": "Impossible de lire le corps de l'erreur",
"requestFailed": "Échec de la requête API Ollama avec le statut {{status}} {{statusText}} : {{errorBody}}",
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/hi/embeddings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@
"failedWithError": "{{attempts}} प्रयासों के बाद एम्बेडिंग बनाने में विफल: {{errorMessage}}",
"failedMaxAttempts": "{{attempts}} प्रयासों के बाद एम्बेडिंग बनाने में विफल",
"textExceedsTokenLimit": "अनुक्रमणिका {{index}} पर पाठ अधिकतम टोकन सीमा ({{itemTokens}} > {{maxTokens}}) से अधिक है। छोड़ा जा रहा है।",
"textWithPrefixExceedsTokenLimit": "उपसर्ग के साथ अनुक्रमणिका {{index}} पर पाठ अधिकतम टोकन सीमा ({{estimatedTokens}} > {{maxTokens}}) से अधिक है। उपसर्ग के बिना मूल पाठ का उपयोग कर रहे हैं।",
"rateLimitRetry": "दर सीमा समाप्त, {{delayMs}}ms में पुन: प्रयास किया जा रहा है (प्रयास {{attempt}}/{{maxRetries}})",
"genericError": "{{provider}} त्रुटि: {{errorDetails}}",
"validation": {
"modelNotFound": "मॉडल '{{modelId}}' नहीं मिला। उपलब्ध मॉडल: {{availableModels}}",
"invalidApiKey": "अमान्य API कुंजी। अपनी {{provider}} API कुंजी की जांच करें।",
"rateLimitExceeded": "दर सीमा पार हो गई। बाद में पुनः प्रयास करें।",
"networkError": "नेटवर्क त्रुटि। अपना इंटरनेट कनेक्शन जांचें।",
"configurationFailed": "{{provider}} कॉन्फ़िगरेशन सत्यापन विफल",
"baseUrlRequired": "{{provider}} एम्बेडर के लिए आधार URL आवश्यक है",
"apiKeyRequired": "{{provider}} एम्बेडर के लिए API कुंजी आवश्यक है",
"endpointNotFound": "एंडपॉइंट नहीं मिला: {{baseUrl}}",
"cannotConnect": "{{baseUrl}} पर {{provider}} से कनेक्ट नहीं हो सकता। सुनिश्चित करें कि {{provider}} चल रहा है।",
"apiNotFound": "{{baseUrl}} पर {{provider}} API नहीं मिला। क्या {{provider}} चल रहा है?",
"connectionFailed": "{{provider}} से कनेक्शन विफल: {{status}} {{statusText}}"
},
"ollama": {
"couldNotReadErrorBody": "त्रुटि सामग्री पढ़ नहीं सका",
"requestFailed": "Ollama API अनुरोध स्थिति {{status}} {{statusText}} के साथ विफल: {{errorBody}}",
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/id/embeddings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@
"failedWithError": "Gagal membuat embeddings setelah {{attempts}} percobaan: {{errorMessage}}",
"failedMaxAttempts": "Gagal membuat embeddings setelah {{attempts}} percobaan",
"textExceedsTokenLimit": "Teks pada indeks {{index}} melebihi batas maksimum token ({{itemTokens}} > {{maxTokens}}). Dilewati.",
"textWithPrefixExceedsTokenLimit": "Teks pada indeks {{index}} dengan prefix melebihi batas maksimum token ({{estimatedTokens}} > {{maxTokens}}). Menggunakan teks asli tanpa prefix.",
"rateLimitRetry": "Batas rate tercapai, mencoba lagi dalam {{delayMs}}ms (percobaan {{attempt}}/{{maxRetries}})",
"genericError": "Error {{provider}}: {{errorDetails}}",
"validation": {
"modelNotFound": "Model '{{modelId}}' tidak ditemukan. Model yang tersedia: {{availableModels}}",
"invalidApiKey": "Kunci API tidak valid. Periksa kunci API {{provider}} kamu.",
"rateLimitExceeded": "Batas rate terlampaui. Coba lagi nanti.",
"networkError": "Error jaringan. Periksa koneksi internet kamu.",
"configurationFailed": "Validasi konfigurasi {{provider}} gagal",
"baseUrlRequired": "URL dasar diperlukan untuk embedder {{provider}}",
"apiKeyRequired": "Kunci API diperlukan untuk embedder {{provider}}",
"endpointNotFound": "Endpoint tidak ditemukan: {{baseUrl}}",
"cannotConnect": "Tidak dapat terhubung ke {{provider}} di {{baseUrl}}. Pastikan {{provider}} sedang berjalan.",
"apiNotFound": "API {{provider}} tidak ditemukan di {{baseUrl}}. Apakah {{provider}} sedang berjalan?",
"connectionFailed": "Koneksi ke {{provider}} gagal: {{status}} {{statusText}}"
},
"ollama": {
"couldNotReadErrorBody": "Tidak dapat membaca body error",
"requestFailed": "Permintaan API Ollama gagal dengan status {{status}} {{statusText}}: {{errorBody}}",
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/it/embeddings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@
"failedWithError": "Creazione degli embedding non riuscita dopo {{attempts}} tentativi: {{errorMessage}}",
"failedMaxAttempts": "Creazione degli embedding non riuscita dopo {{attempts}} tentativi",
"textExceedsTokenLimit": "Il testo all'indice {{index}} supera il limite massimo di token ({{itemTokens}} > {{maxTokens}}). Saltato.",
"textWithPrefixExceedsTokenLimit": "Il testo all'indice {{index}} con prefisso supera il limite massimo di token ({{estimatedTokens}} > {{maxTokens}}). Utilizzo del testo originale senza prefisso.",
"rateLimitRetry": "Limite di velocità raggiunto, nuovo tentativo tra {{delayMs}}ms (tentativo {{attempt}}/{{maxRetries}})",
"genericError": "Errore {{provider}}: {{errorDetails}}",
"validation": {
"modelNotFound": "Modello '{{modelId}}' non trovato. Modelli disponibili: {{availableModels}}",
"invalidApiKey": "Chiave API non valida. Controlla la tua chiave API {{provider}}.",
"rateLimitExceeded": "Limite di velocità superato. Riprova più tardi.",
"networkError": "Errore di rete. Controlla la tua connessione Internet.",
"configurationFailed": "Validazione della configurazione {{provider}} fallita",
"baseUrlRequired": "URL di base richiesto per l'embedder {{provider}}",
"apiKeyRequired": "Chiave API richiesta per l'embedder {{provider}}",
"endpointNotFound": "Endpoint non trovato: {{baseUrl}}",
"cannotConnect": "Impossibile connettersi a {{provider}} su {{baseUrl}}. Assicurati che {{provider}} sia in esecuzione.",
"apiNotFound": "API {{provider}} non trovata su {{baseUrl}}. {{provider}} è in esecuzione?",
"connectionFailed": "Connessione a {{provider}} fallita: {{status}} {{statusText}}"
},
"ollama": {
"couldNotReadErrorBody": "Impossibile leggere il corpo dell'errore",
"requestFailed": "Richiesta API Ollama fallita con stato {{status}} {{statusText}}: {{errorBody}}",
Expand Down
Loading
Loading