mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
Remove workflow features button (#24085)
This commit is contained in:
@ -1,60 +0,0 @@
|
||||
import {
|
||||
memo,
|
||||
useCallback,
|
||||
} from 'react'
|
||||
import { useNodes } from 'reactflow'
|
||||
import { useStore } from './store'
|
||||
import {
|
||||
useIsChatMode,
|
||||
useNodesReadOnly,
|
||||
useNodesSyncDraft,
|
||||
} from './hooks'
|
||||
import { type CommonNodeType, type InputVar, InputVarType, type Node } from './types'
|
||||
import useConfig from './nodes/start/use-config'
|
||||
import type { StartNodeType } from './nodes/start/types'
|
||||
import type { PromptVariable } from '@/models/debug'
|
||||
import NewFeaturePanel from '@/app/components/base/features/new-feature-panel'
|
||||
|
||||
const Features = () => {
|
||||
const setShowFeaturesPanel = useStore(s => s.setShowFeaturesPanel)
|
||||
const isChatMode = useIsChatMode()
|
||||
const { nodesReadOnly } = useNodesReadOnly()
|
||||
const { handleSyncWorkflowDraft } = useNodesSyncDraft()
|
||||
const nodes = useNodes<CommonNodeType>()
|
||||
|
||||
const startNode = nodes.find(node => node.data.type === 'start')
|
||||
const { id, data } = startNode as Node<StartNodeType>
|
||||
const { handleAddVariable } = useConfig(id, data)
|
||||
|
||||
const handleAddOpeningStatementVariable = (variables: PromptVariable[]) => {
|
||||
const newVariable = variables[0]
|
||||
const startNodeVariable: InputVar = {
|
||||
variable: newVariable.key,
|
||||
label: newVariable.name,
|
||||
type: InputVarType.textInput,
|
||||
max_length: newVariable.max_length,
|
||||
required: newVariable.required || false,
|
||||
options: [],
|
||||
}
|
||||
handleAddVariable(startNodeVariable)
|
||||
}
|
||||
|
||||
const handleFeaturesChange = useCallback(() => {
|
||||
handleSyncWorkflowDraft()
|
||||
setShowFeaturesPanel(true)
|
||||
}, [handleSyncWorkflowDraft, setShowFeaturesPanel])
|
||||
|
||||
return (
|
||||
<NewFeaturePanel
|
||||
show
|
||||
isChatMode={isChatMode}
|
||||
disabled={nodesReadOnly}
|
||||
onChange={handleFeaturesChange}
|
||||
onClose={() => setShowFeaturesPanel(false)}
|
||||
onAutoAddPromptVariable={handleAddOpeningStatementVariable}
|
||||
workflowVariables={data.variables}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default memo(Features)
|
||||
@ -23,7 +23,7 @@ const ShortcutsName = ({
|
||||
key={key}
|
||||
className={cn(
|
||||
'system-kbd flex h-4 min-w-4 items-center justify-center rounded-[4px] bg-components-kbd-bg-gray capitalize',
|
||||
textColor === 'secondary' && 'text-text-secondary',
|
||||
textColor === 'secondary' && 'text-text-tertiary',
|
||||
)}
|
||||
>
|
||||
{getKeyboardKeyNameBySystem(key)}
|
||||
|
||||
@ -2,8 +2,6 @@ import type { StateCreator } from 'zustand'
|
||||
|
||||
export type PanelSliceShape = {
|
||||
panelWidth: number
|
||||
showFeaturesPanel: boolean
|
||||
setShowFeaturesPanel: (showFeaturesPanel: boolean) => void
|
||||
showWorkflowVersionHistoryPanel: boolean
|
||||
setShowWorkflowVersionHistoryPanel: (showWorkflowVersionHistoryPanel: boolean) => void
|
||||
showInputsPanel: boolean
|
||||
@ -28,8 +26,6 @@ export type PanelSliceShape = {
|
||||
|
||||
export const createPanelSlice: StateCreator<PanelSliceShape> = set => ({
|
||||
panelWidth: localStorage.getItem('workflow-node-panel-width') ? Number.parseFloat(localStorage.getItem('workflow-node-panel-width')!) : 420,
|
||||
showFeaturesPanel: false,
|
||||
setShowFeaturesPanel: showFeaturesPanel => set(() => ({ showFeaturesPanel })),
|
||||
showWorkflowVersionHistoryPanel: false,
|
||||
setShowWorkflowVersionHistoryPanel: showWorkflowVersionHistoryPanel => set(() => ({ showWorkflowVersionHistoryPanel })),
|
||||
showInputsPanel: false,
|
||||
|
||||
Reference in New Issue
Block a user