Refactor UUID generation, remove unused logger and encryption utilities, and clean up request handling

- Updated `generateUUID` function for improved readability and performance.
- Deleted `logger.ts`, `other.ts`, `request.ts`, `storage.ts`, `tansParams.ts`, and `validate.ts` as they were no longer needed.
- Simplified TypeScript configuration by removing unnecessary paths and aliases.
- Enhanced Vite configuration for better project structure and maintainability.
This commit is contained in:
DEV_DSW
2026-04-17 15:38:08 +08:00
parent b1dea9a5c2
commit 79bea4f107
360 changed files with 14495 additions and 30856 deletions

View File

@@ -1,136 +1,106 @@
# zn-ai Vue 退场清单
# zn-ai Vue Exit Checklist
目标:在 React 接管默认入口后,按清单删除所有仅服务 Vue 的资产,最终收敛为 `React-only`
Goal: move `zn-ai` from "React renderer plus leftover Vue-era assets/config" to a truly `React-only` repo, while keeping build and typecheck green at each step.
## 当前状态
## Current Status
- `Home` 的 React 主链路已经接入真实 `chat/task/channel` store、真实 IPC以及 `TaskOperationDialog / AddChannelDialog`
- `Home` 这批旧 Vue 文件目前仍被 `src/router/index.ts -> src/pages/home/index.vue` 的 Vue fallback 引用,因此本轮不能直接删除。
- 其余主页面虽然已有 `src-react/pages/*` 路由壳,但当前大多还是占位页,尚不满足“删除 Vue 路由与页面”的退场条件。
- Renderer bootstrap is React-only.
- `index.html`
- `src/main.tsx`
- `src/**` is now the active React renderer tree and no longer reaches back into the removed Vue code.
- Electron/shared runtime no longer imports from `src/lib/*`, `src/shared/*`, or `src/i18n/locales/*`.
- active runtime callers now use `@runtime/* -> runtime-shared/*`
- Legacy compatibility/config cleanup is complete.
- removed `@vitejs/plugin-vue`
- removed `unplugin-auto-import`
- removed Vue module declarations from `global.d.ts`
- removed stale `src/**` path aliases from Vite and TypeScript
- moved `openapi-ts-request` output to `src/api`
- added `src/api/request.ts` as the React-side generated request bridge
- The old Vue tree is gone end-to-end.
- deleted `src/main-vue.ts`
- deleted `src/router/index.ts`
- deleted `src/permission.ts`
- deleted `src/App.vue`
- deleted the remaining `src/**` directory, including `src/main.ts` and `src/framework.ts`
- Vue-era runtime dependencies are gone from `package.json`.
- removed `vue`
- removed `pinia`
- removed `vue-router`
- removed `element-plus`
- removed `vue-i18n`
- removed `@remixicon/vue`
- removed `@lucide/vue`
- removed `vue-codemirror`
- removed `vue-markdown-render`
- removed `@vueuse/core`
当前删除策略:
## What This Means
1. 先停止新增对 `src/pages/home/**``src/stores/chat.ts``src/stores/task.ts``src/stores/channel.ts` 的 React 侧依赖。
2.`Agents / Knowledge / Skills / Cron / Scripts / Setting / Login` 的 React 页面完成真实迁移后,再统一删除 `src/router/*``.vue` 页面和旧 Pinia store。
3. 在此之前,只做“替换引用”和“收口依赖”,不做会破坏 Vue fallback 的物理删除。
- The old Vue runtime path is no longer present in the source tree.
- `src/**` is no longer a live runtime or config boundary.
- The remaining follow-up is mostly housekeeping, not migration-blocking runtime work.
- stale historical references in docs
- optional cleanup of `package-lock.json` if the repo standardizes on `pnpm` only
- the known bytecode warning when the local Electron binary is missing
## 1. 入口与切换层
## File Plan
- `src/main-vue.ts`
- `src/framework.ts`
- `src/main.ts`
- `src/App.vue`
- `src/permission.ts`
### 1. `package.json`
退场标准:
#### Done
- `src/main.ts` 不再分流 Vue 入口。
- `src/framework.ts` 不再保留 `vue` 分支。
- `src/main-vue.ts` 删除。
- `src/App.vue``src/permission.ts` 只要还依赖 Vue 生命周期或 Router 守卫,就必须迁入 React 后再删除旧文件。
- removed the Vue-era runtime/UI dependencies from the manifest
- refreshed `pnpm-lock.yaml`
## 2. Vue 页面
### 2. `global.d.ts`
以下页面都属于 Vue 退场范围React 版本完成后删除:
#### Done
- `src/pages/home/index.vue`
- `src/pages/home/ChatBox.vue`
- `src/pages/home/ChatHistory.vue`
- `src/pages/home/TaskCenter.vue`
- `src/pages/home/components/*.vue`
- `src/pages/login/index.vue`
- `src/pages/agents/index.vue`
- `src/pages/knowledge/index.vue`
- `src/pages/skills/index.vue`
- `src/pages/skills/components/*.vue`
- `src/pages/cron/index.vue`
- `src/pages/cron/components/*.vue`
- `src/pages/setting/index.vue`
- `src/pages/setting/components/*.vue`
- removed `declare module "@stores/*";`
- removed `declare module "@service/*";`
- removed `declare module "@utils/*";`
- removed `declare module "@constant/*";`
- removed `declare module "vue-router";`
- removed `declare module "*.vue"`
- removed `declare module "@remixicon/vue"`
- removed `declare module "@assets/images/*"`
建议删除顺序:
### 3. `tsconfig.app.json`
1. 先迁 `home`,再迁其余业务页。
2. 先删纯展示/表单页,再删聊天主链路。
3. 最后统一清理页面下的 Vue 子组件目录。
#### Done
## 3. Vue Store
- removed explicit include for `src/permission.ts`
- removed `include: "src/**/*.vue"`
- removed the remaining dead `src/**` path aliases
以下 `Pinia` store 是 Vue 体系的核心状态React 完成对等实现后删除:
### 4. `vite.config.ts`
- `src/stores/chat.ts`
- `src/stores/providers.ts`
- `src/stores/channel.ts`
- `src/stores/cron.ts`
- `src/stores/script.ts`
- `src/stores/skills.ts`
- `src/stores/task.ts`
- `src/stores/theme.ts`
- `src/stores/locale.ts`
- `src/stores/update.ts`
- `src/stores/userinfo.ts`
- `src/stores/sharedStore.ts`
#### Done
退场标准:
- active renderer build is React-only
- Electron shared runtime uses `@runtime/*`
- removed the legacy `src/**` alias surface from the Vite config
- React 侧已具备对等 store 后,旧 Pinia store 不再被任何路由或组件引用。
- `src/stores/*` 不再承担主流程状态。
## Recommended Execution Order
## 4. Router 与守卫
1. Done: remove low-risk compatibility items from `package.json` and `global.d.ts`
2. Done: remove the dead Vue bootstrap chain
3. Done: remove the dead Vue page/component/store/request tree
4. Done: delete `src/main.ts`, `src/framework.ts`, and the remaining dead `src/**` files
5. Done: trim stale TypeScript/Vite/OpenAPI alias surface that pointed into deleted legacy areas
6. Done: remove the remaining Vue-era dependencies from `package.json`
需要替换或删除的 Vue 路由资产:
## Residual Notes
- `src/router/index.ts`
- `src/constant/menus.ts`
- `src/permission.ts`
- `src/components/SideMenus/index.vue`
- Keep `@runtime/* -> runtime-shared/*`, which is now the active Electron/shared-runtime boundary.
- `package-lock.json` still contains historical Vue-era entries, but the active workspace lockfile is `pnpm-lock.yaml`.
退场标准:
## Next Gate
- 路由切换完全由 React Router 接管。
- 菜单配置不再依赖 Vue 路由表。
- 登录守卫迁到 React 侧后,旧守卫文件删除。
Vue exit is effectively complete for source/runtime once all of the following remain true:
## 5. 仅服务 Vue 的共享组件
这些组件如果只被 Vue 页面使用,应在 React 对等实现后删除:
- `src/components/Layout/index.vue`
- `src/components/Layout/TitleBar/index.vue`
- `src/components/NativeTooltip/index.vue`
- `src/components/Pagination/index.vue`
- `src/components/TitleSection/index.vue`
## 6. Vue 依赖与构建项
`package.json` 中后续需要删除或替换的 Vue 依赖:
- `vue`
- `vue-router`
- `pinia`
- `vue-i18n`
- `element-plus`
- `@vueuse/core`
- `@vitejs/plugin-vue`
- `@lucide/vue`
- `@remixicon/vue`
- `vue-codemirror`
- `vue-markdown-render`
`vite.config.ts` 中后续需要清理的 Vue 构建项:
- `vue()` 插件
- `unplugin-auto-import` 的 Vue 自动导入配置
- 与 Vue 页面强绑定的 `src/auto-imports.d.ts` 生成链路
- 所有仅为 Vue 入口保留的分支判断
## 7. 最终删除判定
只有在以下条件都满足后,才允许进入最终清理提交:
- 默认入口只剩 React。
- 所有主页面都已迁到 `src-react/`
- `src/pages/**` 中不再存在可执行的 Vue 页面。
- `src/stores/**` 中不再存在被运行时调用的 Vue 状态。
- `package.json``vite.config.ts` 中不再保留 Vue 构建依赖。
- 仓库中不再需要 `VITE_UI_FRAMEWORK=vue` 作为运行开关。
1. no source file imports any Vue-era runtime package
2. `package.json` stays free of the Vue-era dependencies and `pnpm-lock.yaml` stays refreshed
3. Vite/TypeScript/OpenAPI config stays off `src/**`
4. `pnpm typecheck` and `pnpm build:vite` stay green