更新
This commit is contained in:
@@ -251,6 +251,47 @@ pm2 stop vigent2-latentsync # 停止 LatentSync 服务
|
||||
pm2 delete all # 删除所有服务
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 步骤 10: 配置 Nginx HTTPS (可选 - 公网访问)
|
||||
|
||||
如果您需要通过公网域名 HTTPS 访问 (如 `https://vigent.hbyrkj.top`),请参考以下 Nginx 配置。
|
||||
|
||||
**前置条件**:
|
||||
1. 已申请 SSL 证书 (如 Let's Encrypt)。
|
||||
2. 使用 FRP 或其他方式将本地 3002 端口映射到服务器。
|
||||
|
||||
**配置示例** (`/etc/nginx/conf.d/vigent.conf`):
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name your.domain.com;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name your.domain.com;
|
||||
|
||||
ssl_certificate /path/to/fullchain.pem;
|
||||
ssl_certificate_key /path/to/privkey.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3002; # 转发给 Next.js 前端
|
||||
|
||||
# 必须配置 WebSocket 支持,否则热更和即时通信失效
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 故障排除
|
||||
|
||||
88
Docs/DevLogs/Day10.md
Normal file
88
Docs/DevLogs/Day10.md
Normal file
@@ -0,0 +1,88 @@
|
||||
---
|
||||
|
||||
## 🔧 隧道访问与视频播放修复 (11:00)
|
||||
|
||||
### 问题描述
|
||||
在通过 FRP 隧道 (如 `http://8.148.x.x:3002`) 访问时发现:
|
||||
1. **视频无法播放**:后端返回 404 (Not Found)。
|
||||
2. **发布页账号列表为空**:后端返回 500 (Internal Server Error)。
|
||||
|
||||
### 解决方案
|
||||
|
||||
#### 1. 视频播放修复
|
||||
- **后端 (`main.py`)**:这是根源问题。后端缺少 `uploads` 目录的挂载,导致静态资源无法访问。
|
||||
```python
|
||||
app.mount("/uploads", StaticFiles(directory=str(settings.UPLOAD_DIR)), name="uploads")
|
||||
```
|
||||
- **前端 (`next.config.ts`)**:添加反向代理规则,将 `/outputs` 和 `/uploads` 转发到后端端口 8006。
|
||||
```typescript
|
||||
{
|
||||
source: '/uploads/:path*',
|
||||
destination: 'http://localhost:8006/uploads/:path*',
|
||||
},
|
||||
{
|
||||
source: '/outputs/:path*',
|
||||
destination: 'http://localhost:8006/outputs/:path*',
|
||||
}
|
||||
```
|
||||
|
||||
#### 2. 账号列表 500 错误修复
|
||||
- **根源**:`backend/app/core/paths.py` 中的白名单缺少 `weixin` 和 `kuaishou`。
|
||||
- **现象**:当 `PublishService` 遍历所有平台时,遇到未在白名单的平台直接抛出 `ValueError`,导致整个接口崩溃。
|
||||
- **修复**:更新白名单。
|
||||
```python
|
||||
VALID_PLATFORMS: Set[str] = {"bilibili", "douyin", "xiaohongshu", "weixin", "kuaishou"}
|
||||
```
|
||||
|
||||
### 结果
|
||||
- ✅ 视频预览和历史视频均可正常播放。
|
||||
- ✅ 发布页账号列表恢复显示。
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Nginx HTTPS 部署 (11:30)
|
||||
|
||||
### 需求
|
||||
用户在阿里云服务器上配置了 SSL 证书,需要通过 HTTPS 访问应用。
|
||||
|
||||
### 解决方案
|
||||
提供了 Nginx 配置文件 `nginx_vigent.conf`,配置了:
|
||||
1. **HTTP -> HTTPS 重定向**。
|
||||
2. **SSL 证书路径** (`/etc/letsencrypt/live/vigent.hbyrkj.top/...`)。
|
||||
3. **反向代理** 到本地 FRP 端口 (3002)。
|
||||
4. **WebSocket 支持** (用于 Next.js 热更和通信)。
|
||||
|
||||
### 结果
|
||||
- ✅ 用户可通过 `https://vigent.hbyrkj.top` 安全访问。
|
||||
- ✅ 代码自适应:前端 `API_BASE` 为空字符串,自动适配 HTTPS 协议,无需修改代码。
|
||||
|
||||
---
|
||||
|
||||
## 🎨 UI 细节优化 (11:45)
|
||||
|
||||
### 修改
|
||||
- 修改 `frontend/src/app/layout.tsx` 中的 Metadata。
|
||||
- 标题从 `Create Next App` 改为 `ViGent`。
|
||||
|
||||
### 结果
|
||||
- ✅ 浏览器标签页名称已更新。
|
||||
|
||||
---
|
||||
|
||||
## 🚪 用户登录退出功能 (12:00)
|
||||
|
||||
### 需求
|
||||
用户反馈没有退出的入口。
|
||||
|
||||
### 解决方案
|
||||
- **UI 修改**:在首页和发布管理页面的顶部导航栏添加红色的“退出”按钮 (位于最右侧)。
|
||||
- **逻辑实现**:
|
||||
```javascript
|
||||
onClick={async () => {
|
||||
if (confirm('确定要退出登录吗?')) {
|
||||
await fetch(`${API_BASE}/api/auth/logout`, { method: 'POST' });
|
||||
window.location.href = '/login';
|
||||
}
|
||||
}}
|
||||
```
|
||||
- **部署**:已同步代码并重建前端。
|
||||
204
Docs/Logs.md
Normal file
204
Docs/Logs.md
Normal file
@@ -0,0 +1,204 @@
|
||||
rongye@r730-ubuntu:~/ProgramFiles/ViGent2$ pm2 logs vigent2-latentsync
|
||||
[TAILING] Tailing last 15 lines for [vigent2-latentsync] process (change the value with --lines option)
|
||||
/home/rongye/.pm2/logs/vigent2-latentsync-out.log last 15 lines:
|
||||
/home/rongye/.pm2/logs/vigent2-latentsync-error.log last 15 lines:
|
||||
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
|
||||
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
|
||||
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
|
||||
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
|
||||
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
|
||||
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
|
||||
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
|
||||
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
|
||||
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
|
||||
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
|
||||
15|vigent2 | SyntaxError: Non-UTF-8 code starting with '\x80' in file /usr/bin/python on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
|
||||
15|vigent2 | INFO: Started server process [1437489]
|
||||
15|vigent2 | INFO: Waiting for application startup.
|
||||
15|vigent2 | INFO: Application startup complete.
|
||||
15|vigent2 | INFO: Uvicorn running on http://0.0.0.0:8007 (Press CTRL+C to quit)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
rongye@r730-ubuntu:~/ProgramFiles/ViGent2$ pm2 logs vigent2-frontend
|
||||
[TAILING] Tailing last 15 lines for [vigent2-frontend] process (change the value with --lines option)
|
||||
/home/rongye/.pm2/logs/vigent2-frontend-error.log last 15 lines:
|
||||
11|vigent2 | at ignore-listed frames
|
||||
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2 | at ignore-listed frames
|
||||
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2 | at ignore-listed frames
|
||||
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2 | at ignore-listed frames
|
||||
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2 | at ignore-listed frames
|
||||
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2 | at ignore-listed frames
|
||||
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2 | at ignore-listed frames
|
||||
11|vigent2 | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2 | at ignore-listed frames
|
||||
|
||||
/home/rongye/.pm2/logs/vigent2-frontend-out.log last 15 lines:
|
||||
11|vigent2 |
|
||||
11|vigent2 | ✓ Starting...
|
||||
11|vigent2 |
|
||||
11|vigent2 | > frontend@0.1.0 start
|
||||
11|vigent2 | > next start -p 3002 -p 3002
|
||||
11|vigent2 |
|
||||
11|vigent2 | ▲ Next.js 16.1.1
|
||||
11|vigent2 | - Local: http://localhost:3002
|
||||
11|vigent2 | - Network: http://192.168.110.200:3002
|
||||
11|vigent2 |
|
||||
11|vigent2 | ✓ Starting...
|
||||
11|vigent2 |
|
||||
11|vigent2 | > frontend@0.1.0 start
|
||||
11|vigent2 | > next start -p 3002 -p 3002
|
||||
11|vigent2 |
|
||||
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
11|vigent2-frontend | > frontend@0.1.0 start
|
||||
11|vigent2-frontend | > next start -p 3002 -p 3002
|
||||
11|vigent2-frontend | ▲ Next.js 16.1.1
|
||||
11|vigent2-frontend | - Local: http://localhost:3002
|
||||
11|vigent2-frontend | - Network: http://192.168.110.200:3002
|
||||
11|vigent2-frontend | ✓ Starting...
|
||||
11|vigent2-frontend | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
|
||||
11|vigent2-frontend | at ignore-listed frames
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
**项目**:ViGent2 数字人口播视频生成系统
|
||||
**服务器**:Dell R730 (2× RTX 3090 24GB)
|
||||
**更新时间**:2026-01-23
|
||||
**整体进度**:100%(Day 9 部署稳定性优化完成)
|
||||
**更新时间**:2026-01-26
|
||||
**整体进度**:100%(Day 10 HTTPS 部署与细节完善)
|
||||
|
||||
## 📖 快速导航
|
||||
|
||||
@@ -138,6 +138,13 @@
|
||||
- [x] 部署服务自愈 (PM2 配置优化)
|
||||
- [x] 部署手册全量更新 (DEPLOY_MANUAL.md)
|
||||
|
||||
### 阶段十六:HTTPS 部署与细节完善 (Day 10)
|
||||
- [x] 隧道访问修复 (StaticFiles 挂载 + Rewrite)
|
||||
- [x] 平台账号列表 500 错误修复 (paths.py)
|
||||
- [x] Nginx HTTPS 配置 (反向代理 + SSL)
|
||||
- [x] 浏览器标题修改 (ViGent)
|
||||
- [x] 代码自适应 HTTPS 验证
|
||||
|
||||
---
|
||||
|
||||
## 🛤️ 后续规划
|
||||
@@ -301,5 +308,11 @@ Day 9: 发布模块优化 ✅ 完成
|
||||
- 前端生产构建流程修复
|
||||
- LatentSync 严重卡顿修复 (线程数限制)
|
||||
- 部署手册全量更新
|
||||
|
||||
Day 10: HTTPS 部署与细节完善 ✅ 完成
|
||||
- 隧道访问视频修正 (挂载 uploads)
|
||||
- 账号列表 Bug 修复 (paths.py 白名单)
|
||||
- 阿里云 Nginx HTTPS 部署
|
||||
- UI 细节优化 (Title 更新)
|
||||
```
|
||||
|
||||
|
||||
@@ -13,9 +13,8 @@ DEFAULT_TTS_VOICE=zh-CN-YunxiNeural
|
||||
|
||||
# =============== LatentSync 配置 ===============
|
||||
# GPU 选择 (0=第一块GPU, 1=第二块GPU)
|
||||
LATENTSYNC_GPU_ID=1
|
||||
LATENTSYNC_GPU_ID=0
|
||||
|
||||
# 使用本地模式 (true) 或远程 API (false)
|
||||
# 使用本地模式 (true) 或远程 API (false)
|
||||
LATENTSYNC_LOCAL=true
|
||||
|
||||
@@ -35,7 +34,7 @@ LATENTSYNC_GUIDANCE_SCALE=1.5
|
||||
LATENTSYNC_ENABLE_DEEPCACHE=true
|
||||
|
||||
# 随机种子 (设为 -1 则随机)
|
||||
LATENTSYNC_SEED=1247
|
||||
LATENTSYNC_SEED=-1
|
||||
|
||||
# =============== 上传配置 ===============
|
||||
# 最大上传文件大小 (MB)
|
||||
@@ -47,16 +46,16 @@ MAX_UPLOAD_SIZE_MB=500
|
||||
|
||||
# =============== Supabase 配置 ===============
|
||||
# 从 Supabase 项目设置 > API 获取
|
||||
SUPABASE_URL=https://zcmitzlqlyzxlgwagouf.supabase.co
|
||||
SUPABASE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InpjbWl0emxxbHl6eGxnd2Fnb3VmIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjkxMzkwNzEsImV4cCI6MjA4NDcxNTA3MX0.2NNkkR0cowopcsCs5bP-DTCksiOuqNjmhfyXGmLdTrM
|
||||
SUPABASE_URL=your_supabase_url_here
|
||||
SUPABASE_KEY=your_supabase_anon_key_here
|
||||
|
||||
# =============== JWT 配置 ===============
|
||||
# 用于签名 JWT Token 的密钥 (请更换为随机字符串)
|
||||
JWT_SECRET_KEY=F4MagRkf7nJsN-ag9AB7Q-30MbZRe7Iu4E9p9xRzyic
|
||||
JWT_SECRET_KEY=generate_your_secure_random_key_here
|
||||
JWT_ALGORITHM=HS256
|
||||
JWT_EXPIRE_HOURS=168
|
||||
|
||||
# =============== 管理员配置 ===============
|
||||
# 服务启动时自动创建的管理员账号
|
||||
ADMIN_EMAIL=
|
||||
ADMIN_PASSWORD=
|
||||
ADMIN_EMAIL=admin@example.com
|
||||
ADMIN_PASSWORD=change_this_password_immediately
|
||||
|
||||
@@ -19,7 +19,7 @@ def sanitize_filename(filename: str) -> str:
|
||||
return safe_name
|
||||
|
||||
|
||||
@router.post("/")
|
||||
@router.post("")
|
||||
async def upload_material(file: UploadFile = File(...)):
|
||||
if not file.filename.lower().endswith(('.mp4', '.mov', '.avi')):
|
||||
raise HTTPException(400, "Invalid format")
|
||||
@@ -47,7 +47,7 @@ async def upload_material(file: UploadFile = File(...)):
|
||||
"type": "video"
|
||||
}
|
||||
|
||||
@router.get("/")
|
||||
@router.get("")
|
||||
async def list_materials():
|
||||
materials_dir = settings.UPLOAD_DIR / "materials"
|
||||
files = []
|
||||
|
||||
@@ -46,7 +46,7 @@ def _get_user_id(request: Request) -> Optional[str]:
|
||||
return None
|
||||
|
||||
|
||||
@router.post("/", response_model=PublishResponse)
|
||||
@router.post("", response_model=PublishResponse)
|
||||
async def publish_video(request: PublishRequest, req: Request, background_tasks: BackgroundTasks):
|
||||
"""发布视频到指定平台"""
|
||||
# Validate platform
|
||||
|
||||
@@ -10,7 +10,7 @@ BASE_DIR = Path(__file__).parent.parent.parent
|
||||
USER_DATA_DIR = BASE_DIR / "user_data"
|
||||
|
||||
# 有效的平台列表
|
||||
VALID_PLATFORMS: Set[str] = {"bilibili", "douyin", "xiaohongshu"}
|
||||
VALID_PLATFORMS: Set[str] = {"bilibili", "douyin", "xiaohongshu", "weixin", "kuaishou"}
|
||||
|
||||
# UUID 格式正则
|
||||
UUID_PATTERN = re.compile(r'^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$', re.IGNORECASE)
|
||||
|
||||
@@ -101,7 +101,7 @@ def set_auth_cookie(response: Response, token: str) -> None:
|
||||
key="access_token",
|
||||
value=token,
|
||||
httponly=True,
|
||||
secure=True, # 生产环境使用 HTTPS
|
||||
secure=not settings.DEBUG, # 开发/测试环境(DEBUG=True)允许非HTTPS
|
||||
samesite="lax",
|
||||
max_age=settings.JWT_EXPIRE_HOURS * 3600
|
||||
)
|
||||
|
||||
@@ -24,6 +24,7 @@ settings.OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
(settings.UPLOAD_DIR / "materials").mkdir(exist_ok=True)
|
||||
|
||||
app.mount("/outputs", StaticFiles(directory=str(settings.OUTPUT_DIR)), name="outputs")
|
||||
app.mount("/uploads", StaticFiles(directory=str(settings.UPLOAD_DIR)), name="uploads")
|
||||
|
||||
# 注册路由
|
||||
app.include_router(materials.router, prefix="/api/materials", tags=["Materials"])
|
||||
|
||||
@@ -8,6 +8,14 @@ const nextConfig: NextConfig = {
|
||||
source: '/api/:path*',
|
||||
destination: 'http://localhost:8006/api/:path*', // 服务器本地代理
|
||||
},
|
||||
{
|
||||
source: '/uploads/:path*',
|
||||
destination: 'http://localhost:8006/uploads/:path*', // 转发上传的素材
|
||||
},
|
||||
{
|
||||
source: '/outputs/:path*',
|
||||
destination: 'http://localhost:8006/outputs/:path*', // 转发生成的视频
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
@@ -4,7 +4,9 @@ import { useState, useEffect } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { getCurrentUser, User } from '@/lib/auth';
|
||||
|
||||
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8006';
|
||||
const API_BASE = typeof window === 'undefined'
|
||||
? (process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8006')
|
||||
: '';
|
||||
|
||||
interface UserListItem {
|
||||
id: string;
|
||||
|
||||
@@ -13,8 +13,8 @@ const geistMono = Geist_Mono({
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
title: "ViGent",
|
||||
description: "ViGent Talking Head Agent",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import Link from "next/link";
|
||||
|
||||
// 动态获取 API 地址:服务端使用 localhost,客户端使用当前域名
|
||||
const API_BASE = typeof window !== 'undefined'
|
||||
? `http://${window.location.hostname}:8006`
|
||||
: 'http://localhost:8006';
|
||||
const API_BASE = typeof window === 'undefined'
|
||||
? 'http://localhost:8006'
|
||||
: '';
|
||||
|
||||
// 类型定义
|
||||
interface Material {
|
||||
@@ -73,7 +72,7 @@ export default function Home() {
|
||||
setDebugData("Loading...");
|
||||
|
||||
// Add timestamp to prevent caching
|
||||
const url = `${API_BASE}/api/materials/?t=${new Date().getTime()}`;
|
||||
const url = `${API_BASE}/api/materials?t=${new Date().getTime()}`;
|
||||
const res = await fetch(url);
|
||||
|
||||
if (!res.ok) {
|
||||
@@ -197,7 +196,7 @@ export default function Home() {
|
||||
setUploadError('网络错误,上传失败');
|
||||
};
|
||||
|
||||
xhr.open('POST', `${API_BASE}/api/materials/`);
|
||||
xhr.open('POST', `${API_BASE}/api/materials`);
|
||||
xhr.send(formData);
|
||||
|
||||
// 清空 input 以便可以再次选择同一文件
|
||||
@@ -299,6 +298,21 @@ export default function Home() {
|
||||
>
|
||||
发布管理
|
||||
</Link>
|
||||
<button
|
||||
onClick={async () => {
|
||||
if (confirm('确定要退出登录吗?')) {
|
||||
try {
|
||||
await fetch(`${API_BASE}/api/auth/logout`, { method: 'POST' });
|
||||
window.location.href = '/login';
|
||||
} catch (e) {
|
||||
window.location.href = '/login';
|
||||
}
|
||||
}
|
||||
}}
|
||||
className="px-4 py-2 bg-red-500/10 hover:bg-red-500/20 text-red-200 rounded-lg transition-colors"
|
||||
>
|
||||
退出
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -7,9 +7,9 @@ const fetcher = (url: string) => fetch(url).then((res) => res.json());
|
||||
import Link from "next/link";
|
||||
|
||||
// 动态获取 API 地址:服务端使用 localhost,客户端使用当前域名
|
||||
const API_BASE = typeof window !== 'undefined'
|
||||
? `http://${window.location.hostname}:8006`
|
||||
: 'http://localhost:8006';
|
||||
const API_BASE = typeof window === 'undefined'
|
||||
? 'http://localhost:8006'
|
||||
: '';
|
||||
|
||||
interface Account {
|
||||
platform: string;
|
||||
@@ -95,7 +95,7 @@ export default function PublishPage() {
|
||||
|
||||
for (const platform of selectedPlatforms) {
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/api/publish/`, {
|
||||
const res = await fetch(`${API_BASE}/api/publish`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
@@ -258,11 +258,26 @@ export default function PublishPage() {
|
||||
href="/"
|
||||
className="px-4 py-2 bg-white/10 hover:bg-white/20 text-white rounded-lg transition-colors"
|
||||
>
|
||||
视频生成
|
||||
返回创作
|
||||
</Link>
|
||||
<span className="px-4 py-2 bg-gradient-to-r from-purple-600 to-pink-600 text-white rounded-lg font-semibold">
|
||||
发布管理
|
||||
</span>
|
||||
<button
|
||||
onClick={async () => {
|
||||
if (confirm('确定要退出登录吗?')) {
|
||||
try {
|
||||
await fetch(`${API_BASE}/api/auth/logout`, { method: 'POST' });
|
||||
window.location.href = '/login';
|
||||
} catch (e) {
|
||||
window.location.href = '/login';
|
||||
}
|
||||
}
|
||||
}}
|
||||
className="px-4 py-2 bg-red-500/10 hover:bg-red-500/20 text-red-200 rounded-lg transition-colors"
|
||||
>
|
||||
退出
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
* 认证工具函数
|
||||
*/
|
||||
|
||||
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8006';
|
||||
const API_BASE = typeof window === 'undefined'
|
||||
? (process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8006')
|
||||
: '';
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user