فهرست منبع

server : detect search query to start webchat (#6554)

Ed Lee 1 سال پیش
والد
کامیت
400d5d722d
2فایلهای تغییر یافته به همراه709 افزوده شده و 674 حذف شده
  1. 704 673
      examples/server/index.html.hpp
  2. 5 1
      examples/server/public/index.html

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 704 - 673
examples/server/index.html.hpp


+ 5 - 1
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}">

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است