2025-07-02 17:48:07 +08:00
|
|
|
import { useStore } from '../store'
|
|
|
|
import { useHooksStore } from '@/app/components/workflow/hooks-store'
|
2025-06-24 09:10:30 +08:00
|
|
|
import {
|
|
|
|
useConversationVarValues,
|
|
|
|
useSysVarValues,
|
|
|
|
} from '@/service/use-workflow'
|
|
|
|
|
|
|
|
const useInspectVarsCrud = () => {
|
|
|
|
const nodesWithInspectVars = useStore(s => s.nodesWithInspectVars)
|
2025-07-02 17:48:07 +08:00
|
|
|
const configsMap = useHooksStore(s => s.configsMap)
|
|
|
|
const { data: conversationVars } = useConversationVarValues(configsMap?.conversationVarsUrl)
|
|
|
|
const { data: systemVars } = useSysVarValues(configsMap?.systemVarsUrl)
|
|
|
|
const hasNodeInspectVars = useHooksStore(s => s.hasNodeInspectVars)
|
|
|
|
const hasSetInspectVar = useHooksStore(s => s.hasSetInspectVar)
|
|
|
|
const fetchInspectVarValue = useHooksStore(s => s.fetchInspectVarValue)
|
|
|
|
const editInspectVarValue = useHooksStore(s => s.editInspectVarValue)
|
|
|
|
const renameInspectVarName = useHooksStore(s => s.renameInspectVarName)
|
|
|
|
const appendNodeInspectVars = useHooksStore(s => s.appendNodeInspectVars)
|
|
|
|
const deleteInspectVar = useHooksStore(s => s.deleteInspectVar)
|
|
|
|
const deleteNodeInspectorVars = useHooksStore(s => s.deleteNodeInspectorVars)
|
|
|
|
const deleteAllInspectorVars = useHooksStore(s => s.deleteAllInspectorVars)
|
|
|
|
const isInspectVarEdited = useHooksStore(s => s.isInspectVarEdited)
|
|
|
|
const resetToLastRunVar = useHooksStore(s => s.resetToLastRunVar)
|
|
|
|
const invalidateSysVarValues = useHooksStore(s => s.invalidateSysVarValues)
|
|
|
|
const resetConversationVar = useHooksStore(s => s.resetConversationVar)
|
|
|
|
const invalidateConversationVarValues = useHooksStore(s => s.invalidateConversationVarValues)
|
2025-06-24 09:10:30 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
conversationVars: conversationVars || [],
|
|
|
|
systemVars: systemVars || [],
|
|
|
|
nodesWithInspectVars,
|
|
|
|
hasNodeInspectVars,
|
|
|
|
hasSetInspectVar,
|
|
|
|
fetchInspectVarValue,
|
|
|
|
editInspectVarValue,
|
|
|
|
renameInspectVarName,
|
|
|
|
appendNodeInspectVars,
|
|
|
|
deleteInspectVar,
|
|
|
|
deleteNodeInspectorVars,
|
|
|
|
deleteAllInspectorVars,
|
|
|
|
isInspectVarEdited,
|
|
|
|
resetToLastRunVar,
|
|
|
|
invalidateSysVarValues,
|
|
|
|
resetConversationVar,
|
|
|
|
invalidateConversationVarValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default useInspectVarsCrud
|