Created
May 7, 2026 15:30
-
-
Save pazteddy/f5200c10d6db47dc9774c5a7765c3a36 to your computer and use it in GitHub Desktop.
Función para la ingestión directamente desde el CLI y mensaje de bienvenida
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function ingestDocs(docsPath: string): Promise<void> { | |
| console.log(`\nIniciando ingestión desde: ${docsPath}`); | |
| const chunks = await processDirectory(docsPath); | |
| if (chunks.length === 0) { | |
| console.log("No se encontraron archivos .md en ese directorio."); | |
| return; | |
| } | |
| console.log(`Generando embeddings para ${chunks.length} chunks...`); | |
| const embeddings = await generateEmbeddings(chunks.map((c) => c.content)); | |
| const store = new VectorStore(config.dbPath); | |
| store.clear(); | |
| for (let i = 0; i < chunks.length; i++) { | |
| const chunk = chunks[i]; | |
| const embedding = embeddings[i]; | |
| if (chunk && embedding) store.insert(chunk, embedding); | |
| } | |
| console.log(`${store.size} chunks almacenados en ${config.dbPath}`); | |
| store.close(); | |
| // Reiniciar el singleton | |
| resetStore(); | |
| console.log("Vector store actualizado — listo para búsquedas\n"); | |
| } | |
| // Mensaje de bienvenida | |
| console.log("╔════════════════════════════════════════╗"); | |
| console.log("║ DevAssistant v0.3 ║"); | |
| console.log("║ Asistente de Documentación RAG ║"); | |
| console.log("╚════════════════════════════════════════╝"); | |
| console.log(""); | |
| console.log("💬 Escribe tu pregunta y presiona Enter."); | |
| console.log("💡 Tip: usa /ingest para cargar documentación"); | |
| console.log(" Comandos: /ingest [path], /clear, /stats, /tools, /exit"); | |
| console.log(""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment