From 0c07b5976567cd460b3c27a4602628947034942d Mon Sep 17 00:00:00 2001 From: WangDL Date: Sun, 24 May 2026 13:46:30 +0800 Subject: [PATCH] fix: add @Optional() to ContentSafetyService in RagChatService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same issue as KnowledgeBaseService — NestJS can't resolve ContentSafetyService in RagChatModule without @Optional(). Co-Authored-By: Claude Opus 4.7 --- src/modules/rag-chat/rag-chat.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/rag-chat/rag-chat.service.ts b/src/modules/rag-chat/rag-chat.service.ts index 43bf2f8..742f83d 100644 --- a/src/modules/rag-chat/rag-chat.service.ts +++ b/src/modules/rag-chat/rag-chat.service.ts @@ -1,4 +1,4 @@ -import { Injectable, NotFoundException, Logger } from '@nestjs/common'; +import { Injectable, NotFoundException, Logger, Optional } from '@nestjs/common'; import { PrismaService } from '../../infrastructure/database/prisma.service'; import { ContentSafetyService } from '../content-safety/content-safety.service'; @@ -8,7 +8,7 @@ export class RagChatService { constructor( private readonly prisma: PrismaService, - private readonly safety?: ContentSafetyService, + @Optional() private readonly safety?: ContentSafetyService, ) {} async createSession(userId: string, knowledgeBaseId: string, title?: string) {