This commit is contained in:
pavel 2026-02-11 17:09:49 +01:00
commit bab956387c
4 changed files with 163 additions and 46 deletions

View file

@ -63,10 +63,41 @@
<div id="dashboard-view" class="dashboard-view"> <div id="dashboard-view" class="dashboard-view">
<header class="dashboard-header"> <header class="dashboard-header">
<h2>Recent Activity</h2> <h2>Perspective</h2>
<p>Track latest agent executions across all directives.</p> <p>Overview of recent agent directives and live communication.</p>
<div class="dashboard-tabs">
<button class="tab-btn active" data-tab="chat">
<span class="tab-icon">💬</span> Quick Chat
</button>
<button class="tab-btn" data-tab="activity">
<span class="tab-icon">📊</span> Recent Activity
</button>
</div>
</header> </header>
<div class="dashboard-content-grid"> <div class="dashboard-content-grid">
<div id="chat-tab-panel" class="tab-panel active">
<div id="chat-container" class="chat-container glass">
<div class="chat-header">
<h3>Neural Link</h3>
<button id="clear-chat-btn" class="btn btn-ghost btn-sm">Clear Memory</button>
</div>
<div id="chat-messages" class="chat-messages">
<!-- Chat messages will be injected here -->
<div class="chat-empty-state">
<p>Establish connection with the neural assistant.</p>
</div>
</div>
<form id="chat-form" class="chat-form">
<input type="text" id="chat-input" placeholder="Transmit message..." autocomplete="off"
required>
<button type="submit" id="chat-send-btn" class="btn btn-primary btn-sm">Send</button>
</form>
</div>
</div>
<div id="activity-tab-panel" class="tab-panel">
<div class="dashboard-content glass"> <div class="dashboard-content glass">
<table class="activity-table"> <table class="activity-table">
<thead> <thead>
@ -81,23 +112,6 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div id="chat-container" class="chat-container glass">
<div class="chat-header">
<h3>Quick Chat</h3>
<button id="clear-chat-btn" class="btn btn-ghost btn-sm">Clear</button>
</div>
<div id="chat-messages" class="chat-messages">
<!-- Chat messages will be injected here -->
<div class="chat-empty-state">
<p>Start a conversation with the assistant.</p>
</div>
</div>
<form id="chat-form" class="chat-form">
<input type="text" id="chat-input" placeholder="Type a message..." autocomplete="off"
required>
<button type="submit" id="chat-send-btn" class="btn btn-primary btn-sm">Send</button>
</form>
</div> </div>
</div> </div>
</div> </div>

View file

@ -17,7 +17,8 @@ const state = {
currentView: 'dashboard', // 'dashboard' or 'task' currentView: 'dashboard', // 'dashboard' or 'task'
isEditing: false, isEditing: false,
isAuthenticated: false, isAuthenticated: false,
chatMessages: [] chatMessages: [],
activeDashboardTab: 'chat' // 'chat' or 'activity'
}; };
// DOM elements // DOM elements
const loginOverlay = document.getElementById('login-overlay'); const loginOverlay = document.getElementById('login-overlay');
@ -271,6 +272,28 @@ function showDashboard() {
renderTaskList(); renderTaskList();
fetchRecentRuns(); fetchRecentRuns();
renderDashboardTabs();
}
function renderDashboardTabs() {
const tabs = document.querySelectorAll('.tab-btn');
const panels = document.querySelectorAll('.tab-panel');
tabs.forEach(tab => {
if (tab.dataset.tab === state.activeDashboardTab) {
tab.classList.add('active');
} else {
tab.classList.remove('active');
}
});
panels.forEach(panel => {
if (panel.id === `${state.activeDashboardTab}-tab-panel`) {
panel.classList.add('active');
} else {
panel.classList.remove('active');
}
});
} }
function renderDashboard(recentRuns) { function renderDashboard(recentRuns) {
@ -723,6 +746,13 @@ logoutBtn.addEventListener('click', () => {
logout(); logout();
}); });
document.querySelectorAll('.tab-btn').forEach(btn => {
btn.addEventListener('click', () => {
state.activeDashboardTab = btn.dataset.tab;
renderDashboardTabs();
});
});
async function initializeApp() { async function initializeApp() {
const hasSession = await checkSession(); const hasSession = await checkSession();

View file

@ -88,9 +88,15 @@ body {
.dashboard-content { .dashboard-content {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
border-radius: 12px; border-radius: 16px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%;
max-width: 900px;
background: rgba(255, 255, 255, 0.02);
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
border: 1px solid var(--glass-border);
min-height: 0;
} }
.activity-table { .activity-table {
@ -125,19 +131,73 @@ body {
} }
.dashboard-content-grid { .dashboard-content-grid {
display: grid; display: flex;
grid-template-columns: 1fr 350px; flex-direction: column;
gap: 24px; align-items: center;
gap: 32px;
flex: 1; flex: 1;
min-height: 0; min-height: 0;
width: 100%;
}
.dashboard-tabs {
display: flex;
gap: 12px;
margin-top: 24px;
}
.tab-btn {
background: rgba(255, 255, 255, 0.03);
border: 1px solid var(--glass-border);
color: var(--text-dim);
padding: 10px 20px;
border-radius: 100px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: var(--transition);
display: flex;
align-items: center;
gap: 8px;
}
.tab-btn:hover {
background: rgba(255, 255, 255, 0.08);
color: var(--text-main);
}
.tab-btn.active {
background: var(--primary);
color: white;
border-color: var(--primary);
box-shadow: 0 4px 15px var(--primary-glow);
}
.tab-panel {
display: none;
width: 100%;
flex-direction: column;
align-items: center;
flex: 1;
min-height: 0;
}
.tab-panel.active {
display: flex;
} }
.chat-container { .chat-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
border-radius: 12px; border-radius: 16px;
overflow: hidden; overflow: hidden;
background: rgba(255, 255, 255, 0.02); background: rgba(255, 255, 255, 0.02);
width: 100%;
max-width: 900px;
flex: 1;
min-height: 0;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
border: 1px solid var(--glass-border);
} }
.chat-header { .chat-header {
@ -176,11 +236,11 @@ body {
} }
.chat-message { .chat-message {
max-width: 85%; max-width: 80%;
padding: 10px 14px; padding: 12px 18px;
border-radius: 12px; border-radius: 16px;
font-size: 14px; font-size: 15px;
line-height: 1.4; line-height: 1.5;
word-wrap: break-word; word-wrap: break-word;
} }
@ -210,10 +270,10 @@ body {
flex: 1; flex: 1;
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
border: 1px solid var(--glass-border); border: 1px solid var(--glass-border);
border-radius: 6px; border-radius: 12px;
padding: 8px 12px; padding: 12px 20px;
color: var(--text-main); color: var(--text-main);
font-size: 14px; font-size: 15px;
outline: none; outline: none;
transition: var(--transition); transition: var(--transition);
} }
@ -894,9 +954,9 @@ textarea:focus {
} }
.btn-sm { .btn-sm {
padding: 6px 12px; padding: 6px 16px;
font-size: 12px; font-size: 12px;
width: 100%; width: auto;
justify-content: center; justify-content: center;
} }

View file

@ -96,6 +96,17 @@ pub fn get_tools() -> Vec<Tool> {
}), }),
}, },
}, },
Tool {
tool_type: "function".to_string(),
function: FunctionDefinition {
name: "get_current_time".to_string(),
description: "Get the current date and time in ISO 8601 format".to_string(),
parameters: serde_json::json!({
"type": "object",
"properties": {},
}),
},
},
] ]
} }
@ -198,6 +209,8 @@ pub async fn handle_tool_call(
)); ));
} }
(out, false) (out, false)
} else if name == "get_current_time" {
(chrono::Utc::now().to_rfc3339(), false)
} else { } else {
(format!("Error: Unknown tool {}", name), false) (format!("Error: Unknown tool {}", name), false)
}; };