before feature container refactory

This commit is contained in:
ValueOn AG 2026-01-22 00:23:33 +01:00
parent 5fcbc6acd3
commit 04ba89a0e8
49 changed files with 3172 additions and 462 deletions

20
app.py
View file

@ -20,7 +20,7 @@ from datetime import datetime
from modules.shared.configuration import APP_CONFIG from modules.shared.configuration import APP_CONFIG
from modules.shared.eventManagement import eventManager from modules.shared.eventManagement import eventManager
from modules.features import featuresLifecycle as featuresLifecycle from modules.features import featuresLifecycle as featuresLifecycle
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
class DailyRotatingFileHandler(RotatingFileHandler): class DailyRotatingFileHandler(RotatingFileHandler):
""" """
@ -421,8 +421,8 @@ app.include_router(promptRouter)
from modules.routes.routeDataConnections import router as connectionsRouter from modules.routes.routeDataConnections import router as connectionsRouter
app.include_router(connectionsRouter) app.include_router(connectionsRouter)
from modules.routes.routeWorkflows import router as workflowRouter from modules.routes.routeDataWorkflows import router as dataWorkflowsRouter
app.include_router(workflowRouter) app.include_router(dataWorkflowsRouter)
from modules.routes.routeFeatureChatDynamic import router as chatPlaygroundRouter from modules.routes.routeFeatureChatDynamic import router as chatPlaygroundRouter
app.include_router(chatPlaygroundRouter) app.include_router(chatPlaygroundRouter)
@ -451,11 +451,11 @@ app.include_router(sharepointRouter)
from modules.routes.routeDataAutomation import router as automationRouter from modules.routes.routeDataAutomation import router as automationRouter
app.include_router(automationRouter) app.include_router(automationRouter)
from modules.routes.routeFeatureWorkflow import router as adminAutomationEventsRouter from modules.routes.routeAdminAutomationEvents import router as adminAutomationEventsRouter
app.include_router(adminAutomationEventsRouter) app.include_router(adminAutomationEventsRouter)
from modules.routes.routeRbac import router as rbacRouter from modules.routes.routeAdminRbacRules import router as rbacAdminRulesRouter
app.include_router(rbacRouter) app.include_router(rbacAdminRulesRouter)
from modules.routes.routeOptions import router as optionsRouter from modules.routes.routeOptions import router as optionsRouter
app.include_router(optionsRouter) app.include_router(optionsRouter)
@ -470,14 +470,14 @@ from modules.routes.routeFeatureTrustee import router as trusteeRouter
app.include_router(trusteeRouter) app.include_router(trusteeRouter)
# Phase 8: New Feature Routes # Phase 8: New Feature Routes
from modules.routes.routeFeatures import router as featuresRouter from modules.routes.routeAdminFeatures import router as featuresAdminRouter
app.include_router(featuresRouter) app.include_router(featuresAdminRouter)
from modules.routes.routeInvitations import router as invitationsRouter from modules.routes.routeInvitations import router as invitationsRouter
app.include_router(invitationsRouter) app.include_router(invitationsRouter)
from modules.routes.routeRbacExport import router as rbacExportRouter from modules.routes.routeAdminRbacExport import router as rbacAdminExportRouter
app.include_router(rbacExportRouter) app.include_router(rbacAdminExportRouter)
from modules.routes.routeGdpr import router as gdprRouter from modules.routes.routeGdpr import router as gdprRouter
app.include_router(gdprRouter) app.include_router(gdprRouter)

View file

@ -21,7 +21,7 @@ from slowapi.util import get_remote_address
from modules.shared.configuration import APP_CONFIG from modules.shared.configuration import APP_CONFIG
from modules.security.rootAccess import getRootDbAppConnector, getRootUser from modules.security.rootAccess import getRootDbAppConnector, getRootUser
from modules.interfaces.interfaceDbAppObjects import getInterface, getRootInterface from modules.interfaces.interfaceDbApp import getInterface, getRootInterface
from modules.datamodels.datamodelUam import User, AuthAuthority, AccessLevel from modules.datamodels.datamodelUam import User, AuthAuthority, AccessLevel
from modules.datamodels.datamodelSecurity import Token from modules.datamodels.datamodelSecurity import Token
from modules.datamodels.datamodelRbac import AccessRule from modules.datamodels.datamodelRbac import AccessRule

View file

@ -259,7 +259,7 @@ class TokenManager:
try: try:
if interface is None: if interface is None:
from modules.security.rootAccess import getRootUser from modules.security.rootAccess import getRootUser
from modules.interfaces.interfaceDbAppObjects import getInterface from modules.interfaces.interfaceDbApp import getInterface
rootUser = getRootUser() rootUser = getRootUser()
interface = getInterface(rootUser) interface = getInterface(rootUser)

View file

@ -159,7 +159,7 @@ class TokenRefreshService:
# Get user interface # Get user interface
from modules.security.rootAccess import getRootUser from modules.security.rootAccess import getRootUser
from modules.interfaces.interfaceDbAppObjects import getInterface from modules.interfaces.interfaceDbApp import getInterface
rootUser = getRootUser() rootUser = getRootUser()
root_interface = getInterface(rootUser) root_interface = getInterface(rootUser)
@ -228,7 +228,7 @@ class TokenRefreshService:
# Get user interface # Get user interface
from modules.security.rootAccess import getRootUser from modules.security.rootAccess import getRootUser
from modules.interfaces.interfaceDbAppObjects import getInterface from modules.interfaces.interfaceDbApp import getInterface
rootUser = getRootUser() rootUser = getRootUser()
root_interface = getInterface(rootUser) root_interface = getInterface(rootUser)

View file

@ -1,314 +0,0 @@
| Field Name | Type Pattern | Models Using It |
|------------|--------------|-----------------|
| `accumulatedJsonString` | str | JsonAccumulationState |
| `action` | str | ActionDefinition |
| `actionId` | str | ChatDocument, ChatMessage |
| `actionList` | List | TaskItem |
| `actionMethod` | str | ChatMessage |
| `actionName` | str | ChatMessage |
| `actionNumber` | int | ChatLog, ChatDocument, ChatMessage |
| `actionObjective` | str | ActionDefinition, TaskContext |
| `actionProgress` | str | ChatMessage |
| `actionResult` | Any | TaskResult |
| `active` | bool | AutomationDefinition |
| `additionalData` | Dict | AiResponseMetadata |
| `aiPrompt` | str | AiProcessParameters |
| `allSections` | List | JsonAccumulationState |
| `apiUrl` | str | AiModel |
| `authenticationAuthority` | AuthAuthority | User |
| `authority` | AuthAuthority | UserConnection, Token |
| `availableConnections` | list | TaskContext |
| `availableDocuments` | str | TaskContext |
| `base64Encoded` | bool | ContentMetadata, FileData |
| `bytesSent` | int | ChatStat, AiCallResponse |
| `bytesReceived` | int | ChatStat, AiCallResponse |
| `classes` | List | CodeContentPromptArgs |
| `colorMode` | str | ContentMetadata |
| `compressContext` | bool | AiCallOptions |
| `compressPrompt` | bool | AiCallOptions |
| `condition` | str | SelectionRule |
| `confidence` | float | ReviewResult |
| `connectedAt` | float | UserConnection |
| `connectionId` | str | Token |
| `connectionReference` | str | ActionDefinition |
| `connectorType` | str | AiModel |
| `content` | str | Prompt, ContentItem, AiResponse, AiCallResponse, FilePreview |
| `contentAnalysis` | Dict | Observation |
| `contentParts` | List | AiCallRequest, AiProcessParameters, SectionPromptArgs, ChapterStructurePromptArgs, CodeContentPromptArgs, CodeStructurePromptArgs |
| `contentSize` | str | ObservationPreview |
| `contentValidation` | Dict | Observation |
| `contents` | List | ChatContentExtracted |
| `context` | Dict, AccessRuleContext | TaskHandover, UnderstandingResult, AccessRule |
| `contextInfo` | str | CodeContentPromptArgs |
| `costPer1kTokensInput` | float | AiModel |
| `costPer1kTokensOutput` | float | AiModel |
| `country` | str | AiCallPromptWebSearch |
| `create` | AccessLevel | AccessRule, UserPermissions |
| `created` | str | ObservationPreview |
| `createdAt` | float | Token |
| `creationDate` | float | FileItem |
| `criteriaProgress` | dict | TaskContext |
| `currentAction` | int | ChatWorkflow |
| `currentRound` | int | ChatWorkflow |
| `currentTask` | int | ChatWorkflow |
| `data` | str | ContentItem, FileData |
| `dataType` | str | TaskStep |
| `delete` | AccessLevel | AccessRule, UserPermissions |
| `deliverable` | Dict | TaskDefinition |
| `delivered_summary` | str | ContinuationContext |
| `dependencies` | List | TaskItem, TaskStep, CodeContentPromptArgs |
| `description` | TextMultilingual | Role |
| `details` | str | AuthEvent |
| `detectedComplexity` | str | RequestContext |
| `displayName` | str | AiModel |
| `documentData` | Any | ActionDocument, DocumentData |
| `documentId` | str | ObservationPreview |
| `documentList` | DocumentReferenceList | ActionDefinition, ExtractContentParameters |
| `documentName` | str | ActionDocument, DocumentData |
| `documentReferences` | List | UnderstandingResult |
| `documents` | List | ChatMessage, ActionResult, AiResponse |
| `documentsCount` | int | Observation |
| `documentsLabel` | str | ChatMessage, DocumentExchange |
| `durationSec` | float | ContentMetadata |
| `email` | EmailStr | User |
| `enabled` | bool | Mandate, User |
| `encoding` | str | FilePreview |
| `engine` | str | ChatStat |
| `error` | str | ContentMetadata, ActionResult, ActionItem, TaskItem, TaskResult |
| `errorCount` | int | ChatStat, AiCallResponse |
| `estimatedComplexity` | str | TaskStep |
| `eventId` | str | AutomationDefinition |
| `eventType` | str | AuthEvent |
| `execAction` | str | ActionItem |
| `execMethod` | str | ActionItem |
| `execParameters` | Dict | ActionItem |
| `execResultLabel` | str | ActionItem |
| `executedActions` | list | TaskContext |
| `executionLogs` | List | AutomationDefinition |
| `expectedDocumentFormats` | List | ActionItem |
| `expectedFormats` | List | ChatWorkflow, TaskStep |
| `expectedOutputFormat` | str | RequestContext |
| `expectedOutputType` | str | RequestContext |
| `expiresAt` | float | UserConnection, Token |
| `externalEmail` | EmailStr | UserConnection |
| `externalId` | str | UserConnection |
| `externalUsername` | str | UserConnection |
| `extractionMethod` | str | AiResponseMetadata |
| `extractionOptions` | Any | TaskDefinition, ExtractContentParameters |
| `failedActions` | list | TaskContext |
| `failurePatterns` | list | TaskContext |
| `feedback` | str | TaskResult, TaskItem |
| `fileHash` | str | FileItem |
| `fileId` | str | ChatDocument |
| `fileName` | str | FileItem, FilePreview, ChatDocument |
| `fileSize` | int | FileItem, ChatDocument |
| `fileType` | str | CodeContentPromptArgs |
| `filename` | str | AiResponseMetadata, CodeContentPromptArgs |
| `finishedAt` | float | TaskItem |
| `fps` | float | ContentMetadata |
| `fullName` | str | User |
| `functionCall` | Callable | AiModel |
| `functions` | List | CodeContentPromptArgs |
| `generationHint` | str | SectionPromptArgs |
| `handoverType` | str | TaskHandover |
| `hashedPassword` | str | UserInDB |
| `height` | int | ContentMetadata |
| `hierarchyContext` | str | JsonContinuationContexts |
| `hierarchyContextForPrompt` | str | JsonContinuationContexts |
| `id` | str | *Most models* |
| `improvements` | List | TaskHandover, TaskContext, ReviewResult |
| `incomplete_part` | str | ContinuationContext |
| `inputDocuments` | List | TaskHandover |
| `instruction` | str | AiCallPromptWebSearch, AiCallPromptWebCrawl |
| `intention` | Dict | UnderstandingResult |
| `ipAddress` | str | AuthEvent |
| `isAccumulationMode` | bool | JsonAccumulationState |
| `isAggregation` | bool | SectionPromptArgs |
| `isAvailable` | bool | AiModel |
| `isRegeneration` | bool | TaskContext |
| `isSystemRole` | bool | Role |
| `isText` | bool | FilePreview |
| `item` | str | AccessRule |
| `jsonParsingSuccess` | bool | JsonContinuationContexts |
| `kpis` | List | JsonAccumulationState |
| `label` | str | ContentItem, AutomationDefinition |
| `language` | str | Mandate, User, SectionPromptArgs, AiCallPromptWebSearch |
| `last_complete_part` | str | ContinuationContext |
| `last_raw_json` | str | ContinuationContext |
| `lastActivity` | float | ChatWorkflow |
| `lastChecked` | float | UserConnection |
| `lastParsedResult` | Dict | JsonAccumulationState |
| `lastUpdated` | str | AiModel |
| `learnings` | List | ActionDefinition, TaskContext |
| `listFileId` | List | UserInputRequest |
| `logs` | List | ChatWorkflow |
| `mandateId` | str | ChatWorkflow, FileItem, Prompt, User, AutomationDefinition, Token |
| `maxCost` | float | SelectionRule, AiCallOptions |
| `maxDepth` | int | AiCallPromptWebCrawl |
| `maxNumberPages` | int | AiCallPromptWebSearch |
| `maxParts` | int | AiCallOptions |
| `maxProcessingTime` | int | AiCallOptions |
| `maxSteps` | int | ChatWorkflow |
| `maxTokens` | int | AiModel |
| `maxWidth` | int | AiCallPromptWebCrawl |
| `message` | str | ChatLog, ChatMessage |
| `messageHistory` | List | TaskHandover |
| `messageId` | str | ChatDocument |
| `messages` | List | ChatWorkflow, AiModelCall |
| `metadata` | ContentMetadata, AiResponseMetadata, Dict | ContentItem, AiResponse, AiModelResponse, CodeContentPromptArgs |
| `metCriteria` | List | ReviewResult |
| `method` | str | ActionSelection |
| `mime` | str | ObservationPreview |
| `mimeType` | str | ContentMetadata, FileItem, FilePreview, ChatDocument, ActionDocument, DocumentData |
| `minContextLength` | int | AiModel, SelectionRule |
| `minQualityRating` | int | SelectionRule |
| `missingOutputs` | List | ReviewResult |
| `model` | AiModel | AiModelCall |
| `modelId` | str | AiModelResponse |
| `modelName` | str | AiCallResponse |
| `modified` | str | ObservationPreview |
| `name` | str | Mandate, Prompt, ActionSelection, AiModel, SelectionRule, ObservationPreview |
| `nextAction` | str | ReviewResult |
| `nextActionGuidance` | Dict | TaskContext |
| `nextActionObjective` | str | ReviewResult |
| `nextActionParameters` | Dict | ReviewResult |
| `notes` | List | Observation |
| `objective` | str | TaskStep, TaskDefinition |
| `operationId` | str | ChatLog |
| `operationType` | OperationTypeEnum, str | OperationTypeRating, AiCallOptions, AiResponseMetadata |
| `operationTypes` | List | AiModel, SelectionRule |
| `options` | AiCallOptions | AiCallRequest, AiModelCall |
| `originalPrompt` | str | RequestContext |
| `outputDocuments` | List | TaskHandover |
| `outputFormat` | str | ChapterStructurePromptArgs |
| `overlapContext` | str | JsonContinuationContexts |
| `overlap_context` | str | ContinuationContext |
| `overview` | str | TaskPlan |
| `pages` | int | ContentMetadata |
| `parameters` | Dict | ActionParameters, UnderstandingResult, ActionDefinition |
| `parametersContext` | str | ActionDefinition, TaskContext |
| `parentId` | str | ChatLog |
| `parentMessageId` | str | ChatMessage |
| `performance` | Dict | ChatLog |
| `placeholders` | List, Dict | PromptBundle, AutomationDefinition |
| `priceUsd` | float | ChatStat, AiCallResponse |
| `previews` | List | Observation |
| `previousActionResults` | list | TaskContext |
| `previousHandover` | TaskHandover | TaskContext |
| `previousResults` | List | TaskHandover, TaskContext, ReviewContext |
| `previousReviewResult` | dict | TaskContext |
| `priority` | PriorityEnum | AiModel, SelectionRule, AiCallOptions |
| `process` | str | ChatStat |
| `processDocumentsIndividually` | bool | AiCallOptions |
| `processingMode` | ProcessingModeEnum | AiModel, AiCallOptions |
| `processingTime` | float | ChatStat, ActionItem, TaskItem, AiCallResponse, AiModelResponse |
| `progress` | float | ChatLog |
| `prompt` | str | UserInputRequest, PromptBundle, AiCallPromptImage |
| `publishedAt` | float | ChatMessage |
| `qualityRating` | int | AiModel |
| `qualityRequirements` | Dict | TaskStep |
| `qualityScore` | float | ReviewResult |
| `quality` | str | AiCallPromptImage |
| `rating` | int | OperationTypeRating |
| `read` | AccessLevel | AccessRule, UserPermissions |
| `reason` | str | Token, ReviewResult |
| `reference` | str | ObservationPreview |
| `requiredDocuments` | List | TaskDefinition |
| `requiresAnalysis` | bool | RequestContext |
| `requiresContentGeneration` | bool | TaskDefinition |
| `requiresDocumentAnalysis` | bool | TaskDefinition |
| `requiresDocuments` | bool | RequestContext |
| `requiresWebResearch` | bool | RequestContext, TaskDefinition |
| `researchDepth` | str | AiCallPromptWebSearch |
| `resetToken` | str | UserInDB |
| `resetTokenExpires` | float | UserInDB |
| `result` | str | ActionItem |
| `resultFormat` | str | AiCallOptions |
| `resultLabel` | str | ActionResult, Observation |
| `resultLabels` | Dict | TaskItem |
| `resultType` | str | AiProcessParameters |
| `retryCount` | int | ActionItem, TaskItem, TaskContext |
| `retryMax` | int | ActionItem, TaskItem |
| `revokedAt` | float | Token |
| `revokedBy` | str | Token |
| `role` | str | ChatMessage |
| `roleLabel` | str | Role, AccessRule |
| `roleLabels` | List | User |
| `rollbackOnFailure` | bool | TaskItem |
| `roundNumber` | int | ChatLog, ChatDocument, ChatMessage |
| `safetyMargin` | float | AiCallOptions |
| `schedule` | str | AutomationDefinition |
| `schemaVersion` | str | AiResponseMetadata |
| `section` | Dict | SectionPromptArgs |
| `section_count` | int | ContinuationContext |
| `sectionIndex` | int | SectionPromptArgs |
| `sequenceNr` | int | ChatMessage |
| `sessionId` | str | Token |
| `size` | int, str | ContentMetadata, FilePreview, AiCallPromptImage, ObservationPreview |
| `snippet` | str | ObservationPreview |
| `sourceDocuments` | List | AiResponseMetadata |
| `sourceJson` | Dict | ActionDocument, DocumentData |
| `sourceTask` | str | TaskHandover |
| `speedRating` | int | AiModel |
| `stage1Selection` | dict | TaskContext |
| `startedAt` | float | ChatWorkflow, TaskItem |
| `stats` | List | ChatWorkflow |
| `status` | str, TokenStatus, TaskStatus, ConnectionStatus | ChatLog, ChatWorkflow, ChatMessage, UserConnection, AutomationDefinition, ActionItem, TaskItem, TaskResult, ReviewResult, Token |
| `style` | str | AiCallPromptImage |
| `success` | bool | ChatMessage, ActionResult, Observation, TaskResult, AuthEvent, AiModelResponse |
| `successCriteria` | list | TaskStep |
| `successfulActions` | list | TaskContext |
| `summary` | str | ChatMessage |
| `summaryAllowed` | bool | PromptPlaceholder |
| `taskActions` | list | ReviewContext |
| `taskId` | str | TaskResult, TaskHandover |
| `taskNumber` | int | ChatLog, ChatDocument, ChatMessage |
| `taskProgress` | str | ChatMessage |
| `tasks` | List | ChatWorkflow, TaskPlan, UnderstandingResult |
| `taskStep` | TaskStep | TaskContext, ReviewContext |
| `temperature` | float | AiModel, AiCallOptions |
| `template` | str | AutomationDefinition |
| `template_structure` | str | ContinuationContext |
| `timestamp` | float | ChatLog, ActionItem, TaskHandover, AuthEvent |
| `title` | str | AiResponseMetadata |
| `tokenAccess` | str | Token |
| `tokenExpiresAt` | float | UserConnection |
| `tokenRefresh` | str | Token |
| `tokensUsed` | Dict | AiModelResponse |
| `tokenStatus` | str | UserConnection |
| `tokenType` | str | Token |
| `totalActions` | int | ChatWorkflow |
| `totalTasks` | int | ChatWorkflow |
| `type` | str | ChatLog |
| `typeGroup` | str | ObservationPreview |
| `unmetCriteria` | List | ReviewResult |
| `update` | AccessLevel | AccessRule, UserPermissions |
| `url` | str | AiCallPromptWebCrawl |
| `userAgent` | str | AuthEvent |
| `userId` | str | UserConnection, Token, AuthEvent |
| `userInput` | str | TaskItem |
| `userLanguage` | str | UserInputRequest, RequestContext |
| `userMessage` | str | ActionItem, TaskStep, ReviewResult, TaskPlan, ActionDefinition |
| `userPrompt` | str | SectionPromptArgs, ChapterStructurePromptArgs, CodeContentPromptArgs, CodeStructurePromptArgs |
| `username` | str | User |
| `validationMetadata` | Dict | ActionDocument |
| `version` | str | AiModel |
| `view` | bool | AccessRule, UserPermissions |
| `weight` | float | SelectionRule |
| `width` | int | ContentMetadata |
| `workflow` | ChatWorkflow | TaskContext |
| `workflowId` | str | ChatStat, ChatLog, ChatMessage, ChatWorkflow, TaskItem, TaskContext, ReviewContext |
| `workflowMode` | WorkflowModeEnum | ChatWorkflow |
| `workflowSummary` | str | TaskHandover |
---
Can you adapt following fields to Multilingual Fields (`TextMultilingual`):
| Field Name | Models |
|------------|--------|
| `description` | Role | (is already)

File diff suppressed because it is too large Load diff

View file

@ -23,7 +23,7 @@ from modules.datamodels.datamodelRealEstate import (
Land, Land,
) )
from modules.services import getInterface as getServices from modules.services import getInterface as getServices
from modules.interfaces.interfaceDbRealEstate import getInterface as getRealEstateInterface from modules.interfaces.interfaceDbRealestate import getInterface as getRealEstateInterface
from modules.connectors.connectorSwissTopoMapServer import SwissTopoMapServerConnector from modules.connectors.connectorSwissTopoMapServer import SwissTopoMapServerConnector
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -3,7 +3,7 @@
""" """
Utility functions for automation feature. Utility functions for automation feature.
Moved from interfaces/interfaceDbChatbot.py. Moved from interfaces/interfaceDbChat.py.
""" """
import json import json

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,8 @@
# Copyright (c) 2025 Patrick Motsch # Copyright (c) 2025 Patrick Motsch
# All rights reserved. # All rights reserved.
""" """
Interface to LucyDOM database and AI Connectors. Interface to Chatbot database and AI Connectors.
Uses the JSON connector for data access with added language support. Uses the PostgreSQL connector for data access with user/mandate filtering.
""" """
import logging import logging
@ -59,7 +59,7 @@ def storeDebugMessageAndDocuments(message, currentUser) -> None:
import os import os
from datetime import datetime, UTC from datetime import datetime, UTC
from modules.shared.debugLogger import _getBaseDebugDir, _ensureDir from modules.shared.debugLogger import _getBaseDebugDir, _ensureDir
from modules.interfaces.interfaceDbComponentObjects import getInterface from modules.interfaces.interfaceDbManagement import getInterface
# Create base debug directory (use base debug dir, not prompts subdirectory) # Create base debug directory (use base debug dir, not prompts subdirectory)
baseDebugDir = _getBaseDebugDir() baseDebugDir = _getBaseDebugDir()
@ -314,7 +314,7 @@ class ChatObjects:
try: try:
# Get configuration values with defaults # Get configuration values with defaults
dbHost = APP_CONFIG.get("DB_HOST", "_no_config_default_data") dbHost = APP_CONFIG.get("DB_HOST", "_no_config_default_data")
dbDatabase = "poweron_chat" dbDatabase = "poweron_chatbot"
dbUser = APP_CONFIG.get("DB_USER") dbUser = APP_CONFIG.get("DB_USER")
dbPassword = APP_CONFIG.get("DB_PASSWORD_SECRET") dbPassword = APP_CONFIG.get("DB_PASSWORD_SECRET")
dbPort = int(APP_CONFIG.get("DB_PORT", 5432)) dbPort = int(APP_CONFIG.get("DB_PORT", 5432))
@ -1668,7 +1668,7 @@ class ChatObjects:
if not automations: if not automations:
return automations return automations
from modules.interfaces.interfaceDbAppObjects import getInterface as getAppInterface from modules.interfaces.interfaceDbApp import getInterface as getAppInterface
# Collect all unique user IDs and mandate IDs # Collect all unique user IDs and mandate IDs
userIds = set() userIds = set()

View file

@ -215,7 +215,7 @@ class ComponentObjects:
# Get the root interface to access the initial mandate ID # Get the root interface to access the initial mandate ID
from modules.security.rootAccess import getRootUser from modules.security.rootAccess import getRootUser
from modules.interfaces.interfaceDbAppObjects import getInterface from modules.interfaces.interfaceDbApp import getInterface
rootUser = getRootUser() rootUser = getRootUser()
rootInterface = getInterface(rootUser) rootInterface = getInterface(rootUser)

View file

@ -12,7 +12,7 @@ from fastapi import HTTPException, status
from modules.shared.configuration import APP_CONFIG from modules.shared.configuration import APP_CONFIG
from modules.auth import limiter, getCurrentUser from modules.auth import limiter, getCurrentUser
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
# Static folder setup - using absolute path from app root # Static folder setup - using absolute path from app root
baseDir = FilePath(__file__).parent.parent.parent # Go up to gateway root baseDir = FilePath(__file__).parent.parent.parent # Go up to gateway root

View file

@ -11,7 +11,7 @@ from fastapi import status
import logging import logging
# Import interfaces and models # Import interfaces and models
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
from modules.auth import limiter, getRequestContext, requireSysAdmin, RequestContext from modules.auth import limiter, getRequestContext, requireSysAdmin, RequestContext
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
@ -76,8 +76,8 @@ async def sync_all_automation_events(
This will register/remove events based on active flags. This will register/remove events based on active flags.
""" """
try: try:
from modules.interfaces.interfaceDbChatbot import getInterface as getChatInterface from modules.interfaces.interfaceDbChat import getInterface as getChatInterface
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
from modules.features.workflow import syncAutomationEvents from modules.features.workflow import syncAutomationEvents
chatInterface = getChatInterface(currentUser) chatInterface = getChatInterface(currentUser)
@ -127,7 +127,7 @@ async def remove_event(
# Update automation's eventId if it exists # Update automation's eventId if it exists
if eventId.startswith("automation."): if eventId.startswith("automation."):
automation_id = eventId.replace("automation.", "") automation_id = eventId.replace("automation.", "")
chatInterface = interfaceDbChatbot.getInterface(currentUser) chatInterface = interfaceDbChat.getInterface(currentUser)
automation = chatInterface.getAutomationDefinition(automation_id) automation = chatInterface.getAutomationDefinition(automation_id)
if automation and getattr(automation, "eventId", None) == eventId: if automation and getattr(automation, "eventId", None) == eventId:
chatInterface.updateAutomationDefinition(automation_id, {"eventId": None}) chatInterface.updateAutomationDefinition(automation_id, {"eventId": None})

View file

@ -19,7 +19,7 @@ from pydantic import BaseModel, Field
from modules.auth import limiter, getRequestContext, RequestContext, requireSysAdmin from modules.auth import limiter, getRequestContext, RequestContext, requireSysAdmin
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.datamodels.datamodelFeatures import Feature, FeatureInstance from modules.datamodels.datamodelFeatures import Feature, FeatureInstance
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
from modules.interfaces.interfaceFeatures import getFeatureInterface from modules.interfaces.interfaceFeatures import getFeatureInterface
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -21,7 +21,7 @@ from pydantic import BaseModel, Field
from modules.auth import limiter, getRequestContext, RequestContext, requireSysAdmin from modules.auth import limiter, getRequestContext, RequestContext, requireSysAdmin
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.datamodels.datamodelRbac import Role, AccessRule from modules.datamodels.datamodelRbac import Role, AccessRule
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
from modules.shared.timeUtils import getUtcTimestamp from modules.shared.timeUtils import getUtcTimestamp
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -17,7 +17,7 @@ from modules.auth import limiter, requireSysAdmin
from modules.datamodels.datamodelUam import User, UserInDB from modules.datamodels.datamodelUam import User, UserInDB
from modules.datamodels.datamodelRbac import Role from modules.datamodels.datamodelRbac import Role
from modules.datamodels.datamodelMembership import UserMandate, UserMandateRole from modules.datamodels.datamodelMembership import UserMandate, UserMandateRole
from modules.interfaces.interfaceDbAppObjects import getInterface, getRootInterface from modules.interfaces.interfaceDbApp import getInterface, getRootInterface
# Configure logger # Configure logger
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -20,7 +20,7 @@ from modules.auth import limiter, getRequestContext, requireSysAdmin, RequestCon
from modules.datamodels.datamodelUam import User, UserPermissions, AccessLevel from modules.datamodels.datamodelUam import User, UserPermissions, AccessLevel
from modules.datamodels.datamodelRbac import AccessRuleContext, AccessRule, Role from modules.datamodels.datamodelRbac import AccessRuleContext, AccessRule, Role
from modules.datamodels.datamodelPagination import PaginationParams, PaginatedResponse, PaginationMetadata, normalize_pagination_dict from modules.datamodels.datamodelPagination import PaginationParams, PaginatedResponse, PaginationMetadata, normalize_pagination_dict
from modules.interfaces.interfaceDbAppObjects import getInterface, getRootInterface from modules.interfaces.interfaceDbApp import getInterface, getRootInterface
# Configure logger # Configure logger
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -13,7 +13,7 @@ import logging
import json import json
# Import interfaces and models # Import interfaces and models
from modules.interfaces.interfaceDbChatbot import getInterface as getChatInterface from modules.interfaces.interfaceDbChat import getInterface as getChatInterface
from modules.auth import getCurrentUser, limiter from modules.auth import getCurrentUser, limiter
from modules.datamodels.datamodelChat import AutomationDefinition, ChatWorkflow from modules.datamodels.datamodelChat import AutomationDefinition, ChatWorkflow
from modules.datamodels.datamodelPagination import PaginationParams, PaginatedResponse, PaginationMetadata, normalize_pagination_dict from modules.datamodels.datamodelPagination import PaginationParams, PaginatedResponse, PaginationMetadata, normalize_pagination_dict

View file

@ -21,9 +21,9 @@ from modules.datamodels.datamodelUam import User, UserConnection, AuthAuthority,
from modules.datamodels.datamodelSecurity import Token from modules.datamodels.datamodelSecurity import Token
from modules.auth import getCurrentUser, limiter from modules.auth import getCurrentUser, limiter
from modules.datamodels.datamodelPagination import PaginationParams, PaginatedResponse, PaginationMetadata, normalize_pagination_dict from modules.datamodels.datamodelPagination import PaginationParams, PaginatedResponse, PaginationMetadata, normalize_pagination_dict
from modules.interfaces.interfaceDbAppObjects import getInterface from modules.interfaces.interfaceDbApp import getInterface
from modules.shared.timeUtils import getUtcTimestamp, parseTimestamp from modules.shared.timeUtils import getUtcTimestamp, parseTimestamp
from modules.interfaces.interfaceDbComponentObjects import ComponentObjects from modules.interfaces.interfaceDbManagement import ComponentObjects
# Configure logger # Configure logger
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -10,7 +10,7 @@ import json
from modules.auth import limiter, getCurrentUser from modules.auth import limiter, getCurrentUser
# Import interfaces # Import interfaces
import modules.interfaces.interfaceDbComponentObjects as interfaceDbComponentObjects import modules.interfaces.interfaceDbManagement as interfaceDbManagement
from modules.datamodels.datamodelFiles import FileItem, FilePreview from modules.datamodels.datamodelFiles import FileItem, FilePreview
from modules.shared.attributeUtils import getModelAttributeDefinitions from modules.shared.attributeUtils import getModelAttributeDefinitions
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
@ -69,7 +69,7 @@ async def get_files(
detail=f"Invalid pagination parameter: {str(e)}" detail=f"Invalid pagination parameter: {str(e)}"
) )
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
result = managementInterface.getAllFiles(pagination=paginationParams) result = managementInterface.getAllFiles(pagination=paginationParams)
# If pagination was requested, result is PaginatedResult # If pagination was requested, result is PaginatedResult
@ -112,17 +112,17 @@ async def upload_file(
file.fileName = file.filename file.fileName = file.filename
"""Upload a file""" """Upload a file"""
try: try:
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
# Read file # Read file
fileContent = await file.read() fileContent = await file.read()
# Check size limits # Check size limits
maxSize = int(interfaceDbComponentObjects.APP_CONFIG.get("File_Management_MAX_UPLOAD_SIZE_MB")) * 1024 * 1024 # in bytes maxSize = int(interfaceDbManagement.APP_CONFIG.get("File_Management_MAX_UPLOAD_SIZE_MB")) * 1024 * 1024 # in bytes
if len(fileContent) > maxSize: if len(fileContent) > maxSize:
raise HTTPException( raise HTTPException(
status_code=status.HTTP_413_REQUEST_ENTITY_TOO_LARGE, status_code=status.HTTP_413_REQUEST_ENTITY_TOO_LARGE,
detail=f"File too large. Maximum size: {interfaceDbComponentObjects.APP_CONFIG.get('File_Management_MAX_UPLOAD_SIZE_MB')}MB" detail=f"File too large. Maximum size: {interfaceDbManagement.APP_CONFIG.get('File_Management_MAX_UPLOAD_SIZE_MB')}MB"
) )
# Save file via LucyDOM interface in the database # Save file via LucyDOM interface in the database
@ -155,7 +155,7 @@ async def upload_file(
"isDuplicate": duplicateType != "new_file" "isDuplicate": duplicateType != "new_file"
}) })
except interfaceDbComponentObjects.FileStorageError as e: except interfaceDbManagement.FileStorageError as e:
logger.error(f"Error during file upload (storage): {str(e)}") logger.error(f"Error during file upload (storage): {str(e)}")
raise HTTPException( raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
@ -177,7 +177,7 @@ async def get_file(
) -> FileItem: ) -> FileItem:
"""Get a file""" """Get a file"""
try: try:
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
# Get file via LucyDOM interface from the database # Get file via LucyDOM interface from the database
fileData = managementInterface.getFile(fileId) fileData = managementInterface.getFile(fileId)
@ -189,19 +189,19 @@ async def get_file(
return fileData return fileData
except interfaceDbComponentObjects.FileNotFoundError as e: except interfaceDbManagement.FileNotFoundError as e:
logger.warning(f"File not found: {str(e)}") logger.warning(f"File not found: {str(e)}")
raise HTTPException( raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND, status_code=status.HTTP_404_NOT_FOUND,
detail=str(e) detail=str(e)
) )
except interfaceDbComponentObjects.FilePermissionError as e: except interfaceDbManagement.FilePermissionError as e:
logger.warning(f"No permission for file: {str(e)}") logger.warning(f"No permission for file: {str(e)}")
raise HTTPException( raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN, status_code=status.HTTP_403_FORBIDDEN,
detail=str(e) detail=str(e)
) )
except interfaceDbComponentObjects.FileError as e: except interfaceDbManagement.FileError as e:
logger.error(f"Error retrieving file: {str(e)}") logger.error(f"Error retrieving file: {str(e)}")
raise HTTPException( raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
@ -224,7 +224,7 @@ async def update_file(
) -> FileItem: ) -> FileItem:
"""Update file info""" """Update file info"""
try: try:
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
# Get the file from the database # Get the file from the database
file = managementInterface.getFile(fileId) file = managementInterface.getFile(fileId)
@ -270,7 +270,7 @@ async def delete_file(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> Dict[str, Any]: ) -> Dict[str, Any]:
"""Delete a file""" """Delete a file"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
# Check if the file exists # Check if the file exists
existingFile = managementInterface.getFile(fileId) existingFile = managementInterface.getFile(fileId)
@ -297,7 +297,7 @@ async def get_file_stats(
) -> Dict[str, Any]: ) -> Dict[str, Any]:
"""Returns statistics about the stored files""" """Returns statistics about the stored files"""
try: try:
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
# Get all files - metadata only # Get all files - metadata only
allFiles = managementInterface.getAllFiles() allFiles = managementInterface.getAllFiles()
@ -336,7 +336,7 @@ async def download_file(
) -> Response: ) -> Response:
"""Download a file""" """Download a file"""
try: try:
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
# Get file data # Get file data
fileData = managementInterface.getFile(fileId) fileData = managementInterface.getFile(fileId)
@ -384,7 +384,7 @@ async def preview_file(
) -> FilePreview: ) -> FilePreview:
"""Preview a file's content""" """Preview a file's content"""
try: try:
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
# Get file preview using the correct method # Get file preview using the correct method
preview = managementInterface.getFileContent(fileId) preview = managementInterface.getFileContent(fileId)

View file

@ -20,7 +20,7 @@ from pydantic import BaseModel, Field
from modules.auth import limiter, requireSysAdmin, getRequestContext, RequestContext from modules.auth import limiter, requireSysAdmin, getRequestContext, RequestContext
# Import interfaces # Import interfaces
import modules.interfaces.interfaceDbAppObjects as interfaceDbAppObjects import modules.interfaces.interfaceDbApp as interfaceDbApp
from modules.shared.attributeUtils import getModelAttributeDefinitions from modules.shared.attributeUtils import getModelAttributeDefinitions
from modules.shared.auditLogger import audit_logger from modules.shared.auditLogger import audit_logger
@ -107,7 +107,7 @@ async def get_mandates(
detail=f"Invalid pagination parameter: {str(e)}" detail=f"Invalid pagination parameter: {str(e)}"
) )
appInterface = interfaceDbAppObjects.getRootInterface() appInterface = interfaceDbApp.getRootInterface()
result = appInterface.getAllMandates(pagination=paginationParams) result = appInterface.getAllMandates(pagination=paginationParams)
# If pagination was requested, result is PaginatedResult # If pagination was requested, result is PaginatedResult
@ -150,7 +150,7 @@ async def get_mandate(
MULTI-TENANT: SysAdmin-only. MULTI-TENANT: SysAdmin-only.
""" """
try: try:
appInterface = interfaceDbAppObjects.getRootInterface() appInterface = interfaceDbApp.getRootInterface()
mandate = appInterface.getMandate(mandateId) mandate = appInterface.getMandate(mandateId)
if not mandate: if not mandate:
@ -195,7 +195,7 @@ async def create_mandate(
description = mandateData.get('description') description = mandateData.get('description')
enabled = mandateData.get('enabled', True) enabled = mandateData.get('enabled', True)
appInterface = interfaceDbAppObjects.getRootInterface() appInterface = interfaceDbApp.getRootInterface()
# Create mandate # Create mandate
newMandate = appInterface.createMandate( newMandate = appInterface.createMandate(
@ -237,7 +237,7 @@ async def update_mandate(
try: try:
logger.debug(f"Updating mandate {mandateId} with data: {mandateData}") logger.debug(f"Updating mandate {mandateId} with data: {mandateData}")
appInterface = interfaceDbAppObjects.getRootInterface() appInterface = interfaceDbApp.getRootInterface()
# Check if mandate exists # Check if mandate exists
existingMandate = appInterface.getMandate(mandateId) existingMandate = appInterface.getMandate(mandateId)
@ -280,7 +280,7 @@ async def delete_mandate(
MULTI-TENANT: SysAdmin-only. MULTI-TENANT: SysAdmin-only.
""" """
try: try:
appInterface = interfaceDbAppObjects.getRootInterface() appInterface = interfaceDbApp.getRootInterface()
# Check if mandate exists # Check if mandate exists
existingMandate = appInterface.getMandate(mandateId) existingMandate = appInterface.getMandate(mandateId)
@ -347,7 +347,7 @@ async def listMandateUsers(
) )
try: try:
rootInterface = interfaceDbAppObjects.getRootInterface() rootInterface = interfaceDbApp.getRootInterface()
# Verify mandate exists # Verify mandate exists
mandate = rootInterface.getMandate(targetMandateId) mandate = rootInterface.getMandate(targetMandateId)
@ -518,7 +518,7 @@ async def addUserToMandate(
) )
try: try:
rootInterface = interfaceDbAppObjects.getRootInterface() rootInterface = interfaceDbApp.getRootInterface()
# 3. Verify mandate exists # 3. Verify mandate exists
mandate = rootInterface.getMandate(targetMandateId) mandate = rootInterface.getMandate(targetMandateId)
@ -627,7 +627,7 @@ async def removeUserFromMandate(
) )
try: try:
rootInterface = interfaceDbAppObjects.getRootInterface() rootInterface = interfaceDbApp.getRootInterface()
# Verify mandate exists # Verify mandate exists
mandate = rootInterface.getMandate(targetMandateId) mandate = rootInterface.getMandate(targetMandateId)
@ -707,7 +707,7 @@ async def updateUserRolesInMandate(
) )
try: try:
rootInterface = interfaceDbAppObjects.getRootInterface() rootInterface = interfaceDbApp.getRootInterface()
# Get user's membership # Get user's membership
membership = rootInterface.getUserMandate(targetUserId, targetMandateId) membership = rootInterface.getUserMandate(targetUserId, targetMandateId)
@ -810,7 +810,7 @@ def _hasMandateAdminRole(context: RequestContext, mandateId: str) -> bool:
return False return False
try: try:
rootInterface = interfaceDbAppObjects.getRootInterface() rootInterface = interfaceDbApp.getRootInterface()
for roleId in context.roleIds: for roleId in context.roleIds:
roleRecords = rootInterface.db.getRecordset(Role, recordFilter={"id": roleId}) roleRecords = rootInterface.db.getRecordset(Role, recordFilter={"id": roleId})

View file

@ -10,7 +10,7 @@ import json
from modules.auth import limiter, getCurrentUser from modules.auth import limiter, getCurrentUser
# Import interfaces # Import interfaces
import modules.interfaces.interfaceDbComponentObjects as interfaceDbComponentObjects import modules.interfaces.interfaceDbManagement as interfaceDbManagement
from modules.datamodels.datamodelUtils import Prompt from modules.datamodels.datamodelUtils import Prompt
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.datamodels.datamodelPagination import PaginationParams, PaginatedResponse, PaginationMetadata, normalize_pagination_dict from modules.datamodels.datamodelPagination import PaginationParams, PaginatedResponse, PaginationMetadata, normalize_pagination_dict
@ -58,7 +58,7 @@ async def get_prompts(
detail=f"Invalid pagination parameter: {str(e)}" detail=f"Invalid pagination parameter: {str(e)}"
) )
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
result = managementInterface.getAllPrompts(pagination=paginationParams) result = managementInterface.getAllPrompts(pagination=paginationParams)
# If pagination was requested, result is PaginatedResult # If pagination was requested, result is PaginatedResult
@ -89,7 +89,7 @@ async def create_prompt(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> Prompt: ) -> Prompt:
"""Create a new prompt""" """Create a new prompt"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
# Create prompt # Create prompt
newPrompt = managementInterface.createPrompt(prompt) newPrompt = managementInterface.createPrompt(prompt)
@ -104,7 +104,7 @@ async def get_prompt(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> Prompt: ) -> Prompt:
"""Get a specific prompt""" """Get a specific prompt"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
# Get prompt # Get prompt
prompt = managementInterface.getPrompt(promptId) prompt = managementInterface.getPrompt(promptId)
@ -125,7 +125,7 @@ async def update_prompt(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> Prompt: ) -> Prompt:
"""Update an existing prompt""" """Update an existing prompt"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
# Check if the prompt exists # Check if the prompt exists
existingPrompt = managementInterface.getPrompt(promptId) existingPrompt = managementInterface.getPrompt(promptId)
@ -160,7 +160,7 @@ async def delete_prompt(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> Dict[str, Any]: ) -> Dict[str, Any]:
"""Delete a prompt""" """Delete a prompt"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
# Check if the prompt exists # Check if the prompt exists
existingPrompt = managementInterface.getPrompt(promptId) existingPrompt = managementInterface.getPrompt(promptId)

View file

@ -17,7 +17,7 @@ import logging
import json import json
# Import interfaces and models # Import interfaces and models
import modules.interfaces.interfaceDbAppObjects as interfaceDbAppObjects import modules.interfaces.interfaceDbApp as interfaceDbApp
from modules.auth import limiter, getRequestContext, RequestContext from modules.auth import limiter, getRequestContext, RequestContext
# Import the attribute definition and helper functions # Import the attribute definition and helper functions
@ -179,7 +179,7 @@ async def get_users(
detail=f"Invalid pagination parameter: {str(e)}" detail=f"Invalid pagination parameter: {str(e)}"
) )
appInterface = interfaceDbAppObjects.getInterface(context.user) appInterface = interfaceDbApp.getInterface(context.user)
# MULTI-TENANT: Use mandateId from context (header) # MULTI-TENANT: Use mandateId from context (header)
# SysAdmin without mandateId can see all users # SysAdmin without mandateId can see all users
@ -278,7 +278,7 @@ async def get_user(
MULTI-TENANT: User must be in the same mandate (via UserMandate) or caller is SysAdmin. MULTI-TENANT: User must be in the same mandate (via UserMandate) or caller is SysAdmin.
""" """
try: try:
appInterface = interfaceDbAppObjects.getInterface(context.user) appInterface = interfaceDbApp.getInterface(context.user)
# Get user without filtering by enabled status # Get user without filtering by enabled status
user = appInterface.getUser(userId) user = appInterface.getUser(userId)
@ -333,7 +333,7 @@ async def create_user(
Create a new user. Create a new user.
MULTI-TENANT: User is created and automatically added to the current mandate. MULTI-TENANT: User is created and automatically added to the current mandate.
""" """
appInterface = interfaceDbAppObjects.getInterface(context.user) appInterface = interfaceDbApp.getInterface(context.user)
# Extract fields from request model and call createUser with individual parameters # Extract fields from request model and call createUser with individual parameters
from modules.datamodels.datamodelUam import AuthAuthority from modules.datamodels.datamodelUam import AuthAuthority
@ -375,7 +375,7 @@ async def update_user(
Update an existing user. Update an existing user.
MULTI-TENANT: Can only update users in the same mandate (unless SysAdmin). MULTI-TENANT: Can only update users in the same mandate (unless SysAdmin).
""" """
appInterface = interfaceDbAppObjects.getInterface(context.user) appInterface = interfaceDbApp.getInterface(context.user)
# Check if the user exists # Check if the user exists
existingUser = appInterface.getUser(userId) existingUser = appInterface.getUser(userId)
@ -430,7 +430,7 @@ async def reset_user_password(
) )
# Get user interface # Get user interface
appInterface = interfaceDbAppObjects.getInterface(context.user) appInterface = interfaceDbApp.getInterface(context.user)
# Get target user # Get target user
target_user = appInterface.getUser(userId) target_user = appInterface.getUser(userId)
@ -525,7 +525,7 @@ async def change_password(
""" """
try: try:
# Get user interface # Get user interface
appInterface = interfaceDbAppObjects.getInterface(context.user) appInterface = interfaceDbApp.getInterface(context.user)
# Verify current password # Verify current password
if not appInterface.verifyPassword(currentPassword, context.user.passwordHash): if not appInterface.verifyPassword(currentPassword, context.user.passwordHash):
@ -612,10 +612,10 @@ async def sendPasswordLink(
""" """
try: try:
from modules.shared.configuration import APP_CONFIG from modules.shared.configuration import APP_CONFIG
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
# Get user interface # Get user interface
appInterface = interfaceDbAppObjects.getInterface(context.user) appInterface = interfaceDbApp.getInterface(context.user)
# Get target user # Get target user
targetUser = appInterface.getUser(userId) targetUser = appInterface.getUser(userId)
@ -742,7 +742,7 @@ async def delete_user(
Delete a user. Delete a user.
MULTI-TENANT: Can only delete users in the same mandate (unless SysAdmin). MULTI-TENANT: Can only delete users in the same mandate (unless SysAdmin).
""" """
appInterface = interfaceDbAppObjects.getInterface(context.user) appInterface = interfaceDbApp.getInterface(context.user)
# Check if the user exists # Check if the user exists
existingUser = appInterface.getUser(userId) existingUser = appInterface.getUser(userId)

View file

@ -14,8 +14,8 @@ from fastapi import APIRouter, HTTPException, Depends, Body, Path, Query, Respon
from modules.auth import limiter, getCurrentUser from modules.auth import limiter, getCurrentUser
# Import interfaces # Import interfaces
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
from modules.interfaces.interfaceDbChatbot import getInterface from modules.interfaces.interfaceDbChat import getInterface
from modules.interfaces.interfaceRbac import getRecordsetWithRBAC from modules.interfaces.interfaceRbac import getRecordsetWithRBAC
# Import models # Import models
@ -45,7 +45,7 @@ router = APIRouter(
) )
def getServiceChat(currentUser: User): def getServiceChat(currentUser: User):
return interfaceDbChatbot.getInterface(currentUser) return interfaceDbChat.getInterface(currentUser)
# Consolidated endpoint for getting all workflows # Consolidated endpoint for getting all workflows
@router.get("/", response_model=PaginatedResponse[ChatWorkflow]) @router.get("/", response_model=PaginatedResponse[ChatWorkflow])

View file

@ -13,7 +13,7 @@ from fastapi import APIRouter, HTTPException, Depends, Body, Path, Query, Reques
from modules.auth import limiter, getRequestContext, RequestContext from modules.auth import limiter, getRequestContext, RequestContext
# Import interfaces # Import interfaces
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
# Import models # Import models
from modules.datamodels.datamodelChat import ChatWorkflow, UserInputRequest, WorkflowModeEnum from modules.datamodels.datamodelChat import ChatWorkflow, UserInputRequest, WorkflowModeEnum
@ -32,7 +32,7 @@ router = APIRouter(
) )
def _getServiceChat(context: RequestContext): def _getServiceChat(context: RequestContext):
return interfaceDbChatbot.getInterface(context.user, mandateId=str(context.mandateId) if context.mandateId else None) return interfaceDbChat.getInterface(context.user, mandateId=str(context.mandateId) if context.mandateId else None)
# Workflow start endpoint # Workflow start endpoint
@router.post("/start", response_model=ChatWorkflow) @router.post("/start", response_model=ChatWorkflow)

View file

@ -18,7 +18,7 @@ from modules.shared.timeUtils import parseTimestamp
from modules.auth import limiter, getRequestContext, RequestContext from modules.auth import limiter, getRequestContext, RequestContext
# Import interfaces # Import interfaces
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
from modules.interfaces.interfaceRbac import getRecordsetWithRBAC from modules.interfaces.interfaceRbac import getRecordsetWithRBAC
# Import models # Import models
@ -43,7 +43,7 @@ router = APIRouter(
) )
def _getServiceChat(context: RequestContext): def _getServiceChat(context: RequestContext):
return interfaceDbChatbot.getInterface(context.user, mandateId=str(context.mandateId) if context.mandateId else None) return interfaceDbChat.getInterface(context.user, mandateId=str(context.mandateId) if context.mandateId else None)
# Chatbot streaming endpoint (SSE) # Chatbot streaming endpoint (SSE)
@router.post("/start/stream") @router.post("/start/stream")

View file

@ -26,7 +26,7 @@ from modules.datamodels.datamodelRealEstate import (
) )
# Import interfaces # Import interfaces
from modules.interfaces.interfaceDbRealEstate import getInterface as getRealEstateInterface from modules.interfaces.interfaceDbRealestate import getInterface as getRealEstateInterface
# Import feature logic for AI-powered commands # Import feature logic for AI-powered commands
from modules.features.realEstate.mainRealEstate import ( from modules.features.realEstate.mainRealEstate import (

View file

@ -19,7 +19,7 @@ import io
from modules.auth import limiter, getRequestContext, RequestContext from modules.auth import limiter, getRequestContext, RequestContext
from modules.interfaces.interfaceDbTrustee import getInterface from modules.interfaces.interfaceDbTrustee import getInterface
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
from modules.interfaces.interfaceFeatures import getFeatureInterface from modules.interfaces.interfaceFeatures import getFeatureInterface
from modules.datamodels.datamodelTrustee import ( from modules.datamodels.datamodelTrustee import (
TrusteeOrganisation, TrusteeOrganisation,

View file

@ -21,7 +21,7 @@ from pydantic import BaseModel, Field
from modules.auth import limiter, getCurrentUser from modules.auth import limiter, getCurrentUser
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
from modules.shared.timeUtils import getUtcTimestamp from modules.shared.timeUtils import getUtcTimestamp
from modules.shared.auditLogger import audit_logger from modules.shared.auditLogger import audit_logger

View file

@ -19,7 +19,7 @@ from pydantic import BaseModel, Field
from modules.auth import limiter, getRequestContext, RequestContext, getCurrentUser from modules.auth import limiter, getRequestContext, RequestContext, getCurrentUser
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.datamodels.datamodelInvitation import Invitation from modules.datamodels.datamodelInvitation import Invitation
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
from modules.shared.timeUtils import getUtcTimestamp from modules.shared.timeUtils import getUtcTimestamp
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -11,7 +11,7 @@ from modules.auth import limiter, getCurrentUser, getRequestContext, RequestCont
from modules.datamodels.datamodelRbac import Role from modules.datamodels.datamodelRbac import Role
# Import interfaces # Import interfaces
import modules.interfaces.interfaceDbComponentObjects as interfaceDbComponentObjects import modules.interfaces.interfaceDbManagement as interfaceDbManagement
from modules.datamodels.datamodelMessaging import ( from modules.datamodels.datamodelMessaging import (
MessagingSubscription, MessagingSubscription,
MessagingSubscriptionRegistration, MessagingSubscriptionRegistration,
@ -55,7 +55,7 @@ async def getSubscriptions(
detail=f"Invalid pagination parameter: {str(e)}" detail=f"Invalid pagination parameter: {str(e)}"
) )
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
result = managementInterface.getAllSubscriptions(pagination=paginationParams) result = managementInterface.getAllSubscriptions(pagination=paginationParams)
if paginationParams: if paginationParams:
@ -85,7 +85,7 @@ async def createSubscription(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> MessagingSubscription: ) -> MessagingSubscription:
"""Create a new subscription""" """Create a new subscription"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
subscriptionData = subscription.model_dump(exclude={"id"}) subscriptionData = subscription.model_dump(exclude={"id"})
newSubscription = managementInterface.createSubscription(subscriptionData) newSubscription = managementInterface.createSubscription(subscriptionData)
@ -101,7 +101,7 @@ async def getSubscription(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> MessagingSubscription: ) -> MessagingSubscription:
"""Get a specific subscription""" """Get a specific subscription"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
subscription = managementInterface.getSubscription(subscriptionId) subscription = managementInterface.getSubscription(subscriptionId)
if not subscription: if not subscription:
@ -122,7 +122,7 @@ async def updateSubscription(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> MessagingSubscription: ) -> MessagingSubscription:
"""Update an existing subscription""" """Update an existing subscription"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
existingSubscription = managementInterface.getSubscription(subscriptionId) existingSubscription = managementInterface.getSubscription(subscriptionId)
if not existingSubscription: if not existingSubscription:
@ -151,7 +151,7 @@ async def deleteSubscription(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> Dict[str, Any]: ) -> Dict[str, Any]:
"""Delete a subscription""" """Delete a subscription"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
existingSubscription = managementInterface.getSubscription(subscriptionId) existingSubscription = managementInterface.getSubscription(subscriptionId)
if not existingSubscription: if not existingSubscription:
@ -192,7 +192,7 @@ async def getSubscriptionRegistrations(
detail=f"Invalid pagination parameter: {str(e)}" detail=f"Invalid pagination parameter: {str(e)}"
) )
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
result = managementInterface.getAllRegistrations( result = managementInterface.getAllRegistrations(
subscriptionId=subscriptionId, subscriptionId=subscriptionId,
pagination=paginationParams pagination=paginationParams
@ -227,7 +227,7 @@ async def subscribeUser(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> MessagingSubscriptionRegistration: ) -> MessagingSubscriptionRegistration:
"""Subscribe user to a subscription with a specific channel""" """Subscribe user to a subscription with a specific channel"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
registration = managementInterface.subscribeUser( registration = managementInterface.subscribeUser(
subscriptionId=subscriptionId, subscriptionId=subscriptionId,
@ -248,7 +248,7 @@ async def unsubscribeUser(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> Dict[str, Any]: ) -> Dict[str, Any]:
"""Unsubscribe user from a subscription for a specific channel""" """Unsubscribe user from a subscription for a specific channel"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
success = managementInterface.unsubscribeUser( success = managementInterface.unsubscribeUser(
subscriptionId=subscriptionId, subscriptionId=subscriptionId,
@ -284,7 +284,7 @@ async def getMyRegistrations(
detail=f"Invalid pagination parameter: {str(e)}" detail=f"Invalid pagination parameter: {str(e)}"
) )
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
result = managementInterface.getAllRegistrations( result = managementInterface.getAllRegistrations(
userId=currentUser.id, userId=currentUser.id,
pagination=paginationParams pagination=paginationParams
@ -318,7 +318,7 @@ async def updateRegistration(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> MessagingSubscriptionRegistration: ) -> MessagingSubscriptionRegistration:
"""Update a registration""" """Update a registration"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
existingRegistration = managementInterface.getRegistration(registrationId) existingRegistration = managementInterface.getRegistration(registrationId)
if not existingRegistration: if not existingRegistration:
@ -347,7 +347,7 @@ async def deleteRegistration(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> Dict[str, Any]: ) -> Dict[str, Any]:
"""Delete a registration""" """Delete a registration"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
existingRegistration = managementInterface.getRegistration(registrationId) existingRegistration = managementInterface.getRegistration(registrationId)
if not existingRegistration: if not existingRegistration:
@ -417,7 +417,7 @@ def _hasTriggerPermission(context: RequestContext) -> bool:
return False return False
try: try:
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
rootInterface = getRootInterface() rootInterface = getRootInterface()
for roleId in context.roleIds: for roleId in context.roleIds:
@ -458,7 +458,7 @@ async def getDeliveries(
detail=f"Invalid pagination parameter: {str(e)}" detail=f"Invalid pagination parameter: {str(e)}"
) )
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
result = managementInterface.getDeliveries( result = managementInterface.getDeliveries(
subscriptionId=subscriptionId, subscriptionId=subscriptionId,
userId=currentUser.id, # Users can only see their own deliveries userId=currentUser.id, # Users can only see their own deliveries
@ -492,7 +492,7 @@ async def getDelivery(
currentUser: User = Depends(getCurrentUser) currentUser: User = Depends(getCurrentUser)
) -> MessagingDelivery: ) -> MessagingDelivery:
"""Get a specific delivery""" """Get a specific delivery"""
managementInterface = interfaceDbComponentObjects.getInterface(currentUser) managementInterface = interfaceDbManagement.getInterface(currentUser)
delivery = managementInterface.getDelivery(deliveryId) delivery = managementInterface.getDelivery(deliveryId)
if not delivery: if not delivery:

View file

@ -13,7 +13,7 @@ import logging
from modules.auth import getCurrentUser, limiter, requireSysAdmin from modules.auth import getCurrentUser, limiter, requireSysAdmin
from modules.connectors.connectorDbPostgre import DatabaseConnector from modules.connectors.connectorDbPostgre import DatabaseConnector
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
from modules.datamodels.datamodelUam import User, UserInDB, AuthAuthority from modules.datamodels.datamodelUam import User, UserInDB, AuthAuthority
from modules.datamodels.datamodelSecurity import Token from modules.datamodels.datamodelSecurity import Token
from modules.shared.configuration import APP_CONFIG from modules.shared.configuration import APP_CONFIG

View file

@ -13,7 +13,7 @@ from requests_oauthlib import OAuth2Session
import httpx import httpx
from modules.shared.configuration import APP_CONFIG from modules.shared.configuration import APP_CONFIG
from modules.interfaces.interfaceDbAppObjects import getInterface, getRootInterface from modules.interfaces.interfaceDbApp import getInterface, getRootInterface
from modules.datamodels.datamodelUam import AuthAuthority, User, ConnectionStatus, UserConnection from modules.datamodels.datamodelUam import AuthAuthority, User, ConnectionStatus, UserConnection
from modules.auth import getCurrentUser, limiter from modules.auth import getCurrentUser, limiter
from modules.auth import createAccessToken, setAccessTokenCookie, createRefreshToken, setRefreshTokenCookie from modules.auth import createAccessToken, setAccessTokenCookie, createRefreshToken, setRefreshTokenCookie

View file

@ -16,7 +16,7 @@ from jose import jwt
# Import auth modules # Import auth modules
from modules.auth import getCurrentUser, limiter, SECRET_KEY, ALGORITHM from modules.auth import getCurrentUser, limiter, SECRET_KEY, ALGORITHM
from modules.auth import createAccessToken, createRefreshToken, setAccessTokenCookie, setRefreshTokenCookie, clearAccessTokenCookie, clearRefreshTokenCookie from modules.auth import createAccessToken, createRefreshToken, setAccessTokenCookie, setRefreshTokenCookie, clearAccessTokenCookie, clearRefreshTokenCookie
from modules.interfaces.interfaceDbAppObjects import getInterface, getRootInterface from modules.interfaces.interfaceDbApp import getInterface, getRootInterface
from modules.datamodels.datamodelUam import User, UserInDB, AuthAuthority from modules.datamodels.datamodelUam import User, UserInDB, AuthAuthority
from modules.datamodels.datamodelSecurity import Token from modules.datamodels.datamodelSecurity import Token
from modules.shared.configuration import APP_CONFIG from modules.shared.configuration import APP_CONFIG

View file

@ -13,7 +13,7 @@ import msal
import httpx import httpx
from modules.shared.configuration import APP_CONFIG from modules.shared.configuration import APP_CONFIG
from modules.interfaces.interfaceDbAppObjects import getInterface, getRootInterface from modules.interfaces.interfaceDbApp import getInterface, getRootInterface
from modules.datamodels.datamodelUam import AuthAuthority, User, ConnectionStatus, UserConnection from modules.datamodels.datamodelUam import AuthAuthority, User, ConnectionStatus, UserConnection
from modules.datamodels.datamodelSecurity import Token from modules.datamodels.datamodelSecurity import Token
from modules.auth import getCurrentUser, limiter from modules.auth import getCurrentUser, limiter

View file

@ -11,7 +11,7 @@ from fastapi import APIRouter, HTTPException, Depends, Path, Query, Request, sta
from modules.auth import limiter, getCurrentUser from modules.auth import limiter, getCurrentUser
from modules.datamodels.datamodelUam import User, UserConnection from modules.datamodels.datamodelUam import User, UserConnection
from modules.interfaces.interfaceDbAppObjects import getInterface from modules.interfaces.interfaceDbApp import getInterface
from modules.services import getInterface as getServices from modules.services import getInterface as getServices
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -49,13 +49,13 @@ class Services:
# Initialize interfaces with explicit mandateId # Initialize interfaces with explicit mandateId
from modules.interfaces.interfaceDbChatbot import getInterface as getChatInterface from modules.interfaces.interfaceDbChat import getInterface as getChatInterface
self.interfaceDbChat = getChatInterface(user, mandateId=mandateId) self.interfaceDbChat = getChatInterface(user, mandateId=mandateId)
from modules.interfaces.interfaceDbAppObjects import getInterface as getAppInterface from modules.interfaces.interfaceDbApp import getInterface as getAppInterface
self.interfaceDbApp = getAppInterface(user, mandateId=mandateId) self.interfaceDbApp = getAppInterface(user, mandateId=mandateId)
from modules.interfaces.interfaceDbComponentObjects import getInterface as getComponentInterface from modules.interfaces.interfaceDbManagement import getInterface as getComponentInterface
self.interfaceDbComponent = getComponentInterface(user, mandateId=mandateId) self.interfaceDbComponent = getComponentInterface(user, mandateId=mandateId)
from modules.interfaces.interfaceDbTrustee import getInterface as getTrusteeInterface from modules.interfaces.interfaceDbTrustee import getInterface as getTrusteeInterface

View file

@ -65,7 +65,7 @@ class ExtractionService:
results: List[ContentExtracted] = [] results: List[ContentExtracted] = []
# Lazy import to avoid circular deps and heavy init at module import # Lazy import to avoid circular deps and heavy init at module import
from modules.interfaces.interfaceDbComponentObjects import getInterface from modules.interfaces.interfaceDbManagement import getInterface
dbInterface = getInterface() dbInterface = getInterface()
totalDocs = len(documents) totalDocs = len(documents)

View file

@ -157,11 +157,11 @@ class UtilsService:
def storeDebugMessageAndDocuments(self, message, currentUser): def storeDebugMessageAndDocuments(self, message, currentUser):
""" """
Wrapper to store debug messages and documents via interfaceDbChatbot. Wrapper to store debug messages and documents via interfaceDbChat.
Mirrors storeDebugMessageAndDocuments() in modules.interfaces.interfaceDbChatbot. Mirrors storeDebugMessageAndDocuments() in modules.interfaces.interfaceDbChat.
""" """
try: try:
from modules.interfaces.interfaceDbChatbot import storeDebugMessageAndDocuments as _storeDebugMessageAndDocuments from modules.interfaces.interfaceDbChat import storeDebugMessageAndDocuments as _storeDebugMessageAndDocuments
_storeDebugMessageAndDocuments(message, currentUser) _storeDebugMessageAndDocuments(message, currentUser)
except Exception: except Exception:
# Silent fail to never break main flow # Silent fail to never break main flow

View file

@ -452,10 +452,10 @@ def extractLatestRefinementFeedback(context: Any) -> str:
# First check for ERROR level logs in workflow # First check for ERROR level logs in workflow
if hasattr(context, 'workflow') and context.workflow: if hasattr(context, 'workflow') and context.workflow:
try: try:
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
rootInterface = getRootInterface() rootInterface = getRootInterface()
interfaceDbChat = interfaceDbChatbot.getInterface(rootInterface.currentUser) interfaceDbChat = interfaceDbChat.getInterface(rootInterface.currentUser)
# Get workflow logs # Get workflow logs
chatData = interfaceDbChat.getUnifiedChatData(context.workflow.id, None) chatData = interfaceDbChat.getUnifiedChatData(context.workflow.id, None)

View file

@ -27,7 +27,7 @@ class MethodAiOperationsTester:
def __init__(self): def __init__(self):
# Use root user for testing (has full access to everything) # Use root user for testing (has full access to everything)
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
rootInterface = getRootInterface() rootInterface = getRootInterface()
self.testUser = rootInterface.currentUser self.testUser = rootInterface.currentUser
@ -94,8 +94,8 @@ class MethodAiOperationsTester:
logging.getLogger().setLevel(logging.DEBUG) logging.getLogger().setLevel(logging.DEBUG)
# Import and initialize services - use the same approach as routeChatPlayground # Import and initialize services - use the same approach as routeChatPlayground
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
# Import and initialize services # Import and initialize services
from modules.services import getInterface as getServices from modules.services import getInterface as getServices
@ -201,8 +201,8 @@ class MethodAiOperationsTester:
# Save message to database # Save message to database
if self.services.workflow: if self.services.workflow:
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
messageDict = testMessage.model_dump() messageDict = testMessage.model_dump()
interfaceDbChat.createMessage(messageDict) interfaceDbChat.createMessage(messageDict)
@ -283,8 +283,8 @@ class MethodAiOperationsTester:
maxSteps=5 maxSteps=5
) )
# Save workflow to database # Save workflow to database
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
workflowDict = testWorkflow.model_dump() workflowDict = testWorkflow.model_dump()
interfaceDbChat.createWorkflow(workflowDict) interfaceDbChat.createWorkflow(workflowDict)

View file

@ -27,7 +27,7 @@ from modules.datamodels.datamodelWorkflow import AiResponse
class AIBehaviorTester: class AIBehaviorTester:
def __init__(self): def __init__(self):
# Use root user for testing (has full access to everything) # Use root user for testing (has full access to everything)
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
rootInterface = getRootInterface() rootInterface = getRootInterface()
self.testUser = rootInterface.currentUser self.testUser = rootInterface.currentUser
@ -45,7 +45,7 @@ class AIBehaviorTester:
from modules.datamodels.datamodelChat import ChatWorkflow, WorkflowModeEnum from modules.datamodels.datamodelChat import ChatWorkflow, WorkflowModeEnum
import uuid import uuid
import time import time
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
currentTimestamp = time.time() currentTimestamp = time.time()
@ -67,7 +67,7 @@ class AIBehaviorTester:
) )
# SAVE workflow to database so it exists for access control # SAVE workflow to database so it exists for access control
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
workflowDict = testWorkflow.model_dump() workflowDict = testWorkflow.model_dump()
interfaceDbChat.createWorkflow(workflowDict) interfaceDbChat.createWorkflow(workflowDict)

View file

@ -23,13 +23,13 @@ from modules.services import getInterface as getServices
from modules.datamodels.datamodelChat import UserInputRequest, WorkflowModeEnum from modules.datamodels.datamodelChat import UserInputRequest, WorkflowModeEnum
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.features.workflow import chatStart from modules.features.workflow import chatStart
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
class WorkflowWithDocumentsTester: class WorkflowWithDocumentsTester:
def __init__(self): def __init__(self):
# Use root user for testing (has full access to everything) # Use root user for testing (has full access to everything)
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
rootInterface = getRootInterface() rootInterface = getRootInterface()
self.testUser = rootInterface.currentUser self.testUser = rootInterface.currentUser
@ -192,7 +192,7 @@ class WorkflowWithDocumentsTester:
return False return False
# Get current workflow status # Get current workflow status
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
currentWorkflow = interfaceDbChat.getWorkflow(self.workflow.id) currentWorkflow = interfaceDbChat.getWorkflow(self.workflow.id)
if not currentWorkflow: if not currentWorkflow:
@ -225,7 +225,7 @@ class WorkflowWithDocumentsTester:
if not self.workflow: if not self.workflow:
return {"error": "No workflow to analyze"} return {"error": "No workflow to analyze"}
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
workflow = interfaceDbChat.getWorkflow(self.workflow.id) workflow = interfaceDbChat.getWorkflow(self.workflow.id)
if not workflow: if not workflow:

View file

@ -25,13 +25,13 @@ from modules.services import getInterface as getServices
from modules.datamodels.datamodelChat import UserInputRequest, WorkflowModeEnum from modules.datamodels.datamodelChat import UserInputRequest, WorkflowModeEnum
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.features.workflow import chatStart from modules.features.workflow import chatStart
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
class WorkflowPromptVariationsTester: class WorkflowPromptVariationsTester:
def __init__(self): def __init__(self):
# Use root user for testing (has full access to everything) # Use root user for testing (has full access to everything)
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
rootInterface = getRootInterface() rootInterface = getRootInterface()
self.testUser = rootInterface.currentUser self.testUser = rootInterface.currentUser
@ -115,7 +115,7 @@ class WorkflowPromptVariationsTester:
return False return False
# Get current workflow status # Get current workflow status
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
currentWorkflow = interfaceDbChat.getWorkflow(workflow.id) currentWorkflow = interfaceDbChat.getWorkflow(workflow.id)
if not currentWorkflow: if not currentWorkflow:
@ -140,7 +140,7 @@ class WorkflowPromptVariationsTester:
def _analyzeWorkflowResults(self, workflow: Any) -> Dict[str, Any]: def _analyzeWorkflowResults(self, workflow: Any) -> Dict[str, Any]:
"""Analyze workflow results and extract information.""" """Analyze workflow results and extract information."""
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
workflow = interfaceDbChat.getWorkflow(workflow.id) workflow = interfaceDbChat.getWorkflow(workflow.id)
if not workflow: if not workflow:

View file

@ -24,13 +24,13 @@ from modules.services import getInterface as getServices
from modules.datamodels.datamodelChat import UserInputRequest, WorkflowModeEnum from modules.datamodels.datamodelChat import UserInputRequest, WorkflowModeEnum
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.features.workflow import chatStart from modules.features.workflow import chatStart
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
class DocumentGenerationFormatsTester: class DocumentGenerationFormatsTester:
def __init__(self): def __init__(self):
# Use root user for testing (has full access to everything) # Use root user for testing (has full access to everything)
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
rootInterface = getRootInterface() rootInterface = getRootInterface()
self.testUser = rootInterface.currentUser self.testUser = rootInterface.currentUser
@ -251,7 +251,7 @@ class DocumentGenerationFormatsTester:
startTime = time.time() startTime = time.time()
lastStatus = None lastStatus = None
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
if timeout is None: if timeout is None:
print("Waiting indefinitely (no timeout)") print("Waiting indefinitely (no timeout)")
@ -296,7 +296,7 @@ class DocumentGenerationFormatsTester:
if not self.workflow: if not self.workflow:
return {"error": "No workflow to analyze"} return {"error": "No workflow to analyze"}
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
workflow = interfaceDbChat.getWorkflow(self.workflow.id) workflow = interfaceDbChat.getWorkflow(self.workflow.id)
if not workflow: if not workflow:

View file

@ -24,13 +24,13 @@ from modules.services import getInterface as getServices
from modules.datamodels.datamodelChat import UserInputRequest, WorkflowModeEnum from modules.datamodels.datamodelChat import UserInputRequest, WorkflowModeEnum
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.features.workflow import chatStart from modules.features.workflow import chatStart
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
class DocumentGenerationFormatsTester10: class DocumentGenerationFormatsTester10:
def __init__(self): def __init__(self):
# Use root user for testing (has full access to everything) # Use root user for testing (has full access to everything)
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
rootInterface = getRootInterface() rootInterface = getRootInterface()
self.testUser = rootInterface.currentUser self.testUser = rootInterface.currentUser
@ -248,7 +248,7 @@ class DocumentGenerationFormatsTester10:
startTime = time.time() startTime = time.time()
lastStatus = None lastStatus = None
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
if timeout is None: if timeout is None:
print("Waiting indefinitely (no timeout)") print("Waiting indefinitely (no timeout)")
@ -293,7 +293,7 @@ class DocumentGenerationFormatsTester10:
if not self.workflow: if not self.workflow:
return {"error": "No workflow to analyze"} return {"error": "No workflow to analyze"}
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
workflow = interfaceDbChat.getWorkflow(self.workflow.id) workflow = interfaceDbChat.getWorkflow(self.workflow.id)
if not workflow: if not workflow:

View file

@ -26,13 +26,13 @@ from modules.services import getInterface as getServices
from modules.datamodels.datamodelChat import UserInputRequest, WorkflowModeEnum from modules.datamodels.datamodelChat import UserInputRequest, WorkflowModeEnum
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.features.workflow import chatStart from modules.features.workflow import chatStart
import modules.interfaces.interfaceDbChatbot as interfaceDbChatbot import modules.interfaces.interfaceDbChat as interfaceDbChat
class CodeGenerationFormatsTester11: class CodeGenerationFormatsTester11:
def __init__(self): def __init__(self):
# Use root user for testing (has full access to everything) # Use root user for testing (has full access to everything)
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
rootInterface = getRootInterface() rootInterface = getRootInterface()
self.testUser = rootInterface.currentUser self.testUser = rootInterface.currentUser
@ -190,7 +190,7 @@ class CodeGenerationFormatsTester11:
startTime = time.time() startTime = time.time()
lastStatus = None lastStatus = None
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
if timeout is None: if timeout is None:
print("Waiting indefinitely (no timeout)") print("Waiting indefinitely (no timeout)")
@ -235,7 +235,7 @@ class CodeGenerationFormatsTester11:
if not self.workflow: if not self.workflow:
return {"error": "No workflow to analyze"} return {"error": "No workflow to analyze"}
interfaceDbChat = interfaceDbChatbot.getInterface(self.testUser) interfaceDbChat = interfaceDbChat.getInterface(self.testUser)
workflow = interfaceDbChat.getWorkflow(self.workflow.id) workflow = interfaceDbChat.getWorkflow(self.workflow.id)
if not workflow: if not workflow:

View file

@ -9,7 +9,7 @@ import pytest
import secrets import secrets
from fastapi.testclient import TestClient from fastapi.testclient import TestClient
from modules.datamodels.datamodelUam import User from modules.datamodels.datamodelUam import User
from modules.interfaces.interfaceDbAppObjects import getRootInterface from modules.interfaces.interfaceDbApp import getRootInterface
@pytest.fixture @pytest.fixture