chore(ui): Move zombie UI to old
This commit is contained in:
@@ -249,7 +249,7 @@ func (a *App) ImportAgent(pool *state.AgentPool) func(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) Chat(pool *state.AgentPool) func(c *fiber.Ctx) error {
|
func (a *App) OldChat(pool *state.AgentPool) func(c *fiber.Ctx) error {
|
||||||
return func(c *fiber.Ctx) error {
|
return func(c *fiber.Ctx) error {
|
||||||
payload := struct {
|
payload := struct {
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
@@ -307,9 +307,9 @@ func (a *App) Chat(pool *state.AgentPool) func(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChatAPI provides a JSON-based API for chat functionality
|
// Chat provides a JSON-based API for chat functionality
|
||||||
// This is designed to work better with the React UI
|
// This is designed to work better with the React UI
|
||||||
func (a *App) ChatAPI(pool *state.AgentPool) func(c *fiber.Ctx) error {
|
func (a *App) Chat(pool *state.AgentPool) func(c *fiber.Ctx) error {
|
||||||
return func(c *fiber.Ctx) error {
|
return func(c *fiber.Ctx) error {
|
||||||
// Parse the request body
|
// Parse the request body
|
||||||
payload := struct {
|
payload := struct {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 886 KiB After Width: | Height: | Size: 886 KiB |
@@ -4,10 +4,10 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Actions Playground</title>
|
<title>Actions Playground</title>
|
||||||
{{template "views/partials/header"}}
|
{{template "old/views/partials/header"}}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{template "views/partials/menu"}}
|
{{template "old/views/partials/menu"}}
|
||||||
|
|
||||||
<!-- Toast for notifications -->
|
<!-- Toast for notifications -->
|
||||||
<div id="toast" class="toast">
|
<div id="toast" class="toast">
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function fetchActions() {
|
function fetchActions() {
|
||||||
fetch('/actions')
|
fetch('/api/actions')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(actions => {
|
.then(actions => {
|
||||||
const select = document.getElementById('action-select');
|
const select = document.getElementById('action-select');
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
// Execute the action
|
// Execute the action
|
||||||
fetch(`/action/${actionId}/run`, {
|
fetch(`/api/action/${actionId}/run`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Agent List</title>
|
<title>Agent List</title>
|
||||||
{{template "views/partials/header"}}
|
{{template "old/views/partials/header"}}
|
||||||
<style>
|
<style>
|
||||||
.avatar-placeholder {
|
.avatar-placeholder {
|
||||||
width: 96px;
|
width: 96px;
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{template "views/partials/menu"}}
|
{{template "old/views/partials/menu"}}
|
||||||
|
|
||||||
<!-- Toast for notifications -->
|
<!-- Toast for notifications -->
|
||||||
<div id="toast" class="toast">
|
<div id="toast" class="toast">
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="button-container justify-center mb-6">
|
<div class="button-container justify-center mb-6">
|
||||||
<a href="/create" class="action-btn start-btn">
|
<a href="/old/create" class="action-btn start-btn">
|
||||||
<i class="fas fa-plus-circle"></i> Add New Agent
|
<i class="fas fa-plus-circle"></i> Add New Agent
|
||||||
</a>
|
</a>
|
||||||
<button id="toggle-import" class="action-btn" style="background: linear-gradient(135deg, var(--tertiary), #4a76a8);">
|
<button id="toggle-import" class="action-btn" style="background: linear-gradient(135deg, var(--tertiary), #4a76a8);">
|
||||||
@@ -121,11 +121,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-2 gap-2 w-full mb-4">
|
<div class="grid grid-cols-2 gap-2 w-full mb-4">
|
||||||
<a href="/status/{{.}}" class="action-btn flex items-center justify-center"
|
<a href="/old/status/{{.}}" class="action-btn flex items-center justify-center"
|
||||||
style="background: linear-gradient(135deg, #2a2a2a, #3a3a3a);">
|
style="background: linear-gradient(135deg, #2a2a2a, #3a3a3a);">
|
||||||
<i class="fas fa-info-circle mr-2"></i> Status
|
<i class="fas fa-info-circle mr-2"></i> Status
|
||||||
</a>
|
</a>
|
||||||
<a href="/talk/{{.}}" class="action-btn flex items-center justify-center"
|
<a href="/old/talk/{{.}}" class="action-btn flex items-center justify-center"
|
||||||
style="background: linear-gradient(135deg, #2a2a2a, #3a3a3a);">
|
style="background: linear-gradient(135deg, #2a2a2a, #3a3a3a);">
|
||||||
<i class="fas fa-comments mr-2"></i> Talk
|
<i class="fas fa-comments mr-2"></i> Talk
|
||||||
</a>
|
</a>
|
||||||
@@ -141,7 +141,7 @@
|
|||||||
<i class="fas fa-play"></i> Start
|
<i class="fas fa-play"></i> Start
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</button>
|
</button>
|
||||||
<a href="/settings/{{.}}" class="action-btn col-span-1 flex items-center justify-center"
|
<a href="/old/settings/{{.}}" class="action-btn col-span-1 flex items-center justify-center"
|
||||||
style="background: linear-gradient(135deg, #2a2a2a, #3a3a3a);">
|
style="background: linear-gradient(135deg, #2a2a2a, #3a3a3a);">
|
||||||
<i class="fas fa-cog"></i>
|
<i class="fas fa-cog"></i>
|
||||||
</a>
|
</a>
|
||||||
@@ -244,7 +244,7 @@
|
|||||||
button.addEventListener('click', function() {
|
button.addEventListener('click', function() {
|
||||||
const agent = this.getAttribute('data-agent');
|
const agent = this.getAttribute('data-agent');
|
||||||
const isActive = this.getAttribute('data-active') === 'true';
|
const isActive = this.getAttribute('data-active') === 'true';
|
||||||
const endpoint = isActive ? `/pause/${agent}` : `/start/${agent}`;
|
const endpoint = isActive ? `/api/agent/${agent}/pause` : `/api/agent/${agent}/start`;
|
||||||
|
|
||||||
// Add animation
|
// Add animation
|
||||||
this.style.animation = 'pulse 0.5s';
|
this.style.animation = 'pulse 0.5s';
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Smart Agent Interface</title>
|
<title>Smart Agent Interface</title>
|
||||||
{{template "views/partials/header"}}
|
{{template "old/views/partials/header"}}
|
||||||
<style>
|
<style>
|
||||||
body { overflow: hidden; }
|
body { overflow: hidden; }
|
||||||
.chat-container { height: 90vh; display: flex; flex-direction: column; }
|
.chat-container { height: 90vh; display: flex; flex-direction: column; }
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-gray-900 p-4 text-white font-sans" hx-ext="sse" sse-connect="/sse/{{.Name}}">
|
<body class="bg-gray-900 p-4 text-white font-sans" hx-ext="sse" sse-connect="/sse/{{.Name}}">
|
||||||
{{template "views/partials/menu"}}
|
{{template "old/views/partials/menu"}}
|
||||||
<div class="chat-container bg-gray-800 shadow-lg rounded-lg" >
|
<div class="chat-container bg-gray-800 shadow-lg rounded-lg" >
|
||||||
|
|
||||||
<!-- Chat Header -->
|
<!-- Chat Header -->
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
<!-- Message Input -->
|
<!-- Message Input -->
|
||||||
<div class="p-4 border-t border-gray-700">
|
<div class="p-4 border-t border-gray-700">
|
||||||
<div sse-swap="message_status"></div>
|
<div sse-swap="message_status"></div>
|
||||||
<input id="inputMessage" name="message" type="text" hx-post="/chat/{{.Name}}" hx-target="#results" hx-indicator=".htmx-indicator"
|
<input id="inputMessage" name="message" type="text" hx-post="/old/chat/{{.Name}}" hx-target="#results" hx-indicator=".htmx-indicator"
|
||||||
class="p-2 border rounded w-full bg-gray-600 text-white placeholder-gray-300" placeholder="Type a message..." _="on htmx:afterRequest set my value to ''">
|
class="p-2 border rounded w-full bg-gray-600 text-white placeholder-gray-300" placeholder="Type a message..." _="on htmx:afterRequest set my value to ''">
|
||||||
<div class="my-2 htmx-indicator" ></div>
|
<div class="my-2 htmx-indicator" ></div>
|
||||||
<div id="results" class="flex justify-center"></div>
|
<div id="results" class="flex justify-center"></div>
|
||||||
@@ -2,20 +2,20 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Create New Agent</title>
|
<title>Create New Agent</title>
|
||||||
{{template "views/partials/header"}}
|
{{template "old/views/partials/header"}}
|
||||||
<script src="/public/js/wizard.js"></script>
|
<script src="/old/public/js/wizard.js"></script>
|
||||||
<link rel="stylesheet" href="/public/css/wizard.css">
|
<link rel="stylesheet" href="/old/public/css/wizard.css">
|
||||||
<script src="/public/js/connector-templates.js"></script>
|
<script src="/old/public/js/connector-templates.js"></script>
|
||||||
<script src="/public/js/agent-form.js"></script>
|
<script src="/old/public/js/agent-form.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{template "views/partials/menu"}}
|
{{template "old/views/partials/menu"}}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="section-box">
|
<div class="section-box">
|
||||||
<h1>Create New Agent</h1>
|
<h1>Create New Agent</h1>
|
||||||
|
|
||||||
<form id="create-agent-form" action="/create" method="POST">
|
<form id="create-agent-form" action="/api/agent/create" method="POST">
|
||||||
{{template "views/partials/agent-form" . }}
|
{{template "old/views/partials/agent-form" . }}
|
||||||
|
|
||||||
<button type="submit" id="create-button" data-original-text="<i class='fas fa-robot'></i> Create Agent">
|
<button type="submit" id="create-button" data-original-text="<i class='fas fa-robot'></i> Create Agent">
|
||||||
<i class="fas fa-robot"></i> Create Agent
|
<i class="fas fa-robot"></i> Create Agent
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
if (jsonData.promptblocks === null) return; // Validation failed
|
if (jsonData.promptblocks === null) return; // Validation failed
|
||||||
|
|
||||||
// Send the structured data as JSON
|
// Send the structured data as JSON
|
||||||
fetch('/create', {
|
fetch('/api/agent/create', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
|
|
||||||
// Redirect to agent list page after a delay
|
// Redirect to agent list page after a delay
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = '/agents';
|
window.location.href = '/old/agents';
|
||||||
}, 2000);
|
}, 2000);
|
||||||
} else if (data.error) {
|
} else if (data.error) {
|
||||||
// Show error toast
|
// Show error toast
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Create Agent Group</title>
|
<title>Create Agent Group</title>
|
||||||
{{template "views/partials/header"}}
|
{{template "old/views/partials/header"}}
|
||||||
<script src="/public/js/wizard.js"></script>
|
<script src="/old/public/js/wizard.js"></script>
|
||||||
<link rel="stylesheet" href="/public/css/wizard.css">
|
<link rel="stylesheet" href="/old/public/css/wizard.css">
|
||||||
<script src="/public/js/connector-templates.js"></script>
|
<script src="/old/public/js/connector-templates.js"></script>
|
||||||
<script src="/public/js/agent-form.js"></script>
|
<script src="/old/public/js/agent-form.js"></script>
|
||||||
<style>
|
<style>
|
||||||
.agent-profile {
|
.agent-profile {
|
||||||
border: 1px solid var(--medium-bg);
|
border: 1px solid var(--medium-bg);
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{template "views/partials/menu"}}
|
{{template "old/views/partials/menu"}}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="section-box">
|
<div class="section-box">
|
||||||
<h1>Create Agent Group</h1>
|
<h1>Create Agent Group</h1>
|
||||||
@@ -268,7 +268,7 @@
|
|||||||
|
|
||||||
<!-- Use the existing agent-form partial -->
|
<!-- Use the existing agent-form partial -->
|
||||||
<div id="group-agent-form">
|
<div id="group-agent-form">
|
||||||
{{template "views/partials/agent-form" . }}
|
{{template "old/views/partials/agent-form" . }}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -554,7 +554,7 @@
|
|||||||
|
|
||||||
// Redirect to agent list page after a delay
|
// Redirect to agent list page after a delay
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = '/agents';
|
window.location.href = '/old/agents';
|
||||||
}, 2000);
|
}, 2000);
|
||||||
} else if (data.error) {
|
} else if (data.error) {
|
||||||
// Show error toast
|
// Show error toast
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Smart Assistant Dashboard</title>
|
<title>Smart Assistant Dashboard</title>
|
||||||
{{template "views/partials/header"}}
|
{{template "old/views/partials/header"}}
|
||||||
<style>
|
<style>
|
||||||
.image-container {
|
.image-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -132,12 +132,12 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{template "views/partials/menu"}}
|
{{template "old/views/partials/menu"}}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
|
|
||||||
<div class="image-container">
|
<div class="image-container">
|
||||||
<img src="/public/logo_1.png" width="250" alt="Company Logo">
|
<img src="/old/public/logo_1.png" width="250" alt="Company Logo">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1 class="dashboard-title">LocalAgent</h1>
|
<h1 class="dashboard-title">LocalAgent</h1>
|
||||||
@@ -160,7 +160,7 @@
|
|||||||
|
|
||||||
<div class="cards-container">
|
<div class="cards-container">
|
||||||
<!-- Card for Agent List Page -->
|
<!-- Card for Agent List Page -->
|
||||||
<a href="/agents" class="card-link">
|
<a href="/old/agents" class="card-link">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h2><i class="fas fa-robot"></i> Agent List</h2>
|
<h2><i class="fas fa-robot"></i> Agent List</h2>
|
||||||
<p>View and manage your list of agents, including detailed profiles and statistics.</p>
|
<p>View and manage your list of agents, including detailed profiles and statistics.</p>
|
||||||
@@ -168,7 +168,7 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- Card for Create Agent -->
|
<!-- Card for Create Agent -->
|
||||||
<a href="/create" class="card-link">
|
<a href="/old/create" class="card-link">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h2><i class="fas fa-plus-circle"></i> Create Agent</h2>
|
<h2><i class="fas fa-plus-circle"></i> Create Agent</h2>
|
||||||
<p>Create a new intelligent agent with custom behaviors, connectors, and actions.</p>
|
<p>Create a new intelligent agent with custom behaviors, connectors, and actions.</p>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
{{template "views/partials/header" .}}
|
{{template "old/views/partials/header" .}}
|
||||||
|
|
||||||
<body class="bg-gradient-to-br from-gray-900 to-gray-950 text-gray-200">
|
<body class="bg-gradient-to-br from-gray-900 to-gray-950 text-gray-200">
|
||||||
<div class="flex flex-col min-h-screen">
|
<div class="flex flex-col min-h-screen">
|
||||||
|
|
||||||
{{template "views/partials/menu" .}}
|
{{template "old/views/partials/menu" .}}
|
||||||
|
|
||||||
<div class="container mx-auto px-4 py-8 flex-grow flex items-center justify-center">
|
<div class="container mx-auto px-4 py-8 flex-grow flex items-center justify-center">
|
||||||
<!-- Auth Card -->
|
<!-- Auth Card -->
|
||||||
@@ -6,5 +6,5 @@
|
|||||||
<script src="https://unpkg.com/htmx.org"></script>
|
<script src="https://unpkg.com/htmx.org"></script>
|
||||||
<script src="https://unpkg.com/htmx.org/dist/ext/sse.js"></script>
|
<script src="https://unpkg.com/htmx.org/dist/ext/sse.js"></script>
|
||||||
<script src="https://unpkg.com/hyperscript.org@0.9.12"></script>
|
<script src="https://unpkg.com/hyperscript.org@0.9.12"></script>
|
||||||
<link rel="stylesheet" href="/public/css/styles.css">
|
<link rel="stylesheet" href="/old/public/css/styles.css">
|
||||||
<script src="/public/js/common.js"></script>
|
<script src="/old/public/js/common.js"></script>
|
||||||
@@ -5,9 +5,9 @@
|
|||||||
<!-- Logo container -->
|
<!-- Logo container -->
|
||||||
<div class="flex-shrink-0">
|
<div class="flex-shrink-0">
|
||||||
<!-- Logo with glow effect -->
|
<!-- Logo with glow effect -->
|
||||||
<a href="/" class="flex items-center group">
|
<a href="/old" class="flex items-center group">
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<img src="/public/logo_1.png" alt="Logo" class="h-10 w-auto mr-4 transition-transform duration-300 group-hover:scale-105"
|
<img src="/old/public/logo_1.png" alt="Logo" class="h-10 w-auto mr-4 transition-transform duration-300 group-hover:scale-105"
|
||||||
style="filter: drop-shadow(0 0 5px var(--primary));">
|
style="filter: drop-shadow(0 0 5px var(--primary));">
|
||||||
<!-- Animated scan line on hover -->
|
<!-- Animated scan line on hover -->
|
||||||
<div class="absolute inset-0 overflow-hidden opacity-0 group-hover:opacity-100 transition-opacity duration-300">
|
<div class="absolute inset-0 overflow-hidden opacity-0 group-hover:opacity-100 transition-opacity duration-300">
|
||||||
@@ -21,25 +21,25 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="hidden md:block ml-10">
|
<div class="hidden md:block ml-10">
|
||||||
<div class="flex space-x-4">
|
<div class="flex space-x-4">
|
||||||
<a href="/" class="px-3 py-2 rounded-md text-lg font-medium text-white hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
<a href="/old" class="px-3 py-2 rounded-md text-lg font-medium text-white hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
||||||
<i class="fas fa-home mr-2"></i> Home
|
<i class="fas fa-home mr-2"></i> Home
|
||||||
<!-- Underline animation -->
|
<!-- Underline animation -->
|
||||||
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
||||||
style="background: linear-gradient(90deg, var(--primary), var(--secondary));"></span>
|
style="background: linear-gradient(90deg, var(--primary), var(--secondary));"></span>
|
||||||
</a>
|
</a>
|
||||||
<a href="/agents" class="px-3 py-2 rounded-md text-lg font-medium text-gray-400 hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
<a href="/old/agents" class="px-3 py-2 rounded-md text-lg font-medium text-gray-400 hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
||||||
<i class="fas fa-users mr-2"></i> Agent List
|
<i class="fas fa-users mr-2"></i> Agent List
|
||||||
<!-- Underline animation -->
|
<!-- Underline animation -->
|
||||||
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
||||||
style="background: linear-gradient(90deg, var(--secondary), var(--tertiary));"></span>
|
style="background: linear-gradient(90deg, var(--secondary), var(--tertiary));"></span>
|
||||||
</a>
|
</a>
|
||||||
<a href="/actions-playground" class="px-3 py-2 rounded-md text-lg font-medium text-gray-400 hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
<a href="/old/actions-playground" class="px-3 py-2 rounded-md text-lg font-medium text-gray-400 hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
||||||
<i class="fas fa-bolt mr-2"></i> Actions Playground
|
<i class="fas fa-bolt mr-2"></i> Actions Playground
|
||||||
<!-- Underline animation -->
|
<!-- Underline animation -->
|
||||||
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
||||||
style="background: linear-gradient(90deg, var(--tertiary), var(--primary));"></span>
|
style="background: linear-gradient(90deg, var(--tertiary), var(--primary));"></span>
|
||||||
</a>
|
</a>
|
||||||
<a href="/group-create" class="px-3 py-2 rounded-md text-lg font-medium text-gray-400 hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
<a href="/old/group-create" class="px-3 py-2 rounded-md text-lg font-medium text-gray-400 hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
||||||
<i class="fas fa-users-cog mr-2"></i> Create Agent Group
|
<i class="fas fa-users-cog mr-2"></i> Create Agent Group
|
||||||
<!-- Underline animation -->
|
<!-- Underline animation -->
|
||||||
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
||||||
@@ -72,21 +72,21 @@
|
|||||||
<div id="mobile-menu" class="md:hidden hidden"
|
<div id="mobile-menu" class="md:hidden hidden"
|
||||||
style="background-color: var(--darker-bg); border-top: 1px solid var(--medium-bg);">
|
style="background-color: var(--darker-bg); border-top: 1px solid var(--medium-bg);">
|
||||||
<div class="px-2 pt-2 pb-3 space-y-1">
|
<div class="px-2 pt-2 pb-3 space-y-1">
|
||||||
<a href="/" class="block px-3 py-2 rounded-md text-base font-medium text-white hover:bg-gray-800 transition duration-300"
|
<a href="/old" class="block px-3 py-2 rounded-md text-base font-medium text-white hover:bg-gray-800 transition duration-300"
|
||||||
style="border-left: 3px solid var(--primary);">
|
style="border-left: 3px solid var(--primary);">
|
||||||
<i class="fas fa-home mr-2"></i> Home
|
<i class="fas fa-home mr-2"></i> Home
|
||||||
</a>
|
</a>
|
||||||
<a href="/agents" class="block px-3 py-2 rounded-md text-base font-medium text-gray-400 hover:bg-gray-800 transition duration-300"
|
<a href="/old/agents" class="block px-3 py-2 rounded-md text-base font-medium text-gray-400 hover:bg-gray-800 transition duration-300"
|
||||||
style="border-left: 3px solid var(--secondary);">
|
style="border-left: 3px solid var(--secondary);">
|
||||||
<i class="fas fa-users mr-2"></i> Agent List
|
<i class="fas fa-users mr-2"></i> Agent List
|
||||||
</a>
|
</a>
|
||||||
<a href="/actions-playground" class="px-3 py-2 rounded-md text-lg font-medium text-gray-400 hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
<a href="/old/actions-playground" class="px-3 py-2 rounded-md text-lg font-medium text-gray-400 hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
||||||
<i class="fas fa-bolt mr-2"></i> Actions Playground
|
<i class="fas fa-bolt mr-2"></i> Actions Playground
|
||||||
<!-- Underline animation -->
|
<!-- Underline animation -->
|
||||||
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
||||||
style="background: linear-gradient(90deg, var(--tertiary), var(--primary));"></span>
|
style="background: linear-gradient(90deg, var(--tertiary), var(--primary));"></span>
|
||||||
</a>
|
</a>
|
||||||
<a href="/group-create" class="px-3 py-2 rounded-md text-lg font-medium text-gray-400 hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
<a href="/old/group-create" class="px-3 py-2 rounded-md text-lg font-medium text-gray-400 hover:bg-gray-800 transition duration-300 relative overflow-hidden group">
|
||||||
<i class="fas fa-users-cog mr-2"></i> Create Agent Group
|
<i class="fas fa-users-cog mr-2"></i> Create Agent Group
|
||||||
<!-- Underline animation -->
|
<!-- Underline animation -->
|
||||||
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
<span class="absolute bottom-0 left-0 w-0 h-0.5 group-hover:w-full transition-all duration-300"
|
||||||
@@ -2,14 +2,14 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Agent settings {{.Name}}</title>
|
<title>Agent settings {{.Name}}</title>
|
||||||
{{template "views/partials/header"}}
|
{{template "old/views/partials/header"}}
|
||||||
<script src="/public/js/wizard.js"></script>
|
<script src="/old/public/js/wizard.js"></script>
|
||||||
<link rel="stylesheet" href="/public/css/wizard.css">
|
<link rel="stylesheet" href="/old/public/css/wizard.css">
|
||||||
<script src="/public/js/connector-templates.js"></script>
|
<script src="/old/public/js/connector-templates.js"></script>
|
||||||
<script src="/public/js/agent-form.js"></script>
|
<script src="/old/public/js/agent-form.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{template "views/partials/menu"}}
|
{{template "old/views/partials/menu"}}
|
||||||
|
|
||||||
<!-- Toast notification container -->
|
<!-- Toast notification container -->
|
||||||
<div id="toast" class="toast">
|
<div id="toast" class="toast">
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<form id="edit-agent-form">
|
<form id="edit-agent-form">
|
||||||
<input type="hidden" name="name" id="name" value="{{.Name}}">
|
<input type="hidden" name="name" id="name" value="{{.Name}}">
|
||||||
|
|
||||||
{{template "views/partials/agent-form" .}}
|
{{template "old/views/partials/agent-form" .}}
|
||||||
|
|
||||||
<button type="submit" id="update-button" class="action-btn" data-original-text="<i class='fas fa-save'></i> Update Agent">
|
<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
|
<i class="fas fa-save"></i> Update Agent
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<p class="mb-4">Export your agent configuration for backup or transfer.</p>
|
<p class="mb-4">Export your agent configuration for backup or transfer.</p>
|
||||||
<button
|
<button
|
||||||
class="action-btn"
|
class="action-btn"
|
||||||
onclick="window.location.href='/settings/export/{{.Name}}'">
|
onclick="window.location.href='/old/settings/export/{{.Name}}'">
|
||||||
<i class="fas fa-file-export"></i> Export Configuration
|
<i class="fas fa-file-export"></i> Export Configuration
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
<button
|
<button
|
||||||
class="action-btn"
|
class="action-btn"
|
||||||
style="background: linear-gradient(135deg, #ff4545, var(--secondary)); color: white;"
|
style="background: linear-gradient(135deg, #ff4545, var(--secondary)); color: white;"
|
||||||
hx-delete="/delete/{{.Name}}"
|
hx-delete="/api/agent/{{.Name}}"
|
||||||
hx-swap="none"
|
hx-swap="none"
|
||||||
data-action="delete"
|
data-action="delete"
|
||||||
data-agent="{{.Name}}">
|
data-agent="{{.Name}}">
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
toggleButton.addEventListener('click', function() {
|
toggleButton.addEventListener('click', function() {
|
||||||
const agent = this.getAttribute('data-agent');
|
const agent = this.getAttribute('data-agent');
|
||||||
const isActive = this.getAttribute('data-active') === "true";
|
const isActive = this.getAttribute('data-active') === "true";
|
||||||
const endpoint = isActive ? `/pause/${agent}` : `/start/${agent}`;
|
const endpoint = isActive ? `/api/agent/${agent}/pause` : `/api/agent/${agent}/start`;
|
||||||
|
|
||||||
// Add animation
|
// Add animation
|
||||||
this.style.animation = 'pulse 0.5s';
|
this.style.animation = 'pulse 0.5s';
|
||||||
@@ -277,7 +277,7 @@
|
|||||||
message = `Agent "${agent}" deleted successfully`;
|
message = `Agent "${agent}" deleted successfully`;
|
||||||
// Redirect to agent list page after short delay for delete
|
// Redirect to agent list page after short delay for delete
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = "/agents";
|
window.location.href = "/old/agents";
|
||||||
}, 2000);
|
}, 2000);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Smart Agent status</title>
|
<title>Smart Agent status</title>
|
||||||
{{template "views/partials/header"}}
|
{{template "old/views/partials/header"}}
|
||||||
<style>
|
<style>
|
||||||
body { overflow: hidden; }
|
body { overflow: hidden; }
|
||||||
.chat-container { height: 90vh; display: flex; flex-direction: column; }
|
.chat-container { height: 90vh; display: flex; flex-direction: column; }
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-gray-900 p-4 text-white font-sans" hx-ext="sse" sse-connect="/sse/{{.Name}}">
|
<body class="bg-gray-900 p-4 text-white font-sans" hx-ext="sse" sse-connect="/sse/{{.Name}}">
|
||||||
{{template "views/partials/menu"}}
|
{{template "old/views/partials/menu"}}
|
||||||
<div class="chat-container bg-gray-800 shadow-lg rounded-lg" >
|
<div class="chat-container bg-gray-800 shadow-lg rounded-lg" >
|
||||||
<!-- Chat Header -->
|
<!-- Chat Header -->
|
||||||
<div class="border-b border-gray-700 p-4">
|
<div class="border-b border-gray-700 p-4">
|
||||||
153
webui/routes.go
153
webui/routes.go
@@ -21,10 +21,10 @@ import (
|
|||||||
"github.com/mudler/LocalAgent/services"
|
"github.com/mudler/LocalAgent/services"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed views/*
|
//go:embed old/views/*
|
||||||
var viewsfs embed.FS
|
var viewsfs embed.FS
|
||||||
|
|
||||||
//go:embed public/*
|
//go:embed old/public/*
|
||||||
var embeddedFiles embed.FS
|
var embeddedFiles embed.FS
|
||||||
|
|
||||||
//go:embed react-ui/dist/*
|
//go:embed react-ui/dist/*
|
||||||
@@ -39,12 +39,12 @@ func (app *App) registerRoutes(pool *state.AgentPool, webapp *fiber.App) {
|
|||||||
Browse: true,
|
Browse: true,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/* webapp.Use("/public", filesystem.New(filesystem.Config{
|
webapp.Use("/old/public", filesystem.New(filesystem.Config{
|
||||||
Root: http.FS(embeddedFiles),
|
Root: http.FS(embeddedFiles),
|
||||||
PathPrefix: "public",
|
PathPrefix: "/old/public",
|
||||||
Browse: true,
|
Browse: true,
|
||||||
}))
|
}))
|
||||||
*/
|
|
||||||
if len(app.config.ApiKeys) > 0 {
|
if len(app.config.ApiKeys) > 0 {
|
||||||
kaConfig, err := GetKeyAuthConfig(app.config.ApiKeys)
|
kaConfig, err := GetKeyAuthConfig(app.config.ApiKeys)
|
||||||
if err != nil || kaConfig == nil {
|
if err != nil || kaConfig == nil {
|
||||||
@@ -53,15 +53,18 @@ func (app *App) registerRoutes(pool *state.AgentPool, webapp *fiber.App) {
|
|||||||
webapp.Use(v2keyauth.New(*kaConfig))
|
webapp.Use(v2keyauth.New(*kaConfig))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* webapp.Get("/", func(c *fiber.Ctx) error {
|
webapp.Get("/old", func(c *fiber.Ctx) error {
|
||||||
return c.Render("views/index", fiber.Map{
|
return c.Render("old/views/index", fiber.Map{
|
||||||
"Agents": pool.List(),
|
"Agents": pool.List(),
|
||||||
"AgentCount": len(pool.List()),
|
"AgentCount": len(pool.List()),
|
||||||
"Actions": len(services.AvailableActions),
|
"Actions": len(services.AvailableActions),
|
||||||
"Connectors": len(services.AvailableConnectors),
|
"Connectors": len(services.AvailableConnectors),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
*/
|
|
||||||
|
webapp.Get("/", func(c *fiber.Ctx) error {
|
||||||
|
return c.Redirect("/app")
|
||||||
|
})
|
||||||
webapp.Use("/app", filesystem.New(filesystem.Config{
|
webapp.Use("/app", filesystem.New(filesystem.Config{
|
||||||
Root: http.FS(reactUI),
|
Root: http.FS(reactUI),
|
||||||
PathPrefix: "react-ui/dist",
|
PathPrefix: "react-ui/dist",
|
||||||
@@ -77,30 +80,29 @@ func (app *App) registerRoutes(pool *state.AgentPool, webapp *fiber.App) {
|
|||||||
return c.Send(indexHTML)
|
return c.Send(indexHTML)
|
||||||
})
|
})
|
||||||
|
|
||||||
/* webapp.Get("/agents", func(c *fiber.Ctx) error {
|
webapp.Get("/old/agents", func(c *fiber.Ctx) error {
|
||||||
statuses := map[string]bool{}
|
statuses := map[string]bool{}
|
||||||
for _, a := range pool.List() {
|
for _, a := range pool.List() {
|
||||||
agent := pool.GetAgent(a)
|
agent := pool.GetAgent(a)
|
||||||
if agent == nil {
|
if agent == nil {
|
||||||
xlog.Error("Agent not found", "name", a)
|
xlog.Error("Agent not found", "name", a)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
statuses[a] = !agent.Paused()
|
statuses[a] = !agent.Paused()
|
||||||
}
|
}
|
||||||
return c.Render("views/agents", fiber.Map{
|
return c.Render("old/views/agents", fiber.Map{
|
||||||
"Agents": pool.List(),
|
"Agents": pool.List(),
|
||||||
"Status": statuses,
|
"Status": statuses,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
*/
|
|
||||||
/* webapp.Get("/api/create", func(c *fiber.Ctx) error {
|
webapp.Get("/old/create", func(c *fiber.Ctx) error {
|
||||||
return c.Render("views/create", fiber.Map{
|
return c.Render("old/views/create", fiber.Map{
|
||||||
"Actions": services.AvailableActions,
|
"Actions": services.AvailableActions,
|
||||||
"Connectors": services.AvailableConnectors,
|
"Connectors": services.AvailableConnectors,
|
||||||
"PromptBlocks": services.AvailableBlockPrompts,
|
"PromptBlocks": services.AvailableBlockPrompts,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
*/
|
|
||||||
// Define a route for the GET method on the root path '/'
|
// Define a route for the GET method on the root path '/'
|
||||||
webapp.Get("/sse/:name", func(c *fiber.Ctx) error {
|
webapp.Get("/sse/:name", func(c *fiber.Ctx) error {
|
||||||
m := pool.GetManager(c.Params("name"))
|
m := pool.GetManager(c.Params("name"))
|
||||||
@@ -112,70 +114,69 @@ func (app *App) registerRoutes(pool *state.AgentPool, webapp *fiber.App) {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
/*webapp.Get("/status/:name", func(c *fiber.Ctx) error {
|
webapp.Get("/old/status/:name", func(c *fiber.Ctx) error {
|
||||||
history := pool.GetStatusHistory(c.Params("name"))
|
history := pool.GetStatusHistory(c.Params("name"))
|
||||||
if history == nil {
|
if history == nil {
|
||||||
history = &state.Status{ActionResults: []types.ActionState{}}
|
history = &state.Status{ActionResults: []types.ActionState{}}
|
||||||
}
|
}
|
||||||
// reverse history
|
// reverse history
|
||||||
|
|
||||||
return c.Render("views/status", fiber.Map{
|
return c.Render("old/views/status", fiber.Map{
|
||||||
"Name": c.Params("name"),
|
"Name": c.Params("name"),
|
||||||
"History": Reverse(history.Results()),
|
"History": Reverse(history.Results()),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
webapp.Get("/notify/:name", app.Notify(pool))
|
webapp.Get("/api/notify/:name", app.Notify(pool))
|
||||||
webapp.Post("/chat/:name", app.Chat(pool))
|
webapp.Post("/old/chat/:name", app.OldChat(pool))
|
||||||
*/
|
|
||||||
webapp.Post("/api/agent/create", app.Create(pool))
|
webapp.Post("/api/agent/create", app.Create(pool))
|
||||||
webapp.Delete("/api/agent/:name", app.Delete(pool))
|
webapp.Delete("/api/agent/:name", app.Delete(pool))
|
||||||
webapp.Put("/api/agent/:name/pause", app.Pause(pool))
|
webapp.Put("/api/agent/:name/pause", app.Pause(pool))
|
||||||
webapp.Put("/api/agent/:name/start", app.Start(pool))
|
webapp.Put("/api/agent/:name/start", app.Start(pool))
|
||||||
|
|
||||||
// Add JSON-based chat API endpoint
|
webapp.Post("/api/chat/:name", app.Chat(pool))
|
||||||
webapp.Post("/api/chat/:name", app.ChatAPI(pool))
|
|
||||||
|
|
||||||
conversationTracker := connectors.NewConversationTracker[string](app.config.ConversationStoreDuration)
|
conversationTracker := connectors.NewConversationTracker[string](app.config.ConversationStoreDuration)
|
||||||
|
|
||||||
webapp.Post("/v1/responses", app.Responses(pool, conversationTracker))
|
webapp.Post("/v1/responses", app.Responses(pool, conversationTracker))
|
||||||
|
|
||||||
/* webapp.Get("/talk/:name", func(c *fiber.Ctx) error {
|
webapp.Get("/old/talk/:name", func(c *fiber.Ctx) error {
|
||||||
return c.Render("views/chat", fiber.Map{
|
return c.Render("old/views/chat", fiber.Map{
|
||||||
// "Character": agent.Character,
|
// "Character": agent.Character,
|
||||||
"Name": c.Params("name"),
|
"Name": c.Params("name"),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
webapp.Get("/settings/:name", func(c *fiber.Ctx) error {
|
webapp.Get("/old/settings/:name", func(c *fiber.Ctx) error {
|
||||||
status := false
|
status := false
|
||||||
for _, a := range pool.List() {
|
for _, a := range pool.List() {
|
||||||
if a == c.Params("name") {
|
if a == c.Params("name") {
|
||||||
status = !pool.GetAgent(a).Paused()
|
status = !pool.GetAgent(a).Paused()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.Render("views/settings", fiber.Map{
|
return c.Render("old/views/settings", fiber.Map{
|
||||||
"Name": c.Params("name"),
|
"Name": c.Params("name"),
|
||||||
"Status": status,
|
"Status": status,
|
||||||
"Actions": services.AvailableActions,
|
"Actions": services.AvailableActions,
|
||||||
"Connectors": services.AvailableConnectors,
|
"Connectors": services.AvailableConnectors,
|
||||||
"PromptBlocks": services.AvailableBlockPrompts,
|
"PromptBlocks": services.AvailableBlockPrompts,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
webapp.Get("/actions-playground", func(c *fiber.Ctx) error {
|
webapp.Get("/old/actions-playground", func(c *fiber.Ctx) error {
|
||||||
return c.Render("views/actions", fiber.Map{})
|
return c.Render("old/views/actions", fiber.Map{})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
webapp.Get("/old/group-create", func(c *fiber.Ctx) error {
|
||||||
|
return c.Render("old/views/group-create", fiber.Map{
|
||||||
|
"Actions": services.AvailableActions,
|
||||||
|
"Connectors": services.AvailableConnectors,
|
||||||
|
"PromptBlocks": services.AvailableBlockPrompts,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
webapp.Get("/group-create", func(c *fiber.Ctx) error {
|
|
||||||
return c.Render("views/group-create", fiber.Map{
|
|
||||||
"Actions": services.AvailableActions,
|
|
||||||
"Connectors": services.AvailableConnectors,
|
|
||||||
"PromptBlocks": services.AvailableBlockPrompts,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
// New API endpoints for getting and updating agent configuration
|
// New API endpoints for getting and updating agent configuration
|
||||||
webapp.Get("/api/agent/:name/config", app.GetAgentConfig(pool))
|
webapp.Get("/api/agent/:name/config", app.GetAgentConfig(pool))
|
||||||
webapp.Put("/api/agent/:name/config", app.UpdateAgentConfig(pool))
|
webapp.Put("/api/agent/:name/config", app.UpdateAgentConfig(pool))
|
||||||
@@ -295,7 +296,7 @@ func getApiKeyErrorHandler(opaqueErrors bool, apiKeys []string) fiber.ErrorHandl
|
|||||||
if opaqueErrors {
|
if opaqueErrors {
|
||||||
return ctx.SendStatus(401)
|
return ctx.SendStatus(401)
|
||||||
}
|
}
|
||||||
return ctx.Status(401).Render("views/login", fiber.Map{})
|
return ctx.Status(401).Render("old/views/login", fiber.Map{})
|
||||||
}
|
}
|
||||||
if opaqueErrors {
|
if opaqueErrors {
|
||||||
return ctx.SendStatus(500)
|
return ctx.SendStatus(500)
|
||||||
|
|||||||
Reference in New Issue
Block a user