| @@ -52,7 +52,7 @@ export type CommonHooksFnMap = { | |||
| fetchInspectVars: (params: { passInVars?: boolean, vars?: VarInInspect[], passedInAllPluginInfoList?: Record<string, ToolWithProvider[]>, passedInSchemaTypeDefinitions?: SchemaTypeDefinition[] }) => Promise<void> | |||
| hasNodeInspectVars: (nodeId: string) => boolean | |||
| hasSetInspectVar: (nodeId: string, name: string, sysVars: VarInInspect[], conversationVars: VarInInspect[]) => boolean | |||
| fetchInspectVarValue: (selector: ValueSelector) => Promise<void> | |||
| fetchInspectVarValue: (selector: ValueSelector, schemaTypeDefinitions: SchemaTypeDefinition[]) => Promise<void> | |||
| editInspectVarValue: (nodeId: string, varId: string, value: any) => Promise<void> | |||
| renameInspectVarName: (nodeId: string, oldName: string, newName: string) => Promise<void> | |||
| appendNodeInspectVars: (nodeId: string, payload: VarInInspect[], allNodes: Node[]) => void | |||
| @@ -16,8 +16,8 @@ import { useNodesInteractionsWithoutSync } from '@/app/components/workflow/hooks | |||
| import { useEdgesInteractionsWithoutSync } from '@/app/components/workflow/hooks/use-edges-interactions-without-sync' | |||
| import type { FlowType } from '@/types/common' | |||
| import useFLow from '@/service/use-flow' | |||
| import useMatchSchemaType from '../nodes/_base/components/variable/use-match-schema-type' | |||
| import { useStoreApi } from 'reactflow' | |||
| import type { SchemaTypeDefinition } from '@/service/use-common' | |||
| type Params = { | |||
| flowId: string | |||
| @@ -29,7 +29,6 @@ export const useInspectVarsCrudCommon = ({ | |||
| }: Params) => { | |||
| const workflowStore = useWorkflowStore() | |||
| const store = useStoreApi() | |||
| const { schemaTypeDefinitions } = useMatchSchemaType() | |||
| const { | |||
| useInvalidateConversationVarValues, | |||
| useInvalidateSysVarValues, | |||
| @@ -96,7 +95,7 @@ export const useInspectVarsCrudCommon = ({ | |||
| return !!getNodeInspectVars(nodeId) | |||
| }, [getNodeInspectVars]) | |||
| const fetchInspectVarValue = useCallback(async (selector: ValueSelector) => { | |||
| const fetchInspectVarValue = useCallback(async (selector: ValueSelector, schemaTypeDefinitions: SchemaTypeDefinition[]) => { | |||
| const { | |||
| setNodeInspectVars, | |||
| buildInTools, | |||
| @@ -15,6 +15,7 @@ import { VarInInspectType } from '@/types/workflow' | |||
| import cn from '@/utils/classnames' | |||
| import type { NodeProps } from '../types' | |||
| import useMatchSchemaType from '../nodes/_base/components/variable/use-match-schema-type' | |||
| export type currentVarType = { | |||
| nodeId: string | |||
| @@ -133,13 +134,15 @@ const Panel: FC = () => { | |||
| setCurrentVarId(node.var.id) | |||
| }, [setCurrentFocusNodeId, setCurrentVarId]) | |||
| const { isLoading, schemaTypeDefinitions } = useMatchSchemaType() | |||
| useEffect(() => { | |||
| if (currentFocusNodeId && currentVarId) { | |||
| if (currentFocusNodeId && currentVarId && !isLoading) { | |||
| const targetNode = nodesWithInspectVars.find(node => node.nodeId === currentFocusNodeId) | |||
| if (targetNode && !targetNode.isValueFetched) | |||
| fetchInspectVarValue([currentFocusNodeId]) | |||
| fetchInspectVarValue([currentFocusNodeId], schemaTypeDefinitions!) | |||
| } | |||
| }, [currentFocusNodeId, currentVarId, nodesWithInspectVars, fetchInspectVarValue]) | |||
| }, [currentFocusNodeId, currentVarId, nodesWithInspectVars, fetchInspectVarValue, schemaTypeDefinitions, isLoading]) | |||
| if (isEmpty) { | |||
| return ( | |||
| @@ -56,6 +56,7 @@ const Right = ({ | |||
| const toolIcon = useToolIcon(currentNodeVar?.nodeData) | |||
| const isTruncated = currentNodeVar?.var.is_truncated | |||
| const fullContent = currentNodeVar?.var.full_content | |||
| console.log(currentNodeVar?.var) | |||
| // const isTruncated = true | |||
| // const fullContent = { | |||
| // size_bytes: 11289600, | |||