Files

74 lines
2.3 KiB
Markdown
Raw Permalink 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.
# 随身助手 Companion Assistant
一个跨端随身助手系统:对话、智能体、多类型项目开发(编程 / 研究 / 办公 / 写作 / 视频分析)。
- **前端**Vue 3 + Vant 4 + PWA(浏览器直接用,安卓可安装到桌面,Capacitor 可打包原生 App
- **后端**Python FastAPIREST + WebSocketOpenAPI 标准文档)
- **解耦**:前后端分离,纯 API 通信,模块化分层
## 快速开始
### 后端
```bash
cd backend
pip install -r requirements.txt
./start.sh # 或 python3 -m uvicorn app.main:app --host 0.0.0.0 --port 16080
```
- API 文档: http://<host>:16080/docs
- 健康检查: http://<host>:16080/api/health
### 前端
```bash
cd frontend
npm install
npm run dev # 开发模式
npm run build # 构建 PWA 产物 → dist/
```
### 转安卓/iOS AppCapacitor
```bash
cd frontend
npm run build
npx cap sync android
npx cap open android # Android Studio 打包 APK
```
## 目录结构
```
companion-assistant/
├── backend/ # FastAPI 后端
│ ├── app/
│ │ ├── api/ # 路由层(auth/chat/agents/projects/files/tasks/ws
│ │ ├── core/ # 配置、安全、LLM 客户端
│ │ ├── models/ # SQLAlchemy 模型
│ │ ├── schemas/ # Pydantic 校验模型
│ │ ├── services/ # 业务逻辑层
│ │ ├── database.py
│ │ └── main.py
│ └── data/ # SQLite + 上传文件 + 项目工作目录
├── frontend/ # Vue 3 + Vant + PWA 前端
├── docs/ # 架构文档、API 文档
└── README.md
```
## 核心模块
| 模块 | 说明 |
|------|------|
| 对话 | 多会话、流式输出(WebSocket)、Markdown 渲染 |
| 智能体 | 预置 + 自定义角色(系统提示词 + 模型 + 工具),类似 GPTs |
| 项目 | 编程 / 研究 / 办公 / 写作 / 视频分析,独立工作目录 + 任务流 |
| 文件 | 上传/下载/管理,项目文件隔离 |
| 任务 | 后台异步任务(视频分析等耗时操作) |
## 技术栈
- 后端: FastAPI / SQLAlchemy 2.0 / SQLite(可换 PostgreSQL) / OpenAI 兼容 SDK
- 前端: Vue 3 / Vite / Vant 4 / Pinia / Vue Router / vite-plugin-pwa / Capacitor
- LLM: OpenAI 兼容适配(火山方舟 doubao、DeepSeek、Qwen、AutoDL 可切换)