File size: 1,669 Bytes
266c03f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""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()