refactor(reasoning)!: remove Node-RED engine and integrations
BREAKING CHANGE: NODE_RED reasoning is no longer supported. Unsupported mode values fall back to PROXY. PROXY and OPENAI remain available.
This commit is contained in:
@@ -17,7 +17,6 @@ from s2s_client.providers import apipilot as providers_apipilot
|
||||
from s2s_client.providers import caller as providers_caller
|
||||
from s2s_client.realtime import events as realtime_events
|
||||
from s2s_client.services import context as services_context
|
||||
from s2s_client.services import reasoning as services_reasoning
|
||||
from s2s_client.services import tool_context as services_tool_context
|
||||
|
||||
|
||||
@@ -408,8 +407,6 @@ async def realtime_proxy(ws: WebSocket) -> None:
|
||||
) as upstream:
|
||||
app_logging.logger.info("[INJECT-PROFILE] WS tunnel ESTABLISHED client=%s", client_ip)
|
||||
session_ctx = {
|
||||
"last_user_transcript": "",
|
||||
"last_item_id": None,
|
||||
"injected_episode_context": injected_episode_context,
|
||||
"injected_profile_context": injected_profile_context,
|
||||
"injected_reports_context": injected_reports_context,
|
||||
@@ -1166,32 +1163,22 @@ async def _upstream_to_client(
|
||||
user_text = ""
|
||||
if event_type == "conversation.item.input_audio_transcription.completed":
|
||||
user_text = (summary.get("transcript") or "").strip()
|
||||
item_id = summary.get("item_id")
|
||||
if user_text:
|
||||
app_logging.logger.info(
|
||||
"[USER INPUT] client=%s stt=%s",
|
||||
client_ip,
|
||||
user_text,
|
||||
)
|
||||
session_ctx["last_user_transcript"] = user_text
|
||||
if item_id:
|
||||
session_ctx["last_item_id"] = item_id
|
||||
elif event_type == "conversation.item.created" and summary.get("role") == "user":
|
||||
user_text = (summary.get("text") or "").strip()
|
||||
item_id = summary.get("item_id") or summary.get("id")
|
||||
if user_text:
|
||||
app_logging.logger.info(
|
||||
"[USER INPUT] client=%s text=%s",
|
||||
client_ip,
|
||||
user_text,
|
||||
)
|
||||
session_ctx["last_user_transcript"] = user_text
|
||||
if item_id:
|
||||
session_ctx["last_item_id"] = item_id
|
||||
# Agent output, including all event variants.
|
||||
agent_text = ""
|
||||
response_id = summary.get("response_id") or summary.get("id")
|
||||
item_id = summary.get("item_id")
|
||||
if event_type in {"response.audio_transcript.done", "response.output_audio_transcript.done"}:
|
||||
# Pass-2 accumulation already retained the original text.
|
||||
# This sanitized agent_text is only for UI and logs.
|
||||
@@ -1202,19 +1189,6 @@ async def _upstream_to_client(
|
||||
client_ip,
|
||||
agent_text,
|
||||
)
|
||||
asyncio.create_task(
|
||||
services_reasoning._forward_agent_text_to_nodered(
|
||||
{
|
||||
"tts": agent_text,
|
||||
"response_id": response_id,
|
||||
"item_id": item_id,
|
||||
"client_ip": client_ip,
|
||||
"role": "assistant",
|
||||
"source_event": event_type,
|
||||
"user_transcript": session_ctx.get("last_user_transcript") or "",
|
||||
}
|
||||
)
|
||||
)
|
||||
else:
|
||||
raw_preview = summary.get("_raw_preview") or json.dumps(summary, ensure_ascii=True)
|
||||
app_logging.logger.debug(
|
||||
@@ -1232,19 +1206,6 @@ async def _upstream_to_client(
|
||||
client_ip,
|
||||
agent_text,
|
||||
)
|
||||
asyncio.create_task(
|
||||
services_reasoning._forward_agent_text_to_nodered(
|
||||
{
|
||||
"tts": agent_text,
|
||||
"response_id": response_id,
|
||||
"item_id": item_id,
|
||||
"client_ip": client_ip,
|
||||
"role": "assistant",
|
||||
"source_event": event_type,
|
||||
"user_transcript": session_ctx.get("last_user_transcript") or "",
|
||||
}
|
||||
)
|
||||
)
|
||||
elif event_type == "response.output_item.done" and summary.get("role") == "assistant":
|
||||
agent_text = (summary.get("text") or "").strip()
|
||||
if agent_text:
|
||||
@@ -1253,19 +1214,6 @@ async def _upstream_to_client(
|
||||
client_ip,
|
||||
agent_text,
|
||||
)
|
||||
asyncio.create_task(
|
||||
services_reasoning._forward_agent_text_to_nodered(
|
||||
{
|
||||
"tts": agent_text,
|
||||
"response_id": response_id,
|
||||
"item_id": item_id,
|
||||
"client_ip": client_ip,
|
||||
"role": "assistant",
|
||||
"source_event": event_type,
|
||||
"user_transcript": session_ctx.get("last_user_transcript") or "",
|
||||
}
|
||||
)
|
||||
)
|
||||
elif event_type == "conversation.item.created" and summary.get("role") == "assistant":
|
||||
agent_text = (summary.get("text") or "").strip()
|
||||
if agent_text:
|
||||
@@ -1274,19 +1222,6 @@ async def _upstream_to_client(
|
||||
client_ip,
|
||||
agent_text,
|
||||
)
|
||||
asyncio.create_task(
|
||||
services_reasoning._forward_agent_text_to_nodered(
|
||||
{
|
||||
"tts": agent_text,
|
||||
"response_id": response_id,
|
||||
"item_id": item_id,
|
||||
"client_ip": client_ip,
|
||||
"role": "assistant",
|
||||
"source_event": event_type,
|
||||
"user_transcript": session_ctx.get("last_user_transcript") or "",
|
||||
}
|
||||
)
|
||||
)
|
||||
if event_type not in realtime_events._NOISY_REALTIME_EVENT_TYPES:
|
||||
app_logging.logger.debug(
|
||||
"[EXT][S2S-PROXY] client=%s UPSTREAM→ event=%s summary=%s",
|
||||
|
||||
Reference in New Issue
Block a user