From a0fafd04526024103109dade925019f51fd907b1 Mon Sep 17 00:00:00 2001 From: WangDL Date: Tue, 19 May 2026 22:36:18 +0800 Subject: [PATCH] fix: TypeScript null check for RAG internal controller --- src/modules/rag/internal-rag.controller.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/modules/rag/internal-rag.controller.ts b/src/modules/rag/internal-rag.controller.ts index 5756d9e..643582b 100644 --- a/src/modules/rag/internal-rag.controller.ts +++ b/src/modules/rag/internal-rag.controller.ts @@ -37,13 +37,11 @@ export class InternalRagController { @Get('jobs/:id') async getJobDetail(@Param('id') id: string) { const job = await this.importRepo.findById(id); - if (!job) return { job: null }; + if (!job) return { job: null, source: null }; - let source = null; - let downloadUrl = null; - if (job.sourceId) { - source = await this.sourceRepo.findById(job.sourceId); - } + const source = job.sourceId + ? await this.sourceRepo.findById(job.sourceId) + : null; return { job: {