cleaned referencing to services

This commit is contained in:
ValueOn AG 2025-10-20 12:29:17 +02:00
parent ab5618a9a5
commit 29a86c2212
3 changed files with 5 additions and 15 deletions

View file

@ -7,17 +7,12 @@ from typing import Dict, Any, Tuple, List
import io import io
import base64 import base64
import re import re
import os
from datetime import datetime, UTC
try: try:
from docx import Document from docx import Document
from docx.shared import Inches, Pt, RGBColor from docx.shared import Inches, Pt, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT from docx.enum.table import WD_TABLE_ALIGNMENT
from docx.oxml.shared import OxmlElement, qn
from docx.oxml.ns import nsdecls
from docx.oxml import parse_xml
DOCX_AVAILABLE = True DOCX_AVAILABLE = True
except ImportError: except ImportError:
DOCX_AVAILABLE = False DOCX_AVAILABLE = False

View file

@ -3,10 +3,6 @@ import uuid
from typing import Dict, Any, List, Optional from typing import Dict, Any, List, Optional
from modules.datamodels.datamodelUam import User, UserConnection from modules.datamodels.datamodelUam import User, UserConnection
from modules.datamodels.datamodelChat import ChatDocument, ChatMessage, ChatStat, ChatLog from modules.datamodels.datamodelChat import ChatDocument, ChatMessage, ChatStat, ChatLog
from modules.datamodels.datamodelChat import ChatContentExtracted
from modules.services.serviceExtraction.mainServiceExtraction import ExtractionService
from modules.services.serviceGeneration.subDocumentUtility import getFileExtension, getMimeTypeFromExtension, detectContentTypeFromData
from modules.shared.timezoneUtils import get_utc_timestamp
from modules.security.tokenManager import TokenManager from modules.security.tokenManager import TokenManager
from modules.shared.progressLogger import ProgressLogger from modules.shared.progressLogger import ProgressLogger
@ -225,7 +221,7 @@ Please provide a comprehensive summary of this conversation."""
token = TokenManager().getFreshToken(connection.id) token = TokenManager().getFreshToken(connection.id)
if token: if token:
if hasattr(token, 'expiresAt') and token.expiresAt: if hasattr(token, 'expiresAt') and token.expiresAt:
current_time = get_utc_timestamp() current_time = self.services.utils.timestampGetUtc()
if current_time > token.expiresAt: if current_time > token.expiresAt:
token_status = "expired" token_status = "expired"
else: else:

View file

@ -13,7 +13,6 @@ from modules.datamodels.datamodelChat import (
) )
from modules.datamodels.datamodelChat import TaskItem, TaskStatus, TaskContext from modules.datamodels.datamodelChat import TaskItem, TaskStatus, TaskContext
from modules.workflows.processing.workflowProcessor import WorkflowProcessor, WorkflowStoppedException from modules.workflows.processing.workflowProcessor import WorkflowProcessor, WorkflowStoppedException
from modules.shared.timezoneUtils import get_utc_timestamp
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -611,7 +610,7 @@ class WorkflowManager:
# Update workflow status to stopped # Update workflow status to stopped
workflow.status = "stopped" workflow.status = "stopped"
workflow.lastActivity = get_utc_timestamp() workflow.lastActivity = self.services.utils.timestampGetUtc()
self.services.workflow.updateWorkflow(workflow.id, { self.services.workflow.updateWorkflow(workflow.id, {
"status": "stopped", "status": "stopped",
"lastActivity": workflow.lastActivity, "lastActivity": workflow.lastActivity,
@ -626,7 +625,7 @@ class WorkflowManager:
"message": "🛑 Workflow stopped by user", "message": "🛑 Workflow stopped by user",
"status": "last", "status": "last",
"sequenceNr": len(workflow.messages) + 1, "sequenceNr": len(workflow.messages) + 1,
"publishedAt": get_utc_timestamp(), "publishedAt": self.services.utils.timestampGetUtc(),
"documentsLabel": "workflow_stopped", "documentsLabel": "workflow_stopped",
"documents": [], "documents": [],
# Add workflow context fields # Add workflow context fields
@ -653,7 +652,7 @@ class WorkflowManager:
# Update workflow status to failed # Update workflow status to failed
workflow.status = "failed" workflow.status = "failed"
workflow.lastActivity = get_utc_timestamp() workflow.lastActivity = self.services.utils.timestampGetUtc()
self.services.workflow.updateWorkflow(workflow.id, { self.services.workflow.updateWorkflow(workflow.id, {
"status": "failed", "status": "failed",
"lastActivity": workflow.lastActivity, "lastActivity": workflow.lastActivity,
@ -668,7 +667,7 @@ class WorkflowManager:
"message": f"Workflow processing failed: {str(error)}", "message": f"Workflow processing failed: {str(error)}",
"status": "last", "status": "last",
"sequenceNr": len(workflow.messages) + 1, "sequenceNr": len(workflow.messages) + 1,
"publishedAt": get_utc_timestamp(), "publishedAt": self.services.utils.timestampGetUtc(),
"documentsLabel": "workflow_error", "documentsLabel": "workflow_error",
"documents": [], "documents": [],
# Add workflow context fields # Add workflow context fields