УЛЬТРА КРУТОЙ ВАЙБКОД ФИКСЫ И АВТОМОДЕЛЬ ТЕСЛА
This commit is contained in:
1 parent
5be8fcce19
commit
b0541faa3d
8 files changed
+328
-106
No files matched your search
+39
@@ -269,6 +269,45 @@ def clean_tail_repeats(text: str, max_repeat: int = 10):
|
||||
return cleaned, removed_count
|
||||
|
||||
|
||||
def get_key(provider, model_full):
|
||||
prov = PROVIDERS.get(provider, {})
|
||||
key = prov.get("key", "")
|
||||
if isinstance(key, list):
|
||||
parts = model_full.split("*")
|
||||
if len(parts) >= 3:
|
||||
try:
|
||||
idx = int(parts[2]) - 1
|
||||
except ValueError:
|
||||
return key[0]
|
||||
if 0 <= idx < len(key):
|
||||
return key[idx]
|
||||
return key[0]
|
||||
return key
|
||||
|
||||
|
||||
_expanded_auto_models = None
|
||||
|
||||
|
||||
def expand_auto_models():
|
||||
global _expanded_auto_models
|
||||
if _expanded_auto_models is not None:
|
||||
return _expanded_auto_models
|
||||
result = []
|
||||
for entry in AUTO_MODELS:
|
||||
parts = entry.split("*", 2)
|
||||
provider = parts[0]
|
||||
model = parts[1]
|
||||
suffix = parts[2] if len(parts) >= 3 else None
|
||||
prov_key = PROVIDERS.get(provider, {}).get("key", "")
|
||||
if isinstance(prov_key, list) and not suffix:
|
||||
for i in range(len(prov_key)):
|
||||
result.append(f"{provider}*{model}*{i + 1}")
|
||||
else:
|
||||
result.append(entry)
|
||||
_expanded_auto_models = result
|
||||
return result
|
||||
|
||||
|
||||
def parse_response(text: str):
|
||||
if "connection error." in text:
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user