From 725ab9e5b3d9f95e04a87422f130be90f5ae8f10 Mon Sep 17 00:00:00 2001 From: cbh778899 Date: Thu, 19 Sep 2024 18:31:28 +1000 Subject: [PATCH 1/4] add edit icon alongside title Signed-off-by: cbh778899 --- src/components/chat/Conversation.jsx | 7 +++++-- src/styles/chat.css | 12 ++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/chat/Conversation.jsx b/src/components/chat/Conversation.jsx index 8abdabb..f7ba3ca 100644 --- a/src/components/chat/Conversation.jsx +++ b/src/components/chat/Conversation.jsx @@ -1,6 +1,6 @@ import { useEffect, useRef, useState } from "react"; import ConversationBubble from "./ConversationBubble"; -import { CheckCircle, FileImageFill, FileTextFill, Paperclip, Send, StopCircleFill, XCircle } from 'react-bootstrap-icons'; +import { CheckCircle, FileImageFill, FileTextFill, Paperclip, PencilFill, Send, StopCircleFill, XCircle } from 'react-bootstrap-icons'; import useIDB from "../../utils/idb"; import { isModelLoaded, loadModel } from '../../utils/workers/worker' import { getCompletionFunctions } from "../../utils/workers"; @@ -167,7 +167,10 @@ export default function Conversation({ uid, title, updateTitle, client, updateCl {setEditedTitle(title); toggleEditTitle(false)}} /> : -
toggleEditTitle(true)}>{ title }
+
toggleEditTitle(true)}> +
{ title }
+ +
}
diff --git a/src/styles/chat.css b/src/styles/chat.css index 7a056eb..2465dc3 100644 --- a/src/styles/chat.css +++ b/src/styles/chat.css @@ -152,10 +152,22 @@ font-size: 15px; font-weight: bold; color: rgb(50, 50, 50); + align-content: center; --elem-height: calc(var(--title-bar-height) - 14px); } +.chat > .conversation-main > .title-bar .display-title { + width: fit-content; + height: 100%; + display: flex; + align-items: center; +} + +.chat > .conversation-main > .title-bar .display-title > .edit-icon { + margin-left: 10px; +} + .chat > .conversation-main > .title-bar > form { display: flex; } From 1b8933422b3b04fca39403b9302632c8000d73b3 Mon Sep 17 00:00:00 2001 From: cbh778899 Date: Thu, 19 Sep 2024 18:44:31 +1000 Subject: [PATCH 2/4] adjust to max if value over max Signed-off-by: cbh778899 --- src/components/settings/components/ScrollBarComponent.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/settings/components/ScrollBarComponent.jsx b/src/components/settings/components/ScrollBarComponent.jsx index e9018cf..9de6c8d 100644 --- a/src/components/settings/components/ScrollBarComponent.jsx +++ b/src/components/settings/components/ScrollBarComponent.jsx @@ -16,6 +16,7 @@ export default function ScrollBarComponent({ cb, value, disabled, title, descrip setScrollValue(value); } else { if(!isNaN(+value)) { + if(value > max) value = max; setScrollValue(times_10 ? value * 10 : value); } setTextValue(value); @@ -23,7 +24,7 @@ export default function ScrollBarComponent({ cb, value, disabled, title, descrip } useEffect(()=>{ - !isNaN(+textValue) && checkValue() && cb(+textValue); + textValue !== value && !isNaN(+textValue) && checkValue() && cb(+textValue); // eslint-disable-next-line }, [textValue]) From ae2c7dfb76ffc701f714b3f9b91d9ba43d5ec062 Mon Sep 17 00:00:00 2001 From: cbh778899 Date: Tue, 24 Sep 2024 14:57:11 +1000 Subject: [PATCH 3/4] add Wllama related settings Signed-off-by: cbh778899 --- src/components/chat/Conversation.jsx | 5 +- src/components/settings/WllamaSettings.jsx | 76 ++++++++++++++++++++++ src/components/settings/index.jsx | 5 ++ src/utils/general_settings.js | 7 +- src/utils/workers/index.js | 5 +- src/utils/workers/worker.js | 38 +++++++++-- 6 files changed, 128 insertions(+), 8 deletions(-) create mode 100644 src/components/settings/WllamaSettings.jsx diff --git a/src/components/chat/Conversation.jsx b/src/components/chat/Conversation.jsx index f7ba3ca..83dd984 100644 --- a/src/components/chat/Conversation.jsx +++ b/src/components/chat/Conversation.jsx @@ -85,7 +85,10 @@ export default function Conversation({ uid, title, updateTitle, client, updateCl }); setPendingMessage('') } - messages = [user_msg]; + + messages = + chat_functions.current.continue_chat ? + [...conversation, user_msg] : [user_msg]; } else { let user_message = user_msg; if(upload_file) { diff --git a/src/components/settings/WllamaSettings.jsx b/src/components/settings/WllamaSettings.jsx new file mode 100644 index 0000000..da8a767 --- /dev/null +++ b/src/components/settings/WllamaSettings.jsx @@ -0,0 +1,76 @@ +import { useEffect, useState } from "react"; +import SettingSection from "./SettingSection"; +import TrueFalseComponent from "./components/TrueFalseComponent"; +import ScrollBarComponent from "./components/ScrollBarComponent"; +import { getPlatformSettings, updatePlatformSettings } from "../../utils/general_settings"; +import { loadModel, loadModelSamplingSettings } from "../../utils/workers/worker"; + +export default function WllamaSettings({ trigger, enabled }) { + + const [ threads, setThreads ] = useState(1); + const [ batch_size, setBatchSize ] = useState(256); + const [ context_length, setContextLength ] = useState(4096); + const [ continue_conv, setContinueConversation ] = useState(false); + + function saveSettings() { + updatePlatformSettings({ + wllama_threads: threads, + wllama_batch_size: batch_size, + wllama_context_length: context_length, + wllama_continue_conv: continue_conv + }) + + if(enabled) { + loadModelSamplingSettings(); + loadModel('completion'); + } + } + + useEffect(()=>{ + trigger && saveSettings(); + // eslint-disable-next-line + }, [trigger]) + + useEffect(()=>{ + const { + wllama_threads, + wllama_batch_size, + wllama_context_length, + wllama_continue_conv + } = getPlatformSettings(); + + setThreads(wllama_threads) + setBatchSize(wllama_batch_size) + setContextLength(wllama_context_length) + setContinueConversation(wllama_continue_conv) + + }, []) + + return ( + + + + + + + ) +} \ No newline at end of file diff --git a/src/components/settings/index.jsx b/src/components/settings/index.jsx index 7cd84b4..9bd1bb1 100644 --- a/src/components/settings/index.jsx +++ b/src/components/settings/index.jsx @@ -3,6 +3,7 @@ import AwsSettings from "./AwsSettings"; import { getPlatformSettings, updatePlatformSettings } from "../../utils/general_settings"; import ModelSettings from "./ModelSettings"; import OpenaiSettings from "./OpenaiSettings"; +import WllamaSettings from "./WllamaSettings"; export default function Settings() { @@ -24,6 +25,10 @@ export default function Settings() { + { cb && cb(currentText, false); From ecda9f56dd297f2700ecf6b3606300fe1c6fd7fc Mon Sep 17 00:00:00 2001 From: cbh778899 Date: Tue, 24 Sep 2024 14:57:18 +1000 Subject: [PATCH 4/4] update title Signed-off-by: cbh778899 --- src/components/settings/OpenaiSettings.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/settings/OpenaiSettings.jsx b/src/components/settings/OpenaiSettings.jsx index 4611506..0c6f2d8 100644 --- a/src/components/settings/OpenaiSettings.jsx +++ b/src/components/settings/OpenaiSettings.jsx @@ -36,7 +36,7 @@ export default function OpenaiSettings({ trigger, enabled, updateEnabled }) { }, []) return ( - +