From 3e47275df2f7418a01f1cc79762ae3ff4f8b54fc Mon Sep 17 00:00:00 2001 From: JasonM Date: Tue, 15 Oct 2024 21:15:02 +0700 Subject: [PATCH 1/3] Add provider filtering on model list --- app/components/chat/BaseChat.tsx | 55 ++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/app/components/chat/BaseChat.tsx b/app/components/chat/BaseChat.tsx index e3c7f5fd..2749ca41 100644 --- a/app/components/chat/BaseChat.tsx +++ b/app/components/chat/BaseChat.tsx @@ -10,6 +10,7 @@ import { classNames } from '~/utils/classNames'; import { MODEL_LIST } from '~/utils/constants'; import { Messages } from './Messages.client'; import { SendButton } from './SendButton.client'; +import { useState } from 'react'; import styles from './BaseChat.module.scss'; @@ -21,6 +22,40 @@ const EXAMPLE_PROMPTS = [ { text: 'How do I center a div?' }, ]; +const providerList = [...new Set(MODEL_LIST.map((model) => model.provider))] + +const ModelSelector = ({ model, setModel, modelList, providerList }) => { + const [provider, setProvider] = useState(null); + return ( +
+ + +
+ ) +} + const TEXTAREA_MIN_HEIGHT = 76; interface BaseChatProps { @@ -110,20 +145,12 @@ export const BaseChat = React.forwardRef( 'sticky bottom-0': chatStarted, })} > - {/* Model selection dropdown */} -
- -
+
Date: Tue, 15 Oct 2024 21:28:36 +0700 Subject: [PATCH 2/3] Set default provider from constants --- app/components/chat/BaseChat.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/components/chat/BaseChat.tsx b/app/components/chat/BaseChat.tsx index 2749ca41..abfdaa57 100644 --- a/app/components/chat/BaseChat.tsx +++ b/app/components/chat/BaseChat.tsx @@ -7,7 +7,7 @@ import { Menu } from '~/components/sidebar/Menu.client'; import { IconButton } from '~/components/ui/IconButton'; import { Workbench } from '~/components/workbench/Workbench.client'; import { classNames } from '~/utils/classNames'; -import { MODEL_LIST } from '~/utils/constants'; +import { MODEL_LIST, DEFAULT_PROVIDER } from '~/utils/constants'; import { Messages } from './Messages.client'; import { SendButton } from './SendButton.client'; import { useState } from 'react'; @@ -25,7 +25,7 @@ const EXAMPLE_PROMPTS = [ const providerList = [...new Set(MODEL_LIST.map((model) => model.provider))] const ModelSelector = ({ model, setModel, modelList, providerList }) => { - const [provider, setProvider] = useState(null); + const [provider, setProvider] = useState(DEFAULT_PROVIDER); return (