diff --git a/tools/server/server.cpp b/tools/server/server.cpp index 129801fe06daa..6062904a8c7c0 100644 --- a/tools/server/server.cpp +++ b/tools/server/server.cpp @@ -5262,42 +5262,6 @@ int main(int argc, char ** argv) { svr->Get (params.api_prefix + "/slots", handle_slots); svr->Post(params.api_prefix + "/slots/:id_slot", handle_slots_action); - // SPA fallback route - serve index.html for any route that doesn't match API endpoints - // This enables client-side routing for dynamic routes like /chat/[id] - if (params.webui && params.public_path.empty()) { - // Only add fallback when using embedded static files - svr->Get(".*", [](const httplib::Request & req, httplib::Response & res) { - // Skip API routes - they should have been handled above - if (req.path.find("/v1/") != std::string::npos || - req.path.find("/health") != std::string::npos || - req.path.find("/metrics") != std::string::npos || - req.path.find("/props") != std::string::npos || - req.path.find("/models") != std::string::npos || - req.path.find("/api/tags") != std::string::npos || - req.path.find("/completions") != std::string::npos || - req.path.find("/chat/completions") != std::string::npos || - req.path.find("/embeddings") != std::string::npos || - req.path.find("/tokenize") != std::string::npos || - req.path.find("/detokenize") != std::string::npos || - req.path.find("/lora-adapters") != std::string::npos || - req.path.find("/slots") != std::string::npos) { - return false; // Let other handlers process API routes - } - - // Serve index.html for all other routes (SPA fallback) - if (req.get_header_value("Accept-Encoding").find("gzip") == std::string::npos) { - res.set_content("Error: gzip is not supported by this browser", "text/plain"); - } else { - res.set_header("Content-Encoding", "gzip"); - // COEP and COOP headers, required by pyodide (python interpreter) - res.set_header("Cross-Origin-Embedder-Policy", "require-corp"); - res.set_header("Cross-Origin-Opener-Policy", "same-origin"); - res.set_content(reinterpret_cast(index_html_gz), index_html_gz_len, "text/html; charset=utf-8"); - } - return false; - }); - } - // // Start the server // diff --git a/tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebar.svelte b/tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebar.svelte index 05c775f2f5a03..6af348e696da7 100644 --- a/tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebar.svelte +++ b/tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebar.svelte @@ -64,13 +64,13 @@ searchQuery = ''; } - await goto(`/chat/${id}`); + await goto(`#/chat/${id}`); } - +

llama.cpp

diff --git a/tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebarActions.svelte b/tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebarActions.svelte index b946ef07497cc..30d1f9d4b7e98 100644 --- a/tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebarActions.svelte +++ b/tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebarActions.svelte @@ -51,7 +51,7 @@ {:else}