Spaces:
Paused
Paused
Restore patch_models.py from 5743f66
Browse files- patch_models.py +5 -10
patch_models.py
CHANGED
|
@@ -5,22 +5,17 @@ AGENT_FILE = "/app/backend/routes/agent.py"
|
|
| 5 |
with open(AGENT_FILE, "r") as f:
|
| 6 |
content = f.read()
|
| 7 |
|
| 8 |
-
# Rename Claude Opus references to Owl Alpha
|
| 9 |
-
content = content.replace("Claude Opus 4.7", "Owl Alpha")
|
| 10 |
-
content = content.replace("claude-opus-4.7", "owl-alpha")
|
| 11 |
-
content = content.replace("Claude Opus 4", "Owl Alpha")
|
| 12 |
-
|
| 13 |
# Add new models to AVAILABLE_MODELS
|
| 14 |
target = "AVAILABLE_MODELS = _available_models()\n"
|
| 15 |
patch = '''
|
| 16 |
# === PATCH: Add HF Inference + OpenRouter models ===
|
| 17 |
import os as _os
|
| 18 |
AVAILABLE_MODELS.extend([
|
| 19 |
-
{"id": "openai/owl-alpha", "label": "Owl Alpha", "provider": "openrouter", "tier": "free", "recommended": True},
|
| 20 |
{"id": "deepseek-ai/DeepSeek-V4-Pro", "label": "DeepSeek V4 Pro", "provider": "huggingface", "tier": "free", "recommended": True},
|
|
|
|
|
|
|
| 21 |
{"id": "Qwen/Qwen3-Coder-Next", "label": "Qwen3 Coder Next", "provider": "huggingface", "tier": "free", "recommended": True},
|
| 22 |
-
{"id": "
|
| 23 |
-
{"id": "zai-org/GLM-5.1", "label": "GLM 5.1", "provider": "huggingface", "tier": "free"},
|
| 24 |
{"id": "openai/google/gemini-2.0-flash-001", "label": "Gemini 2.0 Flash", "provider": "openrouter", "tier": "free"},
|
| 25 |
])
|
| 26 |
PREMIUM_MODEL_IDS = set() # No premium gate
|
|
@@ -32,9 +27,9 @@ if target in content:
|
|
| 32 |
content = content.replace(target, target + patch)
|
| 33 |
print("✅ Added models to AVAILABLE_MODELS")
|
| 34 |
|
| 35 |
-
# Fix title generation
|
| 36 |
old_title = 'model="openai/openai/gpt-oss-120b:cerebras",\n api_base="https://router.huggingface.co/v1",\n api_key=api_key,'
|
| 37 |
-
new_title = 'model="deepseek-ai/DeepSeek-V4-Pro",\n
|
| 38 |
if old_title in content:
|
| 39 |
content = content.replace(old_title, new_title)
|
| 40 |
content = content.replace(' reasoning_effort="low",\n', '')
|
|
|
|
| 5 |
with open(AGENT_FILE, "r") as f:
|
| 6 |
content = f.read()
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
# Add new models to AVAILABLE_MODELS
|
| 9 |
target = "AVAILABLE_MODELS = _available_models()\n"
|
| 10 |
patch = '''
|
| 11 |
# === PATCH: Add HF Inference + OpenRouter models ===
|
| 12 |
import os as _os
|
| 13 |
AVAILABLE_MODELS.extend([
|
|
|
|
| 14 |
{"id": "deepseek-ai/DeepSeek-V4-Pro", "label": "DeepSeek V4 Pro", "provider": "huggingface", "tier": "free", "recommended": True},
|
| 15 |
+
{"id": "deepseek-ai/DeepSeek-V4-Flash", "label": "DeepSeek V4 Flash", "provider": "huggingface", "tier": "free"},
|
| 16 |
+
{"id": "openai/deepseek/deepseek-v4-flash", "label": "DeepSeek V4 Flash (OR)", "provider": "openrouter", "tier": "free"},
|
| 17 |
{"id": "Qwen/Qwen3-Coder-Next", "label": "Qwen3 Coder Next", "provider": "huggingface", "tier": "free", "recommended": True},
|
| 18 |
+
{"id": "openrouter/owl-alpha", "label": "Owl Alpha", "provider": "openrouter", "tier": "free", "recommended": True},
|
|
|
|
| 19 |
{"id": "openai/google/gemini-2.0-flash-001", "label": "Gemini 2.0 Flash", "provider": "openrouter", "tier": "free"},
|
| 20 |
])
|
| 21 |
PREMIUM_MODEL_IDS = set() # No premium gate
|
|
|
|
| 27 |
content = content.replace(target, target + patch)
|
| 28 |
print("✅ Added models to AVAILABLE_MODELS")
|
| 29 |
|
| 30 |
+
# Fix title generation - use huggingface/ prefix for litellm
|
| 31 |
old_title = 'model="openai/openai/gpt-oss-120b:cerebras",\n api_base="https://router.huggingface.co/v1",\n api_key=api_key,'
|
| 32 |
+
new_title = 'model="huggingface/deepseek-ai/DeepSeek-V4-Pro",\n api_key=api_key,'
|
| 33 |
if old_title in content:
|
| 34 |
content = content.replace(old_title, new_title)
|
| 35 |
content = content.replace(' reasoning_effort="low",\n', '')
|