diff --git a/intelligence/augorWorker.js b/intelligence/augorWorker.js index 421665d..033949d 100644 --- a/intelligence/augorWorker.js +++ b/intelligence/augorWorker.js @@ -178,7 +178,12 @@ async function callLlm(llmConfig, prompt) { "Authorization": `Bearer ${llmConfig.apiKey || ""}`, }); - const parsed = JSON.parse(responseText); + let parsed; + try { + parsed = JSON.parse(responseText); + } catch (e) { + throw new Error(`LLM response not JSON: ${responseText.slice(0, 300)}`); + } const content = parsed.choices?.[0]?.message?.content; if (!content) return null;