From 0e034e253d639836c6a6379bc3b5e7a20b022fed Mon Sep 17 00:00:00 2001 From: ValueOn AG Date: Tue, 2 Sep 2025 01:07:11 +0200 Subject: [PATCH] ready for user test 1.01 --- modules/chat/serviceCenter.py | 16 ++-------------- modules/interfaces/interfaceChatObjects.py | 11 ++++++----- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/modules/chat/serviceCenter.py b/modules/chat/serviceCenter.py index 0569ccde..9a37030c 100644 --- a/modules/chat/serviceCenter.py +++ b/modules/chat/serviceCenter.py @@ -1153,23 +1153,11 @@ Please provide a comprehensive summary of this conversation.""" return {'currentRound': 0, 'currentTask': 0, 'currentAction': 0} def incrementWorkflowContext(self, context_type: str): - """Increment workflow context counters""" + """Increment workflow context counters (task and action only - rounds handled in interface layer)""" try: update_data = {} - if context_type == 'round': - current_round = self.workflow.currentRound if hasattr(self.workflow, 'currentRound') else 0 - self.workflow.currentRound = current_round + 1 - # Reset task and action when round changes - self.workflow.currentTask = 0 - self.workflow.currentAction = 0 - update_data = { - "currentRound": self.workflow.currentRound, - "currentTask": 0, - "currentAction": 0 - } - logger.info(f"Incremented workflow round to {self.workflow.currentRound}") - elif context_type == 'task': + if context_type == 'task': current_task = self.workflow.currentTask if hasattr(self.workflow, 'currentTask') else 0 self.workflow.currentTask = current_task + 1 # Reset action when task changes diff --git a/modules/interfaces/interfaceChatObjects.py b/modules/interfaces/interfaceChatObjects.py index 039fd725..95ebb3a5 100644 --- a/modules/interfaces/interfaceChatObjects.py +++ b/modules/interfaces/interfaceChatObjects.py @@ -872,7 +872,7 @@ class ChatObjects: # Wait a moment for any running processes to detect the stop await asyncio.sleep(0.1) - # Update workflow - set status back to running for resumed workflows + # Update workflow - increment round for existing workflows newRound = workflow.currentRound + 1 self.updateWorkflow(workflowId, { "status": "running", # Set status back to running for resumed workflows @@ -880,14 +880,15 @@ class ChatObjects: "currentRound": newRound }) - # Update the workflow object status and round number as well - workflow.status = "running" - workflow.currentRound = newRound + # Reload workflow object to get updated currentRound from database + workflow = self.loadWorkflowState(workflowId) + if not workflow: + raise ValueError(f"Failed to reload workflow {workflowId} after update") # Add log entry for workflow resumption self.createWorkflowLog({ "workflowId": workflowId, - "message": f"Workflow resumed (round {workflow.currentRound + 1})", + "message": f"Workflow resumed (round {workflow.currentRound})", "type": "info", "status": "running", "progress": 0