diff --git a/web/app/components/base/form/components/base/base-field.tsx b/web/app/components/base/form/components/base/base-field.tsx index 75b5cd3225..738435e38e 100644 --- a/web/app/components/base/form/components/base/base-field.tsx +++ b/web/app/components/base/form/components/base/base-field.tsx @@ -27,6 +27,10 @@ import ArrayValueList from '@/app/components/workflow/panel/chat-variable-panel/ import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor' import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' import Button from '@/app/components/base/button' +import PromptGeneratorBtn from '@/app/components/workflow/nodes/llm/components/prompt-generator-btn' +import Switch from '@/app/components/base/switch' +import Slider from '@/app/components/base/slider' +import Tooltip from '@/app/components/base/tooltip' export type BaseFieldProps = { fieldClassName?: string @@ -62,6 +66,7 @@ const BaseField = ({ help, selfFormProps, onChange, + tooltip, } = formSchema const type = typeof typeOrFn === 'function' ? typeOrFn(field.form) : typeOrFn @@ -82,6 +87,13 @@ const BaseField = ({ if (typeof placeholder === 'object' && placeholder !== null) return renderI18nObject(placeholder as Record) }, [placeholder, renderI18nObject]) + const memorizedTooltip = useMemo(() => { + if (typeof tooltip === 'string') + return tooltip + + if (typeof tooltip === 'object' && tooltip !== null) + return renderI18nObject(tooltip as Record) + }, [tooltip, renderI18nObject]) const optionValues = useStore(field.form.store, (s) => { const result: Record = {} options?.forEach((option) => { @@ -127,12 +139,26 @@ const BaseField = ({ onChange?.(field.form, value) }, [field, onChange]) + const selfProps = typeof selfFormProps === 'function' ? selfFormProps(field.form) : selfFormProps + if (!show) return null return ( + <> + { + selfProps?.withTopDivider && ( +
+ ) + }
-
+
{ + if (type === FormTypeEnum.collapse) + handleChange(!value) + }} + > {memorizedLabel} { required && !isValidElement(label) && ( @@ -143,10 +169,9 @@ const BaseField = ({ type === FormTypeEnum.collapse && ( handleChange(!value)} /> ) } @@ -159,10 +184,18 @@ const BaseField = ({ onClick={() => handleChange(!value)} > {value ? : } - {selfFormProps?.(field.form)?.editModeLabel} + {selfProps?.editModeLabel} ) } + { + memorizedTooltip && ( + + ) + }
{ @@ -195,7 +228,7 @@ const BaseField = ({ ) } { - type === FormTypeEnum.textNumber && ( + type === FormTypeEnum.textNumber && !selfProps?.withSlider && ( ) } + { + type === FormTypeEnum.textNumber && selfProps?.withSlider && ( +
+ + handleChange(e.target.value)} + onBlur={field.handleBlur} + disabled={disabled} + placeholder={memorizedPlaceholder} + /> +
+ ) + } { type === FormTypeEnum.select && ( handleChange(option.value)} > { - selfFormProps?.(field.form)?.showRadioUI && ( + selfProps?.showRadioUI && ( +
+ { + selfProps?.enablePromptGenerator && ( + + ) + } + +
) } { @@ -296,7 +373,7 @@ const BaseField = ({ { type === FormTypeEnum.arrayList && ( @@ -304,13 +381,13 @@ const BaseField = ({ } { type === FormTypeEnum.jsonInput && ( -
+
{selfFormProps?.(field.form)?.placeholder as string}
} + placeholder={
{selfProps?.placeholder as string}
} onChange={handleChange} />
@@ -328,6 +405,15 @@ const BaseField = ({ /> ) } + { + type === FormTypeEnum.boolean && ( + + ) + } { url && (
+ { + selfProps?.withBottomDivider && ( +
+ ) + } + ) } diff --git a/web/app/components/base/form/types.ts b/web/app/components/base/form/types.ts index 36137fda09..a8e3034ebd 100644 --- a/web/app/components/base/form/types.ts +++ b/web/app/components/base/form/types.ts @@ -68,7 +68,7 @@ export type FormSchema = { inputContainerClassName?: string inputClassName?: string validators?: AnyValidators - selfFormProps?: (form: AnyFormApi) => Record + selfFormProps?: ((form: AnyFormApi) => Record) | Record onChange?: (form: AnyFormApi, v: any) => void } diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx index 9f9de880e4..dbc1c566ae 100644 --- a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx +++ b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx @@ -40,7 +40,7 @@ const ChatVariableModal = ({ const form = useTanstackForm({ defaultValues, }) - const type = useTanstackStore(form.store, s => s.values.type) + const type = useTanstackStore(form.store, (s: any) => s.values.value_type) const checkVariableName = (value: string) => { const { isValid, errorMessageKey } = checkKeys([value], false) @@ -57,19 +57,23 @@ const ChatVariableModal = ({ const handleConfirm = useCallback(async () => { const { values, + isCheckValidated, } = formRef.current?.getFormValues({ needCheckValidatedValues: true, }) || { isCheckValidated: false, values: {} } const { name, type, - 'object-list-value': objectValue, + value, } = values + console.log(values, 'xxx') + if (!isCheckValidated) + return if (!checkVariableName(name)) return if (!chatVar && varList.some(chatVar => chatVar.name === name)) return notify({ type: 'error', message: 'name is existed' }) - if (type === ChatVarType.Object && objectValue.some((item: any) => !item.key && !!item.value)) + if (type === ChatVarType.Object && value.some((item: any) => !item.key && !!item.value)) return notify({ type: 'error', message: 'object key can not be empty' }) // onSave({ diff --git a/web/app/components/workflow/panel/chat-variable-panel/constants.ts b/web/app/components/workflow/panel/chat-variable-panel/constants.ts index 286d0f1c39..ed707082b8 100644 --- a/web/app/components/workflow/panel/chat-variable-panel/constants.ts +++ b/web/app/components/workflow/panel/chat-variable-panel/constants.ts @@ -1,4 +1,5 @@ import { ChatVarType } from './type' +import { DEFAULT_OBJECT_VALUE } from '@/app/components/workflow/panel/chat-variable-panel/components/object-value-item' export const objectPlaceholder = `# example # { @@ -33,5 +34,12 @@ export const typeList = [ ChatVarType.ArrayString, ChatVarType.ArrayNumber, ChatVarType.ArrayObject, - 'memory', + ChatVarType.Memory, ] + +export const TYPE_STRING_DEFAULT_VALUE = '' +export const TYPE_NUMBER_DEFAULT_VALUE = 0 +export const TYPE_OBJECT_DEFAULT_VALUE = [DEFAULT_OBJECT_VALUE] +export const TYPE_ARRAY_STRING_DEFAULT_VALUE = [undefined] +export const TYPE_ARRAY_NUMBER_DEFAULT_VALUE = [undefined] +export const TYPE_ARRAY_OBJECT_DEFAULT_VALUE = undefined diff --git a/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/index.ts b/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/index.ts index 12b89caeea..2010c9642c 100644 --- a/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/index.ts +++ b/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/index.ts @@ -4,13 +4,20 @@ import { useMemo } from 'react' import { useTypeSchema } from './use-type-schema' import { useValueSchema } from './use-value-schema' import { useEditInJSONSchema } from './use-edit-in-json-schema' +import { + useMemoryDefaultValues, + useMemorySchema, +} from './use-memory-schema' +import type { ConversationVariable } from '@/app/components/workflow/types' -export const useForm = () => { +export const useForm = (chatVar?: ConversationVariable) => { const { t } = useTranslation() const typeSchema = useTypeSchema() const valueSchema = useValueSchema() const editInJSONSchema = useEditInJSONSchema() + const memorySchema = useMemorySchema() + const memoryDefaultValues = useMemoryDefaultValues() const formSchemas = useMemo(() => { return [ @@ -24,15 +31,31 @@ export const useForm = () => { typeSchema, editInJSONSchema, valueSchema, + { + name: 'description', + label: t('workflow.chatVariable.modal.description'), + type: 'textarea-input', + placeholder: t('workflow.chatVariable.modal.descriptionPlaceholder'), + show_on: [ + { + variable: 'value_type', + value: [ChatVarType.String, ChatVarType.Number, ChatVarType.Object, ChatVarType.ArrayString, ChatVarType.ArrayNumber, ChatVarType.ArrayObject], + }, + ], + }, + ...memorySchema, ] - }, [t, valueSchema, typeSchema, editInJSONSchema]) + }, [t, valueSchema, typeSchema, editInJSONSchema, memorySchema]) const defaultValues = useMemo(() => { + if (chatVar) + return chatVar return { - type: ChatVarType.String, + value_type: ChatVarType.Memory, value: '', editInJSON: false, + ...memoryDefaultValues, } - }, []) + }, [chatVar]) return { formSchemas, diff --git a/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-edit-in-json-schema.ts b/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-edit-in-json-schema.ts index 4b5e3e9836..36a6762cbc 100644 --- a/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-edit-in-json-schema.ts +++ b/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-edit-in-json-schema.ts @@ -4,30 +4,35 @@ import type { AnyFormApi, } from '@tanstack/react-form' import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type' +import { getValue } from '@/app/components/workflow/panel/chat-variable-panel/utils' export const useEditInJSONSchema = () => { const { t } = useTranslation() + const getEditModeLabel = useCallback((form: AnyFormApi) => { const { - type, + value_type, editInJSON, } = form.state.values const editModeLabelWhenFalse = t('workflow.chatVariable.modal.editInJSON') let editModeLabelWhenTrue = t('workflow.chatVariable.modal.oneByOne') - if (type === ChatVarType.Object) + if (value_type === ChatVarType.Object) editModeLabelWhenTrue = t('workflow.chatVariable.modal.editInForm') return { editModeLabel: editInJSON ? editModeLabelWhenTrue : editModeLabelWhenFalse, } }, [t]) - const handleEditInJSONChange = useCallback((form: AnyFormApi) => { + const handleEditInJSONChange = useCallback((form: AnyFormApi, v: boolean) => { const { - resetField, + setFieldValue, + getFieldValue, } = form - resetField('objectListValue') - resetField('arrayListValue') - resetField('jsonValue') + const type = getFieldValue('value_type') + const value = getFieldValue('value') + + const newValue = getValue(type, !v, value) + setFieldValue('value', newValue) }, []) return { @@ -36,7 +41,7 @@ export const useEditInJSONSchema = () => { type: 'edit-mode', show_on: [ { - variable: 'type', + variable: 'value_type', value: [ChatVarType.Object, ChatVarType.ArrayString, ChatVarType.ArrayNumber], }, ], diff --git a/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-memory-schema.ts b/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-memory-schema.ts new file mode 100644 index 0000000000..bc946b6e6b --- /dev/null +++ b/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-memory-schema.ts @@ -0,0 +1,227 @@ +import { FormTypeEnum } from '@/app/components/base/form/types' +import type { FormSchema } from '@/app/components/base/form/types' +import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type' + +export const useMemorySchema = () => { + return [ + { + name: 'template', + label: 'Memory Template', + type: FormTypeEnum.promptInput, + tooltip: 'template', + placeholder: 'Enter template for AI memory (e.g., user profile, preferences, context)...', + show_on: [ + { + variable: 'value_type', + value: [ChatVarType.Memory], + }, + ], + selfFormProps: { + withTopDivider: true, + }, + }, + { + name: 'instruction', + label: 'Update Instructions', + type: FormTypeEnum.promptInput, + show_on: [ + { + variable: 'value_type', + value: [ChatVarType.Memory], + }, + ], + selfFormProps: { + enablePromptGenerator: true, + placeholder: 'How should the AI update this memory...', + }, + }, + { + name: 'strategy', + label: 'Update trigger', + type: FormTypeEnum.radio, + default: 'on_turns', + fieldClassName: 'flex justify-between', + inputClassName: 'w-[102px]', + options: [ + { + label: 'Every N turns', + value: 'on_turns', + }, + { + label: 'Auto', + value: 'on_auto', + }, + ], + show_on: [ + { + variable: 'value_type', + value: [ChatVarType.Memory], + }, + ], + selfFormProps: { + withTopDivider: true, + }, + }, + { + name: 'update_turns', + label: 'Update every', + type: FormTypeEnum.textNumber, + fieldClassName: 'flex justify-between', + show_on: [ + { + variable: 'value_type', + value: [ChatVarType.Memory], + }, + { + variable: 'strategy', + value: 'on_turns', + }, + ], + selfFormProps: { + withSlider: true, + sliderMin: 0, + sliderMax: 1000, + sliderStep: 50, + sliderClassName: 'w-[98px]', + inputWrapperClassName: 'w-[102px]', + }, + }, + { + name: 'scope', + label: 'Scope', + type: FormTypeEnum.radio, + default: 'app', + fieldClassName: 'flex justify-between', + inputClassName: 'w-[102px]', + options: [ + { + label: 'Conversation', + value: 'conversation', + }, + { + label: 'App', + value: 'app', + }, + ], + show_on: [ + { + variable: 'value_type', + value: [ChatVarType.Memory], + }, + ], + selfFormProps: { + withTopDivider: true, + }, + }, + { + name: 'term', + label: 'Term', + type: FormTypeEnum.radio, + default: 'session', + fieldClassName: 'flex justify-between', + inputClassName: 'w-[102px]', + options: [ + { + label: 'Session', + value: 'session', + }, + { + label: 'Persistent', + value: 'persistent', + }, + ], + show_on: [ + { + variable: 'value_type', + value: [ChatVarType.Memory], + }, + ], + selfFormProps: { + withBottomDivider: true, + }, + }, + { + name: 'more', + label: 'MoreSettings', + type: FormTypeEnum.collapse, + show_on: [ + { + variable: 'value_type', + value: [ChatVarType.Memory], + }, + ], + }, + { + name: 'model', + label: 'Memory model', + type: FormTypeEnum.modelSelector, + show_on: [ + { + variable: 'value_type', + value: [ChatVarType.Memory], + }, + { + variable: 'more', + value: true, + }, + ], + }, + { + name: 'schedule_mode', + label: 'Update method', + type: FormTypeEnum.radio, + options: [ + { + label: 'Sync', + value: 'sync', + }, + { + label: 'Async', + value: 'async', + }, + ], + show_on: [ + { + variable: 'value_type', + value: [ChatVarType.Memory], + }, + { + variable: 'more', + value: true, + }, + ], + }, + { + name: 'end_user_editable', + label: 'Editable in web app', + type: FormTypeEnum.boolean, + fieldClassName: 'flex justify-between', + show_on: [ + { + variable: 'value_type', + value: [ChatVarType.Memory], + }, + { + variable: 'more', + value: true, + }, + ], + }, + ] as FormSchema[] +} + +export const useMemoryDefaultValues = () => { + return { + template: '', + instruction: '', + strategy: 'on_turns', + update_turns: 0, + scope: 'conversation', + term: 'session', + more: false, + model: '', + schedule_mode: 'sync', + end_user_visible: false, + end_user_editable: false, + } +} diff --git a/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-type-schema.ts b/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-type-schema.ts index 254b0bbc65..53306ba318 100644 --- a/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-type-schema.ts +++ b/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-type-schema.ts @@ -4,8 +4,15 @@ import type { AnyFormApi, } from '@tanstack/react-form' import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type' -import { DEFAULT_OBJECT_VALUE } from '@/app/components/workflow/panel/chat-variable-panel/components/object-value-item' import { typeList } from '@/app/components/workflow/panel/chat-variable-panel/constants' +import { + TYPE_ARRAY_NUMBER_DEFAULT_VALUE, + TYPE_ARRAY_OBJECT_DEFAULT_VALUE, + TYPE_ARRAY_STRING_DEFAULT_VALUE, + TYPE_NUMBER_DEFAULT_VALUE, + TYPE_OBJECT_DEFAULT_VALUE, + TYPE_STRING_DEFAULT_VALUE, +} from '@/app/components/workflow/panel/chat-variable-panel/constants' export const useTypeSchema = () => { const { t } = useTranslation() @@ -13,22 +20,23 @@ export const useTypeSchema = () => { const { setFieldValue, } = form + setFieldValue('editInJSON', false) if (v === ChatVarType.String) - setFieldValue('value', '') + setFieldValue('value', TYPE_STRING_DEFAULT_VALUE) else if (v === ChatVarType.Number) - setFieldValue('value', 0) + setFieldValue('value', TYPE_NUMBER_DEFAULT_VALUE) else if (v === ChatVarType.Object) - setFieldValue('value', [DEFAULT_OBJECT_VALUE]) + setFieldValue('value', TYPE_OBJECT_DEFAULT_VALUE) else if (v === ChatVarType.ArrayString) - setFieldValue('value', [undefined]) + setFieldValue('value', TYPE_ARRAY_STRING_DEFAULT_VALUE) else if (v === ChatVarType.ArrayNumber) - setFieldValue('value', [undefined]) + setFieldValue('value', TYPE_ARRAY_NUMBER_DEFAULT_VALUE) else if (v === ChatVarType.ArrayObject) - setFieldValue('value', undefined) + setFieldValue('value', TYPE_ARRAY_OBJECT_DEFAULT_VALUE) }, []) return { - name: 'type', + name: 'value_type', label: t('workflow.chatVariable.modal.type'), type: 'select', options: typeList.map(type => ({ diff --git a/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-value-schema.ts b/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-value-schema.ts index 3fb7ecf769..b5fcbfc827 100644 --- a/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-value-schema.ts +++ b/web/app/components/workflow/panel/chat-variable-panel/hooks/use-form/use-value-schema.ts @@ -15,57 +15,57 @@ export const useValueSchema = () => { const { t } = useTranslation() const getValueFormType = useCallback((form: AnyFormApi) => { const { - type, + value_type, editInJSON, } = form.state.values - console.log(editInJSON, 'editInJSON', type, 'type') - if (type === ChatVarType.String) { + + if (value_type === ChatVarType.String) { return 'textarea-input' } - else if (type === ChatVarType.Number) { + else if (value_type === ChatVarType.Number) { return 'number-input' } - else if (type === ChatVarType.Object) { + else if (value_type === ChatVarType.Object) { if (editInJSON) return 'json-input' else return 'object-list' } - else if (type === ChatVarType.ArrayString || type === ChatVarType.ArrayNumber) { + else if (value_type === ChatVarType.ArrayString || value_type === ChatVarType.ArrayNumber) { if (editInJSON) return 'json-input' else return 'array-list' } - else if (type === ChatVarType.ArrayObject) { + else if (value_type === ChatVarType.ArrayObject) { return 'json-input' } }, []) const getSelfFormProps = useCallback((form: AnyFormApi) => { const { - type, + value_type, editInJSON, } = form.state.values - if (editInJSON || type === ChatVarType.ArrayObject) { + if (editInJSON || value_type === ChatVarType.ArrayObject) { let minHeight = '120px' - if (type === ChatVarType.ArrayObject) + if (value_type === ChatVarType.ArrayObject) minHeight = '240px' let placeholder = objectPlaceholder - if (type === ChatVarType.ArrayString) + if (value_type === ChatVarType.ArrayString) placeholder = arrayStringPlaceholder - else if (type === ChatVarType.ArrayNumber) + else if (value_type === ChatVarType.ArrayNumber) placeholder = arrayNumberPlaceholder - else if (type === ChatVarType.ArrayObject) + else if (value_type === ChatVarType.ArrayObject) placeholder = arrayObjectPlaceholder return { editorMinHeight: minHeight, placeholder, } } - if (type === ChatVarType.ArrayString || type === ChatVarType.ArrayNumber) { + if (value_type === ChatVarType.ArrayString || value_type === ChatVarType.ArrayNumber) { if (!editInJSON) { return { - isString: type === ChatVarType.ArrayString, + isString: value_type === ChatVarType.ArrayString, } } } @@ -78,12 +78,12 @@ export const useValueSchema = () => { placeholder: t('workflow.chatVariable.modal.valuePlaceholder'), show_on: [ { - variable: 'type', + variable: 'value_type', value: [ChatVarType.String, ChatVarType.Number, ChatVarType.Object, ChatVarType.ArrayString, ChatVarType.ArrayNumber, ChatVarType.ArrayObject], }, { variable: 'editInJSON', - value: [true, false], + value: [true, false, undefined], }, ], selfFormProps: getSelfFormProps, diff --git a/web/app/components/workflow/panel/chat-variable-panel/type.ts b/web/app/components/workflow/panel/chat-variable-panel/type.ts index 2a4e776463..8abdfb878a 100644 --- a/web/app/components/workflow/panel/chat-variable-panel/type.ts +++ b/web/app/components/workflow/panel/chat-variable-panel/type.ts @@ -5,4 +5,11 @@ export enum ChatVarType { ArrayString = 'array[string]', ArrayNumber = 'array[number]', ArrayObject = 'array[object]', + Memory = 'memory', +} + +export type ObjectValueItem = { + key: string + type: ChatVarType + value: string | number | undefined } diff --git a/web/app/components/workflow/panel/chat-variable-panel/utils.ts b/web/app/components/workflow/panel/chat-variable-panel/utils.ts new file mode 100644 index 0000000000..378a254e87 --- /dev/null +++ b/web/app/components/workflow/panel/chat-variable-panel/utils.ts @@ -0,0 +1,66 @@ +import type { ObjectValueItem } from './type' +import { ChatVarType } from './type' +import { + TYPE_ARRAY_STRING_DEFAULT_VALUE, + TYPE_OBJECT_DEFAULT_VALUE, +} from './constants' + +const formatValueFromObject = (list: ObjectValueItem[]) => { + return list.reduce((acc: any, curr) => { + if (curr.key) + acc[curr.key] = curr.value || null + return acc + }, {}) +} +export const getObjectValue = (fromJson: boolean, value?: any) => { + if (fromJson) { + if (!value) + return TYPE_OBJECT_DEFAULT_VALUE + try { + const result = JSON.parse(value) + const newValue = Object.keys(result).map((key) => { + return { + key, + type: typeof result[key] === 'string' ? ChatVarType.String : ChatVarType.Number, + value: result[key], + } + }) + return newValue + } + catch { + return TYPE_OBJECT_DEFAULT_VALUE + } + } + else { + if (!value) + return undefined + return JSON.stringify(formatValueFromObject(value)) + } +} + +export const getArrayValue = (fromJson: boolean, value?: any) => { + if (fromJson) { + if (!value) + return TYPE_ARRAY_STRING_DEFAULT_VALUE + + return JSON.parse(value) + } + else { + if (!value) + return undefined + + return JSON.stringify((value?.length && value.filter(Boolean).length) ? value.filter(Boolean) : undefined) + } +} + +export const getValue = (type: ChatVarType, fromJson: boolean, value?: any) => { + switch (type) { + case ChatVarType.Object: + return getObjectValue(fromJson, value) + case ChatVarType.ArrayNumber: + case ChatVarType.ArrayString: + return getArrayValue(fromJson, value) + default: + return value + } +} diff --git a/web/app/components/workflow/types.ts b/web/app/components/workflow/types.ts index 371352771d..82ef97c30f 100644 --- a/web/app/components/workflow/types.ts +++ b/web/app/components/workflow/types.ts @@ -156,13 +156,25 @@ export type EnvironmentVariable = { description: string } +export type MemoryVariable = { + template?: string + instruction?: string + schedule_mode?: string + model?: any + strategy?: string + update_turns?: number + scope?: string + term?: string + end_user_editable?: boolean +} + export type ConversationVariable = { id: string name: string value_type: ChatVarType value: any description: string -} +} & MemoryVariable export type GlobalVariable = { name: string