Spaces:
Running
Running
Upload patch_models.py
Browse files- patch_models.py +17 -3
patch_models.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""Patch backend: replace AVAILABLE_MODELS (remove old 6, add
|
| 2 |
|
| 3 |
import ast
|
| 4 |
import os
|
|
@@ -136,13 +136,25 @@ new_func = '''def _available_models() -> list[dict[str, Any]]:
|
|
| 136 |
"provider": "openrouter",
|
| 137 |
"tier": "free",
|
| 138 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
]
|
| 140 |
return models'''
|
| 141 |
|
| 142 |
func_match = func_pattern.search(content)
|
| 143 |
if func_match:
|
| 144 |
content = content[:func_match.start()] + new_func + content[func_match.end():]
|
| 145 |
-
print("OK: Replaced _available_models() with
|
| 146 |
else:
|
| 147 |
print("WARN: Could not find _available_models() via regex, trying extend approach...")
|
| 148 |
target = "AVAILABLE_MODELS = _available_models()\n"
|
|
@@ -167,6 +179,8 @@ else:
|
|
| 167 |
' {"id": "openai/nvidia/nemotron-3-ultra-550b-a55b:free", "label": "Nemotron 3 Ultra 550B", "provider": "openrouter", "tier": "free", "recommended": True},\n'
|
| 168 |
' {"id": "openai/poolside/laguna-m.1:free", "label": "Laguna M.1", "provider": "openrouter", "tier": "free", "recommended": True},\n'
|
| 169 |
' {"id": "openai/poolside/laguna-xs.2:free", "label": "Laguna XS.2", "provider": "openrouter", "tier": "free"},\n'
|
|
|
|
|
|
|
| 170 |
"])\n"
|
| 171 |
'DEFAULT_FREE_MODEL_ID = "openai/openrouter/owl-alpha"\n'
|
| 172 |
)
|
|
@@ -222,4 +236,4 @@ except SyntaxError as e:
|
|
| 222 |
with open(LLM_PARAMS_FILE, "w") as f:
|
| 223 |
f.write(llm_content)
|
| 224 |
|
| 225 |
-
print("OK: Backend patched -
|
|
|
|
| 1 |
+
"""Patch backend: replace AVAILABLE_MODELS (remove old 6, add 18 new) + OpenRouter routing."""
|
| 2 |
|
| 3 |
import ast
|
| 4 |
import os
|
|
|
|
| 136 |
"provider": "openrouter",
|
| 137 |
"tier": "free",
|
| 138 |
},
|
| 139 |
+
{
|
| 140 |
+
"id": "openai/qwen/qwen3.7-flash",
|
| 141 |
+
"label": "Qwen3.7 Flash",
|
| 142 |
+
"provider": "openrouter",
|
| 143 |
+
"tier": "free",
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"id": "openai/inclusionai/ling-2.6-flash",
|
| 147 |
+
"label": "Ling 2.6 Flash",
|
| 148 |
+
"provider": "openrouter",
|
| 149 |
+
"tier": "free",
|
| 150 |
+
},
|
| 151 |
]
|
| 152 |
return models'''
|
| 153 |
|
| 154 |
func_match = func_pattern.search(content)
|
| 155 |
if func_match:
|
| 156 |
content = content[:func_match.start()] + new_func + content[func_match.end():]
|
| 157 |
+
print("OK: Replaced _available_models() with 18 new models via regex")
|
| 158 |
else:
|
| 159 |
print("WARN: Could not find _available_models() via regex, trying extend approach...")
|
| 160 |
target = "AVAILABLE_MODELS = _available_models()\n"
|
|
|
|
| 179 |
' {"id": "openai/nvidia/nemotron-3-ultra-550b-a55b:free", "label": "Nemotron 3 Ultra 550B", "provider": "openrouter", "tier": "free", "recommended": True},\n'
|
| 180 |
' {"id": "openai/poolside/laguna-m.1:free", "label": "Laguna M.1", "provider": "openrouter", "tier": "free", "recommended": True},\n'
|
| 181 |
' {"id": "openai/poolside/laguna-xs.2:free", "label": "Laguna XS.2", "provider": "openrouter", "tier": "free"},\n'
|
| 182 |
+
' {"id": "openai/qwen/qwen3.7-flash", "label": "Qwen3.7 Flash", "provider": "openrouter", "tier": "free"},\n'
|
| 183 |
+
' {"id": "openai/inclusionai/ling-2.6-flash", "label": "Ling 2.6 Flash", "provider": "openrouter", "tier": "free"},\n'
|
| 184 |
"])\n"
|
| 185 |
'DEFAULT_FREE_MODEL_ID = "openai/openrouter/owl-alpha"\n'
|
| 186 |
)
|
|
|
|
| 236 |
with open(LLM_PARAMS_FILE, "w") as f:
|
| 237 |
f.write(llm_content)
|
| 238 |
|
| 239 |
+
print("OK: Backend patched - 18 models, ALL openai/ -> OR")
|