mirror of https://github.com/langgenius/dify.git
fix: provider switch credential
This commit is contained in:
parent
9e6c846bf3
commit
ad37863183
|
|
@ -50,38 +50,34 @@ export const AuthorizedItem = ({
|
|||
|
||||
return (
|
||||
<div className='p-1'>
|
||||
{
|
||||
model && (
|
||||
<div
|
||||
className='flex h-9 items-center'
|
||||
>
|
||||
<div className='h-5 w-5 shrink-0'></div>
|
||||
<div
|
||||
className='system-md-medium mx-1 grow truncate text-text-primary'
|
||||
title={model.model}
|
||||
<div
|
||||
className='flex h-9 items-center'
|
||||
>
|
||||
<div className='h-5 w-5 shrink-0'></div>
|
||||
<div
|
||||
className='system-md-medium mx-1 grow truncate text-text-primary'
|
||||
title={title ?? model?.model}
|
||||
>
|
||||
{title ?? model?.model}
|
||||
</div>
|
||||
{
|
||||
enableAddModelCredential && (
|
||||
<Tooltip
|
||||
asChild
|
||||
popupContent={t('common.modelProvider.auth.addModelCredential')}
|
||||
>
|
||||
{title ?? model.model}
|
||||
</div>
|
||||
{
|
||||
enableAddModelCredential && (
|
||||
<Tooltip
|
||||
asChild
|
||||
popupContent={t('common.modelProvider.auth.addModelCredential')}
|
||||
>
|
||||
<Button
|
||||
className='h-6 w-6 shrink-0 rounded-full p-0'
|
||||
size='small'
|
||||
variant='secondary-accent'
|
||||
onClick={() => handleEdit?.()}
|
||||
>
|
||||
<RiAddLine className='h-4 w-4' />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
<Button
|
||||
className='h-6 w-6 shrink-0 rounded-full p-0'
|
||||
size='small'
|
||||
variant='secondary-accent'
|
||||
onClick={() => handleEdit?.()}
|
||||
>
|
||||
<RiAddLine className='h-4 w-4' />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
{
|
||||
credentials.map(credential => (
|
||||
<CredentialItem
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ type AuthorizedProps = {
|
|||
currentCustomConfigurationModelFixedFields?: CustomConfigurationModelFixedFields,
|
||||
isModelCredential?: boolean
|
||||
items: {
|
||||
title?: string
|
||||
model?: CustomModel
|
||||
credentials: Credential[]
|
||||
}[]
|
||||
|
|
@ -142,6 +143,7 @@ const Authorized = ({
|
|||
items.map((item, index) => (
|
||||
<AuthorizedItem
|
||||
key={index}
|
||||
title={item.title}
|
||||
model={item.model}
|
||||
credentials={item.credentials}
|
||||
disabled={disabled}
|
||||
|
|
|
|||
|
|
@ -67,9 +67,7 @@ const ConfigProvider = ({
|
|||
configurationMethod={ConfigurationMethodEnum.predefinedModel}
|
||||
items={[
|
||||
{
|
||||
model: {
|
||||
model: t('common.modelProvider.auth.apiKeys'),
|
||||
} as any,
|
||||
title: t('common.modelProvider.auth.apiKeys'),
|
||||
credentials: available_credentials ?? [],
|
||||
},
|
||||
]}
|
||||
|
|
|
|||
Loading…
Reference in New Issue