Revert "Attach to ui"
This reverts commit 088d0c47e87ee8f84297e47d178fb7384bbe6d45. Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
@@ -72,7 +72,6 @@ type AgentConfigMeta struct {
|
|||||||
Actions []config.FieldGroup
|
Actions []config.FieldGroup
|
||||||
DynamicPrompts []config.FieldGroup
|
DynamicPrompts []config.FieldGroup
|
||||||
MCPServers []config.Field
|
MCPServers []config.Field
|
||||||
MCPSTDIOServers []config.Field
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAgentConfigMeta(
|
func NewAgentConfigMeta(
|
||||||
@@ -289,28 +288,6 @@ func NewAgentConfigMeta(
|
|||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
MCPSTDIOServers: []config.Field{
|
|
||||||
{
|
|
||||||
Name: "cmd",
|
|
||||||
Label: "Command",
|
|
||||||
Type: config.FieldTypeText,
|
|
||||||
Required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "args",
|
|
||||||
Label: "Arguments",
|
|
||||||
Type: config.FieldTypeText,
|
|
||||||
Required: true,
|
|
||||||
HelpText: "Comma-separated list of arguments",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "env",
|
|
||||||
Label: "Environment Variables",
|
|
||||||
Type: config.FieldTypeText,
|
|
||||||
Required: true,
|
|
||||||
HelpText: "Comma-separated list of environment variables in KEY=VALUE format",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
DynamicPrompts: dynamicPromptsConfig,
|
DynamicPrompts: dynamicPromptsConfig,
|
||||||
Connectors: connectorsConfig,
|
Connectors: connectorsConfig,
|
||||||
Actions: actionsConfig,
|
Actions: actionsConfig,
|
||||||
|
|||||||
@@ -157,40 +157,6 @@ const AgentForm = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle adding an MCP STDIO server
|
|
||||||
const handleAddMCPSTDIOServer = () => {
|
|
||||||
setFormData({
|
|
||||||
...formData,
|
|
||||||
mcp_stdio_servers: [
|
|
||||||
...(formData.mcp_stdio_servers || []),
|
|
||||||
{ cmd: '', args: [], env: [] }
|
|
||||||
]
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Handle removing an MCP STDIO server
|
|
||||||
const handleRemoveMCPSTDIOServer = (index) => {
|
|
||||||
const updatedSTDIOServers = [...formData.mcp_stdio_servers];
|
|
||||||
updatedSTDIOServers.splice(index, 1);
|
|
||||||
setFormData({
|
|
||||||
...formData,
|
|
||||||
mcp_stdio_servers: updatedSTDIOServers
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Handle MCP STDIO server change
|
|
||||||
const handleMCPSTDIOServerChange = (index, field, value) => {
|
|
||||||
const updatedSTDIOServers = [...formData.mcp_stdio_servers];
|
|
||||||
updatedSTDIOServers[index] = {
|
|
||||||
...updatedSTDIOServers[index],
|
|
||||||
[field]: value
|
|
||||||
};
|
|
||||||
setFormData({
|
|
||||||
...formData,
|
|
||||||
mcp_stdio_servers: updatedSTDIOServers
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <div className="loading">Loading...</div>;
|
return <div className="loading">Loading...</div>;
|
||||||
}
|
}
|
||||||
@@ -294,15 +260,7 @@ const AgentForm = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: activeSection === 'mcp-section' ? 'block' : 'none' }}>
|
<div style={{ display: activeSection === 'mcp-section' ? 'block' : 'none' }}>
|
||||||
<MCPServersSection
|
<MCPServersSection formData={formData} handleAddMCPServer={handleAddMCPServer} handleRemoveMCPServer={handleRemoveMCPServer} handleMCPServerChange={handleMCPServerChange} />
|
||||||
formData={formData}
|
|
||||||
handleAddMCPServer={handleAddMCPServer}
|
|
||||||
handleRemoveMCPServer={handleRemoveMCPServer}
|
|
||||||
handleMCPServerChange={handleMCPServerChange}
|
|
||||||
handleAddMCPSTDIOServer={handleAddMCPSTDIOServer}
|
|
||||||
handleRemoveMCPSTDIOServer={handleRemoveMCPSTDIOServer}
|
|
||||||
handleMCPSTDIOServerChange={handleMCPSTDIOServerChange}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: activeSection === 'memory-section' ? 'block' : 'none' }}>
|
<div style={{ display: activeSection === 'memory-section' ? 'block' : 'none' }}>
|
||||||
@@ -353,15 +311,7 @@ const AgentForm = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: activeSection === 'mcp-section' ? 'block' : 'none' }}>
|
<div style={{ display: activeSection === 'mcp-section' ? 'block' : 'none' }}>
|
||||||
<MCPServersSection
|
<MCPServersSection formData={formData} handleAddMCPServer={handleAddMCPServer} handleRemoveMCPServer={handleRemoveMCPServer} handleMCPServerChange={handleMCPServerChange} />
|
||||||
formData={formData}
|
|
||||||
handleAddMCPServer={handleAddMCPServer}
|
|
||||||
handleRemoveMCPServer={handleRemoveMCPServer}
|
|
||||||
handleMCPServerChange={handleMCPServerChange}
|
|
||||||
handleAddMCPSTDIOServer={handleAddMCPSTDIOServer}
|
|
||||||
handleRemoveMCPSTDIOServer={handleRemoveMCPSTDIOServer}
|
|
||||||
handleMCPSTDIOServerChange={handleMCPSTDIOServerChange}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: activeSection === 'memory-section' ? 'block' : 'none' }}>
|
<div style={{ display: activeSection === 'memory-section' ? 'block' : 'none' }}>
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ const MCPServersSection = ({
|
|||||||
formData,
|
formData,
|
||||||
handleAddMCPServer,
|
handleAddMCPServer,
|
||||||
handleRemoveMCPServer,
|
handleRemoveMCPServer,
|
||||||
handleMCPServerChange,
|
handleMCPServerChange
|
||||||
handleAddMCPSTDIOServer,
|
|
||||||
handleRemoveMCPSTDIOServer,
|
|
||||||
handleMCPSTDIOServerChange
|
|
||||||
}) => {
|
}) => {
|
||||||
// Define field definitions for each MCP server
|
// Define field definitions for each MCP server
|
||||||
const getServerFields = () => [
|
const getServerFields = () => [
|
||||||
@@ -30,55 +27,14 @@ const MCPServersSection = ({
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// Define field definitions for each MCP STDIO server
|
|
||||||
const getSTDIOServerFields = () => [
|
|
||||||
{
|
|
||||||
name: 'cmd',
|
|
||||||
label: 'Command',
|
|
||||||
type: 'text',
|
|
||||||
defaultValue: '',
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'args',
|
|
||||||
label: 'Arguments',
|
|
||||||
type: 'text',
|
|
||||||
defaultValue: '',
|
|
||||||
required: true,
|
|
||||||
helpText: 'Comma-separated list of arguments',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'env',
|
|
||||||
label: 'Environment Variables',
|
|
||||||
type: 'text',
|
|
||||||
defaultValue: '',
|
|
||||||
required: true,
|
|
||||||
helpText: 'Comma-separated list of environment variables in KEY=VALUE format',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// Handle field value changes for a specific server
|
// Handle field value changes for a specific server
|
||||||
const handleFieldChange = (index, e, isStdio = false) => {
|
const handleFieldChange = (index, e) => {
|
||||||
const { name, value, type, checked } = e.target;
|
const { name, value, type, checked } = e.target;
|
||||||
|
|
||||||
// Convert value to number if it's a number input
|
// Convert value to number if it's a number input
|
||||||
const processedValue = type === 'number' ? Number(value) : value;
|
const processedValue = type === 'number' ? Number(value) : value;
|
||||||
|
|
||||||
// Handle comma-separated values for args and env
|
|
||||||
if (name === 'args' || name === 'env') {
|
|
||||||
const values = value.split(',').map(v => v.trim()).filter(v => v);
|
|
||||||
if (isStdio) {
|
|
||||||
handleMCPSTDIOServerChange(index, name, values);
|
|
||||||
} else {
|
|
||||||
handleMCPServerChange(index, name, values);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (isStdio) {
|
|
||||||
handleMCPSTDIOServerChange(index, name, type === 'checkbox' ? checked : processedValue);
|
|
||||||
} else {
|
|
||||||
handleMCPServerChange(index, name, type === 'checkbox' ? checked : processedValue);
|
handleMCPServerChange(index, name, type === 'checkbox' ? checked : processedValue);
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -119,43 +75,6 @@ const MCPServersSection = ({
|
|||||||
<i className="fas fa-plus"></i> Add MCP Server
|
<i className="fas fa-plus"></i> Add MCP Server
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 className="section-title mt-4">MCP STDIO Servers</h3>
|
|
||||||
<p className="section-description">
|
|
||||||
Configure MCP STDIO servers for this agent.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div className="mcp-stdio-servers-container">
|
|
||||||
{formData.mcp_stdio_servers && formData.mcp_stdio_servers.map((server, index) => (
|
|
||||||
<div key={index} className="mcp-stdio-server-item mb-4">
|
|
||||||
<div className="mcp-stdio-server-header">
|
|
||||||
<h4>MCP STDIO Server #{index + 1}</h4>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="action-btn delete-btn"
|
|
||||||
onClick={() => handleRemoveMCPSTDIOServer(index)}
|
|
||||||
>
|
|
||||||
<i className="fas fa-times"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<FormFieldDefinition
|
|
||||||
fields={getSTDIOServerFields()}
|
|
||||||
values={server}
|
|
||||||
onChange={(e) => handleFieldChange(index, e, true)}
|
|
||||||
idPrefix={`mcp_stdio_server_${index}_`}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="action-btn"
|
|
||||||
onClick={handleAddMCPSTDIOServer}
|
|
||||||
>
|
|
||||||
<i className="fas fa-plus"></i> Add MCP STDIO Server
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user