mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-13 17:52:38 +02:00
refactor(chat): drop alternate streaming entry path; use graph_stream
This commit is contained in:
parent
52895e37e9
commit
7e07092f67
23 changed files with 61 additions and 1278 deletions
|
|
@ -72,13 +72,8 @@ from app.schemas.new_chat import (
|
|||
TurnStatusResponse,
|
||||
)
|
||||
from app.tasks.chat.stream_new_chat import (
|
||||
stream_new_chat as legacy_stream_new_chat,
|
||||
stream_resume_chat as legacy_stream_resume_chat,
|
||||
)
|
||||
from app.tasks.chat.streaming.orchestration.orchestrator import (
|
||||
stream_chat,
|
||||
stream_regenerate,
|
||||
stream_resume,
|
||||
stream_new_chat,
|
||||
stream_resume_chat,
|
||||
)
|
||||
from app.users import current_active_user
|
||||
from app.utils.perf import get_perf_logger
|
||||
|
|
@ -98,10 +93,6 @@ TURN_CANCELLING_MAX_DELAY_MS = 1500
|
|||
router = APIRouter()
|
||||
|
||||
|
||||
def _use_streaming_orchestrator() -> bool:
|
||||
return config.ENABLE_CHAT_STREAM_ORCHESTRATOR
|
||||
|
||||
|
||||
def _resolve_filesystem_selection(
|
||||
*,
|
||||
mode: str,
|
||||
|
|
@ -1782,11 +1773,7 @@ async def handle_new_chat(
|
|||
)
|
||||
|
||||
return StreamingResponse(
|
||||
(
|
||||
stream_chat
|
||||
if _use_streaming_orchestrator()
|
||||
else legacy_stream_new_chat
|
||||
)(
|
||||
stream_new_chat(
|
||||
user_query=request.user_query,
|
||||
search_space_id=request.search_space_id,
|
||||
chat_id=request.chat_id,
|
||||
|
|
@ -2271,12 +2258,7 @@ async def regenerate_response(
|
|||
else None
|
||||
)
|
||||
try:
|
||||
regenerate_fn = (
|
||||
stream_regenerate
|
||||
if _use_streaming_orchestrator()
|
||||
else legacy_stream_new_chat
|
||||
)
|
||||
async for chunk in regenerate_fn(
|
||||
async for chunk in stream_new_chat(
|
||||
user_query=str(user_query_to_use),
|
||||
search_space_id=request.search_space_id,
|
||||
chat_id=thread_id,
|
||||
|
|
@ -2408,11 +2390,7 @@ async def resume_chat(
|
|||
await session.close()
|
||||
|
||||
return StreamingResponse(
|
||||
(
|
||||
stream_resume
|
||||
if _use_streaming_orchestrator()
|
||||
else legacy_stream_resume_chat
|
||||
)(
|
||||
stream_resume_chat(
|
||||
chat_id=thread_id,
|
||||
search_space_id=request.search_space_id,
|
||||
decisions=decisions,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue