mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-07 13:15:06 -05:00
Compare commits
49 Commits
fix/previe
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3a99eda19 | ||
|
|
1a66d48add | ||
|
|
46822e91f3 | ||
|
|
2bb68335ee | ||
|
|
8528fbe2d2 | ||
|
|
31fdd2be13 | ||
|
|
028bc652c2 | ||
|
|
c6bf5cd58c | ||
|
|
11dc18a80d | ||
|
|
ab4e9dc72f | ||
|
|
1c58c35bd8 | ||
|
|
d63a5cb504 | ||
|
|
8bd5d41723 | ||
|
|
c12931bc50 | ||
|
|
e9c4251c1c | ||
|
|
cc2be33d6b | ||
|
|
45371e521e | ||
|
|
0ce0f98aa5 | ||
|
|
dff1c9d083 | ||
|
|
b09f683072 | ||
|
|
a8bb0db660 | ||
|
|
af82820a28 | ||
|
|
4372841797 | ||
|
|
5e8c843241 | ||
|
|
7bf3d73ee6 | ||
|
|
7ffc11a738 | ||
|
|
be578e2ed7 | ||
|
|
f415e5edc4 | ||
|
|
13a6e6c3fa | ||
|
|
f5ab7f21ae | ||
|
|
bfb6fffe38 | ||
|
|
4fbec0a43f | ||
|
|
585f5e365b | ||
|
|
3792bdd252 | ||
|
|
eb5d1f3e5b | ||
|
|
54ab82c8dd | ||
|
|
f895bf469b | ||
|
|
dd3209af06 | ||
|
|
b6ba3b50a7 | ||
|
|
b304233062 | ||
|
|
57e4b49bd6 | ||
|
|
e12dd204ed | ||
|
|
3d9d9cbc54 | ||
|
|
0f4ec962ad | ||
|
|
4827866f9a | ||
|
|
3e697d9ed9 | ||
|
|
4431a1a484 | ||
|
|
4d1a9a3f22 | ||
|
|
eb07a080fb |
@@ -35,7 +35,6 @@ interface CredentialSelectorProps {
|
|||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
isPreview?: boolean
|
isPreview?: boolean
|
||||||
previewValue?: any | null
|
previewValue?: any | null
|
||||||
previewContextValues?: Record<string, unknown>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CredentialSelector({
|
export function CredentialSelector({
|
||||||
@@ -44,7 +43,6 @@ export function CredentialSelector({
|
|||||||
disabled = false,
|
disabled = false,
|
||||||
isPreview = false,
|
isPreview = false,
|
||||||
previewValue,
|
previewValue,
|
||||||
previewContextValues,
|
|
||||||
}: CredentialSelectorProps) {
|
}: CredentialSelectorProps) {
|
||||||
const [showOAuthModal, setShowOAuthModal] = useState(false)
|
const [showOAuthModal, setShowOAuthModal] = useState(false)
|
||||||
const [editingValue, setEditingValue] = useState('')
|
const [editingValue, setEditingValue] = useState('')
|
||||||
@@ -69,11 +67,7 @@ export function CredentialSelector({
|
|||||||
canUseCredentialSets
|
canUseCredentialSets
|
||||||
)
|
)
|
||||||
|
|
||||||
const { depsSatisfied, dependsOn } = useDependsOnGate(blockId, subBlock, {
|
const { depsSatisfied, dependsOn } = useDependsOnGate(blockId, subBlock, { disabled, isPreview })
|
||||||
disabled,
|
|
||||||
isPreview,
|
|
||||||
previewContextValues,
|
|
||||||
})
|
|
||||||
const hasDependencies = dependsOn.length > 0
|
const hasDependencies = dependsOn.length > 0
|
||||||
|
|
||||||
const effectiveDisabled = disabled || (hasDependencies && !depsSatisfied)
|
const effectiveDisabled = disabled || (hasDependencies && !depsSatisfied)
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { Tooltip } from '@/components/emcn'
|
|||||||
import { SelectorCombobox } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/selector-combobox/selector-combobox'
|
import { SelectorCombobox } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/selector-combobox/selector-combobox'
|
||||||
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
||||||
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
||||||
import { resolvePreviewContextValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/utils'
|
|
||||||
import type { SubBlockConfig } from '@/blocks/types'
|
import type { SubBlockConfig } from '@/blocks/types'
|
||||||
import type { SelectorContext } from '@/hooks/selectors/types'
|
import type { SelectorContext } from '@/hooks/selectors/types'
|
||||||
|
|
||||||
@@ -34,9 +33,7 @@ export function DocumentSelector({
|
|||||||
previewContextValues,
|
previewContextValues,
|
||||||
})
|
})
|
||||||
const [knowledgeBaseIdFromStore] = useSubBlockValue(blockId, 'knowledgeBaseId')
|
const [knowledgeBaseIdFromStore] = useSubBlockValue(blockId, 'knowledgeBaseId')
|
||||||
const knowledgeBaseIdValue = previewContextValues
|
const knowledgeBaseIdValue = previewContextValues?.knowledgeBaseId ?? knowledgeBaseIdFromStore
|
||||||
? resolvePreviewContextValue(previewContextValues.knowledgeBaseId)
|
|
||||||
: knowledgeBaseIdFromStore
|
|
||||||
const normalizedKnowledgeBaseId =
|
const normalizedKnowledgeBaseId =
|
||||||
typeof knowledgeBaseIdValue === 'string' && knowledgeBaseIdValue.trim().length > 0
|
typeof knowledgeBaseIdValue === 'string' && knowledgeBaseIdValue.trim().length > 0
|
||||||
? knowledgeBaseIdValue
|
? knowledgeBaseIdValue
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import { formatDisplayText } from '@/app/workspace/[workspaceId]/w/[workflowId]/
|
|||||||
import { TagDropdown } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown'
|
import { TagDropdown } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown'
|
||||||
import { useSubBlockInput } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-input'
|
import { useSubBlockInput } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-input'
|
||||||
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
||||||
import { resolvePreviewContextValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/utils'
|
|
||||||
import { useAccessibleReferencePrefixes } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes'
|
import { useAccessibleReferencePrefixes } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes'
|
||||||
import type { SubBlockConfig } from '@/blocks/types'
|
import type { SubBlockConfig } from '@/blocks/types'
|
||||||
import { useKnowledgeBaseTagDefinitions } from '@/hooks/kb/use-knowledge-base-tag-definitions'
|
import { useKnowledgeBaseTagDefinitions } from '@/hooks/kb/use-knowledge-base-tag-definitions'
|
||||||
@@ -78,9 +77,7 @@ export function DocumentTagEntry({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const [knowledgeBaseIdFromStore] = useSubBlockValue(blockId, 'knowledgeBaseId')
|
const [knowledgeBaseIdFromStore] = useSubBlockValue(blockId, 'knowledgeBaseId')
|
||||||
const knowledgeBaseIdValue = previewContextValues
|
const knowledgeBaseIdValue = previewContextValues?.knowledgeBaseId ?? knowledgeBaseIdFromStore
|
||||||
? resolvePreviewContextValue(previewContextValues.knowledgeBaseId)
|
|
||||||
: knowledgeBaseIdFromStore
|
|
||||||
const knowledgeBaseId =
|
const knowledgeBaseId =
|
||||||
typeof knowledgeBaseIdValue === 'string' && knowledgeBaseIdValue.trim().length > 0
|
typeof knowledgeBaseIdValue === 'string' && knowledgeBaseIdValue.trim().length > 0
|
||||||
? knowledgeBaseIdValue
|
? knowledgeBaseIdValue
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { SelectorCombobox } from '@/app/workspace/[workspaceId]/w/[workflowId]/c
|
|||||||
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
||||||
import { useForeignCredential } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-foreign-credential'
|
import { useForeignCredential } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-foreign-credential'
|
||||||
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
||||||
import { resolvePreviewContextValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/utils'
|
|
||||||
import { getBlock } from '@/blocks/registry'
|
import { getBlock } from '@/blocks/registry'
|
||||||
import type { SubBlockConfig } from '@/blocks/types'
|
import type { SubBlockConfig } from '@/blocks/types'
|
||||||
import { isDependency } from '@/blocks/utils'
|
import { isDependency } from '@/blocks/utils'
|
||||||
@@ -63,56 +62,42 @@ export function FileSelectorInput({
|
|||||||
|
|
||||||
const [domainValueFromStore] = useSubBlockValue(blockId, 'domain')
|
const [domainValueFromStore] = useSubBlockValue(blockId, 'domain')
|
||||||
|
|
||||||
const connectedCredential = previewContextValues
|
const connectedCredential = previewContextValues?.credential ?? blockValues.credential
|
||||||
? resolvePreviewContextValue(previewContextValues.credential)
|
const domainValue = previewContextValues?.domain ?? domainValueFromStore
|
||||||
: blockValues.credential
|
|
||||||
const domainValue = previewContextValues
|
|
||||||
? resolvePreviewContextValue(previewContextValues.domain)
|
|
||||||
: domainValueFromStore
|
|
||||||
|
|
||||||
const teamIdValue = useMemo(
|
const teamIdValue = useMemo(
|
||||||
() =>
|
() =>
|
||||||
previewContextValues
|
previewContextValues?.teamId ??
|
||||||
? resolvePreviewContextValue(previewContextValues.teamId)
|
resolveDependencyValue('teamId', blockValues, canonicalIndex, canonicalModeOverrides),
|
||||||
: resolveDependencyValue('teamId', blockValues, canonicalIndex, canonicalModeOverrides),
|
[previewContextValues?.teamId, blockValues, canonicalIndex, canonicalModeOverrides]
|
||||||
[previewContextValues, blockValues, canonicalIndex, canonicalModeOverrides]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const siteIdValue = useMemo(
|
const siteIdValue = useMemo(
|
||||||
() =>
|
() =>
|
||||||
previewContextValues
|
previewContextValues?.siteId ??
|
||||||
? resolvePreviewContextValue(previewContextValues.siteId)
|
resolveDependencyValue('siteId', blockValues, canonicalIndex, canonicalModeOverrides),
|
||||||
: resolveDependencyValue('siteId', blockValues, canonicalIndex, canonicalModeOverrides),
|
[previewContextValues?.siteId, blockValues, canonicalIndex, canonicalModeOverrides]
|
||||||
[previewContextValues, blockValues, canonicalIndex, canonicalModeOverrides]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const collectionIdValue = useMemo(
|
const collectionIdValue = useMemo(
|
||||||
() =>
|
() =>
|
||||||
previewContextValues
|
previewContextValues?.collectionId ??
|
||||||
? resolvePreviewContextValue(previewContextValues.collectionId)
|
resolveDependencyValue('collectionId', blockValues, canonicalIndex, canonicalModeOverrides),
|
||||||
: resolveDependencyValue(
|
[previewContextValues?.collectionId, blockValues, canonicalIndex, canonicalModeOverrides]
|
||||||
'collectionId',
|
|
||||||
blockValues,
|
|
||||||
canonicalIndex,
|
|
||||||
canonicalModeOverrides
|
|
||||||
),
|
|
||||||
[previewContextValues, blockValues, canonicalIndex, canonicalModeOverrides]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const projectIdValue = useMemo(
|
const projectIdValue = useMemo(
|
||||||
() =>
|
() =>
|
||||||
previewContextValues
|
previewContextValues?.projectId ??
|
||||||
? resolvePreviewContextValue(previewContextValues.projectId)
|
resolveDependencyValue('projectId', blockValues, canonicalIndex, canonicalModeOverrides),
|
||||||
: resolveDependencyValue('projectId', blockValues, canonicalIndex, canonicalModeOverrides),
|
[previewContextValues?.projectId, blockValues, canonicalIndex, canonicalModeOverrides]
|
||||||
[previewContextValues, blockValues, canonicalIndex, canonicalModeOverrides]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const planIdValue = useMemo(
|
const planIdValue = useMemo(
|
||||||
() =>
|
() =>
|
||||||
previewContextValues
|
previewContextValues?.planId ??
|
||||||
? resolvePreviewContextValue(previewContextValues.planId)
|
resolveDependencyValue('planId', blockValues, canonicalIndex, canonicalModeOverrides),
|
||||||
: resolveDependencyValue('planId', blockValues, canonicalIndex, canonicalModeOverrides),
|
[previewContextValues?.planId, blockValues, canonicalIndex, canonicalModeOverrides]
|
||||||
[previewContextValues, blockValues, canonicalIndex, canonicalModeOverrides]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const normalizedCredentialId =
|
const normalizedCredentialId =
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { SelectorCombobox } from '@/app/workspace/[workspaceId]/w/[workflowId]/c
|
|||||||
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
||||||
import { useForeignCredential } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-foreign-credential'
|
import { useForeignCredential } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-foreign-credential'
|
||||||
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
||||||
import { resolvePreviewContextValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/utils'
|
|
||||||
import type { SubBlockConfig } from '@/blocks/types'
|
import type { SubBlockConfig } from '@/blocks/types'
|
||||||
import { resolveSelectorForSubBlock } from '@/hooks/selectors/resolution'
|
import { resolveSelectorForSubBlock } from '@/hooks/selectors/resolution'
|
||||||
import { useCollaborativeWorkflow } from '@/hooks/use-collaborative-workflow'
|
import { useCollaborativeWorkflow } from '@/hooks/use-collaborative-workflow'
|
||||||
@@ -18,7 +17,6 @@ interface FolderSelectorInputProps {
|
|||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
isPreview?: boolean
|
isPreview?: boolean
|
||||||
previewValue?: any | null
|
previewValue?: any | null
|
||||||
previewContextValues?: Record<string, unknown>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function FolderSelectorInput({
|
export function FolderSelectorInput({
|
||||||
@@ -27,13 +25,9 @@ export function FolderSelectorInput({
|
|||||||
disabled = false,
|
disabled = false,
|
||||||
isPreview = false,
|
isPreview = false,
|
||||||
previewValue,
|
previewValue,
|
||||||
previewContextValues,
|
|
||||||
}: FolderSelectorInputProps) {
|
}: FolderSelectorInputProps) {
|
||||||
const [storeValue] = useSubBlockValue(blockId, subBlock.id)
|
const [storeValue] = useSubBlockValue(blockId, subBlock.id)
|
||||||
const [credentialFromStore] = useSubBlockValue(blockId, 'credential')
|
const [connectedCredential] = useSubBlockValue(blockId, 'credential')
|
||||||
const connectedCredential = previewContextValues
|
|
||||||
? resolvePreviewContextValue(previewContextValues.credential)
|
|
||||||
: credentialFromStore
|
|
||||||
const { collaborativeSetSubblockValue } = useCollaborativeWorkflow()
|
const { collaborativeSetSubblockValue } = useCollaborativeWorkflow()
|
||||||
const { activeWorkflowId } = useWorkflowRegistry()
|
const { activeWorkflowId } = useWorkflowRegistry()
|
||||||
const [selectedFolderId, setSelectedFolderId] = useState<string>('')
|
const [selectedFolderId, setSelectedFolderId] = useState<string>('')
|
||||||
@@ -53,11 +47,7 @@ export function FolderSelectorInput({
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Central dependsOn gating
|
// Central dependsOn gating
|
||||||
const { finalDisabled } = useDependsOnGate(blockId, subBlock, {
|
const { finalDisabled } = useDependsOnGate(blockId, subBlock, { disabled, isPreview })
|
||||||
disabled,
|
|
||||||
isPreview,
|
|
||||||
previewContextValues,
|
|
||||||
})
|
|
||||||
|
|
||||||
// Get the current value from the store or prop value if in preview mode
|
// Get the current value from the store or prop value if in preview mode
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { formatDisplayText } from '@/app/workspace/[workspaceId]/w/[workflowId]/
|
|||||||
import { TagDropdown } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown'
|
import { TagDropdown } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown'
|
||||||
import { useSubBlockInput } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-input'
|
import { useSubBlockInput } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-input'
|
||||||
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
||||||
import { resolvePreviewContextValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/utils'
|
|
||||||
import { useAccessibleReferencePrefixes } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes'
|
import { useAccessibleReferencePrefixes } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes'
|
||||||
import { useWorkflowState } from '@/hooks/queries/workflows'
|
import { useWorkflowState } from '@/hooks/queries/workflows'
|
||||||
|
|
||||||
@@ -38,8 +37,6 @@ interface InputMappingProps {
|
|||||||
isPreview?: boolean
|
isPreview?: boolean
|
||||||
previewValue?: Record<string, unknown>
|
previewValue?: Record<string, unknown>
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
/** Sub-block values from the preview context for resolving sibling sub-block values */
|
|
||||||
previewContextValues?: Record<string, unknown>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,13 +50,9 @@ export function InputMapping({
|
|||||||
isPreview = false,
|
isPreview = false,
|
||||||
previewValue,
|
previewValue,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
previewContextValues,
|
|
||||||
}: InputMappingProps) {
|
}: InputMappingProps) {
|
||||||
const [mapping, setMapping] = useSubBlockValue(blockId, subBlockId)
|
const [mapping, setMapping] = useSubBlockValue(blockId, subBlockId)
|
||||||
const [storeWorkflowId] = useSubBlockValue(blockId, 'workflowId')
|
const [selectedWorkflowId] = useSubBlockValue(blockId, 'workflowId')
|
||||||
const selectedWorkflowId = previewContextValues
|
|
||||||
? resolvePreviewContextValue(previewContextValues.workflowId)
|
|
||||||
: storeWorkflowId
|
|
||||||
|
|
||||||
const inputController = useSubBlockInput({
|
const inputController = useSubBlockInput({
|
||||||
blockId,
|
blockId,
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import { type FilterFieldType, getOperatorsForFieldType } from '@/lib/knowledge/
|
|||||||
import { formatDisplayText } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/formatted-text'
|
import { formatDisplayText } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/formatted-text'
|
||||||
import { TagDropdown } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown'
|
import { TagDropdown } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown'
|
||||||
import { useSubBlockInput } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-input'
|
import { useSubBlockInput } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-input'
|
||||||
import { resolvePreviewContextValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/utils'
|
|
||||||
import { useAccessibleReferencePrefixes } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes'
|
import { useAccessibleReferencePrefixes } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes'
|
||||||
import type { SubBlockConfig } from '@/blocks/types'
|
import type { SubBlockConfig } from '@/blocks/types'
|
||||||
import { useKnowledgeBaseTagDefinitions } from '@/hooks/kb/use-knowledge-base-tag-definitions'
|
import { useKnowledgeBaseTagDefinitions } from '@/hooks/kb/use-knowledge-base-tag-definitions'
|
||||||
@@ -70,9 +69,7 @@ export function KnowledgeTagFilters({
|
|||||||
const overlayRefs = useRef<Record<string, HTMLDivElement>>({})
|
const overlayRefs = useRef<Record<string, HTMLDivElement>>({})
|
||||||
|
|
||||||
const [knowledgeBaseIdFromStore] = useSubBlockValue(blockId, 'knowledgeBaseId')
|
const [knowledgeBaseIdFromStore] = useSubBlockValue(blockId, 'knowledgeBaseId')
|
||||||
const knowledgeBaseIdValue = previewContextValues
|
const knowledgeBaseIdValue = previewContextValues?.knowledgeBaseId ?? knowledgeBaseIdFromStore
|
||||||
? resolvePreviewContextValue(previewContextValues.knowledgeBaseId)
|
|
||||||
: knowledgeBaseIdFromStore
|
|
||||||
const knowledgeBaseId =
|
const knowledgeBaseId =
|
||||||
typeof knowledgeBaseIdValue === 'string' && knowledgeBaseIdValue.trim().length > 0
|
typeof knowledgeBaseIdValue === 'string' && knowledgeBaseIdValue.trim().length > 0
|
||||||
? knowledgeBaseIdValue
|
? knowledgeBaseIdValue
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { cn } from '@/lib/core/utils/cn'
|
|||||||
import { LongInput } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/long-input/long-input'
|
import { LongInput } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/long-input/long-input'
|
||||||
import { ShortInput } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/short-input/short-input'
|
import { ShortInput } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/short-input/short-input'
|
||||||
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
||||||
import { resolvePreviewContextValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/utils'
|
|
||||||
import type { SubBlockConfig } from '@/blocks/types'
|
import type { SubBlockConfig } from '@/blocks/types'
|
||||||
import { useMcpTools } from '@/hooks/mcp/use-mcp-tools'
|
import { useMcpTools } from '@/hooks/mcp/use-mcp-tools'
|
||||||
import { formatParameterLabel } from '@/tools/params'
|
import { formatParameterLabel } from '@/tools/params'
|
||||||
@@ -19,7 +18,6 @@ interface McpDynamicArgsProps {
|
|||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
isPreview?: boolean
|
isPreview?: boolean
|
||||||
previewValue?: any
|
previewValue?: any
|
||||||
previewContextValues?: Record<string, unknown>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,19 +47,12 @@ export function McpDynamicArgs({
|
|||||||
disabled = false,
|
disabled = false,
|
||||||
isPreview = false,
|
isPreview = false,
|
||||||
previewValue,
|
previewValue,
|
||||||
previewContextValues,
|
|
||||||
}: McpDynamicArgsProps) {
|
}: McpDynamicArgsProps) {
|
||||||
const params = useParams()
|
const params = useParams()
|
||||||
const workspaceId = params.workspaceId as string
|
const workspaceId = params.workspaceId as string
|
||||||
const { mcpTools, isLoading } = useMcpTools(workspaceId)
|
const { mcpTools, isLoading } = useMcpTools(workspaceId)
|
||||||
const [toolFromStore] = useSubBlockValue(blockId, 'tool')
|
const [selectedTool] = useSubBlockValue(blockId, 'tool')
|
||||||
const selectedTool = previewContextValues
|
const [cachedSchema] = useSubBlockValue(blockId, '_toolSchema')
|
||||||
? resolvePreviewContextValue(previewContextValues.tool)
|
|
||||||
: toolFromStore
|
|
||||||
const [schemaFromStore] = useSubBlockValue(blockId, '_toolSchema')
|
|
||||||
const cachedSchema = previewContextValues
|
|
||||||
? resolvePreviewContextValue(previewContextValues._toolSchema)
|
|
||||||
: schemaFromStore
|
|
||||||
const [toolArgs, setToolArgs] = useSubBlockValue(blockId, subBlockId)
|
const [toolArgs, setToolArgs] = useSubBlockValue(blockId, subBlockId)
|
||||||
|
|
||||||
const selectedToolConfig = mcpTools.find((tool) => tool.id === selectedTool)
|
const selectedToolConfig = mcpTools.find((tool) => tool.id === selectedTool)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { useEffect, useMemo, useState } from 'react'
|
|||||||
import { useParams } from 'next/navigation'
|
import { useParams } from 'next/navigation'
|
||||||
import { Combobox } from '@/components/emcn/components'
|
import { Combobox } from '@/components/emcn/components'
|
||||||
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
||||||
import { resolvePreviewContextValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/utils'
|
|
||||||
import type { SubBlockConfig } from '@/blocks/types'
|
import type { SubBlockConfig } from '@/blocks/types'
|
||||||
import { useMcpTools } from '@/hooks/mcp/use-mcp-tools'
|
import { useMcpTools } from '@/hooks/mcp/use-mcp-tools'
|
||||||
|
|
||||||
@@ -14,7 +13,6 @@ interface McpToolSelectorProps {
|
|||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
isPreview?: boolean
|
isPreview?: boolean
|
||||||
previewValue?: string | null
|
previewValue?: string | null
|
||||||
previewContextValues?: Record<string, unknown>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function McpToolSelector({
|
export function McpToolSelector({
|
||||||
@@ -23,7 +21,6 @@ export function McpToolSelector({
|
|||||||
disabled = false,
|
disabled = false,
|
||||||
isPreview = false,
|
isPreview = false,
|
||||||
previewValue,
|
previewValue,
|
||||||
previewContextValues,
|
|
||||||
}: McpToolSelectorProps) {
|
}: McpToolSelectorProps) {
|
||||||
const params = useParams()
|
const params = useParams()
|
||||||
const workspaceId = params.workspaceId as string
|
const workspaceId = params.workspaceId as string
|
||||||
@@ -34,10 +31,7 @@ export function McpToolSelector({
|
|||||||
const [storeValue, setStoreValue] = useSubBlockValue(blockId, subBlock.id)
|
const [storeValue, setStoreValue] = useSubBlockValue(blockId, subBlock.id)
|
||||||
const [, setSchemaCache] = useSubBlockValue(blockId, '_toolSchema')
|
const [, setSchemaCache] = useSubBlockValue(blockId, '_toolSchema')
|
||||||
|
|
||||||
const [serverFromStore] = useSubBlockValue(blockId, 'server')
|
const [serverValue] = useSubBlockValue(blockId, 'server')
|
||||||
const serverValue = previewContextValues
|
|
||||||
? resolvePreviewContextValue(previewContextValues.server)
|
|
||||||
: serverFromStore
|
|
||||||
|
|
||||||
const label = subBlock.placeholder || 'Select tool'
|
const label = subBlock.placeholder || 'Select tool'
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { SelectorCombobox } from '@/app/workspace/[workspaceId]/w/[workflowId]/c
|
|||||||
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
||||||
import { useForeignCredential } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-foreign-credential'
|
import { useForeignCredential } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-foreign-credential'
|
||||||
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
||||||
import { resolvePreviewContextValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/utils'
|
|
||||||
import { getBlock } from '@/blocks/registry'
|
import { getBlock } from '@/blocks/registry'
|
||||||
import type { SubBlockConfig } from '@/blocks/types'
|
import type { SubBlockConfig } from '@/blocks/types'
|
||||||
import { resolveSelectorForSubBlock } from '@/hooks/selectors/resolution'
|
import { resolveSelectorForSubBlock } from '@/hooks/selectors/resolution'
|
||||||
@@ -56,19 +55,14 @@ export function ProjectSelectorInput({
|
|||||||
return (workflowValues as Record<string, Record<string, unknown>>)[blockId] || {}
|
return (workflowValues as Record<string, Record<string, unknown>>)[blockId] || {}
|
||||||
})
|
})
|
||||||
|
|
||||||
const connectedCredential = previewContextValues
|
const connectedCredential = previewContextValues?.credential ?? blockValues.credential
|
||||||
? resolvePreviewContextValue(previewContextValues.credential)
|
const jiraDomain = previewContextValues?.domain ?? jiraDomainFromStore
|
||||||
: blockValues.credential
|
|
||||||
const jiraDomain = previewContextValues
|
|
||||||
? resolvePreviewContextValue(previewContextValues.domain)
|
|
||||||
: jiraDomainFromStore
|
|
||||||
|
|
||||||
const linearTeamId = useMemo(
|
const linearTeamId = useMemo(
|
||||||
() =>
|
() =>
|
||||||
previewContextValues
|
previewContextValues?.teamId ??
|
||||||
? resolvePreviewContextValue(previewContextValues.teamId)
|
resolveDependencyValue('teamId', blockValues, canonicalIndex, canonicalModeOverrides),
|
||||||
: resolveDependencyValue('teamId', blockValues, canonicalIndex, canonicalModeOverrides),
|
[previewContextValues?.teamId, blockValues, canonicalIndex, canonicalModeOverrides]
|
||||||
[previewContextValues, blockValues, canonicalIndex, canonicalModeOverrides]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const serviceId = subBlock.serviceId || ''
|
const serviceId = subBlock.serviceId || ''
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { buildCanonicalIndex, resolveDependencyValue } from '@/lib/workflows/sub
|
|||||||
import { SelectorCombobox } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/selector-combobox/selector-combobox'
|
import { SelectorCombobox } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/selector-combobox/selector-combobox'
|
||||||
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
||||||
import { useForeignCredential } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-foreign-credential'
|
import { useForeignCredential } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-foreign-credential'
|
||||||
import { resolvePreviewContextValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/utils'
|
|
||||||
import { getBlock } from '@/blocks/registry'
|
import { getBlock } from '@/blocks/registry'
|
||||||
import type { SubBlockConfig } from '@/blocks/types'
|
import type { SubBlockConfig } from '@/blocks/types'
|
||||||
import { resolveSelectorForSubBlock, type SelectorResolution } from '@/hooks/selectors/resolution'
|
import { resolveSelectorForSubBlock, type SelectorResolution } from '@/hooks/selectors/resolution'
|
||||||
@@ -67,12 +66,9 @@ export function SheetSelectorInput({
|
|||||||
[blockValues, canonicalIndex, canonicalModeOverrides]
|
[blockValues, canonicalIndex, canonicalModeOverrides]
|
||||||
)
|
)
|
||||||
|
|
||||||
const connectedCredential = previewContextValues
|
const connectedCredential = previewContextValues?.credential ?? connectedCredentialFromStore
|
||||||
? resolvePreviewContextValue(previewContextValues.credential)
|
|
||||||
: connectedCredentialFromStore
|
|
||||||
const spreadsheetId = previewContextValues
|
const spreadsheetId = previewContextValues
|
||||||
? (resolvePreviewContextValue(previewContextValues.spreadsheetId) ??
|
? (previewContextValues.spreadsheetId ?? previewContextValues.manualSpreadsheetId)
|
||||||
resolvePreviewContextValue(previewContextValues.manualSpreadsheetId))
|
|
||||||
: spreadsheetIdFromStore
|
: spreadsheetIdFromStore
|
||||||
|
|
||||||
const normalizedCredentialId =
|
const normalizedCredentialId =
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { SelectorCombobox } from '@/app/workspace/[workspaceId]/w/[workflowId]/c
|
|||||||
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
import { useDependsOnGate } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate'
|
||||||
import { useForeignCredential } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-foreign-credential'
|
import { useForeignCredential } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-foreign-credential'
|
||||||
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
|
||||||
import { resolvePreviewContextValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/utils'
|
|
||||||
import type { SubBlockConfig } from '@/blocks/types'
|
import type { SubBlockConfig } from '@/blocks/types'
|
||||||
import type { SelectorContext, SelectorKey } from '@/hooks/selectors/types'
|
import type { SelectorContext, SelectorKey } from '@/hooks/selectors/types'
|
||||||
|
|
||||||
@@ -59,15 +58,9 @@ export function SlackSelectorInput({
|
|||||||
const [botToken] = useSubBlockValue(blockId, 'botToken')
|
const [botToken] = useSubBlockValue(blockId, 'botToken')
|
||||||
const [connectedCredential] = useSubBlockValue(blockId, 'credential')
|
const [connectedCredential] = useSubBlockValue(blockId, 'credential')
|
||||||
|
|
||||||
const effectiveAuthMethod = previewContextValues
|
const effectiveAuthMethod = previewContextValues?.authMethod ?? authMethod
|
||||||
? resolvePreviewContextValue(previewContextValues.authMethod)
|
const effectiveBotToken = previewContextValues?.botToken ?? botToken
|
||||||
: authMethod
|
const effectiveCredential = previewContextValues?.credential ?? connectedCredential
|
||||||
const effectiveBotToken = previewContextValues
|
|
||||||
? resolvePreviewContextValue(previewContextValues.botToken)
|
|
||||||
: botToken
|
|
||||||
const effectiveCredential = previewContextValues
|
|
||||||
? resolvePreviewContextValue(previewContextValues.credential)
|
|
||||||
: connectedCredential
|
|
||||||
const [_selectedValue, setSelectedValue] = useState<string | null>(null)
|
const [_selectedValue, setSelectedValue] = useState<string | null>(null)
|
||||||
|
|
||||||
const serviceId = subBlock.serviceId || ''
|
const serviceId = subBlock.serviceId || ''
|
||||||
|
|||||||
@@ -332,7 +332,6 @@ function FolderSelectorSyncWrapper({
|
|||||||
dependsOn: uiComponent.dependsOn,
|
dependsOn: uiComponent.dependsOn,
|
||||||
}}
|
}}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
previewContextValues={previewContextValues}
|
|
||||||
/>
|
/>
|
||||||
</GenericSyncWrapper>
|
</GenericSyncWrapper>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -785,7 +785,6 @@ function SubBlockComponent({
|
|||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
isPreview={isPreview}
|
isPreview={isPreview}
|
||||||
previewValue={previewValue}
|
previewValue={previewValue}
|
||||||
previewContextValues={isPreview ? subBlockValues : undefined}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -821,7 +820,6 @@ function SubBlockComponent({
|
|||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
isPreview={isPreview}
|
isPreview={isPreview}
|
||||||
previewValue={previewValue}
|
previewValue={previewValue}
|
||||||
previewContextValues={isPreview ? subBlockValues : undefined}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -833,7 +831,6 @@ function SubBlockComponent({
|
|||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
isPreview={isPreview}
|
isPreview={isPreview}
|
||||||
previewValue={previewValue}
|
previewValue={previewValue}
|
||||||
previewContextValues={isPreview ? subBlockValues : undefined}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -856,7 +853,6 @@ function SubBlockComponent({
|
|||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
isPreview={isPreview}
|
isPreview={isPreview}
|
||||||
previewValue={previewValue as any}
|
previewValue={previewValue as any}
|
||||||
previewContextValues={isPreview ? subBlockValues : undefined}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -868,7 +864,6 @@ function SubBlockComponent({
|
|||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
isPreview={isPreview}
|
isPreview={isPreview}
|
||||||
previewValue={previewValue as any}
|
previewValue={previewValue as any}
|
||||||
previewContextValues={isPreview ? subBlockValues : undefined}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -880,7 +875,6 @@ function SubBlockComponent({
|
|||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
isPreview={isPreview}
|
isPreview={isPreview}
|
||||||
previewValue={previewValue as any}
|
previewValue={previewValue as any}
|
||||||
previewContextValues={isPreview ? subBlockValues : undefined}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -905,7 +899,6 @@ function SubBlockComponent({
|
|||||||
isPreview={isPreview}
|
isPreview={isPreview}
|
||||||
previewValue={previewValue as any}
|
previewValue={previewValue as any}
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
previewContextValues={isPreview ? subBlockValues : undefined}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -941,7 +934,6 @@ function SubBlockComponent({
|
|||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
isPreview={isPreview}
|
isPreview={isPreview}
|
||||||
previewValue={previewValue}
|
previewValue={previewValue}
|
||||||
previewContextValues={isPreview ? subBlockValues : undefined}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -975,7 +967,6 @@ function SubBlockComponent({
|
|||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
isPreview={isPreview}
|
isPreview={isPreview}
|
||||||
previewValue={previewValue as any}
|
previewValue={previewValue as any}
|
||||||
previewContextValues={isPreview ? subBlockValues : undefined}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -987,7 +978,6 @@ function SubBlockComponent({
|
|||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
isPreview={isPreview}
|
isPreview={isPreview}
|
||||||
previewValue={previewValue}
|
previewValue={previewValue}
|
||||||
previewContextValues={isPreview ? subBlockValues : undefined}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* Extracts the raw value from a preview context entry.
|
|
||||||
*
|
|
||||||
* @remarks
|
|
||||||
* In the sub-block preview context, values are wrapped as `{ value: T }` objects
|
|
||||||
* (the full sub-block state). In the tool-input preview context, values are already
|
|
||||||
* raw. This function normalizes both cases to return the underlying value.
|
|
||||||
*
|
|
||||||
* @param raw - The preview context entry, which may be a raw value or a `{ value: T }` wrapper
|
|
||||||
* @returns The unwrapped value, or `null` if the input is nullish
|
|
||||||
*/
|
|
||||||
export function resolvePreviewContextValue(raw: unknown): unknown {
|
|
||||||
if (raw === null || raw === undefined) return null
|
|
||||||
if (typeof raw === 'object' && !Array.isArray(raw) && 'value' in raw) {
|
|
||||||
return (raw as Record<string, unknown>).value ?? null
|
|
||||||
}
|
|
||||||
return raw
|
|
||||||
}
|
|
||||||
@@ -784,12 +784,8 @@ function PreviewEditorContent({
|
|||||||
? childWorkflowSnapshotState
|
? childWorkflowSnapshotState
|
||||||
: childWorkflowState
|
: childWorkflowState
|
||||||
const resolvedIsLoadingChildWorkflow = isExecutionMode ? false : isLoadingChildWorkflow
|
const resolvedIsLoadingChildWorkflow = isExecutionMode ? false : isLoadingChildWorkflow
|
||||||
const isBlockNotExecuted = isExecutionMode && !executionData
|
|
||||||
const isMissingChildWorkflow =
|
const isMissingChildWorkflow =
|
||||||
Boolean(childWorkflowId) &&
|
Boolean(childWorkflowId) && !resolvedIsLoadingChildWorkflow && !resolvedChildWorkflowState
|
||||||
!isBlockNotExecuted &&
|
|
||||||
!resolvedIsLoadingChildWorkflow &&
|
|
||||||
!resolvedChildWorkflowState
|
|
||||||
|
|
||||||
/** Drills down into the child workflow or opens it in a new tab */
|
/** Drills down into the child workflow or opens it in a new tab */
|
||||||
const handleExpandChildWorkflow = useCallback(() => {
|
const handleExpandChildWorkflow = useCallback(() => {
|
||||||
@@ -1196,7 +1192,7 @@ function PreviewEditorContent({
|
|||||||
<div ref={subBlocksRef} className='subblocks-section flex flex-1 flex-col overflow-hidden'>
|
<div ref={subBlocksRef} className='subblocks-section flex flex-1 flex-col overflow-hidden'>
|
||||||
<div className='flex-1 overflow-y-auto overflow-x-hidden'>
|
<div className='flex-1 overflow-y-auto overflow-x-hidden'>
|
||||||
{/* Not Executed Banner - shown when in execution mode but block wasn't executed */}
|
{/* Not Executed Banner - shown when in execution mode but block wasn't executed */}
|
||||||
{isBlockNotExecuted && (
|
{isExecutionMode && !executionData && (
|
||||||
<div className='flex min-w-0 flex-col gap-[8px] overflow-hidden border-[var(--border)] border-b px-[12px] py-[10px]'>
|
<div className='flex min-w-0 flex-col gap-[8px] overflow-hidden border-[var(--border)] border-b px-[12px] py-[10px]'>
|
||||||
<div className='flex items-center justify-between'>
|
<div className='flex items-center justify-between'>
|
||||||
<Badge variant='gray-secondary' size='sm' dot>
|
<Badge variant='gray-secondary' size='sm' dot>
|
||||||
@@ -1423,9 +1419,7 @@ function PreviewEditorContent({
|
|||||||
) : (
|
) : (
|
||||||
<div className='flex h-full items-center justify-center bg-[var(--surface-3)]'>
|
<div className='flex h-full items-center justify-center bg-[var(--surface-3)]'>
|
||||||
<span className='text-[13px] text-[var(--text-tertiary)]'>
|
<span className='text-[13px] text-[var(--text-tertiary)]'>
|
||||||
{isBlockNotExecuted
|
{isMissingChildWorkflow
|
||||||
? 'Not Executed'
|
|
||||||
: isMissingChildWorkflow
|
|
||||||
? DELETED_WORKFLOW_LABEL
|
? DELETED_WORKFLOW_LABEL
|
||||||
: 'Unable to load preview'}
|
: 'Unable to load preview'}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -33,25 +33,11 @@ export class SnapshotService implements ISnapshotService {
|
|||||||
|
|
||||||
const existingSnapshot = await this.getSnapshotByHash(workflowId, stateHash)
|
const existingSnapshot = await this.getSnapshotByHash(workflowId, stateHash)
|
||||||
if (existingSnapshot) {
|
if (existingSnapshot) {
|
||||||
let refreshedState: WorkflowState = existingSnapshot.stateData
|
|
||||||
try {
|
|
||||||
await db
|
|
||||||
.update(workflowExecutionSnapshots)
|
|
||||||
.set({ stateData: state })
|
|
||||||
.where(eq(workflowExecutionSnapshots.id, existingSnapshot.id))
|
|
||||||
refreshedState = state
|
|
||||||
} catch (error) {
|
|
||||||
logger.warn(
|
|
||||||
`Failed to refresh snapshot stateData for ${existingSnapshot.id}, continuing with existing data`,
|
|
||||||
error
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
`Reusing existing snapshot for workflow ${workflowId} (hash: ${stateHash.slice(0, 12)}...)`
|
`Reusing existing snapshot for workflow ${workflowId} (hash: ${stateHash.slice(0, 12)}...)`
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
snapshot: { ...existingSnapshot, stateData: refreshedState },
|
snapshot: existingSnapshot,
|
||||||
isNew: false,
|
isNew: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user