feat(workflow): support resizing comment nodes, add theme and author display toggle

This commit is contained in:
Eternity
2026-03-09 03:18:33 +08:00
parent 966bd8528d
commit 389dd8d402
3 changed files with 13 additions and 5 deletions

View File

@@ -764,6 +764,10 @@ class DifyConverter(BaseConverter):
node_data = node["data"]
result = NoteNodeConfig.model_construct(
author=node_data.get("author", ""),
text=node_data.get("text", "")
text=node_data.get("text", ""),
width=node_data.get("width", 80),
height=node_data.get("height", 80),
theme=node_data.get("theme", "blue"),
show_author=node_data.get("showAuthor", True)
).model_dump()
return result

View File

@@ -59,7 +59,7 @@ class DifyAdapter(BasePlatformAdapter, DifyConverter):
support_node_types=list(self.NODE_TYPE_MAPPING.keys())
)
def map_node_type(self, platform_node_type) -> str:
def map_node_type(self, platform_node_type) -> NodeType:
return self.NODE_TYPE_MAPPING.get(platform_node_type, NodeType.UNKNOWN)
@property
@@ -184,7 +184,7 @@ class DifyAdapter(BasePlatformAdapter, DifyConverter):
except Exception as e:
logger.debug(f"convert node error - {e}", exc_info=True)
def _convert_node_config(self, node_type: str, node: dict):
def _convert_node_config(self, node_type: NodeType, node: dict):
try:
node_data = node["data"]
converter = self.get_node_convert(node_type)

View File

@@ -4,5 +4,9 @@ from app.core.workflow.nodes.base_config import BaseNodeConfig
class NoteNodeConfig(BaseNodeConfig):
author: str = Field(..., description="author")
text: str = Field(..., description="note context")
author: str = Field(default="", description="author")
text: str = Field(default="", description="note content")
width: int = Field(default=80)
height: int = Field(default=80)
theme: str = Field(default="blue")
show_author: bool = Field(default=True)