feat: multi-channel LLM support with visual channel editor (#494)

* feat: multi-channel LLM support with visual channel editor

- Add three-tier LLM config: LITELLM_CONFIG (YAML) > LLM_CHANNELS (env) > legacy keys
- Each channel gets independent base_url / api_key / models (no OPENAI_BASE_URL conflict)
- Support DEEPSEEK_API_KEY as standalone provider (auto-infers deepseek-chat model)
- Add LLMChannelEditor component with 9 presets (AIHubmix/DeepSeek/Dashscope/GLM/Moonshot/SiliconFlow/OpenRouter/Gemini/Custom)
- Expand config_registry with ~50 new fields for web settings coverage
- Rewrite .env.example AI section with clear quick-start guide (Scenario A vs B)
- Add litellm_config.example.yaml template
- Add PyYAML dependency for YAML config support
- Full backward compatibility: existing single-key configs work unchanged

* chore: replace placeholder key values with empty defaults in .env.example

* fix: resolve ESLint errors in LLMChannelEditor and HomePage

* refactor: use native litellm deepseek/ provider and extract shared LLM helpers

- Replace openai/deepseek-* + manual api_base with deepseek/ prefix (litellm
  natively resolves DEEPSEEK_API_KEY and base_url)
- Extract duplicated _get_api_keys_for_model and _extra_litellm_params from
  analyzer.py and llm_adapter.py into shared functions in config.py
- Update litellm_config.example.yaml to use deepseek/ prefix
- Thinking mode (deepseek-chat opt-in, deepseek-reasoner auto) unaffected:
  get_thinking_extra_body uses model short name stripped of provider prefix
This commit is contained in:
mumu
2026-03-06 21:14:34 +08:00
committed by GitHub
parent d5b8b60c69
commit e642f776c8
12 changed files with 1661 additions and 146 deletions

View File

@@ -28,6 +28,7 @@ json-repair>=0.55.1 # JSON 修复
# AI 分析
litellm>=1.80.10 # Unified LLM client (Gemini/Anthropic/OpenAI/DeepSeek etc.)
openai>=1.0.0 # OpenAI SDK (transitive dependency of litellm, kept explicit)
PyYAML>=6.0 # YAML parser for LITELLM_CONFIG support
# 搜索引擎(用于获取股票新闻)
tavily-python>=0.3.0 # Tavily 搜索 API每月 1000 次免费)