Files
autoclip/env.example
5105422ceb feat(llm): custom base_url for OpenAI-compatible endpoints, persist provider choice (#92)
- OpenAIProvider accepts base_url (settings or OPENAI_BASE_URL) so Zhipu, DeepSeek,
  OpenRouter, Ollama, vLLM, LM Studio etc. work through the existing OpenAI path;
  keyless local endpoints get a placeholder key and skip the sk- format check
- Settings API: persist api_provider / api_base_url; /test-api takes base_url + model;
  /current-provider now reports the real provider instead of always dashscope
- LLMManager: reads provider + base_url from settings.json, reloads when the file
  changes (API process and Celery worker pick up new settings without restart),
  falls back to API_*_API_KEY / LLM_PROVIDER / API_MODEL_NAME env vars for Docker,
  and resolves settings.json via path_utils so it reads what the settings API writes
- Settings page: Base URL field for the OpenAI provider, key optional for custom
  endpoints, model tags value normalized to a string before saving
- Regression tests for provider construction, manager reload and /test-api

Closes #72, closes #57; supersedes #78

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Kris K <zhouxiaoka@users.noreply.github.com>
2026-09-06 22:34:36 +08:00

52 lines
1.6 KiB
Plaintext
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.
# AutoClip 环境变量配置示例
# 复制此文件为 .env 并填入实际配置
# 数据库配置
DATABASE_URL=sqlite:///./data/autoclip.db
# Redis配置
REDIS_URL=redis://localhost:6379/0
# API配置
# 桌面版在设置页配置即可;Docker / 脚本模式没有设置页时用下面的环境变量。
# LLM_PROVIDER: dashscope | openai | gemini | siliconflow(settings.json 里已保存的提供商优先)
LLM_PROVIDER=dashscope
API_DASHSCOPE_API_KEY=your_dashscope_api_key_here
# API_OPENAI_API_KEY=
# API_GEMINI_API_KEY=
# API_SILICONFLOW_API_KEY=
# OpenAI 兼容接口地址(LLM_PROVIDER=openai 时生效,留空走 OpenAI 官方)。
# 智谱: https://open.bigmodel.cn/api/paas/v4 DeepSeek: https://api.deepseek.com/v1
# Ollama: http://localhost:11434/v1(Docker 内访问宿主机用 http://host.docker.internal:11434/v1)
# OPENAI_BASE_URL=
API_MODEL_NAME=qwen-plus
API_MAX_TOKENS=4096
API_TIMEOUT=30
# 处理配置
PROCESSING_CHUNK_SIZE=5000
PROCESSING_MIN_SCORE_THRESHOLD=0.7
PROCESSING_MAX_CLIPS_PER_COLLECTION=5
PROCESSING_MAX_RETRIES=3
# 路径配置(可选,系统会自动检测)
# PATH_PROJECT_ROOT=
# PATH_DATA_DIR=
# PATH_UPLOADS_DIR=
# PATH_TEMP_DIR=
# PATH_OUTPUT_DIR=
# YouTube 下载(可选)
# 字幕语言列表,逗号分隔;一次请求过多语言易触发 429。默认 zh-Hans,zh,en
# AUTOCLIP_YT_SUBTITLE_LANGS=zh-Hans,zh,en
# 兜底 player client(android/ios/tv),仅在默认 client 拉不到格式时使用
# AUTOCLIP_YT_CLIENT=
# 日志配置
LOG_LEVEL=INFO
LOG_FORMAT=%(asctime)s - %(name)s - %(levelname)s - %(message)s
LOG_FILE=backend.log
# 环境配置
ENVIRONMENT=development
DEBUG=true