@fusedashlabs/ui9000-workspace
Version:
UI9000 workspace MCP. One tool, show_workspace, draws a chart from your table. Set TYPESAFE_API_KEY to let Jev choose the chart.
21 lines (20 loc) • 713 B
JavaScript
import { JEV_MODEL } from './chart-choice.js';
const ENDPOINT = 'https://api.typesafe.ai/v1/systemone';
export async function askJev(request, apiKey, fetchImpl = fetch) {
const key = apiKey.trim();
if (!key)
throw new Error('TYPESAFE_API_KEY is empty.');
const response = await fetchImpl(ENDPOINT, {
method: 'POST',
headers: {
Authorization: `Bearer ${key}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ ...request, model: JEV_MODEL }),
});
const text = await response.text();
if (!response.ok) {
throw new Error(`Jev ${response.status}: ${text.slice(0, 500)}`);
}
return JSON.parse(text);
}