Spaces:
Sleeping
Sleeping
| 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" }; | |
| } | |