speka autoreg + shim pool
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Add speka-* aliases into sso_limits MODELS, toolgate ALLOW, legacy rank_models."""
|
||||
import re, shutil, time, sys
|
||||
|
||||
MODELS = ['speka-muse-glimmer', 'speka-nemotron-ultra', 'speka-laguna-xs',
|
||||
'speka-bolt', 'speka-lightning', 'speka-step5', 'speka-llama-vision']
|
||||
ts = time.strftime('%Y%m%dT%H%M%S')
|
||||
line_models = "MODELS += [m for m in %r if m not in MODELS] # [SPEKA %s]\n" % (MODELS, ts)
|
||||
line_allow = "ALLOW += [m for m in %r if m not in ALLOW] # [SPEKA %s]\n" % (MODELS, ts)
|
||||
line_rank = " models += [m for m in %r if m not in models] # [SPEKA %s]\n" % (MODELS, ts)
|
||||
|
||||
|
||||
def patch(path, line, marker='# [SPEKA'):
|
||||
src = open(path, encoding='utf-8').read()
|
||||
if marker in src:
|
||||
print('SKIP already', path)
|
||||
return False
|
||||
shutil.copy2(path, path + '.bak-speka-' + ts)
|
||||
src = src.rstrip('\n') + '\n' + line
|
||||
compile(src, path, 'exec')
|
||||
open(path, 'w', encoding='utf-8').write(src)
|
||||
print('PATCHED', path)
|
||||
return True
|
||||
|
||||
|
||||
patch('/root/sso_limits.py', line_models)
|
||||
patch('/root/toolgate.py', line_allow)
|
||||
patch('/opt/grok-bot/iishko/legacy.py', line_rank)
|
||||
Reference in New Issue
Block a user