From c34ff19b79947b93b03294d0555f25d287a4e690 Mon Sep 17 00:00:00 2001 From: Srujan Gurram Date: Sun, 26 Nov 2023 15:17:46 +0530 Subject: [PATCH] updated models and only add snip tool on vision model selection --- src/components/Sidebar/chat/ChatInput.tsx | 14 +++++++++++++- .../chat/MessageDraftLengthCounter.tsx | 19 +++++++++++++++++++ src/components/Sidebar/chat/index.tsx | 3 ++- src/config/settings/index.ts | 8 +++----- 4 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 src/components/Sidebar/chat/MessageDraftLengthCounter.tsx diff --git a/src/components/Sidebar/chat/ChatInput.tsx b/src/components/Sidebar/chat/ChatInput.tsx index d4871a2d..21aef06a 100644 --- a/src/components/Sidebar/chat/ChatInput.tsx +++ b/src/components/Sidebar/chat/ChatInput.tsx @@ -9,6 +9,7 @@ import WebPageContentToggle from './WebPageContentToggle' import ImageCaptureButton from './ImageCaptureButton' import { useMessageDraft } from '../../../hooks/useMessageDraft' import FilePreviewBar from './FilePreviewBar' +import MessageDraftLengthCounter from './MessageDraftLengthCounter' interface SidebarInputProps { loading: boolean @@ -17,6 +18,7 @@ interface SidebarInputProps { chatIsEmpty: boolean cancelRequest: () => void isWebpageContextOn: boolean + isVisionModel: boolean } const MAX_MESSAGE_LENGTH = 10000 @@ -28,6 +30,7 @@ export function SidebarInput({ chatIsEmpty, cancelRequest, isWebpageContextOn, + isVisionModel, }: SidebarInputProps) { const { messageDraft, @@ -131,7 +134,16 @@ export function SidebarInput({ }} />
- + {isVisionModel ? ( + + ) : ( +
+ +
+ )}
{!delayedLoading ? sendButton : stopButton} diff --git a/src/components/Sidebar/chat/MessageDraftLengthCounter.tsx b/src/components/Sidebar/chat/MessageDraftLengthCounter.tsx new file mode 100644 index 00000000..6e2ccc51 --- /dev/null +++ b/src/components/Sidebar/chat/MessageDraftLengthCounter.tsx @@ -0,0 +1,19 @@ +import React from 'react' + +interface MessageDraftlengthCounterProps { + length: number + MAX_LENGTH: number +} +const MessageDraftLengthCounter = ({ + length, + MAX_LENGTH, +}: MessageDraftlengthCounterProps) => { + return ( +
+ {length.toLocaleString()}/ + {MAX_LENGTH.toLocaleString()} +
+ ) +} + +export default MessageDraftLengthCounter diff --git a/src/components/Sidebar/chat/index.tsx b/src/components/Sidebar/chat/index.tsx index ee69ca2c..a8547b62 100644 --- a/src/components/Sidebar/chat/index.tsx +++ b/src/components/Sidebar/chat/index.tsx @@ -3,7 +3,7 @@ import ChatList from './ChatList' import { SidebarInput } from './ChatInput' import { useChatCompletion } from '../../../hooks/useChatCompletion' import { SYSTEM_PROMPT } from '../../../config/prompts' -import { Settings } from '../../../config/settings' +import { AvailableModels, Settings } from '../../../config/settings' interface ChatProps { settings: Settings @@ -45,6 +45,7 @@ const Chat = ({ settings }: ChatProps) => { clearMessages={clearMessages} cancelRequest={cancelRequest} isWebpageContextOn={settings.general.webpageContext} + isVisionModel={settings.chat.modal === AvailableModels.GPT_4_VISION} /> ) diff --git a/src/config/settings/index.ts b/src/config/settings/index.ts index c335af5b..16ec7be2 100644 --- a/src/config/settings/index.ts +++ b/src/config/settings/index.ts @@ -7,12 +7,10 @@ export enum ThemeOptions { } export enum AvailableModels { + GPT_4_VISION = 'gpt-4-vision-preview', + GPT_4_TURBO = 'gpt-4-1106-preview', GPT_4 = 'gpt-4', - GPT_4_0314 = 'gpt-4-0314', - GPT_4_32K = 'gpt-4-32k', - GPT_4_32K_0314 = 'gpt-4-32k-0314', - GPT_3_5_TURBO = 'gpt-3.5-turbo', - GPT_3_5_TURBO_0301 = 'gpt-3.5-turbo-0301', + GPT_3_5_TURBO = 'gpt-3.5-turbo-1106', } export enum Mode {