bep40 commited on
Commit
c1d2b49
·
verified ·
1 Parent(s): 5195563

Upload patch_frontend.py

Browse files
Files changed (1) hide show
  1. patch_frontend.py +36 -15
patch_frontend.py CHANGED
@@ -1,4 +1,4 @@
1
- """Patch frontend ChatInput.tsx + model.ts: Remove Owl Alpha, fix Tencent HY3 path, add Gemma 4:free as default."""
2
 
3
  # === Step 1: Patch model.ts constants ===
4
  MODEL_FILE = "/source/frontend/src/utils/model.ts"
@@ -31,7 +31,7 @@ FILE = "/source/frontend/src/components/Chat/ChatInput.tsx"
31
  with open(FILE, "r") as f:
32
  content = f.read()
33
 
34
- # Remove Owl Alpha references — revert Claude Opus name
35
  content = content.replace("'Owl Alpha'", "'Claude Opus 4.8'")
36
  content = content.replace('"Owl Alpha"', '"Claude Opus 4.8"')
37
 
@@ -53,7 +53,7 @@ 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 old Tencent HY3 entry if present
57
  old_tencent_block = """ {
58
  id: 'tencent-hy3',
59
  name: 'Tencent HY3',
@@ -62,38 +62,59 @@ old_tencent_block = """ {
62
  },"""
63
  content = content.replace(old_tencent_block, "")
64
 
65
- # === Add models at end of DEFAULT_MODEL_OPTIONS array ===
66
- idx_end = content.find("];", content.find("DEFAULT_MODEL_OPTIONS") if "DEFAULT_MODEL_OPTIONS" in content else 0)
67
- if idx_end == -1:
68
- idx_end = content.rfind("];", 0, content.find("export") if "export" in content else len(content))
69
-
70
- if idx_end > 0:
71
- new_models = """ {
72
  id: 'gemma-4-31b',
73
  name: 'Gemma 4 31B:free',
74
  modelPath: 'google/gemma-4-31b-it:free',
75
  avatarUrl: 'https://huggingface.co/api/avatars/google',
76
  recommended: true,
77
- },
78
- {
 
 
79
  id: 'tencent-hy3',
80
  name: 'Tencent HY3:free',
81
  modelPath: 'tencent/hy3:free',
82
  avatarUrl: 'https://huggingface.co/api/avatars/tencent',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  },
84
  {
85
  id: 'gemma-3-1b',
86
  name: 'Gemma 3 1B',
87
  modelPath: 'google/gemma-3-1b-it',
88
  avatarUrl: 'https://huggingface.co/api/avatars/google',
89
- recommended: true,
90
  },
91
  {
92
  id: 'qwen3-coder-next',
93
  name: 'Qwen3 Coder Next',
94
  modelPath: 'Qwen/Qwen3-Coder-Next',
95
  avatarUrl: 'https://huggingface.co/api/avatars/Qwen',
96
- recommended: true,
97
  },
98
  {
99
  id: 'gemini-2.0-flash',
@@ -114,4 +135,4 @@ print(" Row 3 (Kimi): DeepSeek V4 Pro")
114
  print(" Row 4 (MiniMax): DeepSeek V4 Flash")
115
  print(" Row 5 (GLM): DeepSeek V4 Flash (OR)")
116
  print(" Row 6 (DeepSeek): nvidia/nemotron-3-super-120b-a12b:free")
117
- print(" NEW: Gemma 4 31B:free (DEFAULT), Tencent HY3:free, Gemma 3 1B, Qwen3 Coder Next, Gemini 2.0 Flash")
 
1
+ """Patch frontend: Remove Owl Alpha, add working free models (no :free suffix)."""
2
 
3
  # === Step 1: Patch model.ts constants ===
4
  MODEL_FILE = "/source/frontend/src/utils/model.ts"
 
31
  with open(FILE, "r") as f:
32
  content = f.read()
33
 
34
+ # Remove Owl Alpha references
35
  content = content.replace("'Owl Alpha'", "'Claude Opus 4.8'")
36
  content = content.replace('"Owl Alpha"', '"Claude Opus 4.8"')
37
 
 
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 old Tencent/Gemma4 entries with :free suffix that don't work
57
  old_tencent_block = """ {
58
  id: 'tencent-hy3',
59
  name: 'Tencent HY3',
 
62
  },"""
63
  content = content.replace(old_tencent_block, "")
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
+ content = content.replace(old_gemma4_block, "")
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
+ content = content.replace(old_tencent_new_block, "")
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',
109
  name: 'Gemma 3 1B',
110
  modelPath: 'google/gemma-3-1b-it',
111
  avatarUrl: 'https://huggingface.co/api/avatars/google',
 
112
  },
113
  {
114
  id: 'qwen3-coder-next',
115
  name: 'Qwen3 Coder Next',
116
  modelPath: 'Qwen/Qwen3-Coder-Next',
117
  avatarUrl: 'https://huggingface.co/api/avatars/Qwen',
 
118
  },
119
  {
120
  id: 'gemini-2.0-flash',
 
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")