refactor: standardize developer text and identifiers in English
This commit is contained in:
@@ -30,7 +30,7 @@ class SessionHandler(RealtimeBaseHandler):
|
||||
"""
|
||||
s = event.session
|
||||
|
||||
# Forza il bypass della voce inviata dal browser
|
||||
# Ignore the voice supplied by the browser.
|
||||
if hasattr(s, "voice") and s.voice is not None:
|
||||
s.voice = None
|
||||
elif isinstance(s, dict) and "voice" in s:
|
||||
|
||||
@@ -277,11 +277,10 @@ class RealtimeService:
|
||||
try:
|
||||
return model_cls.model_validate(raw) # type: ignore[return-value]
|
||||
except ValidationError as e:
|
||||
# ── Retrocompatibilità session.update ─────────────────────────────────
|
||||
# Il formato standard OpenAI Realtime GA annida instructions/tools/tool_choice
|
||||
# DENTRO "session": { ... }. Per tollerare anche client che li mandano
|
||||
# alla RADICE (es. bug prima della Fase 2 MCP), ricostruiamo qui il payload
|
||||
# corretto e riproviamo la validazione. Funziona SOLO per session.update.
|
||||
# Backward-compatible session.update parsing.
|
||||
# OpenAI Realtime GA nests instructions/tools/tool_choice in "session".
|
||||
# Accept older clients that send them at the root by rebuilding the
|
||||
# nested payload and retrying validation, only for session.update.
|
||||
if event_type == "session.update":
|
||||
try:
|
||||
raw_dict = dict(raw) if not isinstance(raw, dict) else raw
|
||||
@@ -290,7 +289,7 @@ class RealtimeService:
|
||||
normalized_inner = dict(session_inner)
|
||||
else:
|
||||
normalized_inner = {}
|
||||
# Promuovi campi noti dalla root → inner se mancanti (fallback flat)
|
||||
# Promote known root fields into the inner session when missing.
|
||||
SESSION_KNOWN_TOP_LEVEL = (
|
||||
"instructions",
|
||||
"tools",
|
||||
|
||||
Reference in New Issue
Block a user