Skip to content

Commit fff6dfb

Browse files
Switched web UI to hash-based routing
1 parent 5d0a40f commit fff6dfb

File tree

13 files changed

+20
-19
lines changed

13 files changed

+20
-19
lines changed

tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
searchQuery = '';
6565
}
6666
67-
await goto(`/chat/${id}`);
67+
await goto(`#/chat/${id}`);
6868
}
6969
</script>
7070

tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebarActions.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
{:else}
5252
<Button
5353
class="w-full justify-between hover:[&>kbd]:opacity-100"
54-
href="/?new_chat=true"
54+
href="?new_chat=true#/"
5555
onclick={handleMobileSidebarItemClick}
5656
variant="ghost"
5757
>

tools/server/webui/src/lib/components/app/server/ServerErrorSplash.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
updateConfig('apiKey', apiKeyInput.trim());
6565
6666
// Test the API key by making a real request to the server
67-
const response = await fetch('/props', {
67+
const response = await fetch('./props', {
6868
headers: {
6969
'Content-Type': 'application/json',
7070
Authorization: `Bearer ${apiKeyInput.trim()}`
@@ -77,7 +77,7 @@
7777
7878
// Show success state briefly, then navigate to home
7979
setTimeout(() => {
80-
goto('/');
80+
goto(`#/`);
8181
}, 1000);
8282
} else {
8383
// API key is invalid - User Story A

tools/server/webui/src/lib/services/chat.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export class ChatService {
164164
const currentConfig = config();
165165
const apiKey = currentConfig.apiKey?.toString().trim();
166166

167-
const response = await fetch(`/v1/chat/completions`, {
167+
const response = await fetch(`./v1/chat/completions`, {
168168
method: 'POST',
169169
headers: {
170170
'Content-Type': 'application/json',
@@ -533,7 +533,7 @@ export class ChatService {
533533
const currentConfig = config();
534534
const apiKey = currentConfig.apiKey?.toString().trim();
535535

536-
const response = await fetch(`/props`, {
536+
const response = await fetch(`./props`, {
537537
headers: {
538538
'Content-Type': 'application/json',
539539
...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {})

tools/server/webui/src/lib/services/slots.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export class SlotsService {
138138
const currentConfig = config();
139139
const apiKey = currentConfig.apiKey?.toString().trim();
140140

141-
const response = await fetch('/slots', {
141+
const response = await fetch(`./slots`, {
142142
headers: {
143143
...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {})
144144
}

tools/server/webui/src/lib/stores/chat.svelte.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class ChatStore {
100100

101101
this.maxContextError = null;
102102

103-
await goto(`/chat/${conversation.id}`);
103+
await goto(`#/chat/${conversation.id}`);
104104

105105
return conversation.id;
106106
}
@@ -910,7 +910,7 @@ class ChatStore {
910910
if (this.activeConversation?.id === convId) {
911911
this.activeConversation = null;
912912
this.activeMessages = [];
913-
await goto('/?new_chat=true');
913+
await goto(`?new_chat=true#/`);
914914
}
915915
} catch (error) {
916916
console.error('Failed to delete conversation:', error);

tools/server/webui/src/lib/stores/server.svelte.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class ServerStore {
9898
const currentConfig = config();
9999
const apiKey = currentConfig.apiKey?.toString().trim();
100100

101-
const response = await fetch('/slots', {
101+
const response = await fetch(`./slots`, {
102102
headers: {
103103
...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {})
104104
}

tools/server/webui/src/lib/utils/api-key-validation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function validateApiKey(fetch: typeof globalThis.fetch): Promise<vo
2222
headers.Authorization = `Bearer ${apiKey}`;
2323
}
2424

25-
const response = await fetch('/props', { headers });
25+
const response = await fetch(`./props`, { headers });
2626

2727
if (!response.ok) {
2828
if (response.status === 401 || response.status === 403) {

tools/server/webui/src/routes/+error.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1818
function handleRetry() {
1919
// Navigate back to home page after successful API key validation
20-
goto('/');
20+
goto('#/');
2121
}
2222
</script>
2323

@@ -60,7 +60,7 @@
6060
</p>
6161
</div>
6262
<button
63-
onclick={() => goto('/')}
63+
onclick={() => goto('#/')}
6464
class="rounded-md bg-primary px-4 py-2 text-primary-foreground hover:bg-primary/90"
6565
>
6666
Go Home

tools/server/webui/src/routes/+layout.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
5050
if (isCtrlOrCmd && event.shiftKey && event.key === 'o') {
5151
event.preventDefault();
52-
goto('/?new_chat=true');
52+
goto('?new_chat=true#/');
5353
}
5454
5555
if (event.shiftKey && isCtrlOrCmd && event.key === 'e') {
@@ -115,7 +115,7 @@
115115
headers.Authorization = `Bearer ${apiKey.trim()}`;
116116
}
117117
118-
fetch('/props', { headers })
118+
fetch(`./props`, { headers })
119119
.then((response) => {
120120
if (response.status === 401 || response.status === 403) {
121121
window.location.reload();

0 commit comments

Comments
 (0)