Skip to content

Commit 7fcae2b

Browse files
committed
Merge branch 'macae-v3-dev-v2-vip' of https://github.com/microsoft/Multi-Agent-Custom-Automation-Engine-Solution-Accelerator into macae-v3-dev-marktayl
2 parents d8de50e + 6e4357f commit 7fcae2b

File tree

8 files changed

+198
-200
lines changed

8 files changed

+198
-200
lines changed

src/backend/app_kernel.py

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from kernel_agents.agent_factory import AgentFactory
2929
# Local imports
3030
from middleware.health_check import HealthCheckMiddleware
31+
from common.utils.utils_date import format_dates_in_messages
3132
from v3.api.router import app_v3
3233

3334
# Semantic Kernel imports
@@ -671,57 +672,57 @@ async def get_plans(
671672
#### <To do: Francia> Replace the following with code to get plan run history from the database
672673

673674
# # Initialize memory context
674-
# memory_store = await DatabaseFactory.get_database(user_id=user_id)
675-
# if session_id:
676-
# plan = await memory_store.get_plan_by_session(session_id=session_id)
677-
# if not plan:
678-
# track_event_if_configured(
679-
# "GetPlanBySessionNotFound",
680-
# {"status_code": 400, "detail": "Plan not found"},
681-
# )
682-
# raise HTTPException(status_code=404, detail="Plan not found")
683-
684-
# # Use get_steps_by_plan to match the original implementation
685-
# steps = await memory_store.get_steps_by_plan(plan_id=plan.id)
686-
# plan_with_steps = PlanWithSteps(**plan.model_dump(), steps=steps)
687-
# plan_with_steps.update_step_counts()
688-
# return [plan_with_steps]
689-
# if plan_id:
690-
# plan = await memory_store.get_plan_by_plan_id(plan_id=plan_id)
691-
# if not plan:
692-
# track_event_if_configured(
693-
# "GetPlanBySessionNotFound",
694-
# {"status_code": 400, "detail": "Plan not found"},
695-
# )
696-
# raise HTTPException(status_code=404, detail="Plan not found")
697-
698-
# # Use get_steps_by_plan to match the original implementation
699-
# steps = await memory_store.get_steps_by_plan(plan_id=plan.id)
700-
# messages = await memory_store.get_data_by_type_and_session_id(
701-
# "agent_message", session_id=plan.session_id
702-
# )
703-
704-
# plan_with_steps = PlanWithSteps(**plan.model_dump(), steps=steps)
705-
# plan_with_steps.update_step_counts()
706-
707-
# # Format dates in messages according to locale
708-
# formatted_messages = format_dates_in_messages(
709-
# messages, config.get_user_local_browser_language()
710-
# )
711-
712-
# return [plan_with_steps, formatted_messages]
713-
714-
# all_plans = await memory_store.get_all_plans()
715-
# # Fetch steps for all plans concurrently
716-
# steps_for_all_plans = await asyncio.gather(
717-
# *[memory_store.get_steps_by_plan(plan_id=plan.id) for plan in all_plans]
718-
# )
719-
# # Create list of PlanWithSteps and update step counts
720-
# list_of_plans_with_steps = []
721-
# for plan, steps in zip(all_plans, steps_for_all_plans):
722-
# plan_with_steps = PlanWithSteps(**plan.model_dump(), steps=steps)
723-
# plan_with_steps.update_step_counts()
724-
# list_of_plans_with_steps.append(plan_with_steps)
675+
memory_store = await DatabaseFactory.get_database(user_id=user_id)
676+
if session_id:
677+
plan = await memory_store.get_plan_by_session(session_id=session_id)
678+
if not plan:
679+
track_event_if_configured(
680+
"GetPlanBySessionNotFound",
681+
{"status_code": 400, "detail": "Plan not found"},
682+
)
683+
raise HTTPException(status_code=404, detail="Plan not found")
684+
685+
# Use get_steps_by_plan to match the original implementation
686+
steps = await memory_store.get_steps_by_plan(plan_id=plan.id)
687+
plan_with_steps = PlanWithSteps(**plan.model_dump(), steps=steps)
688+
plan_with_steps.update_step_counts()
689+
return [plan_with_steps]
690+
if plan_id:
691+
plan = await memory_store.get_plan_by_plan_id(plan_id=plan_id)
692+
if not plan:
693+
track_event_if_configured(
694+
"GetPlanBySessionNotFound",
695+
{"status_code": 400, "detail": "Plan not found"},
696+
)
697+
raise HTTPException(status_code=404, detail="Plan not found")
698+
699+
# Use get_steps_by_plan to match the original implementation
700+
steps = await memory_store.get_steps_by_plan(plan_id=plan.id)
701+
messages = await memory_store.get_data_by_type_and_session_id(
702+
"agent_message", session_id=plan.session_id
703+
)
704+
705+
plan_with_steps = PlanWithSteps(**plan.model_dump(), steps=steps)
706+
plan_with_steps.update_step_counts()
707+
708+
# Format dates in messages according to locale
709+
formatted_messages = format_dates_in_messages(
710+
messages, config.get_user_local_browser_language()
711+
)
712+
713+
return [plan_with_steps, formatted_messages]
714+
715+
all_plans = await memory_store.get_all_plans()
716+
# Fetch steps for all plans concurrently
717+
steps_for_all_plans = await asyncio.gather(
718+
*[memory_store.get_steps_by_plan(plan_id=plan.id) for plan in all_plans]
719+
)
720+
# Create list of PlanWithSteps and update step counts
721+
list_of_plans_with_steps = []
722+
for plan, steps in zip(all_plans, steps_for_all_plans):
723+
plan_with_steps = PlanWithSteps(**plan.model_dump(), steps=steps)
724+
plan_with_steps.update_step_counts()
725+
list_of_plans_with_steps.append(plan_with_steps)
725726

726727
return []
727728

src/frontend/src/api/apiService.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ export class APIService {
118118
// return apiClient.post(API_ENDPOINTS.PROCESS_REQUEST, inputTask);
119119
// }
120120

121-
async createPlan(inputTask: InputTask): Promise<{ status: string; session_id: string }> {
122-
return apiClient.post(API_ENDPOINTS.PROCESS_REQUEST, inputTask);
121+
async createPlan(inputTask: InputTask): Promise<InputTaskResponse> {
122+
return apiClient.post(API_ENDPOINTS.PROCESS_REQUEST, inputTask);
123123
}
124124

125125
/**

src/frontend/src/api/config.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function getUserInfoGlobal() {
9797
}
9898

9999
if (!USER_INFO) {
100-
console.info('User info not yet configured');
100+
// console.info('User info not yet configured');
101101
return null;
102102
}
103103

@@ -149,7 +149,7 @@ export function headerBuilder(headers?: Record<string, string>): Record<string,
149149
// });
150150

151151
// console.log('initializeTeam: Starting team initialization...');
152-
152+
153153
// try {
154154
// const response = await fetch(`${apiUrl}/init_team`, {
155155
// method: 'GET',
@@ -163,12 +163,12 @@ export function headerBuilder(headers?: Record<string, string>): Record<string,
163163

164164
// const data = await response.json();
165165
// console.log('initializeTeam: Team initialization completed:', data);
166-
166+
167167
// // Validate the expected response format
168168
// if (data.status !== 'Request started successfully' || !data.team_id) {
169169
// throw new Error('Invalid response format from init_team endpoint');
170170
// }
171-
171+
172172
// return data;
173173
// } catch (error) {
174174
// console.error('initializeTeam: Error initializing team:', error);

src/frontend/src/components/content/HomeInput.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ import "../../styles/prism-material-oceanic.css";
1313
import "./../../styles/HomeInput.css";
1414

1515
import { HomeInputProps, iconMap, QuickTask } from "../../models/homeInput";
16-
import { TeamConfig } from "../../models/Team";
1716
import { TaskService } from "../../services/TaskService";
1817
import { NewTaskService } from "../../services/NewTaskService";
1918
import { RAIErrorCard, RAIErrorData } from "../errors";
20-
import { apiService } from "../../api/apiService";
2119

2220
import ChatInput from "@/coral/modules/ChatInput";
2321
import InlineToaster, { useInlineToaster } from "../toast/InlineToaster";
@@ -78,29 +76,24 @@ const HomeInput: React.FC<HomeInputProps> = ({
7876
input.trim(),
7977
selectedTeam?.team_id
8078
);
79+
console.log("Plan created:", response);
8180
setInput("");
8281

8382
if (textareaRef.current) {
8483
textareaRef.current.style.height = "auto";
8584
}
8685

87-
if (response.session_id && response.session_id !== null) {
86+
if (response.plan_id && response.plan_id !== null) {
8887
showToast("Plan created!", "success");
8988
dismissToast(id);
9089

91-
// Navigate to create page (no team ID in URL anymore)
92-
console.log('HomeInput: Navigating to plan creation with team:', selectedTeam?.name);
93-
console.log('HomeInput: Navigating to plan creation with session:', response.session_id);
94-
console.log('HomeInput: Plan created with session:', response.session_id);
95-
96-
navigate(`/plan/${response.session_id}`);
90+
navigate(`/plan/${response.plan_id}`);
9791
} else {
9892
showToast("Failed to create plan", "error");
9993
dismissToast(id);
10094
}
10195
} catch (error: any) {
10296
dismissToast(id);
103-
10497
// Check if this is an RAI validation error
10598
let errorDetail = null;
10699
try {

0 commit comments

Comments
 (0)