From cd7d384500ca65f439aed87b4d81789b2fba6206 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Sun, 16 Nov 2025 11:01:05 +0100 Subject: [PATCH] feat: restyle index (#7282) * Move management to separate section Signed-off-by: Ettore Di Giacinto * Make index to redirect to chat Signed-off-by: Ettore Di Giacinto * Use logo in index Signed-off-by: Ettore Di Giacinto * work out the wizard in the front-page Signed-off-by: Ettore Di Giacinto --------- Signed-off-by: Ettore Di Giacinto --- core/http/endpoints/localai/welcome.go | 9 +- core/http/routes/ui.go | 1 + core/http/static/chat.js | 52 ++ core/http/views/404.html | 12 +- core/http/views/backends.html | 74 +- core/http/views/error.html | 12 +- core/http/views/explorer.html | 6 +- core/http/views/index.html | 838 ++++++++--------------- core/http/views/login.html | 5 +- core/http/views/manage.html | 588 ++++++++++++++++ core/http/views/model-editor.html | 82 +-- core/http/views/models.html | 110 ++- core/http/views/p2p.html | 99 ++- core/http/views/partials/inprogress.html | 30 +- core/http/views/talk.html | 11 +- core/http/views/text2image.html | 14 +- core/http/views/tts.html | 7 +- 17 files changed, 1138 insertions(+), 812 deletions(-) create mode 100644 core/http/views/manage.html diff --git a/core/http/endpoints/localai/welcome.go b/core/http/endpoints/localai/welcome.go index 76f7f1a4a..d21d853c4 100644 --- a/core/http/endpoints/localai/welcome.go +++ b/core/http/endpoints/localai/welcome.go @@ -64,8 +64,13 @@ func WelcomeEndpoint(appConfig *config.ApplicationConfig, // The client expects a JSON response return c.JSON(200, summary) } else { - // Render index - return c.Render(200, "views/index", summary) + // Check if this is the manage route + templateName := "views/index" + if strings.HasSuffix(c.Request().URL.Path, "/manage") || c.Request().URL.Path == "/manage" { + templateName = "views/manage" + } + // Render appropriate template + return c.Render(200, templateName, summary) } } } diff --git a/core/http/routes/ui.go b/core/http/routes/ui.go index 03cb3c9b7..776547e5c 100644 --- a/core/http/routes/ui.go +++ b/core/http/routes/ui.go @@ -21,6 +21,7 @@ func RegisterUIRoutes(app *echo.Echo, var processingOps = services.NewOpCache(galleryService) app.GET("/", localai.WelcomeEndpoint(appConfig, cl, ml, processingOps)) + app.GET("/manage", localai.WelcomeEndpoint(appConfig, cl, ml, processingOps)) // P2P app.GET("/p2p/", func(c echo.Context) error { diff --git a/core/http/static/chat.js b/core/http/static/chat.js index 1307b1b54..055cc85e9 100644 --- a/core/http/static/chat.js +++ b/core/http/static/chat.js @@ -1237,3 +1237,55 @@ document.addEventListener("alpine:init", () => { } }); +// Check for message from index page on load +document.addEventListener('DOMContentLoaded', function() { + // Wait for Alpine to be ready + setTimeout(() => { + const chatData = localStorage.getItem('localai_index_chat_data'); + if (chatData) { + try { + const data = JSON.parse(chatData); + const input = document.getElementById('input'); + + if (input && data.message) { + // Set the message in the input + input.value = data.message; + + // Process files if any + if (data.imageFiles && data.imageFiles.length > 0) { + data.imageFiles.forEach(file => { + images.push(file.data); + }); + } + + if (data.audioFiles && data.audioFiles.length > 0) { + data.audioFiles.forEach(file => { + audios.push(file.data); + }); + } + + if (data.textFiles && data.textFiles.length > 0) { + data.textFiles.forEach(file => { + fileContents.push({ name: file.name, content: file.data }); + currentFileNames.push(file.name); + }); + } + + // Clear localStorage + localStorage.removeItem('localai_index_chat_data'); + + // Auto-submit after a short delay to ensure everything is ready + setTimeout(() => { + if (input.value.trim()) { + processAndSendMessage(input.value); + } + }, 500); + } + } catch (error) { + console.error('Error processing chat data from index:', error); + localStorage.removeItem('localai_index_chat_data'); + } + } + }, 300); +}); + diff --git a/core/http/views/404.html b/core/http/views/404.html index 2a25b028e..231d85b0e 100644 --- a/core/http/views/404.html +++ b/core/http/views/404.html @@ -9,9 +9,9 @@
-
+
-
+
diff --git a/core/http/views/backends.html b/core/http/views/backends.html index 05f40eab9..244e218be 100644 --- a/core/http/views/backends.html +++ b/core/http/views/backends.html @@ -11,21 +11,21 @@
@@ -73,15 +63,13 @@
-
- -
-

-
+ x-transition:enter="transition ease-out duration-200" + x-transition:enter-start="opacity-0" + x-transition:enter-end="opacity-100" + class="bg-[#1E293B] border border-[#8B5CF6]/20 rounded-xl p-8"> +
+

+
Import from URI @@ -89,16 +77,16 @@
-
@@ -283,25 +271,23 @@
-
- -
-

-
+ x-transition:enter="transition ease-out duration-200" + x-transition:enter-start="opacity-0" + x-transition:enter-end="opacity-100" + class="bg-[#1E293B] border border-[#8B5CF6]/20 rounded-xl overflow-hidden h-[calc(100vh-250px)]"> +
+

+
YAML Configuration Editor

- -
@@ -447,11 +433,9 @@ @keyframes slideInFromTop { from { - transform: translateY(-20px); opacity: 0; } to { - transform: translateY(0); opacity: 1; } } diff --git a/core/http/views/models.html b/core/http/views/models.html index e1a60b5e5..e6b62496c 100644 --- a/core/http/views/models.html +++ b/core/http/views/models.html @@ -10,22 +10,22 @@