smallest.ai autoreg + Waves cookie-pool shim
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
#!/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()
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
CID=115991
|
||||
for M in smallest-tts smallest-tts-pro; do
|
||||
for G in default premium t1 t2 t3 t4; do
|
||||
sudo -u postgres psql -d newapi -q -c "insert into abilities (\"group\",model,channel_id,enabled,priority,weight,tag) values ('$G','$M',$CID,true,700,1,'sm');" >/dev/null 2>&1
|
||||
done
|
||||
done
|
||||
echo "abilities=$(sudo -u postgres psql -d newapi -tAc "select count(*) from abilities where channel_id=$CID;" 2>/dev/null | tr -d ' ')"
|
||||
KEY=$(cat /root/_sm_key)
|
||||
systemctl restart new-api; sleep 10
|
||||
curl -s -m 120 -o /tmp/gw.wav -w "gateway:%{http_code} size:%{size_download}\n" -X POST http://127.0.0.1:48000/v1/audio/speech -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -d '{"model":"smallest-tts","input":"gateway routing check one two three","voice":"lakshya"}'
|
||||
file /tmp/gw.wav
|
||||
head -c 120 /tmp/gw.wav
|
||||
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=smallest.ai Waves shim (cookie pool)
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment=SS_BANK=/opt/smallest-shim/bank.jsonl
|
||||
Environment=SS_PORT=48014
|
||||
ExecStart=/usr/bin/python3 /opt/smallest-shim/shim.py
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user