add intelligence and SQL tabs to admin interface with corresponding API endpoints
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user