From 615d30e3dce92a9993b0e93b044faadf228529b1 Mon Sep 17 00:00:00 2001
From: Nate Sesti <sestinj@gmail.com>
Date: Mon, 28 Aug 2023 23:33:23 -0700
Subject: fix: :bug: allow end/home keys to work

---
 extension/react-app/src/components/ModelSelect.tsx | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

(limited to 'extension/react-app/src/components/ModelSelect.tsx')

diff --git a/extension/react-app/src/components/ModelSelect.tsx b/extension/react-app/src/components/ModelSelect.tsx
index 9134cd7d..ea979da7 100644
--- a/extension/react-app/src/components/ModelSelect.tsx
+++ b/extension/react-app/src/components/ModelSelect.tsx
@@ -92,8 +92,7 @@ const Select = styled.select`
 function ModelSelect(props: {}) {
   const client = useContext(GUIClientContext);
   const defaultModel = useSelector(
-    (state: RootStore) =>
-      (state.serverState.config as any)?.models?.default?.class_name
+    (state: RootStore) => (state.serverState.config as any)?.models?.default
   );
 
   return (
@@ -106,7 +105,14 @@ function ModelSelect(props: {}) {
     >
       {MODEL_INFO.map((model, idx) => {
         return (
-          <option selected={defaultModel === model.class} value={idx}>
+          <option
+            selected={
+              defaultModel?.class_name === model.class &&
+              (!defaultModel?.model?.startsWith("gpt") ||
+                defaultModel?.model === model.args.model)
+            }
+            value={idx}
+          >
             {model.title}
           </option>
         );
-- 
cgit v1.2.3-70-g09d2

