fix(codex-link): keep subscription models untouched, append bridge models after them
sirala_codex re-sorted the whole list and rewrote every priority, which pushed the native subscription models to the bottom and put same-named AITURK copies (GPT-6-Astra) above them. Native models now keep their own order, priority and name; bridge models are appended after them and a copy that shares a native name is shown with an (AITURK) suffix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8ee676d7c6
commit
ce49d6d1cc
2 files changed
+40
-8
No files matched your search
@@ -85,6 +85,7 @@ def ide_yapilandirma(agent=AGENT):
|
||||
|
||||
|
||||
DOKUZ_ISARET = "9R · "
|
||||
AITURK_EKI = " (AITURK)"
|
||||
|
||||
|
||||
def _isaret(ad):
|
||||
@@ -157,10 +158,18 @@ def sec(data, tanimli=(), kapsam="ide", turler=None):
|
||||
|
||||
|
||||
def sirala_codex(modeller, ekler):
|
||||
"""Tum listeyi siralar: combo A-Z, sonra saglayici A-Z / model A-Z.
|
||||
Kimlik ve yetenek alanlari korunur; kayitli model secimine dokunulmaz.
|
||||
Codex'in isDefault etiketi kendi davranisi geregi ilk gorunur satira verilir."""
|
||||
"""Ozgun abonelik modelleri oldugu gibi kalir: sirasi, priority degeri ve adi degismez,
|
||||
listenin basinda durur. Ek modeller onlarin ARKASINA eklenir: combo A-Z, sonra
|
||||
saglayici A-Z / model A-Z. Ozgun bir modelle ayni adi tasiyan ek model " (AITURK)"
|
||||
ekiyle ayirt edilir; secicide ozgunun yerine gecmis gibi gorunmez.
|
||||
Kimlik ve yetenek alanlari korunur; kayitli model secimine dokunulmaz."""
|
||||
bilgiler = {m["slug"]: m for m in ekler}
|
||||
ozgunler = [m for m in modeller if m.get("slug", "") not in bilgiler]
|
||||
ek_modeller = [m for m in modeller if m.get("slug", "") in bilgiler]
|
||||
def yalin(ad): # "GPT-6-1-Sol" ile "GPT-6.1-Sol" ayni ad sayilir
|
||||
return re.sub(r"[^0-9a-z]+", "", (ad or "").casefold())
|
||||
|
||||
ozgun_adlar = {yalin(m.get("display_name") or m.get("slug", "")) for m in ozgunler}
|
||||
|
||||
def anahtar(m):
|
||||
slug = m.get("slug", "")
|
||||
@@ -182,9 +191,14 @@ def sirala_codex(modeller, ekler):
|
||||
saglayici, model = "OpenAI", ad
|
||||
return (1, saglayici.casefold(), model.casefold(), slug)
|
||||
|
||||
modeller.sort(key=anahtar)
|
||||
for n, model in enumerate(modeller):
|
||||
model["priority"] = n
|
||||
ek_modeller.sort(key=anahtar)
|
||||
taban = max([m.get("priority") or 0 for m in ozgunler], default=-1) + 1
|
||||
for n, model in enumerate(ek_modeller):
|
||||
model["priority"] = taban + n
|
||||
ad = model.get("display_name") or model.get("slug", "")
|
||||
if yalin(ad) in ozgun_adlar:
|
||||
model["display_name"] = f"{ad}{AITURK_EKI}"
|
||||
modeller[:] = ozgunler + ek_modeller
|
||||
|
||||
|
||||
def yukle(ua="AstraBridge/1.0 (codex)", timeout=30):
|
||||
|
||||
@@ -55,8 +55,26 @@ class MemberCatalog(unittest.TestCase):
|
||||
for m in models if m["slug"].startswith("ide/")]
|
||||
c.sirala_codex(models, extras)
|
||||
self.assertEqual([m["slug"] for m in models],
|
||||
["ide/A-Team", "ide/Z-Team", "ide/bekci-kurnaz", "ide/9router-cc-opus", "gpt-z"])
|
||||
self.assertEqual([m["priority"] for m in models], list(range(5)))
|
||||
["gpt-z", "ide/A-Team", "ide/Z-Team", "ide/bekci-kurnaz", "ide/9router-cc-opus"])
|
||||
self.assertEqual([m["priority"] for m in models], [1, 2, 3, 4, 5])
|
||||
|
||||
def test_subscription_models_keep_their_own_order_priority_and_name(self):
|
||||
models = [{"slug": "ide/GPT-6-Astra", "display_name": "GPT-6-Astra", "priority": 3},
|
||||
{"slug": "gpt-6-astra", "display_name": "GPT-6-Astra", "priority": 2},
|
||||
{"slug": "ide/A-Team", "display_name": "A-Team", "priority": 0},
|
||||
{"slug": "gpt-6.1-sol", "display_name": "GPT-6.1-Sol", "priority": 1},
|
||||
{"slug": "codex-auto-review", "display_name": "Codex Auto Review", "priority": 43}]
|
||||
models.append({"slug": "ide/GPT-6-1-Sol", "display_name": "GPT-6-1-Sol", "priority": 2})
|
||||
extras = [{"slug": "ide/GPT-6-Astra", "kind": "combo"}, {"slug": "ide/A-Team", "kind": "combo"},
|
||||
{"slug": "ide/GPT-6-1-Sol", "kind": "combo"}]
|
||||
originals = [dict(m) for m in models if not m["slug"].startswith("ide/")]
|
||||
c.sirala_codex(models, extras)
|
||||
self.assertEqual([m for m in models if not m["slug"].startswith("ide/")], originals)
|
||||
self.assertEqual([m["slug"] for m in models],
|
||||
["gpt-6-astra", "gpt-6.1-sol", "codex-auto-review", "ide/A-Team", "ide/GPT-6-1-Sol",
|
||||
"ide/GPT-6-Astra"])
|
||||
self.assertEqual([m["priority"] for m in models[3:]], [44, 45, 46])
|
||||
self.assertEqual([m["display_name"] for m in models[4:]], ["GPT-6-1-Sol (AITURK)", "GPT-6-Astra (AITURK)"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user