File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 522522 },
523523 },
524524 });
525+
526+ let hasAutoSubmitted = $state (false );
527+
528+ // Auto-submit when URL query parameter is present (only once)
529+ $effect (() => {
530+ const urlQuery = page .url .searchParams .get (' q' );
531+ if (urlQuery && message .current && ! isGenerating && mounted .current && ! hasAutoSubmitted ) {
532+ hasAutoSubmitted = true ;
533+ // Small delay to ensure everything is ready
534+ setTimeout (() => {
535+ handleSubmit ();
536+ }, 100 );
537+ }
538+ });
525539 let selectedImages = $state <{ url: string ; storage_id: string ; fileName? : string }[]>([]);
526540 let selectedDocuments = $state <
527541 {
Original file line number Diff line number Diff line change 99 import { scale } from ' svelte/transition' ;
1010 import { useCachedQuery , api } from ' $lib/cache/cached-query.svelte' ;
1111 import { Provider } from ' $lib/types' ;
12+ import { page } from ' $app/state' ;
1213
1314 const defaultSuggestions = [
1415 ' How does AI work?' ,
6869 });
6970
7071 const prompt = usePrompt ();
72+
73+ // Handle URL parameter for initial query
74+ $effect (() => {
75+ const urlQuery = page .url .searchParams .get (' q' );
76+ if (urlQuery && prompt .current === ' ' ) {
77+ prompt .current = decodeURIComponent (urlQuery );
78+ }
79+ });
7180 </script >
7281
7382<svelte:head >
You can’t perform that action at this time.
0 commit comments