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:
parent
fb9ab8ab81
commit
7060618a59
1 changed files with 7 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
sys.path.insert(0, os.path.dirname(__file__))
|
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():
|
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"]):
|
if any(w in q for w in ["still", "silence", "stumm", "logs"]):
|
||||||
parts.append("=== Stille Hosts ===\n" + gather_silence())
|
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)
|
ct_match = re.search(r'\bct[- ]?(\d{3})\b', q)
|
||||||
if ct_match:
|
if ct_match:
|
||||||
parts.append(f"=== CT {ct_match.group(1)} ===\n" + gather_container_status(ct_match.group(1)))
|
parts.append(f"=== CT {ct_match.group(1)} ===\n" + gather_container_status(ct_match.group(1)))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue