From 2d87c25f9c46438a9e265f35376e9da3d30cd6d1 Mon Sep 17 00:00:00 2001 From: ovived Date: Mon, 1 Jul 2024 13:17:57 -0400 Subject: [PATCH] (adding) retry --- src/llm.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/llm.ts b/src/llm.ts index 2fdd2b5..dafe9ca 100644 --- a/src/llm.ts +++ b/src/llm.ts @@ -167,7 +167,10 @@ class LLM { if (sanitizedContent) { return sanitizedContent; } else { - return JSON.stringify({ error: "Invalid JSON format", originalMessage: contentText }); + console.log("Invalid JSON format, retrying request..."); + return await this.cloudflareAIChat(messages, options); + + } } else { return contentText;