6 KiB
6 KiB
flowchart TD
%% External/shared services/utilities
subgraph External and Shared
AiObjectsCall[AiObjects.call()];
AiObjectsGen[AiObjects.generateImage()];
ExtractionService[ExtractionService.extractContent()];
GenServicePrompt[GenerationService.getAdaptiveExtractionPrompt()];
GenServiceRender[GenerationService.renderReport()];
Normalizer[NormalizationService (discover/apply/validate)];
SubPipelineMerge[subPipeline._applyMerging()];
JsonUtilsExtract[jsonUtils.extractJsonString()];
JsonUtilsRepair[jsonUtils.repairBrokenJson()];
JsonUtilsSections[jsonUtils.extractSectionsFromDocument()];
JsonUtilsBuildCtx[jsonUtils.buildContinuationContext()];
BuildGenPrompt[subPromptBuilderGeneration.buildGenerationPrompt()];
UtilsSanitize[subSharedAiUtils.sanitizePromptContent()];
UtilsBuildPH[subSharedAiUtils.buildPromptWithPlaceholders()];
end
%% AiService
subgraph serviceAi mainServiceAi py - AiService
AiSvc_create[create()]
AiSvc_init[__init__()]
AiSvc_ensure[_ensureAiObjectsInitialized()]
AiSvc_initSubs[_initializeSubmodules()]
AiSvc_readImage[readImage()]
AiSvc_generateImage[generateImage()]
AiSvc_callPlan[callAiPlanning()]
AiSvc_callDocs[callAiDocuments()]
AiSvc_sanitize[sanitizePromptContent()]
end
AiSvc_create --> AiObjectsCall
AiSvc_create --> AiSvc_initSubs
AiSvc_initSubs --> ExtractionService
AiSvc_initSubs --> SubCore_new[SubCoreAi(...)]
AiSvc_initSubs --> SubDocProc_new[SubDocumentProcessing(...)]
AiSvc_initSubs --> SubDocGen_new[SubDocumentGeneration(...)]
AiSvc_ensure --> AiObjectsCall
AiSvc_ensure --> AiSvc_initSubs
AiSvc_readImage --> SubCore_readImage
AiSvc_generateImage --> SubCore_generateImage
AiSvc_callPlan --> SubCore_callPlan
AiSvc_callDocs --> SubCore_callDocs
AiSvc_sanitize --> UtilsSanitize
%% SubCoreAi
subgraph serviceAi subCoreAi py - SubCoreAi
SubCore_ctor[__init__()]
SubCore_analyze[_analyzePromptAndCreateOptions()]
SubCore_loop[_callAiWithLooping()]
SubCore_extract[_extractSectionsFromResponse()]
SubCore_should[_shouldContinueGeneration()]
SubCore_buildFinal[_buildFinalResultFromSections()]
SubCore_callPlan[callAiPlanning()]
SubCore_callDocs[callAiDocuments()]
SubCore_readImage[readImage()]
SubCore_generateImage[generateImage()]
end
SubCore_analyze --> AiObjectsCall
SubCore_analyze --> AiSvc_sanitize
SubCore_loop --> AiObjectsCall
SubCore_loop --> SubCore_extract
SubCore_loop --> SubCore_should
SubCore_loop --> SubCore_buildFinal
SubCore_extract --> JsonUtilsExtract
SubCore_extract --> JsonUtilsRepair
SubCore_extract --> JsonUtilsSections
SubCore_loop --> JsonUtilsBuildCtx
SubCore_callPlan --> UtilsBuildPH
SubCore_callPlan --> AiObjectsCall
SubCore_callDocs --> AiSvc_ensure
SubCore_callDocs --> SubCore_analyze
SubCore_callDocs --> BuildGenPrompt
SubCore_callDocs --> SubCore_loop
SubCore_callDocs --> GenServiceRender
SubCore_callDocs -->|documents present| AiSvc_callDocs_toDP[services.ai.documentProcessor.callAiText()]
SubCore_readImage --> AiObjectsCall
SubCore_generateImage --> AiObjectsGen
%% SubDocumentProcessing
subgraph serviceAi subDocumentProcessing py - SubDocumentProcessing
SDP_ctor[__init__()]
SDP_extractionService[prop: extractionService]
SDP_perChunk[processDocumentsPerChunk()]
SDP_perChunkJson[processDocumentsPerChunkJson()]
SDP_perChunkJsonPrompt[processDocumentsPerChunkJsonWithPrompt()]
SDP_withCont[processDocumentsWithContinuation()]
SDP_callText[callAiText()]
SDP_partsMap[_processPartsWithMapping()]
SDP_chunksMap[_processChunksWithMapping()]
SDP_mergeParts[_mergePartResults()]
SDP_convertPartsJson[_convertPartResultsToJson()]
SDP_mergeChunks[_mergeChunkResults()]
SDP_mergeChunksClean[_mergeChunkResultsClean()]
SDP_mergeChunksJson[_mergeChunkResultsJson()]
SDP_buildContPrompt[_buildContinuationPrompt()]
SDP_contLoop[_processWithContinuationLoop()]
SDP_buildIterPrompt[_buildContinuationIterationPrompt()]
end
SDP_extractionService --> ExtractionService
SDP_perChunk --> ExtractionService
SDP_perChunk --> SDP_partsMap
SDP_perChunk --> SDP_mergeParts
SDP_perChunkJson --> ExtractionService
SDP_perChunkJson --> SDP_partsMap
SDP_perChunkJson --> SDP_convertPartsJson
SDP_perChunkJson --> Normalizer
SDP_perChunkJsonPrompt --> ExtractionService
SDP_perChunkJsonPrompt --> SDP_chunksMap
SDP_perChunkJsonPrompt --> SDP_mergeChunksJson
SDP_withCont --> SDP_buildContPrompt
SDP_withCont --> SDP_contLoop
SDP_contLoop --> SDP_perChunkJsonPrompt
SDP_contLoop --> SDP_buildIterPrompt
SDP_callText --> SDP_perChunk
%% internals mapping to AI/external
SDP_partsMap --> AiObjectsCall
SDP_chunksMap --> SubCore_readImage
SDP_chunksMap --> AiObjectsCall
SDP_mergeParts --> SubPipelineMerge
SDP_convertPartsJson --> SubPipelineMerge
SDP_mergeChunks --> SubPipelineMerge
SDP_mergeChunksClean --> SubPipelineMerge
SDP_mergeChunksJson --> SubPipelineMerge
%% SubDocumentGeneration
subgraph serviceAi subDocumentGeneration py - SubDocumentGeneration
SDG_ctor[__init__()]
SDG_callGen[callAiWithDocumentGeneration()]
SDG_procUnified[_processDocumentsUnified()]
SDG_validateUnified[_validateUnifiedResponseStructure()]
SDG_validateDoc[_validateDocumentStructure()]
SDG_buildUnified[_buildUnifiedResult()]
SDG_processDoc[_processDocument()]
SDG_callAiJson[_callAiJson()]
SDG_postRaw[_postRawDataChatMessage()]
end
SDG_callGen --> GenServicePrompt
SDG_callGen --> SDG_procUnified
SDG_procUnified --> SDP_withCont
SDG_procUnified --> SDG_validateUnified
SDG_procUnified --> SDG_postRaw
SDG_buildUnified --> SDG_processDoc
SDG_processDoc --> BuildGenPrompt
SDG_processDoc --> AiObjectsCall
SDG_processDoc --> GenServiceRender
SDG_callAiJson --> SDP_perChunkJson
%% Cross-module interactions from AiService-created submodules (contextual)
AiSvc_initSubs --> SubCore_ctor
AiSvc_initSubs --> SDP_ctor
AiSvc_initSubs --> SDG_ctor