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