add intelligence and SQL tabs to admin interface with corresponding API endpoints
This commit is contained in:
parent
eaeffd003a
commit
0fbdc21861
1 changed files with 6 additions and 1 deletions
|
|
@ -178,7 +178,12 @@ async function callLlm(llmConfig, prompt) {
|
||||||
"Authorization": `Bearer ${llmConfig.apiKey || ""}`,
|
"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;
|
const content = parsed.choices?.[0]?.message?.content;
|
||||||
if (!content) return null;
|
if (!content) return null;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue