fix: model selection does not show in api settings page (#1802)

This commit is contained in:
Louis 2024-01-26 18:57:52 +07:00 committed by GitHub
parent 9fa28d2275
commit 532a589354
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View File

@ -42,7 +42,12 @@ import {
export const selectedModelAtom = atom<Model | undefined>(undefined)
const DropdownListSidebar: React.FC = () => {
// TODO: Move all of the unscoped logics outside of the component
const DropdownListSidebar = ({
strictedThread = true,
}: {
strictedThread?: boolean
}) => {
const activeThread = useAtomValue(activeThreadAtom)
const threadStates = useAtomValue(threadStatesAtom)
const [selectedModel, setSelectedModel] = useAtom(selectedModelAtom)
@ -152,7 +157,7 @@ const DropdownListSidebar: React.FC = () => {
]
)
if (!activeThread) {
if (strictedThread && !activeThread) {
return null
}

View File

@ -59,7 +59,7 @@ const portAtom = atom('1337')
const LocalServerScreen = () => {
const [errorRangePort, setErrorRangePort] = useState(false)
const [serverEnabled, setServerEnabled] = useAtom(serverEnabledAtom)
const showing = useAtomValue(showRightSideBarAtom)
const showRightSideBar = useAtomValue(showRightSideBarAtom)
const activeModelParams = useAtomValue(getActiveThreadModelParamsAtom)
const modelEngineParams = toSettingParams(activeModelParams)
@ -117,7 +117,7 @@ const LocalServerScreen = () => {
<Button
block
themes={serverEnabled ? 'danger' : 'primary'}
disabled={stateModel.loading || errorRangePort}
disabled={stateModel.loading || errorRangePort || !selectedModel}
onClick={() => {
if (serverEnabled) {
window.core?.api?.stopServer()
@ -347,13 +347,13 @@ const LocalServerScreen = () => {
<div
className={twMerge(
'h-full flex-shrink-0 overflow-x-hidden border-l border-border bg-background transition-all duration-100 dark:bg-background/20',
showing
showRightSideBar
? 'w-80 translate-x-0 opacity-100'
: 'w-0 translate-x-full opacity-0'
)}
>
<div className="px-4 pt-4">
<DropdownListSidebar />
<DropdownListSidebar strictedThread={false} />
{componentDataEngineSetting.filter(
(x) => x.name === 'prompt_template'