chore: more info to workflows

This commit is contained in:
Joel 2024-03-21 16:23:47 +08:00
parent 178f1fc5d6
commit 8cffbc6b2a
6 changed files with 19 additions and 20 deletions

View File

@ -11,22 +11,12 @@ import Field from './field'
import Toast from '@/app/components/base/toast'
import { getNewVarInWorkflow } from '@/utils/var'
import ConfigContext from '@/context/debug-configuration'
import { type InputVar, InputVarType } from '@/app/components/workflow/types'
import type { InputVar, MoreInfo } from '@/app/components/workflow/types'
import Modal from '@/app/components/base/modal'
import Switch from '@/app/components/base/switch'
import { ChangeType, InputVarType } from '@/app/components/workflow/types'
export enum ChangeType {
changeVarName = 'changeVarName',
}
export type MoreInfo = {
type: ChangeType
payload?: {
beforeKey: string
afterKey: string
}
}
export type IConfigModalProps = {
isCreate?: boolean
payload?: InputVar

View File

@ -4,11 +4,10 @@ import React, { useCallback, useRef } from 'react'
import { useBoolean, useHover } from 'ahooks'
import { useTranslation } from 'react-i18next'
import InputVarTypeIcon from '../../_base/components/input-var-type-icon'
import type { InputVar } from '@/app/components/workflow/types'
import type { InputVar, MoreInfo } from '@/app/components/workflow/types'
import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development'
import { Edit03 } from '@/app/components/base/icons/src/vender/solid/general'
import { Trash03 } from '@/app/components/base/icons/src/vender/line/general'
import type { MoreInfo } from '@/app/components/app/configuration/config-var/config-modal'
import ConfigVarModal from '@/app/components/app/configuration/config-var/config-modal'
type Props = {

View File

@ -4,8 +4,7 @@ import React, { useCallback } from 'react'
import produce from 'immer'
import { useTranslation } from 'react-i18next'
import VarItem from './var-item'
import type { InputVar } from '@/app/components/workflow/types'
import type { MoreInfo } from '@/app/components/app/configuration/config-var/config-modal'
import type { InputVar, MoreInfo } from '@/app/components/workflow/types'
type Props = {
readonly: boolean
list: InputVar[]

View File

@ -8,7 +8,7 @@ import Split from '@/app/components/workflow/nodes/_base/components/split'
import Field from '@/app/components/workflow/nodes/_base/components/field'
import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars'
import AddButton from '@/app/components/base/button/add-button'
import ConfigVarModal from '@/app/components/app/configuration/config-var/config-modal'
import ConfigVarModal from '@/app/components/workflow/types'
import type { InputVar, NodePanelProps } from '@/app/components/workflow/types'
const i18nPrefix = 'workflow.nodes.start'

View File

@ -2,14 +2,13 @@ import { useCallback } from 'react'
import produce from 'immer'
import { useBoolean } from 'ahooks'
import type { StartNodeType } from './types'
import type { InputVar } from '@/app/components/workflow/types'
import type { InputVar, MoreInfo } from '@/app/components/workflow/types'
import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud'
import {
useIsChatMode,
useNodesReadOnly,
useWorkflow,
} from '@/app/components/workflow/hooks'
import type { MoreInfo } from '@/app/components/app/configuration/config-var/config-modal'
const useConfig = (id: string, payload: StartNodeType) => {
const { nodesReadOnly: readOnly } = useNodesReadOnly()
@ -32,7 +31,7 @@ const useConfig = (id: string, payload: StartNodeType) => {
const changedVar = newList[moreInfo.index]
handleOutVarRenameChange(id, [id, inputs.variables[moreInfo.index].variable], [id, changedVar.variable])
}
}, [inputs, setInputs])
}, [handleOutVarRenameChange, id, inputs, setInputs])
const handleAddVariable = useCallback((payload: InputVar) => {
const newInputs = produce(inputs, (draft: StartNodeType) => {

View File

@ -251,3 +251,15 @@ export type HistoryWorkflowData = {
status: string
conversation_id?: string
}
export enum ChangeType {
changeVarName = 'changeVarName',
}
export type MoreInfo = {
type: ChangeType
payload?: {
beforeKey: string
afterKey: string
}
}