dynamic yaml loading part 1

This commit is contained in:
overcuriousity 2025-07-18 14:30:58 +02:00
parent d6e1023e40
commit 69819eba7d
3 changed files with 22 additions and 14 deletions

View File

@ -8,6 +8,7 @@ const yamlPath = path.join(process.cwd(), 'src/data/tools.yaml');
const yamlContent = await fs.readFile(yamlPath, 'utf8');
const data = load(yamlContent) as any;
const tools = data.tools;
const phases = data.phases;
---
<!-- AI Query Interface -->
@ -87,7 +88,7 @@ const tools = data.tools;
</div>
</section>
<script define:vars={{ tools }}>
<script define:vars={{ tools, phases }}>
document.addEventListener('DOMContentLoaded', () => {
const aiInterface = document.getElementById('ai-interface');
const aiInput = document.getElementById('ai-query-input');
@ -278,13 +279,13 @@ document.addEventListener('DOMContentLoaded', () => {
function displayResults(recommendation, originalQuery) {
// Group tools by phase
const toolsByPhase = {};
const phaseOrder = ['data-collection', 'examination', 'analysis', 'reporting'];
const phaseNames = {
'data-collection': 'Datensammlung',
'examination': 'Auswertung',
'analysis': 'Analyse',
'reporting': 'Bericht & Präsentation'
};
// Replace hardcoded values with dynamic data from YAML
const phaseOrder = phases.filter(phase => phase.id !== 'collaboration-general').map(phase => phase.id);
const phaseNames = phases.reduce((acc, phase) => {
acc[phase.id] = phase.name;
return acc;
}, {});
// Initialize phases
phaseOrder.forEach(phase => {

View File

@ -825,11 +825,16 @@ domains:
phases:
- id: data-collection
name: Datensammlung
description: "Imaging, Acquisition, Remote Collection Tools"
- id: examination
name: Auswertung
description: "Parsing, Extraction, Initial Analysis Tools"
- id: analysis
name: Analyse
description: "Deep Analysis, Correlation, Visualization Tools"
- id: reporting
name: Bericht & Präsentation
description: "Documentation, Visualization, Presentation Tools (z.B. QGIS für Geodaten, Timeline-Tools)"
- id: collaboration-general
name: Übergreifend & Kollaboration
description: "Cross-cutting tools and collaboration platforms"

View File

@ -107,6 +107,11 @@ function createSystemPrompt(toolsData: any): string {
`- ${domain.id}: ${domain.name}`
).join('\n');
const phaseDescriptions = toolsData.phases
.filter((phase: any) => phase.id !== 'collaboration-general')
.map((phase: any) => `- ${phase.name}: ${phase.description || 'Tools for this phase'}`)
.join('\n');
return `Du bist ein DFIR (Digital Forensics and Incident Response) Experte, der Ermittlern bei der Toolauswahl hilft.
VERFÜGBARE TOOLS DATABASE:
@ -128,10 +133,7 @@ WICHTIGE REGELN:
7. Bewerbe NIEMALS Proprietäre Software fälschlicherweise als Open-Source-Tools, erkenne aber an, falls diese besser geeignet sein könnte.
TOOL-AUSWAHL NACH PHASE:
- Datensammlung: Imaging, Acquisition, Remote Collection Tools
- Auswertung: Parsing, Extraction, Initial Analysis Tools
- Analyse: Deep Analysis, Correlation, Visualization Tools
- Berichterstattung: Documentation, Visualization, Presentation Tools (z.B. QGIS für Geodaten, Timeline-Tools)
${phaseDescriptions}
ANTWORT-FORMAT (strict JSON):
{
@ -140,7 +142,7 @@ ANTWORT-FORMAT (strict JSON):
{
"name": "EXAKTER Name aus der Database",
"priority": "high|medium|low",
"phase": "data-collection|examination|analysis|reporting",
"phase": "${toolsData.phases.filter((p: any) => p.id !== 'collaboration-general').map((p: any) => p.id).join('|')}",
"justification": "Warum dieses Tool für diese Phase und Szenario geeignet ist"
}
],