(path, options = {})
| 1743 | } |
| 1744 | |
| 1745 | async function demoApi(path, options = {}) { |
| 1746 | await new Promise((resolve) => window.setTimeout(resolve, 90)); |
| 1747 | const url = new URL(path, window.location.origin); |
| 1748 | const route = url.pathname; |
| 1749 | const method = (options.method || "GET").toUpperCase(); |
| 1750 | const body = options.body ? JSON.parse(options.body) : {}; |
| 1751 | |
| 1752 | if (route === "/api/health") { |
| 1753 | return { ok: true, database_exists: true, database: "demo.db", version: "offline-demo" }; |
| 1754 | } |
| 1755 | if (route === "/api/users") { |
| 1756 | return { ok: true, users: ["user_demo", "user_lab", "user_founder"] }; |
| 1757 | } |
| 1758 | if (route === "/api/source-options") { |
| 1759 | return { |
| 1760 | ok: true, |
| 1761 | arxiv_categories: [ |
| 1762 | { id: "cs.CL", name: "cs.CL" }, |
| 1763 | { id: "cs.AI", name: "cs.AI" }, |
| 1764 | { id: "cs.IR", name: "cs.IR" }, |
| 1765 | { id: "cs.LG", name: "cs.LG" } |
| 1766 | ], |
| 1767 | conferences: [ |
| 1768 | { id: "ICLR", name: "ICLR", group: "ML", source: "openreview.net API", venue_id: "ICLR.cc", acceptance_timeline: "1 月底", conference_date: "4-5 月" }, |
| 1769 | { id: "NeurIPS", name: "NeurIPS", group: "ML", source: "openreview.net API", venue_id: "NeurIPS.cc", acceptance_timeline: "9 月底", conference_date: "12 月" }, |
| 1770 | { id: "ACL", name: "ACL", group: "NLP", source: "openreview / aclanthology", venue_id: "ACL.org", acceptance_timeline: "5 月", conference_date: "7-8 月" }, |
| 1771 | { id: "SIGIR", name: "SIGIR", group: "IR", source: "DBLP / ACM DL", venue_id: "SIGIR.org", acceptance_timeline: "4 月", conference_date: "7 月" } |
| 1772 | ], |
| 1773 | journals: [ |
| 1774 | { id: "Nature Machine Intelligence", name: "Nature MI" }, |
| 1775 | { id: "JMLR", name: "JMLR" }, |
| 1776 | { id: "TOIS", name: "TOIS" } |
| 1777 | ] |
| 1778 | }; |
| 1779 | } |
| 1780 | if (route === "/api/latest-push" || route === "/api/daily/start") { |
| 1781 | return { |
| 1782 | ok: true, |
| 1783 | task: { task_id: "demo-task", status: "completed" }, |
| 1784 | push: { |
| 1785 | push_id: "push_demo_20260610", |
| 1786 | push_time: "2026-06-10 08:00", |
| 1787 | papers: demoPapers, |
| 1788 | metadata: { |
| 1789 | total_fetched: 247, |
| 1790 | paper_count: 35, |
| 1791 | filtered_count: 35 |
| 1792 | } |
| 1793 | } |
| 1794 | }; |
| 1795 | } |
| 1796 | if (route === "/api/daily/status") { |
| 1797 | return { |
| 1798 | ok: true, |
| 1799 | task: { |
| 1800 | task_id: "demo-task", |
| 1801 | status: "completed", |
| 1802 | push: { |
no test coverage detected