Merge remote-tracking branch 'origin/main' into feat/queue-based-graph-engine

Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
-LAN-
2025-09-13 01:27:37 +08:00
242 changed files with 10968 additions and 2216 deletions

View File

@ -680,7 +680,7 @@ export const useNodesInteractions = () => {
data: {
...NODES_INITIAL_DATA[nodeType],
title: nodesWithSameType.length > 0 ? `${t(`workflow.blocks.${nodeType}`)} ${nodesWithSameType.length + 1}` : t(`workflow.blocks.${nodeType}`),
...(toolDefaultValue || {}),
...toolDefaultValue,
selected: true,
_showAddVariablePopup: (nodeType === BlockEnum.VariableAssigner || nodeType === BlockEnum.VariableAggregator) && !!prevNodeId,
_holdAddVariablePopup: false,
@ -1112,7 +1112,7 @@ export const useNodesInteractions = () => {
data: {
...NODES_INITIAL_DATA[nodeType],
title: nodesWithSameType.length > 0 ? `${t(`workflow.blocks.${nodeType}`)} ${nodesWithSameType.length + 1}` : t(`workflow.blocks.${nodeType}`),
...(toolDefaultValue || {}),
...toolDefaultValue,
_connectedSourceHandleIds: [],
_connectedTargetHandleIds: [],
selected: currentNode.data.selected,
@ -1130,9 +1130,7 @@ export const useNodesInteractions = () => {
zIndex: currentNode.zIndex,
})
const nodesConnectedSourceOrTargetHandleIdsMap = getNodesConnectedSourceOrTargetHandleIdsMap(
[
...connectedEdges.map(edge => ({ type: 'remove', edge })),
],
connectedEdges.map(edge => ({ type: 'remove', edge })),
nodes,
)
const newNodes = produce(nodes, (draft) => {

View File

@ -589,7 +589,7 @@ const formatItem = (
return false
const obj = findExceptVarInObject(isFile ? { ...v, children } : v, filterVar, selector, isFile)
return obj?.children && ((obj?.children as Var[]).length > 0 || Object.keys((obj?.children as StructuredOutput)?.schema?.properties || {}).length > 0)
return hasValidChildren(obj?.children)
}).map((v) => {
const isFile = v.type === VarType.file
@ -813,7 +813,7 @@ export const getVarType = ({
if (isIterationInnerVar) {
if (valueSelector[1] === 'item') {
const itemType = getIterationItemType({
valueSelector: (parentNode?.data as any).iterator_selector || [],
valueSelector: (parentNode?.data as any)?.iterator_selector || [],
beforeNodesOutputVars,
})
return itemType
@ -832,7 +832,7 @@ export const getVarType = ({
if (isLoopInnerVar) {
if (valueSelector[1] === 'item') {
const itemType = getLoopItemType({
valueSelector: (parentNode?.data as any).iterator_selector || [],
valueSelector: (parentNode?.data as any)?.iterator_selector || [],
beforeNodesOutputVars,
})
return itemType

View File

@ -45,7 +45,7 @@ const InputItem: FC<Props> = ({
filterVar: (varPayload: Var) => {
const supportVarTypes = [VarType.string, VarType.number, VarType.secret]
if (isSupportFile)
supportVarTypes.push(...[VarType.file, VarType.arrayFile])
supportVarTypes.push(VarType.file, VarType.arrayFile)
return supportVarTypes.includes(varPayload.type)
},

View File

@ -97,6 +97,7 @@ export const getOperators = (type?: VarType, file?: { key: string }) => {
ComparisonOperator.notEmpty,
]
case VarType.number:
case VarType.integer:
return [
ComparisonOperator.equal,
ComparisonOperator.notEqual,

View File

@ -229,7 +229,7 @@ export const useSchemaNodeOperations = (props: VisualEditorProps) => {
const schema = findPropertyWithPath(draft, path) as Field
if (schema.type === Type.object) {
schema.properties = {
...(schema.properties || {}),
...schema.properties,
'': {
type: Type.string,
},
@ -238,7 +238,7 @@ export const useSchemaNodeOperations = (props: VisualEditorProps) => {
}
if (schema.type === Type.array && schema.items && schema.items.type === Type.object) {
schema.items.properties = {
...(schema.items.properties || {}),
...schema.items.properties,
'': {
type: Type.string,
},

View File

@ -61,7 +61,7 @@ const AddBlock = ({
data: {
...NODES_INITIAL_DATA[type],
title: nodesWithSameType.length > 0 ? `${t(`workflow.blocks.${type}`)} ${nodesWithSameType.length + 1}` : t(`workflow.blocks.${type}`),
...(toolDefaultValue || {}),
...toolDefaultValue,
_isCandidate: true,
},
position: {

View File

@ -52,6 +52,8 @@ const InputsPanel = ({ onRun }: Props) => {
startVariables.forEach((variable) => {
if (variable.default)
initialInputs[variable.variable] = variable.default
if (inputs[variable.variable] !== undefined)
initialInputs[variable.variable] = inputs[variable.variable]
})
}

View File

@ -73,7 +73,7 @@ const NodePanel: FC<Props> = ({
if (time < 1)
return `${(time * 1000).toFixed(3)} ms`
if (time > 60)
return `${Number.parseInt(Math.round(time / 60).toString())} m ${(time % 60).toFixed(3)} s`
return `${Math.floor(time / 60)} m ${(time % 60).toFixed(3)} s`
return `${time.toFixed(3)} s`
}

View File

@ -260,6 +260,7 @@ export type Memory = {
export enum VarType {
string = 'string',
number = 'number',
integer = 'integer',
secret = 'secret',
boolean = 'boolean',
object = 'object',