feat(backend): Lokalisierung der weiteren Pipeline-Bereiche
- incidents.enhance_description: ENHANCE_PROMPT_RESEARCH/ADHOC nun pro
Sprache (DE/EN), Auswahl via _enhance_template(type, org_lang_iso).
- pipeline_tracker.get_pipeline_steps(lang_iso) liefert die Schritt-
Definition lokalisiert. /api/incidents/{id}/pipeline reicht Org-Sprache
durch.
- chat._build_prompt(output_language): SYSTEM_PROMPT laesst sich per
format() in Org-Sprache rendern (nur Output-Anweisung). Chat-Router
zieht Sprache aus Org-Setting.
- report_generator: FC_STATUS_LABELS_DE/EN + _fc_labels(lang_iso).
PDF-Template bleibt vorerst deutsch (Phase 9).
Bewusst draussen (Phase 4): entity_extractor (Backend-intern, keine UI),
source_suggester (Admin in Verwaltung), geoparsing (liefert bereits
englische Ortsnamen).
Phase 4 von 8 (eng_demo / Org-Sprache).
Dieser Commit ist enthalten in:
@@ -196,7 +196,7 @@ async def get_refreshing_incidents(
|
||||
|
||||
# --- Beschreibung generieren (Prompt Enhancement) ---
|
||||
|
||||
ENHANCE_PROMPT_RESEARCH = """Du bist ein Recherche-Planer in einem OSINT-Lagemonitoring-System.
|
||||
ENHANCE_PROMPT_RESEARCH_DE = """Du bist ein Recherche-Planer in einem OSINT-Lagemonitoring-System.
|
||||
Deine Aufgabe: Strukturiere ein Recherche-Briefing, das Analysten als Leitfaden für ihre Suche verwenden.
|
||||
Du behauptest KEINE Fakten und musst das Thema NICHT kennen oder verifizieren.
|
||||
Der Nutzer gibt das Thema vor -- du definierst Suchrichtungen, Schwerpunkte und Stichworte.
|
||||
@@ -215,7 +215,7 @@ Erstelle ein präzises Recherche-Briefing mit:
|
||||
|
||||
Schreibe NUR das Briefing als Fließtext mit Aufzählungen. Keine Erklärungen, Rückfragen oder Disclaimer."""
|
||||
|
||||
ENHANCE_PROMPT_ADHOC = """Du bist ein Recherche-Planer in einem OSINT-Lagemonitoring-System.
|
||||
ENHANCE_PROMPT_ADHOC_DE = """Du bist ein Recherche-Planer in einem OSINT-Lagemonitoring-System.
|
||||
Deine Aufgabe: Erstelle eine knappe Vorfallsbeschreibung, die als Suchauftrag für Live-Monitoring dient.
|
||||
Du behauptest KEINE Fakten und musst den Vorfall NICHT kennen oder verifizieren.
|
||||
Der Nutzer gibt das Thema vor -- du strukturierst, wonach gesucht werden soll.
|
||||
@@ -235,6 +235,52 @@ Erstelle eine knappe, informative Beschreibung mit:
|
||||
|
||||
Schreibe NUR die Beschreibung als Fließtext (3-5 Zeilen). Keine Erklärungen, Rückfragen oder Disclaimer."""
|
||||
|
||||
ENHANCE_PROMPT_RESEARCH_EN = """You are a research planner in an OSINT situation-monitoring system.
|
||||
Your task: Structure a research briefing that analysts will use as a guide for their search.
|
||||
Do NOT assert facts; you do NOT need to know or verify the topic.
|
||||
The user provides the topic; you define search directions, focus areas, and keywords.
|
||||
ALWAYS produce a briefing, even if the topic is unfamiliar.
|
||||
|
||||
Title: {title}
|
||||
Existing context: {context}
|
||||
Type: Background research
|
||||
|
||||
Produce a precise research briefing with:
|
||||
1. Case designation (full naming of the topic based on title and context)
|
||||
2. Research focus areas (5-8 thematic points, e.g. facts, parties involved, legal aspects, media reception, background, chronology)
|
||||
3. Relevant search terms (English plus any other relevant languages, including abbreviations and alternative spellings)
|
||||
|
||||
Write ONLY the briefing as flowing text with bullet points. No explanations, follow-up questions, or disclaimers."""
|
||||
|
||||
ENHANCE_PROMPT_ADHOC_EN = """You are a research planner in an OSINT situation-monitoring system.
|
||||
Your task: Produce a concise incident description that serves as a search brief for live monitoring.
|
||||
Do NOT assert facts; you do NOT need to know or verify the incident.
|
||||
The user provides the topic; you structure what should be searched for.
|
||||
ALWAYS produce a description, even if the incident is unfamiliar.
|
||||
|
||||
Title: {title}
|
||||
Existing context: {context}
|
||||
Type: Live monitoring (current events)
|
||||
|
||||
Produce a concise, informative description with:
|
||||
1. What happened / what it is about (based on title and context)
|
||||
2. Where (geographic context, if derivable)
|
||||
3. Who is involved (actors, organizations, countries)
|
||||
4. What should be searched for (current developments, reactions, background)
|
||||
|
||||
Write ONLY the description as flowing text (3-5 lines). No explanations, follow-up questions, or disclaimers."""
|
||||
|
||||
|
||||
def _enhance_template(incident_type: str, output_lang_iso: str) -> str:
|
||||
if output_lang_iso == "en":
|
||||
return ENHANCE_PROMPT_RESEARCH_EN if incident_type == "research" else ENHANCE_PROMPT_ADHOC_EN
|
||||
return ENHANCE_PROMPT_RESEARCH_DE if incident_type == "research" else ENHANCE_PROMPT_ADHOC_DE
|
||||
|
||||
|
||||
# Backward-compat fuer alte Importe
|
||||
ENHANCE_PROMPT_RESEARCH = ENHANCE_PROMPT_RESEARCH_DE
|
||||
ENHANCE_PROMPT_ADHOC = ENHANCE_PROMPT_ADHOC_DE
|
||||
|
||||
_enhance_logger = logging.getLogger("osint.enhance")
|
||||
|
||||
|
||||
@@ -249,8 +295,11 @@ async def enhance_description(
|
||||
from config import CLAUDE_MODEL_FAST
|
||||
from services.license_service import charge_usage_to_tenant
|
||||
|
||||
template = ENHANCE_PROMPT_RESEARCH if data.type == "research" else ENHANCE_PROMPT_ADHOC
|
||||
context = data.description.strip() if data.description and data.description.strip() else "Kein Kontext angegeben"
|
||||
from services.org_settings import get_org_language
|
||||
org_lang_iso = await get_org_language(db, current_user.get("tenant_id")) if current_user.get("tenant_id") else "de"
|
||||
template = _enhance_template(data.type, org_lang_iso)
|
||||
fallback_ctx = "No context provided" if org_lang_iso == "en" else "Kein Kontext angegeben"
|
||||
context = data.description.strip() if data.description and data.description.strip() else fallback_ctx
|
||||
prompt = template.format(title=data.title.strip(), context=context)
|
||||
|
||||
try:
|
||||
@@ -631,10 +680,13 @@ async def get_pipeline(
|
||||
"steps": [{step_key, status, count_value, count_secondary, pass_number}, ...]
|
||||
}
|
||||
"""
|
||||
from services.pipeline_tracker import PIPELINE_STEPS
|
||||
from services.pipeline_tracker import get_pipeline_steps
|
||||
from services.org_settings import get_org_language
|
||||
|
||||
tenant_id = current_user.get("tenant_id")
|
||||
incident_row = await _check_incident_access(db, incident_id, current_user["id"], tenant_id)
|
||||
org_lang_iso = await get_org_language(db, tenant_id) if tenant_id else "de"
|
||||
steps_definition = get_pipeline_steps(org_lang_iso)
|
||||
is_research = (incident_row["type"] or "adhoc") == "research"
|
||||
|
||||
# Jüngsten Refresh-Log wählen: bevorzugt running, sonst der letzte completed
|
||||
@@ -700,7 +752,7 @@ async def get_pipeline(
|
||||
"is_research": is_research,
|
||||
"is_running": is_running,
|
||||
"last_refresh": last_refresh,
|
||||
"steps_definition": PIPELINE_STEPS,
|
||||
"steps_definition": steps_definition,
|
||||
"steps": steps,
|
||||
}
|
||||
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren