Show OpenAI test failure details
This commit is contained in:
@@ -447,9 +447,19 @@ function openAiTestMessage(result) {
|
|||||||
if (result?.error === "invalid_key") return "OpenAI klic je spatny nebo nema pristup. Vloz novy klic.";
|
if (result?.error === "invalid_key") return "OpenAI klic je spatny nebo nema pristup. Vloz novy klic.";
|
||||||
if (result?.error === "bad_model") return "Zvoleny OpenAI model neni dostupny pro tento klic. Vyber jiny model.";
|
if (result?.error === "bad_model") return "Zvoleny OpenAI model neni dostupny pro tento klic. Vyber jiny model.";
|
||||||
if (result?.error === "rate_limited") return "OpenAI docasne omezuje pozadavky. Zkus test za chvili.";
|
if (result?.error === "rate_limited") return "OpenAI docasne omezuje pozadavky. Zkus test za chvili.";
|
||||||
|
if (result?.message) return `Test selhal (${result?.error || "chyba"}): ${shortErrorMessage(result.message)}`;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shortErrorMessage(value) {
|
||||||
|
const text = String(value || "")
|
||||||
|
.replace(/\s+/g, " ")
|
||||||
|
.replace(/^OpenAI HTTP\s+/i, "OpenAI ")
|
||||||
|
.trim();
|
||||||
|
if (!text) return "bez detailu";
|
||||||
|
return text.length > 220 ? `${text.slice(0, 217)}...` : text;
|
||||||
|
}
|
||||||
|
|
||||||
function setOpenAiStatus(message) {
|
function setOpenAiStatus(message) {
|
||||||
$("#openaiApiKeyStatus").textContent = message;
|
$("#openaiApiKeyStatus").textContent = message;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user