createDiagnosticReport static method
Creates a diagnostic report for troubleshooting
Implementation
static DiagnosticReport createDiagnosticReport({
required Uint8List imageBytes,
required ModelType modelType,
String? processedBase64,
String? prompt,
String? response,
}) {
try {
debugPrint('MultimodalImageHandler: Creating diagnostic report...');
final format = ImageProcessor.detectFormat(imageBytes);
final sizeInKB = imageBytes.length / 1024;
final validationResult = VisionEncoderValidator.validateForEncoder(
imageBytes: imageBytes,
encoderType: _getVisionEncoderType(modelType),
originalFormat: format,
);
final report = DiagnosticReport(
timestamp: DateTime.now(),
modelType: modelType,
originalFormat: format,
originalSizeKB: sizeInKB,
validationResult: validationResult,
processedBase64Length: processedBase64?.length ?? 0,
promptLength: prompt?.length ?? 0,
responseLength: response?.length ?? 0,
hasProcessedImage: processedBase64 != null,
hasPrompt: prompt != null,
hasResponse: response != null,
);
debugPrint('MultimodalImageHandler: Diagnostic report created');
return report;
} catch (e) {
debugPrint('MultimodalImageHandler: Diagnostic report failed - $e');
rethrow;
}
}