fix: model selection does not show in api settings page (#1802)
This commit is contained in:
parent
9fa28d2275
commit
532a589354
@ -42,7 +42,12 @@ import {
|
|||||||
|
|
||||||
export const selectedModelAtom = atom<Model | undefined>(undefined)
|
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 activeThread = useAtomValue(activeThreadAtom)
|
||||||
const threadStates = useAtomValue(threadStatesAtom)
|
const threadStates = useAtomValue(threadStatesAtom)
|
||||||
const [selectedModel, setSelectedModel] = useAtom(selectedModelAtom)
|
const [selectedModel, setSelectedModel] = useAtom(selectedModelAtom)
|
||||||
@ -152,7 +157,7 @@ const DropdownListSidebar: React.FC = () => {
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!activeThread) {
|
if (strictedThread && !activeThread) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@ const portAtom = atom('1337')
|
|||||||
const LocalServerScreen = () => {
|
const LocalServerScreen = () => {
|
||||||
const [errorRangePort, setErrorRangePort] = useState(false)
|
const [errorRangePort, setErrorRangePort] = useState(false)
|
||||||
const [serverEnabled, setServerEnabled] = useAtom(serverEnabledAtom)
|
const [serverEnabled, setServerEnabled] = useAtom(serverEnabledAtom)
|
||||||
const showing = useAtomValue(showRightSideBarAtom)
|
const showRightSideBar = useAtomValue(showRightSideBarAtom)
|
||||||
const activeModelParams = useAtomValue(getActiveThreadModelParamsAtom)
|
const activeModelParams = useAtomValue(getActiveThreadModelParamsAtom)
|
||||||
|
|
||||||
const modelEngineParams = toSettingParams(activeModelParams)
|
const modelEngineParams = toSettingParams(activeModelParams)
|
||||||
@ -117,7 +117,7 @@ const LocalServerScreen = () => {
|
|||||||
<Button
|
<Button
|
||||||
block
|
block
|
||||||
themes={serverEnabled ? 'danger' : 'primary'}
|
themes={serverEnabled ? 'danger' : 'primary'}
|
||||||
disabled={stateModel.loading || errorRangePort}
|
disabled={stateModel.loading || errorRangePort || !selectedModel}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (serverEnabled) {
|
if (serverEnabled) {
|
||||||
window.core?.api?.stopServer()
|
window.core?.api?.stopServer()
|
||||||
@ -347,13 +347,13 @@ const LocalServerScreen = () => {
|
|||||||
<div
|
<div
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
'h-full flex-shrink-0 overflow-x-hidden border-l border-border bg-background transition-all duration-100 dark:bg-background/20',
|
'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-80 translate-x-0 opacity-100'
|
||||||
: 'w-0 translate-x-full opacity-0'
|
: 'w-0 translate-x-full opacity-0'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="px-4 pt-4">
|
<div className="px-4 pt-4">
|
||||||
<DropdownListSidebar />
|
<DropdownListSidebar strictedThread={false} />
|
||||||
|
|
||||||
{componentDataEngineSetting.filter(
|
{componentDataEngineSetting.filter(
|
||||||
(x) => x.name === 'prompt_template'
|
(x) => x.name === 'prompt_template'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user