Files
duocthu/apps/web

web

Next.js frontend: chat UI, citation/evidence panel, drug autocomplete, persistent clinical disclaimer banner.

Current call path: browser → this app's own route handlers → ai-service. api-gateway is not built yet (its directory holds a README.md and a package.json), so requests go through app/api/ and on to ai-service (API_GATEWAY_URL ?? AI_SERVICE_URL, set to http://ai-service:8000 in production). There is no authentication layer in this path today. When the gateway and auth services are built, this is the seam that changes.

app/api/chat/route.ts is more than a proxy: it maps ai-service's abstain reason codes to the Vietnamese text the user reads. A reason code with no entry there falls back to wording that reads as "no data in the formulary", which would misrepresent an outage or a timeout — so a new backend reason code needs an entry here in the same change.

Timeouts: _components/ChatPanel.tsx aborts a request at 65s, derived from the backend's ceiling (a 40s request budget that can overrun by one in-flight model call). A lower value can cut off answers the server has successfully produced, so keep it above that ceiling if it is ever revisited.

Running

pnpm install
pnpm --filter web dev     # http://localhost:3000, expects ai-service on :8079

Tests

There are none, and no test runner is configured. Verify changes by driving the real UI in a browser; pytest passing in apps/ai-service says nothing about this app.