Skip to content

Commit 734b406

Browse files
committed
Update app_kernel.py
1 parent 85292b0 commit 734b406

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

src/backend/app_kernel.py

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import asyncio
33
import logging
44
import os
5+
56
# Azure monitoring
67
import re
78
import uuid
@@ -12,20 +13,35 @@
1213
from azure.monitor.opentelemetry import configure_azure_monitor
1314
from common.config.app_config import config
1415
from 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+
)
1928
from common.utils.event_utils import track_event_if_configured
2029

2130
# Updated import for KernelArguments
2231
from 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+
)
2742
from fastapi.middleware.cors import CORSMiddleware
2843
from kernel_agents.agent_factory import AgentFactory
44+
2945
# Local imports
3046
from middleware.health_check import HealthCheckMiddleware
3147
from common.utils.utils_date import format_dates_in_messages
@@ -70,12 +86,7 @@
7086
# Add this near the top of your app.py, after initializing the app
7187
app.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=["*"],
@@ -87,6 +98,7 @@
8798
app.include_router(app_v3)
8899
logging.info("Added health check middleware")
89100

101+
90102
@app.post("/api/user_browser_language")
91103
async 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])
719731
async def get_steps_by_plan(plan_id: str, request: Request) -> List[Step]:
720732
"""

0 commit comments

Comments
 (0)