videoSummary/CONFIG.md
2025-12-02 18:54:14 +08:00

125 lines
2.7 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.

# 配置说明文档
本文档说明运行视频分析服务需要配置的内容。
## 必须配置项
### 1. DashScope API Key必需
**用途**: 用于调用阿里云 DashScope 多模态 API 进行视频分析
**配置方式**: 在 `config.yaml` 文件中配置
```yaml
dashscope:
api_key: "your-api-key-here"
```
**获取方式**:
- 访问 https://dashscope.console.aliyun.com/
- 注册/登录阿里云账号
- 创建 API Key
### 2. MongoDB 连接(必需)
**用途**: 存储视频元数据和分析结果
**配置方式**: 在 `config.yaml` 文件中配置
```yaml
mongodb:
uri: "mongodb://localhost:27017"
database: "videoSummary"
```
**要求**:
- 确保 MongoDB 服务已启动
- 确保数据库可访问
## 可选配置项
### 服务器配置
```yaml
server:
host: "0.0.0.0" # 监听地址,默认 0.0.0.0
port: 8080 # 监听端口,默认 8080
mode: "debug" # 运行模式: debug, release, test
```
### DashScope 模型配置
```yaml
dashscope:
model: "qwen3-vl-plus" # 多模态模型名称
fps: 2 # 视频抽帧频率(每秒帧数)
```
### 文件上传配置
```yaml
upload:
max_size: 524288000 # 最大文件大小(字节),默认 500MB
allowed_extensions: ["mp4", "avi", "mov", "mkv", "wmv", "flv", "webm"]
```
### MongoDB 连接池配置
```yaml
mongodb:
max_pool_size: 100 # 最大连接数
min_pool_size: 10 # 最小连接数
```
### 日志配置
```yaml
log:
level: "info" # 日志级别: debug, info, warn, error
format: "json" # 日志格式: json, text
output: "stdout" # 输出位置: stdout 或文件路径
```
## 配置来源
所有配置均从 `config.yaml` 文件读取。
## 快速开始
### 最小配置
只需要配置以下两项即可运行:
1. **DashScope API Key**(在 `config.yaml` 中设置)
2. **MongoDB 连接**(确保 MongoDB 运行在默认地址 `mongodb://localhost:27017`
### 配置示例
```yaml
# config.yaml 最小配置示例
dashscope:
api_key: "sk-your-api-key-here"
mongodb:
uri: "mongodb://localhost:27017"
database: "videoSummary"
```
## 注意事项
1. **API Key 安全**:
- 不要将 API Key 提交到版本控制系统
- 建议将 `config.yaml` 添加到 `.gitignore` 或使用配置模板文件
2. **MongoDB 连接**:
- 确保 MongoDB 服务已启动
- 生产环境建议配置认证和 SSL
3. **文件上传大小**:
- 根据服务器资源调整 `max_size`
- 大文件上传可能需要更长的处理时间
4. **DashScope FPS 参数**:
- 较低的 fps 值可以减少 API 调用成本,但可能丢失细节
- 较高的 fps 值可以获得更详细的分析,但成本更高
- 默认值 2 是平衡性能和成本的选择