From f3527df6447e9ca7cb82460f6ee4fcb79ac2678e Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 27 May 2024 13:22:24 -0700 Subject: [PATCH] refac: styling --- backend/config.py | 2 +- src/lib/components/chat/Chat.svelte | 7 +- src/lib/components/chat/MessageInput.svelte | 42 +++++----- .../chat/MessageInput/InputMenu.svelte | 80 +++++++++++++++++++ src/lib/components/common/Dropdown.svelte | 1 + .../icons/DocumentArrowUpSolid.svelte | 14 ++++ src/lib/components/icons/GlobeAltSolid.svelte | 9 +++ 7 files changed, 132 insertions(+), 23 deletions(-) create mode 100644 src/lib/components/chat/MessageInput/InputMenu.svelte create mode 100644 src/lib/components/icons/DocumentArrowUpSolid.svelte create mode 100644 src/lib/components/icons/GlobeAltSolid.svelte diff --git a/backend/config.py b/backend/config.py index 202c75b90..dfdeee732 100644 --- a/backend/config.py +++ b/backend/config.py @@ -783,7 +783,7 @@ RAG_WEB_SEARCH_ENABLED = ( or SERPER_API_KEY != "" ) -RAG_WEB_SEARCH_RESULT_COUNT = int(os.getenv("RAG_WEB_SEARCH_RESULT_COUNT", "10")) +RAG_WEB_SEARCH_RESULT_COUNT = int(os.getenv("RAG_WEB_SEARCH_RESULT_COUNT", "3")) RAG_WEB_SEARCH_CONCURRENT_REQUESTS = int( os.getenv("RAG_WEB_SEARCH_CONCURRENT_REQUESTS", "10") ) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index d237cc58c..fd6673ea4 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -65,7 +65,7 @@ let selectedModels = ['']; let atSelectedModel: Model | undefined; - let useWebSearch = false; + let webSearchEnabled = false; let chat = null; let tags = []; @@ -406,7 +406,7 @@ } responseMessage.userContext = userContext; - if (useWebSearch) { + if (webSearchEnabled) { await getWebSearchResultsAsFiles(model.id, parentId, responseMessageId); } @@ -1159,12 +1159,11 @@ bind:files bind:prompt bind:autoScroll - bind:useWebSearch + bind:webSearchEnabled bind:atSelectedModel {selectedModels} {messages} {submitPrompt} {stopResponse} - webSearchAvailable={$config?.features.enable_web_search ?? false} /> {/if} diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 310f370e7..443923ea2 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -1,7 +1,7 @@ + + { + if (e.detail === false) { + onClose(); + } + }} +> + + + + +
+ +
+
+ +
{$i18n.t('Web Search')}
+
+ + +
+ +
+ + { + uploadFilesHandler(); + }} + > + +
{$i18n.t('Upload Files')}
+
+ + +
+
+
diff --git a/src/lib/components/common/Dropdown.svelte b/src/lib/components/common/Dropdown.svelte index eaceeb3e2..4beb1d26c 100644 --- a/src/lib/components/common/Dropdown.svelte +++ b/src/lib/components/common/Dropdown.svelte @@ -10,6 +10,7 @@ { dispatch('change', state); }} diff --git a/src/lib/components/icons/DocumentArrowUpSolid.svelte b/src/lib/components/icons/DocumentArrowUpSolid.svelte new file mode 100644 index 000000000..2690f5537 --- /dev/null +++ b/src/lib/components/icons/DocumentArrowUpSolid.svelte @@ -0,0 +1,14 @@ + + + + + + diff --git a/src/lib/components/icons/GlobeAltSolid.svelte b/src/lib/components/icons/GlobeAltSolid.svelte new file mode 100644 index 000000000..7054d311f --- /dev/null +++ b/src/lib/components/icons/GlobeAltSolid.svelte @@ -0,0 +1,9 @@ + + + + +