mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 13:53:50 +00:00
fix: input form value type error (#3399)
This commit is contained in:
@@ -284,9 +284,13 @@ export const formatVariableValByType = (val: any, valueType?: WorkflowIOValueTyp
|
|||||||
if (!valueType) return val;
|
if (!valueType) return val;
|
||||||
// Value type check, If valueType invalid, return undefined
|
// Value type check, If valueType invalid, return undefined
|
||||||
if (valueType.startsWith('array') && !Array.isArray(val)) return undefined;
|
if (valueType.startsWith('array') && !Array.isArray(val)) return undefined;
|
||||||
if (valueType === WorkflowIOValueTypeEnum.boolean && typeof val !== 'boolean') return undefined;
|
if (valueType === WorkflowIOValueTypeEnum.boolean) return Boolean(val);
|
||||||
if (valueType === WorkflowIOValueTypeEnum.number && typeof val !== 'number') return undefined;
|
if (valueType === WorkflowIOValueTypeEnum.number) return Number(val);
|
||||||
if (valueType === WorkflowIOValueTypeEnum.string && typeof val !== 'string') return undefined;
|
if (valueType === WorkflowIOValueTypeEnum.string) {
|
||||||
|
if (val === undefined) return 'undefined';
|
||||||
|
if (val === null) return 'null';
|
||||||
|
return typeof val === 'object' ? JSON.stringify(val) : String(val);
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
[
|
[
|
||||||
WorkflowIOValueTypeEnum.object,
|
WorkflowIOValueTypeEnum.object,
|
||||||
|
@@ -73,7 +73,6 @@ import { dispatchLoopEnd } from './loop/runLoopEnd';
|
|||||||
import { dispatchLoopStart } from './loop/runLoopStart';
|
import { dispatchLoopStart } from './loop/runLoopStart';
|
||||||
import { dispatchFormInput } from './interactive/formInput';
|
import { dispatchFormInput } from './interactive/formInput';
|
||||||
import { dispatchToolParams } from './agent/runTool/toolParams';
|
import { dispatchToolParams } from './agent/runTool/toolParams';
|
||||||
import { AppChatConfigType } from '@fastgpt/global/core/app/type';
|
|
||||||
|
|
||||||
const callbackMap: Record<FlowNodeTypeEnum, Function> = {
|
const callbackMap: Record<FlowNodeTypeEnum, Function> = {
|
||||||
[FlowNodeTypeEnum.workflowStart]: dispatchWorkflowStart,
|
[FlowNodeTypeEnum.workflowStart]: dispatchWorkflowStart,
|
||||||
@@ -635,7 +634,7 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
|
|||||||
const entryNodes = runtimeNodes.filter((item) => item.isEntry);
|
const entryNodes = runtimeNodes.filter((item) => item.isEntry);
|
||||||
// reset entry
|
// reset entry
|
||||||
runtimeNodes.forEach((item) => {
|
runtimeNodes.forEach((item) => {
|
||||||
// Interactive node is not the entry node, return interactive result
|
// Interactively nodes will use the "isEntry", which does not need to be updated
|
||||||
if (
|
if (
|
||||||
item.flowNodeType !== FlowNodeTypeEnum.userSelect &&
|
item.flowNodeType !== FlowNodeTypeEnum.userSelect &&
|
||||||
item.flowNodeType !== FlowNodeTypeEnum.formInput &&
|
item.flowNodeType !== FlowNodeTypeEnum.formInput &&
|
||||||
|
@@ -41,7 +41,8 @@ const MyNumberInput = (props: Props) => {
|
|||||||
? register(name, {
|
? register(name, {
|
||||||
required: props.isRequired,
|
required: props.isRequired,
|
||||||
min: props.min,
|
min: props.min,
|
||||||
max: props.max
|
max: props.max,
|
||||||
|
valueAsNumber: true
|
||||||
})
|
})
|
||||||
: {})}
|
: {})}
|
||||||
/>
|
/>
|
||||||
|
Reference in New Issue
Block a user