Skip to content

Commit ffb9fc5

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 d65a018 + 46fa18d commit ffb9fc5

File tree

4 files changed

+51
-36
lines changed

4 files changed

+51
-36
lines changed

src/backend/common/database/cosmosdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ async def get_all_plans_by_team_id(self, team_id: str) -> List[Plan]:
235235
return await self.query_items(query, parameters, Plan)
236236

237237

238-
async def get_all_plans_by_team_id_status(self, team_id: str, status: str) -> List[Plan]:
238+
async def get_all_plans_by_team_id_status(self, user_id: str,team_id: str, status: str) -> List[Plan]:
239239
"""Retrieve all plans for a specific team."""
240240
query = "SELECT * FROM c WHERE c.team_id=@team_id AND c.data_type=@data_type and c.user_id=@user_id and c.overall_status=@status ORDER BY c._ts DESC"
241241
parameters = [
242-
{"name": "@user_id", "value": self.user_id},
242+
{"name": "@user_id", "value": user_id},
243243
{"name": "@team_id", "value": team_id},
244244
{"name": "@data_type", "value": DataType.plan},
245245
{"name": "@status", "value": status},

src/backend/common/database/database_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def get_all_plans_by_team_id(self, team_id: str) -> List[Plan]:
9393

9494
@abstractmethod
9595
async def get_all_plans_by_team_id_status(
96-
self, team_id: str, status: str
96+
self, user_id:str, team_id: str, status: str
9797
) -> List[Plan]:
9898
"""Retrieve all plans for a specific team."""
9999
pass

src/backend/v3/api/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ async def get_plans(request: Request):
12141214
return []
12151215

12161216
all_plans = await memory_store.get_all_plans_by_team_id_status(
1217-
team_id=current_team.team_id, status=PlanStatus.completed
1217+
user_id=user_id, team_id=current_team.team_id, status=PlanStatus.completed
12181218
)
12191219

12201220
return all_plans

src/frontend/src/utils/agentIconUtils.tsx

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
2-
import {
3-
Desktop20Regular,
4-
Code20Regular,
2+
import {
3+
Desktop20Regular,
4+
Code20Regular,
55
Building20Regular,
66
Organization20Regular,
77
Search20Regular,
@@ -113,18 +113,18 @@ const generateHash = (str: string): number => {
113113
*/
114114
const matchStringToFluentIcon = (iconString: string): React.ComponentType<any> | null => {
115115
if (!iconString || typeof iconString !== 'string') return null;
116-
116+
117117
// Try exact match first
118118
if (fluentIconMap[iconString]) {
119119
return fluentIconMap[iconString];
120120
}
121-
121+
122122
// Try case-insensitive match
123123
const lowerIconString = iconString.toLowerCase();
124124
if (fluentIconMap[lowerIconString]) {
125125
return fluentIconMap[lowerIconString];
126126
}
127-
127+
128128
// Try removing common suffixes and prefixes
129129
const cleanedIconString = iconString
130130
.replace(/20Regular$/i, '')
@@ -134,11 +134,11 @@ const matchStringToFluentIcon = (iconString: string): React.ComponentType<any> |
134134
.replace(/^icon/i, '')
135135
.toLowerCase()
136136
.trim();
137-
137+
138138
if (fluentIconMap[cleanedIconString]) {
139139
return fluentIconMap[cleanedIconString];
140140
}
141-
141+
142142
return null;
143143
};
144144

@@ -200,20 +200,20 @@ const getUniqueAgentIcon = (
200200
iconStyle: React.CSSProperties
201201
): React.ReactNode => {
202202
const cleanName = TaskService.cleanTextToSpaces(agentName).toLowerCase();
203-
203+
204204
// If we already assigned an icon to this agent, use it
205205
if (agentIconAssignments[cleanName]) {
206206
const IconComponent = agentIconAssignments[cleanName];
207207
return React.createElement(IconComponent, { style: iconStyle });
208208
}
209-
209+
210210
// Get deterministic icon based on agent name patterns
211211
// This ensures same names always get the same icon regardless of assignment order
212212
const selectedIcon = getDeterministicAgentIcon(cleanName);
213-
213+
214214
// Cache the assignment for future lookups
215215
agentIconAssignments[cleanName] = selectedIcon;
216-
216+
217217
return React.createElement(selectedIcon, { style: iconStyle });
218218
};
219219

@@ -222,8 +222,8 @@ const getUniqueAgentIcon = (
222222
* with consistent fallback patterns across all components
223223
*/
224224
export const getAgentIcon = (
225-
agentName: string,
226-
planData?: any,
225+
agentName: string,
226+
planData?: any,
227227
planApprovalRequest?: any,
228228
iconColor: string = 'var(--colorNeutralForeground2)'
229229
): React.ReactNode => {
@@ -245,7 +245,7 @@ export const getAgentIcon = (
245245
if (FluentIconComponent) {
246246
return React.createElement(FluentIconComponent, { style: iconStyle });
247247
}
248-
248+
249249
// Fallback: check if it's in the existing iconMap
250250
if (iconMap[agent.icon]) {
251251
return React.cloneElement(iconMap[agent.icon] as React.ReactElement, {
@@ -259,8 +259,8 @@ export const getAgentIcon = (
259259
const storedTeam = TeamService.getStoredTeam();
260260
if (storedTeam?.agents) {
261261
const cleanAgentName = TaskService.cleanTextToSpaces(agentName);
262-
263-
const agent = storedTeam.agents.find(a =>
262+
263+
const agent = storedTeam.agents.find(a =>
264264
TaskService.cleanTextToSpaces(a.name).toLowerCase().includes(cleanAgentName.toLowerCase()) ||
265265
a.type.toLowerCase().includes(cleanAgentName.toLowerCase()) ||
266266
a.input_key.toLowerCase().includes(cleanAgentName.toLowerCase())
@@ -286,15 +286,15 @@ export const getAgentIcon = (
286286
// 4. Deterministic icon assignment - ensures same names get same icons
287287
// Get all agent names from current context for unique assignment
288288
let allAgentNames: string[] = [];
289-
289+
290290
if (planApprovalRequest?.team) {
291291
allAgentNames = planApprovalRequest.team;
292292
} else if (planData?.team?.agents) {
293293
allAgentNames = planData.team.agents.map((a: any) => a.name || a.type || '');
294294
} else if (storedTeam?.agents) {
295295
allAgentNames = storedTeam.agents.map(a => a.name);
296296
}
297-
297+
298298
return getUniqueAgentIcon(agentName, allAgentNames, iconStyle);
299299
};
300300

@@ -313,13 +313,13 @@ export const clearAgentIconAssignments = (): void => {
313313
*/
314314
export const getAgentDisplayName = (agentName: string): string => {
315315
if (!agentName) return 'Assistant';
316-
316+
317317
// Clean and format the name
318318
let cleanName = TaskService.cleanTextToSpaces(agentName);
319-
319+
320320
// Remove "Agent" suffix if it exists (case insensitive)
321321
cleanName = cleanName.replace(/\s*agent\s*$/gi, '').trim();
322-
322+
323323
// Convert to proper case
324324
cleanName = cleanName
325325
.replace(/\bHRHelper\b/gi, 'HR Helper')
@@ -329,8 +329,8 @@ export const getAgentDisplayName = (agentName: string): string => {
329329

330330
// Convert to proper case
331331
cleanName = cleanName.replace(/\b\w/g, l => l.toUpperCase());
332-
333-
332+
333+
334334
// Handle special cases for better readability
335335
cleanName = cleanName
336336
.replace(/\bKb\b/g, 'KB') // KB instead of Kb
@@ -340,7 +340,7 @@ export const getAgentDisplayName = (agentName: string): string => {
340340
.replace(/\bAi\b/g, 'AI') // AI instead of Ai
341341
.replace(/\bUi\b/g, 'UI') // UI instead of Ui
342342
.replace(/\bDb\b/g, 'DB'); // DB instead of Db
343-
343+
344344
return cleanName || 'Assistant';
345345
};
346346

@@ -352,22 +352,37 @@ export const getAgentDisplayNameWithSuffix = (agentName: string): string => {
352352
return `${baseName} Agent`;
353353
};
354354

355+
/**
356+
* Get agent icon with custom styling override
357+
*/
355358
/**
356359
* Get agent icon with custom styling override
357360
*/
358361
export const getStyledAgentIcon = (
359-
agentName: string,
362+
agentName: string,
360363
customStyle: React.CSSProperties,
361-
planData?: any,
364+
planData?: any,
362365
planApprovalRequest?: any
363366
): React.ReactNode => {
364367
const icon = getAgentIcon(agentName, planData, planApprovalRequest);
365-
368+
366369
if (React.isValidElement(icon)) {
367-
return React.cloneElement(icon, {
368-
style: { ...icon.props.style, ...customStyle }
369-
});
370+
try {
371+
// Safely merge styles
372+
const mergedStyle = {
373+
...(icon.props as any)?.style,
374+
...customStyle
375+
};
376+
377+
return React.cloneElement(icon as React.ReactElement<any>, {
378+
style: mergedStyle
379+
});
380+
} catch (error) {
381+
// Fallback: return original icon if cloning fails
382+
console.warn('Failed to apply custom style to agent icon:', error);
383+
return icon;
384+
}
370385
}
371-
386+
372387
return icon;
373388
};

0 commit comments

Comments
 (0)