fix: dropdown modal list is empty
This commit is contained in:
parent
f5852d9b75
commit
b4433e03a4
@ -14,16 +14,18 @@ const Navigation: FC<Props> = ({ activeAssistant }) => {
|
||||
const providers = useProviders()
|
||||
const { model, setModel } = useAssistant(activeAssistant.id)
|
||||
|
||||
const items: MenuProps['items'] = providers.map((p) => ({
|
||||
key: p.id,
|
||||
label: p.name,
|
||||
type: 'group',
|
||||
children: p.models.map((m) => ({
|
||||
key: m.id,
|
||||
label: m.name,
|
||||
onClick: () => setModel(m)
|
||||
const items: MenuProps['items'] = providers
|
||||
.filter((p) => p.models.length > 0)
|
||||
.map((p) => ({
|
||||
key: p.id,
|
||||
label: p.name,
|
||||
type: 'group',
|
||||
children: p.models.map((m) => ({
|
||||
key: m.id,
|
||||
label: m.name,
|
||||
onClick: () => setModel(m)
|
||||
}))
|
||||
}))
|
||||
}))
|
||||
|
||||
return (
|
||||
<NavbarCenter style={{ border: 'none' }}>
|
||||
|
||||
@ -11,6 +11,14 @@ const ModelSettings: FC = () => {
|
||||
const providers = useProviders()
|
||||
const allModels = providers.map((p) => p.models).flat()
|
||||
|
||||
const selectOptions = providers
|
||||
.filter((p) => p.models.length > 0)
|
||||
.map((p) => ({
|
||||
label: p.name,
|
||||
title: p.name,
|
||||
options: p.models.map((m) => ({ label: m.name, value: m.id }))
|
||||
}))
|
||||
|
||||
return (
|
||||
<SettingContainer>
|
||||
<SettingTitle>Default Assistant Model</SettingTitle>
|
||||
@ -19,14 +27,7 @@ const ModelSettings: FC = () => {
|
||||
defaultValue={defaultModel.id}
|
||||
style={{ width: 200 }}
|
||||
onChange={(id) => setDefaultModel(find(allModels, { id }) as Model)}
|
||||
options={providers.map((p) => ({
|
||||
label: p.name,
|
||||
title: p.name,
|
||||
options: p.models.map((m) => ({
|
||||
label: m.name,
|
||||
value: m.id
|
||||
}))
|
||||
}))}
|
||||
options={selectOptions}
|
||||
/>
|
||||
<div style={{ height: 40 }} />
|
||||
<SettingTitle>Topic Naming Model</SettingTitle>
|
||||
@ -35,14 +36,7 @@ const ModelSettings: FC = () => {
|
||||
defaultValue={topicNamingModel.id}
|
||||
style={{ width: 200 }}
|
||||
onChange={(id) => setTopicNamingModel(find(allModels, { id }) as Model)}
|
||||
options={providers.map((p) => ({
|
||||
label: p.name,
|
||||
title: p.name,
|
||||
options: p.models.map((m) => ({
|
||||
label: m.name,
|
||||
value: m.id
|
||||
}))
|
||||
}))}
|
||||
options={selectOptions}
|
||||
/>
|
||||
</SettingContainer>
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user