feat: show team_member_model_max_budget field in Create Team modal UI

Add 'Default Member Model Budget' input field to the Create Team form in OldTeams.tsx
so admins can set per-model spend limits for team members without expanding the
Additional Settings accordion. Field accepts JSON format and is parsed before submission.
This commit is contained in:
Ishaan Jaffer 2026-04-24 16:10:23 -07:00
parent 4aa097e645
commit e5c33ca695
No known key found for this signature in database
2 changed files with 51 additions and 0 deletions

View file

@ -198,6 +198,20 @@ const CreateTeamModal = ({
formValues.metadata = JSON.stringify(metadata);
}
if (formValues.team_member_model_max_budget) {
if (typeof formValues.team_member_model_max_budget === "string") {
if (formValues.team_member_model_max_budget.trim() === "") {
delete formValues.team_member_model_max_budget;
} else {
try {
formValues.team_member_model_max_budget = JSON.parse(formValues.team_member_model_max_budget);
} catch (e) {
throw new Error("Failed to parse per-model member budget: " + e);
}
}
}
}
if (formValues.secret_manager_settings) {
if (typeof formValues.secret_manager_settings === "string") {
if (formValues.secret_manager_settings.trim() === "") {
@ -469,6 +483,20 @@ const CreateTeamModal = ({
</AccordionBody>
</Accordion>
<Form.Item
label={
<span>
Default Member Model Budget{" "}
<Tooltip title="Optional. Set independent spend limits per model for each team member. Format: {&quot;model-name&quot;: {&quot;max_budget&quot;: 10.0}}. Each member gets their own independent budget per model.">
<InfoCircleOutlined style={{ marginLeft: "4px" }} />
</Tooltip>
</span>
}
name="team_member_model_max_budget"
>
<TextInput placeholder={'{"gpt-3.5-turbo": {"max_budget": 10.0}}'} />
</Form.Item>
<Form.Item label="Max Budget (USD)" name="max_budget">
<NumericalInput step={0.01} precision={2} width={200} />
</Form.Item>

View file

@ -563,6 +563,21 @@ const Teams: React.FC<TeamProps> = ({
delete formValues.allowed_agents_and_groups;
}
// Parse team_member_model_max_budget from JSON string
if (formValues.team_member_model_max_budget) {
if (typeof formValues.team_member_model_max_budget === "string") {
if (formValues.team_member_model_max_budget.trim() === "") {
delete formValues.team_member_model_max_budget;
} else {
try {
formValues.team_member_model_max_budget = JSON.parse(formValues.team_member_model_max_budget);
} catch (e) {
throw new Error("Failed to parse team member model budget: " + e);
}
}
}
}
// Add model_aliases if any are defined
if (Object.keys(modelAliases).length > 0) {
formValues.model_aliases = modelAliases;
@ -1224,6 +1239,14 @@ const Teams: React.FC<TeamProps> = ({
<NumericalInput step={1} width={400} />
</Form.Item>
<Form.Item
label="Default Member Model Budget"
name="team_member_model_max_budget"
tooltip='Optional. Set independent spend limits per model for each team member. Each member gets their own independent budget per model. Format: {"model-name": {"max_budget": 10.0}}'
>
<TextInput placeholder='{"gpt-3.5-turbo": {"max_budget": 10.0}}' />
</Form.Item>
<Accordion
className="mt-20 mb-8"
onClick={() => {