enhance update form

Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
mudler
2025-03-17 16:13:03 +01:00
parent 3c3b5a774c
commit 29a8713427
5 changed files with 681 additions and 184 deletions

View File

@@ -3,6 +3,8 @@
<head>
<title>Create New Agent</title>
{{template "views/partials/header"}}
<script src="/public/js/wizard.js"></script>
<link rel="stylesheet" href="/public/css/wizard.css">
<script src="/public/js/agent-form.js"></script>
</head>
<body>

View File

@@ -1,173 +1,272 @@
<div class="mb-4">
<label for="name">Name</label>
{{ if .Name }}
<input type="text" name="name" id="name" placeholder="Name" value="{{.Name}}" readonly >
{{ else }}
<input type="text" name="name" id="name" placeholder="Name">
{{ end }}
<div class="agent-form-container">
<!-- Wizard Sidebar -->
<div class="wizard-sidebar">
<ul class="wizard-nav">
<li class="wizard-nav-item active" data-target="basic-section">
<i class="fas fa-info-circle"></i> Basic Information
</li>
<li class="wizard-nav-item" data-target="connectors-section">
<i class="fas fa-plug"></i> Connectors
</li>
<li class="wizard-nav-item" data-target="actions-section">
<i class="fas fa-bolt"></i> Actions
</li>
<li class="wizard-nav-item" data-target="mcp-section">
<i class="fas fa-server"></i> MCP Servers
</li>
<li class="wizard-nav-item" data-target="memory-section">
<i class="fas fa-memory"></i> Memory Settings
</li>
<li class="wizard-nav-item" data-target="model-section">
<i class="fas fa-robot"></i> Model Settings
</li>
<li class="wizard-nav-item" data-target="prompts-section">
<i class="fas fa-comment-alt"></i> Prompts & Goals
</li>
<li class="wizard-nav-item" data-target="advanced-section">
<i class="fas fa-cogs"></i> Advanced Settings
</li>
</ul>
</div>
<!-- Form Content Area -->
<div class="form-content-area">
<!-- Basic Information Section -->
<div class="form-section active" id="basic-section">
<h3 class="section-title">Basic Information</h3>
<div class="mb-4">
<label for="name">Name</label>
{{ if .Name }}
<input type="text" name="name" id="name" placeholder="Name" value="{{.Name}}" readonly >
{{ else }}
<input type="text" name="name" id="name" placeholder="Name">
{{ end }}
</div>
<div class="mb-4">
<label for="identity_guidance">Identity Guidance</label>
<textarea name="identity_guidance" id="identity_guidance" placeholder="Identity Guidance"></textarea>
</div>
<div class="mb-4">
<label for="random_identity" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="random_identity" id="random_identity">
<span class="checkmark"></span>
</span>
Random Identity
</label>
</div>
<div class="mb-4">
<label for="hud" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="hud" id="hud">
<span class="checkmark"></span>
</span>
HUD
</label>
</div>
</div>
<!-- Connectors Section -->
<div class="form-section" id="connectors-section">
<h3 class="section-title">Connectors</h3>
<div id="connectorsSection">
<!-- Connectors will be added here dynamically -->
</div>
<div class="button-container">
<button type="button" id="addConnectorButton" class="action-btn">
<i class="fas fa-plus-circle"></i> Add Connector
</button>
</div>
</div>
<!-- Actions Section -->
<div class="form-section" id="actions-section">
<h3 class="section-title">Actions</h3>
<div class="mb-4" id="action_box">
<!-- Actions will be added here dynamically -->
</div>
<div class="button-container">
<button id="action_button" type="button" class="action-btn">
<i class="fas fa-plus-circle"></i> Add Action
</button>
</div>
</div>
<!-- MCP Servers Section -->
<div class="form-section" id="mcp-section">
<h3 class="section-title">MCP Servers</h3>
<div id="mcpSection">
<!-- MCP servers will be added here dynamically -->
</div>
<div class="button-container">
<button type="button" id="addMCPButton" class="action-btn">
<i class="fas fa-plus-circle"></i> Add MCP Server
</button>
</div>
</div>
<!-- Memory Settings Section -->
<div class="form-section" id="memory-section">
<h3 class="section-title">Memory Settings</h3>
<div class="mb-4">
<label for="enable_kb" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="enable_kb" id="enable_kb">
<span class="checkmark"></span>
</span>
Enable Knowledge Base
</label>
</div>
<div class="mb-4">
<label for="kb_results">Knowledge Base Results</label>
<input type="number" name="kb_results" id="kb_results" placeholder="3">
</div>
<div class="mb-4">
<label for="long_term_memory" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="long_term_memory" id="long_term_memory">
<span class="checkmark"></span>
</span>
Long Term Memory
</label>
</div>
<div class="mb-4">
<label for="summary_long_term_memory" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="summary_long_term_memory" id="summary_long_term_memory">
<span class="checkmark"></span>
</span>
Long Term Memory (Summarize!)
</label>
</div>
</div>
<!-- Model Settings Section -->
<div class="form-section" id="model-section">
<h3 class="section-title">Model Settings</h3>
<div class="mb-4">
<label for="model">Model </label>
<input type="text" name="model" id="model" placeholder="Model name">
</div>
<div class="mb-4">
<label for="multimodal_model">Multimodal Model </label>
<input type="text" name="multimodal_model" id="multimodal_model" placeholder="Model name">
</div>
<div class="mb-4">
<label for="enable_reasoning" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="enable_reasoning" id="enable_reasoning">
<span class="checkmark"></span>
</span>
Enable Reasoning
</label>
</div>
</div>
<!-- Prompts & Goals Section -->
<div class="form-section" id="prompts-section">
<h3 class="section-title">Prompts & Goals</h3>
<div class="mb-4" id="dynamic_box">
<!-- Dynamic prompts will be added here dynamically -->
</div>
<div class="button-container">
<button id="dynamic_button" type="button" class="action-btn">
<i class="fas fa-plus-circle"></i> Add Dynamic Prompt
</button>
</div>
<div class="mb-4">
<label for="system_prompt">System Prompt</label>
<textarea name="system_prompt" id="system_prompt" placeholder="System prompt"></textarea>
</div>
<div class="mb-4">
<label for="permanent_goal">Permanent Goal</label>
<textarea name="permanent_goal" id="permanent_goal" placeholder="Permanent goal"></textarea>
</div>
</div>
<!-- Advanced Settings Section -->
<div class="form-section" id="advanced-section">
<h3 class="section-title">Advanced Settings</h3>
<div class="mb-4">
<label for="standalone_job" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="standalone_job" id="standalone_job">
<span class="checkmark"></span>
</span>
Standalone Job
</label>
</div>
<div class="mb-4">
<label for="initiate_conversations" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="initiate_conversations" id="initiate_conversations">
<span class="checkmark"></span>
</span>
Initiate Conversations
</label>
</div>
<div class="mb-4">
<label for="can_stop_itself" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="can_stop_itself" id="can_stop_itself">
<span class="checkmark"></span>
</span>
Can Stop Itself
</label>
</div>
<div class="mb-4">
<label for="periodic_runs">Periodic Runs</label>
<input type="text" name="periodic_runs" id="periodic_runs" placeholder="Periodic Runs">
</div>
</div>
</div>
</div>
<div id="connectorsSection">
<!-- Connectors will be added here dynamically -->
</div>
<div class="button-container">
<button type="button" id="addConnectorButton" class="action-btn">
<i class="fas fa-plus-circle"></i> Add Connector
</button>
</div>
<div class="mb-4" id="action_box">
<!-- Actions will be added here dynamically -->
</div>
<div class="button-container">
<button id="action_button" type="button" class="action-btn">
<i class="fas fa-plus-circle"></i> Add Action
</button>
</div>
<div id="mcpSection">
<!-- MCP servers will be added here dynamically -->
</div>
<div class="button-container">
<button type="button" id="addMCPButton" class="action-btn">
<i class="fas fa-plus-circle"></i> Add MCP Server
</button>
</div>
<div class="mb-4" id="dynamic_box">
<!-- Dynamic prompts will be added here dynamically -->
</div>
<div class="button-container">
<button id="dynamic_button" type="button" class="action-btn">
<i class="fas fa-plus-circle"></i> Add Dynamic Prompt
</button>
</div>
<div class="mb-4">
<label for="hud" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="hud" id="hud">
<span class="checkmark"></span>
</span>
HUD
</label>
</div>
<div class="mb-4">
<label for="enable_kb" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="enable_kb" id="enable_kb">
<span class="checkmark"></span>
</span>
Enable Knowledge Base
</label>
</div>
<div class="mb-4">
<label for="enable_reasoning" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="enable_reasoning" id="enable_reasoning">
<span class="checkmark"></span>
</span>
Enable Reasoning
</label>
</div>
<div class="mb-4">
<label for="kb_results">Knowledge Base Results</label>
<input type="number" name="kb_results" id="kb_results" placeholder="3">
</div>
<div class="mb-4">
<label for="standalone_job" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="standalone_job" id="standalone_job">
<span class="checkmark"></span>
</span>
Standalone Job
</label>
</div>
<div class="mb-4">
<label for="initiate_conversations" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="initiate_conversations" id="initiate_conversations">
<span class="checkmark"></span>
</span>
Initiate Conversations
</label>
</div>
<div class="mb-4">
<label for="can_stop_itself" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="can_stop_itself" id="can_stop_itself">
<span class="checkmark"></span>
</span>
Can Stop Itself
</label>
</div>
<div class="mb-4">
<label for="random_identity" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="random_identity" id="random_identity">
<span class="checkmark"></span>
</span>
Random Identity
</label>
</div>
<div class="mb-4">
<label for="long_term_memory" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="long_term_memory" id="long_term_memory">
<span class="checkmark"></span>
</span>
Long Term Memory
</label>
</div>
<div class="mb-4">
<label for="summary_long_term_memory" class="checkbox-label">
<span class="checkbox-custom">
<input type="checkbox" name="summary_long_term_memory" id="summary_long_term_memory">
<span class="checkmark"></span>
</span>
Long Term Memory (Summarize!)
</label>
</div>
<div class="mb-4">
<label for="identity_guidance">Identity Guidance</label>
<textarea name="identity_guidance" id="identity_guidance" placeholder="Identity Guidance"></textarea>
</div>
<div class="mb-4">
<label for="periodic_runs">Periodic Runs</label>
<input type="text" name="periodic_runs" id="periodic_runs" placeholder="Periodic Runs">
</div>
<div class="mb-4">
<label for="model">Model </label>
<input type="text" name="model" id="model" placeholder="Model name">
</div>
<div class="mb-4">
<label for="multimodal_model">Multimodal Model </label>
<input type="text" name="multimodal_model" id="multimodal_model" placeholder="Model name">
</div>
<div class="mb-4">
<label for="permanent_goal">Permanent Goal</label>
<textarea name="permanent_goal" id="permanent_goal" placeholder="Permanent goal"></textarea>
</div>
<div class="mb-4">
<label for="system_prompt">System Prompt</label>
<textarea name="system_prompt" id="system_prompt" placeholder="System prompt"></textarea>
<!-- Add navigation controls at the bottom -->
<div class="wizard-controls">
<div class="wizard-controls-left">
<button type="button" id="prevSection" class="nav-btn">
<i class="fas fa-arrow-left"></i> Previous
</button>
</div>
<div class="wizard-controls-center">
<div class="progress-dots" id="progressDots">
<!-- Dots will be added dynamically via JS -->
</div>
<div class="progress-indicator">
<span id="currentStepLabel">Basic Information</span>
</div>
</div>
<div class="wizard-controls-right">
<button type="button" id="nextSection" class="nav-btn">
Next <i class="fas fa-arrow-right"></i>
</button>
</div>
</div>

View File

@@ -3,6 +3,8 @@
<head>
<title>Agent settings {{.Name}}</title>
{{template "views/partials/header"}}
<script src="/public/js/wizard.js"></script>
<link rel="stylesheet" href="/public/css/wizard.css">
<script src="/public/js/agent-form.js"></script>
</head>
<body>
@@ -19,6 +21,21 @@
</header>
<div class="max-w-4xl mx-auto">
<!-- Agent Configuration Form Section -->
<div class="section-box">
<h2>Edit Agent Configuration</h2>
<form id="edit-agent-form">
<input type="hidden" name="name" id="name" value="{{.Name}}">
{{template "views/partials/agent-form" .}}
<button type="submit" id="update-button" class="action-btn" data-original-text="<i class='fas fa-save'></i> Update Agent">
<i class="fas fa-save"></i> Update Agent
</button>
</form>
</div>
<div class="section-box">
<h2>Agent Control</h2>
<div class="button-container">
@@ -35,20 +52,6 @@
</div>
</div>
<!-- Agent Configuration Form Section -->
<div class="section-box">
<h2>Edit Agent Configuration</h2>
<form id="edit-agent-form">
<input type="hidden" name="name" id="name" value="{{.Name}}">
{{template "views/partials/agent-form" .}}
<button type="submit" id="update-button" class="action-btn" data-original-text="<i class='fas fa-save'></i> Update Agent">
<i class="fas fa-save"></i> Update Agent
</button>
</form>
</div>
<div class="section-box">
<h2>Export Data</h2>
<p class="mb-4">Export your agent configuration for backup or transfer.</p>