diff options
author | Ed Lee <edilee@mozilla.com> | 2024-04-09 01:31:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-09 10:31:47 +0200 |
commit | 400d5d722d7edf7de0cf24a18c42b183c65047d2 (patch) | |
tree | 757ca927e5fd62bef10917622b4fa055b88b4248 /examples/server/public | |
parent | 5dc9dd7152dedc6046b646855585bd070c91e8c8 (diff) |
server : detect search query to start webchat (#6554)
Diffstat (limited to 'examples/server/public')
-rw-r--r-- | examples/server/public/index.html | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/server/public/index.html b/examples/server/public/index.html index c91a357c..9fe61eb1 100644 --- a/examples/server/public/index.html +++ b/examples/server/public/index.html @@ -406,7 +406,7 @@ throw new Error("already running"); } controller.value = new AbortController(); - for await (const chunk of llama(prompt, llamaParams, { controller: controller.value, api_url: document.baseURI.replace(/\/+$/, '') })) { + for await (const chunk of llama(prompt, llamaParams, { controller: controller.value, api_url: location.pathname.replace(/\/+$/, '') })) { const data = chunk.data; if (data.stop) { @@ -1015,6 +1015,10 @@ } function App(props) { + useEffect(() => { + const query = new URLSearchParams(location.search).get("q"); + if (query) chat(query); + }, []); return html` <div class="mode-${session.value.type}"> |