forked from lsdefine/GenericAgent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmykey_template.py
More file actions
100 lines (90 loc) · 5.52 KB
/
Copy pathmykey_template.py
File metadata and controls
100 lines (90 loc) · 5.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# ══════════════════════════════════════════════════════════════════════════════
# apibase 填写规则(自动拼接端点路径):
# 填到端口 'http://host:2001' → 自动补 /v1/chat/completions
# 填到版本号 'http://host:2001/v1' → 自动补 /chat/completions
# 填完整路径 'http://host:2001/v1/chat/completions' → 直接使用,不再拼接
# ══════════════════════════════════════════════════════════════════════════════
# ── Mixin (实验性) ───────────────────────────────────────────────────────────────
# key命名含 'mixin' 触发 MixinSession:多key/endpoint自动fallback + 指数退避重试
# 约束:引用的session须同为Native或非Native
# mixin_config = {'llm_nos': ['modela', 'xxxx'], 'max_retries': 5, 'base_delay': 1.5} # name匹配,含自身
# ── Claude Native API ───────────────────────────────────────────────────────────
# key命名同时含 'native' 和 'claude' 触发 NativeClaudeSession
# 原生工具调用格式,缓解弱模型指令遵循问题
native_claude_config123 = {
'apikey': 'sk-ant-...', # Anthropic原生apikey
'apibase': 'https://api.anthropic.com',
'model': 'claude-opus-4-6',
'name': 'claude1'
# 'context_win': 24000,
# 'fake_cc_system_prompt': True # 是否尝试绕过cc MAX检测
}
# ── OpenAI-compatible Native API ─────────────────────────────────────────────
# key命名同时含 'native' 和 'oai' 触发 NativeOAISession
# 原生工具调用格式,缓解弱模型指令遵循问题
native_oai_config456 = {
'apikey': 'sk-...',
'apibase': 'http://your-proxy:2001',
'model': 'gpt-5.4',
'name': 'oai1'
# 'context_win': 24000,
}
# ── OpenAI-compatible (chat/completions or responses API) ──────────────────────
# key命名含 'oai' 触发 LLMSession
oai_config = {
'name': 'modela', # 可选
'apikey': 'sk-...',
'apibase': 'http://your-proxy:2001',
'model': 'openai/gpt-5.1',
'api_mode': 'chat_completions', # 'chat_completions' | 'responses'
# 'reasoning_effort': 'low', # none|low|medium|high|xhigh (OpenAI o系列)
'max_retries': 2, # 429/timeout/5xx 重试次数
'connect_timeout': 10, # 秒
'read_timeout': 120, # 秒(流式读取)
# 'proxy': 'http://127.0.0.1:2082', # 单独代理,不填则不走代理
# 'context_win': 16000, # token估算上限,超出自动截断历史
}
# 可以定义多个,命名含 'oai' 即可
oai_config2 = {
'apikey': 'sk-...',
'apibase': 'http://your-proxy:2001',
'model': 'claude-opus-4-6-20260206',
}
# ── Claude via OpenAI-compatible proxy ─────────────────────────────────────────
# key命名含 'claude'(不含'native')触发 ClaudeSession(走OpenAI兼容层)
claude_config = {
'name': 'xxxx', # 可选
'apikey': 'sk-...',
'apibase': 'http://your-proxy:2001',
'model': 'claude-opus',
# 'context_win': 12000,
}
# ── Sider ───────────────────────────────────────────────────────────────────────
# key命名含 'sider' 触发 SiderLLMSession(需安装 sider_ai_api 包)
#sider_cookie = 'token=Bearer%20eyJhbGciOiJIUz...'
# ── MiniMax (OpenAI-compatible) ─────────────────────────────────────────────────
# MiniMax 使用 OpenAI 兼容接口,key命名含 'oai' 即可
# 温度自动修正为 (0, 1],支持 M2.7 / M2.5 全系列,204K 上下文
# oai_minimax_config = {
# 'apikey': 'eyJh...', # MiniMax API Key
# 'apibase': 'https://api.minimax.io/v1',
# 'model': 'MiniMax-M2.7', # MiniMax-M2.7-highspeed / MiniMax-M2.5 等
# 'context_win': 50000, # M2.7 支持 204K context
# }
# If you need them
# tg_bot_token = '84102K2gYZ...'
# tg_allowed_users = [6806...]
# qq_app_id = '123456789'
# qq_app_secret = 'xxxxxxxxxxxxxxxx'
# qq_allowed_users = ['your_user_openid'] # 留空或 ['*'] 表示允许所有 QQ 用户
# fs_app_id = 'cli_xxxxxxxxxxxxxxxx'
# fs_app_secret = 'xxxxxxxxxxxxxxxx'
# fs_allowed_users = ['ou_xxxxxxxxxxxxxxxx'] # 留空或 ['*'] 表示允许所有飞书用户
# wecom_bot_id = 'your_bot_id'
# wecom_secret = 'your_bot_secret'
# wecom_allowed_users = ['your_user_id'] # 留空或 ['*'] 表示允许所有企业微信用户
# wecom_welcome_message = '你好,我在线上。'
# dingtalk_client_id = 'your_app_key'
# dingtalk_client_secret = 'your_app_secret'
# dingtalk_allowed_users = ['your_staff_id'] # 留空或 ['*'] 表示允许所有钉钉用户
# proxy = "http://127.0.0.1:2082"