File size: 1,606 Bytes
8dbf890
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""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()