diff --git a/src/home/chat-window/text-area.tsx b/src/home/chat-window/text-area.tsx index 1647891..7d7a5cf 100644 --- a/src/home/chat-window/text-area.tsx +++ b/src/home/chat-window/text-area.tsx @@ -4,14 +4,13 @@ import {appState, Chat} from "../../state/app-state.ts" import {controlState, SendMessageOption} from "../../state/control-state.ts" import {cx} from "../../util/util.tsx" import {searchLinuxTerminalHistoryPotision} from "../../data-structure/message.tsx"; -import {matchKeyComobo} from "../../state/shortcuts.ts"; +import {bestModel, matchKeyCombo} from "../../state/shortcuts.ts"; import IosSpinner from "../../assets/svg/ios-spinner.svg?react" type Props = { chatProxy: Chat } -const bestModel = "gpt-4-1106-preview" const largeTextAreaMinHeight = "min-h-96" const smallTextAreaMinHeight = "min-h-24" @@ -108,7 +107,7 @@ const TextArea: React.FC = ({chatProxy}) => { } } else { const sc = appState.pref.shortcuts - if (matchKeyComobo(sc.newLine, event)) { + if (matchKeyCombo(sc.newLine, event)) { if (event.key === 'Enter' && !event.ctrlKey && !event.metaKey && !event.altKey) { // try our best to use native 'new-line', in order to preserve edit stack(ctrl/cmd + z) } else { @@ -121,16 +120,16 @@ const TextArea: React.FC = ({chatProxy}) => { target.value.slice(caretPosition); setTimeout(() => target.selectionStart = target.selectionEnd = caretPosition + 1) } - } else if (matchKeyComobo(sc.send, event)) { + } else if (matchKeyCombo(sc.send, event)) { sendAndClearText() event.preventDefault() - } else if (matchKeyComobo(sc.sendWithBestModel, event)) { + } else if (matchKeyCombo(sc.sendWithBestModel, event)) { sendAndClearText({model: bestModel}) event.preventDefault() - } else if (matchKeyComobo(sc.sendZeroAttachedMessage, event)) { + } else if (matchKeyCombo(sc.sendZeroAttachedMessage, event)) { sendAndClearText({ignoreAttachedMessage: true}) event.preventDefault() - } else if (matchKeyComobo(sc.sendWithBestModelAndZeroAttachedMessage, event)) { + } else if (matchKeyCombo(sc.sendWithBestModelAndZeroAttachedMessage, event)) { sendAndClearText({ ignoreAttachedMessage: true, model: bestModel diff --git a/src/state/shortcuts.ts b/src/state/shortcuts.ts index 33bba8a..b1cb506 100644 --- a/src/state/shortcuts.ts +++ b/src/state/shortcuts.ts @@ -32,19 +32,21 @@ export const defaultShortcuts = (): Shortcuts => ({ mKeys: ["Control"] }, sendWithBestModel: { - name: "Send with gpt-4-1106-preview model", + name: `Send with ${bestModel} model`, key: "Enter", mKeys: ["Meta"] }, sendWithBestModelAndZeroAttachedMessage: { - name: "Send with gpt-4-1106-preview model and 0 attached message", + name: `Send with ${bestModel} model and 0 attached message`, key: "Enter", mKeys: ["Meta", "Control"] } }) +export const bestModel = "gpt-4-turbo-preview" + const mods: ModifierKey[] = ["Meta", "Control", "Alt", "Shift"] -export const matchKeyComobo = (keyCombo: KeyCombo, e: React.KeyboardEvent): boolean => { +export const matchKeyCombo = (keyCombo: KeyCombo, e: React.KeyboardEvent): boolean => { if (e.key !== keyCombo.key) { return false } diff --git a/yarn.lock b/yarn.lock index 83212e6..e4c25af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2320,7 +2320,7 @@ postcss-value-parser@^4.0.0, postcss-value-parser@^4.2.0: postcss@8.4.32: version "8.4.32" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.32.tgz#1dac6ac51ab19adb21b8b34fd2d93a86440ef6c9" + resolved "https://registry.npmmirror.com/postcss/-/postcss-8.4.32.tgz#1dac6ac51ab19adb21b8b34fd2d93a86440ef6c9" integrity sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw== dependencies: nanoid "^3.3.7"