让 .env 文件可以在系统 config 文件夹内盛放

This commit is contained in:
2026-04-08 14:11:10 +08:00
parent cad2c583bf
commit c9a85759fb
2 changed files with 44 additions and 6 deletions

View File

@ -44,9 +44,33 @@
### 2. 配置
API 配置从以下位置按优先级读取:
1. `scripts/.env` (本地)
2. `~/.config/phomework/.env` (全局)
**方式一:全局配置(推荐)**
```bash
mkdir -p ~/.config/phomework
cp scripts/.env.example ~/.config/phomework/.env
# 编辑 ~/.config/phomework/.env
```
**方式二:本地配置**
```bash
cp scripts/.env.example scripts/.env
# 编辑 .env填入 API 配置
# 编辑 scripts/.env
```
`.env` 文件内容:
```bash
# API 端点OpenAI 兼容)
IMG2TYP_API_ENDPOINT=https://api.openai.com/v1/chat/completions
# API 密钥
IMG2TYP_API_KEY=your-api-key-here
# 模型名称(默认 qwen-vl-plus
IMG2TYP_MODEL=qwen-vl-plus
```
### 3. 运行