+page.svelte 635 B

123456789101112131415161718192021222324252627
  1. <script lang="ts">
  2. import { ChatScreen } from '$lib/components/app';
  3. import { chatStore, isInitialized } from '$lib/stores/chat.svelte';
  4. import { onMount } from 'svelte';
  5. import { page } from '$app/state';
  6. let qParam = $derived(page.url.searchParams.get('q'));
  7. onMount(async () => {
  8. if (!isInitialized) {
  9. await chatStore.initialize();
  10. }
  11. chatStore.clearActiveConversation();
  12. if (qParam !== null) {
  13. await chatStore.createConversation();
  14. await chatStore.sendMessage(qParam);
  15. }
  16. });
  17. </script>
  18. <svelte:head>
  19. <title>llama.cpp - AI Chat Interface</title>
  20. </svelte:head>
  21. <ChatScreen showCenteredEmpty={true} />