-
Notifications
You must be signed in to change notification settings - Fork 278
feat: Json upload setting page #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: macae-v3-dev
Are you sure you want to change the base?
Conversation
@blessing-sanusi please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements JSON team configuration upload functionality, allowing users to upload custom team configurations and select teams for plan creation. The feature includes team management UI components, RAI validation for uploaded content, and backend support for team configuration processing.
- Adds team upload and selection interface with validation
- Integrates team selection into the plan creation workflow
- Implements RAI validation for team configuration content
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 8 comments.
Show a summary per file
File | Description |
---|---|
src/frontend/src/services/TeamService.ts | New service for team operations (upload, fetch, delete) |
src/frontend/src/services/TaskService.tsx | Added team_id parameter to plan creation |
src/frontend/src/pages/HomePage.tsx | Integrated team selection and upload functionality |
src/frontend/src/components/common/SettingsButton.tsx | New team management UI component |
src/frontend/src/models/Team.ts | Team data models and interfaces |
src/backend/utils_kernel.py | RAI validation function for team configurations |
src/backend/app_kernel.py | Added RAI validation to upload endpoint |
Comments suppressed due to low confidence (1)
src/frontend/src/components/common/SettingsButton.tsx:136
- The agent type name has a typo: "MaintanceKBAgent" should be "MaintenanceKBAgent" (missing 'e' in 'Maintenance')
setIsOpen(false);
FILE_SURFER = "FileSurfer", | ||
WEB_SURFER = "WebSurfer", | ||
SENSOR_SENTINEL = "SensorSentinel", | ||
MAINTENANCE_KB_AGENT = "MaintanceKBAgent", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The agent type name has a typo: "MaintanceKBAgent" should be "MaintenanceKBAgent" (missing 'e' in 'Maintenance')
MAINTENANCE_KB_AGENT = "MaintanceKBAgent", | |
MAINTENANCE_KB_AGENT = "MaintenanceKBAgent", |
Copilot uses AI. Check for mistakes.
PLANNER = "Planner_Agent", | ||
|
||
// Common uploadable agent types | ||
MAGENTIC_ONE = "MagenticOne", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The agent type name appears to have a typo: "MagenticOne" should likely be "MagneticOne" (missing 'i' in 'Magnetic')
MAGENTIC_ONE = "MagenticOne", | |
MAGNETIC_ONE = "MagneticOne", |
Copilot uses AI. Check for mistakes.
return 'system'; | ||
} | ||
|
||
// MagenticOne framework agents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment has a typo: "MagenticOne" should likely be "MagneticOne" (missing 'i' in 'Magnetic')
// MagenticOne framework agents | |
// MagneticOne framework agents |
Copilot uses AI. Check for mistakes.
// MagenticOne framework agents | ||
if (typeStr === 'MagenticOne' || [ | ||
'Coder', 'Executor', 'FileSurfer', 'WebSurfer' | ||
].includes(typeStr)) { | ||
return 'magentic-one'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The agent type comparison has a typo: "MagenticOne" should likely be "MagneticOne" (missing 'i' in 'Magnetic')
// MagenticOne framework agents | |
if (typeStr === 'MagenticOne' || [ | |
'Coder', 'Executor', 'FileSurfer', 'WebSurfer' | |
].includes(typeStr)) { | |
return 'magentic-one'; | |
// MagneticOne framework agents | |
if (typeStr === 'MagneticOne' || [ | |
'Coder', 'Executor', 'FileSurfer', 'WebSurfer' | |
].includes(typeStr)) { | |
return 'magnetic-one'; |
Copilot uses AI. Check for mistakes.
if (typeStr === 'MagenticOne' || [ | ||
'Coder', 'Executor', 'FileSurfer', 'WebSurfer' | ||
].includes(typeStr)) { | ||
return 'magentic-one'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The category name has a typo: "magentic-one" should likely be "magnetic-one" (missing 'i' in 'magnetic')
if (typeStr === 'MagenticOne' || [ | |
'Coder', 'Executor', 'FileSurfer', 'WebSurfer' | |
].includes(typeStr)) { | |
return 'magentic-one'; | |
if (typeStr === 'MagneticOne' || [ | |
'Coder', 'Executor', 'FileSurfer', 'WebSurfer' | |
].includes(typeStr)) { | |
return 'magnetic-one'; |
Copilot uses AI. Check for mistakes.
switch (category) { | ||
case 'system': | ||
return 'Person'; | ||
case 'magentic-one': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The category case has a typo: "magentic-one" should likely be "magnetic-one" (missing 'i' in 'magnetic')
case 'magentic-one': | |
case 'magnetic-one': |
Copilot uses AI. Check for mistakes.
// First, validate the file type | ||
if (!file.name.toLowerCase().endsWith('.json')) { | ||
throw new Error('Please upload a valid JSON file'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File type validation relies only on file extension which can be easily bypassed. Consider also validating the actual file content or MIME type for better security.
// First, validate the file type | |
if (!file.name.toLowerCase().endsWith('.json')) { | |
throw new Error('Please upload a valid JSON file'); | |
// First, validate the file type by extension and MIME type | |
const validMimeTypes = ['application/json', 'text/json']; | |
if ( | |
!file.name.toLowerCase().endsWith('.json') || | |
(file.type && !validMimeTypes.includes(file.type)) | |
) { | |
throw new Error('Please upload a valid JSON file (with .json extension and correct file type)'); |
Copilot uses AI. Check for mistakes.
// Check if this is an RAI validation error | ||
const errorDetail = error.response?.data?.detail || error.response?.data; | ||
|
||
// If the error message contains "inappropriate content", treat it as RAI error | ||
if (typeof errorDetail === 'string' && errorDetail.includes('inappropriate content')) { | ||
return { | ||
success: false, | ||
raiError: { | ||
error_type: 'RAI_VALIDATION_FAILED', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using string matching to detect RAI errors is fragile and could break if error messages change. Consider using structured error codes or types instead.
// Check if this is an RAI validation error | |
const errorDetail = error.response?.data?.detail || error.response?.data; | |
// If the error message contains "inappropriate content", treat it as RAI error | |
if (typeof errorDetail === 'string' && errorDetail.includes('inappropriate content')) { | |
return { | |
success: false, | |
raiError: { | |
error_type: 'RAI_VALIDATION_FAILED', | |
// Check if this is an RAI validation error using structured error code | |
const errorType = error.response?.data?.error_type; | |
const errorDetail = error.response?.data?.detail || error.response?.data?.message || error.response?.data; | |
if (errorType === 'RAI_VALIDATION_FAILED') { | |
return { | |
success: false, | |
raiError: { | |
error_type: errorType, |
Copilot uses AI. Check for mistakes.
…e AI Foundry - Add POST /api/upload_team_config endpoint for team configuration management - Implement FoundryAgentService for bulk agent creation with error handling - Add comprehensive RAI validation for all uploaded content - Add team selection UI with search, delete, and validation features - Add model deployment and search index validation services
@@ -0,0 +1,103 @@ | |||
import { TeamConfig } from '../models/Team'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convert this file to tsx
src/frontend/src/models/messages.tsx
Outdated
@@ -83,7 +83,7 @@ export interface ActionRequest { | |||
/** Action to be performed */ | |||
action: string; | |||
/** Agent assigned to this step */ | |||
agent: AgentType; | |||
agent: AgentTypeString; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put back the AgentType
instead of AgentTypeString
} | ||
|
||
export const quickTasks: QuickTask[] = [ | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very good
RAG = "RAG", | ||
|
||
// Specific agent names (can be any name with any type) | ||
CODER = "Coder", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this are not agent type,
Agent Type can be Custom, RAG, MagenticOne the other are Agent names
src/backend/app_kernel.py
Outdated
@@ -1526,6 +1629,160 @@ async def upload_team_config_endpoint(request: Request, file: UploadFile = File( | |||
raise HTTPException(status_code=500, detail="Internal server error occurred") | |||
|
|||
|
|||
@app.post("/api/upload_scenarios") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are sceenarios?? I don't think we upload scenarios by themselves but as part of the teams only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take endpoint out
"""Service for validating model deployments in Azure AI Foundry""" | ||
|
||
def __init__(self): | ||
self.subscription_id = os.getenv("AZURE_AI_SUBSCRIPTION_ID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should come from the configuration file
|
||
def __init__(self): | ||
"""Initialize the search validation service.""" | ||
self.search_endpoint = os.getenv("AZURE_SEARCH_ENDPOINT") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should come from the validation file
src/frontend/src/models/Team.ts
Outdated
export interface Agent { | ||
input_key: string; | ||
type: string; | ||
name: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they should be tsx extension
PLANNER = "Planner_Agent", | ||
|
||
// Common uploadable agent types | ||
MAGENTIC_ONE = "MagenticOne", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magentic one is not a name of Agent is a Agent Type, however, I think we will review this complete logic because in V3 the agent type are the agent names, and agent type will MagenticOne, Custom, and RAG
Purpose
Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information