bep40 commited on
Commit
f1cdc24
·
verified ·
1 Parent(s): 123cd2e

Fix frontend patch: rename Claude→DeepSeekV3, remove Kimi K2.6

Browse files
Files changed (1) hide show
  1. patch_frontend.py +48 -16
patch_frontend.py CHANGED
@@ -1,18 +1,44 @@
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!")
@@ -21,7 +47,7 @@ if idx_end == -1:
21
  new_models = """ {
22
  id: 'grok-4.3',
23
  name: 'Grok 4.3',
24
- description: 'Tốt nhất giá rẻ · $2/$10 · 1M context',
25
  modelPath: 'openai/x-ai/grok-4.3',
26
  avatarUrl: 'https://huggingface.co/api/avatars/xai-org',
27
  recommended: true,
@@ -29,15 +55,14 @@ new_models = """ {
29
  {
30
  id: 'deepseek-v4-pro-or',
31
  name: 'DeepSeek V4 Pro',
32
- description: 'Rẻ nhất · $0.5/$2.18 · code quality cực tốt',
33
  modelPath: 'openai/deepseek/deepseek-v4-pro',
34
  avatarUrl: 'https://huggingface.co/api/avatars/deepseek-ai',
35
- recommended: true,
36
  },
37
  {
38
  id: 'qwen3.7-max',
39
  name: 'Qwen 3.7 Max',
40
- description: 'Cân bằng · $1/$4 · quality khá',
41
  modelPath: 'openai/qwen/qwen3.7-max',
42
  avatarUrl: 'https://huggingface.co/api/avatars/Qwen',
43
  },
@@ -51,7 +76,7 @@ new_models = """ {
51
  {
52
  id: 'gemini-2.0-flash',
53
  name: 'Gemini 2.0 Flash',
54
- description: 'Rẻ · $0.15/$0.60 · nhanh',
55
  modelPath: 'openai/google/gemini-2.0-flash-001',
56
  avatarUrl: 'https://huggingface.co/api/avatars/google',
57
  },
@@ -59,12 +84,19 @@ new_models = """ {
59
 
60
  content = content[:idx_end] + new_models + content[idx_end:]
61
 
 
 
 
 
 
 
62
  with open(FILE, "w") as f:
63
  f.write(content)
64
 
65
- assert "grok-4.3" in content
66
- assert "deepseek-v4-pro" in content
67
- assert "qwen3.7-max" in content
68
- assert "Qwen3-235B-A22B" in content
69
- assert "gemini-2.0-flash" in content
70
- print("✅ Frontend patched: Grok 4.3, DeepSeek V4 Pro, Qwen 3.7 Max, Qwen3 HF, Gemini Flash added")
 
 
1
+ """Patch frontend ChatInput.tsx: Rename Claude→DeepSeek V3, remove Kimi, add new models."""
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. Remove Kimi K2.6 entry entirely
9
+ kimi_start = content.find("id: 'kimi-k2.6'")
10
+ if kimi_start > -1:
11
+ # Find the opening { before it
12
+ brace_start = content.rfind("{", 0, kimi_start)
13
+ # Find the closing }, after it
14
+ brace_end = content.find("},", kimi_start) + 2
15
+ content = content[:brace_start] + content[brace_end:]
16
+ print("✅ Removed Kimi K2.6")
17
+
18
+ # 2. Replace Claude Opus entry with DeepSeek V3
19
+ claude_start = content.find("id: 'claude-opus'")
20
+ if claude_start > -1:
21
+ brace_start = content.rfind("{", 0, claude_start)
22
+ brace_end = content.find("},", claude_start) + 2
23
+ deepseek_entry = """ {
24
+ id: 'deepseek-v3',
25
+ name: 'DeepSeek V3',
26
+ description: 'OpenRouter · Mặc định',
27
+ modelPath: 'openai/deepseek/deepseek-chat-v3-0324',
28
+ avatarUrl: 'https://huggingface.co/api/avatars/deepseek-ai',
29
+ recommended: true,
30
+ },"""
31
+ content = content[:brace_start] + deepseek_entry + content[brace_end:]
32
+ print("✅ Replaced Claude Opus with DeepSeek V3")
33
+
34
+ # 3. Add new models at end of array
35
  idx_deepseek = content.find("'deepseek-v4-pro'")
36
  if idx_deepseek == -1:
37
  idx_deepseek = content.find("deepseek-ai/DeepSeek-V4")
38
  if idx_deepseek == -1:
39
+ # Try finding end of array another way
40
+ idx_deepseek = content.find("DEFAULT_MODEL_OPTIONS")
41
+
42
  idx_end = content.find("];", idx_deepseek)
43
  if idx_end == -1:
44
  print("❌ Cannot find end of array!")
 
47
  new_models = """ {
48
  id: 'grok-4.3',
49
  name: 'Grok 4.3',
50
+ description: 'Tốt nhất giá rẻ · $2/$10 · 1M ctx',
51
  modelPath: 'openai/x-ai/grok-4.3',
52
  avatarUrl: 'https://huggingface.co/api/avatars/xai-org',
53
  recommended: true,
 
55
  {
56
  id: 'deepseek-v4-pro-or',
57
  name: 'DeepSeek V4 Pro',
58
+ description: 'Rẻ nhất mà vẫn tốt · $0.5/$2.18',
59
  modelPath: 'openai/deepseek/deepseek-v4-pro',
60
  avatarUrl: 'https://huggingface.co/api/avatars/deepseek-ai',
 
61
  },
62
  {
63
  id: 'qwen3.7-max',
64
  name: 'Qwen 3.7 Max',
65
+ description: 'Cân bằng · $1/$4',
66
  modelPath: 'openai/qwen/qwen3.7-max',
67
  avatarUrl: 'https://huggingface.co/api/avatars/Qwen',
68
  },
 
76
  {
77
  id: 'gemini-2.0-flash',
78
  name: 'Gemini 2.0 Flash',
79
+ description: 'Rẻ nhanh · $0.15/$0.60',
80
  modelPath: 'openai/google/gemini-2.0-flash-001',
81
  avatarUrl: 'https://huggingface.co/api/avatars/google',
82
  },
 
84
 
85
  content = content[:idx_end] + new_models + content[idx_end:]
86
 
87
+ # 4. Fix FIRST_FREE_MODEL_PATH reference (was Kimi, now DeepSeek V3)
88
+ content = content.replace(
89
+ "m.modelPath === FIRST_FREE_MODEL_PATH",
90
+ "m.modelPath === 'openai/deepseek/deepseek-chat-v3-0324'"
91
+ )
92
+
93
  with open(FILE, "w") as f:
94
  f.write(content)
95
 
96
+ # Verify
97
+ assert "kimi-k2.6" not in content, "Kimi still present!"
98
+ assert "deepseek-v3" in content, "DeepSeek V3 missing!"
99
+ assert "grok-4.3" in content, "Grok missing!"
100
+ assert "qwen3.7-max" in content, "Qwen 3.7 missing!"
101
+ assert "gemini-2.0-flash" in content, "Gemini missing!"
102
+ print("\n✅ Frontend complete: DeepSeek V3 default, Kimi removed, all models added")