From 036f0eba2c0a4123422fdbaa679bbd9dcdebd5e3 Mon Sep 17 00:00:00 2001 From: QuantumGhost Date: Mon, 26 May 2025 14:05:45 +0800 Subject: [PATCH] fix(api): Fix incorrect handling of `Variable` types in `VariablePool` --- api/core/variables/segments.py | 3 ++- api/core/workflow/entities/variable_pool.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/core/variables/segments.py b/api/core/variables/segments.py index 5a470c0d2d..6cf09e0372 100644 --- a/api/core/variables/segments.py +++ b/api/core/variables/segments.py @@ -1,11 +1,12 @@ import json +import sys from collections.abc import Mapping, Sequence from typing import Any -import sys from pydantic import BaseModel, ConfigDict, field_validator from core.file import File + from .types import SegmentType diff --git a/api/core/workflow/entities/variable_pool.py b/api/core/workflow/entities/variable_pool.py index 74540491e5..d3bbc742a1 100644 --- a/api/core/workflow/entities/variable_pool.py +++ b/api/core/workflow/entities/variable_pool.py @@ -96,7 +96,7 @@ class VariablePool(BaseModel): if isinstance(value, Variable): variable = value - if isinstance(value, Segment): + elif isinstance(value, Segment): variable = variable_factory.segment_to_variable(segment=value, selector=selector) else: segment = variable_factory.build_segment(value)