* fix(frontend): recover the chat stream from an expired access token The SSE chat request runs on raw fetch, outside the axios instance, so the 401 refresh flow in utils/request.ts never applied to it. An expired token left the user staring at an orphaned message bubble and a dead-end "HTTP 401" toast, with no re-login prompt until some unrelated polling request happened to hit 401 seconds later. Extract the refresh into a shared, de-duplicated helper and have the stream client use it: on a 401 handshake, refresh once and replay the request. The replay cannot duplicate a message because auth rejects before the handler runs, and nothing has been rendered yet. Embed visitors are excluded since their token cannot be refreshed by the SPA. * fix(frontend): keep a minted session after a post-refresh SSE 401 A second chat handshake 401 is not proof the session is gone — tenant lookup also returns 401 — so wiping the just-refreshed tokens logged users out unlike axios. Identify StreamAuthError by name, pin replay to the original abort controller, and cover the shared refresh queue with unit tests. --------- Co-authored-by: wizardchen <wizardchen@tencent.com> |
||
|---|---|---|
| .. | ||
| packages | ||
| public | ||
| src | ||
| .dockerignore | ||
| .gitignore | ||
| Dockerfile | ||
| docker-entrypoint.sh | ||
| embed.html | ||
| env.d.ts | ||
| index.html | ||
| nginx-api-proxy.conf | ||
| nginx.conf | ||
| package-lock.json | ||
| package.json | ||
| package.json.md5 | ||
| pnpm-workspace.yaml | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||