Fix ENOENT in folder upload by reading from temporary extracted readPath

This commit is contained in:
Paco POR-CORREO 2026-04-06 23:55:39 +02:00
parent c730160a93
commit 6f6902849f
2 changed files with 5 additions and 5 deletions

View file

@ -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`.

View file

@ -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<string[]> {
const targetPath = source.readPath ?? source.sourceRef;
if (source.sourceType === "file") {
return [source.readPath ?? source.sourceRef];
return [targetPath];
}
return listFilesRecursively(source.sourceRef);
return listFilesRecursively(targetPath);
}
}