Spaces:
Running
Running
Download patch_flint_free_frontend.py from bep40/ml-intern: direct link, hf CLI and curl.
- Browser
- Download file 1.67 kB
-
https://huggingface.co/spaces/bep40/ml-intern/resolve/main/patch_flint_free_frontend.py
- Command line
-
hf download hf://spaces/bep40/ml-intern/patch_flint_free_frontend.py
-
curl -L -o patch_flint_free_frontend.py https://huggingface.co/spaces/bep40/ml-intern/resolve/main/patch_flint_free_frontend.py
1.67 kB
| """Patch frontend ChatInput.tsx: add recursive/flint-v1.0:free (OpenRouter). | |
| Uses the same `openai/` modelPath convention as Laguna S 2.1:free. | |
| The frontend modelPath is sent to the backend, which strips the `openai/` | |
| prefix and routes to OpenRouter via the existing catch-all in _resolve_llm_params. | |
| Runs AFTER patch_frontend_xing_nemotron_vl.py (which already rewrote | |
| DEFAULT_MODEL_OPTIONS). Idempotent. | |
| """ | |
| import os | |
| FILE = "/source/frontend/src/components/Chat/ChatInput.tsx" | |
| def patch(): | |
| if not os.path.exists(FILE): | |
| print(f"SKIP: {FILE} not found") | |
| return | |
| with open(FILE, "r", encoding="utf-8") as f: | |
| content = f.read() | |
| if "flint-v1.0" in content: | |
| print("OK: recursive/flint-v1.0:free already present in ChatInput.tsx (idempotent)") | |
| return | |
| # Anchor: the deepseek-v4-flash-latest entry at the end of DEFAULT_MODEL_OPTIONS. | |
| anchor = " {\n id: 'deepseek-v4-flash-latest',\n" | |
| new_entry = ( | |
| " {\n" | |
| " id: 'flint-v1.0-free',\n" | |
| " name: 'recursive/flint-v1.0:free',\n" | |
| " modelPath: 'openai/recursive/flint-v1.0:free',\n" | |
| " avatarUrl: 'https://huggingface.co/api/avatars/recursive',\n" | |
| " recommended: true,\n" | |
| " },\n" | |
| ) | |
| if anchor in content: | |
| content = content.replace(anchor, new_entry + anchor, 1) | |
| with open(FILE, "w", encoding="utf-8") as f: | |
| f.write(content) | |
| print("OK: added recursive/flint-v1.0:free to ChatInput.tsx DEFAULT_MODEL_OPTIONS") | |
| else: | |
| print("FAIL: deepseek anchor not found in ChatInput.tsx") | |
| return | |
| if __name__ == "__main__": | |
| patch() | |