mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 10:28:10 +08:00
feat(trigger): add API endpoint to retrieve trigger plugin icons and enhance workflow response handling
- Introduced `TriggerProviderIconApi` to fetch icons for trigger plugins based on tenant and provider ID. - Updated `WorkflowResponseConverter` to include trigger plugin icons in the response. - Implemented `get_trigger_plugin_icon` method in `TriggerManager` for icon retrieval logic. - Adjusted `Node` class to correctly set provider information for trigger plugins. - Modified TypeScript types to accommodate new provider ID field in workflow nodes.
This commit is contained in:
@ -7,7 +7,6 @@ import type { TestRunOptions, TriggerOption } from '../header/test-run-menu'
|
||||
import { TriggerAll } from '@/app/components/base/icons/src/vender/workflow'
|
||||
import BlockIcon from '../block-icon'
|
||||
import { useStore } from '../store'
|
||||
import { canFindTool } from '@/utils'
|
||||
import { useAllTriggerPlugins } from '@/service/use-triggers'
|
||||
|
||||
export const useDynamicTestRunOptions = (): TestRunOptions => {
|
||||
@ -74,18 +73,18 @@ export const useDynamicTestRunOptions = (): TestRunOptions => {
|
||||
})
|
||||
}
|
||||
else if (nodeData.type === BlockEnum.TriggerPlugin) {
|
||||
let toolIcon: string | any
|
||||
let triggerIcon: string | any
|
||||
|
||||
if (nodeData.provider_id) {
|
||||
const targetTools = triggerPlugins || []
|
||||
toolIcon = targetTools.find(toolWithProvider => canFindTool(toolWithProvider.id, nodeData.provider_id!))?.icon
|
||||
const targetTriggers = triggerPlugins || []
|
||||
triggerIcon = targetTriggers.find(toolWithProvider => toolWithProvider.name === nodeData.provider_id)?.icon
|
||||
}
|
||||
|
||||
const icon = (
|
||||
<BlockIcon
|
||||
type={BlockEnum.TriggerPlugin}
|
||||
size='md'
|
||||
toolIcon={toolIcon}
|
||||
toolIcon={triggerIcon}
|
||||
/>
|
||||
)
|
||||
|
||||
|
||||
@ -104,6 +104,7 @@ export type CommonNodeType<T = {}> = {
|
||||
default_value?: DefaultValueForm[]
|
||||
credential_id?: string
|
||||
subscription_id?: string
|
||||
provider_id?: string
|
||||
_dimmed?: boolean
|
||||
} & T & Partial<PluginDefaultValue>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user