mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
chore: use flow type instead of whole url
This commit is contained in:
@ -64,8 +64,6 @@ export type CommonHooksFnMap = {
|
||||
configsMap?: {
|
||||
flowId: string
|
||||
flowType: FlowType
|
||||
conversationVarsUrl: string
|
||||
systemVarsUrl: string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -11,20 +11,16 @@ import type { FlowType } from '@/types/common'
|
||||
type Params = {
|
||||
flowType: FlowType
|
||||
flowId: string
|
||||
conversationVarsUrl: string
|
||||
systemVarsUrl: string
|
||||
}
|
||||
|
||||
export const useSetWorkflowVarsWithValue = ({
|
||||
flowType,
|
||||
flowId,
|
||||
conversationVarsUrl,
|
||||
systemVarsUrl,
|
||||
}: Params) => {
|
||||
const workflowStore = useWorkflowStore()
|
||||
const store = useStoreApi()
|
||||
const invalidateConversationVarValues = useInvalidateConversationVarValues(conversationVarsUrl)
|
||||
const invalidateSysVarValues = useInvalidateSysVarValues(systemVarsUrl)
|
||||
const invalidateConversationVarValues = useInvalidateConversationVarValues(flowType, flowId)
|
||||
const invalidateSysVarValues = useInvalidateSysVarValues(flowType, flowId)
|
||||
const { handleCancelAllNodeSuccessStatus } = useNodesInteractionsWithoutSync()
|
||||
|
||||
const setInspectVarsToStore = useCallback((inspectVars: VarInInspect[]) => {
|
||||
|
||||
@ -3,10 +3,7 @@ import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import type { ValueSelector } from '@/app/components/workflow/types'
|
||||
import type { VarInInspect } from '@/types/workflow'
|
||||
import { VarInInspectType } from '@/types/workflow'
|
||||
import {
|
||||
useInvalidateConversationVarValues,
|
||||
useInvalidateSysVarValues,
|
||||
} from '@/service/use-workflow'
|
||||
|
||||
import { useCallback } from 'react'
|
||||
import { isConversationVar, isENV, isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils'
|
||||
import produce from 'immer'
|
||||
@ -19,17 +16,15 @@ import useFLow from '@/service/use-flow'
|
||||
type Params = {
|
||||
flowId: string
|
||||
flowType: FlowType
|
||||
conversationVarsUrl: string
|
||||
systemVarsUrl: string
|
||||
}
|
||||
export const useInspectVarsCrudCommon = ({
|
||||
flowId,
|
||||
flowType,
|
||||
conversationVarsUrl,
|
||||
systemVarsUrl,
|
||||
}: Params) => {
|
||||
const workflowStore = useWorkflowStore()
|
||||
const {
|
||||
useInvalidateConversationVarValues,
|
||||
useInvalidateSysVarValues,
|
||||
useResetConversationVar,
|
||||
useResetToLastRunValue,
|
||||
useDeleteAllInspectorVars,
|
||||
@ -37,10 +32,10 @@ export const useInspectVarsCrudCommon = ({
|
||||
useDeleteInspectVar,
|
||||
useEditInspectorVar,
|
||||
} = useFLow({ flowType })
|
||||
const invalidateConversationVarValues = useInvalidateConversationVarValues(conversationVarsUrl!)
|
||||
const invalidateConversationVarValues = useInvalidateConversationVarValues(flowId)
|
||||
const { mutateAsync: doResetConversationVar } = useResetConversationVar(flowId)
|
||||
const { mutateAsync: doResetToLastRunValue } = useResetToLastRunValue(flowId)
|
||||
const invalidateSysVarValues = useInvalidateSysVarValues(systemVarsUrl!)
|
||||
const invalidateSysVarValues = useInvalidateSysVarValues(flowId)
|
||||
|
||||
const { mutateAsync: doDeleteAllInspectorVars } = useDeleteAllInspectorVars(flowId)
|
||||
const { mutate: doDeleteNodeInspectorVars } = useDeleteNodeInspectorVars(flowId)
|
||||
|
||||
@ -8,8 +8,8 @@ import {
|
||||
const useInspectVarsCrud = () => {
|
||||
const nodesWithInspectVars = useStore(s => s.nodesWithInspectVars)
|
||||
const configsMap = useHooksStore(s => s.configsMap)
|
||||
const { data: conversationVars } = useConversationVarValues(configsMap?.conversationVarsUrl)
|
||||
const { data: systemVars } = useSysVarValues(configsMap?.systemVarsUrl)
|
||||
const { data: conversationVars } = useConversationVarValues(configsMap?.flowType, configsMap?.flowId)
|
||||
const { data: systemVars } = useSysVarValues(configsMap?.flowType, configsMap?.flowId)
|
||||
const hasNodeInspectVars = useHooksStore(s => s.hasNodeInspectVars)
|
||||
const hasSetInspectVar = useHooksStore(s => s.hasSetInspectVar)
|
||||
const fetchInspectVarValue = useHooksStore(s => s.fetchInspectVarValue)
|
||||
|
||||
Reference in New Issue
Block a user