diff --git a/web/app/components/workflow/variable-inspect/group.tsx b/web/app/components/workflow/variable-inspect/group.tsx index d02f20aa39..e49a9834fe 100644 --- a/web/app/components/workflow/variable-inspect/group.tsx +++ b/web/app/components/workflow/variable-inspect/group.tsx @@ -25,7 +25,7 @@ type Props = { currentVar?: currentVarType varType: VarInInspectType varList: VarInInspect[] - handleSelect: (state: any) => void + handleSelect: (state: currentVarType) => void handleView?: () => void handleClear?: () => void } @@ -50,7 +50,7 @@ const Group = ({ const visibleVarList = isEnv ? varList : varList.filter(v => v.visible) - const handleSelectVar = (varItem: any, type?: string) => { + const handleSelectVar = (varItem: VarInInspect, type?: VarInInspectType) => { if (type === VarInInspectType.environment) { handleSelect({ nodeId: VarInInspectType.environment, diff --git a/web/app/components/workflow/variable-inspect/left.tsx b/web/app/components/workflow/variable-inspect/left.tsx index e7bd7d16b7..fc25601d72 100644 --- a/web/app/components/workflow/variable-inspect/left.tsx +++ b/web/app/components/workflow/variable-inspect/left.tsx @@ -12,7 +12,7 @@ import Group from './group' type Props = { currentNodeVar?: currentVarType - handleVarSelect: (state: any) => void + handleVarSelect: (state: currentVarType) => void } const Left = ({ diff --git a/web/app/components/workflow/variable-inspect/right.tsx b/web/app/components/workflow/variable-inspect/right.tsx index f2ad505003..7befbb1aa0 100644 --- a/web/app/components/workflow/variable-inspect/right.tsx +++ b/web/app/components/workflow/variable-inspect/right.tsx @@ -1,5 +1,6 @@ import type { FC } from 'react' import type { SplitRightProps } from './split-panel' +import type { VarInspectValue } from './types' import type { currentVarType } from './variables-tab' import type { GenRes } from '@/service/debug' import { @@ -68,7 +69,7 @@ const Right: FC = ({ editInspectVarValue, } = useCurrentVars() - const handleValueChange = (varId: string, value: any) => { + const handleValueChange = (varId: string, value: VarInspectValue) => { if (!currentNodeVar || !currentVar) return editInspectVarValue(currentNodeVar.nodeId, varId, value) diff --git a/web/app/components/workflow/variable-inspect/types.ts b/web/app/components/workflow/variable-inspect/types.ts index f9eb952c71..c2711294ff 100644 --- a/web/app/components/workflow/variable-inspect/types.ts +++ b/web/app/components/workflow/variable-inspect/types.ts @@ -1,3 +1,7 @@ +import type { FileEntity } from '@/app/components/base/file-uploader/types' +import type { PromptTemplateItem } from '@/app/components/workflow/types' +import type { FileResponse } from '@/types/workflow' + export const EVENT_WORKFLOW_STOP = 'WORKFLOW_STOP' export const CHUNK_SCHEMA_TYPES = ['general_structure', 'parent_child_structure', 'qa_structure'] @@ -16,3 +20,16 @@ export enum InspectTab { Variables = 'variables', Artifacts = 'artifacts', } + +export type VarInspectValue + = string + | number + | boolean + | null + | Record + | Array> + | FileEntity + | FileEntity[] + | FileResponse + | FileResponse[] + | PromptTemplateItem[] diff --git a/web/app/components/workflow/variable-inspect/value-content.tsx b/web/app/components/workflow/variable-inspect/value-content.tsx index 94751e6b16..282ff785df 100644 --- a/web/app/components/workflow/variable-inspect/value-content.tsx +++ b/web/app/components/workflow/variable-inspect/value-content.tsx @@ -1,3 +1,4 @@ +import type { VarInspectValue } from './types' import type { VarInInspect } from '@/types/workflow' import { useDebounceFn } from 'ahooks' import * as React from 'react' @@ -30,7 +31,7 @@ import { CHUNK_SCHEMA_TYPES, PreviewType } from './types' type Props = { currentVar: VarInInspect - handleValueChange: (varId: string, value: any) => void + handleValueChange: (varId: string, value: VarInspectValue) => void isTruncated: boolean }