forensic-ai #4

Merged
mstoeck3 merged 20 commits from forensic-ai into main 2025-08-05 20:56:02 +00:00
3 changed files with 15 additions and 19 deletions
Showing only changes of commit 769c223d39 - Show all commits

View File

@ -741,7 +741,7 @@ class AIQueryInterface {
displayToolResults(recommendation, originalQuery) { displayToolResults(recommendation, originalQuery) {
const html = ` const html = `
<div class="tool-results-container"> <div class="workflow-container">
${this.renderHeader('Handlungsempfehlung', originalQuery)} ${this.renderHeader('Handlungsempfehlung', originalQuery)}
${this.renderContextualAnalysis(recommendation, 'tool')} ${this.renderContextualAnalysis(recommendation, 'tool')}
${this.renderBackgroundKnowledge(recommendation.background_knowledge)} ${this.renderBackgroundKnowledge(recommendation.background_knowledge)}

View File

@ -169,11 +169,14 @@ Antworten Sie AUSSCHLIESSLICH mit diesem JSON-Format:
"detailed_explanation": "Detaillierte Erklärung warum und wie dieses Tool für diese spezifische Aufgabe eingesetzt wird", "detailed_explanation": "Detaillierte Erklärung warum und wie dieses Tool für diese spezifische Aufgabe eingesetzt wird",
"implementation_approach": "Konkrete Schritt-für-Schritt Anleitung zur korrekten Anwendung", "implementation_approach": "Konkrete Schritt-für-Schritt Anleitung zur korrekten Anwendung",
"pros": ["Spezifischer Vorteil 1", "Spezifischer Vorteil 2"], "pros": ["Spezifischer Vorteil 1", "Spezifischer Vorteil 2"],
"cons": ["Bekannte Limitation 1", "Bekannte Limitation 2"], "limitations": ["Spezifische Einschränkung 1", "Spezifische Einschränkung 2"],
"alternatives": "Alternative Ansätze oder Tools falls dieses nicht verfügbar ist" "alternatives": "Alternative Ansätze oder Tools falls dieses nicht verfügbar ist"
} }
WICHTIG: Keine erneute Bewertung - nur detaillierte Erklärung der bereits bewerteten Eignung.`; WICHTIG:
- Keine erneute Bewertung - nur detaillierte Erklärung der bereits bewerteten Eignung
- "limitations" soll spezifische technische/methodische Einschränkungen des Tools auflisten
- "pros" soll die Stärken für diese spezifische Aufgabe hervorheben`;
}, },
// Background knowledge selection prompt // Background knowledge selection prompt

View File

@ -776,11 +776,6 @@ ${JSON.stringify(conceptsToSend, null, 2)}`;
factors.push('Einsteiger-Tool für komplexe Analyse - könnte funktionale Limitierungen haben'); factors.push('Einsteiger-Tool für komplexe Analyse - könnte funktionale Limitierungen haben');
} }
// Platform availability concerns
if (tool.platforms && tool.platforms.length === 1 && tool.platforms[0] === 'Windows' && /linux|unix|server/i.test(context.userQuery)) {
factors.push('Nur Windows-Tool bei möglicher Linux/Server-Umgebung - Plattform-Inkompatibilität');
}
// Access and deployment concerns // Access and deployment concerns
if (tool.type === 'software' && !isToolHosted(tool) && tool.accessType === 'download') { if (tool.type === 'software' && !isToolHosted(tool) && tool.accessType === 'download') {
factors.push('Installation und Setup erforderlich'); factors.push('Installation und Setup erforderlich');
@ -939,7 +934,6 @@ ${JSON.stringify(conceptsToSend, null, 2)}`;
} }
private async evaluateSpecificTool(context: AnalysisContext, tool: any, rank: number): Promise<MicroTaskResult> { private async evaluateSpecificTool(context: AnalysisContext, tool: any, rank: number): Promise<MicroTaskResult> {
// Get existing task relevance from previous phase selection
const existingSelection = context.selectedTools?.find(st => st.tool.name === tool.name); const existingSelection = context.selectedTools?.find(st => st.tool.name === tool.name);
const taskRelevance = existingSelection?.taskRelevance || 70; const taskRelevance = existingSelection?.taskRelevance || 70;
const priority = this.derivePriorityFromScore(taskRelevance); const priority = this.derivePriorityFromScore(taskRelevance);
@ -953,11 +947,10 @@ ${JSON.stringify(conceptsToSend, null, 2)}`;
detailed_explanation: 'Evaluation failed', detailed_explanation: 'Evaluation failed',
implementation_approach: '', implementation_approach: '',
pros: [], pros: [],
cons: [], limitations: [],
alternatives: '' alternatives: ''
}); });
// Store evaluation without re-scoring
this.addToolToSelection(context, { this.addToolToSelection(context, {
...tool, ...tool,
evaluation: { evaluation: {
@ -966,7 +959,7 @@ ${JSON.stringify(conceptsToSend, null, 2)}`;
task_relevance: taskRelevance task_relevance: taskRelevance
} }
}, 'evaluation', priority, evaluation.detailed_explanation, }, 'evaluation', priority, evaluation.detailed_explanation,
taskRelevance, existingSelection?.limitations); taskRelevance, evaluation.limitations);
this.addAuditEntry(context, 'micro-task', 'tool-evaluation', this.addAuditEntry(context, 'micro-task', 'tool-evaluation',
{ toolName: tool.name, rank, existingTaskRelevance: taskRelevance, derivedPriority: priority }, { toolName: tool.name, rank, existingTaskRelevance: taskRelevance, derivedPriority: priority },
@ -974,11 +967,12 @@ ${JSON.stringify(conceptsToSend, null, 2)}`;
hasExplanation: !!evaluation.detailed_explanation, hasExplanation: !!evaluation.detailed_explanation,
hasImplementationApproach: !!evaluation.implementation_approach, hasImplementationApproach: !!evaluation.implementation_approach,
prosCount: evaluation.pros?.length || 0, prosCount: evaluation.pros?.length || 0,
consCount: evaluation.cons?.length || 0 limitationsCount: evaluation.limitations?.length || 0, // ← Updated field name
hasLimitations: Array.isArray(evaluation.limitations) && evaluation.limitations.length > 0
}, },
70, 70,
Date.now() - result.processingTimeMs, Date.now() - result.processingTimeMs,
{ toolType: tool.type, explanationOnly: true, priorityDerived: true } { toolType: tool.type, explanationOnly: true, priorityDerived: true, limitationsExtracted: true }
); );
} }
@ -1226,7 +1220,6 @@ ${JSON.stringify(conceptsToSend, null, 2)}`;
if (isWorkflow) { if (isWorkflow) {
const recommendedToolsWithConfidence = context.selectedTools?.map(st => { const recommendedToolsWithConfidence = context.selectedTools?.map(st => {
// Calculate enhanced confidence for each tool
const confidence = this.calculateRecommendationConfidence( const confidence = this.calculateRecommendationConfidence(
st.tool, st.tool,
context, context,
@ -1234,7 +1227,6 @@ ${JSON.stringify(conceptsToSend, null, 2)}`;
st.limitations || [] st.limitations || []
); );
// Add audit entry for confidence calculation
this.addAuditEntry(context, 'validation', 'confidence-scoring', this.addAuditEntry(context, 'validation', 'confidence-scoring',
{ toolName: st.tool.name, phase: st.phase }, { toolName: st.tool.name, phase: st.phase },
{ {
@ -1272,14 +1264,15 @@ ${JSON.stringify(conceptsToSend, null, 2)}`;
st.tool, st.tool,
context, context,
st.taskRelevance || 70, st.taskRelevance || 70,
st.limitations || [] st.limitations || []
); );
this.addAuditEntry(context, 'validation', 'confidence-scoring', this.addAuditEntry(context, 'validation', 'confidence-scoring',
{ toolName: st.tool.name, rank: st.tool.evaluation?.rank || 1 }, { toolName: st.tool.name, rank: st.tool.evaluation?.rank || 1 },
{ {
overall: confidence.overall, overall: confidence.overall,
suitabilityAlignment: st.priority === 'high' && confidence.overall >= this.confidenceConfig.highThreshold suitabilityAlignment: st.priority === 'high' && confidence.overall >= this.confidenceConfig.highThreshold,
limitationsUsed: st.limitations?.length || 0
}, },
confidence.overall, confidence.overall,
Date.now(), Date.now(),
@ -1293,7 +1286,7 @@ ${JSON.stringify(conceptsToSend, null, 2)}`;
detailed_explanation: st.tool.evaluation?.detailed_explanation || '', detailed_explanation: st.tool.evaluation?.detailed_explanation || '',
implementation_approach: st.tool.evaluation?.implementation_approach || '', implementation_approach: st.tool.evaluation?.implementation_approach || '',
pros: st.tool.evaluation?.pros || [], pros: st.tool.evaluation?.pros || [],
cons: st.tool.evaluation?.cons || [], cons: st.tool.evaluation?.limitations || [], // ← FIXED: Use limitations as cons for display
alternatives: st.tool.evaluation?.alternatives || '', alternatives: st.tool.evaluation?.alternatives || '',
confidence: confidence, confidence: confidence,
recommendationStrength: confidence.overall >= this.confidenceConfig.highThreshold ? 'strong' : recommendationStrength: confidence.overall >= this.confidenceConfig.highThreshold ? 'strong' :