From 089e97e9d3ddb7fa002add8c9351268688d729a8 Mon Sep 17 00:00:00 2001 From: Sha Zhou Date: Tue, 5 Aug 2025 11:32:05 +0800 Subject: [PATCH] add debug logs for better tracing of fallback generation issues --- src/utils/safe-generator.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/safe-generator.ts b/src/utils/safe-generator.ts index 23ccacb..ed28fa4 100644 --- a/src/utils/safe-generator.ts +++ b/src/utils/safe-generator.ts @@ -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);