audit trail detail
This commit is contained in:
@@ -1247,6 +1247,99 @@ class AIQueryInterface {
|
||||
};
|
||||
}
|
||||
|
||||
createSpecificSummary(data, action, type) {
|
||||
if (!data) return 'Leer';
|
||||
|
||||
// Action-specific summaries that provide meaningful information
|
||||
switch (action) {
|
||||
case 'selection-decision':
|
||||
if (type === 'input') {
|
||||
if (data.availableTools && Array.isArray(data.availableTools)) {
|
||||
const preview = data.availableTools.slice(0, 5).join(', ');
|
||||
return `${data.totalAvailable || data.availableTools.length} Tools verfügbar: ${preview}${data.availableTools.length > 5 ? '...' : ''}`;
|
||||
}
|
||||
return `${data.totalAvailable || 0} Tools verfügbar`;
|
||||
} else {
|
||||
return `Ausgewählt: ${Array.isArray(data.selectedTools) ? data.selectedTools.join(', ') : 'keine'}`;
|
||||
}
|
||||
|
||||
case 'phase-tool-selection':
|
||||
if (type === 'input') {
|
||||
if (data.availableTools && Array.isArray(data.availableTools)) {
|
||||
return `${data.availableTools.length} Tools für Phase: ${data.availableTools.slice(0, 3).join(', ')}${data.availableTools.length > 3 ? '...' : ''}`;
|
||||
}
|
||||
return `Phase: ${data.phaseName || data.phaseId || 'unbekannt'} (${data.toolCount || 0} verfügbar)`;
|
||||
} else {
|
||||
if (data.selectedTools && Array.isArray(data.selectedTools)) {
|
||||
return `Ausgewählt: ${data.selectedTools.join(', ')}`;
|
||||
}
|
||||
return `${data.selectionCount || 0} Tools ausgewählt (Ø ${data.avgTaskRelevance || 0}% Relevanz)`;
|
||||
}
|
||||
|
||||
case 'similarity-search':
|
||||
if (type === 'input') {
|
||||
return `Suche: "${data.query}" (Schwelle: ${data.threshold})`;
|
||||
} else {
|
||||
if (data.topMatches && Array.isArray(data.topMatches)) {
|
||||
return `${data.resultsCount} Treffer: ${data.topMatches.slice(0, 3).join(', ')}`;
|
||||
}
|
||||
return `${data.resultsCount || 0} Treffer gefunden`;
|
||||
}
|
||||
|
||||
case 'phase-enhancement':
|
||||
if (type === 'input') {
|
||||
return `Phase: ${data.phaseName || data.phaseId} (${data.searchStrategy || 'Standard'})`;
|
||||
} else {
|
||||
const toolsAdded = Array.isArray(data.addedTools) ? data.addedTools : [];
|
||||
return `${data.toolsAddedCount || toolsAdded.length} Tools hinzugefügt: ${toolsAdded.join(', ') || 'keine'}`;
|
||||
}
|
||||
|
||||
case 'ai-decision':
|
||||
if (type === 'input') {
|
||||
return data.prompt ? `KI-Prompt: ${data.prompt.slice(0, 100)}...` : 'KI-Analyse durchgeführt';
|
||||
} else {
|
||||
return data.response ? `KI-Antwort: ${data.response.slice(0, 100)}...` : 'Antwort erhalten';
|
||||
}
|
||||
|
||||
case 'tool-confidence':
|
||||
if (type === 'input') {
|
||||
return `Tool: ${data.toolName} (Semantik: ${data.semanticSimilarity}%, Aufgabe: ${data.taskRelevance}%)`;
|
||||
} else {
|
||||
return `Vertrauen: ${data.overallConfidence}% (Stärken: ${data.strengthIndicators?.length || 0}, Unsicherheiten: ${data.uncertaintyFactors?.length || 0})`;
|
||||
}
|
||||
|
||||
case 'tool-added-to-phase':
|
||||
if (type === 'input') {
|
||||
return `Tool: ${data.toolName} für ${data.phaseId} (${data.taskRelevance}% Relevanz, ${data.priority} Priorität)`;
|
||||
} else {
|
||||
const justificationPreview = data.justification ? data.justification.slice(0, 80) + '...' : 'Keine Begründung';
|
||||
return `Begründung: ${justificationPreview}`;
|
||||
}
|
||||
|
||||
case 'concept-selection':
|
||||
if (type === 'input') {
|
||||
const availableCount = Array.isArray(data.availableConcepts) ? data.availableConcepts.length : 0;
|
||||
return `${availableCount} Konzepte verfügbar für methodische Fundierung`;
|
||||
} else {
|
||||
const selectedConcepts = Array.isArray(data.selectedConcepts) ? data.selectedConcepts : [];
|
||||
return `${selectedConcepts.length} ausgewählt: ${selectedConcepts.slice(0, 3).join(', ')}${selectedConcepts.length > 3 ? '...' : ''}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to generic handling for other actions
|
||||
if (typeof data === 'string') {
|
||||
return data.length > 100 ? data.slice(0, 100) + '...' : data;
|
||||
}
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
if (data.length === 0) return 'Leeres Array';
|
||||
if (data.length <= 3) return data.join(', ');
|
||||
return `${data.slice(0, 3).join(', ')} und ${data.length - 3} weitere`;
|
||||
}
|
||||
|
||||
return `${Object.keys(data).length} Eigenschaften`;
|
||||
}
|
||||
|
||||
renderPhaseGroups(auditTrail, stats) {
|
||||
const phaseGroups = new Map();
|
||||
|
||||
@@ -1350,27 +1443,27 @@ class AIQueryInterface {
|
||||
const output = entry.output || {};
|
||||
const metadata = entry.metadata || {};
|
||||
|
||||
// Show input summary
|
||||
if (metadata.inputSummary && metadata.inputSummary !== 'Empty') {
|
||||
// Show input summary with action-specific formatting
|
||||
if (metadata.inputSummary && metadata.inputSummary !== 'Leer') {
|
||||
details.push(`<div class="detail-item"><strong>Eingabe:</strong> ${escapeHtml(metadata.inputSummary)}</div>`);
|
||||
}
|
||||
|
||||
// Show output summary
|
||||
if (metadata.outputSummary && metadata.outputSummary !== 'Empty') {
|
||||
// Show output summary with action-specific formatting
|
||||
if (metadata.outputSummary && metadata.outputSummary !== 'Leer') {
|
||||
details.push(`<div class="detail-item"><strong>Ausgabe:</strong> ${escapeHtml(metadata.outputSummary)}</div>`);
|
||||
}
|
||||
|
||||
// Show reasoning
|
||||
if (metadata.reasoning) {
|
||||
// Show reasoning - this is now meaningful, not generic
|
||||
if (metadata.reasoning && !metadata.reasoning.includes('completed with')) {
|
||||
details.push(`<div class="detail-item"><strong>Begründung:</strong> ${escapeHtml(metadata.reasoning)}</div>`);
|
||||
}
|
||||
|
||||
// Show specific details based on action type
|
||||
if (entry.action === 'similarity-search' && metadata.similarityScores) {
|
||||
const topScores = Object.entries(metadata.similarityScores)
|
||||
.sort(([,a], [,b]) => b - a)
|
||||
.sort(([,a], [,b]) => (b) - (a))
|
||||
.slice(0, 3)
|
||||
.map(([name, score]) => `${name} (${(score * 100).toFixed(1)}%)`)
|
||||
.map(([name, score]) => `${name} (${((score) * 100).toFixed(1)}%)`)
|
||||
.join(', ');
|
||||
if (topScores) {
|
||||
details.push(`<div class="detail-item"><strong>Top Treffer:</strong> ${topScores}</div>`);
|
||||
@@ -1386,18 +1479,28 @@ class AIQueryInterface {
|
||||
|
||||
if (entry.action === 'selection-decision' && metadata.selectionMethod) {
|
||||
details.push(`<div class="detail-item"><strong>Auswahlmethode:</strong> ${metadata.selectionMethod}</div>`);
|
||||
if (metadata.reductionRatio) {
|
||||
details.push(`<div class="detail-item"><strong>Reduktion:</strong> ${(metadata.reductionRatio * 100).toFixed(1)}% der verfügbaren Tools</div>`);
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.action === 'tool-confidence') {
|
||||
const confidence = entry.output || {};
|
||||
if (confidence.strengthIndicators?.length > 0) {
|
||||
if (confidence.strengthIndicators && confidence.strengthIndicators.length > 0) {
|
||||
details.push(`<div class="detail-item"><strong>Stärken:</strong> ${confidence.strengthIndicators.slice(0, 2).join(', ')}</div>`);
|
||||
}
|
||||
if (confidence.uncertaintyFactors?.length > 0) {
|
||||
if (confidence.uncertaintyFactors && confidence.uncertaintyFactors.length > 0) {
|
||||
details.push(`<div class="detail-item"><strong>Unsicherheiten:</strong> ${confidence.uncertaintyFactors.slice(0, 2).join(', ')}</div>`);
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.action === 'phase-tool-selection') {
|
||||
if (metadata.availableToolsCount && metadata.selectedToolsCount) {
|
||||
const ratio = (metadata.selectedToolsCount / metadata.availableToolsCount * 100).toFixed(1);
|
||||
details.push(`<div class="detail-item"><strong>Auswahlrate:</strong> ${ratio}% der verfügbaren Phase-Tools</div>`);
|
||||
}
|
||||
}
|
||||
|
||||
if (details.length === 0) return '';
|
||||
|
||||
return `
|
||||
@@ -1433,19 +1536,34 @@ class AIQueryInterface {
|
||||
return `Semantische Suche: ${entry.output?.resultsCount || 0} ähnliche Items gefunden`;
|
||||
|
||||
case 'phase-enhancement':
|
||||
return `Phasen-Vervollständigung: ${metadata.toolsAddedCount || 0} Tools für ${metadata.phaseId} hinzugefügt`;
|
||||
const actualCount = entry.output?.toolsAddedCount || metadata.toolsAdded?.length || 0;
|
||||
const phaseName = entry.input?.phaseName || metadata.phaseId || 'unbekannte Phase';
|
||||
return `Phasen-Vervollständigung: ${actualCount} Tools für ${phaseName} hinzugefügt`;
|
||||
|
||||
case 'tool-confidence':
|
||||
return `Vertrauenswertung: ${entry.input?.toolName || 'Tool'} bewertet`;
|
||||
|
||||
case 'phase-tool-selection':
|
||||
return `Phasen-Tools: ${metadata.selectedToolsCount || 0} Tools für ${metadata.phaseId} ausgewählt`;
|
||||
const phaseId = metadata.phaseId || entry.input?.phaseId;
|
||||
const phasesToDisplay = {
|
||||
'preparation': 'Vorbereitung',
|
||||
'acquisition': 'Datensammlung',
|
||||
'examination': 'Untersuchung',
|
||||
'analysis': 'Analyse',
|
||||
'reporting': 'Dokumentation',
|
||||
'presentation': 'Präsentation'
|
||||
};
|
||||
const displayPhase = phasesToDisplay[phaseId] || phaseId || 'Phase';
|
||||
return `${displayPhase}: ${metadata.selectedToolsCount || 0} Tools ausgewählt`;
|
||||
|
||||
case 'pipeline-start':
|
||||
return `Analyse gestartet (${entry.input?.mode || 'unknown'} Modus)`;
|
||||
case 'tool-added-to-phase':
|
||||
const toolName = entry.input?.toolName || 'Tool';
|
||||
const phase = entry.input?.phaseId || 'Phase';
|
||||
const priority = entry.input?.priority || metadata.priority || 'medium';
|
||||
return `${toolName} als ${priority}-Priorität für ${phase} ausgewählt`;
|
||||
|
||||
case 'pipeline-end':
|
||||
return `Analyse abgeschlossen (${entry.input?.completedTasks || 0} erfolgreich, ${entry.input?.failedTasks || 0} fehlgeschlagen)`;
|
||||
case 'concept-selection':
|
||||
return `Hintergrundwissen: ${metadata.selectedConceptsCount || 0} Konzepte ausgewählt`;
|
||||
|
||||
default:
|
||||
return this.getActionDisplayName(action);
|
||||
@@ -1486,43 +1604,42 @@ class AIQueryInterface {
|
||||
`;
|
||||
}
|
||||
|
||||
getPhaseIcon(phase) {
|
||||
const icons = {
|
||||
'initialization': '🚀',
|
||||
'tool-selection': '🔧',
|
||||
'contextual-analysis': '🧠',
|
||||
'workflow-phase': '⚡',
|
||||
'tool-reasoning': '💭',
|
||||
'knowledge-synthesis': '📚',
|
||||
'confidence-scoring': '📊',
|
||||
'phase-completion': '✅',
|
||||
'completion': '🎯',
|
||||
'embeddings': '🔍',
|
||||
'unknown': '❓'
|
||||
};
|
||||
return icons[phase] || icons['unknown'];
|
||||
}
|
||||
|
||||
getPhaseDisplayName(phase) {
|
||||
const names = {
|
||||
'initialization': 'Initialisierung',
|
||||
'tool-selection': 'Tool-Auswahl',
|
||||
'contextual-analysis': 'Kontext-Analyse',
|
||||
'contextual-analysis': 'Kontext-Analyse',
|
||||
'workflow-phase': 'Workflow-Phase',
|
||||
'tool-reasoning': 'Tool-Bewertung',
|
||||
'tool-evaluation': 'Tool-Bewertung',
|
||||
'knowledge-synthesis': 'Wissens-Synthese',
|
||||
'confidence-scoring': 'Vertrauenswertung',
|
||||
'phase-completion': 'Phasen-Vervollständigung',
|
||||
'completion': 'Abschluss',
|
||||
'embeddings': 'Semantische Suche',
|
||||
'synthesis': 'Empfehlungs-Synthese',
|
||||
'unknown': 'Unbekannt'
|
||||
};
|
||||
return names[phase] || phase;
|
||||
}
|
||||
|
||||
getPhaseIcon(phase) {
|
||||
const icons = {
|
||||
'tool-selection': '🔧',
|
||||
'contextual-analysis': '🧠',
|
||||
'workflow-phase': '⚡',
|
||||
'tool-reasoning': '💭',
|
||||
'tool-evaluation': '💭',
|
||||
'knowledge-synthesis': '📚',
|
||||
'confidence-scoring': '📊',
|
||||
'phase-completion': '✅',
|
||||
'embeddings': '🔍',
|
||||
'synthesis': '🎯',
|
||||
'unknown': '❓'
|
||||
};
|
||||
return icons[phase] || icons['unknown'];
|
||||
}
|
||||
|
||||
getActionDisplayName(action) {
|
||||
const actions = {
|
||||
'pipeline-start': 'Analyse gestartet',
|
||||
'selection-decision': 'Tools ausgewählt',
|
||||
'ai-decision': 'KI-Entscheidung',
|
||||
'phase-tool-selection': 'Phasen-Tools evaluiert',
|
||||
@@ -1530,8 +1647,7 @@ class AIQueryInterface {
|
||||
'concept-selection': 'Konzepte ausgewählt',
|
||||
'tool-confidence': 'Vertrauen berechnet',
|
||||
'phase-enhancement': 'Phase vervollständigt',
|
||||
'similarity-search': 'Ähnlichkeitssuche',
|
||||
'pipeline-end': 'Analyse abgeschlossen'
|
||||
'similarity-search': 'Ähnlichkeitssuche'
|
||||
};
|
||||
return actions[action] || action;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user