webui: switch to hash-based routing (alternative of #16079) (#16157)

* Switched web UI to hash-based routing

* Added hash to missed goto function call

* Removed outdated SPA handling code

* Fixed broken sidebar home link
This commit is contained in:
Isaac McFadyen
2025-09-26 11:36:48 -04:00
committed by GitHub
parent 5d0a40f390
commit e0539eb6ae
14 changed files with 22 additions and 57 deletions

View File

@@ -64,13 +64,13 @@
searchQuery = '';
}
await goto(`/chat/${id}`);
await goto(`#/chat/${id}`);
}
</script>
<ScrollArea class="h-[100vh]">
<Sidebar.Header class=" top-0 z-10 gap-6 bg-sidebar/50 px-4 pt-4 pb-2 backdrop-blur-lg md:sticky">
<a href="/" onclick={handleMobileSidebarItemClick}>
<a href="#/" onclick={handleMobileSidebarItemClick}>
<h1 class="inline-flex items-center gap-1 px-2 text-xl font-semibold">llama.cpp</h1>
</a>

View File

@@ -51,7 +51,7 @@
{:else}
<Button
class="w-full justify-between hover:[&>kbd]:opacity-100"
href="/?new_chat=true"
href="?new_chat=true#/"
onclick={handleMobileSidebarItemClick}
variant="ghost"
>

View File

@@ -64,7 +64,7 @@
updateConfig('apiKey', apiKeyInput.trim());
// Test the API key by making a real request to the server
const response = await fetch('/props', {
const response = await fetch('./props', {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${apiKeyInput.trim()}`
@@ -77,7 +77,7 @@
// Show success state briefly, then navigate to home
setTimeout(() => {
goto('/');
goto(`#/`);
}, 1000);
} else {
// API key is invalid - User Story A