style(workflow): enforce PEP8 style and remove redundant imports

This commit is contained in:
Eternity
2026-01-27 17:51:27 +08:00
parent 166d05afe9
commit 2a10e9f7ee
11 changed files with 25 additions and 28 deletions

View File

@@ -7,7 +7,6 @@ from textwrap import dedent
from typing import Any
import httpx
from sympy.physics.vector import vlatex
from app.core.workflow.nodes import BaseNode, WorkflowState
from app.core.workflow.nodes.base_config import VariableType

View File

@@ -1,5 +1,4 @@
import asyncio
import copy
import logging
import re
from typing import Any

View File

@@ -6,7 +6,6 @@ from langgraph.graph.state import CompiledStateGraph
from app.core.workflow.nodes import WorkflowState
from app.core.workflow.nodes.base_node import BaseNode
from app.core.workflow.nodes.cycle_graph.config import LoopNodeConfig, IterationNodeConfig
from app.core.workflow.nodes.cycle_graph.iteration import IterationRuntime
from app.core.workflow.nodes.cycle_graph.loop import LoopRuntime
from app.core.workflow.nodes.enums import NodeType

View File

@@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
class IfElseNode(BaseNode):
def __init__(self, node_config: dict[str, Any], workflow_config: dict[str, Any]):
super().__init__(node_config, workflow_config)
self.typed_config: IfElseNodeConfig | None= None
self.typed_config: IfElseNodeConfig | None = None
@staticmethod
def _evaluate(operator, instance: CompareOperatorInstance) -> Any:

View File

@@ -1,8 +1,6 @@
import uuid
from uuid import UUID
from pydantic import Field
from typing import Literal
from app.core.workflow.nodes.base_config import BaseNodeConfig

View File

@@ -24,7 +24,7 @@ class MemoryReadNode(BaseNode):
return await MemoryAgentService().read_memory(
end_user_id=end_user_id,
message=self._render_template(self.typed_config.message, state),
config_id=str(self.typed_config.config_id),
config_id=self.typed_config.config_id,
search_switch=self.typed_config.search_switch,
history=[],
db=db,

View File

@@ -5,6 +5,7 @@ from pydantic import Field, BaseModel
from app.core.workflow.nodes.base_config import BaseNodeConfig
class ClassifierConfig(BaseModel):
"""分类器节点配置"""

View File

@@ -78,7 +78,8 @@ class QuestionClassifierNode(BaseNode):
if not question:
logger.warning(
f"节点 {self.node_id} 未获取到输入问题,使用默认分支"
f"默认分支{DEFAULT_EMPTY_QUESTION_CASE},分类总数:{category_count}"
f"(默认分支:{DEFAULT_EMPTY_QUESTION_CASE}"
f"分类总数: {category_count})"
)
# 若分类列表为空返回默认unknown分支否则返回CASE1
if category_count > 0: