update audit trail detail level
This commit is contained in:
parent
c60730b4aa
commit
170638a5fa
@ -979,7 +979,7 @@ class AIQueryInterface {
|
|||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="text-align: right; margin: 0.5rem 0 1rem 0;">
|
<div style="margin: 0.5rem 0 1rem 0;">
|
||||||
<button id="download-results-btn" class="btn btn-secondary">
|
<button id="download-results-btn" class="btn btn-secondary">
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right: 0.5rem;">
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right: 0.5rem;">
|
||||||
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
||||||
@ -1010,19 +1010,27 @@ class AIQueryInterface {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insights-section">
|
<div class="insights-section">
|
||||||
${stats.qualityMetrics.aiTransparency >= 80 ? `
|
${stats.keyInsights && stats.keyInsights.length > 0 ? `
|
||||||
<div class="insights-header success">✅ Hohe Transparenz</div>
|
<div class="insights-header success">✅ Erkenntnisse</div>
|
||||||
|
<ul class="insights-list">
|
||||||
|
${stats.keyInsights.map(insight => `<li>${insight}</li>`).join('')}
|
||||||
|
</ul>
|
||||||
|
` : ''}
|
||||||
|
|
||||||
|
${stats.potentialIssues && stats.potentialIssues.length > 0 ? `
|
||||||
|
<div class="insights-header warning">⚠️ Hinweise</div>
|
||||||
|
<ul class="insights-list">
|
||||||
|
${stats.potentialIssues.map(issue => `<li>${issue}</li>`).join('')}
|
||||||
|
</ul>
|
||||||
|
` : ''}
|
||||||
|
|
||||||
|
${(!stats.keyInsights || stats.keyInsights.length === 0) && (!stats.potentialIssues || stats.potentialIssues.length === 0) ? `
|
||||||
|
<div class="insights-header">📊 Analyse-Details</div>
|
||||||
<ul class="insights-list">
|
<ul class="insights-list">
|
||||||
<li>${stats.qualityMetrics.aiTransparency}% der Entscheidungen mit nachvollziehbarer Begründung</li>
|
<li>${stats.qualityMetrics.aiTransparency}% der Entscheidungen mit nachvollziehbarer Begründung</li>
|
||||||
<li>Durchschnittliche Verarbeitungszeit: ${formatDuration(stats.qualityMetrics.avgProcessingTime)}</li>
|
<li>Analysequalität: ${this.getQualityDisplayText(stats.analysisQuality)}</li>
|
||||||
</ul>
|
</ul>
|
||||||
` : `
|
` : ''}
|
||||||
<div class="insights-header warning">⚠️ Transparenz-Hinweise</div>
|
|
||||||
<ul class="insights-list">
|
|
||||||
<li>Nur ${stats.qualityMetrics.aiTransparency}% der Entscheidungen vollständig dokumentiert</li>
|
|
||||||
<li>Einige KI-Entscheidungen ohne detaillierte Begründung</li>
|
|
||||||
</ul>
|
|
||||||
`}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -1068,6 +1076,17 @@ class AIQueryInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getQualityDisplayText(analysisQuality) {
|
||||||
|
const qualityMap = {
|
||||||
|
'excellent': 'Ausgezeichnet',
|
||||||
|
'good': 'Gut',
|
||||||
|
'fair': 'Zufriedenstellend',
|
||||||
|
'poor': 'Verbesserungswürdig',
|
||||||
|
'unknown': 'Unbekannt'
|
||||||
|
};
|
||||||
|
return qualityMap[analysisQuality] || 'Unbekannt';
|
||||||
|
}
|
||||||
|
|
||||||
setupUnifiedUploadSystem() {
|
setupUnifiedUploadSystem() {
|
||||||
const previousUploadInput = document.getElementById('upload-previous-analysis');
|
const previousUploadInput = document.getElementById('upload-previous-analysis');
|
||||||
if (previousUploadInput) {
|
if (previousUploadInput) {
|
||||||
@ -1113,13 +1132,20 @@ class AIQueryInterface {
|
|||||||
totalTime: 0,
|
totalTime: 0,
|
||||||
avgConfidence: 0,
|
avgConfidence: 0,
|
||||||
stepCount: 0,
|
stepCount: 0,
|
||||||
|
highConfidenceSteps: 0,
|
||||||
|
lowConfidenceSteps: 0,
|
||||||
|
phaseBreakdown: {},
|
||||||
aiDecisionCount: 0,
|
aiDecisionCount: 0,
|
||||||
embeddingsUsageCount: 0,
|
embeddingsUsageCount: 0,
|
||||||
toolSelectionCount: 0,
|
toolSelectionCount: 0,
|
||||||
qualityMetrics: {
|
qualityMetrics: {
|
||||||
avgProcessingTime: 0,
|
avgProcessingTime: 0,
|
||||||
|
confidenceDistribution: { high: 0, medium: 0, low: 0 },
|
||||||
aiTransparency: 0
|
aiTransparency: 0
|
||||||
}
|
},
|
||||||
|
analysisQuality: 'unknown',
|
||||||
|
keyInsights: [],
|
||||||
|
potentialIssues: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1129,25 +1155,115 @@ class AIQueryInterface {
|
|||||||
? Math.round(validConfidenceEntries.reduce((sum, entry) => sum + entry.confidence, 0) / validConfidenceEntries.length)
|
? Math.round(validConfidenceEntries.reduce((sum, entry) => sum + entry.confidence, 0) / validConfidenceEntries.length)
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
|
const highConfidenceSteps = auditTrail.filter(entry => (entry.confidence || 0) >= 80).length;
|
||||||
|
const lowConfidenceSteps = auditTrail.filter(entry => (entry.confidence || 0) < 60).length;
|
||||||
|
const mediumConfidenceSteps = auditTrail.length - highConfidenceSteps - lowConfidenceSteps;
|
||||||
|
|
||||||
|
// Enhanced metrics
|
||||||
const aiDecisionCount = auditTrail.filter(entry => entry.action === 'ai-decision').length;
|
const aiDecisionCount = auditTrail.filter(entry => entry.action === 'ai-decision').length;
|
||||||
const embeddingsUsageCount = auditTrail.filter(entry => entry.metadata?.embeddingsUsed).length;
|
const embeddingsUsageCount = auditTrail.filter(entry => entry.metadata?.embeddingsUsed).length;
|
||||||
const toolSelectionCount = auditTrail.filter(entry => entry.action === 'selection-decision').length;
|
const toolSelectionCount = auditTrail.filter(entry => entry.action === 'selection-decision').length;
|
||||||
|
|
||||||
|
// Phase breakdown
|
||||||
|
const phaseBreakdown = {};
|
||||||
|
auditTrail.forEach(entry => {
|
||||||
|
const phase = entry.phase || 'unknown';
|
||||||
|
if (!phaseBreakdown[phase]) {
|
||||||
|
phaseBreakdown[phase] = { count: 0, avgConfidence: 0, totalTime: 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
phaseBreakdown[phase].count++;
|
||||||
|
phaseBreakdown[phase].totalTime += entry.processingTimeMs || 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Calculate average confidence per phase
|
||||||
|
Object.keys(phaseBreakdown).forEach(phase => {
|
||||||
|
const phaseEntries = auditTrail.filter(entry => entry.phase === phase);
|
||||||
|
const validEntries = phaseEntries.filter(entry => typeof entry.confidence === 'number');
|
||||||
|
|
||||||
|
if (validEntries.length > 0) {
|
||||||
|
phaseBreakdown[phase].avgConfidence = Math.round(
|
||||||
|
validEntries.reduce((sum, entry) => sum + entry.confidence, 0) / validEntries.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const avgProcessingTime = auditTrail.length > 0 ? totalTime / auditTrail.length : 0;
|
const avgProcessingTime = auditTrail.length > 0 ? totalTime / auditTrail.length : 0;
|
||||||
const aiTransparency = auditTrail.length > 0 ?
|
const aiTransparency = auditTrail.length > 0 ?
|
||||||
(auditTrail.filter(entry => entry.metadata?.aiPrompt || entry.metadata?.reasoning).length / auditTrail.length) * 100 : 0;
|
(auditTrail.filter(entry => entry.metadata?.aiPrompt || entry.metadata?.reasoning).length / auditTrail.length) * 100 : 0;
|
||||||
|
|
||||||
|
// RESTORED: Intelligent Analysis Quality Assessment
|
||||||
|
let analysisQuality;
|
||||||
|
if (avgConfidence >= 85 && lowConfidenceSteps === 0) {
|
||||||
|
analysisQuality = 'excellent';
|
||||||
|
} else if (avgConfidence >= 70 && lowConfidenceSteps <= 1) {
|
||||||
|
analysisQuality = 'good';
|
||||||
|
} else if (avgConfidence >= 60 && lowConfidenceSteps <= 3) {
|
||||||
|
analysisQuality = 'fair';
|
||||||
|
} else {
|
||||||
|
analysisQuality = 'poor';
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTORED: Intelligent Insights Generation
|
||||||
|
const keyInsights = [];
|
||||||
|
const embeddingsUsed = auditTrail.some(e => e.metadata?.embeddingsUsed);
|
||||||
|
if (embeddingsUsed) {
|
||||||
|
keyInsights.push('Semantische Suche wurde erfolgreich eingesetzt');
|
||||||
|
}
|
||||||
|
|
||||||
|
const toolSelectionEntries = auditTrail.filter(e => e.action === 'selection-decision');
|
||||||
|
if (toolSelectionEntries.length > 0) {
|
||||||
|
const avgSelectionConfidence = toolSelectionEntries.reduce((sum, e) => sum + (e.confidence || 0), 0) / toolSelectionEntries.length;
|
||||||
|
if (avgSelectionConfidence >= 80) {
|
||||||
|
keyInsights.push('Hohe Konfidenz bei der Tool-Auswahl');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aiTransparency >= 90) {
|
||||||
|
keyInsights.push('Sehr hohe Transparenz der KI-Entscheidungen');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (highConfidenceSteps > auditTrail.length * 0.7) {
|
||||||
|
keyInsights.push('Mehrheit der Analyseschritte mit hoher Sicherheit');
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTORED: Automatic Issue Detection (excluding processing time warnings)
|
||||||
|
const potentialIssues = [];
|
||||||
|
if (lowConfidenceSteps > 2) {
|
||||||
|
potentialIssues.push(`${lowConfidenceSteps} Analyseschritte mit niedriger Konfidenz`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aiTransparency < 50) {
|
||||||
|
potentialIssues.push('Geringe Transparenz der KI-Entscheidungsfindung');
|
||||||
|
}
|
||||||
|
|
||||||
|
const failedAiDecisions = auditTrail.filter(e => e.action === 'ai-decision' && e.confidence < 50).length;
|
||||||
|
if (failedAiDecisions > 0) {
|
||||||
|
potentialIssues.push(`${failedAiDecisions} KI-Entscheidungen mit sehr niedriger Konfidenz`);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
totalTime,
|
totalTime,
|
||||||
avgConfidence,
|
avgConfidence,
|
||||||
stepCount: auditTrail.length,
|
stepCount: auditTrail.length,
|
||||||
|
highConfidenceSteps,
|
||||||
|
lowConfidenceSteps,
|
||||||
|
phaseBreakdown,
|
||||||
aiDecisionCount,
|
aiDecisionCount,
|
||||||
embeddingsUsageCount,
|
embeddingsUsageCount,
|
||||||
toolSelectionCount,
|
toolSelectionCount,
|
||||||
qualityMetrics: {
|
qualityMetrics: {
|
||||||
avgProcessingTime,
|
avgProcessingTime,
|
||||||
|
confidenceDistribution: {
|
||||||
|
high: highConfidenceSteps,
|
||||||
|
medium: mediumConfidenceSteps,
|
||||||
|
low: lowConfidenceSteps
|
||||||
|
},
|
||||||
aiTransparency: Math.round(aiTransparency)
|
aiTransparency: Math.round(aiTransparency)
|
||||||
}
|
},
|
||||||
|
analysisQuality,
|
||||||
|
keyInsights,
|
||||||
|
potentialIssues
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user