Files
yaoayanui/.cursor/rules/aiclient-overview.mdc
949036910@qq.com 9c6650373f 1111
2026-05-30 18:44:16 +08:00

50 lines
1.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
description: aiclient 项目总览与通用约定
alwaysApply: true
---
# aiclient 项目约定
## 仓库拆分
| 仓库 | 职责 |
|------|------|
| **aiclient**(本仓库) | Tauri 2 桌面壳、Rust 业务、updater、打包 |
| **aiclient_ui**`../aiclient_ui` | Vue 3 前端Vite 开发/构建 |
`tauri.conf.json` 的 `frontendDist` 为占位目录 `frontend-stub`**发布构建不编译前端**;运行时加载服务器上的 HTML/CSS/JS见 `lib.rs` 中 `PROD_WEB_URL`)。前端开发/部署在 **aiclient_ui** 仓库。
## 常用命令
- 在 **aiclient_ui**`npm run dev` — 仅 Web`npm run build:deploy` — 部署到服务器静态目录
- 在 **aiclient**`npm run dev` — `tauri dev`(调试时连本地 Vite
- 在 **aiclient**`npm run tauri:build` — 仅打包 Rust/updater不构建前端
## 后端 API 约定pythonbackend
前端通过 HTTP 对接 `f:\projects\pythonbackend`FastAPI默认 `http://127.0.0.1:8001`)。业务接口前缀 `/api/v1`。
### 统一响应 `ApiResponse<T>`
| 字段 | 类型 | 说明 |
|------|------|------|
| `ok` | `boolean` | 业务是否成功 |
| `message` | `string` | 用户可见提示 |
| `data` | `T \| null` | 成功载荷 |
业务失败仍返回 **HTTP 200** + `ok: false`。未认证返回 **401**。
### 认证
- JWT`Authorization: Bearer <access_token>`
- 登出:`POST /api/v1/auth/logout`
### 环境
- 前端 `VITE_*`aiclient_ui 的 `.env`
- Rust `AICLIENT_*`aiclient 根目录 `.env`
## 通用原则
- 用户界面文案默认使用简体中文