fix: url sanitization

This commit is contained in:
Han Xiao 2025-03-17 21:33:29 +08:00
parent 47b9e436d5
commit 9f97d266de

View File

@ -169,7 +169,7 @@ export class ObjectGeneratorSafe {
// Create a distilled version of the schema without descriptions
const distilledSchema = this.createDistilledSchema(schema);
// find last `"url":` appear in the string, which is the source of the problem
const tailoredOutput = failedOutput.slice(0, Math.max(failedOutput.lastIndexOf('"url":'), 1500));
const tailoredOutput = failedOutput.slice(0, Math.min(failedOutput.lastIndexOf('"url":'), 5000));
const fallbackResult = await generateObject({
model: fallbackModel,