|
|
|
@ -1,8 +1,9 @@
|
|
|
|
import type { MutableRefObject } from 'react'
|
|
|
|
import type { MutableRefObject } from 'react'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import type { Props as FormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form/form'
|
|
|
|
import type { Props as FormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form/form'
|
|
|
|
import type { InputVar, Variable } from '@/app/components/workflow/types'
|
|
|
|
import { type InputVar, InputVarType, type Variable } from '@/app/components/workflow/types'
|
|
|
|
import type { StartNodeType } from './types'
|
|
|
|
import type { StartNodeType } from './types'
|
|
|
|
|
|
|
|
import { useIsChatMode } from '../../hooks'
|
|
|
|
|
|
|
|
|
|
|
|
type Params = {
|
|
|
|
type Params = {
|
|
|
|
id: string,
|
|
|
|
id: string,
|
|
|
|
@ -19,18 +20,36 @@ const useSingleRunFormParams = ({
|
|
|
|
setRunInputData,
|
|
|
|
setRunInputData,
|
|
|
|
}: Params) => {
|
|
|
|
}: Params) => {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
const isChatMode = useIsChatMode()
|
|
|
|
|
|
|
|
|
|
|
|
const forms = (() => {
|
|
|
|
const forms = (() => {
|
|
|
|
const forms: FormProps[] = []
|
|
|
|
const forms: FormProps[] = []
|
|
|
|
|
|
|
|
const inputs = payload.variables.map((item: InputVar) => ({
|
|
|
|
|
|
|
|
label: item.variable,
|
|
|
|
|
|
|
|
variable: item.variable,
|
|
|
|
|
|
|
|
type: item.type,
|
|
|
|
|
|
|
|
required: item.required,
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isChatMode) {
|
|
|
|
|
|
|
|
inputs.push({
|
|
|
|
|
|
|
|
label: 'sys.query',
|
|
|
|
|
|
|
|
variable: '#sys.query#',
|
|
|
|
|
|
|
|
type: InputVarType.textInput,
|
|
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inputs.push({
|
|
|
|
|
|
|
|
label: 'sys.files',
|
|
|
|
|
|
|
|
variable: '#sys.files#',
|
|
|
|
|
|
|
|
type: InputVarType.multiFiles,
|
|
|
|
|
|
|
|
required: false,
|
|
|
|
|
|
|
|
})
|
|
|
|
forms.push(
|
|
|
|
forms.push(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: t('workflow.nodes.llm.singleRun.variable')!,
|
|
|
|
label: t('workflow.nodes.llm.singleRun.variable')!,
|
|
|
|
inputs: payload.variables.map((item: InputVar) => ({
|
|
|
|
inputs,
|
|
|
|
label: item.variable,
|
|
|
|
|
|
|
|
variable: item.variable,
|
|
|
|
|
|
|
|
type: item.type,
|
|
|
|
|
|
|
|
required: item.required,
|
|
|
|
|
|
|
|
})),
|
|
|
|
|
|
|
|
values: runInputData,
|
|
|
|
values: runInputData,
|
|
|
|
onChange: setRunInputData,
|
|
|
|
onChange: setRunInputData,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|