mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-18 10:02:16 +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.
|
the raw technical string appears inside a longer sentence.
|
||||||
{emoji_instructions}
|
{emoji_instructions}
|
||||||
|
|
||||||
|
═══ KNOWN MESSAGE TYPES AND HOW TO FORMAT THEM ═══
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
═══ MESSAGE TYPES — FORMAT RULES ═══
|
|
||||||
|
|
||||||
BACKUP (backup_complete / backup_fail / backup_start):
|
BACKUP (backup_complete / backup_fail / backup_start):
|
||||||
Input contains: VM/CT names, IDs, size, duration, storage location, status per VM
|
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.
|
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
|
like "Backup partially failed" / "Copia de seguridad parcialmente fallida" — never say
|
||||||
"backup failed" when there are also successful VMs in the same job.
|
"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.
|
NEVER omit the storage/archive line or the summary line — always include them even for long jobs.
|
||||||
|
|
||||||
UPDATES (update_summary):
|
UPDATES (update_summary / pve_update):
|
||||||
- Each count on its own line with its label.
|
Input contains: total count, security count, proxmox count, kernel count, package list
|
||||||
- Package list uses "• " (bullet + space) per package, NOT the 🗂️ emoji on each line.
|
Output body must show each count on its own line with its label.
|
||||||
- The 🗂️ emoji goes only on the "Important packages:" header line.
|
For the package list: use "• " (bullet + space) before each package name, NOT the 📋 emoji.
|
||||||
- NEVER add a redundant summary line repeating the total count.
|
The 📋 emoji goes only on the "Important packages:" header line.
|
||||||
|
|
||||||
PVE UPDATE (pve_update):
|
EXAMPLE — pve_update (new Proxmox VE version):
|
||||||
- First line: plain sentence announcing the new version (no emoji on this line).
|
- First line: plain sentence announcing the new version (no emoji — it goes on the title)
|
||||||
- Blank line after intro.
|
- Blank line after the intro sentence
|
||||||
- Current version: 🔹 prefix | New version: 🟢 prefix
|
- Current version line: 🔹 prefix
|
||||||
- Blank line before packages block.
|
- New version line: 🟢 prefix
|
||||||
- Packages header: 🗂️ | Package lines: 📌 prefix with version arrow v{{old}} ➜ v{{new}}
|
- 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):
|
DISK / SMART ERRORS (disk_io_error / storage_unavailable):
|
||||||
Input contains: device name, error type, SMART values or I/O error codes
|
Input contains: device name, error type, SMART values or I/O error codes
|
||||||
Output body: device, then the specific error or failing attribute
|
Output body: device, then the specific error or failing attribute
|
||||||
DEDUPLICATION: Input may contain repeated or similar information from multiple sources.
|
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,
|
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.
|
consolidate them into a single, clear statement. Never repeat the same information twice.
|
||||||
|
|
||||||
RESOURCES (cpu_high / ram_high / temp_high / load_high):
|
RESOURCES (cpu_high / ram_high / temp_high / load_high):
|
||||||
Input contains: current value, threshold, core count
|
Input contains: current value, threshold, core count
|
||||||
Output: current value vs threshold, context if available
|
Output: current value vs threshold, context if available
|
||||||
|
|
||||||
SECURITY (auth_fail / ip_block):
|
SECURITY (auth_fail / ip_block):
|
||||||
Input contains: source IP, user, service, jail, failure count
|
Input contains: source IP, user, service, jail, failure count
|
||||||
Output: list each field on its own line
|
Output: list each field on its own line
|
||||||
|
|
||||||
VM/CT LIFECYCLE (vm_start, vm_stop, vm_shutdown, vm_fail, vm_restart,
|
VM/CT LIFECYCLE (vm_start, vm_stop, vm_fail, ct_*, migration_*, replication_*):
|
||||||
ct_start, ct_stop, ct_shutdown, ct_fail, ct_restart,
|
Input contains: VM name, ID, target node (migrations), reason (failures)
|
||||||
migration_start, migration_complete, migration_fail,
|
Output: one or two lines confirming the event with key facts
|
||||||
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]
|
|
||||||
|
|
||||||
CLUSTER (split_brain / node_disconnect / node_reconnect):
|
CLUSTER (split_brain / node_disconnect / node_reconnect):
|
||||||
Input: node name, quorum status
|
Input: node name, quorum status
|
||||||
Output: state change + quorum value
|
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):
|
HEALTH (new_error / error_resolved / health_persistent / health_degraded):
|
||||||
Input: category, severity, duration, reason
|
Input: category, severity, duration, reason
|
||||||
Output: what changed, in which category, for how long (if resolved)
|
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]
|
[TITLE]
|
||||||
translated title here
|
translated title here
|
||||||
[BODY]
|
[BODY]
|
||||||
translated body here
|
translated body here
|
||||||
|
|
||||||
CRITICAL:
|
CRITICAL OUTPUT RULES:
|
||||||
- [TITLE] on its own line, title text on the very next line — no blank line between them
|
- Write [TITLE] on its own line, then the title on the very next line
|
||||||
- [BODY] on its own line, body text starting on the very next line — no blank line between them
|
- Write [BODY] on its own line, then the body starting on the very next line
|
||||||
- Do NOT write "Title:", "Body:", or any label substituting the markers
|
- 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 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 = """
|
AI_EMOJI_INSTRUCTIONS = """
|
||||||
═══ EMOJI RULES ═══
|
EMOJI USAGE — place ONE emoji at the START of EVERY non-empty line (title and each body line).
|
||||||
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.
|
||||||
Never skip a line. Never put the emoji at the end.
|
|
||||||
A blank line must be completely empty — no emoji, no spaces.
|
|
||||||
|
|
||||||
|
|
||||||
|
Use these exact emoji for each kind of content:
|
||||||
|
|
||||||
TITLE emoji — pick by event type:
|
TITLE emoji — pick by event type:
|
||||||
✅ success / resolved / complete / reconnected
|
✅ success / resolved / complete / reconnected
|
||||||
@@ -1425,32 +1433,34 @@ A blank line must be completely empty — no emoji, no spaces.
|
|||||||
⏻ system shutdown
|
⏻ system shutdown
|
||||||
|
|
||||||
BODY LINE emoji — pick by what the line is about:
|
BODY LINE emoji — pick by what the line is about:
|
||||||
🏷️ VM name / CT name / ID (first line of every VM/CT lifecycle event)
|
🏷️ VM name / CT name / ID / guest name
|
||||||
✔️ status ok / success / action confirmed
|
✔️ status ok / success / completed
|
||||||
❌ status error / failed
|
❌ status error / failed
|
||||||
💽 size (individual VM/CT)
|
💽 size / tamaño / Größe
|
||||||
💾 total backup size (summary line only)
|
💾 total backup size (summary line only)
|
||||||
⏱️ duration
|
⏱️ duration / tiempo / Dauer
|
||||||
🗄️ storage location / PBS path
|
🗄️ storage / almacenamiento / PBS
|
||||||
📦 total updates count
|
🗃️ archive path / ruta de archivo
|
||||||
🔒 security updates / jail
|
📦 total updates / total actualizaciones
|
||||||
🔄 proxmox updates
|
🔒 security updates / actualizaciones de seguridad / jail
|
||||||
⚙️ kernel updates / service name
|
🔄 proxmox updates / actualizaciones de proxmox
|
||||||
🗂️ important packages header
|
⚙️ kernel updates / actualizaciones del kernel / service
|
||||||
🌐 source IP
|
📋 important packages header (update_summary)
|
||||||
👤 user
|
🗂️ important packages header (pve_update) / file index / archive listing
|
||||||
📝 reason / details
|
🌐 source IP / IP origen
|
||||||
🌡️ temperature
|
👤 user / usuario
|
||||||
🔥 CPU usage
|
📝 reason / motivo / razón / details
|
||||||
💧 memory usage
|
🌡️ temperature / temperatura
|
||||||
📊 summary line / statistics
|
🔥 CPU usage / uso de CPU
|
||||||
👥 quorum / cluster nodes
|
💧 memory / memoria
|
||||||
💿 disk device
|
📊 statistics / load / carga / summary line
|
||||||
📂 filesystem / mount point
|
👥 quorum / cluster
|
||||||
📌 package item (pve_update only)
|
💿 disk device / dispositivo
|
||||||
🚦 severity
|
📂 filesystem / mount / ruta
|
||||||
🖥️ node name
|
📌 category / categoría
|
||||||
🎯 target node
|
🚦 severity / severidad
|
||||||
|
🖥️ node / nodo
|
||||||
|
🎯 target / destino
|
||||||
🔹 current version (pve_update)
|
🔹 current version (pve_update)
|
||||||
🟢 new 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)
|
⚠️ 1 sector currently unreadable (pending)
|
||||||
📝 Disk reports sectors in pending reallocation state
|
📝 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
|
# No emoji instructions for email/plain text channels
|
||||||
AI_NO_EMOJI_INSTRUCTIONS = """
|
AI_NO_EMOJI_INSTRUCTIONS = """
|
||||||
|
|||||||
Reference in New Issue
Block a user