Merge branch 'feat/plugins' of https://github.com/langgenius/dify into feat/plugins

This commit is contained in:
AkaraChen 2024-12-31 11:52:20 +08:00
commit fe5702784e
5 changed files with 27 additions and 9 deletions

View File

@ -39,6 +39,7 @@ export type AgentModelTriggerProps = {
providerName?: string
modelId?: string
hasDeprecated?: boolean
scope?: string
}
const AgentModelTrigger: FC<AgentModelTriggerProps> = ({
@ -48,6 +49,7 @@ const AgentModelTrigger: FC<AgentModelTriggerProps> = ({
providerName,
modelId,
hasDeprecated,
scope,
}) => {
const { t } = useTranslation()
const { modelProviders } = useProviderContext()
@ -136,9 +138,19 @@ const AgentModelTrigger: FC<AgentModelTriggerProps> = ({
try {
const { all_installed } = await installPackageFromMarketPlace(pluginInfo.latest_package_identifier)
if (all_installed) {
setInstalled(true)
[
ModelTypeEnum.textGeneration,
ModelTypeEnum.textEmbedding,
ModelTypeEnum.rerank,
ModelTypeEnum.moderation,
ModelTypeEnum.speech2text,
ModelTypeEnum.tts,
].forEach((type: ModelTypeEnum) => {
if (scope?.includes(type))
updateModelList(type)
})
updateModelProviders()
updateModelList(ModelTypeEnum.textGeneration)
setInstalled(true)
}
}
catch (error) {
@ -190,7 +202,7 @@ const AgentModelTrigger: FC<AgentModelTriggerProps> = ({
t={t}
/>
)}
{modelProvider && !disabled && (
{modelProvider && !disabled && !needsConfiguration && (
<div className="flex pr-1 items-center">
<RiEqualizer2Line className="w-4 h-4 text-text-tertiary group-hover:text-text-secondary" />
</div>

View File

@ -40,7 +40,7 @@ const SearchBox = ({
locale={locale}
/>
<div className='mx-1 w-[1px] h-3.5 bg-divider-regular'></div>
<div className='grow flex items-center p-1 pl-2'>
<div className='relative grow flex items-center p-1 pl-2'>
<div className='flex items-center mr-2 w-full'>
<input
className={cn(
@ -54,9 +54,11 @@ const SearchBox = ({
/>
{
search && (
<ActionButton onClick={() => onSearchChange('')}>
<RiCloseLine className='w-4 h-4' />
</ActionButton>
<div className='absolute right-2 top-1/2 -translate-y-1/2'>
<ActionButton onClick={() => onSearchChange('')}>
<RiCloseLine className='w-4 h-4' />
</ActionButton>
</div>
)
}
</div>

View File

@ -190,6 +190,7 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
currentModel={currentModel}
providerName={value?.provider}
modelId={value?.model}
scope={scope}
/>
: <Trigger
disabled={disabled}

View File

@ -74,11 +74,13 @@ const List = ({
)
}
const maxWidthClassName = 'max-w-[300px]'
return (
<>
{hasRes && (
<div
className={cn('sticky z-10 flex justify-between h-8 px-4 py-1 text-text-primary system-sm-medium cursor-pointer', stickyClassName)}
className={cn('sticky z-10 flex justify-between h-8 px-4 py-1 text-text-primary system-sm-medium cursor-pointer', stickyClassName, maxWidthClassName)}
onClick={handleHeadClick}
>
<span>{t('plugin.fromMarketplace')}</span>
@ -93,7 +95,7 @@ const List = ({
</Link>
</div>
)}
<div className='p-1' ref={nextToStickyELemRef}>
<div className={cn('p-1', maxWidthClassName)} ref={nextToStickyELemRef}>
{list.map((item, index) => (
<Item
key={index}

View File

@ -68,6 +68,7 @@ const Tabs: FC<TabsProps> = ({
{
activeTab === TabsEnum.Tools && (
<AllTools
className='w-[315px]'
searchText={searchText}
onSelect={onSelect}
tags={tags}