Spaces:
Paused
Paused
Upload patch_frontend.py
Browse files- patch_frontend.py +38 -32
patch_frontend.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""Patch frontend: Remove Owl Alpha, add working free
|
| 2 |
|
| 3 |
# === Step 1: Patch model.ts constants ===
|
| 4 |
MODEL_FILE = "/source/frontend/src/utils/model.ts"
|
|
@@ -53,56 +53,68 @@ content = content.replace(
|
|
| 53 |
" {\n id: 'nemotron-120b',\n name: 'nvidia/nemotron-3-super-120b-a12b:free',\n modelPath: DEEPSEEK_V4_PRO_MODEL_PATH,\n avatarUrl: 'https://huggingface.co/api/avatars/nvidia',\n },"
|
| 54 |
)
|
| 55 |
|
| 56 |
-
# Remove
|
| 57 |
-
|
|
|
|
| 58 |
id: 'tencent-hy3',
|
| 59 |
name: 'Tencent HY3',
|
| 60 |
modelPath: 'openai/tencent/hy3:free',
|
| 61 |
avatarUrl: 'https://huggingface.co/api/avatars/tencent',
|
| 62 |
-
},"""
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
old_gemma4_block = """ {
|
| 66 |
id: 'gemma-4-31b',
|
| 67 |
name: 'Gemma 4 31B:free',
|
| 68 |
modelPath: 'google/gemma-4-31b-it:free',
|
| 69 |
avatarUrl: 'https://huggingface.co/api/avatars/google',
|
| 70 |
recommended: true,
|
| 71 |
-
},"""
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
old_tencent_new_block = """ {
|
| 75 |
id: 'tencent-hy3',
|
| 76 |
name: 'Tencent HY3:free',
|
| 77 |
modelPath: 'tencent/hy3:free',
|
| 78 |
avatarUrl: 'https://huggingface.co/api/avatars/tencent',
|
| 79 |
-
},"""
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
# === Add working free models at end of DEFAULT_MODEL_OPTIONS array ===
|
| 83 |
-
idx_end = content.find("];", content.find("DEFAULT_MODEL_OPTIONS") if "DEFAULT_MODEL_OPTIONS" in content else 0)
|
| 84 |
-
if idx_end == -1:
|
| 85 |
-
idx_end = content.rfind("];", 0, content.find("export") if "export" in content else len(content))
|
| 86 |
-
|
| 87 |
-
if idx_end > 0:
|
| 88 |
-
new_models = """ {
|
| 89 |
id: 'llama-3.1-8b',
|
| 90 |
name: 'Llama 3.1 8B',
|
| 91 |
modelPath: 'meta-llama/llama-3.1-8b-instruct',
|
| 92 |
avatarUrl: 'https://huggingface.co/api/avatars/meta-llama',
|
| 93 |
recommended: true,
|
| 94 |
-
},
|
| 95 |
-
{
|
| 96 |
id: 'nemotron-70b',
|
| 97 |
name: 'Nemotron 70B',
|
| 98 |
modelPath: 'nvidia/llama-3.1-nemotron-70b-instruct',
|
| 99 |
avatarUrl: 'https://huggingface.co/api/avatars/nvidia',
|
| 100 |
-
},
|
| 101 |
-
{
|
| 102 |
id: 'gemma-2-9b',
|
| 103 |
name: 'Gemma 2 9B',
|
| 104 |
modelPath: 'google/gemma-2-9b-it',
|
| 105 |
avatarUrl: 'https://huggingface.co/api/avatars/google',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
},
|
| 107 |
{
|
| 108 |
id: 'gemma-3-1b',
|
|
@@ -129,10 +141,4 @@ with open(FILE, "w") as f:
|
|
| 129 |
f.write(content)
|
| 130 |
|
| 131 |
print("✅ Frontend patched:")
|
| 132 |
-
print("
|
| 133 |
-
print(" Row 2 (GPT-5.5): unchanged")
|
| 134 |
-
print(" Row 3 (Kimi): DeepSeek V4 Pro")
|
| 135 |
-
print(" Row 4 (MiniMax): DeepSeek V4 Flash")
|
| 136 |
-
print(" Row 5 (GLM): DeepSeek V4 Flash (OR)")
|
| 137 |
-
print(" Row 6 (DeepSeek): nvidia/nemotron-3-super-120b-a12b:free")
|
| 138 |
-
print(" NEW: Llama 3.1 8B (DEFAULT, free), Nemotron 70B, Gemma 2 9B, Gemma 3 1B, Qwen3 Coder Next, Gemini 2.0 Flash")
|
|
|
|
| 1 |
+
"""Patch frontend: Remove Owl Alpha, add working free model Llama 3.3 70B:free."""
|
| 2 |
|
| 3 |
# === Step 1: Patch model.ts constants ===
|
| 4 |
MODEL_FILE = "/source/frontend/src/utils/model.ts"
|
|
|
|
| 53 |
" {\n id: 'nemotron-120b',\n name: 'nvidia/nemotron-3-super-120b-a12b:free',\n modelPath: DEEPSEEK_V4_PRO_MODEL_PATH,\n avatarUrl: 'https://huggingface.co/api/avatars/nvidia',\n },"
|
| 54 |
)
|
| 55 |
|
| 56 |
+
# Remove all broken model blocks
|
| 57 |
+
old_blocks = [
|
| 58 |
+
""" {
|
| 59 |
id: 'tencent-hy3',
|
| 60 |
name: 'Tencent HY3',
|
| 61 |
modelPath: 'openai/tencent/hy3:free',
|
| 62 |
avatarUrl: 'https://huggingface.co/api/avatars/tencent',
|
| 63 |
+
},""",
|
| 64 |
+
""" {
|
|
|
|
|
|
|
| 65 |
id: 'gemma-4-31b',
|
| 66 |
name: 'Gemma 4 31B:free',
|
| 67 |
modelPath: 'google/gemma-4-31b-it:free',
|
| 68 |
avatarUrl: 'https://huggingface.co/api/avatars/google',
|
| 69 |
recommended: true,
|
| 70 |
+
},""",
|
| 71 |
+
""" {
|
|
|
|
|
|
|
| 72 |
id: 'tencent-hy3',
|
| 73 |
name: 'Tencent HY3:free',
|
| 74 |
modelPath: 'tencent/hy3:free',
|
| 75 |
avatarUrl: 'https://huggingface.co/api/avatars/tencent',
|
| 76 |
+
},""",
|
| 77 |
+
""" {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
id: 'llama-3.1-8b',
|
| 79 |
name: 'Llama 3.1 8B',
|
| 80 |
modelPath: 'meta-llama/llama-3.1-8b-instruct',
|
| 81 |
avatarUrl: 'https://huggingface.co/api/avatars/meta-llama',
|
| 82 |
recommended: true,
|
| 83 |
+
},""",
|
| 84 |
+
""" {
|
| 85 |
id: 'nemotron-70b',
|
| 86 |
name: 'Nemotron 70B',
|
| 87 |
modelPath: 'nvidia/llama-3.1-nemotron-70b-instruct',
|
| 88 |
avatarUrl: 'https://huggingface.co/api/avatars/nvidia',
|
| 89 |
+
},""",
|
| 90 |
+
""" {
|
| 91 |
id: 'gemma-2-9b',
|
| 92 |
name: 'Gemma 2 9B',
|
| 93 |
modelPath: 'google/gemma-2-9b-it',
|
| 94 |
avatarUrl: 'https://huggingface.co/api/avatars/google',
|
| 95 |
+
},""",
|
| 96 |
+
""" {
|
| 97 |
+
id: 'gemma-3-1b',
|
| 98 |
+
name: 'Gemma 3 1B',
|
| 99 |
+
modelPath: 'google/gemma-3-1b-it',
|
| 100 |
+
avatarUrl: 'https://huggingface.co/api/avatars/google',
|
| 101 |
+
},""",
|
| 102 |
+
]
|
| 103 |
+
for block in old_blocks:
|
| 104 |
+
content = content.replace(block, "")
|
| 105 |
+
|
| 106 |
+
# === Add working free models at end of DEFAULT_MODEL_OPTIONS array ===
|
| 107 |
+
idx_end = content.find("];", content.find("DEFAULT_MODEL_OPTIONS") if "DEFAULT_MODEL_OPTIONS" in content else 0)
|
| 108 |
+
if idx_end == -1:
|
| 109 |
+
idx_end = content.rfind("];", 0, content.find("export") if "export" in content else len(content))
|
| 110 |
+
|
| 111 |
+
if idx_end > 0:
|
| 112 |
+
new_models = """ {
|
| 113 |
+
id: 'llama-3.3-70b',
|
| 114 |
+
name: 'Llama 3.3 70B:free',
|
| 115 |
+
modelPath: 'meta-llama/llama-3.3-70b-instruct:free',
|
| 116 |
+
avatarUrl: 'https://huggingface.co/api/avatars/meta-llama',
|
| 117 |
+
recommended: true,
|
| 118 |
},
|
| 119 |
{
|
| 120 |
id: 'gemma-3-1b',
|
|
|
|
| 141 |
f.write(content)
|
| 142 |
|
| 143 |
print("✅ Frontend patched:")
|
| 144 |
+
print(" NEW DEFAULT: Llama 3.3 70B:free (meta-llama/llama-3.3-70b-instruct:free) — free variant thật")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|