Spaces:
Running
Running
Upload patch_frontend_ming_models.py
Browse files- patch_frontend_ming_models.py +18 -22
patch_frontend_ming_models.py
CHANGED
|
@@ -1,19 +1,14 @@
|
|
| 1 |
-
"""Patch frontend: add
|
| 2 |
|
| 3 |
Same `openai/`-prefix model-path convention as Laguna S 2.1
|
| 4 |
(`openai/poolside/laguna-s-2.1:free`): the backend strips the `openai/`
|
| 5 |
prefix and routes the request to OpenRouter.
|
| 6 |
|
| 7 |
-
|
| 8 |
- dots-studio/dots-3-note-preview:free -> openai/dots-studio/dots-3-note-preview:free
|
| 9 |
- qwen/qwen3.8-27b:free -> openai/qwen/qwen3.8-27b:free
|
| 10 |
-
-
|
| 11 |
-
|
| 12 |
-
Deliberately NOT added:
|
| 13 |
-
- inclusionai/ming-image-0.1-design -- image-generation model; OpenRouter
|
| 14 |
-
rejects it on /chat/completions with a 404 ("Use the /api/v1/images
|
| 15 |
-
endpoint instead"), so selecting it only produced a runtime error.
|
| 16 |
-
- respan/span-01-lite -- does not exist in the OpenRouter catalog.
|
| 17 |
"""
|
| 18 |
|
| 19 |
import os
|
|
@@ -30,7 +25,7 @@ with open(FILE, "r", encoding="utf-8") as f:
|
|
| 30 |
content = f.read()
|
| 31 |
|
| 32 |
if MARKER in content:
|
| 33 |
-
print("OK: new
|
| 34 |
sys.exit(0)
|
| 35 |
|
| 36 |
anchor = (
|
|
@@ -59,27 +54,28 @@ new_entries = (
|
|
| 59 |
" recommended: true,\n"
|
| 60 |
" },\n"
|
| 61 |
" {\n"
|
| 62 |
-
" id: '
|
| 63 |
-
" name: '
|
| 64 |
-
" modelPath: 'openai/
|
| 65 |
-
" avatarUrl: 'https://huggingface.co/api/avatars/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
" recommended: true,\n"
|
| 67 |
" },\n"
|
| 68 |
)
|
| 69 |
|
| 70 |
if anchor in content:
|
| 71 |
content = content.replace(anchor, anchor + new_entries, 1)
|
| 72 |
-
print("OK: added
|
| 73 |
else:
|
| 74 |
print("FAIL: could not find Laguna S 2.1 entry in DEFAULT_MODEL_OPTIONS")
|
| 75 |
sys.exit(1)
|
| 76 |
|
| 77 |
-
# Guard: the two unusable ids must not appear anywhere in the picker.
|
| 78 |
-
for dead in ("inclusionai/ming-image-0.1-design", "respan/span-01-lite"):
|
| 79 |
-
if dead in content:
|
| 80 |
-
print(f"FAIL: unsupported model present in picker: {dead}")
|
| 81 |
-
sys.exit(1)
|
| 82 |
-
|
| 83 |
with open(FILE, "w", encoding="utf-8") as f:
|
| 84 |
f.write(content)
|
| 85 |
-
print("OK: ChatInput.tsx patched with
|
|
|
|
| 1 |
+
"""Patch frontend: add 4 new models right after the Laguna S 2.1 entry.
|
| 2 |
|
| 3 |
Same `openai/`-prefix model-path convention as Laguna S 2.1
|
| 4 |
(`openai/poolside/laguna-s-2.1:free`): the backend strips the `openai/`
|
| 5 |
prefix and routes the request to OpenRouter.
|
| 6 |
|
| 7 |
+
New models:
|
| 8 |
- dots-studio/dots-3-note-preview:free -> openai/dots-studio/dots-3-note-preview:free
|
| 9 |
- qwen/qwen3.8-27b:free -> openai/qwen/qwen3.8-27b:free
|
| 10 |
+
- respan/span-01-lite -> openai/respan/span-01-lite
|
| 11 |
+
- inclusionai/ming-image-0.1-design -> openai/inclusionai/ming-image-0.1-design
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"""
|
| 13 |
|
| 14 |
import os
|
|
|
|
| 25 |
content = f.read()
|
| 26 |
|
| 27 |
if MARKER in content:
|
| 28 |
+
print("OK: 4 new models already present in ChatInput.tsx (idempotent)")
|
| 29 |
sys.exit(0)
|
| 30 |
|
| 31 |
anchor = (
|
|
|
|
| 54 |
" recommended: true,\n"
|
| 55 |
" },\n"
|
| 56 |
" {\n"
|
| 57 |
+
" id: 'span-01-lite',\n"
|
| 58 |
+
" name: 'respan/span-01-lite',\n"
|
| 59 |
+
" modelPath: 'openai/respan/span-01-lite',\n"
|
| 60 |
+
" avatarUrl: 'https://huggingface.co/api/avatars/respan',\n"
|
| 61 |
+
" recommended: true,\n"
|
| 62 |
+
" },\n"
|
| 63 |
+
" {\n"
|
| 64 |
+
" id: 'ming-image-0-1-design',\n"
|
| 65 |
+
" name: 'inclusionai/ming-image-0.1-design',\n"
|
| 66 |
+
" modelPath: 'openai/inclusionai/ming-image-0.1-design',\n"
|
| 67 |
+
" avatarUrl: 'https://huggingface.co/api/avatars/inclusionai',\n"
|
| 68 |
" recommended: true,\n"
|
| 69 |
" },\n"
|
| 70 |
)
|
| 71 |
|
| 72 |
if anchor in content:
|
| 73 |
content = content.replace(anchor, anchor + new_entries, 1)
|
| 74 |
+
print("OK: added 4 new models after Laguna S 2.1")
|
| 75 |
else:
|
| 76 |
print("FAIL: could not find Laguna S 2.1 entry in DEFAULT_MODEL_OPTIONS")
|
| 77 |
sys.exit(1)
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
with open(FILE, "w", encoding="utf-8") as f:
|
| 80 |
f.write(content)
|
| 81 |
+
print("OK: ChatInput.tsx patched with 4 new models")
|