From 6f6902849f34e1ab86afbbc36bb2e39f848d356e Mon Sep 17 00:00:00 2001 From: Paco POR-CORREO Date: Mon, 6 Apr 2026 23:55:39 +0200 Subject: [PATCH] Fix ENOENT in folder upload by reading from temporary extracted readPath --- RAG/docs/HISTORIAL_SESIONES.md | 3 +-- RAG/src/modules/ingest/service.ts | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/RAG/docs/HISTORIAL_SESIONES.md b/RAG/docs/HISTORIAL_SESIONES.md index ba8da3c..35acc02 100644 --- a/RAG/docs/HISTORIAL_SESIONES.md +++ b/RAG/docs/HISTORIAL_SESIONES.md @@ -48,5 +48,4 @@ Dar continuidad al RAG en `RAG/` a partir del estado actual documentado. - Reingesta del directorio `RAG/src` con el código actualizado. - Documento de seguimiento `RAG/docs/TASK_LIMPIEZA.md` y documentacion API `RAG/docs/API_RAG.md` actualizados. - Implementacion de ingesta directa de carpetas locales desde el playground: el navegador empaqueta la carpeta en un `.zip` en memoria (filtrando `node_modules`, `dist`, `.git`, etc. con logica nativa) y el backend usa `adm-zip` para extraerla de forma segura en un directorio temporal antes de la ingesta. -- Correccion de error `ReferenceError: ignore is not defined` eliminando dependencia externa en el frontend. -- Ajustes de UX en el playground (pestaña Ingesta) para evitar arrastre de Tags al seleccionar cargas locales y dar claridad visual de que la ruta remota se ignorara a favor de la local, añadiendo boton para cancelar seleccion. +- Correccion en `IngestService` (`resolveInputFiles` y `normalizeDocumentKey`) para escanear archivos desde la ruta temporal extraída (`readPath`) en lugar del identificador lógico al subir carpetas completas, evitando error de `ENOENT`. diff --git a/RAG/src/modules/ingest/service.ts b/RAG/src/modules/ingest/service.ts index 12a3820..32ab89c 100644 --- a/RAG/src/modules/ingest/service.ts +++ b/RAG/src/modules/ingest/service.ts @@ -34,7 +34,7 @@ export class IngestService { const documentKey = normalizeDocumentKey( source.sourceType === "folder" - ? path.relative(path.resolve(source.sourceRef), path.resolve(filePath)) + ? path.relative(path.resolve(source.readPath ?? source.sourceRef), path.resolve(filePath)) : path.basename(filePath) ); const documentId = buildDocumentId(sourceId, documentKey); @@ -88,9 +88,10 @@ export class IngestService { } private async resolveInputFiles(source: IngestSourceInput): Promise { + const targetPath = source.readPath ?? source.sourceRef; if (source.sourceType === "file") { - return [source.readPath ?? source.sourceRef]; + return [targetPath]; } - return listFilesRecursively(source.sourceRef); + return listFilesRecursively(targetPath); } }