bep40 commited on
Commit
9e3b950
·
verified ·
1 Parent(s): 64fe76f

Fix frontend: patch existing dropdown entries exactly

Browse files
Files changed (1) hide show
  1. patch_frontend.py +20 -80
patch_frontend.py CHANGED
@@ -1,92 +1,32 @@
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")
 
1
+ """Patch frontend ChatInput.tsx: Modify existing model entries in dropdown."""
2
 
3
  FILE = "/source/frontend/src/components/Chat/ChatInput.tsx"
4
 
5
  with open(FILE, "r") as f:
6
  content = f.read()
7
 
8
+ # 1. Replace Kimi K2.6 → DeepSeek V4 Pro (HF Inference)
9
+ content = content.replace("moonshotai/Kimi-K2.6", "deepseek-ai/DeepSeek-V4-Pro")
10
+ content = content.replace("'kimi-k2.6'", "'deepseek-v4-pro'")
11
+ content = content.replace("Kimi K2.6", "DeepSeek V4 Pro")
 
 
 
12
 
13
+ # 4. MiniMax M2.7 → openai/deepseek/deepseek-v4-flash (OpenRouter prefix)
14
+ content = content.replace("MiniMaxAI/MiniMax-M2.7", "openai/deepseek/deepseek-v4-flash")
15
+ content = content.replace("'minimax-m2.7'", "'deepseek-v4-flash-or'")
16
+ content = content.replace("MiniMax M2.7", "DeepSeek V4 Flash (OR)")
17
 
18
+ # 5. GLM 5.1 → deepseek-ai/DeepSeek-V4-Flash (HF Inference)
19
+ content = content.replace("zai-org/GLM-5.1", "deepseek-ai/DeepSeek-V4-Flash")
20
+ content = content.replace("'glm-5.1'", "'deepseek-v4-flash-hf'")
21
+ content = content.replace("GLM 5.1", "DeepSeek V4 Flash (HF)")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  with open(FILE, "w") as f:
24
  f.write(content)
25
 
26
+ assert "deepseek-ai/DeepSeek-V4-Pro" in content
27
+ assert "openai/deepseek/deepseek-v4-flash" in content
28
+ assert "deepseek-ai/DeepSeek-V4-Flash" in content
29
+ print("✅ Frontend patched:")
30
+ print(" - Kimi K2.6 → DeepSeek V4 Pro (HF)")
31
+ print(" - MiniMax M2.7 → DeepSeek V4 Flash (OR)")
32
+ print(" - GLM 5.1 → DeepSeek V4 Flash (HF)")