diff --git a/webui/react-ui/src/components/agent-form-sections/AdvancedSettingsSection.jsx b/webui/react-ui/src/components/agent-form-sections/AdvancedSettingsSection.jsx
index 517c9a5..b5072be 100644
--- a/webui/react-ui/src/components/agent-form-sections/AdvancedSettingsSection.jsx
+++ b/webui/react-ui/src/components/agent-form-sections/AdvancedSettingsSection.jsx
@@ -1,82 +1,82 @@
import React from 'react';
+import FormFieldDefinition from '../common/FormFieldDefinition';
/**
* Advanced Settings section of the agent form
*/
const AdvancedSettingsSection = ({ formData, handleInputChange }) => {
+ // Define field definitions for Advanced Settings section
+ const fields = [
+ {
+ name: 'max_steps',
+ label: 'Max Steps',
+ type: 'number',
+ defaultValue: 10,
+ helpText: 'Maximum number of steps the agent can take',
+ required: true,
+ },
+ {
+ name: 'max_iterations',
+ label: 'Max Iterations',
+ type: 'number',
+ defaultValue: 5,
+ helpText: 'Maximum number of iterations for each step',
+ required: true,
+ },
+ {
+ name: 'autonomous',
+ label: 'Autonomous Mode',
+ type: 'checkbox',
+ defaultValue: false,
+ helpText: 'Allow the agent to operate autonomously',
+ },
+ {
+ name: 'verbose',
+ label: 'Verbose Mode',
+ type: 'checkbox',
+ defaultValue: false,
+ helpText: 'Enable detailed logging',
+ },
+ {
+ name: 'allow_code_execution',
+ label: 'Allow Code Execution',
+ type: 'checkbox',
+ defaultValue: false,
+ helpText: 'Allow the agent to execute code (use with caution)',
+ },
+ ];
+
+ // Handle field value changes
+ const handleFieldChange = (name, value) => {
+ // For checkboxes, convert string 'true'/'false' to boolean
+ if (['autonomous', 'verbose', 'allow_code_execution'].includes(name)) {
+ handleInputChange({
+ target: {
+ name,
+ type: 'checkbox',
+ checked: value === 'true'
+ }
+ });
+ } else {
+ handleInputChange({
+ target: {
+ name,
+ value
+ }
+ });
+ }
+ };
+
return (
);
};
diff --git a/webui/react-ui/src/components/agent-form-sections/BasicInfoSection.jsx b/webui/react-ui/src/components/agent-form-sections/BasicInfoSection.jsx
index fd0f6e1..7d74ecc 100644
--- a/webui/react-ui/src/components/agent-form-sections/BasicInfoSection.jsx
+++ b/webui/react-ui/src/components/agent-form-sections/BasicInfoSection.jsx
@@ -1,4 +1,5 @@
import React from 'react';
+import FormFieldDefinition from '../common/FormFieldDefinition';
/**
* Basic Information section of the agent form
@@ -9,69 +10,74 @@ const BasicInfoSection = ({ formData, handleInputChange, isEdit, isGroupForm })
return null;
}
+ // Define field definitions for Basic Information section
+ const fields = [
+ {
+ name: 'name',
+ label: 'Name',
+ type: 'text',
+ defaultValue: '',
+ required: true,
+ helpText: isEdit ? 'Agent name cannot be changed after creation' : '',
+ disabled: isEdit, // This will be handled in the component
+ },
+ {
+ name: 'description',
+ label: 'Description',
+ type: 'textarea',
+ defaultValue: '',
+ },
+ {
+ name: 'identity_guidance',
+ label: 'Identity Guidance',
+ type: 'textarea',
+ defaultValue: '',
+ },
+ {
+ name: 'random_identity',
+ label: 'Random Identity',
+ type: 'checkbox',
+ defaultValue: false,
+ },
+ {
+ name: 'hud',
+ label: 'HUD',
+ type: 'checkbox',
+ defaultValue: false,
+ }
+ ];
+
+ // Handle field value changes
+ const handleFieldChange = (name, value) => {
+ // For checkboxes, convert string 'true'/'false' to boolean
+ if (name === 'random_identity' || name === 'hud') {
+ handleInputChange({
+ target: {
+ name,
+ type: 'checkbox',
+ checked: value === 'true'
+ }
+ });
+ } else {
+ handleInputChange({
+ target: {
+ name,
+ value
+ }
+ });
+ }
+ };
+
return (
Basic Information
-
-
-
- {isEdit && Agent name cannot be changed after creation}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
);
};
diff --git a/webui/react-ui/src/components/agent-form-sections/MCPServersSection.jsx b/webui/react-ui/src/components/agent-form-sections/MCPServersSection.jsx
index e76582f..5fd07fa 100644
--- a/webui/react-ui/src/components/agent-form-sections/MCPServersSection.jsx
+++ b/webui/react-ui/src/components/agent-form-sections/MCPServersSection.jsx
@@ -1,4 +1,5 @@
import React from 'react';
+import FormFieldDefinition from '../common/FormFieldDefinition';
/**
* MCP Servers section of the agent form
@@ -9,6 +10,28 @@ const MCPServersSection = ({
handleRemoveMCPServer,
handleMCPServerChange
}) => {
+ // Define field definitions for each MCP server
+ const getServerFields = () => [
+ {
+ name: 'url',
+ label: 'URL',
+ type: 'text',
+ defaultValue: '',
+ placeholder: 'https://example.com/mcp',
+ },
+ {
+ name: 'token',
+ label: 'API Key',
+ type: 'password',
+ defaultValue: '',
+ },
+ ];
+
+ // Handle field value changes for a specific server
+ const handleFieldChange = (index, name, value) => {
+ handleMCPServerChange(index, name, value);
+ };
+
return (
MCP Servers
@@ -30,28 +53,12 @@ const MCPServersSection = ({
-
-
- handleMCPServerChange(index, 'url', e.target.value)}
- className="form-control"
- placeholder="https://example.com/mcp"
- />
-
-
-
-
- handleMCPServerChange(index, 'token', e.target.value)}
- className="form-control"
- />
-
+ handleFieldChange(index, name, value)}
+ idPrefix={`mcp_server_${index}_`}
+ />
))}
diff --git a/webui/react-ui/src/components/agent-form-sections/MemorySettingsSection.jsx b/webui/react-ui/src/components/agent-form-sections/MemorySettingsSection.jsx
index 51b4e64..2ee2b9e 100644
--- a/webui/react-ui/src/components/agent-form-sections/MemorySettingsSection.jsx
+++ b/webui/react-ui/src/components/agent-form-sections/MemorySettingsSection.jsx
@@ -1,68 +1,67 @@
import React from 'react';
+import FormFieldDefinition from '../common/FormFieldDefinition';
/**
* Memory Settings section of the agent form
*/
const MemorySettingsSection = ({ formData, handleInputChange }) => {
+ // Define field definitions for Memory Settings section
+ const fields = [
+ {
+ name: 'memory_provider',
+ label: 'Memory Provider',
+ type: 'select',
+ defaultValue: 'local',
+ options: [
+ { value: 'local', label: 'Local' },
+ { value: 'redis', label: 'Redis' },
+ { value: 'postgres', label: 'PostgreSQL' },
+ ],
+ },
+ {
+ name: 'memory_collection',
+ label: 'Memory Collection',
+ type: 'text',
+ defaultValue: '',
+ placeholder: 'agent_memories',
+ },
+ {
+ name: 'memory_url',
+ label: 'Memory URL',
+ type: 'text',
+ defaultValue: '',
+ placeholder: 'redis://localhost:6379',
+ helpText: 'Connection URL for Redis or PostgreSQL',
+ },
+ {
+ name: 'memory_window_size',
+ label: 'Memory Window Size',
+ type: 'number',
+ defaultValue: 10,
+ helpText: 'Number of recent messages to include in context window',
+ },
+ ];
+
+ // Handle field value changes
+ const handleFieldChange = (name, value) => {
+ handleInputChange({
+ target: {
+ name,
+ value
+ }
+ });
+ };
+
return (
Memory Settings
-
-
-
-
-
-
-
-
-
-
-
-
-
- Connection URL for Redis or PostgreSQL
-
-
-
-
-
- Number of recent messages to include in context window
-
+
);
};
diff --git a/webui/react-ui/src/components/agent-form-sections/ModelSettingsSection.jsx b/webui/react-ui/src/components/agent-form-sections/ModelSettingsSection.jsx
index feaa8cb..550dc77 100644
--- a/webui/react-ui/src/components/agent-form-sections/ModelSettingsSection.jsx
+++ b/webui/react-ui/src/components/agent-form-sections/ModelSettingsSection.jsx
@@ -1,82 +1,74 @@
import React from 'react';
+import FormFieldDefinition from '../common/FormFieldDefinition';
/**
* Model Settings section of the agent form
*/
const ModelSettingsSection = ({ formData, handleInputChange }) => {
+ // Define field definitions for Model Settings section
+ const fields = [
+ {
+ name: 'model',
+ label: 'Model',
+ type: 'text',
+ defaultValue: '',
+ },
+ {
+ name: 'multimodal_model',
+ label: 'Multimodal Model',
+ type: 'text',
+ defaultValue: '',
+ },
+ {
+ name: 'api_url',
+ label: 'API URL',
+ type: 'text',
+ defaultValue: '',
+ },
+ {
+ name: 'api_key',
+ label: 'API Key',
+ type: 'password',
+ defaultValue: '',
+ },
+ {
+ name: 'temperature',
+ label: 'Temperature',
+ type: 'number',
+ defaultValue: 0.7,
+ min: 0,
+ max: 2,
+ step: 0.1,
+ },
+ {
+ name: 'max_tokens',
+ label: 'Max Tokens',
+ type: 'number',
+ defaultValue: 2000,
+ min: 1,
+ },
+ ];
+
+ // Handle field value changes
+ const handleFieldChange = (name, value) => {
+ handleInputChange({
+ target: {
+ name,
+ value
+ }
+ });
+ };
+
return (
);
};
diff --git a/webui/react-ui/src/components/agent-form-sections/PromptsGoalsSection.jsx b/webui/react-ui/src/components/agent-form-sections/PromptsGoalsSection.jsx
index 82214b0..7b65aa8 100644
--- a/webui/react-ui/src/components/agent-form-sections/PromptsGoalsSection.jsx
+++ b/webui/react-ui/src/components/agent-form-sections/PromptsGoalsSection.jsx
@@ -1,67 +1,78 @@
import React from 'react';
+import FormFieldDefinition from '../common/FormFieldDefinition';
/**
* Prompts & Goals section of the agent form
*/
const PromptsGoalsSection = ({ formData, handleInputChange, isGroupForm }) => {
- // In group form context, we hide the system prompt as it comes from each agent profile
+ // Define field definitions for Prompts & Goals section
+ const getFields = () => {
+ // Base fields that are always shown
+ const baseFields = [
+ {
+ name: 'goals',
+ label: 'Goals',
+ type: 'textarea',
+ defaultValue: '',
+ helpText: 'Define the agent\'s goals (one per line)',
+ rows: 5,
+ },
+ {
+ name: 'constraints',
+ label: 'Constraints',
+ type: 'textarea',
+ defaultValue: '',
+ helpText: 'Define the agent\'s constraints (one per line)',
+ rows: 5,
+ },
+ {
+ name: 'tools',
+ label: 'Tools',
+ type: 'textarea',
+ defaultValue: '',
+ helpText: 'Define the agent\'s tools (one per line)',
+ rows: 5,
+ },
+ ];
+
+ // Only include system_prompt field if not in group form context
+ if (!isGroupForm) {
+ return [
+ {
+ name: 'system_prompt',
+ label: 'System Prompt',
+ type: 'textarea',
+ defaultValue: '',
+ helpText: 'Instructions that define the agent\'s behavior',
+ rows: 5,
+ },
+ ...baseFields
+ ];
+ }
+
+ return baseFields;
+ };
+
+ // Handle field value changes
+ const handleFieldChange = (name, value) => {
+ handleInputChange({
+ target: {
+ name,
+ value
+ }
+ });
+ };
+
return (
Prompts & Goals
- {!isGroupForm && (
-
-
-
- Instructions that define the agent's behavior
-
- )}
-
-
-
-
- Define the agent's goals (one per line)
-
-
-
-
-
- Define the agent's constraints (one per line)
-
-
-
-
-
- Define the agent's tools (one per line)
-
+
);
};
diff --git a/webui/react-ui/src/components/common/FormField.jsx b/webui/react-ui/src/components/common/FormField.jsx
index 6f9e821..f3b44b9 100644
--- a/webui/react-ui/src/components/common/FormField.jsx
+++ b/webui/react-ui/src/components/common/FormField.jsx
@@ -81,6 +81,7 @@ const FormField = ({
className="form-control"
placeholder={placeholder}
required={required}
+ rows={5}
/>
{helpText && {helpText}}
>
diff --git a/webui/react-ui/src/components/common/FormFieldDefinition.jsx b/webui/react-ui/src/components/common/FormFieldDefinition.jsx
index e558976..5a32498 100644
--- a/webui/react-ui/src/components/common/FormFieldDefinition.jsx
+++ b/webui/react-ui/src/components/common/FormFieldDefinition.jsx
@@ -22,18 +22,19 @@ const FormFieldDefinition = ({
return (
{fields.map((field) => (
-
onChange(field.name, value)}
- placeholder={field.placeholder || ''}
- helpText={field.helpText || ''}
- options={field.options || []}
- required={field.required || false}
- />
+
+ onChange(field.name, value)}
+ placeholder={field.placeholder || ''}
+ helpText={field.helpText || ''}
+ options={field.options || []}
+ required={field.required || false}
+ />
+
))}
);