MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / demoApi

Function demoApi

deployments/desktop/static/app.js:296–465  ·  view source on GitHub ↗
(path, options = {})

Source from the content-addressed store, hash-verified

294}
295
296async function demoApi(path, options = {}) {
297 await new Promise((resolve) => window.setTimeout(resolve, 90));
298 const url = new URL(path, window.location.origin);
299 const body = parseDemoBody(options);
300 const route = url.pathname;
301
302 if (route === "/api/health") {
303 return { ok: true, database_exists: true };
304 }
305 if (route === "/api/settings") {
306 return {
307 ok: true,
308 project_root: "GitHub Pages preview",
309 env_path: ".env",
310 database: "mock://paperflow.db",
311 paths: {
312 pdf_dir: "data/papers",
313 reading_reports_dir: "data/reading_reports",
314 wiki_dir: "data/wiki",
315 monthly_report_dir: "data/wiki/monthly_reports",
316 topic_index_dir: "data/wiki/monthly_reports",
317 monthly_subdir: true,
318 wiki_ingest: true,
319 write_feishu: false,
320 },
321 editable_env: [
322 { key: "PAPERFLOW_LLM_PROVIDER", value: "mock", is_secret: false, present: true },
323 { key: "PAPERFLOW_LLM_MODEL", value: "paperflow-preview", is_secret: false, present: true },
324 { key: "PAPERFLOW_EMBED_PROVIDER", value: "hash", is_secret: false, present: true },
325 { key: "PAPERFLOW_EMBED_MODEL", value: "", is_secret: false, present: false },
326 { key: "OPENAI_API_KEY", value: "", is_secret: true, present: false },
327 { key: "OPENAI_BASE_URL", value: "", is_secret: false, present: false },
328 ],
329 };
330 }
331 if (route === "/api/source-options") {
332 return {
333 ok: true,
334 arxiv_categories: [
335 { id: "cs.AI", label: "cs.AI - Artificial Intelligence" },
336 { id: "cs.LG", label: "cs.LG - Machine Learning" },
337 { id: "cs.CV", label: "cs.CV - Computer Vision" },
338 ],
339 conferences: [
340 { id: "ICLR", label: "ICLR", group: "ML", enabled: true },
341 { id: "NeurIPS", label: "NeurIPS", group: "ML", enabled: true },
342 { id: "CVPR", label: "CVPR", group: "CV", enabled: true },
343 ],
344 journals: [
345 { id: "Nature", label: "Nature", group: "weekly_scan_top", enabled: true },
346 { id: "Science", label: "Science", group: "weekly_scan_top", enabled: true },
347 ],
348 };
349 }
350 if (route === "/api/settings" && options.method === "POST") {
351 return demoApi("/api/settings", { method: "GET" });
352 }
353 if (route === "/api/users") {

Callers 1

apiFunction · 0.70

Calls 3

parseDemoBodyFunction · 0.85
demoReportFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected