-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
193 lines (169 loc) · 4.36 KB
/
Copy pathconfig.py
File metadata and controls
193 lines (169 loc) · 4.36 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
import os
from pathlib import Path
_ENV_PATH = Path(__file__).with_name(".env")
def _load_dotenv(path: Path) -> None:
if not path.exists():
return
for raw_line in path.read_text(encoding="utf-8").splitlines():
line = raw_line.strip()
if not line or line.startswith("#"):
continue
if line.startswith("export "):
line = line[7:].strip()
if "=" not in line:
continue
key, value = line.split("=", 1)
key = key.strip()
value = value.strip()
if not key:
continue
if value and value[0] == value[-1] and value[0] in {"'", '"'}:
value = value[1:-1]
os.environ.setdefault(key, value)
def _required(name: str) -> str:
value = os.environ.get(name, "").strip()
if value:
return value
raise RuntimeError(
f"Missing required setting: {name}. Fill it in {_ENV_PATH} or environment."
)
def _required_int(name: str) -> int:
value = _required(name)
try:
return int(value)
except ValueError as exc:
raise RuntimeError(f"{name} must be an integer, got: {value!r}") from exc
def _list(name: str, default: str) -> list[str]:
raw = os.environ.get(name, default)
return [part.strip() for part in raw.split(",") if part.strip()]
_load_dotenv(_ENV_PATH)
API_ID = _required_int("API_ID")
API_HASH = _required("API_HASH")
SESSION_NAME = os.environ.get("SESSION_NAME", "userbot")
PREFIXES = _list("PREFIXES", ".,!")
TELEGRAM_DEVICE_MODEL = os.environ.get("TELEGRAM_DEVICE_MODEL", "Redact Desktop")
TELEGRAM_SYSTEM_VERSION = os.environ.get("TELEGRAM_SYSTEM_VERSION", "Linux")
TELEGRAM_APP_VERSION = os.environ.get("TELEGRAM_APP_VERSION", "redact userbot")
TELEGRAM_LANG_CODE = os.environ.get("TELEGRAM_LANG_CODE", "ru")
AI_URL = "https://api.onlysq.ru/ai/v2"
AI_KEY = _required("AI_KEY")
AI_MODEL = os.environ.get("AI_MODEL", "gpt-4o-mini")
AI_MODELS = [
# Anthropic Claude
"claude-opus-4-6",
"claude-opus-4-5",
"claude-sonnet-4-6",
"claude-sonnet-4-5",
"claude-haiku-4-5",
# OpenAI GPT-5
"gpt-5.4",
"gpt-5.2",
"gpt-5.2-chat",
"gpt-5.1",
"gpt-5",
"gpt-5-chat",
"gpt-5-mini",
"gpt-5-nano",
"gpt-5-search",
# OpenAI GPT-4
"gpt-4.1",
"gpt-4.1-mini",
"gpt-4.1-nano",
"chatgpt-4o",
"gpt-4o",
"gpt-4o-mini",
"gpt-4-turbo",
"gpt-4",
"gpt-3.5-turbo",
# OpenAI reasoning
"o4-mini",
"o3",
"o3-mini",
"o1",
# OpenAI open-source
"gpt-oss-120b",
"gpt-oss-20b",
# Google Gemini
"gemini-3.1-pro",
"gemini-3-flash",
# xAI Grok
"grok-4-1-fast",
"grok-3",
"grok-2-vision",
# Qwen
"qwen3-max",
"qwen3-next-80b-a3b",
"qwen3-235b-a22b-2507",
"qwen3-coder-plus",
"qwen-max-latest",
"qwen-3-32b",
# DeepSeek
"deepseek-v3",
"deepseek-r1",
# Llama
"llama-3.3-70b",
"llama3.1-8b",
# Mistral
"mistral-small-3.1",
# Cohere Command
"command-a-03-2025",
"command-r-plus-08-2024",
"command-a-reasoning-08-2025",
# Z.AI / GLM
"zai-glm-4.6",
"glm-4.7-flash",
# Perplexity Sonar
"sonar-pro",
"sonar-reasoning-pro",
"sonar-deep-research",
]
AI_IMAGE_MODELS = [
"gpt-image-1.5",
"gpt-image-1",
"gpt-image-1-mini",
"phoenix-1.0",
"lucid-origin",
"flux-2-dev",
"flux-2-klein-9b",
"flux-2-klein-4b",
"flux",
"grok-2-image",
]
AI_IMAGE_MODEL = os.environ.get("AI_IMAGE_MODEL", "gpt-image-1.5")
AI_VISION_MODEL = os.environ.get("AI_VISION_MODEL", "gpt-4o")
AI2_URL = "https://abuzgroup.lol/v1"
AI2_KEY = os.environ.get("AI2_KEY", "").strip()
AI2_MODELS = [
"glm-5.1",
"glm-5",
"glm-4.7",
"glm-4.6",
]
PROVIDERS = [
{
"name": "AI",
"url": AI_URL,
"key": AI_KEY,
"models": AI_MODELS,
"image_models": AI_IMAGE_MODELS,
"style": "nested",
},
]
if AI2_KEY:
PROVIDERS.append(
{
"name": "AI2",
"url": AI2_URL,
"key": AI2_KEY,
"models": AI2_MODELS,
"image_models": [],
"style": "openai",
}
)
BIO_TEMPLATE = "get you | {ts}"
BIO_TIME_FORMAT = "%d.%m.%Y %H:%M"
BIO_INTERVAL = 60
USERBOT_NAME = "redact"
USERBOT_VERSION = "1.0.0"
USERBOT_BRANCH = "master"
INFO_IMAGE = os.path.join(os.path.dirname(__file__), "assets", "info")