feat(ai): enhance AI trace warnings with product context
Test Suite / backend-pr-quick (push) Has been skipped
Test Suite / quick-import-pr-quick (push) Has been skipped
Test Suite / backend-full (push) Successful in 2m31s
Test Suite / flutter-quality (push) Failing after 1m12s

- Added `productName` field to `AdminAiWarning` to include product context in warnings
- Updated `collectWarnings` to extract and include `rawName` as `productName` in AI trace warnings
- Added `signals` field to `FlyerParseItem` type for detailed product signals
- Enhanced Flutter admin panel to display product names in AI trace warnings
- Added new `AdminAiTraceResponse` DTO for AI trace data structure
This commit is contained in:
Nils-Johan Gynther
2026-05-24 20:55:14 +02:00
parent 7713eb2fa7
commit ca1eed5061
5 changed files with 117 additions and 93 deletions
@@ -8,6 +8,7 @@ class AdminAiWarning {
final String severity;
final String? location;
final int? itemIndex;
final String? productName;
const AdminAiWarning({
required this.code,
@@ -17,6 +18,7 @@ class AdminAiWarning {
required this.severity,
required this.location,
required this.itemIndex,
required this.productName,
});
factory AdminAiWarning.fromJson(Map<String, dynamic> json) {
@@ -28,6 +30,7 @@ class AdminAiWarning {
severity: (json['severity'] ?? '').toString(),
location: json['location']?.toString(),
itemIndex: (json['itemIndex'] as num?)?.toInt(),
productName: json['productName']?.toString(),
);
}
@@ -44,6 +47,7 @@ class AdminAiWarning {
severity: 'warning',
location: null,
itemIndex: null,
productName: null,
);
}
}
@@ -139,7 +139,8 @@ class _AdminAiPanelState extends ConsumerState<AdminAiPanel> {
String _formatWarningLine(AdminAiWarning warning) {
final rowSuffix = warning.itemIndex == null ? '' : ' (rad ${warning.itemIndex})';
return '[${warning.severity}] ${warning.title}$rowSuffix: ${warning.message}';
final productSuffix = warning.productName != null ? ' (${warning.productName})' : '';
return '[${warning.severity}] ${warning.title}$rowSuffix$productSuffix: ${warning.message}';
}
String _buildErrorReport({
@@ -685,11 +686,16 @@ class _WarningsCard extends StatelessWidget {
warning.location!,
style: theme.textTheme.bodySmall,
),
if (warning.itemIndex != null)
Text(
'Rad: ${warning.itemIndex}',
style: theme.textTheme.bodySmall,
),
if (warning.itemIndex != null)
Text(
'Rad: ${warning.itemIndex}',
style: theme.textTheme.bodySmall,
),
if (warning.productName != null)
Text(
'Produkt: ${warning.productName}',
style: theme.textTheme.bodySmall,
),
],
),
trailing: IconButton(