hcc-meat-coder / ui /src /lib /api.ts
chraos's picture
Claude Opus 4.7 (1M context)
Milestone 0.7.0: LLM MEAT extractor (Qwen/Qwen2.5-3B-Instruct + T4)
5eed8db
Raw History Blame Contribute Delete
1.25 kB
import type { CodingResult, GalleryItem } from "./types";
const JSON_HEADERS = { "Content-Type": "application/json" };
export async function codeNote(text: string, noteId = "adhoc"): Promise<CodingResult> {
const res = await fetch("/api/code", {
method: "POST",
headers: JSON_HEADERS,
body: JSON.stringify({ text, note_id: noteId }),
});
if (!res.ok) throw new Error(`API error: ${res.status} ${await res.text()}`);
return res.json();
}
export async function fetchGallery(): Promise<GalleryItem[]> {
const res = await fetch("/api/gallery");
if (!res.ok) throw new Error(`Gallery fetch failed: ${res.status}`);
return res.json();
}
export interface ServerStatus {
status: "ok" | "degraded";
version: string;
pipeline_ready: boolean;
reference_counts: {
hcc_labels?: number;
hcc_crosswalk_icd10?: number;
};
gallery_size: number;
metrics_available: boolean;
meat_llm_configured?: boolean;
meat_llm_model?: string | null;
meat_llm_ready?: boolean | null;
startup_errors?: Record<string, string>;
}
export async function fetchStatus(): Promise<ServerStatus> {
const res = await fetch("/api/status");
if (!res.ok) throw new Error(`Status fetch failed: ${res.status}`);
return res.json();
}