Skip to content

Commit

Permalink
updated models and only add snip tool on vision model selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Royal-lobster committed Nov 26, 2023
1 parent 008ec44 commit c34ff19
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
14 changes: 13 additions & 1 deletion src/components/Sidebar/chat/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,6 +18,7 @@ interface SidebarInputProps {
chatIsEmpty: boolean
cancelRequest: () => void
isWebpageContextOn: boolean
isVisionModel: boolean
}

const MAX_MESSAGE_LENGTH = 10000
Expand All @@ -28,6 +30,7 @@ export function SidebarInput({
chatIsEmpty,
cancelRequest,
isWebpageContextOn,
isVisionModel,
}: SidebarInputProps) {
const {
messageDraft,
Expand Down Expand Up @@ -131,7 +134,16 @@ export function SidebarInput({
}}
/>
<div className="cdx-flex cdx-justify-between cdx-items-center cdx-p-3">
<ImageCaptureButton addMessageDraftFile={addMessageDraftFile} />
{isVisionModel ? (
<ImageCaptureButton addMessageDraftFile={addMessageDraftFile} />
) : (
<div>
<MessageDraftLengthCounter
length={messageDraft.text.length}
MAX_LENGTH={MAX_MESSAGE_LENGTH}
/>
</div>
)}
<div className="cdx-flex cdx-items-center cdx-justify-center cdx-gap-4">
<WebPageContentToggle />
{!delayedLoading ? sendButton : stopButton}
Expand Down
19 changes: 19 additions & 0 deletions src/components/Sidebar/chat/MessageDraftLengthCounter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'

interface MessageDraftlengthCounterProps {
length: number
MAX_LENGTH: number
}
const MessageDraftLengthCounter = ({
length,
MAX_LENGTH,
}: MessageDraftlengthCounterProps) => {
return (
<div className="cdx-text-neutral-500">
<span>{length.toLocaleString()}</span>/
<span>{MAX_LENGTH.toLocaleString()}</span>
</div>
)
}

export default MessageDraftLengthCounter
3 changes: 2 additions & 1 deletion src/components/Sidebar/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -45,6 +45,7 @@ const Chat = ({ settings }: ChatProps) => {
clearMessages={clearMessages}
cancelRequest={cancelRequest}
isWebpageContextOn={settings.general.webpageContext}
isVisionModel={settings.chat.modal === AvailableModels.GPT_4_VISION}
/>
</>
)
Expand Down
8 changes: 3 additions & 5 deletions src/config/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c34ff19

Please sign in to comment.