chore(ui): Move some field definitions server side
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/mudler/LocalAgent/core/agent"
|
||||
"github.com/mudler/LocalAgent/core/types"
|
||||
"github.com/mudler/LocalAgent/pkg/config"
|
||||
)
|
||||
|
||||
type ConnectorConfig struct {
|
||||
@@ -35,7 +36,7 @@ type AgentConfig struct {
|
||||
MCPServers []agent.MCPServer `json:"mcp_servers" form:"mcp_servers"`
|
||||
|
||||
Description string `json:"description" form:"description"`
|
||||
// This is what needs to be part of ActionsConfig
|
||||
|
||||
Model string `json:"model" form:"model"`
|
||||
MultimodalModel string `json:"multimodal_model" form:"multimodal_model"`
|
||||
APIURL string `json:"api_url" form:"api_url"`
|
||||
@@ -61,6 +62,211 @@ type AgentConfig struct {
|
||||
SummaryLongTermMemory bool `json:"summary_long_term_memory" form:"summary_long_term_memory"`
|
||||
}
|
||||
|
||||
type AgentConfigMeta struct {
|
||||
Fields []config.Field
|
||||
Connectors []config.FieldGroup
|
||||
Actions []config.FieldGroup
|
||||
PromptBlocks []config.Field
|
||||
MCPServers []config.Field
|
||||
}
|
||||
|
||||
func NewAgentConfigMeta(actionsConfig []config.FieldGroup, connectorsConfig []config.FieldGroup) AgentConfigMeta {
|
||||
return AgentConfigMeta{
|
||||
Fields: []config.Field{
|
||||
{
|
||||
Name: "name",
|
||||
Label: "Name",
|
||||
Type: "text",
|
||||
DefaultValue: "",
|
||||
Required: true,
|
||||
Tags: config.Tags{Section: "BasicInfo"},
|
||||
},
|
||||
{
|
||||
Name: "description",
|
||||
Label: "Description",
|
||||
Type: "textarea",
|
||||
DefaultValue: "",
|
||||
Tags: config.Tags{Section: "BasicInfo"},
|
||||
},
|
||||
{
|
||||
Name: "identity_guidance",
|
||||
Label: "Identity Guidance",
|
||||
Type: "textarea",
|
||||
DefaultValue: "",
|
||||
Tags: config.Tags{Section: "BasicInfo"},
|
||||
},
|
||||
{
|
||||
Name: "random_identity",
|
||||
Label: "Random Identity",
|
||||
Type: "checkbox",
|
||||
DefaultValue: false,
|
||||
Tags: config.Tags{Section: "BasicInfo"},
|
||||
},
|
||||
{
|
||||
Name: "hud",
|
||||
Label: "HUD",
|
||||
Type: "checkbox",
|
||||
DefaultValue: false,
|
||||
Tags: config.Tags{Section: "BasicInfo"},
|
||||
},
|
||||
{
|
||||
Name: "model",
|
||||
Label: "Model",
|
||||
Type: "text",
|
||||
DefaultValue: "",
|
||||
Tags: config.Tags{Section: "ModelSettings"},
|
||||
},
|
||||
{
|
||||
Name: "multimodal_model",
|
||||
Label: "Multimodal Model",
|
||||
Type: "text",
|
||||
DefaultValue: "",
|
||||
Tags: config.Tags{Section: "ModelSettings"},
|
||||
},
|
||||
{
|
||||
Name: "api_url",
|
||||
Label: "API URL",
|
||||
Type: "text",
|
||||
DefaultValue: "",
|
||||
Tags: config.Tags{Section: "ModelSettings"},
|
||||
},
|
||||
{
|
||||
Name: "api_key",
|
||||
Label: "API Key",
|
||||
Type: "password",
|
||||
DefaultValue: "",
|
||||
Tags: config.Tags{Section: "ModelSettings"},
|
||||
},
|
||||
{
|
||||
Name: "local_rag_url",
|
||||
Label: "Local RAG URL",
|
||||
Type: "text",
|
||||
DefaultValue: "",
|
||||
Tags: config.Tags{Section: "ModelSettings"},
|
||||
},
|
||||
{
|
||||
Name: "local_rag_api_key",
|
||||
Label: "Local RAG API Key",
|
||||
Type: "password",
|
||||
DefaultValue: "",
|
||||
Tags: config.Tags{Section: "ModelSettings"},
|
||||
},
|
||||
{
|
||||
Name: "enable_kb",
|
||||
Label: "Enable Knowledge Base",
|
||||
Type: "checkbox",
|
||||
DefaultValue: false,
|
||||
Tags: config.Tags{Section: "MemorySettings"},
|
||||
},
|
||||
{
|
||||
Name: "kb_results",
|
||||
Label: "Knowledge Base Results",
|
||||
Type: "number",
|
||||
DefaultValue: 5,
|
||||
Min: 1,
|
||||
Step: 1,
|
||||
Tags: config.Tags{Section: "MemorySettings"},
|
||||
},
|
||||
{
|
||||
Name: "long_term_memory",
|
||||
Label: "Long Term Memory",
|
||||
Type: "checkbox",
|
||||
DefaultValue: false,
|
||||
Tags: config.Tags{Section: "MemorySettings"},
|
||||
},
|
||||
{
|
||||
Name: "summary_long_term_memory",
|
||||
Label: "Summary Long Term Memory",
|
||||
Type: "checkbox",
|
||||
DefaultValue: false,
|
||||
Tags: config.Tags{Section: "MemorySettings"},
|
||||
},
|
||||
{
|
||||
Name: "system_prompt",
|
||||
Label: "System Prompt",
|
||||
Type: "textarea",
|
||||
DefaultValue: "",
|
||||
HelpText: "Instructions that define the agent's behavior and capabilities",
|
||||
Tags: config.Tags{Section: "PromptsGoals"},
|
||||
},
|
||||
{
|
||||
Name: "permanent_goal",
|
||||
Label: "Permanent Goal",
|
||||
Type: "textarea",
|
||||
DefaultValue: "",
|
||||
HelpText: "Long-term objective for the agent to pursue",
|
||||
Tags: config.Tags{Section: "PromptsGoals"},
|
||||
},
|
||||
{
|
||||
Name: "standalone_job",
|
||||
Label: "Standalone Job",
|
||||
Type: "checkbox",
|
||||
DefaultValue: false,
|
||||
HelpText: "Run as a standalone job without user interaction",
|
||||
Tags: config.Tags{Section: "AdvancedSettings"},
|
||||
},
|
||||
{
|
||||
Name: "initiate_conversations",
|
||||
Label: "Initiate Conversations",
|
||||
Type: "checkbox",
|
||||
DefaultValue: false,
|
||||
HelpText: "Allow agent to start conversations on its own",
|
||||
Tags: config.Tags{Section: "AdvancedSettings"},
|
||||
},
|
||||
{
|
||||
Name: "enable_planning",
|
||||
Label: "Enable Planning",
|
||||
Type: "checkbox",
|
||||
DefaultValue: false,
|
||||
HelpText: "Enable agent to create and execute plans",
|
||||
Tags: config.Tags{Section: "AdvancedSettings"},
|
||||
},
|
||||
{
|
||||
Name: "can_stop_itself",
|
||||
Label: "Can Stop Itself",
|
||||
Type: "checkbox",
|
||||
DefaultValue: false,
|
||||
HelpText: "Allow agent to terminate its own execution",
|
||||
Tags: config.Tags{Section: "AdvancedSettings"},
|
||||
},
|
||||
{
|
||||
Name: "periodic_runs",
|
||||
Label: "Periodic Runs",
|
||||
Type: "text",
|
||||
DefaultValue: "",
|
||||
Placeholder: "10m",
|
||||
HelpText: "Duration for scheduling periodic agent runs",
|
||||
Tags: config.Tags{Section: "AdvancedSettings"},
|
||||
},
|
||||
{
|
||||
Name: "enable_reasoning",
|
||||
Label: "Enable Reasoning",
|
||||
Type: "checkbox",
|
||||
DefaultValue: false,
|
||||
HelpText: "Enable agent to explain its reasoning process",
|
||||
Tags: config.Tags{Section: "AdvancedSettings"},
|
||||
},
|
||||
},
|
||||
MCPServers: []config.Field{
|
||||
{
|
||||
Name: "url",
|
||||
Label: "URL",
|
||||
Type: config.FieldTypeText,
|
||||
Required: true,
|
||||
},
|
||||
{
|
||||
Name: "token",
|
||||
Label: "API Key",
|
||||
Type: config.FieldTypeText,
|
||||
Required: true,
|
||||
},
|
||||
},
|
||||
PromptBlocks: []config.Field{},
|
||||
Connectors: connectorsConfig,
|
||||
Actions: actionsConfig,
|
||||
}
|
||||
}
|
||||
|
||||
type Connector interface {
|
||||
AgentResultCallback() func(state types.ActionState)
|
||||
AgentReasoningCallback() func(state types.ActionCurrentState) bool
|
||||
|
||||
Reference in New Issue
Block a user