From 05221ea1355165b44b44f1bc6676992c5bb011a3 Mon Sep 17 00:00:00 2001 From: Firat Birlik Date: Sun, 3 Mar 2024 13:58:51 -0600 Subject: [PATCH 01/25] add fake_useragent to get a realistic header for rag/web requests --- backend/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/requirements.txt b/backend/requirements.txt index 0cacacd800..6d3d044dcf 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -22,6 +22,7 @@ google-generativeai langchain langchain-community +fake_useragent chromadb sentence_transformers pypdf From cc471597cdde23cfa0272b5761d5d149fb24bd32 Mon Sep 17 00:00:00 2001 From: Carlos Daniel Vilaseca Date: Sun, 3 Mar 2024 17:03:03 -0500 Subject: [PATCH 02/25] rf: message input dom queries --- src/lib/components/chat/MessageInput.svelte | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 022ee4fb4d..438d700c7b 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -19,7 +19,7 @@ export let suggestionPrompts = []; export let autoScroll = true; - + let chatTextArea:HTMLTextAreaElement let filesInputElement; let promptsElement; @@ -43,11 +43,9 @@ let speechRecognition; $: if (prompt) { - const chatInput = document.getElementById('chat-textarea'); - - if (chatInput) { - chatInput.style.height = ''; - chatInput.style.height = Math.min(chatInput.scrollHeight, 200) + 'px'; + if (chatTextArea) { + chatTextArea.style.height = ''; + chatTextArea.style.height = Math.min(chatTextArea.scrollHeight, 200) + 'px'; } } @@ -86,9 +84,7 @@ if (res) { prompt = res.text; await tick(); - - const inputElement = document.getElementById('chat-textarea'); - inputElement?.focus(); + chatTextArea?.focus(); if (prompt !== '' && $settings?.speechAutoSend === true) { submitPrompt(prompt, user); @@ -191,8 +187,7 @@ prompt = `${prompt}${transcript}`; await tick(); - const inputElement = document.getElementById('chat-textarea'); - inputElement?.focus(); + chatTextArea?.focus(); // Restart the inactivity timeout timeoutId = setTimeout(() => { @@ -294,8 +289,7 @@ }; onMount(() => { - const chatInput = document.getElementById('chat-textarea'); - window.setTimeout(() => chatInput?.focus(), 0); + window.setTimeout(() => chatTextArea?.focus(), 0); const dropZone = document.querySelector('body'); @@ -663,6 +657,7 @@