Spaces:
Sleeping
Sleeping
File size: 775 Bytes
11ab88a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | export async function requestJson(path, options = {}) {
const response = await fetch(path, options);
const contentType = response.headers.get("content-type") || "";
const data = contentType.includes("application/json") ? await response.json() : null;
if (!response.ok) {
const message = data?.detail?.message || data?.detail || "์์ฒญ์ ์ฒ๋ฆฌํ์ง ๋ชปํ์ต๋๋ค.";
throw new Error(message);
}
return data;
}
export function getConfidenceState(confidence) {
if (confidence >= 0.9) {
return { label: "์์ ", className: "confidence-stable" };
}
if (confidence >= 0.7) {
return { label: "ํ์ธ ํ์", className: "confidence-review" };
}
return { label: "๋ค์ ๋ณด๊ธฐ", className: "confidence-retry" };
}
|