refactor(chat): drop alternate streaming entry path; use graph_stream

This commit is contained in:
CREDO23 2026-05-07 19:25:20 +02:00
parent 52895e37e9
commit 7e07092f67
23 changed files with 61 additions and 1278 deletions

View file

@ -1,7 +1,23 @@
"""Relay state: thinking steps, tool bookkeeping, and stream helpers."""
"""Relay: thinking steps, tool bookkeeping, and ``EventRelay``.
Package imports are lazy so ``relay.thinking_step_sse`` (and siblings) can load
without pulling in ``event_relay`` (which imports handler modules that may
import those siblings).
"""
from __future__ import annotations
from app.tasks.chat.streaming.relay.event_relay import EventRelay, EventRelayConfig
__all__ = ["EventRelay", "EventRelayConfig"]
def __getattr__(name: str):
if name == "EventRelay":
from app.tasks.chat.streaming.relay.event_relay import EventRelay
return EventRelay
if name == "EventRelayConfig":
from app.tasks.chat.streaming.relay.event_relay import EventRelayConfig
return EventRelayConfig
msg = f"module {__name__!r} has no attribute {name!r}"
raise AttributeError(msg)

View file

@ -7,6 +7,7 @@ from dataclasses import dataclass, field
from typing import Any
from app.services.streaming.emitter import EmitterRegistry
from app.tasks.chat.streaming.graph_stream.result import StreamingResult
from app.tasks.chat.streaming.handlers.chain_end import iter_chain_end_frames
from app.tasks.chat.streaming.handlers.chat_model_stream import (
iter_chat_model_stream_frames,
@ -16,7 +17,6 @@ from app.tasks.chat.streaming.handlers.custom_event_dispatch import (
)
from app.tasks.chat.streaming.handlers.tool_end import iter_tool_end_frames
from app.tasks.chat.streaming.handlers.tool_start import iter_tool_start_frames
from app.tasks.chat.streaming.orchestration.output import StreamingResult
from app.tasks.chat.streaming.relay.state import AgentEventRelayState
from app.tasks.chat.streaming.relay.thinking_step_completion import (
complete_active_thinking_step,