feat: context.py — WordPress-Daten in LLM-Kontext einbauen

Bei Fragen zu wordpress/blog/post/artikel etc. wird
wordpress_client.format_overview() automatisch geladen.

Bot kann jetzt auf Fragen antworten wie:
- "Wie viele Posts heute?"
- "Gibt es pending Kommentare?"
- "Welche Plugins sind aktiv?"

Made-with: Cursor
This commit is contained in:
root 2026-03-09 13:10:57 +07:00
parent fb9ab8ab81
commit 7060618a59

View file

@ -6,7 +6,7 @@ import os
import re
sys.path.insert(0, os.path.dirname(__file__))
from core import config, loki_client, proxmox_client
from core import config, loki_client, proxmox_client, wordpress_client
def _load_config():
@ -143,6 +143,12 @@ def gather_context_for_question(question: str) -> str:
if any(w in q for w in ["still", "silence", "stumm", "logs"]):
parts.append("=== Stille Hosts ===\n" + gather_silence())
# WordPress-Daten für Blog-Fragen
if any(w in q for w in ["wordpress", "blog", "post", "artikel", "kommentar", "plugin"]):
cfg = _load_config()
wp_overview = wordpress_client.format_overview(cfg)
parts.append("=== WordPress ===\n" + wp_overview)
ct_match = re.search(r'\bct[- ]?(\d{3})\b', q)
if ct_match:
parts.append(f"=== CT {ct_match.group(1)} ===\n" + gather_container_status(ct_match.group(1)))