diff --git a/core/http/endpoints/localai/welcome.go b/core/http/endpoints/localai/welcome.go index 76f7f1a4a969..d21d853c41f1 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 03cb3c9b7c90..776547e5c979 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 1307b1b5486c..055cc85e96cb 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 2a25b028ee51..231d85b0e456 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 05f40eab9f3d..244e218be11d 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 e1a60b5e5445..e6b62496ced6 100644 --- a/core/http/views/models.html +++ b/core/http/views/models.html @@ -10,22 +10,22 @@