Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tools/server/webui/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
import { ChatScreen } from '$lib/components/app';
import { chatStore, isInitialized } from '$lib/stores/chat.svelte';
import { onMount } from 'svelte';
import type {PageData} from "./$types";
export let data: PageData;
onMount(async () => {
if (!isInitialized) {
await chatStore.initialize();
}
chatStore.clearActiveConversation();
if (data.q !== null) {
await chatStore.createConversation()
await chatStore.sendMessage(data.q)
}
});
</script>

Expand Down
6 changes: 5 additions & 1 deletion tools/server/webui/src/routes/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { PageLoad } from './$types';
import { validateApiKey } from '$lib/utils/api-key-validation';

export const load: PageLoad = async ({ fetch }) => {
export const load: PageLoad = async ({ fetch, url }) => {
await validateApiKey(fetch);

return {
q: url.searchParams.get('q')
}
};