fix: optional chaining on safetyCheck
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 1s

This commit is contained in:
WangDL 2026-05-23 09:38:47 +08:00
parent d4913a58a9
commit 9501231148

View File

@ -50,7 +50,7 @@ export class AiGatewayService {
});
const safetyCheck = await this.contentSafety?.check(output.rawText, { contentType: 'ai_output' }).catch(() => ({ safe: true }));
if (!safetyCheck.safe) throw new Error('AI output blocked by content safety');
if (!safetyCheck?.safe) throw new Error('AI output blocked by content safety');
const parsed = this.parseJson(output.rawText, request.outputSchema);
const estimatedCost = this.costCalculator.calculate(