add intelligence and SQL tabs to admin interface with corresponding API endpoints

This commit is contained in:
ImBenji 2026-04-22 21:02:46 +01:00
parent eaeffd003a
commit 0fbdc21861

View file

@ -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;