@@ -559,7 +559,8 @@ async def user_clarification(
559559
560560 try :
561561 result = await PlanService .handle_human_clarification (
562- human_feedback , user_id )
562+ human_feedback , user_id
563+ )
563564 print ("Human clarification processed:" , result )
564565 except ValueError as ve :
565566 print (f"ValueError processing human clarification: { ve } " )
@@ -573,7 +574,9 @@ async def user_clarification(
573574 "user_id" : user_id ,
574575 },
575576 )
576- return {"status" : "clarification recorded" ,}
577+ return {
578+ "status" : "clarification recorded" ,
579+ }
577580 else :
578581 logging .warning (
579582 f"No orchestration or plan found for request_id: { human_feedback .request_id } "
@@ -582,6 +585,7 @@ async def user_clarification(
582585 status_code = 404 , detail = "No active plan found for clarification"
583586 )
584587
588+
585589@app_v3 .post ("/agent_message" )
586590async def agent_message_user (
587591 agent_message : messages .AgentMessageResponse , request : Request
@@ -642,14 +646,14 @@ async def agent_message_user(
642646 # Set the approval in the orchestration config
643647
644648 try :
645-
649+
646650 result = await PlanService .handle_agent_messages (agent_message , user_id )
647651 print ("Agent message processed:" , result )
648652 except ValueError as ve :
649653 print (f"ValueError processing agent message: { ve } " )
650654 except Exception as e :
651655 print (f"Error processing agent message: { e } " )
652-
656+
653657 track_event_if_configured (
654658 "AgentMessageReceived" ,
655659 {
@@ -658,7 +662,9 @@ async def agent_message_user(
658662 "user_id" : user_id ,
659663 },
660664 )
661- return {"status" : "message recorded" ,}
665+ return {
666+ "status" : "message recorded" ,
667+ }
662668
663669
664670@app_v3 .post ("/upload_team_config" )
@@ -726,19 +732,19 @@ async def upload_team_config(
726732 track_event_if_configured (
727733 "Team configuration RAI validation failed" ,
728734 {
729- "status" : "failed" ,
730- "user_id" : user_id ,
731- "filename" : file .filename ,
732- "reason" : rai_error ,
733- },
734- )
735-
735+ "status" : "failed" ,
736+ "user_id" : user_id ,
737+ "filename" : file .filename ,
738+ "reason" : rai_error ,
739+ },
740+ )
741+
736742 raise HTTPException (status_code = 400 , detail = rai_error )
737743
738744 track_event_if_configured (
739- "Team configuration RAI validation passed" ,
740- {"status" : "passed" , "user_id" : user_id , "filename" : file .filename },
741- )
745+ "Team configuration RAI validation passed" ,
746+ {"status" : "passed" , "user_id" : user_id , "filename" : file .filename },
747+ )
742748 # Initialize memory store and service
743749 memory_store = await DatabaseFactory .get_database (user_id = user_id )
744750 team_service = TeamService (memory_store )
@@ -1340,16 +1346,16 @@ async def get_plan_by_id(request: Request, plan_id: str):
13401346 raise HTTPException (status_code = 404 , detail = "Plan not found" )
13411347
13421348 # Use get_steps_by_plan to match the original implementation
1343- steps = await memory_store .get_steps_by_plan (plan_id = plan .id )
1344- messages = []
13451349
1346- plan_with_steps = PlanWithSteps (** plan .model_dump (), steps = steps )
1347- plan_with_steps .update_step_counts ()
1348-
1349- # Format dates in messages according to locale
1350- formatted_messages = []
1351-
1352- return [plan_with_steps , formatted_messages ]
1350+ team = await memory_store .get_team_by_id (team_id = plan .team_id )
1351+ messages = await memory_store .get_agent_messages (plan_id = plan .plan_id )
1352+ m_plan = await memory_store .get_m_plan_by_plan_id (plan_id = plan .plan_id )
1353+ return {
1354+ "plan" : plan .model_dump (),
1355+ "team" : team .model_dump () if team else None ,
1356+ "messages" : [msg .model_dump () for msg in messages ],
1357+ "m_plan" : m_plan .model_dump () if m_plan else None ,
1358+ }
13531359 else :
13541360 track_event_if_configured (
13551361 "GetPlanId" , {"status_code" : 400 , "detail" : "no plan id" }
0 commit comments