Skip to content

Commit b566350

Browse files
committed
Refactor team config retrieval and update frontend models
Replaces user-specific team configuration retrieval with a method that fetches all team configurations. Updates backend service, API router, and database interfaces accordingly. Refactors frontend PlanPanelRight and related models to use PlanDetailsProps instead of TaskDetailsProps, and cleans up unused props. Improves WebSocketService URL construction and message handling for new message types. Adjusts PlanChat input logic and disables input only when submitting.
2 parents 8139a6c + 04babf4 commit b566350

File tree

13 files changed

+108
-56
lines changed

13 files changed

+108
-56
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
@@ -174,7 +174,7 @@ const PlanChat: React.FC<SimplifiedPlanChatProps> = ({
174174
setInput={setInput}
175175
submittingChatDisableInput={submittingChatDisableInput}
176176
OnChatSubmit={OnChatSubmit}
177-
showChatInput={!planApprovalRequest}
177+
showChatInput={true}
178178
waitingForPlan={waitingForPlan}
179179
loading={false} />
180180
</div>

src/frontend/src/components/content/PlanChatBody.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ const PlanChatBody: React.FC<SimplifiedPlanChatProps> = ({
2828
maxWidth: '800px',
2929
margin: '0 auto',
3030
width: '100%'
31-
}}>
31+
}}
32+
33+
>
3234
<ChatInput
3335
value={input}
3436
onChange={setInput}
3537
onEnter={() => OnChatSubmit(input)}
36-
disabledChat={submittingChatDisableInput || waitingForPlan}
38+
disabledChat={submittingChatDisableInput}
3739
placeholder={
3840
waitingForPlan
3941
? "Creating plan..."
@@ -44,7 +46,7 @@ const PlanChatBody: React.FC<SimplifiedPlanChatProps> = ({
4446
appearance="transparent"
4547
onClick={() => OnChatSubmit(input)}
4648
icon={<SendRegular />}
47-
disabled={submittingChatDisableInput || waitingForPlan}
49+
disabled={submittingChatDisableInput}
4850
style={{ height: '40px', width: '40px' }}
4951
/>
5052
</ChatInput>

src/frontend/src/components/content/PlanPanelRight.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@ import {
66
PersonRegular,
77
ArrowTurnDownRightRegular,
88
} from "@fluentui/react-icons";
9-
import { MPlanData } from "../../models";
9+
import { MPlanData, PlanDetailsProps } from "../../models";
1010
import { TaskService } from "../../services/TaskService";
1111
import { AgentTypeUtils, AgentType } from "../../models/enums";
1212
import ContentNotFound from "../NotFound/ContentNotFound";
1313

14-
interface PlanPanelRightProps {
15-
planData: any;
16-
loading: boolean;
17-
planApprovalRequest: MPlanData | null;
18-
}
1914

20-
const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
15+
const PlanPanelRight: React.FC<PlanDetailsProps> = ({
2116
planData,
2217
loading,
2318
planApprovalRequest
@@ -62,9 +57,9 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
6257

6358
// Get the icon name from the utility
6459
const iconName = AgentTypeUtils.getAgentIcon(agentType);
65-
60+
6661
// Return the appropriate icon component or fallback to PersonRegular
67-
return <PersonRegular style={{
62+
return <PersonRegular style={{
6863
color: 'var(--colorPaletteBlueForeground2)',
6964
fontSize: '16px'
7065
}} />;
@@ -83,11 +78,11 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
8378
if (!planApprovalRequest.steps || planApprovalRequest.steps.length === 0) return [];
8479

8580
const result: Array<{ type: 'heading' | 'substep'; text: string }> = [];
86-
81+
8782
planApprovalRequest.steps.forEach(step => {
8883
const action = step.cleanAction || step.action || '';
8984
const trimmedAction = action.trim();
90-
85+
9186
if (trimmedAction) {
9287
// Check if the step ends with a colon
9388
if (trimmedAction.endsWith(':')) {
@@ -117,8 +112,8 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
117112
display: 'flex',
118113
flexDirection: 'column'
119114
}}>
120-
<Body1 style={{
121-
marginBottom: '16px',
115+
<Body1 style={{
116+
marginBottom: '16px',
122117
flexShrink: 0,
123118
fontSize: '14px',
124119
fontWeight: 600,
@@ -186,7 +181,7 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
186181
flex: 1,
187182
overflow: 'auto'
188183
}}>
189-
<Body1 style={{
184+
<Body1 style={{
190185
marginBottom: '16px',
191186
fontSize: '14px',
192187
fontWeight: 600,
@@ -227,11 +222,11 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
227222
}}>
228223
{getAgentIcon(agentName)}
229224
</div>
230-
225+
231226
{/* Agent Info - just name */}
232227
<div style={{ flex: 1 }}>
233-
<Body1 style={{
234-
fontWeight: 600,
228+
<Body1 style={{
229+
fontWeight: 600,
235230
fontSize: '14px',
236231
color: 'var(--colorNeutralForeground1)'
237232
}}>

src/frontend/src/models/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export * from './homeInput';
1616
export * from './auth';
1717

1818
// Export taskDetails with explicit naming to avoid Agent conflict
19-
export type { SubTask, Human, TaskDetailsProps } from './taskDetails';
19+
export type { SubTask, Human, PlanDetailsProps } from './taskDetails';
2020
export type { Agent as TaskAgent } from './taskDetails';
2121

2222
// Export Team models (Agent interface takes precedence)

0 commit comments

Comments
 (0)