enhance prompts
This commit is contained in:
		
							parent
							
								
									b14ca1d243
								
							
						
					
					
						commit
						b17458d153
					
				@ -1,77 +1,88 @@
 | 
				
			|||||||
// src/config/prompts.ts
 | 
					// src/config/prompts.ts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const AI_PROMPTS = {
 | 
					const RELEVANCE_RUBRIC = `
 | 
				
			||||||
 | 
					TASK RELEVANCE (INTEGER 0–100, NO %):
 | 
				
			||||||
 | 
					- 55–65 = Basis/ok
 | 
				
			||||||
 | 
					- 66–75 = Gut geeignet
 | 
				
			||||||
 | 
					- 76–85 = Sehr gut geeignet
 | 
				
			||||||
 | 
					- >85   = Nur bei nahezu perfekter Übereinstimmung
 | 
				
			||||||
 | 
					`.trim();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const STRICTNESS = `
 | 
				
			||||||
 | 
					STRICTNESS:
 | 
				
			||||||
 | 
					- Output MUST be pure JSON (no prose, no code fences, no trailing commas).
 | 
				
			||||||
 | 
					- Use EXACT item names as provided (casing/spelling must match).
 | 
				
			||||||
 | 
					- Do NOT invent items or fields. If unsure, select fewer.
 | 
				
			||||||
 | 
					`.trim();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const AI_PROMPTS = {
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					  // Tool/Concept selection (AI pre-pick from embedding-curated set)
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
  toolSelection: (mode: string, userQuery: string, maxSelectedItems: number) => {
 | 
					  toolSelection: (mode: string, userQuery: string, maxSelectedItems: number) => {
 | 
				
			||||||
    const modeInstruction =
 | 
					    const modeInstruction =
 | 
				
			||||||
      mode === 'workflow'
 | 
					      mode === 'workflow'
 | 
				
			||||||
        ? 'Workflow mit 15–25 Items über alle Phasen. PFLICHT: Mindestens 40% Methoden, Rest Tools/Konzepte.'
 | 
					        ? 'Workflow mit 15–25 Items über alle Phasen. Pflicht: ~40% Methoden, Rest Software/Konzepte (falls verfügbar).'
 | 
				
			||||||
        : 'Spezifische Lösung mit 4–10 Items. PFLICHT: Mindestens 30% Methoden wenn verfügbar.';
 | 
					        : 'Spezifische Lösung mit 4–10 Items. Pflicht: ≥30% Methoden (falls verfügbar).';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return `Du bist ein DFIR-Experte. Wähle die BESTEN Items aus dem vorgefilterten Set.
 | 
					    return `Du bist DFIR-Experte. Wähle die BESTEN Items aus dem bereits semantisch vorgefilterten Set für die konkrete Aufgabe.
 | 
				
			||||||
 | 
					 | 
				
			||||||
AUSWAHLMETHODE:
 | 
					 | 
				
			||||||
  ✓ Semantisch relevante Items bereits vorgefiltert
 | 
					 | 
				
			||||||
  ✓ Wähle die BESTEN für die konkrete Aufgabe
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
${modeInstruction}
 | 
					${modeInstruction}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ANFRAGE: "${userQuery}"
 | 
					ANFRAGE: "${userQuery}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VERFÜGBARE ITEM-TYPEN:
 | 
					ITEM-TYPEN:
 | 
				
			||||||
- TOOLS (type: "software"/"method") → praktische Anwendungen und Vorgehensweisen  
 | 
					- TOOLS (type: "software" | "method")
 | 
				
			||||||
- KONZEPTE (type: "concept") → theoretisches Wissen und Methodiken
 | 
					- KONZEPTE (type: "concept")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AUSWAHLSTRATEGIE:
 | 
					AUSWAHLPRINZIPIEN:
 | 
				
			||||||
1. **ERSTE PRIORITÄT: Relevanz zur Anfrage**
 | 
					1) Relevanz zur Anfrage (direkt anwendbar, adressiert Kernproblem)
 | 
				
			||||||
   - Direkt anwendbar auf das Problem
 | 
					2) Ausgewogene Mischung (Praxis: selectedTools; Methodik: selectedConcepts)
 | 
				
			||||||
   - Löst die Kernherausforderung
 | 
					3) Qualität > Quantität (lieber weniger, dafür passgenau)
 | 
				
			||||||
 | 
					4) Keine Erfindungen. Wenn etwas nicht passt, wähle weniger.
 | 
				
			||||||
2. **ZWEITE PRIORITÄT: Ausgewogene Mischung**
 | 
					 | 
				
			||||||
   - Tools/Methoden für praktische Umsetzung → selectedTools
 | 
					 | 
				
			||||||
   - Konzepte für methodisches Verständnis → selectedConcepts
 | 
					 | 
				
			||||||
   - WICHTIG: Auch Konzepte auswählen, nicht nur Tools!
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
3. **QUALITÄT > QUANTITÄT**
 | 
					 | 
				
			||||||
   - Lieber weniger perfekte Items als viele mittelmäßige
 | 
					 | 
				
			||||||
   - Jedes Item muss begründbar sein
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
4. **(Skalenharmonisierung – Info)**
 | 
					 | 
				
			||||||
   - Spätere Schritte vergeben "taskRelevance" nach EINHEITLICHER Skala:
 | 
					 | 
				
			||||||
     55–65 (Basis), 66–75 (gut), 76–85 (sehr gut), >85 nur bei perfekter Übereinstimmung.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
AUSWAHLREGELN:
 | 
					AUSWAHLREGELN:
 | 
				
			||||||
- Wähle ${mode === 'workflow' ? '15–25' : '4–10'} Items total, max ${maxSelectedItems}
 | 
					- Wähle ${mode === 'workflow' ? '15–25' : '4–10'} Items total (max ${maxSelectedItems})
 | 
				
			||||||
- BEIDE Arrays füllen: selectedTools UND selectedConcepts
 | 
					- Fülle BEIDE Arrays: selectedTools UND selectedConcepts
 | 
				
			||||||
- Mindestens 1–2 Konzepte auswählen für methodische Fundierung
 | 
					- Mindestens 1–2 Konzepte (falls verfügbar)
 | 
				
			||||||
- Tools: ca. 40% Methoden (type="method"), Rest Software (type="software"), wenn verfügbar
 | 
					- Bevorzugt ~40% Methoden (Workflow) bzw. ≥30% Methoden (Tool-Modus), sofern vorhanden
 | 
				
			||||||
 | 
					- Sortiere selectedTools grob nach Eignung (bestes zuerst)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ANTWORT AUSSCHLIESSLICH IM JSON-FORMAT:
 | 
					Skalenhinweis (für spätere Schritte – einheitlich):
 | 
				
			||||||
 | 
					${RELEVANCE_RUBRIC}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					${STRICTNESS}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ANTWORT (NUR JSON):
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "selectedTools": ["ToolName1", "MethodName1", ...],
 | 
					  "selectedTools": ["ToolName1", "MethodName1", "..."],
 | 
				
			||||||
  "selectedConcepts": ["ConceptName1", "ConceptName2", ...],
 | 
					  "selectedConcepts": ["ConceptName1", "ConceptName2", "..."],
 | 
				
			||||||
  "reasoning": "Kurze Begründung mit Erwähnung der Tool/Konzept-Balance"
 | 
					  "reasoning": "Sehr kurz: Balance/Abdeckung begründen"
 | 
				
			||||||
}`;
 | 
					}`;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  toolSelectionWithData: (basePrompt: string, toolsToSend: any[], conceptsToSend: any[]) => {
 | 
					  toolSelectionWithData: (basePrompt: string, toolsToSend: any[], conceptsToSend: any[]) => {
 | 
				
			||||||
    return `${basePrompt}
 | 
					    return `${basePrompt}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VERFÜGBARE TOOLS (${toolsToSend.length} Items – Methoden und Software):
 | 
					VERFÜGBARE TOOLS (${toolsToSend.length}):
 | 
				
			||||||
${JSON.stringify(toolsToSend, null, 2)}
 | 
					${JSON.stringify(toolsToSend, null, 2)}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VERFÜGBARE KONZEPTE (${conceptsToSend.length} Items – theoretisches Wissen):
 | 
					VERFÜGBARE KONZEPTE (${conceptsToSend.length}):
 | 
				
			||||||
${JSON.stringify(conceptsToSend, null, 2)}
 | 
					${JSON.stringify(conceptsToSend, null, 2)}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WICHTIGER HINWEIS: Wähle sowohl aus TOOLS als auch aus KONZEPTEN aus! Konzepte sind essentiell für methodische Fundierung.
 | 
					WICHTIG:
 | 
				
			||||||
 | 
					- Wähle nur aus obigen Listen. Keine neuen Namen.
 | 
				
			||||||
 | 
					- Nutze exakte Namen. Keine Synonyme/Varianten.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(Hinweis zur späteren Relevanz-Skala – EINHEITLICH ÜBER ALLE MODI)
 | 
					Hinweis zur einheitlichen Relevanz-Skala:
 | 
				
			||||||
- 55–65: Grundlegend relevant
 | 
					${RELEVANCE_RUBRIC}
 | 
				
			||||||
- 66–75: Gut geeignet
 | 
					
 | 
				
			||||||
- 76–85: Sehr gut geeignet
 | 
					${STRICTNESS}`;
 | 
				
			||||||
- >85 : NUR bei nahezu perfekter Übereinstimmung`;
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					  // Contextual analyses (keine JSON-Ausgabe nötig; kurzer Fließtext)
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
  scenarioAnalysis: (isWorkflow: boolean, userQuery: string) => {
 | 
					  scenarioAnalysis: (isWorkflow: boolean, userQuery: string) => {
 | 
				
			||||||
    const analysisType = isWorkflow ? 'Szenario' : 'Problem';
 | 
					    const analysisType = isWorkflow ? 'Szenario' : 'Problem';
 | 
				
			||||||
    const focus = isWorkflow
 | 
					    const focus = isWorkflow
 | 
				
			||||||
@ -81,10 +92,9 @@ WICHTIGER HINWEIS: Wähle sowohl aus TOOLS als auch aus KONZEPTEN aus! Konzepte
 | 
				
			|||||||
    return `DFIR-Experte: Analysiere das ${analysisType}.
 | 
					    return `DFIR-Experte: Analysiere das ${analysisType}.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
${isWorkflow ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
 | 
					${isWorkflow ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
 | 
				
			||||||
 | 
					 | 
				
			||||||
Fokus: ${focus}
 | 
					Fokus: ${focus}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Antwort: Fließtext ohne Listen, max 100 Wörter.`;
 | 
					Antwort: Fließtext, max 100 Wörter. Keine Liste, keine Einleitung.`;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  investigationApproach: (isWorkflow: boolean, userQuery: string) => {
 | 
					  investigationApproach: (isWorkflow: boolean, userQuery: string) => {
 | 
				
			||||||
@ -96,10 +106,9 @@ Antwort: Fließtext ohne Listen, max 100 Wörter.`;
 | 
				
			|||||||
    return `Entwickle einen ${approachType}.
 | 
					    return `Entwickle einen ${approachType}.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
${isWorkflow ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
 | 
					${isWorkflow ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
 | 
				
			||||||
 | 
					 | 
				
			||||||
Fokus: ${focus}
 | 
					Fokus: ${focus}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Antwort: Fließtext ohne Listen, max 100 Wörter.`;
 | 
					Antwort: Fließtext, max 100 Wörter.`;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  criticalConsiderations: (isWorkflow: boolean, userQuery: string) => {
 | 
					  criticalConsiderations: (isWorkflow: boolean, userQuery: string) => {
 | 
				
			||||||
@ -110,12 +119,14 @@ Antwort: Fließtext ohne Listen, max 100 Wörter.`;
 | 
				
			|||||||
    return `Identifiziere kritische Überlegungen.
 | 
					    return `Identifiziere kritische Überlegungen.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
${isWorkflow ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
 | 
					${isWorkflow ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
 | 
				
			||||||
 | 
					 | 
				
			||||||
Fokus: ${focus}
 | 
					Fokus: ${focus}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Antwort: Fließtext ohne Listen, max 100 Wörter.`;
 | 
					Antwort: Fließtext, max 100 Wörter.`;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					  // Phase-specific selection (workflow mode substep)
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
  phaseToolSelection: (userQuery: string, phase: any, phaseTools: any[]) => {
 | 
					  phaseToolSelection: (userQuery: string, phase: any, phaseTools: any[]) => {
 | 
				
			||||||
    const methods = phaseTools.filter(t => t.type === 'method');
 | 
					    const methods = phaseTools.filter(t => t.type === 'method');
 | 
				
			||||||
    const tools = phaseTools.filter(t => t.type === 'software');
 | 
					    const tools = phaseTools.filter(t => t.type === 'software');
 | 
				
			||||||
@ -124,108 +135,116 @@ Antwort: Fließtext ohne Listen, max 100 Wörter.`;
 | 
				
			|||||||
      return `Keine Methoden/Tools für Phase "${phase.name}" verfügbar. Antworte mit leerem Array: []`;
 | 
					      return `Keine Methoden/Tools für Phase "${phase.name}" verfügbar. Antworte mit leerem Array: []`;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return `Du bist ein DFIR-Experte. Wähle die 2–3 BESTEN Items für Phase "${phase.name}".
 | 
					    return `Wähle die 2–3 BESTEN Items für Phase "${phase.name}".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SZENARIO: "${userQuery}"
 | 
					SZENARIO: "${userQuery}"
 | 
				
			||||||
PHASE: ${phase.name} - ${phase.description || ''}
 | 
					PHASE: ${phase.name} — ${phase.description || ''}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VERFÜGBARE ITEMS (bereits von KI vorausgewählt):
 | 
					VERFÜGBARE ITEMS:
 | 
				
			||||||
${methods.length > 0 ? `
 | 
					${methods.length > 0 ? `
 | 
				
			||||||
METHODEN (${methods.length}):
 | 
					METHODEN (${methods.length}):
 | 
				
			||||||
${methods.map((method: any) =>
 | 
					${methods.map((m: any) =>
 | 
				
			||||||
  `- ${method.name}
 | 
					  `- ${m.name}
 | 
				
			||||||
  Typ: ${method.type}
 | 
					  Typ: ${m.type}
 | 
				
			||||||
  Beschreibung: ${method.description}
 | 
					  Beschreibung: ${m.description}
 | 
				
			||||||
  Domains: ${method.domains?.join(', ') || 'N/A'}
 | 
					  Domains: ${m.domains?.join(', ') || 'N/A'}
 | 
				
			||||||
  Skill Level: ${method.skillLevel}`
 | 
					  Skill Level: ${m.skillLevel}`
 | 
				
			||||||
).join('\n\n')}
 | 
					).join('\n\n')}
 | 
				
			||||||
` : 'Keine Methoden verfügbar'}
 | 
					` : 'Keine Methoden verfügbar'}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
${tools.length > 0 ? `
 | 
					${tools.length > 0 ? `
 | 
				
			||||||
SOFTWARE TOOLS (${tools.length}):
 | 
					SOFTWARE (${tools.length}):
 | 
				
			||||||
${tools.map((tool: any) =>
 | 
					${tools.map((t: any) =>
 | 
				
			||||||
  `- ${tool.name}
 | 
					  `- ${t.name}
 | 
				
			||||||
  Typ: ${tool.type}
 | 
					  Typ: ${t.type}
 | 
				
			||||||
  Beschreibung: ${tool.description}
 | 
					  Beschreibung: ${t.description}
 | 
				
			||||||
  Plattformen: ${tool.platforms?.join(', ') || 'N/A'}
 | 
					  Plattformen: ${t.platforms?.join(', ') || 'N/A'}
 | 
				
			||||||
  Skill Level: ${tool.skillLevel}`
 | 
					  Skill Level: ${t.skillLevel}`
 | 
				
			||||||
).join('\n\n')}
 | 
					).join('\n\n')}
 | 
				
			||||||
` : 'Keine Software-Tools verfügbar'}
 | 
					` : 'Keine Software-Tools verfügbar'}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AUSWAHLREGELN FÜR PHASE "${phase.name}":
 | 
					REGELN:
 | 
				
			||||||
1. Wähle die 2–3 BESTEN Items für diese spezifische Phase
 | 
					1) 2–3 Items, direkt phasenrelevant; mind. 1 Methode, falls verfügbar
 | 
				
			||||||
2. Priorisiere Items, die DIREKT für "${phase.name}" relevant sind
 | 
					2) Begründung pro Item (präzise, anwendungsbezogen)
 | 
				
			||||||
3. Mindestens 1 Methode wenn verfügbar, Rest Software-Tools
 | 
					3) Verwende EXAKTE Namen aus den Listen. Keine Erfindungen.
 | 
				
			||||||
4. Begründe WARUM jedes Item für diese Phase optimal ist
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
TASK RELEVANCE – EINHEITLICHE SKALA (GANZZAHL 0–100):
 | 
					${RELEVANCE_RUBRIC}
 | 
				
			||||||
- 55–65: Basis/ausreichend für diese Phase
 | 
					 | 
				
			||||||
- 66–75: Gut geeignet, klare Phasenrelevanz
 | 
					 | 
				
			||||||
- 76–85: Sehr gut geeignet, optimaler Fit
 | 
					 | 
				
			||||||
- >85 : Nur bei nahezu perfekter Übereinstimmung
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
WICHTIG: Verwende EXAKT die Namen wie oben aufgelistet (ohne Präfixe wie M1./T2.)!
 | 
					${STRICTNESS}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ANTWORT AUSSCHLIESSLICH IM JSON-FORMAT OHNE JEGLICHEN TEXT AUSSERHALB:
 | 
					ANTWORT (NUR JSON):
 | 
				
			||||||
[
 | 
					[
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    "toolName": "Exakter Name aus der Liste oben",
 | 
					    "toolName": "Exakter Name",
 | 
				
			||||||
    "taskRelevance": 0,
 | 
					    "taskRelevance": 0,
 | 
				
			||||||
    "justification": "Detaillierte Begründung (60–80 Wörter) warum optimal für ${phase.name} – erkläre Anwendung, Vorteile und spezifische Relevanz",
 | 
					    "justification": "60–80 Wörter zur phasenspezifischen Eignung",
 | 
				
			||||||
    "limitations": ["Mögliche Einschränkung für diese Phase"]
 | 
					    "limitations": ["Optionale spezifische Einschränkung"]
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
]`;
 | 
					]`;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					  // Per-item evaluation (used in tool mode & elsewhere)
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
  toolEvaluation: (userQuery: string, tool: any, rank: number) => {
 | 
					  toolEvaluation: (userQuery: string, tool: any, rank: number) => {
 | 
				
			||||||
    const itemType = tool.type === 'method' ? 'Methode' : 'Tool';
 | 
					    const itemType = tool.type === 'method' ? 'Methode' : 'Tool';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return `Erkläre die Anwendung dieser/dieses ${itemType} für die Aufgabe.
 | 
					    return `Bewerte diese/diesen ${itemType} ausschließlich bzgl. des PROBLEMS.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PROBLEM: "${userQuery}"
 | 
					PROBLEM: "${userQuery}"
 | 
				
			||||||
${itemType.toUpperCase()}: ${tool.name}
 | 
					${itemType.toUpperCase()}: ${tool.name}
 | 
				
			||||||
TYP: ${tool.type}
 | 
					TYP: ${tool.type}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ANWEISUNGEN:
 | 
					ANWEISUNGEN:
 | 
				
			||||||
- Beurteile ausschließlich entlang der fachlichen Eignung zum PROBLEM.
 | 
					- Nur vorhandene Metadaten nutzen (keine Annahmen, keine Websuche).
 | 
				
			||||||
- Nutze nur die dir vorliegenden Texte/Metadaten (keine externen Annahmen).
 | 
					- "taskRelevance" als GANZZAHL 0–100 nach einheitlicher Skala vergeben.
 | 
				
			||||||
- Bestimme eine EIGENE ganzzahlige Bewertung "taskRelevance" von 0–100 (ohne %).
 | 
					- Realistische Scores i.d.R. 60–80, >85 nur bei nahezu perfektem Fit.
 | 
				
			||||||
- Verwende die EINHEITLICHE SKALA:
 | 
					- Keine Texte außerhalb des JSON.
 | 
				
			||||||
  55–65 = Basis/ok · 66–75 = gut · 76–85 = sehr gut · >85 = nur bei nahezu perfekter Übereinstimmung.
 | 
					 | 
				
			||||||
- Bevorzuge realistische Scores im Bereich 60–80 für gute Fits.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Gib nur JSON im folgenden Schema zurück. Keine Texte davor oder danach.
 | 
					${RELEVANCE_RUBRIC}
 | 
				
			||||||
 | 
					${STRICTNESS}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ANTWORT (NUR JSON):
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "detailed_explanation": "Warum und wie einsetzen",
 | 
					  "detailed_explanation": "Warum und wie einsetzen",
 | 
				
			||||||
  "implementation_approach": "Konkrete Schritte",
 | 
					  "implementation_approach": "Konkrete Schritte",
 | 
				
			||||||
  "pros": ["Vorteil 1", "Vorteil 2"],
 | 
					  "pros": ["Vorteil 1", "Vorteil 2"],
 | 
				
			||||||
  "limitations": ["Einschränkung 1"],
 | 
					  "limitations": ["Einschränkung 1"],
 | 
				
			||||||
  "alternatives": "Alternative Ansätze",
 | 
					  "alternatives": "Kurz zu sinnvollen Alternativen",
 | 
				
			||||||
  "taskRelevance": 0
 | 
					  "taskRelevance": 0
 | 
				
			||||||
}`;
 | 
					}`;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					  // Background knowledge (concepts)
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
  backgroundKnowledgeSelection: (userQuery: string, mode: string, selectedToolNames: string[], availableConcepts: any[]) => {
 | 
					  backgroundKnowledgeSelection: (userQuery: string, mode: string, selectedToolNames: string[], availableConcepts: any[]) => {
 | 
				
			||||||
    return `Wähle 2–4 relevante Konzepte.
 | 
					    return `Wähle 2–4 Konzepte, die das Verständnis/den Einsatz der ausgewählten Tools verbessern.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
${mode === 'workflow' ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
 | 
					${mode === 'workflow' ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
 | 
				
			||||||
AUSGEWÄHLTE TOOLS: ${selectedToolNames.join(', ')}
 | 
					AUSGEWÄHLTE TOOLS: ${selectedToolNames.join(', ')}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VERFÜGBARE KONZEPTE (${availableConcepts.length} KI-kuratiert):
 | 
					VERFÜGBARE KONZEPTE (${availableConcepts.length}):
 | 
				
			||||||
${availableConcepts.map((c: any) =>
 | 
					${availableConcepts.map((c: any) => `- ${c.name}: ${c.description}...`).join('\n')}
 | 
				
			||||||
  `- ${c.name}: ${c.description}...`
 | 
					 | 
				
			||||||
).join('\n')}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
ANTWORT AUSSCHLIESSLICH IM JSON-FORMAT OHNE JEGLICHEN TEXT AUSSERHALB DER JSON-STRUKTUR:
 | 
					REGELN:
 | 
				
			||||||
 | 
					- Nur Konzepte aus obiger Liste wählen.
 | 
				
			||||||
 | 
					- Relevanz kurz und konkret begründen.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					${STRICTNESS}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ANTWORT (NUR JSON):
 | 
				
			||||||
[
 | 
					[
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    "conceptName": "Name",
 | 
					    "conceptName": "Exakter Name",
 | 
				
			||||||
    "relevance": "Warum kritisch für Methodik"
 | 
					    "relevance": "Warum dieses Konzept hier methodisch wichtig ist"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
]`;
 | 
					]`;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					  // Phase completion (underrepresented phase fix)
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
  phaseCompletionReasoning: (
 | 
					  phaseCompletionReasoning: (
 | 
				
			||||||
    originalQuery: string,
 | 
					    originalQuery: string,
 | 
				
			||||||
    phase: any,
 | 
					    phase: any,
 | 
				
			||||||
@ -233,27 +252,14 @@ ANTWORT AUSSCHLIESSLICH IM JSON-FORMAT OHNE JEGLICHEN TEXT AUSSERHALB DER JSON-S
 | 
				
			|||||||
    tool: any,
 | 
					    tool: any,
 | 
				
			||||||
    completionContext: string
 | 
					    completionContext: string
 | 
				
			||||||
  ) => {
 | 
					  ) => {
 | 
				
			||||||
    return `Du bist ein DFIR-Experte. Erkläre warum dieses Tool nachträglich zur Vervollständigung hinzugefügt wurde.
 | 
					    return `Begründe knapp die Nachergänzung für Phase "${phase.name}".
 | 
				
			||||||
 | 
					 | 
				
			||||||
KONTEXT DER NACHTRÄGLICHEN ERGÄNZUNG:
 | 
					 | 
				
			||||||
- Ursprüngliche KI-Auswahl war zu spezifisch/eng gefasst
 | 
					 | 
				
			||||||
- Phase "${phase.name}" war unterrepräsentiert in der initialen Auswahl
 | 
					 | 
				
			||||||
- Semantische Suche fand zusätzlich relevante Tools für diese Phase
 | 
					 | 
				
			||||||
- Tool wird nachträglich hinzugefügt um Vollständigkeit zu gewährleisten
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
URSPRÜNGLICHE ANFRAGE: "${originalQuery}"
 | 
					URSPRÜNGLICHE ANFRAGE: "${originalQuery}"
 | 
				
			||||||
PHASE ZU VERVOLLSTÄNDIGEN: ${phase.name} - ${phase.description || ''}
 | 
					PHASE: ${phase.name} — ${phase.description || ''}
 | 
				
			||||||
HINZUGEFÜGTES TOOL: ${selectedToolName} (${tool.type})
 | 
					HINZUGEFÜGTES TOOL: ${selectedToolName} (${tool.type})
 | 
				
			||||||
TOOL-BESCHREIBUNG: ${tool.description}
 | 
					KONTEXT: ${completionContext}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BEGRÜNDUNGSKONTEXT: ${completionContext}
 | 
					Antwort: Prägnanter Fließtext, max 40 Wörter, keine Einleitung, keine Liste.`;
 | 
				
			||||||
 | 
					 | 
				
			||||||
Erstelle eine präzise Begründung (max. 40 Wörter), die erklärt:
 | 
					 | 
				
			||||||
1. WARUM dieses Tool nachträglich hinzugefügt wurde
 | 
					 | 
				
			||||||
2. WIE es die ${phase.name}-Phase ergänzt
 | 
					 | 
				
			||||||
3. DASS es die ursprünglich zu spezifische Auswahl erweitert
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Antwort: Prägnanter Fließtext, knappe Begründung für Nachergänzung. Vermeide Begriffe wie "Das Tool" und gib keinen einleitenden Text wie "Begründung (40 Wörter):" an.`;
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  generatePhaseCompletionPrompt(
 | 
					  generatePhaseCompletionPrompt(
 | 
				
			||||||
@ -262,47 +268,50 @@ Antwort: Prägnanter Fließtext, knappe Begründung für Nachergänzung. Vermeid
 | 
				
			|||||||
    candidateTools: any[],
 | 
					    candidateTools: any[],
 | 
				
			||||||
    candidateConcepts: any[]
 | 
					    candidateConcepts: any[]
 | 
				
			||||||
  ): string {
 | 
					  ): string {
 | 
				
			||||||
    return `Du bist ein DFIR-Experte. Die initiale KI-Auswahl war zu spezifisch – die Phase "${phase.name}" ist unterrepräsentiert.
 | 
					    return `Unterrepräsentierte Phase: "${phase.name}". Ergänze 1–2 passende Items aus der semantischen Nachsuche.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
KONTEXT: Die Hauptauswahl hat zu wenige Tools für "${phase.name}" identifiziert. Wähle jetzt ergänzende Tools aus semantischer Nachsuche.
 | 
					ORIGINALANFRAGE: "${originalQuery}"
 | 
				
			||||||
 | 
					PHASE: ${phase.name} — ${phase.description || ''}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ORIGINAL ANFRAGE: "${originalQuery}"
 | 
					KANDIDATEN — TOOLS (${candidateTools.length}):
 | 
				
			||||||
UNTERREPRÄSENTIERTE PHASE: ${phase.name} - ${phase.description || ''}
 | 
					${candidateTools.map((t: any) => `
 | 
				
			||||||
 | 
					- ${t.name} (${t.type})
 | 
				
			||||||
SEMANTISCH GEFUNDENE KANDIDATEN für Nachergänzung:
 | 
					  Beschreibung: ${t.description}
 | 
				
			||||||
 | 
					  Skill Level: ${t.skillLevel}
 | 
				
			||||||
VERFÜGBARE TOOLS (${candidateTools.length}):
 | 
					 | 
				
			||||||
${candidateTools.map((tool: any) => `
 | 
					 | 
				
			||||||
- ${tool.name} (${tool.type})
 | 
					 | 
				
			||||||
  Beschreibung: ${tool.description}
 | 
					 | 
				
			||||||
  Skill Level: ${tool.skillLevel}
 | 
					 | 
				
			||||||
`).join('')}
 | 
					`).join('')}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
${candidateConcepts.length > 0 ? `
 | 
					${candidateConcepts.length > 0 ? `
 | 
				
			||||||
VERFÜGBARE KONZEPTE (${candidateConcepts.length}):
 | 
					KANDIDATEN — KONZEPTE (${candidateConcepts.length}):
 | 
				
			||||||
${candidateConcepts.map((concept: any) => `
 | 
					${candidateConcepts.map((c: any) => `
 | 
				
			||||||
- ${concept.name}
 | 
					- ${c.name}
 | 
				
			||||||
  Beschreibung: ${concept.description}
 | 
					  Beschreibung: ${c.description}
 | 
				
			||||||
`).join('')}
 | 
					`).join('')}
 | 
				
			||||||
` : ''}
 | 
					` : ''}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AUSWAHLREGELN FÜR NACHERGÄNZUNG:
 | 
					REGELN:
 | 
				
			||||||
1. Wähle 1–2 BESTE Methoden/Tools die die ${phase.name}-Phase optimal ergänzen
 | 
					- Wähle 1–2 Tools/Methoden, die ${phase.name} sinnvoll ergänzen (keine Ersetzung).
 | 
				
			||||||
2. Methoden/Tools müssen für die ursprüngliche Anfrage relevant sein
 | 
					- Nur aus obigen Kandidaten wählen; exakte Namen verwenden.
 | 
				
			||||||
3. Ergänzen, nicht ersetzen – erweitere die zu spezifische Erstauswahl
 | 
					- Kurze Begründung, warum diese Ergänzung nötig ist.
 | 
				
			||||||
4. Relevanz-Skala weiterhin EINHEITLICH: 55–65/66–75/76–85/>85 nur bei perfekter Übereinstimmung
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
ANTWORT AUSSCHLIESSLICH IM JSON-FORMAT:
 | 
					Skalenhinweis (einheitlich):
 | 
				
			||||||
 | 
					${RELEVANCE_RUBRIC}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					${STRICTNESS}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ANTWORT (NUR JSON):
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "selectedTools": ["ToolName1", "ToolName2"],
 | 
					  "selectedTools": ["ToolName1", "ToolName2"],
 | 
				
			||||||
  "selectedConcepts": ["ConceptName1"],
 | 
					  "selectedConcepts": ["ConceptName1"],
 | 
				
			||||||
  "completionReasoning": "Kurze Erklärung warum diese Nachergänzung für ${phase.name} notwendig war"
 | 
					  "completionReasoning": "Kurze Erklärung zur Ergänzung der ${phase.name}-Phase"
 | 
				
			||||||
}`;
 | 
					}`;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					  // Final synthesis (short prose, no JSON needed)
 | 
				
			||||||
 | 
					  // ---------------------------------------------------------------------------
 | 
				
			||||||
  finalRecommendations: (isWorkflow: boolean, userQuery: string, selectedToolNames: string[]) => {
 | 
					  finalRecommendations: (isWorkflow: boolean, userQuery: string, selectedToolNames: string[]) => {
 | 
				
			||||||
    const focus = isWorkflow
 | 
					    const focus = isWorkflow
 | 
				
			||||||
      ? 'Workflow-Schritte, Best Practices, Objektivität'
 | 
					      ? 'Knappe Workflow-Schritte & Best Practices; neutral formulieren'
 | 
				
			||||||
      : 'Methodische Überlegungen, Validierung, Qualitätssicherung';
 | 
					      : 'Methodische Überlegungen, Validierung, Qualitätssicherung';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return `Erstelle ${isWorkflow ? 'Workflow-Empfehlung' : 'methodische Überlegungen'}.
 | 
					    return `Erstelle ${isWorkflow ? 'Workflow-Empfehlung' : 'methodische Überlegungen'}.
 | 
				
			||||||
@ -311,11 +320,11 @@ ${isWorkflow ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
 | 
				
			|||||||
AUSGEWÄHLT: ${selectedToolNames.join(', ')}${selectedToolNames.length > 5 ? '...' : ''}
 | 
					AUSGEWÄHLT: ${selectedToolNames.join(', ')}${selectedToolNames.length > 5 ? '...' : ''}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Fokus: ${focus}
 | 
					Fokus: ${focus}
 | 
				
			||||||
 | 
					Antwort: Fließtext, max ${isWorkflow ? '100' : '80'} Wörter. Keine Liste.`;
 | 
				
			||||||
Antwort: Fließtext ohne Listen, max ${isWorkflow ? '100' : '80'} Wörter.`;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
} as const;
 | 
					} as const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Overloads
 | 
				
			||||||
export function getPrompt(key: 'toolSelection', mode: string, userQuery: string, maxSelectedItems: number): string;
 | 
					export function getPrompt(key: 'toolSelection', mode: string, userQuery: string, maxSelectedItems: number): string;
 | 
				
			||||||
export function getPrompt(key: 'toolSelectionWithData', basePrompt: string, toolsToSend: any[], conceptsToSend: any[]): string;
 | 
					export function getPrompt(key: 'toolSelectionWithData', basePrompt: string, toolsToSend: any[], conceptsToSend: any[]): string;
 | 
				
			||||||
export function getPrompt(key: 'scenarioAnalysis', isWorkflow: boolean, userQuery: string): string;
 | 
					export function getPrompt(key: 'scenarioAnalysis', isWorkflow: boolean, userQuery: string): string;
 | 
				
			||||||
@ -328,17 +337,15 @@ export function getPrompt(key: 'phaseCompletionReasoning', originalQuery: string
 | 
				
			|||||||
export function getPrompt(key: 'finalRecommendations', isWorkflow: boolean, userQuery: string, selectedToolNames: string[]): string;
 | 
					export function getPrompt(key: 'finalRecommendations', isWorkflow: boolean, userQuery: string, selectedToolNames: string[]): string;
 | 
				
			||||||
export function getPrompt(key: 'generatePhaseCompletionPrompt', originalQuery: string, phase: any, candidateTools: any[], candidateConcepts: any[]): string;
 | 
					export function getPrompt(key: 'generatePhaseCompletionPrompt', originalQuery: string, phase: any, candidateTools: any[], candidateConcepts: any[]): string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Dispatcher
 | 
				
			||||||
export function getPrompt(promptKey: keyof typeof AI_PROMPTS, ...args: any[]): string {
 | 
					export function getPrompt(promptKey: keyof typeof AI_PROMPTS, ...args: any[]): string {
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
    const promptFunction = AI_PROMPTS[promptKey];
 | 
					    const f = AI_PROMPTS[promptKey];
 | 
				
			||||||
    if (typeof promptFunction === 'function') {
 | 
					    if (typeof f === 'function') return (f as (...a: any[]) => string)(...args);
 | 
				
			||||||
      return (promptFunction as (...args: any[]) => string)(...args);
 | 
					    console.error(`[PROMPTS] Invalid prompt key: ${promptKey}`);
 | 
				
			||||||
    } else {
 | 
					    return 'Error: Invalid prompt configuration';
 | 
				
			||||||
      console.error(`[PROMPTS] Invalid prompt key: ${promptKey}`);
 | 
					  } catch (err) {
 | 
				
			||||||
      return 'Error: Invalid prompt configuration';
 | 
					    console.error(`[PROMPTS] Error generating prompt ${promptKey}:`, err);
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  } catch (error) {
 | 
					 | 
				
			||||||
    console.error(`[PROMPTS] Error generating prompt ${promptKey}:`, error);
 | 
					 | 
				
			||||||
    return 'Error: Failed to generate prompt';
 | 
					    return 'Error: Failed to generate prompt';
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user