File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1313from sse_starlette import EventSourceResponse
1414
1515from app .auth .handlers import AuthedUser
16- from app .storage import get_thread
16+ from app .storage import get_assistant , get_thread
1717from app .lifespan import get_langserve
1818
1919router = APIRouter ()
@@ -50,6 +50,9 @@ async def stream_run(
5050 thread = await get_thread (user ["user_id" ], payload .thread_id )
5151 if not thread :
5252 raise HTTPException (status_code = 404 , detail = "Thread not found" )
53+ assistant = await get_assistant (user ["user_id" ], thread ["assistant_id" ])
54+ if not assistant :
55+ raise HTTPException (status_code = 404 , detail = "Assistant not found" )
5356
5457 return EventSourceResponse (
5558 (
@@ -60,6 +63,11 @@ async def stream_run(
6063 input = payload .input ,
6164 config = payload .config ,
6265 stream_mode = "messages" ,
66+ interrupt_before = ["action" ]
67+ if assistant ["config" ]["configurable" ].get (
68+ "type==agent/interrupt_before_action"
69+ )
70+ else None ,
6371 )
6472 )
6573 )
You can’t perform that action at this time.
0 commit comments