fix: optional chaining on safetyCheck
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 1s
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 1s
This commit is contained in:
parent
d4913a58a9
commit
9501231148
@ -50,7 +50,7 @@ export class AiGatewayService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const safetyCheck = await this.contentSafety?.check(output.rawText, { contentType: 'ai_output' }).catch(() => ({ safe: true }));
|
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 parsed = this.parseJson(output.rawText, request.outputSchema);
|
||||||
const estimatedCost = this.costCalculator.calculate(
|
const estimatedCost = this.costCalculator.calculate(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user