fix(api): adding variable to variable pool recursively while loading draft variables. (#21478)

This PR fix the issue that `ObjectSegment` are not recursively added to the draft variable pool while loading draft variables from database. It also fixes an issue about loading variables with more than two elements in the its selector.

Enhances #19735.
Closes #21477.
This commit is contained in:
QuantumGhost 2025-06-25 12:39:22 +08:00 committed by GitHub
commit 268da31332
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 191 additions and 12 deletions

View file

@ -129,7 +129,8 @@ class WorkflowDraftVariableService:
) -> list[WorkflowDraftVariable]:
ors = []
for selector in selectors:
node_id, name = selector
assert len(selector) >= MIN_SELECTORS_LENGTH, f"Invalid selector to get: {selector}"
node_id, name = selector[:2]
ors.append(and_(WorkflowDraftVariable.node_id == node_id, WorkflowDraftVariable.name == name))
# NOTE(QuantumGhost): Although the number of `or` expressions may be large, as long as