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