mirror of
https://github.com/langgenius/dify.git
synced 2026-05-01 07:58:02 +08:00
refactor(workflow): move variables package into core.workflow (#32750)
This commit is contained in:
@ -13,8 +13,8 @@ from controllers.console.app.workflow_draft_variable import (
|
||||
_WORKFLOW_DRAFT_VARIABLE_WITHOUT_VALUE_FIELDS,
|
||||
_serialize_full_content,
|
||||
)
|
||||
from core.variables.types import SegmentType
|
||||
from core.workflow.constants import CONVERSATION_VARIABLE_NODE_ID, SYSTEM_VARIABLE_NODE_ID
|
||||
from core.workflow.variables.types import SegmentType
|
||||
from factories.variable_factory import build_segment
|
||||
from libs.datetime_utils import naive_utc_now
|
||||
from libs.uuid_utils import uuidv7
|
||||
|
||||
@ -7,7 +7,7 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from core.app.apps.advanced_chat.app_runner import AdvancedChatAppRunner
|
||||
from core.app.entities.app_invoke_entities import AdvancedChatAppGenerateEntity, InvokeFrom
|
||||
from core.variables import SegmentType
|
||||
from core.workflow.variables import SegmentType
|
||||
from factories import variable_factory
|
||||
from models import ConversationVariable, Workflow
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
from collections.abc import Mapping, Sequence
|
||||
|
||||
from core.app.apps.common.workflow_response_converter import WorkflowResponseConverter
|
||||
from core.variables.segments import ArrayFileSegment, FileSegment
|
||||
from core.workflow.file import FILE_MODEL_IDENTITY, File, FileTransferMethod, FileType
|
||||
from core.workflow.variables.segments import ArrayFileSegment, FileSegment
|
||||
|
||||
|
||||
class TestWorkflowResponseConverterFetchFilesFromVariableValue:
|
||||
|
||||
@ -3,8 +3,6 @@ from datetime import datetime
|
||||
from unittest.mock import Mock
|
||||
|
||||
from core.app.layers.conversation_variable_persist_layer import ConversationVariablePersistenceLayer
|
||||
from core.variables import StringVariable
|
||||
from core.variables.segments import Segment
|
||||
from core.workflow.constants import CONVERSATION_VARIABLE_NODE_ID
|
||||
from core.workflow.enums import NodeType, WorkflowNodeExecutionStatus
|
||||
from core.workflow.graph_engine.protocols.command_channel import CommandChannel
|
||||
@ -13,6 +11,8 @@ from core.workflow.node_events import NodeRunResult
|
||||
from core.workflow.nodes.variable_assigner.common import helpers as common_helpers
|
||||
from core.workflow.runtime.graph_runtime_state_protocol import ReadOnlyGraphRuntimeState
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.variables import StringVariable
|
||||
from core.workflow.variables.segments import Segment
|
||||
|
||||
|
||||
class MockReadOnlyVariablePool:
|
||||
|
||||
@ -13,7 +13,6 @@ from core.app.layers.pause_state_persist_layer import (
|
||||
_AdvancedChatAppGenerateEntityWrapper,
|
||||
_WorkflowGenerateEntityWrapper,
|
||||
)
|
||||
from core.variables.segments import Segment
|
||||
from core.workflow.entities.pause_reason import SchedulingPause
|
||||
from core.workflow.graph_engine.entities.commands import GraphEngineCommand
|
||||
from core.workflow.graph_engine.layers.base import GraphEngineLayerNotInitializedError
|
||||
@ -24,6 +23,7 @@ from core.workflow.graph_events.graph import (
|
||||
GraphRunSucceededEvent,
|
||||
)
|
||||
from core.workflow.runtime.graph_runtime_state_protocol import ReadOnlyVariablePool
|
||||
from core.workflow.variables.segments import Segment
|
||||
from models.model import AppMode
|
||||
from repositories.factory import DifyAPIRepositoryFactory
|
||||
|
||||
|
||||
@ -3,7 +3,10 @@ import dataclasses
|
||||
from pydantic import BaseModel
|
||||
|
||||
from core.helper import encrypter
|
||||
from core.variables.segments import (
|
||||
from core.workflow.file import File, FileTransferMethod, FileType
|
||||
from core.workflow.runtime import VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.variables.segments import (
|
||||
ArrayAnySegment,
|
||||
ArrayFileSegment,
|
||||
ArrayNumberSegment,
|
||||
@ -19,8 +22,8 @@ from core.variables.segments import (
|
||||
StringSegment,
|
||||
get_segment_discriminator,
|
||||
)
|
||||
from core.variables.types import SegmentType
|
||||
from core.variables.variables import (
|
||||
from core.workflow.variables.types import SegmentType
|
||||
from core.workflow.variables.variables import (
|
||||
ArrayAnyVariable,
|
||||
ArrayFileVariable,
|
||||
ArrayNumberVariable,
|
||||
@ -35,9 +38,6 @@ from core.variables.variables import (
|
||||
StringVariable,
|
||||
Variable,
|
||||
)
|
||||
from core.workflow.file import File, FileTransferMethod, FileType
|
||||
from core.workflow.runtime import VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
|
||||
|
||||
def test_segment_group_to_text():
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from core.variables.types import ArrayValidation, SegmentType
|
||||
from core.workflow.variables.types import ArrayValidation, SegmentType
|
||||
|
||||
|
||||
class TestSegmentTypeIsArrayType:
|
||||
|
||||
@ -10,8 +10,10 @@ from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
from core.variables.segment_group import SegmentGroup
|
||||
from core.variables.segments import (
|
||||
from core.workflow.file.enums import FileTransferMethod, FileType
|
||||
from core.workflow.file.models import File
|
||||
from core.workflow.variables.segment_group import SegmentGroup
|
||||
from core.workflow.variables.segments import (
|
||||
ArrayFileSegment,
|
||||
BooleanSegment,
|
||||
FileSegment,
|
||||
@ -20,9 +22,7 @@ from core.variables.segments import (
|
||||
ObjectSegment,
|
||||
StringSegment,
|
||||
)
|
||||
from core.variables.types import ArrayValidation, SegmentType
|
||||
from core.workflow.file.enums import FileTransferMethod, FileType
|
||||
from core.workflow.file.models import File
|
||||
from core.workflow.variables.types import ArrayValidation, SegmentType
|
||||
|
||||
|
||||
def create_test_file(
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from core.variables import (
|
||||
from core.workflow.variables import (
|
||||
ArrayFileVariable,
|
||||
ArrayVariable,
|
||||
FloatVariable,
|
||||
@ -11,7 +11,7 @@ from core.variables import (
|
||||
SegmentType,
|
||||
StringVariable,
|
||||
)
|
||||
from core.variables.variables import VariableBase
|
||||
from core.workflow.variables.variables import VariableBase
|
||||
|
||||
|
||||
def test_frozen_variables():
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
from core.variables.segments import (
|
||||
from core.workflow.runtime import VariablePool
|
||||
from core.workflow.variables.segments import (
|
||||
BooleanSegment,
|
||||
IntegerSegment,
|
||||
NoneSegment,
|
||||
StringSegment,
|
||||
)
|
||||
from core.workflow.runtime import VariablePool
|
||||
|
||||
|
||||
class TestVariablePoolGetAndNestedAttribute:
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
import json
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from core.variables import IntegerVariable, StringVariable
|
||||
from core.workflow.graph_engine.command_channels.redis_channel import RedisChannel
|
||||
from core.workflow.graph_engine.entities.commands import (
|
||||
AbortCommand,
|
||||
@ -12,6 +11,7 @@ from core.workflow.graph_engine.entities.commands import (
|
||||
UpdateVariablesCommand,
|
||||
VariableUpdate,
|
||||
)
|
||||
from core.workflow.variables import IntegerVariable, StringVariable
|
||||
|
||||
|
||||
class TestRedisChannel:
|
||||
|
||||
@ -4,7 +4,6 @@ import time
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from core.app.entities.app_invoke_entities import InvokeFrom
|
||||
from core.variables import IntegerVariable, StringVariable
|
||||
from core.workflow.entities.graph_init_params import GraphInitParams
|
||||
from core.workflow.entities.pause_reason import SchedulingPause
|
||||
from core.workflow.graph import Graph
|
||||
@ -20,6 +19,7 @@ from core.workflow.graph_engine.entities.commands import (
|
||||
from core.workflow.graph_events import GraphRunAbortedEvent, GraphRunPausedEvent, GraphRunStartedEvent
|
||||
from core.workflow.nodes.start.start_node import StartNode
|
||||
from core.workflow.runtime import GraphRuntimeState, VariablePool
|
||||
from core.workflow.variables import IntegerVariable, StringVariable
|
||||
from models.enums import UserFrom
|
||||
|
||||
|
||||
|
||||
@ -215,9 +215,9 @@ class TestMockTemplateTransformNode:
|
||||
|
||||
def test_mock_template_transform_node_with_variables(self):
|
||||
"""Test that MockTemplateTransformNode processes templates with variables."""
|
||||
from core.variables import StringVariable
|
||||
from core.workflow.entities import GraphInitParams
|
||||
from core.workflow.runtime import GraphRuntimeState, VariablePool
|
||||
from core.workflow.variables import StringVariable
|
||||
|
||||
# Create test parameters
|
||||
graph_init_params = GraphInitParams(
|
||||
|
||||
@ -21,15 +21,6 @@ from typing import Any
|
||||
|
||||
from core.app.workflow.node_factory import DifyNodeFactory
|
||||
from core.tools.utils.yaml_utils import _load_yaml_file
|
||||
from core.variables import (
|
||||
ArrayNumberVariable,
|
||||
ArrayObjectVariable,
|
||||
ArrayStringVariable,
|
||||
FloatVariable,
|
||||
IntegerVariable,
|
||||
ObjectVariable,
|
||||
StringVariable,
|
||||
)
|
||||
from core.workflow.entities.graph_init_params import GraphInitParams
|
||||
from core.workflow.graph import Graph
|
||||
from core.workflow.graph_engine import GraphEngine, GraphEngineConfig
|
||||
@ -41,6 +32,15 @@ from core.workflow.graph_events import (
|
||||
)
|
||||
from core.workflow.runtime import GraphRuntimeState, VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.variables import (
|
||||
ArrayNumberVariable,
|
||||
ArrayObjectVariable,
|
||||
ArrayStringVariable,
|
||||
FloatVariable,
|
||||
IntegerVariable,
|
||||
ObjectVariable,
|
||||
StringVariable,
|
||||
)
|
||||
|
||||
from .test_mock_config import MockConfig
|
||||
from .test_mock_factory import MockNodeFactory
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
from configs import dify_config
|
||||
from core.helper.code_executor.code_executor import CodeLanguage
|
||||
from core.variables.types import SegmentType
|
||||
from core.workflow.nodes.code.code_node import CodeNode
|
||||
from core.workflow.nodes.code.entities import CodeNodeData
|
||||
from core.workflow.nodes.code.exc import (
|
||||
@ -9,6 +8,7 @@ from core.workflow.nodes.code.exc import (
|
||||
OutputValidationError,
|
||||
)
|
||||
from core.workflow.nodes.code.limits import CodeNodeLimits
|
||||
from core.workflow.variables.types import SegmentType
|
||||
|
||||
CodeNode._limits = CodeNodeLimits(
|
||||
max_string_length=dify_config.CODE_MAX_STRING_LENGTH,
|
||||
|
||||
@ -2,8 +2,8 @@ import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from core.helper.code_executor.code_executor import CodeLanguage
|
||||
from core.variables.types import SegmentType
|
||||
from core.workflow.nodes.code.entities import CodeNodeData
|
||||
from core.workflow.variables.types import SegmentType
|
||||
|
||||
|
||||
class TestCodeNodeDataOutput:
|
||||
|
||||
@ -6,7 +6,6 @@ import pytest
|
||||
|
||||
from core.app.entities.app_invoke_entities import InvokeFrom
|
||||
from core.model_runtime.entities.llm_entities import LLMUsage
|
||||
from core.variables import StringSegment
|
||||
from core.workflow.entities import GraphInitParams
|
||||
from core.workflow.enums import WorkflowNodeExecutionStatus
|
||||
from core.workflow.nodes.knowledge_retrieval.entities import (
|
||||
@ -20,6 +19,7 @@ from core.workflow.nodes.knowledge_retrieval.knowledge_retrieval_node import Kno
|
||||
from core.workflow.repositories.rag_retrieval_protocol import RAGRetrievalProtocol, Source
|
||||
from core.workflow.runtime import GraphRuntimeState, VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.variables import StringSegment
|
||||
from models.enums import UserFrom
|
||||
|
||||
|
||||
|
||||
@ -5,9 +5,9 @@ from core.workflow.graph_engine.entities.graph import Graph
|
||||
from core.workflow.graph_engine.entities.graph_init_params import GraphInitParams
|
||||
from core.workflow.graph_engine.entities.graph_runtime_state import GraphRuntimeState
|
||||
|
||||
from core.variables import ArrayNumberSegment, ArrayStringSegment
|
||||
from core.workflow.enums import NodeType, WorkflowNodeExecutionStatus
|
||||
from core.workflow.nodes.list_operator.node import ListOperatorNode
|
||||
from core.workflow.variables import ArrayNumberSegment, ArrayStringSegment
|
||||
from models.workflow import WorkflowType
|
||||
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@ from core.model_runtime.entities.message_entities import (
|
||||
)
|
||||
from core.model_runtime.entities.model_entities import AIModelEntity, FetchFrom, ModelType
|
||||
from core.model_runtime.model_providers.model_provider_factory import ModelProviderFactory
|
||||
from core.variables import ArrayAnySegment, ArrayFileSegment, NoneSegment
|
||||
from core.workflow.entities import GraphInitParams
|
||||
from core.workflow.file import File, FileTransferMethod, FileType
|
||||
from core.workflow.nodes.llm import llm_utils
|
||||
@ -37,6 +36,7 @@ from core.workflow.nodes.llm.node import LLMNode
|
||||
from core.workflow.nodes.llm.protocols import CredentialsProvider, ModelFactory
|
||||
from core.workflow.runtime import GraphRuntimeState, VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.variables import ArrayAnySegment, ArrayFileSegment, NoneSegment
|
||||
from models.enums import UserFrom
|
||||
from models.provider import ProviderType
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from core.variables.types import SegmentType
|
||||
from core.workflow.nodes.parameter_extractor.entities import ParameterConfig
|
||||
from core.workflow.variables.types import SegmentType
|
||||
|
||||
|
||||
class TestParameterConfig:
|
||||
|
||||
@ -8,7 +8,6 @@ from typing import Any
|
||||
import pytest
|
||||
|
||||
from core.model_runtime.entities import LLMMode
|
||||
from core.variables.types import SegmentType
|
||||
from core.workflow.nodes.llm import ModelConfig, VisionConfig
|
||||
from core.workflow.nodes.parameter_extractor.entities import ParameterConfig, ParameterExtractorNodeData
|
||||
from core.workflow.nodes.parameter_extractor.exc import (
|
||||
@ -18,6 +17,7 @@ from core.workflow.nodes.parameter_extractor.exc import (
|
||||
RequiredParameterMissingError,
|
||||
)
|
||||
from core.workflow.nodes.parameter_extractor.parameter_extractor_node import ParameterExtractorNode
|
||||
from core.workflow.variables.types import SegmentType
|
||||
from factories.variable_factory import build_segment_with_type
|
||||
|
||||
|
||||
|
||||
@ -6,9 +6,6 @@ import pytest
|
||||
from docx.oxml.text.paragraph import CT_P
|
||||
|
||||
from core.app.entities.app_invoke_entities import InvokeFrom
|
||||
from core.variables import ArrayFileSegment
|
||||
from core.variables.segments import ArrayStringSegment
|
||||
from core.variables.variables import StringVariable
|
||||
from core.workflow.entities import GraphInitParams
|
||||
from core.workflow.enums import NodeType, WorkflowNodeExecutionStatus
|
||||
from core.workflow.file import File, FileTransferMethod
|
||||
@ -20,6 +17,9 @@ from core.workflow.nodes.document_extractor.node import (
|
||||
_extract_text_from_pdf,
|
||||
_extract_text_from_plain_text,
|
||||
)
|
||||
from core.workflow.variables import ArrayFileSegment
|
||||
from core.workflow.variables.segments import ArrayStringSegment
|
||||
from core.workflow.variables.variables import StringVariable
|
||||
from models.enums import UserFrom
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ import pytest
|
||||
|
||||
from core.app.entities.app_invoke_entities import InvokeFrom
|
||||
from core.app.workflow.node_factory import DifyNodeFactory
|
||||
from core.variables import ArrayFileSegment
|
||||
from core.workflow.entities import GraphInitParams
|
||||
from core.workflow.enums import WorkflowNodeExecutionStatus
|
||||
from core.workflow.file import File, FileTransferMethod, FileType
|
||||
@ -16,6 +15,7 @@ from core.workflow.nodes.if_else.if_else_node import IfElseNode
|
||||
from core.workflow.runtime import GraphRuntimeState, VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.utils.condition.entities import Condition, SubCondition, SubVariableCondition
|
||||
from core.workflow.variables import ArrayFileSegment
|
||||
from extensions.ext_database import db
|
||||
from models.enums import UserFrom
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@ from unittest.mock import MagicMock
|
||||
import pytest
|
||||
|
||||
from core.app.entities.app_invoke_entities import InvokeFrom
|
||||
from core.variables import ArrayFileSegment
|
||||
from core.workflow.enums import WorkflowNodeExecutionStatus
|
||||
from core.workflow.file import File, FileTransferMethod, FileType
|
||||
from core.workflow.nodes.list_operator.entities import (
|
||||
@ -17,6 +16,7 @@ from core.workflow.nodes.list_operator.entities import (
|
||||
)
|
||||
from core.workflow.nodes.list_operator.exc import InvalidKeyError
|
||||
from core.workflow.nodes.list_operator.node import ListOperatorNode, _get_file_extract_string_func
|
||||
from core.workflow.variables import ArrayFileSegment
|
||||
from models.enums import UserFrom
|
||||
|
||||
|
||||
|
||||
@ -11,12 +11,12 @@ import pytest
|
||||
from core.model_runtime.entities.llm_entities import LLMUsage
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.utils.message_transformer import ToolFileMessageTransformer
|
||||
from core.variables.segments import ArrayFileSegment
|
||||
from core.workflow.entities import GraphInitParams
|
||||
from core.workflow.file import File, FileTransferMethod, FileType
|
||||
from core.workflow.node_events import StreamChunkEvent, StreamCompletedEvent
|
||||
from core.workflow.runtime import GraphRuntimeState, VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.variables.segments import ArrayFileSegment
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover - imported for type checking only
|
||||
from core.workflow.nodes.tool.tool_node import ToolNode
|
||||
|
||||
@ -4,7 +4,6 @@ from uuid import uuid4
|
||||
|
||||
from core.app.entities.app_invoke_entities import InvokeFrom
|
||||
from core.app.workflow.node_factory import DifyNodeFactory
|
||||
from core.variables import ArrayStringVariable, StringVariable
|
||||
from core.workflow.entities import GraphInitParams
|
||||
from core.workflow.graph import Graph
|
||||
from core.workflow.graph_events.node import NodeRunSucceededEvent
|
||||
@ -13,6 +12,7 @@ from core.workflow.nodes.variable_assigner.v1 import VariableAssignerNode
|
||||
from core.workflow.nodes.variable_assigner.v1.node_data import WriteMode
|
||||
from core.workflow.runtime import GraphRuntimeState, VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.variables import ArrayStringVariable, StringVariable
|
||||
from models.enums import UserFrom
|
||||
|
||||
DEFAULT_NODE_ID = "node_id"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from core.variables import SegmentType
|
||||
from core.workflow.nodes.variable_assigner.v2.enums import Operation
|
||||
from core.workflow.nodes.variable_assigner.v2.helpers import is_input_value_valid
|
||||
from core.workflow.variables import SegmentType
|
||||
|
||||
|
||||
def test_is_input_value_valid_overwrite_array_string():
|
||||
|
||||
@ -4,13 +4,13 @@ from uuid import uuid4
|
||||
|
||||
from core.app.entities.app_invoke_entities import InvokeFrom
|
||||
from core.app.workflow.node_factory import DifyNodeFactory
|
||||
from core.variables import ArrayStringVariable
|
||||
from core.workflow.entities import GraphInitParams
|
||||
from core.workflow.graph import Graph
|
||||
from core.workflow.nodes.variable_assigner.v2 import VariableAssignerNode
|
||||
from core.workflow.nodes.variable_assigner.v2.enums import InputType, Operation
|
||||
from core.workflow.runtime import GraphRuntimeState, VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.variables import ArrayStringVariable
|
||||
from models.enums import UserFrom
|
||||
|
||||
DEFAULT_NODE_ID = "node_id"
|
||||
|
||||
@ -3,7 +3,6 @@ from unittest.mock import patch
|
||||
import pytest
|
||||
|
||||
from core.app.entities.app_invoke_entities import InvokeFrom
|
||||
from core.variables import FileVariable, StringVariable
|
||||
from core.workflow.entities.graph_init_params import GraphInitParams
|
||||
from core.workflow.entities.workflow_node_execution import WorkflowNodeExecutionStatus
|
||||
from core.workflow.file import File, FileTransferMethod, FileType
|
||||
@ -18,6 +17,7 @@ from core.workflow.nodes.trigger_webhook.node import TriggerWebhookNode
|
||||
from core.workflow.runtime.graph_runtime_state import GraphRuntimeState
|
||||
from core.workflow.runtime.variable_pool import VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.variables import FileVariable, StringVariable
|
||||
from models.enums import UserFrom
|
||||
from models.workflow import WorkflowType
|
||||
|
||||
|
||||
@ -3,8 +3,12 @@ from collections import defaultdict
|
||||
|
||||
import pytest
|
||||
|
||||
from core.variables import FileSegment, StringSegment
|
||||
from core.variables.segments import (
|
||||
from core.workflow.constants import CONVERSATION_VARIABLE_NODE_ID, ENVIRONMENT_VARIABLE_NODE_ID, SYSTEM_VARIABLE_NODE_ID
|
||||
from core.workflow.file import File, FileTransferMethod, FileType
|
||||
from core.workflow.runtime import VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.variables import FileSegment, StringSegment
|
||||
from core.workflow.variables.segments import (
|
||||
ArrayAnySegment,
|
||||
ArrayFileSegment,
|
||||
ArrayNumberSegment,
|
||||
@ -15,7 +19,7 @@ from core.variables.segments import (
|
||||
NoneSegment,
|
||||
ObjectSegment,
|
||||
)
|
||||
from core.variables.variables import (
|
||||
from core.workflow.variables.variables import (
|
||||
ArrayNumberVariable,
|
||||
ArrayObjectVariable,
|
||||
ArrayStringVariable,
|
||||
@ -25,10 +29,6 @@ from core.variables.variables import (
|
||||
StringVariable,
|
||||
Variable,
|
||||
)
|
||||
from core.workflow.constants import CONVERSATION_VARIABLE_NODE_ID, ENVIRONMENT_VARIABLE_NODE_ID, SYSTEM_VARIABLE_NODE_ID
|
||||
from core.workflow.file import File, FileTransferMethod, FileType
|
||||
from core.workflow.runtime import VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from factories.variable_factory import build_segment, segment_to_variable
|
||||
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ import pytest
|
||||
|
||||
from configs import dify_config
|
||||
from core.helper.code_executor.code_executor import CodeLanguage
|
||||
from core.variables.variables import StringVariable
|
||||
from core.workflow.constants import (
|
||||
CONVERSATION_VARIABLE_NODE_ID,
|
||||
ENVIRONMENT_VARIABLE_NODE_ID,
|
||||
@ -15,6 +14,7 @@ from core.workflow.nodes.code.code_node import CodeNode
|
||||
from core.workflow.nodes.code.limits import CodeNodeLimits
|
||||
from core.workflow.runtime import VariablePool
|
||||
from core.workflow.system_variable import SystemVariable
|
||||
from core.workflow.variables.variables import StringVariable
|
||||
from core.workflow.workflow_entry import WorkflowEntry
|
||||
|
||||
|
||||
|
||||
@ -7,7 +7,8 @@ import pytest
|
||||
from hypothesis import HealthCheck, given, settings
|
||||
from hypothesis import strategies as st
|
||||
|
||||
from core.variables import (
|
||||
from core.workflow.file import File, FileTransferMethod, FileType
|
||||
from core.workflow.variables import (
|
||||
ArrayNumberVariable,
|
||||
ArrayObjectVariable,
|
||||
ArrayStringVariable,
|
||||
@ -16,8 +17,8 @@ from core.variables import (
|
||||
SecretVariable,
|
||||
StringVariable,
|
||||
)
|
||||
from core.variables.exc import VariableError
|
||||
from core.variables.segments import (
|
||||
from core.workflow.variables.exc import VariableError
|
||||
from core.workflow.variables.segments import (
|
||||
ArrayAnySegment,
|
||||
ArrayFileSegment,
|
||||
ArrayNumberSegment,
|
||||
@ -32,8 +33,7 @@ from core.variables.segments import (
|
||||
Segment,
|
||||
StringSegment,
|
||||
)
|
||||
from core.variables.types import SegmentType
|
||||
from core.workflow.file import File, FileTransferMethod, FileType
|
||||
from core.workflow.variables.types import SegmentType
|
||||
from factories import variable_factory
|
||||
from factories.variable_factory import TypeMismatchError, build_segment, build_segment_with_type
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from uuid import uuid4
|
||||
|
||||
from core.variables import SegmentType
|
||||
from core.workflow.variables import SegmentType
|
||||
from factories import variable_factory
|
||||
from models import ConversationVariable
|
||||
|
||||
|
||||
@ -4,10 +4,10 @@ from unittest import mock
|
||||
from uuid import uuid4
|
||||
|
||||
from constants import HIDDEN_VALUE
|
||||
from core.variables import FloatVariable, IntegerVariable, SecretVariable, StringVariable
|
||||
from core.variables.segments import IntegerSegment, Segment
|
||||
from core.workflow.file.enums import FileTransferMethod, FileType
|
||||
from core.workflow.file.models import File
|
||||
from core.workflow.variables import FloatVariable, IntegerVariable, SecretVariable, StringVariable
|
||||
from core.workflow.variables.segments import IntegerSegment, Segment
|
||||
from factories.variable_factory import build_segment
|
||||
from models.workflow import Workflow, WorkflowDraftVariable, WorkflowNodeExecutionModel, is_system_variable_editable
|
||||
|
||||
|
||||
@ -17,7 +17,9 @@ from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
|
||||
from core.variables.segments import (
|
||||
from core.workflow.file.enums import FileTransferMethod, FileType
|
||||
from core.workflow.file.models import File
|
||||
from core.workflow.variables.segments import (
|
||||
ArrayFileSegment,
|
||||
ArrayNumberSegment,
|
||||
ArraySegment,
|
||||
@ -28,8 +30,6 @@ from core.variables.segments import (
|
||||
ObjectSegment,
|
||||
StringSegment,
|
||||
)
|
||||
from core.workflow.file.enums import FileTransferMethod, FileType
|
||||
from core.workflow.file.models import File
|
||||
from services.variable_truncator import (
|
||||
DummyVariableTruncator,
|
||||
MaxDepthExceededError,
|
||||
|
||||
@ -6,8 +6,8 @@ from unittest.mock import Mock, patch
|
||||
import pytest
|
||||
from sqlalchemy import Engine
|
||||
|
||||
from core.variables.segments import ObjectSegment, StringSegment
|
||||
from core.variables.types import SegmentType
|
||||
from core.workflow.variables.segments import ObjectSegment, StringSegment
|
||||
from core.workflow.variables.types import SegmentType
|
||||
from models.model import UploadFile
|
||||
from models.workflow import WorkflowDraftVariable, WorkflowDraftVariableFile
|
||||
from services.workflow_draft_variable_service import DraftVarLoader
|
||||
@ -174,7 +174,7 @@ class TestDraftVarLoaderSimple:
|
||||
mock_storage.load.return_value = test_json_content.encode()
|
||||
|
||||
with patch.object(WorkflowDraftVariable, "build_segment_with_type") as mock_build_segment:
|
||||
from core.variables.segments import FloatSegment
|
||||
from core.workflow.variables.segments import FloatSegment
|
||||
|
||||
mock_segment = FloatSegment(value=test_number)
|
||||
mock_build_segment.return_value = mock_segment
|
||||
@ -224,7 +224,7 @@ class TestDraftVarLoaderSimple:
|
||||
mock_storage.load.return_value = test_json_content.encode()
|
||||
|
||||
with patch.object(WorkflowDraftVariable, "build_segment_with_type") as mock_build_segment:
|
||||
from core.variables.segments import ArrayAnySegment
|
||||
from core.workflow.variables.segments import ArrayAnySegment
|
||||
|
||||
mock_segment = ArrayAnySegment(value=test_array)
|
||||
mock_build_segment.return_value = mock_segment
|
||||
|
||||
@ -7,10 +7,10 @@ import pytest
|
||||
from sqlalchemy import Engine
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from core.variables.segments import StringSegment
|
||||
from core.variables.types import SegmentType
|
||||
from core.workflow.constants import SYSTEM_VARIABLE_NODE_ID
|
||||
from core.workflow.enums import NodeType
|
||||
from core.workflow.variables.segments import StringSegment
|
||||
from core.workflow.variables.types import SegmentType
|
||||
from libs.uuid_utils import uuidv7
|
||||
from models.account import Account
|
||||
from models.enums import DraftVariableType
|
||||
|
||||
Reference in New Issue
Block a user