| """Patch frontend ChatInput.tsx: Fix model IDs and rename dropdown labels.""" |
|
|
| FILE = "/source/frontend/src/components/Chat/ChatInput.tsx" |
|
|
| with open(FILE, "r") as f: |
| content = f.read() |
|
|
| |
| content = content.replace("'Claude Opus 4.6'", "'Owl Alpha'") |
| content = content.replace('"Claude Opus 4.6"', '"Owl Alpha"') |
| content = content.replace("'Claude Opus 4'", "'Owl Alpha'") |
| content = content.replace('"Claude Opus 4"', '"Owl Alpha"') |
| content = content.replace("'Claude Sonnet 4.5'", "'Owl Beta'") |
| content = content.replace('"Claude Sonnet 4.5"', '"Owl Beta"') |
| content = content.replace("claude.label ?? option.name", "option.name") |
| content = content.replace("claude.label || option.name", "option.name") |
| content = content.replace("description: 'Anthropic'", "description: '🦉 Top Reasoning'") |
|
|
| |
| content = content.replace("moonshotai/Kimi-K2.6", "deepseek-ai/DeepSeek-V4-Pro") |
| content = content.replace("'Kimi K2.6'", "'DeepSeek V4 Pro'") |
| content = content.replace('"Kimi K2.6"', '"DeepSeek V4 Pro"') |
|
|
| |
| content = content.replace("MiniMaxAI/MiniMax-M2.7", "deepseek-ai/DeepSeek-V4-Flash") |
| content = content.replace("'MiniMax M2.7'", "'DeepSeek V4 Flash'") |
| content = content.replace('"MiniMax M2.7"', '"DeepSeek V4 Flash"') |
| content = content.replace("description: 'Novita'", "description: 'HF Inference'", 1) |
|
|
| |
| content = content.replace("zai-org/GLM-5.1", "openai/deepseek/deepseek-v4-flash") |
| content = content.replace("'GLM 5.1'", "'DeepSeek V4 Flash'") |
| content = content.replace('"GLM 5.1"', '"DeepSeek V4 Flash"') |
| content = content.replace("description: 'Together'", "description: 'Openrouter'") |
|
|
| |
| content = content.replace("deepseek-ai/DeepSeek-V4-Pro:deepinfra", "nvidia/nemotron-3-super-120b-a12b:free") |
| content = content.replace("description: 'DeepInfra'", "description: 'Openrouter Free'") |
| |
| |
| |
| content = content.replace("id: 'deepseek-v4-pro',\n name: 'DeepSeek V4 Pro'", "id: 'nemotron-120b',\n name: 'nvidia/nemotron-3-super-120b-a12b:free'") |
|
|
| |
| content = content.replace("description: 'Novita'", "description: 'HF Inference'") |
|
|
| |
| content = content.replace("'Best coding model'", "'⚡ Mạnh nhất · Code + Reasoning'") |
| content = content.replace("'Best all-around model'", "'⚡ Mạnh nhất · Code + Reasoning'") |
|
|
| |
| idx_end = content.find("];", content.find("DEFAULT_MODEL_OPTIONS") if "DEFAULT_MODEL_OPTIONS" in content else 0) |
| if idx_end == -1: |
| idx_end = content.rfind("];", 0, content.find("export") if "export" in content else len(content)) |
|
|
| if idx_end > 0: |
| new_models = """ { |
| id: 'gemma-3-1b', |
| name: 'Gemma 3 1B', |
| description: 'HF Inference', |
| modelPath: 'google/gemma-3-1b-it', |
| avatarUrl: 'https://huggingface.co/api/avatars/google', |
| recommended: true, |
| }, |
| { |
| id: 'qwen3-coder-next', |
| name: 'Qwen3 Coder Next', |
| description: 'HF Inference', |
| modelPath: 'Qwen/Qwen3-Coder-Next', |
| avatarUrl: 'https://huggingface.co/api/avatars/Qwen', |
| recommended: true, |
| }, |
| { |
| id: 'gemini-2.0-flash', |
| name: 'Gemini 2.0 Flash', |
| description: 'Openrouter', |
| modelPath: 'openai/google/gemini-2.0-flash-001', |
| avatarUrl: 'https://huggingface.co/api/avatars/google', |
| }, |
| """ |
| content = content[:idx_end] + new_models + content[idx_end:] |
|
|
| with open(FILE, "w") as f: |
| f.write(content) |
|
|
| print("✅ Frontend patched:") |
| print(" Row 1: DeepSeek V4 Pro | HF Inference") |
| print(" Row 2: Owl Alpha | 🦉 Top Reasoning") |
| print(" Row 3: GPT-5.5 | OpenAI") |
| print(" Row 4: DeepSeek V4 Flash | HF Inference (was Novita)") |
| print(" Row 5: DeepSeek V4 Flash | Openrouter (was Together)") |
| print(" Row 6: nvidia/nemotron-3-super-120b-a12b:free | Openrouter Free") |
| print(" Row 7: Gemma 3 1B | HF Inference") |
| print(" Row 8: Qwen3 Coder Next | HF Inference") |
| print(" Row 9: Gemini 2.0 Flash | Openrouter") |
|
|