mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-28 12:40:26 +00:00
feat(cron): dynamic delivery options from API instead of hardcoded select
Replace the hardcoded 4-option deliver dropdown (local/discord/telegram/slack) with a dynamic select populated from a new GET /api/crons/delivery-options endpoint that reads _KNOWN_DELIVERY_PLATFORMS from hermes-agent. Key changes: - Add GET /api/crons/delivery-options endpoint returning all known platforms - Frontend loads options asynchronously on first cron form open, with caching - Enable deliver editing for existing jobs (was previously disabled) - Include deliver in update payload when editing cron jobs - Fallback to local-only if API unavailable - Custom deliver values (e.g. feishu:oc_xxx) shown with * suffix - Add cron_deliver_custom i18n key to all 12 locales - Add 5 integration tests for the new endpoint
This commit is contained in:
@@ -4781,6 +4781,12 @@ def handle_get(handler, parsed) -> bool:
|
||||
with cron_profile_context():
|
||||
return _handle_cron_status(handler, parsed)
|
||||
|
||||
if parsed.path == "/api/crons/delivery-options":
|
||||
from api.profiles import cron_profile_context
|
||||
|
||||
with cron_profile_context():
|
||||
return _handle_cron_delivery_options(handler)
|
||||
|
||||
# ── Skills API (GET) ──
|
||||
if parsed.path == "/api/skills":
|
||||
qs = parse_qs(parsed.query)
|
||||
@@ -9515,6 +9521,21 @@ def _handle_cron_create(handler, body):
|
||||
return j(handler, {"error": str(e)}, status=400)
|
||||
|
||||
|
||||
def _handle_cron_delivery_options(handler):
|
||||
"""Return available delivery platforms for cron jobs."""
|
||||
try:
|
||||
from cron.scheduler import _KNOWN_DELIVERY_PLATFORMS
|
||||
except Exception:
|
||||
_KNOWN_DELIVERY_PLATFORMS = frozenset()
|
||||
platforms = [
|
||||
{"value": "local", "label": "Local (save output only)"},
|
||||
{"value": "origin", "label": "Origin (reply to creator)"}
|
||||
]
|
||||
for name in sorted(_KNOWN_DELIVERY_PLATFORMS):
|
||||
platforms.append({"value": name, "label": name.capitalize()})
|
||||
return j(handler, {"platforms": platforms})
|
||||
|
||||
|
||||
def _handle_cron_update(handler, body):
|
||||
try:
|
||||
require(body, "job_id")
|
||||
|
||||
Reference in New Issue
Block a user