Restore 3d39bbc: patch_frontend.py (unchanged)
Browse files- patch_frontend.py +80 -20
patch_frontend.py
CHANGED
|
@@ -1,32 +1,92 @@
|
|
| 1 |
-
"""Patch frontend ChatInput.tsx:
|
| 2 |
|
| 3 |
FILE = "/source/frontend/src/components/Chat/ChatInput.tsx"
|
| 4 |
|
| 5 |
with open(FILE, "r") as f:
|
| 6 |
content = f.read()
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
with open(FILE, "w") as f:
|
| 24 |
f.write(content)
|
| 25 |
|
| 26 |
-
assert "
|
| 27 |
-
assert "
|
| 28 |
-
assert "deepseek-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
print("
|
|
|
|
| 1 |
+
"""Patch frontend ChatInput.tsx: Add all models to dropdown with descriptions."""
|
| 2 |
|
| 3 |
FILE = "/source/frontend/src/components/Chat/ChatInput.tsx"
|
| 4 |
|
| 5 |
with open(FILE, "r") as f:
|
| 6 |
content = f.read()
|
| 7 |
|
| 8 |
+
# Find end of DEFAULT_MODEL_OPTIONS array
|
| 9 |
+
idx_deepseek = content.find("'deepseek-v4-pro'")
|
| 10 |
+
if idx_deepseek == -1:
|
| 11 |
+
idx_deepseek = content.find("deepseek-ai/DeepSeek-V4")
|
| 12 |
+
if idx_deepseek == -1:
|
| 13 |
+
print("❌ Cannot find DeepSeek entry!")
|
| 14 |
+
import sys; sys.exit(1)
|
| 15 |
|
| 16 |
+
idx_end = content.find("];", idx_deepseek)
|
| 17 |
+
if idx_end == -1:
|
| 18 |
+
print("❌ Cannot find end of array!")
|
| 19 |
+
import sys; sys.exit(1)
|
| 20 |
|
| 21 |
+
new_models = """ {
|
| 22 |
+
id: 'owl-alpha',
|
| 23 |
+
name: 'Owl Alpha',
|
| 24 |
+
description: 'OpenRouter · mạnh · đa năng',
|
| 25 |
+
modelPath: 'openai/openrouter/owl-alpha',
|
| 26 |
+
avatarUrl: 'https://huggingface.co/api/avatars/openrouter',
|
| 27 |
+
recommended: true,
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
id: 'nemotron-120b',
|
| 31 |
+
name: 'Nemotron 3 Super 120B',
|
| 32 |
+
description: 'OpenRouter · NVIDIA · free',
|
| 33 |
+
modelPath: 'openai/nvidia/nemotron-3-super-120b-a12b:free',
|
| 34 |
+
avatarUrl: 'https://huggingface.co/api/avatars/nvidia',
|
| 35 |
+
recommended: true,
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
id: 'deepseek-v4-pro',
|
| 39 |
+
name: 'DeepSeek V4 Pro',
|
| 40 |
+
description: 'OpenRouter · code quality · rẻ',
|
| 41 |
+
modelPath: 'openai/deepseek/deepseek-v4-pro',
|
| 42 |
+
avatarUrl: 'https://huggingface.co/api/avatars/deepseek-ai',
|
| 43 |
+
recommended: true,
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
id: 'qwen3-coder-next',
|
| 47 |
+
name: 'Qwen3 Coder Next',
|
| 48 |
+
description: 'Code mạnh · HF Inference',
|
| 49 |
+
modelPath: 'Qwen/Qwen3-Coder-Next',
|
| 50 |
+
avatarUrl: 'https://huggingface.co/api/avatars/Qwen',
|
| 51 |
+
recommended: true,
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
id: 'mimo-v2.5',
|
| 55 |
+
name: 'Mimo V2.5',
|
| 56 |
+
description: 'OpenRouter · Xiaomi',
|
| 57 |
+
modelPath: 'openai/xiaomi/mimo-v2.5',
|
| 58 |
+
avatarUrl: 'https://huggingface.co/api/avatars/xiaomi',
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
id: 'gemma-3-1b',
|
| 62 |
+
name: 'Gemma 3 1B',
|
| 63 |
+
description: 'HF Inference · nhẹ · nhanh',
|
| 64 |
+
modelPath: 'google/gemma-3-1b-it',
|
| 65 |
+
avatarUrl: 'https://huggingface.co/api/avatars/google',
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
id: 'gemini-2.0-flash',
|
| 69 |
+
name: 'Gemini 2.0 Flash',
|
| 70 |
+
description: 'OpenRouter · nhanh',
|
| 71 |
+
modelPath: 'openai/google/gemini-2.0-flash-001',
|
| 72 |
+
avatarUrl: 'https://huggingface.co/api/avatars/google',
|
| 73 |
+
},
|
| 74 |
+
"""
|
| 75 |
+
|
| 76 |
+
content = content[:idx_end] + new_models + content[idx_end:]
|
| 77 |
+
|
| 78 |
+
# Rename Claude → Owl Alpha in UI
|
| 79 |
+
content = content.replace("'Claude Opus 4'", "'Owl Alpha'")
|
| 80 |
+
content = content.replace('"Claude Opus 4"', '"Owl Alpha"')
|
| 81 |
+
content = content.replace("Claude Opus", "Owl Alpha")
|
| 82 |
|
| 83 |
with open(FILE, "w") as f:
|
| 84 |
f.write(content)
|
| 85 |
|
| 86 |
+
assert "owl-alpha" in content
|
| 87 |
+
assert "nemotron-3-super-120b" in content
|
| 88 |
+
assert "deepseek-v4-pro" in content
|
| 89 |
+
assert "Qwen3-Coder-Next" in content
|
| 90 |
+
assert "mimo-v2.5" in content
|
| 91 |
+
assert "gemma-3-1b-it" in content
|
| 92 |
+
print("✅ Frontend patched")
|