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

View File

@ -825,11 +825,16 @@ domains:
phases: phases:
- id: data-collection - id: data-collection
name: Datensammlung name: Datensammlung
description: "Imaging, Acquisition, Remote Collection Tools"
- id: examination - id: examination
name: Auswertung name: Auswertung
description: "Parsing, Extraction, Initial Analysis Tools"
- id: analysis - id: analysis
name: Analyse name: Analyse
description: "Deep Analysis, Correlation, Visualization Tools"
- id: reporting - id: reporting
name: Bericht & Präsentation name: Bericht & Präsentation
description: "Documentation, Visualization, Presentation Tools (z.B. QGIS für Geodaten, Timeline-Tools)"
- id: collaboration-general - id: collaboration-general
name: Übergreifend & Kollaboration 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}` `- ${domain.id}: ${domain.name}`
).join('\n'); ).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. return `Du bist ein DFIR (Digital Forensics and Incident Response) Experte, der Ermittlern bei der Toolauswahl hilft.
VERFÜGBARE TOOLS DATABASE: 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. 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: TOOL-AUSWAHL NACH PHASE:
- Datensammlung: Imaging, Acquisition, Remote Collection Tools ${phaseDescriptions}
- 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)
ANTWORT-FORMAT (strict JSON): ANTWORT-FORMAT (strict JSON):
{ {
@ -140,7 +142,7 @@ ANTWORT-FORMAT (strict JSON):
{ {
"name": "EXAKTER Name aus der Database", "name": "EXAKTER Name aus der Database",
"priority": "high|medium|low", "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" "justification": "Warum dieses Tool für diese Phase und Szenario geeignet ist"
} }
], ],