Skip to content

Commit

Permalink
Add support for ?q query parameter to start a conversation (hugging…
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin authored Jun 3, 2024
1 parent 0a19b18 commit d5fc924
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script lang="ts">
import { goto } from "$app/navigation";
import { base } from "$app/paths";
import { page } from "$app/stores";
import { env as envPublic } from "$env/dynamic/public";
import ChatWindow from "$lib/components/chat/ChatWindow.svelte";
import { ERROR_MESSAGES, error } from "$lib/stores/errors";
import { pendingMessage } from "$lib/stores/pendingMessage";
import { useSettingsStore } from "$lib/stores/settings.js";
import { findCurrentModel } from "$lib/utils/models";
import { onMount } from "svelte";
export let data;
let loading = false;
Expand Down Expand Up @@ -70,6 +72,12 @@
loading = false;
}
}
onMount(() => {
// check if there's a ?q query param with a message
const query = $page.url.searchParams.get("q");
if (query) createConversation(query);
});
</script>

<svelte:head>
Expand Down
3 changes: 3 additions & 0 deletions src/routes/models/[...model]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
settings.instantSet({
activeModel: modelId,
});
const query = $page.url.searchParams.get("q");
if (query) createConversation(query);
});
</script>

Expand Down

0 comments on commit d5fc924

Please sign in to comment.