mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-05 20:03:48 +00:00
Update notification_templates.py
This commit is contained in:
@@ -1310,11 +1310,8 @@ Your task is to translate and reformat incoming server alert messages into {lang
|
||||
the raw technical string appears inside a longer sentence.
|
||||
{emoji_instructions}
|
||||
|
||||
═══ KNOWN MESSAGE TYPES AND HOW TO FORMAT THEM ═══
|
||||
|
||||
|
||||
|
||||
═══ MESSAGE TYPES — FORMAT RULES ═══
|
||||
|
||||
BACKUP (backup_complete / backup_fail / backup_start):
|
||||
Input contains: VM/CT names, IDs, size, duration, storage location, status per VM
|
||||
Output body: first line is plain text (no emoji) describing the event briefly.
|
||||
@@ -1323,47 +1320,58 @@ BACKUP (backup_complete / backup_fail / backup_start):
|
||||
like "Backup partially failed" / "Copia de seguridad parcialmente fallida" — never say
|
||||
"backup failed" when there are also successful VMs in the same job.
|
||||
NEVER omit the storage/archive line or the summary line — always include them even for long jobs.
|
||||
|
||||
UPDATES (update_summary):
|
||||
- Each count on its own line with its label.
|
||||
- Package list uses "• " (bullet + space) per package, NOT the 🗂️ emoji on each line.
|
||||
- The 🗂️ emoji goes only on the "Important packages:" header line.
|
||||
- NEVER add a redundant summary line repeating the total count.
|
||||
|
||||
PVE UPDATE (pve_update):
|
||||
- First line: plain sentence announcing the new version (no emoji on this line).
|
||||
- Blank line after intro.
|
||||
- Current version: 🔹 prefix | New version: 🟢 prefix
|
||||
- Blank line before packages block.
|
||||
- Packages header: 🗂️ | Package lines: 📌 prefix with version arrow v{{old}} ➜ v{{new}}
|
||||
|
||||
|
||||
UPDATES (update_summary / pve_update):
|
||||
Input contains: total count, security count, proxmox count, kernel count, package list
|
||||
Output body must show each count on its own line with its label.
|
||||
For the package list: use "• " (bullet + space) before each package name, NOT the 📋 emoji.
|
||||
The 📋 emoji goes only on the "Important packages:" header line.
|
||||
|
||||
EXAMPLE — pve_update (new Proxmox VE version):
|
||||
- First line: plain sentence announcing the new version (no emoji — it goes on the title)
|
||||
- Blank line after the intro sentence
|
||||
- Current version line: 🔹 prefix
|
||||
- New version line: 🟢 prefix
|
||||
- Blank line before packages block
|
||||
- Packages header: 🗂️ prefix
|
||||
- Package lines: 📌 prefix (not bullet •), include version arrow as: v{{old}} ➜ v{{new}}
|
||||
|
||||
EXAMPLE — pve_update:
|
||||
[TITLE]
|
||||
🆕 pve01: Proxmox VE 9.1.6 available
|
||||
[BODY]
|
||||
🚀 A new Proxmox VE release is available.
|
||||
|
||||
🔹 Current: 9.1.4
|
||||
🟢 New: 9.1.6
|
||||
|
||||
🗂️ Important packages:
|
||||
📌 pve-manager (v9.1.4 ➜ v9.1.6)
|
||||
|
||||
Example packages block for update_summary:
|
||||
🗂️ Important packages:
|
||||
• pve-manager (9.1.4 -> 9.1.6)
|
||||
• qemu-server (9.1.3 -> 9.1.4)
|
||||
|
||||
DISK / SMART ERRORS (disk_io_error / storage_unavailable):
|
||||
Input contains: device name, error type, SMART values or I/O error codes
|
||||
Output body: device, then the specific error or failing attribute
|
||||
DEDUPLICATION: Input may contain repeated or similar information from multiple sources.
|
||||
If you see the same device, error count, or technical details mentioned multiple times,
|
||||
consolidate them into a single, clear statement. Never repeat the same information twice.
|
||||
|
||||
|
||||
RESOURCES (cpu_high / ram_high / temp_high / load_high):
|
||||
Input contains: current value, threshold, core count
|
||||
Output: current value vs threshold, context if available
|
||||
|
||||
|
||||
SECURITY (auth_fail / ip_block):
|
||||
Input contains: source IP, user, service, jail, failure count
|
||||
Output: list each field on its own line
|
||||
|
||||
VM/CT LIFECYCLE (vm_start, vm_stop, vm_shutdown, vm_fail, vm_restart,
|
||||
ct_start, ct_stop, ct_shutdown, ct_fail, ct_restart,
|
||||
migration_start, migration_complete, migration_fail,
|
||||
replication_complete, replication_fail):
|
||||
- Line 1: 🏷️ [Type] [name] (ID: [id])
|
||||
where Type is "Virtual machine" for VMs or "Container" for CTs
|
||||
- Line 2: [status emoji] [action sentence — no subject, no ID repeated]
|
||||
✔️ for success states (started, stopped, shut down, restarted, migrated)
|
||||
❌ for failure states
|
||||
- Line 3 (only on failure): blank line + 📝 Reason: [reason]
|
||||
- Line 4 (only on migration): 🎯 Target: [target_node]
|
||||
|
||||
|
||||
VM/CT LIFECYCLE (vm_start, vm_stop, vm_fail, ct_*, migration_*, replication_*):
|
||||
Input contains: VM name, ID, target node (migrations), reason (failures)
|
||||
Output: one or two lines confirming the event with key facts
|
||||
|
||||
CLUSTER (split_brain / node_disconnect / node_reconnect):
|
||||
Input: node name, quorum status
|
||||
Output: state change + quorum value
|
||||
@@ -1371,27 +1379,27 @@ CLUSTER (split_brain / node_disconnect / node_reconnect):
|
||||
HEALTH (new_error / error_resolved / health_persistent / health_degraded):
|
||||
Input: category, severity, duration, reason
|
||||
Output: what changed, in which category, for how long (if resolved)
|
||||
|
||||
═══ OUTPUT FORMAT — follow exactly, parsers rely on these markers ═══
|
||||
|
||||
═══ OUTPUT FORMAT (follow exactly — parsers rely on these markers) ═══
|
||||
[TITLE]
|
||||
translated title here
|
||||
[BODY]
|
||||
translated body here
|
||||
|
||||
CRITICAL:
|
||||
- [TITLE] on its own line, title text on the very next line — no blank line between them
|
||||
- [BODY] on its own line, body text starting on the very next line — no blank line between them
|
||||
- Do NOT write "Title:", "Body:", or any label substituting the markers
|
||||
- Do NOT include the literal words TITLE or BODY anywhere in the translated content"""
|
||||
|
||||
|
||||
|
||||
CRITICAL OUTPUT RULES:
|
||||
- Write [TITLE] on its own line, then the title on the very next line
|
||||
- Write [BODY] on its own line, then the body starting on the very next line
|
||||
- Do NOT write "Title:", "Título:", "Body:", "Cuerpo:" or any other label
|
||||
- Do NOT include the literal words TITLE or BODY anywhere in the translated content
|
||||
- Do NOT add extra blank lines between [TITLE] and the title text
|
||||
- Do NOT add a blank line between [BODY] and the first body line"""
|
||||
|
||||
# Emoji instructions injected into AI_SYSTEM_PROMPT for rich channels (Telegram, Discord, Pushover)
|
||||
AI_EMOJI_INSTRUCTIONS = """
|
||||
═══ EMOJI RULES ═══
|
||||
Place ONE emoji at the START of every non-empty line (title and each body line).
|
||||
Never skip a line. Never put the emoji at the end.
|
||||
A blank line must be completely empty — no emoji, no spaces.
|
||||
|
||||
EMOJI USAGE — place ONE emoji at the START of EVERY non-empty line (title and each body line).
|
||||
Never skip a line. Never put the emoji at the end. Never use two emojis on the same line.
|
||||
|
||||
Use these exact emoji for each kind of content:
|
||||
|
||||
TITLE emoji — pick by event type:
|
||||
✅ success / resolved / complete / reconnected
|
||||
@@ -1425,32 +1433,34 @@ A blank line must be completely empty — no emoji, no spaces.
|
||||
⏻ system shutdown
|
||||
|
||||
BODY LINE emoji — pick by what the line is about:
|
||||
🏷️ VM name / CT name / ID (first line of every VM/CT lifecycle event)
|
||||
✔️ status ok / success / action confirmed
|
||||
🏷️ VM name / CT name / ID / guest name
|
||||
✔️ status ok / success / completed
|
||||
❌ status error / failed
|
||||
💽 size (individual VM/CT)
|
||||
💽 size / tamaño / Größe
|
||||
💾 total backup size (summary line only)
|
||||
⏱️ duration
|
||||
🗄️ storage location / PBS path
|
||||
📦 total updates count
|
||||
🔒 security updates / jail
|
||||
🔄 proxmox updates
|
||||
⚙️ kernel updates / service name
|
||||
🗂️ important packages header
|
||||
🌐 source IP
|
||||
👤 user
|
||||
📝 reason / details
|
||||
🌡️ temperature
|
||||
🔥 CPU usage
|
||||
💧 memory usage
|
||||
📊 summary line / statistics
|
||||
👥 quorum / cluster nodes
|
||||
💿 disk device
|
||||
📂 filesystem / mount point
|
||||
📌 package item (pve_update only)
|
||||
🚦 severity
|
||||
🖥️ node name
|
||||
🎯 target node
|
||||
⏱️ duration / tiempo / Dauer
|
||||
🗄️ storage / almacenamiento / PBS
|
||||
🗃️ archive path / ruta de archivo
|
||||
📦 total updates / total actualizaciones
|
||||
🔒 security updates / actualizaciones de seguridad / jail
|
||||
🔄 proxmox updates / actualizaciones de proxmox
|
||||
⚙️ kernel updates / actualizaciones del kernel / service
|
||||
📋 important packages header (update_summary)
|
||||
🗂️ important packages header (pve_update) / file index / archive listing
|
||||
🌐 source IP / IP origen
|
||||
👤 user / usuario
|
||||
📝 reason / motivo / razón / details
|
||||
🌡️ temperature / temperatura
|
||||
🔥 CPU usage / uso de CPU
|
||||
💧 memory / memoria
|
||||
📊 statistics / load / carga / summary line
|
||||
👥 quorum / cluster
|
||||
💿 disk device / dispositivo
|
||||
📂 filesystem / mount / ruta
|
||||
📌 category / categoría
|
||||
🚦 severity / severidad
|
||||
🖥️ node / nodo
|
||||
🎯 target / destino
|
||||
🔹 current version (pve_update)
|
||||
🟢 new version (pve_update)
|
||||
|
||||
@@ -1551,7 +1561,13 @@ A blank line must be completely empty — no emoji, no spaces.
|
||||
⚠️ 1 sector currently unreadable (pending)
|
||||
📝 Disk reports sectors in pending reallocation state
|
||||
|
||||
EXAMPLE — VM failed:
|
||||
[TITLE]
|
||||
💥 pve01: VM web01 (100) FAILED
|
||||
[BODY]
|
||||
🏷️ Virtual machine web01 (ID: 100) failed to start.
|
||||
|
||||
📝 Reason: kernel segfault"""
|
||||
|
||||
# No emoji instructions for email/plain text channels
|
||||
AI_NO_EMOJI_INSTRUCTIONS = """
|
||||
|
||||
Reference in New Issue
Block a user