docs: 添加执行方式和环境变量配置说明
This commit is contained in:
@@ -13,8 +13,9 @@
|
|||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 分析内容
|
# 分析内容(推荐:使用 -u 参数强制无缓冲输出)
|
||||||
python deep_analyzer.py --metadata meta.json --content content.json --output analysis.md
|
AI_API_KEY="your-api-key" AI_PROVIDER="zhipu" AI_MODEL="glm-4.7" \
|
||||||
|
python3 -u deep_analyzer.py --metadata meta.json --content content.json --output analysis.md
|
||||||
|
|
||||||
# 指定类型
|
# 指定类型
|
||||||
python deep_analyzer.py --metadata meta.json --content content.json --type tutorial --output tutorial.md
|
python deep_analyzer.py --metadata meta.json --content content.json --type tutorial --output tutorial.md
|
||||||
@@ -23,6 +24,48 @@ python deep_analyzer.py --metadata meta.json --content content.json --type tutor
|
|||||||
python deep_analyzer.py -m meta.json -c content.json -o out.md --provider zhipu --model glm-4
|
python deep_analyzer.py -m meta.json -c content.json -o out.md --provider zhipu --model glm-4
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 环境变量配置
|
||||||
|
|
||||||
|
**必须设置以下环境变量**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export AI_API_KEY="your-api-key"
|
||||||
|
export AI_PROVIDER="zhipu" # 或 openai, minimax
|
||||||
|
export AI_MODEL="glm-4.7" # 模型名称
|
||||||
|
export AI_BASE_URL="https://..." # 可选,自定义 API 地址
|
||||||
|
```
|
||||||
|
|
||||||
|
### 重要提示
|
||||||
|
|
||||||
|
**必须使用 `-u` 参数运行 Python**,确保输出实时显示在终端:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 -u deep_analyzer.py ...
|
||||||
|
```
|
||||||
|
|
||||||
|
如果不使用 `-u` 参数,Python 的 stdout 缓冲会导致输出延迟或看不到进度。
|
||||||
|
|
||||||
|
## 执行方式选择
|
||||||
|
|
||||||
|
### 方式1: 并发执行(推荐,默认)
|
||||||
|
- 使用 `batch_size=3`(默认)
|
||||||
|
- 6个分片约 100 秒完成
|
||||||
|
- 适合快速分析
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 -u deep_analyzer.py --metadata meta.json --content content.json -o out.md
|
||||||
|
```
|
||||||
|
|
||||||
|
### 方式2: 顺序执行
|
||||||
|
- 使用 `batch_size=1`
|
||||||
|
- 6个分片约 735 秒完成
|
||||||
|
- 适合调试和问题排查
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 在代码中设置 batch_size=1
|
||||||
|
# analyzer.analyze(metadata, content, "video", batch_size=1)
|
||||||
|
```
|
||||||
|
|
||||||
## Metadata Format
|
## Metadata Format
|
||||||
|
|
||||||
支持两种元数据格式:
|
支持两种元数据格式:
|
||||||
|
|||||||
Reference in New Issue
Block a user