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

This commit is contained in:
Yi 2024-11-01 15:40:06 +08:00
commit 40e171c2c6
6 changed files with 27 additions and 12 deletions

View File

@ -91,7 +91,7 @@ const AgentTools: FC = () => {
provider_name: tool.provider_name,
tool_name: tool.tool_name,
tool_label: tool.tool_label,
tool_parameters: {},
tool_parameters: tool.params,
enabled: true,
})
})

View File

@ -46,7 +46,7 @@ const KeyValueItem: FC<Props> = ({
<div className='flex items-center gap-1'>
<span className={cn('flex flex-col justify-center items-start text-text-tertiary system-xs-medium', labelWidthClassName)}>{label}</span>
<div className='flex justify-center items-center gap-0.5'>
<span className='max-w-[300px] truncate system-xs-medium text-text-secondary'>
<span className='max-w-[162px] truncate system-xs-medium text-text-secondary'>
{value}
</span>
<Tooltip popupContent={t(`common.operation.${isCopied ? 'copied' : 'copy'}`)} position='top'>

View File

@ -44,14 +44,16 @@ const PluginsPanel = () => {
<List pluginList={filteredList} />
</div>
</div>
<PluginDetailPanel
pluginDetail={currentPluginDetail}
endpointList={currentPluginEndpoints}
onHide={() => {
setCurrentPluginDetail(undefined)
setCurrentEndpoints([])
}}
/>
{false && (
<PluginDetailPanel
pluginDetail={currentPluginDetail}
endpointList={currentPluginEndpoints}
onHide={() => {
setCurrentPluginDetail(undefined)
setCurrentEndpoints([])
}}
/>
)}
</>
)
}

View File

@ -10,14 +10,12 @@ import { useGetLanguage } from '@/context/i18n'
import BlockIcon from '../../block-icon'
type Props = {
className?: string
provider: ToolWithProvider
payload: Tool
onSelect: (type: BlockEnum, tool?: ToolDefaultValue) => void
}
const ToolItem: FC<Props> = ({
className,
provider,
payload,
onSelect,
@ -46,6 +44,12 @@ const ToolItem: FC<Props> = ({
key={payload.name}
className='rounded-lg pl-[21px] hover:bg-state-base-hover cursor-pointer'
onClick={() => {
const params: Record<string, string> = {}
if (payload.parameters) {
payload.parameters.forEach((item) => {
params[item.name] = ''
})
}
onSelect(BlockEnum.Tool, {
provider_id: provider.id,
provider_type: provider.type,
@ -53,6 +57,7 @@ const ToolItem: FC<Props> = ({
tool_name: payload.name,
tool_label: payload.label[language],
title: payload.label[language],
params,
})
}}
>

View File

@ -66,6 +66,12 @@ const Tool: FC<Props> = ({
toggleFold()
return
}
// TODO: get workflow and custom tool params
// if (payload.parameters) {
// payload.parameters.forEach((item) => {
// params[item.name] = ''
// })
// }
onSelect(BlockEnum.Tool, {
provider_id: payload.id,
provider_type: payload.type,
@ -73,6 +79,7 @@ const Tool: FC<Props> = ({
tool_name: payload.name,
tool_label: payload.label[language],
title: payload.label[language],
params: {},
})
}}
>

View File

@ -25,4 +25,5 @@ export type ToolDefaultValue = {
tool_name: string
tool_label: string
title: string
params: Record<string, any>
}