Skip to content

Commit 17df80e

Browse files
authored
Merge pull request #464 from microsoft/macae-v3-fr-dev-92
Macae v3 fr dev 92
2 parents a05076c + 76c146c commit 17df80e

File tree

10 files changed

+74
-19
lines changed

10 files changed

+74
-19
lines changed

src/backend/common/database/cosmosdb.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ async def get_team_by_id(self, id: str) -> Optional[TeamConfiguration]:
334334
teams = await self.query_items(query, parameters, TeamConfiguration)
335335
return teams[0] if teams else None
336336

337-
async def get_all_teams_by_user(self, user_id: str) -> List[TeamConfiguration]:
337+
async def get_all_teams(self) -> List[TeamConfiguration]:
338338
"""Retrieve all team configurations for a specific user.
339339
340340
Args:
@@ -343,9 +343,8 @@ async def get_all_teams_by_user(self, user_id: str) -> List[TeamConfiguration]:
343343
Returns:
344344
List of TeamConfiguration objects
345345
"""
346-
query = "SELECT * FROM c WHERE c.user_id=@user_id AND c.data_type=@data_type ORDER BY c.created DESC"
346+
query = "SELECT * FROM c WHERE c.data_type=@data_type ORDER BY c.created DESC"
347347
parameters = [
348-
{"name": "@user_id", "value": user_id},
349348
{"name": "@data_type", "value": DataType.team_config},
350349
]
351350
teams = await self.query_items(query, parameters, TeamConfiguration)

src/backend/common/database/database_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ async def get_team_by_id(self, id: str) -> Optional[TeamConfiguration]:
159159
pass
160160

161161
@abstractmethod
162-
async def get_all_teams_by_user(self, user_id: str) -> List[TeamConfiguration]:
162+
async def get_all_teams(self) -> List[TeamConfiguration]:
163163
"""Retrieve all team configurations for the given user."""
164164
pass
165165

src/backend/v3/api/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ async def get_team_configs(request: Request):
688688
team_service = TeamService(memory_store)
689689

690690
# Retrieve all team configurations
691-
team_configs = await team_service.get_all_team_configurations(user_id)
691+
team_configs = await team_service.get_all_team_configurations()
692692

693693
# Convert to dictionaries for response
694694
configs_dict = [config.model_dump() for config in team_configs]

src/backend/v3/common/services/team_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ async def handle_team_selection(self, user_id: str, team_id: str) -> bool:
271271
return False
272272

273273
async def get_all_team_configurations(
274-
self, user_id: str
274+
self
275275
) -> List[TeamConfiguration]:
276276
"""
277277
Retrieve all team configurations for a user.
@@ -283,8 +283,8 @@ async def get_all_team_configurations(
283283
List of TeamConfiguration objects
284284
"""
285285
try:
286-
# Use the specific get_all_teams_by_user method
287-
team_configs = await self.memory_context.get_all_teams_by_user(user_id)
286+
# Use the specific get_all_teams method
287+
team_configs = await self.memory_context.get_all_teams()
288288
return team_configs
289289

290290
except (KeyError, TypeError, ValueError) as e:

src/backend/v3/config/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,13 @@ async def send_status_update_async(
199199
)
200200
return
201201

202+
print(f" websocket {message}")
202203
try:
203204
if hasattr(message, "data") and hasattr(message, "type"):
204205
message = message.data
205206
except Exception as e:
206207
print(f"Error loading message data: {e}")
207-
208+
print(f" websocket after {message}")
208209
standard_message = {
209210
"type": message_type,
210211
"data": message

src/backend/v3/magentic_agents/proxy_agent.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ async def reduce(self) -> ChatHistory | None:
8181
return None
8282
return await self._chat_history.reduce()
8383

84+
8485
class ProxyAgentResponseItem:
8586
"""Response item wrapper for proxy agent responses."""
8687

src/frontend/src/components/content/PlanChat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ const PlanChat: React.FC<SimplifiedPlanChatProps> = ({
159159
{renderThinkingState(waitingForPlan)}
160160

161161
{/* Plan response with all information */}
162-
{renderPlanResponse(planApprovalRequest, handleApprovePlan, handleRejectPlan, processingApproval, showApprovalButtons)}
162+
{showApprovalButtons && renderPlanResponse(planApprovalRequest, handleApprovePlan, handleRejectPlan, processingApproval, showApprovalButtons)}
163163
{renderAgentMessages(agentMessages)}
164164

165165

src/frontend/src/components/content/streaming/StreamingAgentMessage.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ const renderAgentMessages = (agentMessages: AgentMessageData[]) => {
88
if (!agentMessages || agentMessages.length === 0) return null;
99

1010
return (
11-
<div >
11+
<div
12+
// style={{
13+
// height: 200,
14+
// maxHeight: 200,
15+
// overflowY: 'auto', // or 'hidden' if you don't want scrolling
16+
// overflowX: 'hidden',
17+
// flex: '0 0 200px' // prevents flex parents from stretching it
18+
// }}
19+
20+
>
1221
{agentMessages.map((msg, index) => {
1322
const trimmed = msg.raw_content?.trim();
1423
if (!trimmed) return null; // skip if empty, null, or whitespace

src/frontend/src/pages/PlanPage.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const PlanPage: React.FC = () => {
8282
}, 100);
8383
}, []);
8484

85+
//WebsocketMessageType.PLAN_APPROVAL_REQUEST
8586
useEffect(() => {
8687
const unsubscribe = webSocketService.on(WebsocketMessageType.PLAN_APPROVAL_REQUEST, (approvalRequest: any) => {
8788
console.log('📋 Plan received:', approvalRequest);
@@ -122,7 +123,7 @@ const PlanPage: React.FC = () => {
122123
return () => unsubscribe();
123124
}, [scrollToBottom]); //onPlanReceived, scrollToBottom
124125

125-
126+
//(WebsocketMessageType.AGENT_MESSAGE_STREAMING
126127
useEffect(() => {
127128
const unsubscribe = webSocketService.on(WebsocketMessageType.AGENT_MESSAGE_STREAMING, (streamingMessage: any) => {
128129
// console.log('📋 Streaming Message', streamingMessage);
@@ -134,6 +135,28 @@ const PlanPage: React.FC = () => {
134135
return () => unsubscribe();
135136
}, [scrollToBottom]); //onPlanReceived, scrollToBottom
136137

138+
//WebsocketMessageType.USER_CLARIFICATION_REQUEST
139+
useEffect(() => {
140+
const unsubscribe = webSocketService.on(WebsocketMessageType.USER_CLARIFICATION_REQUEST, (clarificationMessage: any) => {
141+
console.log('📋 Clarification Message', clarificationMessage);
142+
scrollToBottom();
143+
144+
});
145+
146+
return () => unsubscribe();
147+
}, [scrollToBottom]);
148+
//WebsocketMessageType.AGENT_TOOL_MESSAGE
149+
useEffect(() => {
150+
const unsubscribe = webSocketService.on(WebsocketMessageType.AGENT_TOOL_MESSAGE, (toolMessage: any) => {
151+
console.log('📋 Tool Message', toolMessage);
152+
scrollToBottom();
153+
154+
});
155+
156+
return () => unsubscribe();
157+
}, [scrollToBottom]);
158+
159+
//WebsocketMessageType.AGENT_MESSAGE
137160
useEffect(() => {
138161
const unsubscribe = webSocketService.on(WebsocketMessageType.AGENT_MESSAGE, (agentMessage: any) => {
139162
console.log('📋 Agent Message', agentMessage);

src/frontend/src/services/WebSocketService.tsx

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,15 @@ class WebSocketService {
166166

167167
private handleMessage(message: StreamMessage): void {
168168

169-
const currentPlanIds = Array.from(this.planSubscriptions);
170-
const firstPlanId = currentPlanIds[0];
171-
169+
//console.log('WebSocket message received:', message);
170+
const hasClarification = /\bclarifications?\b/i.test(message.data || '');
171+
console.log("Message ':", message);
172+
if (hasClarification) {
173+
console.log("Message contains 'clarification':", message.data);
174+
}
172175
switch (message.type) {
173176
case WebsocketMessageType.PLAN_APPROVAL_REQUEST: {
174177
console.log("enter plan approval request");
175-
console.log('WebSocket message received:', message);
176178
const parsedData = PlanDataService.parsePlanApprovalRequest(message.data);
177179
if (parsedData) {
178180
const structuredMessage: ParsedPlanApprovalRequest = {
@@ -206,13 +208,33 @@ class WebSocketService {
206208
break;
207209
}
208210

209-
case WebsocketMessageType.AGENT_TOOL_MESSAGE:
210-
case WebsocketMessageType.USER_CLARIFICATION_REQUEST:
211+
case WebsocketMessageType.USER_CLARIFICATION_REQUEST: {
212+
if (message.data) {
213+
//const transformed = PlanDataService.parseUserClarificationRequest(message);
214+
this.emit(WebsocketMessageType.USER_CLARIFICATION_REQUEST, message);
215+
}
216+
break;
217+
}
218+
219+
220+
case WebsocketMessageType.AGENT_TOOL_MESSAGE: {
221+
if (message.data) {
222+
//const transformed = PlanDataService.parseUserClarificationRequest(message);
223+
this.emit(WebsocketMessageType.AGENT_TOOL_MESSAGE, message);
224+
}
225+
break;
226+
}
227+
case WebsocketMessageType.FINAL_RESULT_MESSAGE: {
228+
if (message.data) {
229+
//const transformed = PlanDataService.parseFinalResultMessage(message);
230+
this.emit(WebsocketMessageType.FINAL_RESULT_MESSAGE, message);
231+
}
232+
break;
233+
}
211234
case WebsocketMessageType.USER_CLARIFICATION_RESPONSE:
212235
case WebsocketMessageType.REPLAN_APPROVAL_REQUEST:
213236
case WebsocketMessageType.REPLAN_APPROVAL_RESPONSE:
214237
case WebsocketMessageType.PLAN_APPROVAL_RESPONSE:
215-
case WebsocketMessageType.FINAL_RESULT_MESSAGE:
216238
case WebsocketMessageType.AGENT_STREAM_START:
217239
case WebsocketMessageType.AGENT_STREAM_END:
218240
case WebsocketMessageType.SYSTEM_MESSAGE: {

0 commit comments

Comments
 (0)