fix: add @Optional() to ContentSafetyService in KnowledgeBaseService
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 33s

NestJS couldn't resolve ContentSafetyService because ContentSafetyModule
is not imported in KnowledgeBaseModule, causing app startup crash.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
WangDL 2026-05-24 11:42:41 +08:00
parent 3602fb6cdb
commit 81c49ca067

View File

@ -1,4 +1,4 @@
import { Injectable, BadRequestException, NotFoundException, ForbiddenException } from '@nestjs/common';
import { Injectable, BadRequestException, NotFoundException, ForbiddenException, Optional } from '@nestjs/common';
import { KnowledgeBaseRepository } from './knowledge-base.repository';
import { PrismaService } from '../../infrastructure/database/prisma.service';
import { ContentSafetyService } from '../content-safety/content-safety.service';
@ -9,7 +9,7 @@ export class KnowledgeBaseService {
constructor(
private readonly repository: KnowledgeBaseRepository,
private readonly prisma: PrismaService,
private readonly safety?: ContentSafetyService,
@Optional() private readonly safety?: ContentSafetyService,
) {}
async create(userId: string, dto: any) {