feat: add install options for model configuration
parent
0c5101fb3c
commit
ba16cbccf0
@ -0,0 +1,27 @@
|
|||||||
|
import Button from '../button'
|
||||||
|
import { RiInstallLine, RiLoader2Line } from '@remixicon/react'
|
||||||
|
|
||||||
|
type InstallButtonProps = {
|
||||||
|
loading: boolean
|
||||||
|
onInstall: () => void
|
||||||
|
t: any
|
||||||
|
}
|
||||||
|
|
||||||
|
const InstallButton = ({ loading, onInstall, t }: InstallButtonProps) => {
|
||||||
|
return (
|
||||||
|
<Button size='small' className='z-[100]' onClick={onInstall}>
|
||||||
|
<div className={`flex px-[3px] justify-center items-center gap-1
|
||||||
|
${loading ? 'text-components-button-secondary-text-disabled' : 'text-components-button-secondary-text'}
|
||||||
|
system-xs-medium`}
|
||||||
|
>
|
||||||
|
{loading ? t('workflow.nodes.agent.pluginInstaller.installing') : t('workflow.nodes.agent.pluginInstaller.install')}
|
||||||
|
</div>
|
||||||
|
{loading
|
||||||
|
? <RiLoader2Line className='w-3.5 h-3.5 text-text-quaternary' />
|
||||||
|
: <RiInstallLine className='w-3.5 h-3.5 text-text-secondary' />
|
||||||
|
}
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default InstallButton
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
import Button from '@/app/components/base/button'
|
||||||
|
import { ConfigurationMethodEnum } from '../declarations'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
|
type ConfigurationButtonProps = {
|
||||||
|
modelProvider: any
|
||||||
|
handleOpenModal: any
|
||||||
|
}
|
||||||
|
|
||||||
|
const ConfigurationButton = ({ modelProvider, handleOpenModal }: ConfigurationButtonProps) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
className="z-[100]"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
handleOpenModal(modelProvider, ConfigurationMethodEnum.predefinedModel, undefined)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="flex px-[3px] justify-center items-center gap-1">
|
||||||
|
{t('workflow.nodes.agent.notAuthorized')}
|
||||||
|
</div>
|
||||||
|
<div className="flex w-[14px] h-[14px] justify-center items-center">
|
||||||
|
<div className="w-2 h-2 shrink-0 rounded-[3px] border border-components-badge-status-light-warning-border-inner
|
||||||
|
bg-components-badge-status-light-warning-bg shadow-components-badge-status-light-warning-halo" />
|
||||||
|
</div>
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ConfigurationButton
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import ModelName from '../model-name'
|
||||||
|
|
||||||
|
type ModelDisplayProps = {
|
||||||
|
currentModel: any
|
||||||
|
modelId: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const ModelDisplay = ({ currentModel, modelId }: ModelDisplayProps) => {
|
||||||
|
return currentModel ? (
|
||||||
|
<ModelName
|
||||||
|
className="flex px-1 py-[3px] items-center gap-1 grow"
|
||||||
|
modelItem={currentModel}
|
||||||
|
showMode
|
||||||
|
showFeatures
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="flex py-[3px] px-1 items-center gap-1 grow opacity-50 truncate">
|
||||||
|
<div className="text-components-input-text-filled text-ellipsis overflow-hidden system-sm-regular">
|
||||||
|
{modelId}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ModelDisplay
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
import Tooltip from '@/app/components/base/tooltip'
|
||||||
|
import { RiErrorWarningFill } from '@remixicon/react'
|
||||||
|
|
||||||
|
type StatusIndicatorsProps = {
|
||||||
|
needsConfiguration: boolean
|
||||||
|
modelProvider: boolean
|
||||||
|
disabled: boolean
|
||||||
|
pluginInfo: any
|
||||||
|
t: any
|
||||||
|
}
|
||||||
|
|
||||||
|
const StatusIndicators = ({ needsConfiguration, modelProvider, disabled, pluginInfo, t }: StatusIndicatorsProps) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{!needsConfiguration && modelProvider && disabled && (
|
||||||
|
<Tooltip
|
||||||
|
popupContent={t('workflow.nodes.agent.modelSelectorTooltips.deprecated')}
|
||||||
|
asChild={false}
|
||||||
|
>
|
||||||
|
<RiErrorWarningFill className='w-4 h-4 text-text-destructive' />
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
{!modelProvider && !pluginInfo && (
|
||||||
|
<Tooltip
|
||||||
|
popupContent={
|
||||||
|
<div className='flex w-[240px] max-w-[240px] gap-1 flex-col px-1 py-1.5'>
|
||||||
|
<div className='text-text-primary title-xs-semi-bold'>{t('workflow.nodes.agent.modelNotInMarketplace.title')}</div>
|
||||||
|
<div className='min-w-[200px] text-text-secondary body-xs-regular'>
|
||||||
|
{t('workflow.nodes.agent.modelNotInMarketplace.desc')}
|
||||||
|
</div>
|
||||||
|
<div className='text-text-accent body-xs-regular'>{t('workflow.nodes.agent.modelNotInMarketplace.manageInPlugins')}</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
asChild={false}
|
||||||
|
needsDelay
|
||||||
|
>
|
||||||
|
<RiErrorWarningFill className='w-4 h-4 text-text-destructive' />
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StatusIndicators
|
||||||
Loading…
Reference in New Issue