feat: add Citations and WatchlistChat components, integrate with API

- Implemented Citations component to display citation data.
- Created WatchlistDrawer and ChatSidebar components for managing watchlists and AI chat functionality.
- Integrated API calls for watchlist management and chat interactions.
- Updated index.tsx to include new components in the main application layout.
- Added API client in lib/api.ts for structured API interactions.
- Developed Alerts, Dashboard, Portfolio, Routines, Screener, and Report pages with relevant data fetching and UI components.
- Introduced styles in tokens.css for consistent theming across the application.
- Configured TypeScript and Vite for project setup and development.
This commit is contained in:
asepharyana
2026-09-15 12:36:48 +07:00
parent 0db2cf28b3
commit 8c184ccae1
111 changed files with 12349 additions and 62 deletions
+16 -3
View File
@@ -29,10 +29,22 @@ Errors: `{error: {code, message}}` with HTTP 400/404/422/502 (502 = upstream Sec
- `GET /api/alerts`, `POST /api/alerts` body `{name, rule, channels[]}`,
`DELETE /api/alerts/:id`, `GET /api/alert-events?since=&ticker=`.
## Destinations (push targets per user)
- `GET /api/destinations` → `[{id, kind, label, enabled, configured}]`. Secrets are never returned.
- `POST /api/destinations` body `{kind: telegram|discord, label?, bot_token?, chat_id?, webhook_url?}` → created (422 on wrong kind or missing secret).
- `PATCH /api/destinations/:id` body `{label?, enabled?, bot_token?, chat_id?, webhook_url?}` → patched (kind immutable; omitted secret = keep).
- `DELETE /api/destinations/:id` → removed.
Delivery: routines and alerts push to the owner's **enabled** destinations. When the owner has none, the server-level env webhook (`TELEGRAM_*` / `DISCORD_*`) is used as fallback; when neither exists delivery is record-only.
## Report
- `POST /api/report/:ticker` query `?format=json|html|pdf|md` → 7-section payload
with `citations[]` per section. PDF rendered server-side.
- `POST /api/report/:ticker` query `?format=json|html|pdf|md&profile=moderate|conservative|aggressive`
→ 7-section payload with `citations[]` per section. PDF rendered server-side.
- `POST /api/report/:ticker/ask` body `{question, report_id?}` → follow-up answer
grounded ONLY in that report's citations (explicit id or latest for the ticker;
cross-ticker ids are rejected).
## Watchlist / portfolio / accuracy / chat / health
@@ -41,4 +53,5 @@ Errors: `{error: {code, message}}` with HTTP 400/404/422/502 (502 = upstream Sec
- `GET /api/accuracy` → per-agent `{calls, resolved, hits, hit_rate}`.
- `POST /api/chat` body `{message, scope?: {report_id}}` → cited answer (report scope
restricts grounding to that report's citations).
- `GET /api/health` → `{last_cycle_at, credits_today, scheduler_ok, stale_flags}`.
- `GET /api/health` (`?force=1` runs one synchronous probe cycle) →
`{last_cycle_at, credits_today, scheduler_ok, stale_flags}`.