66os .environ .setdefault ("CHAINLIT_APP_ROOT" , str (Path (os .path .abspath (__file__ )).parent ))
77os .environ .setdefault ("SKIP_AUTH" , "1" )
88
9+ from codetide .agents .tide .streaming .service import run_concurrent_tasks , cancel_gen
910from codetide .agents .tide .ui .defaults import AICORE_CONFIG_EXAMPLE , EXCEPTION_MESSAGE , MISSING_CONFIG_MESSAGE , STARTERS
1011from codetide .agents .tide .ui .stream_processor import StreamProcessor , MarkerConfig
11- from codetide .agents .tide .ui .utils import run_concurrent_tasks , send_reasoning_msg
12+ from codetide .agents .tide .ui .utils import send_reasoning_msg
1213from codetide .agents .tide .ui .agent_tide_ui import AgentTideUi
1314from codetide .core .defaults import DEFAULT_ENCODING
1415from codetide .agents .tide .models import Step
@@ -364,7 +365,8 @@ async def agent_loop(message: Optional[cl.Message]=None, codeIdentifiers: Option
364365
365366 st = time .time ()
366367 is_reasonig_sent = False
367- async for chunk in run_concurrent_tasks (agent_tide_ui , codeIdentifiers ):
368+ loop = run_concurrent_tasks (agent_tide_ui , codeIdentifiers )
369+ async for chunk in loop :
368370 if chunk == STREAM_START_TOKEN :
369371 is_reasonig_sent = await send_reasoning_msg (loading_msg , context_msg , agent_tide_ui , st )
370372 continue
@@ -375,17 +377,18 @@ async def agent_loop(message: Optional[cl.Message]=None, codeIdentifiers: Option
375377 elif chunk == STREAM_END_TOKEN :
376378 # Handle any remaining content
377379 await stream_processor .finalize ()
378- break
380+ await asyncio .sleep (0.5 )
381+ await cancel_gen (loop )
379382
380383 await stream_processor .process_chunk (chunk )
381-
384+
382385 await asyncio .sleep (0.5 )
383386 if agent_tide_ui .agent_tide .steps :
384387 cl .user_session .set ("latest_step_message" , msg )
385388 msg .actions = [
386389 cl .Action (
387390 name = "stop_steps" ,
388- tooltip = "stop " ,
391+ tooltip = "Stop " ,
389392 icon = "octagon-x" ,
390393 payload = {"msg_id" : msg .id }
391394 ),
@@ -407,15 +410,6 @@ async def agent_loop(message: Optional[cl.Message]=None, codeIdentifiers: Option
407410 )
408411 )
409412
410- msg .actions .append (
411- cl .Action (
412- name = "checkout_commit_push" ,
413- tooltip = "A new branch will be created and the changes made so far will be commited and pushed to the upstream repository" ,
414- icon = "circle-fading-arrow-up" ,
415- payload = {"msg_id" : msg .id }
416- )
417- )
418-
419413 # Send the final message
420414 await msg .send ()
421415
0 commit comments