fix: resolve test failures after segment 2 merge

- Backend: fix deduct_llm_quota import path in llm node
- Backend: update core.variables → core.workflow.variables imports
- Frontend: update UpdateWorkflowNodesMapPayload in tests
- Frontend: fix various test expectations to match merged code

Made-with: Cursor
This commit is contained in:
Novice
2026-03-23 09:18:26 +08:00
parent 66e67caa2b
commit cbdcdcc2b9
18 changed files with 44 additions and 45 deletions

View File

@@ -10,8 +10,8 @@ This module provides utilities to:
from collections.abc import Callable, Mapping, Sequence
from typing import Any, cast
from core.workflow.variables.segments import ArrayFileSegment, FileSegment
from core.workflow.file import File
from core.workflow.variables.segments import ArrayFileSegment, FileSegment
FILE_PATH_FORMAT = "file-path"
FILE_PATH_DESCRIPTION_SUFFIX = "this field contains a file path from the Dify sandbox"

View File

@@ -6,14 +6,14 @@ from pathlib import PurePosixPath
from typing import Any, cast
from core.sandbox.bash.session import SANDBOX_READY_TIMEOUT
from core.workflow.variables import ArrayFileSegment
from core.workflow.variables.segments import ArrayStringSegment, FileSegment
from core.virtual_environment.__base.command_future import CommandCancelledError, CommandTimeoutError
from core.virtual_environment.__base.helpers import pipeline
from core.workflow.enums import NodeType, WorkflowNodeExecutionStatus
from core.workflow.file import File, FileTransferMethod
from core.workflow.node_events import NodeRunResult
from core.workflow.nodes.base.node import Node
from core.workflow.variables import ArrayFileSegment
from core.workflow.variables.segments import ArrayStringSegment, FileSegment
from core.zip_sandbox import SandboxDownloadItem
from .entities import FileUploadNodeData

View File

@@ -1969,7 +1969,9 @@ class LLMNode(Node[LLMNodeData]):
LLMStructuredOutput(structured_output=structured_raw) if structured_raw else None
)
llm_utils.deduct_llm_quota(tenant_id=self.tenant_id, model_instance=model_instance, usage=usage)
from core.app.llm.quota import deduct_llm_quota
deduct_llm_quota(tenant_id=self.tenant_id, model_instance=model_instance, usage=usage)
completed = True
case LLMStructuredOutput():

View File

@@ -12,8 +12,8 @@ from core.llm_generator.output_parser.file_ref import (
detect_file_path_fields,
is_file_path_property,
)
from core.workflow.variables.segments import ArrayFileSegment, FileSegment
from core.workflow.file import File, FileTransferMethod, FileType
from core.workflow.variables.segments import ArrayFileSegment, FileSegment
def _build_file(file_id: str) -> File:

View File

@@ -29,7 +29,7 @@ def _drain(generator: Generator[NodeEventBase, None, Any]):
@pytest.fixture(autouse=True)
def patch_deduct_llm_quota(monkeypatch):
# Avoid touching real quota logic during unit tests
monkeypatch.setattr("core.workflow.nodes.llm.node.llm_utils.deduct_llm_quota", lambda **_: None)
monkeypatch.setattr("core.app.llm.quota.deduct_llm_quota", lambda **_: None)
def _make_llm_node(reasoning_format: str) -> LLMNode: