"""Patch frontend: add stealth/space-bunny-alpha beside Laguna S 2.1. The model uses the same OpenRouter-style `openai/` model path convention as Laguna S 2.1 (`openai/poolside/laguna-s-2.1:free`). """ 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 "space-bunny-alpha" in content: print("OK: stealth/space-bunny-alpha already present") return anchor = ( " {\n" " id: 'laguna-s21',\n" " name: 'Laguna S 2.1:free',\n" " modelPath: 'openai/poolside/laguna-s-2.1:free',\n" " avatarUrl: 'https://huggingface.co/api/avatars/poolside',\n" " recommended: true,\n" " },\n" ) new_entry = ( " {\n" " id: 'space-bunny-alpha',\n" " name: 'stealth/space-bunny-alpha',\n" " modelPath: 'openai/stealth/space-bunny-alpha',\n" " avatarUrl: 'https://huggingface.co/api/avatars/stealth',\n" " recommended: true,\n" " },\n" ) if anchor in content: content = content.replace(anchor, anchor + new_entry, 1) print("OK: added stealth/space-bunny-alpha after Laguna S 2.1") else: print("FAIL: could not find Laguna S 2.1 model entry") return with open(FILE, "w", encoding="utf-8") as f: f.write(content) print("OK: ChatInput.tsx patched") if __name__ == "__main__": patch()