docs: record sub2api frontend comparison

This commit is contained in:
Codex Agent
2026-06-12 02:28:36 +08:00
parent 7100e51189
commit 55c91043ed
@@ -29,6 +29,18 @@
## Sub2API 分层对照
Sub2API `v0.1.136` 对照必须来自真实 frontend 源码,不允许凭记忆复写。当前迁移基线读取过以下文件:
| Sub2API 文件 | HWLAB 吸收结论 |
|---|---|
| `frontend/package.json``frontend/vite.config.ts` | Vue 3、Pinia、Vue Router、Vue I18n、Tailwind/PostCSS 作为单一前端栈;HWLAB 删除 React 入口和 React 依赖,不做长期双栈。 |
| `frontend/src/main.ts``frontend/src/App.vue` | `main.ts` 只负责安装 Pinia/router/i18n 并挂载 app`App.vue` 保持全局 shell、route outlet、toast/弹窗类横切组件,不承载业务状态机。 |
| `frontend/src/router/index.ts``frontend/src/router/title.ts` | 路由按 public/user/admin 分段懒加载,metadata 表达 auth/admin/titleHWLAB 保留默认首屏 workbench,并保持 Cloud Web 同源入口。 |
| `frontend/src/components/layout/AppLayout.vue``AppSidebar.vue``AppHeader.vue` | 平台壳拆成 layout 组件和导航数据;HWLAB 采用同类分层,但导航语义改为 Workbench、Code Agent、HWPOD、Access、Provider。 |
| `frontend/src/components/common/NavigationProgress.vue``StatusBadge.vue``Skeleton.vue``EmptyState.vue` | common 组件只承载视觉/反馈原语,可复用为 HWLAB 的状态标记、加载态、空态、导航进度。 |
| `frontend/src/views/user/DashboardView.vue``frontend/src/views/admin/DashboardView.vue` | user/admin view 只组合 layout、common 和业务 store,不把 API fetch 散落到 app shellHWLAB 的 workbench/dashboard/admin 页面遵循同样边界。 |
| `frontend/src/i18n/index.ts``frontend/src/style.css``frontend/tailwind.config.js` | i18n 初始化、Tailwind base/components/utilities、颜色和字体 token 集中管理;HWLAB 保留自己的文案和 Web session 约束,不照搬 Sub2API token/Secret/刷新策略。 |
| Sub2API 形态 | 可吸收部分 | HWLAB 必须改写部分 |
|---|---|---|
| `api/client.ts` axios instance、request/response interceptor、统一 unwrap `{ code, data }` | api client 是独立模块,业务 endpoint 放在 `src/api/*.ts`;请求取消保持原错误,便于调用方忽略。 | HWLAB 不使用 localStorage `auth_token``refresh_token` 或 401 token refresh queue;保留 same-origin cookie session、`ApiResult<T>``activityRef` inactivity-timeout。 |