Add injected Menu Items

This commit is contained in:
Raven Scott 2024-10-02 05:10:03 -04:00
parent 94ee7240ad
commit 9f784f5c0a
2 changed files with 43 additions and 5 deletions

View File

@ -198,4 +198,16 @@ async function resetChat(displaySuccessMessage = true) {
// Resets the chat on page load without displaying the success message // Resets the chat on page load without displaying the success message
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
resetChat(false); resetChat(false);
}); });
function openGpuStats() {
window.open('https://chat.x64.world/smi.html', 'gpuStatsWindow', 'width=800,height=600');
}
function openLiveLog() {
window.open('https://llama-live-log.x64.world/', 'liveLogWindow', 'width=600,height=600');
}
function openTop() {
window.open('https://ai-top.x64.world/', 'liveLogGtopWindow', 'width=800,height=600');
}

View File

@ -24,7 +24,14 @@
<link rel="manifest" href="/site.webmanifest"> <link rel="manifest" href="/site.webmanifest">
<meta name="msapplication-TileColor" content="#da532c"> <meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
<script>
const menuItems = [
{ title: 'GPU Stats', customFunction: 'openGpuStats()' },
{ title: 'Live Log', customFunction: 'openLiveLog()' },
{ title: 'Top', customFunction: 'openTop()' },
{ title: 'Home', url: '/', openNewPage: false }
];
</script>
</head> </head>
<body class="bg-dark text-white"> <body class="bg-dark text-white">
@ -44,14 +51,32 @@
<ul class="navbar-nav ms-auto"> <ul class="navbar-nav ms-auto">
<% menuItems.forEach(item=> { %> <% menuItems.forEach(item=> { %>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="<%= item.url %>" <%=item.openNewPage ? 'target="_blank"' : '' <a class="nav-link" href="<%= item.url %>" <%=item.openNewPage ? 'target="_blank"' : '' %>>
%>><%= item.title %></a> <%= item.title %>
</a>
</li> </li>
<% }) %> <% }) %>
<!-- Add a vertical divider -->
<li class="nav-item">
<span class="nav-link separator">|</span>
</li>
<!-- Inject custom menu items here -->
<li class="nav-item">
<a class="nav-link" href="#" onclick="openLiveLog()">Live Log</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" onclick="openTop()">Top</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" onclick="openGpuStats()">GPU Stats</a>
</li>
</ul> </ul>
</div> </div>
</div> </div>
</nav> </nav>
<!-- Alert Messages --> <!-- Alert Messages -->
<div id="success-alert" class="alert alert-success mt-3" style="display: none;"></div> <div id="success-alert" class="alert alert-success mt-3" style="display: none;"></div>
<div id="error-alert" class="alert alert-danger mt-3" style="display: none;"></div> <div id="error-alert" class="alert alert-danger mt-3" style="display: none;"></div>
@ -67,6 +92,7 @@
<!-- Buttons side by side --> <!-- Buttons side by side -->
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<button class="btn btn-secondary" onclick="resetChat()">Reset Chat</button> <button class="btn btn-secondary" onclick="resetChat()">Reset Chat</button>
<!-- Loading Indicator --> <!-- Loading Indicator -->
<div id="loading" class="text-center mt-3" style="display: none;"> <div id="loading" class="text-center mt-3" style="display: none;">
<div class="spinner-border spinner-border-sm text-primary" role="status"> <div class="spinner-border spinner-border-sm text-primary" role="status">