bep40 commited on
Commit
fea82a5
·
verified ·
1 Parent(s): 0ef7b61

Restore patch_frontend.py + rename Claude Opus 4.6 → Owl Alpha

Browse files
Files changed (1) hide show
  1. patch_frontend.py +50 -54
patch_frontend.py CHANGED
@@ -1,84 +1,80 @@
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
- # Also rename Claude Opus 4.7 → Owl Alpha in existing entries
22
- content = content.replace("Claude Opus 4.7", "Owl Alpha")
23
- content = content.replace("claude-opus-4.7", "owl-alpha")
24
- content = content.replace("Claude Opus 4", "Owl Alpha")
 
 
 
 
 
 
 
 
25
 
26
- new_models = """ {
 
 
 
 
 
 
 
 
 
 
27
  id: 'owl-alpha',
28
- name: 'Owl Alpha',
29
- description: 'Mạnh nhất · OpenRouter',
30
- modelPath: 'openai/owl-alpha',
31
- avatarUrl: 'https://huggingface.co/api/avatars/xai-org',
32
- recommended: true,
33
- },
34
- {
35
- id: 'deepseek-v4-pro',
36
- name: 'DeepSeek V4 Pro',
37
- description: 'Rẻ nhất · code quality cực tốt · HF Inference',
38
- modelPath: 'deepseek-ai/DeepSeek-V4-Pro',
39
- avatarUrl: 'https://huggingface.co/api/avatars/deepseek-ai',
40
  recommended: true,
41
  },
42
  {
43
  id: 'qwen3-coder-next',
44
  name: 'Qwen3 Coder Next',
45
- description: 'Code mạnh · HF Inference',
46
  modelPath: 'Qwen/Qwen3-Coder-Next',
47
  avatarUrl: 'https://huggingface.co/api/avatars/Qwen',
48
  recommended: true,
49
  },
50
- {
51
- id: 'minimax-m2.7',
52
- name: 'MiniMax M2.7',
53
- description: 'Đa năng · HF Inference',
54
- modelPath: 'MiniMaxAI/MiniMax-M2.7',
55
- avatarUrl: 'https://huggingface.co/api/avatars/MiniMaxAI',
56
- },
57
- {
58
- id: 'glm-5.1',
59
- name: 'GLM 5.1',
60
- description: 'Mạnh · HF Inference',
61
- modelPath: 'zai-org/GLM-5.1',
62
- avatarUrl: 'https://huggingface.co/api/avatars/zai-org',
63
- },
64
  {
65
  id: 'gemini-2.0-flash',
66
  name: 'Gemini 2.0 Flash',
67
- description: 'Nhanh · rẻ · OpenRouter',
68
  modelPath: 'openai/google/gemini-2.0-flash-001',
69
  avatarUrl: 'https://huggingface.co/api/avatars/google',
70
  },
71
  """
72
-
73
- content = content[:idx_end] + new_models + content[idx_end:]
74
 
75
  with open(FILE, "w") as f:
76
  f.write(content)
77
 
78
- assert "owl-alpha" in content
79
- assert "DeepSeek-V4-Pro" in content
80
- assert "Qwen3-Coder-Next" in content
81
- assert "MiniMax-M2.7" in content
82
- assert "GLM-5.1" in content
83
- assert "gemini-2.0-flash" in content
84
- print("✅ Frontend patched: Owl Alpha, DeepSeek V4 Pro, Qwen3 Coder Next, MiniMax M2.7, GLM 5.1, Gemini Flash")
 
 
1
+ """Patch frontend ChatInput.tsx: Fix model IDs and rename dropdown labels."""
2
 
3
  FILE = "/source/frontend/src/components/Chat/ChatInput.tsx"
4
 
5
  with open(FILE, "r") as f:
6
  content = f.read()
7
 
8
+ # === RENAME: Claude Opus 4.6 → Owl Alpha (display name only, keep model ID) ===
9
+ content = content.replace("Claude Opus 4.6", "Owl Alpha")
10
+ content = content.replace("Claude Opus 4", "Owl Alpha")
11
+ content = content.replace("claude-opus-4-6", "claude-opus-4-6") # keep ID unchanged
12
+ content = content.replace("Claude Sonnet 4.5", "Owl Beta")
 
 
13
 
14
+ # === Fix STT 1: moonshotai/Kimi-K2.6 → deepseek-ai/DeepSeek-V4-Pro (HF Inference) ===
15
+ content = content.replace("moonshotai/Kimi-K2.6", "deepseek-ai/DeepSeek-V4-Pro")
16
+ content = content.replace("moonshotai/kimi-k2.6", "deepseek-ai/DeepSeek-V4-Pro")
17
+ content = content.replace("kimi-ai/kimi-2.6", "deepseek-ai/DeepSeek-V4-Pro")
18
+ content = content.replace("Kimi K2.6", "DeepSeek V4 Pro Inference")
19
+ content = content.replace("Kimi 2.6", "DeepSeek V4 Pro Inference")
20
 
21
+ # === Fix STT 4: MiniMaxAI/... → deepseek-ai/DeepSeek-V4-Flash (HF Inference) ===
22
+ content = content.replace("MiniMaxAI/MiniMax-M2.7", "deepseek-ai/DeepSeek-V4-Flash")
23
+ content = content.replace("MiniMaxAI/MiniMax-M1", "deepseek-ai/DeepSeek-V4-Flash")
24
+ content = content.replace("minimax/MiniMax-M1", "deepseek-ai/DeepSeek-V4-Flash")
25
+ content = content.replace("MiniMax M2.7", "DeepSeek V4 Flash Inference")
26
+ content = content.replace("MiniMax M1", "DeepSeek V4 Flash Inference")
27
+
28
+ # === Fix STT 5: zai-org/GLM-5.1 → openai/deepseek/deepseek-v4-flash (OpenRouter) ===
29
+ content = content.replace("zai-org/GLM-5.1", "openai/deepseek/deepseek-v4-flash")
30
+ content = content.replace("THUDM/GLM-4", "openai/deepseek/deepseek-v4-flash")
31
+ content = content.replace("GLM 5.1", "DeepSeek V4 Flash Openrouter")
32
+ content = content.replace("GLM-4", "DeepSeek V4 Flash Openrouter")
33
 
34
+ # === Update descriptions for performance notes ===
35
+ content = content.replace("'Best coding model'", "'⚡ Mạnh nhất · Code + Reasoning · Free HF Inference'")
36
+ content = content.replace("'Best all-around model'", "'⚡ Mạnh nhất · Code + Reasoning · Free HF Inference'")
37
+
38
+ # === Add custom models at end of array ===
39
+ idx_end = content.find("];", content.find("DEFAULT_MODEL_OPTIONS") if "DEFAULT_MODEL_OPTIONS" in content else 0)
40
+ if idx_end == -1:
41
+ idx_end = content.rfind("];", 0, content.find("export") if "export" in content else len(content))
42
+
43
+ if idx_end > 0:
44
+ new_models = """ {
45
  id: 'owl-alpha',
46
+ name: 'Owl Alpha Openrouter',
47
+ description: '🦉 Top reasoning · Nhanh · OpenRouter',
48
+ modelPath: 'openrouter/owl-alpha',
49
+ avatarUrl: 'https://huggingface.co/api/avatars/openrouter',
 
 
 
 
 
 
 
 
50
  recommended: true,
51
  },
52
  {
53
  id: 'qwen3-coder-next',
54
  name: 'Qwen3 Coder Next',
55
+ description: '🔥 Code cực mạnh · Free HF Inference',
56
  modelPath: 'Qwen/Qwen3-Coder-Next',
57
  avatarUrl: 'https://huggingface.co/api/avatars/Qwen',
58
  recommended: true,
59
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  {
61
  id: 'gemini-2.0-flash',
62
  name: 'Gemini 2.0 Flash',
63
+ description: '💨 Siêu nhanh · Rẻ · OpenRouter',
64
  modelPath: 'openai/google/gemini-2.0-flash-001',
65
  avatarUrl: 'https://huggingface.co/api/avatars/google',
66
  },
67
  """
68
+ content = content[:idx_end] + new_models + content[idx_end:]
 
69
 
70
  with open(FILE, "w") as f:
71
  f.write(content)
72
 
73
+ print("✅ Frontend patched:")
74
+ print(" - Claude Opus 4.6 → Owl Alpha (display only)")
75
+ print(" - Claude Sonnet 4.5 → Owl Beta (display only)")
76
+ print(" 1. DeepSeek V4 Pro Inference")
77
+ print(" 2. Owl Alpha Openrouter")
78
+ print(" 4. DeepSeek V4 Flash Inference")
79
+ print(" 5. DeepSeek V4 Flash Openrouter")
80
+ print(" + Qwen3 Coder Next, Gemini Flash")