#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Add smallest-tts models to the three iishko gates (idempotent, backed up).""" import shutil, sys, time STAMP = time.strftime("%Y%m%d-%H%M%S") NEW = ["smallest-tts", "smallest-tts-pro"] def patch(path, old, new, label): try: src = open(path, encoding="utf-8").read() except FileNotFoundError: print("MISS %s %s" % (label, path)) return if new.strip() in src and all(('"%s"' % m) in src for m in NEW): print("SKIP %s already patched" % label) return if old not in src: print("WARN %s anchor not found in %s" % (label, path)) return shutil.copy2(path, path + ".bak-sm-" + STAMP) open(path, "w", encoding="utf-8").write(src.replace(old, new, 1)) print("OK %s patched" % label) def main(): # 1) bot rank_models: model disappears from token limits on every user activity patch("/opt/grok-bot/iishko/legacy.py", 'models += [m for m in ("eleven-tts", "qwen3-tts-flash") if m not in models]', 'models += [m for m in ("eleven-tts", "qwen3-tts-flash", "smallest-tts", "smallest-tts-pro") if m not in models]', "legacy.rank_models") # 2) toolgate allow-list patch("/root/toolgate.py", 'ALLOW.append("eleven-tts")', 'ALLOW.append("eleven-tts")\nfor _m in ("smallest-tts", "smallest-tts-pro"):\n ALLOW.append(_m)', "toolgate") # 3) sso_limits MODELS (tokens.model_limits source) patch("/root/sso_limits.py", 'MODELS += [m for m in ["eleven-tts","qwen3-tts-flash"] if m not in MODELS]', 'MODELS += [m for m in ["eleven-tts","qwen3-tts-flash","smallest-tts","smallest-tts-pro"] if m not in MODELS]', "sso_limits") if __name__ == "__main__": main()