Skip to content

Commit ff3d230

Browse files
committed
Merge branch 'macae-v3-dev-marktayl' into macae-v3-dev-mt-fr-2
2 parents a07c392 + 0233c56 commit ff3d230

File tree

8 files changed

+422
-103
lines changed

8 files changed

+422
-103
lines changed

data/agent_teams/hr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"input_key": "",
4444
"type": "",
4545
"name": "ProxyAgent",
46-
"deployment_name": "",
46+
"deployment_name": "gpt-4.1",
4747
"icon": "",
4848
"system_message": "",
4949
"description": "",

src/frontend/src/api/config.tsx

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,52 @@ export function headerBuilder(headers?: Record<string, string>): Record<string,
130130
...(headers ? headers : {})
131131
};
132132
}
133+
134+
/**
135+
* Initialize team on the backend - takes about 20 seconds
136+
* @returns Promise with team initialization response
137+
*/
138+
export async function initializeTeam(): Promise<{
139+
status: string;
140+
team_id: string;
141+
}> {
142+
const apiUrl = getApiUrl();
143+
if (!apiUrl) {
144+
throw new Error('API URL not configured');
145+
}
146+
147+
const headers = headerBuilder({
148+
'Content-Type': 'application/json',
149+
});
150+
151+
console.log('initializeTeam: Starting team initialization...');
152+
153+
try {
154+
const response = await fetch(`${apiUrl}/init_team`, {
155+
method: 'GET',
156+
headers,
157+
});
158+
159+
if (!response.ok) {
160+
const errorText = await response.text();
161+
throw new Error(errorText || `HTTP error! status: ${response.status}`);
162+
}
163+
164+
const data = await response.json();
165+
console.log('initializeTeam: Team initialization completed:', data);
166+
167+
// Validate the expected response format
168+
if (data.status !== 'Request started successfully' || !data.team_id) {
169+
throw new Error('Invalid response format from init_team endpoint');
170+
}
171+
172+
return data;
173+
} catch (error) {
174+
console.error('initializeTeam: Error initializing team:', error);
175+
throw error;
176+
}
177+
}
178+
133179
export const toBoolean = (value: any): boolean => {
134180
if (typeof value !== 'string') {
135181
return false;
@@ -145,5 +191,6 @@ export default {
145191
setEnvData,
146192
config,
147193
USER_ID,
148-
API_URL
194+
API_URL,
195+
initializeTeam
149196
};

src/frontend/src/components/common/SettingsButton.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ import {
4141
import { TeamConfig } from '../../models/Team';
4242
import { TeamService } from '../../services/TeamService';
4343

44+
import '../../index.css'
45+
4446
// Icon mapping function to convert string icons to FluentUI icons
4547
const getIconFromString = (iconString: string): React.ReactNode => {
4648
const iconMap: Record<string, React.ReactNode> = {
@@ -514,7 +516,7 @@ const SettingsButton: React.FC<SettingsButtonProps> = ({
514516
appearance="subtle"
515517
size="small"
516518
onClick={(e) => handleDeleteTeam(team, e)}
517-
style={{ color: '#d13438' }}
519+
className="delete-team-button"
518520
/>
519521
</Tooltip>
520522
</div>
@@ -751,16 +753,8 @@ const SettingsButton: React.FC<SettingsButtonProps> = ({
751753
{/* Delete Confirmation Dialog */}
752754
<Dialog open={deleteConfirmOpen} onOpenChange={(event, data) => setDeleteConfirmOpen(data.open)}>
753755
<DialogSurface>
754-
<DialogContent style={{
755-
display: 'flex',
756-
flexDirection: 'column',
757-
width: '100%'
758-
}}>
759-
<DialogBody style={{
760-
display: 'flex',
761-
flexDirection: 'column',
762-
width: '100%'
763-
}}>
756+
<DialogContent data-testid="delete-dialog">
757+
<DialogBody>
764758
<DialogTitle>⚠️ Delete Team Configuration</DialogTitle>
765759
<div style={{ marginTop: '16px', marginBottom: '20px' }}>
766760
<Text style={{ display: 'block', marginBottom: '16px' }}>
@@ -802,6 +796,7 @@ const SettingsButton: React.FC<SettingsButtonProps> = ({
802796
disabled={deleteLoading}
803797
style={{ backgroundColor: '#d13438', color: 'white' }}
804798
onClick={confirmDeleteTeam}
799+
data-testid="delete-team-confirm"
805800
>
806801
{deleteLoading ? 'Deleting...' : 'Delete for Everyone'}
807802
</Button>

0 commit comments

Comments
 (0)