Merge pull request #92 from xinnan-tech/doc

🎈 perf: 优化开发
This commit is contained in:
欣南科技
2025-02-20 11:01:56 +08:00
committed by GitHub
7 changed files with 98 additions and 24 deletions
-5
View File
@@ -37,11 +37,6 @@ RUN poetry install --no-root
# 从构建阶段复制虚拟环境和前端构建产物
COPY --from=frontend-builder /app/ZhiKongTaiWeb/dist /app/manager/static/webui
# 下载模型文件(断点续传 + 自动重试)
RUN mkdir -p /app/model/SenseVoiceSmall && \
wget -O /app/model/SenseVoiceSmall/model.pt -c --tries=5 --waitretry=5 \
https://modelscope.cn/models/iic/SenseVoiceSmall/resolve/master/model.pt
# 设置虚拟环境路径
ENV PATH="/app/.venv/bin:$PATH"
+1 -7
View File
@@ -24,13 +24,7 @@ WORKDIR /app
COPY requirements.txt .
# 优化apt安装
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list && \
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y --no-install-recommends gcc libopus-dev ffmpeg && \
rm -rf /var/lib/apt/lists/* && \
# 直接使用系统Python
pip install --no-cache-dir -r requirements.txt \
RUN pip install --no-cache-dir -r requirements.txt \
-i https://pypi.tuna.tsinghua.edu.cn/simple
# 第三阶段:生产镜像
+83 -9
View File
@@ -1,14 +1,88 @@
# Vue 3 + Vite
# Vue 3 + Vite 项目配置文档
项目使用Vue3 + Vite实现
## 开发环境配置
在当前目录执行以下命令进入开发模式
### 使用 Poetry 配置开发环境
```
npm run dev
在项目根目录中执行以下命令安装 Python 依赖:
```sh
poetry install
```
执行以下命令打包
```
npm run build
```
---
## 安装项目依赖
你可以选择以下任意一个包管理工具(`npm``yarn``pnpm`)来管理项目依赖。
### 通用命令
- `install`:安装项目依赖
- `dev`:同时启动前后端
- `dev:ui`:启动前端
- `dev:api`:启动后端
- `dev:d`:在 Docker 环境下同时启动前后端
- `build`:打包项目
---
### 使用 npm
1. 安装依赖:
```sh
npm install
```
2. 启动开发模式:
```sh
npm run dev
```
3. 打包项目:
```sh
npm run build
```
### 使用 yarn
1. 安装依赖:
```sh
yarn install
```
2. 启动开发模式:
```sh
yarn dev
```
3. 打包项目:
```sh
yarn build
```
### 使用 pnpm
1. 安装依赖:
```sh
pnpm install
```
2. 启动开发模式:
```sh
pnpm run dev
```
3. 打包项目:
```sh
pnpm run build
```
+2 -1
View File
@@ -6,7 +6,8 @@
"scripts": {
"dev": "concurrently -n 'Frontend,Backend' -c 'blue,green' 'yarn run dev:ui' 'npm run dev:api'",
"dev:ui": "vite",
"dev:api": "cd .. && poetry run python manager/http_server.py",
"dev:api": "cd .. && poetry run python app.py",
"dev:d": "docker exec xiaozhi-env poetry run python app.py",
"build": "vite build",
"preview": "vite preview"
},
+2 -1
View File
@@ -9,4 +9,5 @@ services:
- "8000:8000"
- "8002:8002"
volumes:
- ./data:/app/data
- ./data:/app/data
- ./models/SenseVoiceSmall/model.pt:/app/models/SenseVoiceSmall/model.pt
+9
View File
@@ -112,6 +112,15 @@ LLM:
- 线路二:百度网盘下载[SenseVoiceSmall](https://pan.baidu.com/share/init?surl=QlgM58FHhYv1tFnUT_A8Sg&pwd=qvna) 提取码:
`qvna`
huggingface地址:
```
https://huggingface.co/jinaai/jina-embeddings-v2-base-zh?clone=true
https://huggingface.co/FunAudioLLM/SenseVoiceSmall/tree/main?clone=true
```
镜像地址`https://hf-mirror.com/`
## 运行状态确认
+1 -1
View File
@@ -38,7 +38,7 @@ class WebUI:
self.session_manager = SessionManager()
# 添加静态文件路径
self.static_path = os.path.join(root_dir, 'manager', 'static', 'webui')
self.static_path = os.path.join(root_dir, 'ZhiKongTaiWeb', 'dist')
self.setup_routes()
self.setup_cors()