refactor: remove XAI/Gemini sessions, add MixinSession fallback, improve error handling

- Remove GeminiSession and XaiSession from llmcore.py
- Add MixinSession: multi-endpoint fallback with exponential backoff
- ga.py: handle empty/incomplete/max_tokens responses
- Update mykey_template.py and GETTING_STARTED.md accordingly
This commit is contained in:
Liang Jiaqing
2026-03-28 08:14:35 +08:00
parent 38e2a460e3
commit a5dbce396a
5 changed files with 52 additions and 82 deletions

View File

@@ -6,6 +6,11 @@
# 填完整路径 'http://host:2001/v1/chat/completions' → 直接使用,不再拼接
# ══════════════════════════════════════════════════════════════════════════════
# ── Mixin (实验性) ───────────────────────────────────────────────────────────────
# key命名含 'mixin' 触发 MixinSession多key/endpoint自动fallback + 指数退避重试
# 约束引用的session须同类型不支持Native
# mixin_config = {'llm_nos': [1, 2], 'max_retries': 3, 'base_delay': 1.5} # 序号含自身此处mixin=0
# ── OpenAI-compatible (chat/completions or responses API) ──────────────────────
# key命名含 'oai' 触发 LLMSession
oai_config = {
@@ -63,13 +68,6 @@ native_oai_config = {
# key命名含 'sider' 触发 SiderLLMSession需安装 sider_ai_api 包)
#sider_cookie = 'token=Bearer%20eyJhbGciOiJIUz...'
# ── xAI Grok ────────────────────────────────────────────────────────────────────
# key命名含 'xai' 触发 XaiSession需安装 xai_sdk 包)
# xai_config = {
# 'apikey': 'xai-...',
# 'model': 'grok-4-1-fast-non-reasoning',
# 'proxy': 'http://127.0.0.1:2082',
# }
# If you need them
# tg_bot_token = '84102K2gYZ...'