mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-08 14:29:15 +08:00
feat: improved model validation and error handling
This commit is contained in:
parent
a6795289da
commit
8eac836e05
@ -68,6 +68,9 @@ const PopupContainer: React.FC<Props> = ({ provider: _provider, resolve }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onAddModel = (model: Model) => {
|
const onAddModel = (model: Model) => {
|
||||||
|
if (isEmpty(model.name)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
addModel(model)
|
addModel(model)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +95,7 @@ const PopupContainer: React.FC<Props> = ({ provider: _provider, resolve }) => {
|
|||||||
description: model?.description,
|
description: model?.description,
|
||||||
owned_by: model?.owned_by
|
owned_by: model?.owned_by
|
||||||
}))
|
}))
|
||||||
.filter((model) => !isEmpty(model.id))
|
.filter((model) => !isEmpty(model.name))
|
||||||
)
|
)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -151,7 +154,7 @@ const PopupContainer: React.FC<Props> = ({ provider: _provider, resolve }) => {
|
|||||||
<ListItem key={model.id}>
|
<ListItem key={model.id}>
|
||||||
<ListItemHeader>
|
<ListItemHeader>
|
||||||
<Avatar src={getModelLogo(model.id)} size={24}>
|
<Avatar src={getModelLogo(model.id)} size={24}>
|
||||||
{model.name[0].toUpperCase()}
|
{model?.name?.[0]?.toUpperCase()}
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<ListItemName>
|
<ListItemName>
|
||||||
<Tooltip title={model.id} placement="top">
|
<Tooltip title={model.id} placement="top">
|
||||||
|
|||||||
@ -279,9 +279,9 @@ const ProviderSetting: FC<Props> = ({ provider: _provider }) => {
|
|||||||
<ModelListItem key={model.id}>
|
<ModelListItem key={model.id}>
|
||||||
<ModelListHeader>
|
<ModelListHeader>
|
||||||
<Avatar src={getModelLogo(model.id)} size={22} style={{ marginRight: '8px' }}>
|
<Avatar src={getModelLogo(model.id)} size={22} style={{ marginRight: '8px' }}>
|
||||||
{model.name[0].toUpperCase()}
|
{model?.name?.[0]?.toUpperCase()}
|
||||||
</Avatar>
|
</Avatar>
|
||||||
{model.name}
|
{model?.name}
|
||||||
<ModelTags model={model} />
|
<ModelTags model={model} />
|
||||||
<Popover content={modelTypeContent(model)} title={t('models.type.select')} trigger="click">
|
<Popover content={modelTypeContent(model)} title={t('models.type.select')} trigger="click">
|
||||||
<SettingIcon />
|
<SettingIcon />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user