Files
aiturk-hermes-ide/apps/desktop/assets/codex-bridge/internet.py
T
yilsemandClaude Opus 5.5 c8993d58cc feat(codex-bridge): web search for added models, forgiving spoken model names
Added models had no web search: Codex's built-in one runs on OpenAI's side and
the bridge drops it from their tool list. Measured in a voice session on
11 Oct 2026: a model looked for a search tool ten times and ended the turn
with no answer. The bridge now tells added models two ready commands (ara.py:
search and read a page, standard library only, no key). Codex's own models
never see the note: their requests do not reach the bridge.

Spoken model names: a half-spoken word matches the start of a name part
("think" -> thinking, "obli" -> obliterated), and when one candidate is the
others minus extra words, the one without the unsaid suffix is picked
("Qwen 3.8 Obliterated" -> not the ":thinking" one).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 07:25:30 +03:00

58 lines
2.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Ek modellere internet aramasi (11 Ekim 2026).
Kullanici karari (11 Ekim 2026, sesli): "Arastirma yapabilmesini istiyorum. Ayni Codex'te yapabildikleri gibi olmasini
istiyorum." Codex'in yerlesik web aramasi OpenAI sunucusunda calistigi icin ek modele verilemez (kopru onu arac
listesinden atar); olcum: ek model arama araci bulamayinca turu bos bitirdi. Kopru bunun yerine ek modele giden
istege, aramayi kabuk araciyla yapan hazir komutu (ara.py) soyleyen kisa bir not ekler. Codex'in kendi modelleri bu
notu hic gormez: onlarin istegi kopruye ugramaz.
Ayar (bridge.json, istege bagli): "internet": {"enabled": false} kapatir; {"talimat": "..."} metni degistirir.
"""
import os
import sys
ISARET = "[İnternet araması]"
VARSAYILAN = (
ISARET + " Bu modelde yerleşik web araması yok; internetten bilgi gerektiğinde (güncel olay, araştırma, kaynak, "
"fiyat, \"araştır\" isteği) kabuk aracınla şu iki komutu kullan:\n"
"Arama: {ara} \"sorgu\"\n"
"Sayfa okuma: {oku} <adres>\n"
"Önce ara, sonra işe yarayan iki üç sonucu oku, cevabında kaynak adreslerini belirt. Başka bir arama aracı "
"arama (tool_search ile bulunmaz). Komut hata verirse sorguyu değiştirip bir kez daha dene; yine olmazsa "
"aramanın yapılamadığını açıkça söyle, bilgi uydurma."
)
def python_yolu(calisan=None):
"""Modelin calistiracagi yorumlayici. Kopru penceresiz (pythonw) calisiyorsa cikti veren python secilir."""
calisan = calisan or sys.executable or "python"
klasor, ad = os.path.split(calisan)
if ad.lower() == "pythonw.exe":
aday = os.path.join(klasor, "python.exe")
if os.path.isfile(aday):
return aday
return calisan
def talimat(ayar, betik, python=None):
"""Eklenecek metin; kapaliysa ya da betik yoksa None."""
ayar = ayar if isinstance(ayar, dict) else {}
if ayar.get("enabled") is False or not betik or not os.path.isfile(betik):
return None
on = f'"{python or python_yolu()}" "{betik}"'
return str(ayar.get("talimat") or VARSAYILAN).replace("{ara}", on + " ara").replace("{oku}", on + " oku")
def ekle(req, metin):
"""Notu istegin basina developer mesaji olarak koyar. True: eklendi (zaten varsa eklenmez)."""
girdi = req.get("input")
if not metin or not isinstance(girdi, list):
return False
for oge in girdi[:4]:
icerik = oge.get("content") if isinstance(oge, dict) else None
yazi = icerik if isinstance(icerik, str) else " ".join(str(p.get("text") or "") for p in icerik or [] if isinstance(p, dict))
if ISARET in yazi:
return False
girdi.insert(0, {"type": "message", "role": "developer", "content": [{"type": "input_text", "text": metin}]})
return True