Remove workflow features button (#24085)

This commit is contained in:
lyzno1
2025-08-19 09:32:07 +08:00
committed by GitHub
parent 6a3d135d49
commit d4ff1e031a
26 changed files with 20 additions and 182 deletions

View File

@ -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)

View File

@ -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)}

View File

@ -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,