add debug logs for better tracing of fallback generation issues

This commit is contained in:
Sha Zhou 2025-08-05 11:32:05 +08:00
parent 8c59c2cb7e
commit 089e97e9d3

View File

@ -186,9 +186,11 @@ export class ObjectGeneratorSafe {
if (NoObjectGeneratedError.isInstance(parseError)) {
failedOutput = (parseError as any).text;
logDebug(`Failed output: ${failedOutput}`);
// find last `"url":` appear in the string, which is the source of the problem
failedOutput = failedOutput.slice(0, Math.min(failedOutput.lastIndexOf('"url":'), 8000));
}
logDebug(`Prompt: ${failedOutput}`);
// Create a distilled version of the schema without descriptions
const distilledSchema = this.createDistilledSchema(schema);