mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
add interrupt detection, SSE event, and resume schemas
This commit is contained in:
parent
c9542c8603
commit
9751918e41
3 changed files with 34 additions and 1 deletions
|
|
@ -1175,6 +1175,17 @@ async def stream_new_chat(
|
|||
if completion_event:
|
||||
yield completion_event
|
||||
|
||||
# Check if the graph was interrupted (human-in-the-loop)
|
||||
state = await agent.aget_state(config)
|
||||
is_interrupted = state.tasks and any(task.interrupts for task in state.tasks)
|
||||
if is_interrupted:
|
||||
interrupt_value = state.tasks[0].interrupts[0].value
|
||||
yield streaming_service.format_interrupt_request(interrupt_value)
|
||||
yield streaming_service.format_finish_step()
|
||||
yield streaming_service.format_finish()
|
||||
yield streaming_service.format_done()
|
||||
return
|
||||
|
||||
# Generate LLM title for new chats after first response
|
||||
# Check if this is the first assistant response by counting existing assistant messages
|
||||
from sqlalchemy import func
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue