22import asyncio
33import logging
44import os
5+
56# Azure monitoring
67import re
78import uuid
1213from azure .monitor .opentelemetry import configure_azure_monitor
1314from common .config .app_config import config
1415from common .database .database_factory import DatabaseFactory
15- from common .models .messages_kernel import (AgentMessage , AgentType ,
16- HumanClarification , HumanFeedback ,
17- InputTask , Plan , PlanStatus ,
18- PlanWithSteps , Step , UserLanguage )
16+ from common .models .messages_kernel import (
17+ AgentMessage ,
18+ AgentType ,
19+ HumanClarification ,
20+ HumanFeedback ,
21+ InputTask ,
22+ Plan ,
23+ PlanStatus ,
24+ PlanWithSteps ,
25+ Step ,
26+ UserLanguage ,
27+ )
1928from common .utils .event_utils import track_event_if_configured
2029
2130# Updated import for KernelArguments
2231from common .utils .utils_kernel import rai_success
2332
2433# FastAPI imports
25- from fastapi import (FastAPI , HTTPException , Query , Request , WebSocket ,
26- WebSocketDisconnect )
34+ from fastapi import (
35+ FastAPI ,
36+ HTTPException ,
37+ Query ,
38+ Request ,
39+ WebSocket ,
40+ WebSocketDisconnect ,
41+ )
2742from fastapi .middleware .cors import CORSMiddleware
2843from kernel_agents .agent_factory import AgentFactory
44+
2945# Local imports
3046from middleware .health_check import HealthCheckMiddleware
3147from common .utils .utils_date import format_dates_in_messages
7086# Add this near the top of your app.py, after initializing the app
7187app .add_middleware (
7288 CORSMiddleware ,
73- allow_origins = [
74- "http://localhost:3000" , # Add this for local development
75- "https://localhost:3000" , # Add this if using HTTPS locally
76- "https://127.0.0.1:3000" ,
77- "http://127.0.0.1:3001" ,
78- ], # Allow all origins for development; restrict in production
89+ allow_origins = ["*" ], # Allow all origins for development; restrict in production
7990 allow_credentials = True ,
8091 allow_methods = ["*" ],
8192 allow_headers = ["*" ],
8798app .include_router (app_v3 )
8899logging .info ("Added health check middleware" )
89100
101+
90102@app .post ("/api/user_browser_language" )
91103async def user_browser_language_endpoint (user_language : UserLanguage , request : Request ):
92104 """
@@ -665,7 +677,6 @@ async def get_plans(
665677 "UserIdNotFound" , {"status_code" : 400 , "detail" : "no user" }
666678 )
667679 raise HTTPException (status_code = 400 , detail = "no user" )
668-
669680
670681 #### <To do: Francia> Replace the following with code to get plan run history from the database
671682
@@ -699,8 +710,8 @@ async def get_plans(
699710
700711 current_team = await memory_store .get_current_team (user_id = user_id )
701712 if not current_team :
702- return []
703-
713+ return []
714+
704715 all_plans = await memory_store .get_all_plans_by_team_id (team_id = current_team .id )
705716 # Fetch steps for all plans concurrently
706717 steps_for_all_plans = await asyncio .gather (
@@ -714,7 +725,8 @@ async def get_plans(
714725 list_of_plans_with_steps .append (plan_with_steps )
715726
716727 return []
717-
728+
729+
718730@app .get ("/api/steps/{plan_id}" , response_model = List [Step ])
719731async def get_steps_by_plan (plan_id : str , request : Request ) -> List [Step ]:
720732 """
0 commit comments