feat(codex-bridge): natural model command, spelled-out names, any gateway model, clear miss
Live voice chat 01a12804: the user said "Seed iki nokta bir turbo yap" (no "modeli", name spelled out) and the model was in the gateway but not in Codex's list; the main model then promised the bridge would do it. A sentence ending in a command verb whose name fits exactly one model is now a command, single letters are joined, a name missing from Codex's list is looked up in the gateway's full model list, and an explicit command whose name fits nothing is answered by the bridge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8a612beba7
commit
a46ff51019
3 files changed
+92
-5
No files matched your search
@@ -773,6 +773,31 @@ def bilinen_modeller():
|
||||
if m.get("slug") and m["slug"] not in gorulen]
|
||||
return liste
|
||||
|
||||
_GECIT = {"zaman": 0.0, "liste": []}
|
||||
|
||||
def gecit_modelleri():
|
||||
"""AITURK gecidindeki BUTUN modeller (Codex listesinde gorunmeyenler dahil), "ide/<kimlik>" olarak. Soylenen ad
|
||||
Codex listesinde yoksa buraya bakilir (olcum 11 Ekim 2026: "Seed 2.1 Turbo" gecitte vardi, listede yoktu).
|
||||
10 dakika bellekte tutulur; alinamazsa bos liste."""
|
||||
simdi = time.time()
|
||||
if simdi - _GECIT["zaman"] < 600:
|
||||
return _GECIT["liste"]
|
||||
_GECIT["zaman"] = simdi
|
||||
rota = ROUTES.get("aiturk-ide")
|
||||
if not rota:
|
||||
_GECIT["liste"] = []
|
||||
return []
|
||||
try:
|
||||
adres = rota["url"].rsplit("/", 1)[0] + "/models"
|
||||
istek = urllib.request.Request(adres, headers={"Authorization": f"Bearer {rota['key']}", "User-Agent": UA})
|
||||
with urllib.request.urlopen(istek, timeout=6) as yanit:
|
||||
veri = json.loads(yanit.read())
|
||||
_GECIT["liste"] = [("ide/" + m["id"], m["id"]) for m in veri.get("data", []) if isinstance(m, dict) and m.get("id")]
|
||||
except Exception as e:
|
||||
log(f"gecit model listesi alinamadi: {type(e).__name__}: {e}")
|
||||
_GECIT["liste"] = []
|
||||
return _GECIT["liste"]
|
||||
|
||||
def model_adi(slug):
|
||||
return next((ad for kimlik, ad in bilinen_modeller() if kimlik == slug), None) or slug
|
||||
|
||||
@@ -1156,7 +1181,16 @@ class H(http.server.BaseHTTPRequestHandler):
|
||||
return f"Sohbetin modeli şu an {model_adi(etkin)}. " + model_gecis.NASIL
|
||||
sonuc = model_gecis.eslestir(komut["ad"], bilinen_modeller())
|
||||
if not sonuc:
|
||||
return None # ad hicbir modele benzemiyor: komut degil, modele gider
|
||||
sonuc = model_gecis.eslestir(komut["ad"], gecit_modelleri()) # Codex listesinde olmayan gecit modeli
|
||||
if not komut.get("kesin", True) and not (sonuc and "slug" in sonuc):
|
||||
return None # "modeli" denmemis ve ad tek modele oturmuyor: komut degil, modele gider
|
||||
if not sonuc:
|
||||
if ortada:
|
||||
return None
|
||||
# Acik komut ("modeli ... yap") ama ad bulunamadi: model "kopru yapacak" diye yanlis soz vermesin.
|
||||
log(f"[{n} {gelen}] model komutu: ad bulunamadi {komut['ad']}")
|
||||
return (f"\"{' '.join(komut['ad'])}\" adına uyan bir model bulamadım, model değişmedi; sohbetin modeli hâlâ "
|
||||
f"{model_adi(etkin)}. Adını biraz farklı söyler misin?")
|
||||
if "adaylar" in sonuc:
|
||||
soru = ("Hangi modeli istediğini tek modele bağlayamadım, model değişmedi. En yakınlar: "
|
||||
+ ", ".join(sonuc["adaylar"]) + ". Adını biraz daha tam söyler misin?")
|
||||
|
||||
Reference in new issue
Block a user