From c6fc315da33083e60360748893d840348ade47ae Mon Sep 17 00:00:00 2001 From: Ramiro Medina <64783088+ramedina86@users.noreply.github.com> Date: Wed, 6 Nov 2024 14:59:40 +0000 Subject: [PATCH] chore: Linter fixes --- src/writer/core.py | 2 +- src/writer/workflows.py | 8 +++----- src/writer/workflows_blocks/__init__.py | 2 +- src/writer/workflows_blocks/writeraddchatmessage.py | 2 +- src/writer/workflows_blocks/writerchat.py | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/writer/core.py b/src/writer/core.py index 6297878fa..040e63291 100644 --- a/src/writer/core.py +++ b/src/writer/core.py @@ -55,10 +55,10 @@ InstancePathItem, Readable, ServeMode, + WorkflowExecutionLog, WriterEvent, WriterEventResult, WriterFileItem, - WorkflowExecutionLog ) if TYPE_CHECKING: diff --git a/src/writer/workflows.py b/src/writer/workflows.py index b70ab5297..a7fe7a136 100644 --- a/src/writer/workflows.py +++ b/src/writer/workflows.py @@ -2,9 +2,9 @@ from typing import Any, Dict, List, Literal, Optional, Tuple import writer.core -from writer.ss_types import WorkflowExecutionLog import writer.workflows_blocks from writer.core_ui import Component +from writer.ss_types import WorkflowExecutionLog from writer.workflows_blocks.blocks import WorkflowBlock @@ -41,11 +41,9 @@ def run_workflow(session, component_id: str, execution_env: Dict): def _generate_run_log(session: "writer.core.WriterSession", execution: Dict[str, WorkflowBlock], title: str, entry_type: Literal["info", "error"], return_value: Optional[Any] = None): if not writer.core.Config.is_mail_enabled_for_log: return - exec_log:WorkflowExecutionLog = { - "summary": [] - } + exec_log:WorkflowExecutionLog = WorkflowExecutionLog(summary=[]) for component_id, tool in execution.items(): - exec_log["summary"].append({ + exec_log.summary.append({ "componentId": component_id, "outcome": tool.outcome, "result": tool.result, diff --git a/src/writer/workflows_blocks/__init__.py b/src/writer/workflows_blocks/__init__.py index 7f3399fc6..b6f73b483 100644 --- a/src/writer/workflows_blocks/__init__.py +++ b/src/writer/workflows_blocks/__init__.py @@ -11,8 +11,8 @@ from writer.workflows_blocks.writerchat import WriterChat from writer.workflows_blocks.writerclassification import WriterClassification from writer.workflows_blocks.writercompletion import WriterCompletion -from writer.workflows_blocks.writernocodeapp import WriterNoCodeApp from writer.workflows_blocks.writerinitchat import WriterInitChat +from writer.workflows_blocks.writernocodeapp import WriterNoCodeApp SetState.register("workflows_setstate") WriterClassification.register("workflows_writerclassification") diff --git a/src/writer/workflows_blocks/writeraddchatmessage.py b/src/writer/workflows_blocks/writeraddchatmessage.py index 76d5cec6d..1d9a9f235 100644 --- a/src/writer/workflows_blocks/writeraddchatmessage.py +++ b/src/writer/workflows_blocks/writeraddchatmessage.py @@ -50,7 +50,7 @@ def run(self): conversation = self.evaluator.evaluate_expression(conversation_state_element, self.instance_path, self.execution_env) if conversation is None or not isinstance(conversation, writer.ai.Conversation): - self.result = f"The state element specified doesn't contain a conversation. Initialize one using the block 'Initialize chat'." + self.result = "The state element specified doesn't contain a conversation. Initialize one using the block 'Initialize chat'." self.outcome = "error" return diff --git a/src/writer/workflows_blocks/writerchat.py b/src/writer/workflows_blocks/writerchat.py index 078916655..b0c7814ea 100644 --- a/src/writer/workflows_blocks/writerchat.py +++ b/src/writer/workflows_blocks/writerchat.py @@ -104,7 +104,7 @@ def run(self): conversation = self.evaluator.evaluate_expression(conversation_state_element, self.instance_path, self.execution_env) if conversation is None or not isinstance(conversation, writer.ai.Conversation): - self.result = f"The state element specified doesn't contain a conversation. Initialize one using the block 'Initialize chat'." + self.result = "The state element specified doesn't contain a conversation. Initialize one using the block 'Initialize chat'." self.outcome = "error" return