diff --git a/api/routes.py b/api/routes.py index a8d32521..c80d74aa 100644 --- a/api/routes.py +++ b/api/routes.py @@ -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") diff --git a/static/i18n.js b/static/i18n.js index 4913139d..b746cee5 100644 --- a/static/i18n.js +++ b/static/i18n.js @@ -1206,6 +1206,7 @@ const LOCALES = { cron_prompt_label: 'Prompt', cron_deliver_label: 'Deliver output to', cron_deliver_local: 'Local (save output only)', + cron_deliver_custom: 'Custom delivery target', cron_profile_label: 'Profile', cron_profile_server_default: 'server default', cron_profile_server_default_hint: 'Uses the WebUI server default profile at run time. Existing jobs without a profile keep this legacy behavior.', @@ -2477,6 +2478,7 @@ const LOCALES = { cron_prompt_label: 'Prompt', cron_deliver_label: 'Recapita output a', cron_deliver_local: 'Locale (solo salva output)', + cron_deliver_custom: 'Destinazione personalizzata', cron_profile_label: 'Profilo', cron_profile_server_default: 'predefinito server', cron_profile_server_default_hint: 'Usa il profilo predefinito del server WebUI a runtime. I job esistenti senza profilo mantengono questo comportamento legacy.', @@ -3753,6 +3755,7 @@ const LOCALES = { cron_prompt_label: 'プロンプト', cron_deliver_label: '出力先', cron_deliver_local: 'ローカル (出力を保存のみ)', + cron_deliver_custom: 'カスタム配信先', cron_profile_label: 'プロフィール', cron_profile_server_default: 'サーバーデフォルト', cron_profile_server_default_hint: '実行時に WebUI サーバーのデフォルトプロフィールを使用します。プロフィールのない既存ジョブはこの従来の動作を維持します。', @@ -4793,6 +4796,7 @@ const LOCALES = { cron_prompt_label: 'Запрос', cron_deliver_label: 'Доставлять вывод', cron_deliver_local: 'Локально (только сохранение)', + cron_deliver_custom: 'Пользовательская доставка', cron_profile_label: 'Профиль', cron_profile_server_default: 'по умолчанию сервера', cron_profile_server_default_hint: 'Использует профиль WebUI-сервера по умолчанию во время запуска. Существующие задания без профиля сохраняют это поведение.', @@ -5990,6 +5994,7 @@ const LOCALES = { cron_prompt_label: 'Prompt', cron_deliver_label: 'Entregar salida a', cron_deliver_local: 'Local (solo guardar salida)', + cron_deliver_custom: 'Destino personalizado', cron_profile_label: 'Perfil', cron_profile_server_default: 'predeterminado del servidor', cron_profile_server_default_hint: 'Usa el perfil predeterminado del servidor WebUI durante la ejecución. Los trabajos existentes sin perfil conservan este comportamiento heredado.', @@ -6903,6 +6908,7 @@ const LOCALES = { cron_prompt_label: 'Prompt', cron_deliver_label: 'Ausgabe senden an', cron_deliver_local: 'Lokal (nur speichern)', + cron_deliver_custom: 'Benutzerdefiniertes Ziel', cron_profile_label: 'Profil', cron_profile_server_default: 'Serverstandard', cron_profile_server_default_hint: 'Verwendet zur Laufzeit das Standardprofil des WebUI-Servers. Bestehende Jobs ohne Profil behalten dieses Legacy-Verhalten.', @@ -8417,6 +8423,7 @@ const LOCALES = { cron_prompt_label: '提示词', cron_deliver_label: '输出位置', cron_deliver_local: '本地(仅保存输出)', + cron_deliver_custom: '自定义推送目标', cron_profile_label: '配置档', cron_profile_server_default: '服务器默认', cron_profile_server_default_hint: '运行时使用 WebUI 服务器默认配置档。没有配置档的现有作业会保留此旧行为。', @@ -9841,6 +9848,7 @@ const LOCALES = { cron_prompt_label: '提示', cron_deliver_label: '發送至', cron_deliver_local: '僅本地儲存', + cron_deliver_custom: '自訂推送目標', cron_profile_label: '設定檔', cron_profile_server_default: '伺服器預設', cron_profile_server_default_hint: '執行時使用 WebUI 伺服器預設設定檔。沒有設定檔的既有工作會保留此舊行為。', @@ -10919,6 +10927,7 @@ const LOCALES = { cron_prompt_label: 'Prompt', cron_deliver_label: 'Entregar output para', cron_deliver_local: 'Local (salvar output apenas)', + cron_deliver_custom: 'Destino personalizado', cron_profile_label: 'Perfil', cron_profile_server_default: 'padrão do servidor', cron_profile_server_default_hint: 'Usa o perfil padrão do servidor WebUI no momento da execução. Tarefas existentes sem perfil mantêm esse comportamento legado.', @@ -12163,6 +12172,7 @@ const LOCALES = { cron_prompt_label: 'Prompt', cron_deliver_label: 'Deliver output to', cron_deliver_local: 'Local (save output only)', + cron_deliver_custom: '사용자 지정 전달 대상', cron_profile_label: 'Profile', cron_profile_server_default: 'server default', cron_profile_server_default_hint: 'Uses the WebUI server default profile at run time. Existing jobs without a profile keep this legacy behavior.', @@ -13340,6 +13350,7 @@ const LOCALES = { cron_prompt_label: 'Rapide', cron_deliver_label: 'Livrer la sortie à', cron_deliver_local: 'Local (enregistrer la sortie uniquement)', + cron_deliver_custom: 'Destination personnalisee', cron_profile_label: 'Profil', cron_profile_server_default: 'serveur par défaut', cron_profile_server_default_hint: 'Utilise le profil par défaut du serveur WebUI au moment de l\'exécution. Les tâches existantes sans profil conservent ce comportement hérité.', @@ -14638,6 +14649,7 @@ const LOCALES = { cron_prompt_label: 'Çabuk', cron_deliver_label: 'Çıktıyı şuraya ilet:', cron_deliver_local: 'Yerel (yalnızca çıktıyı kaydet)', + cron_deliver_custom: 'Ozel teslimat hedefi', cron_profile_label: 'Profil', cron_profile_server_default: 'sunucu varsayılanı', cron_profile_server_default_hint: 'Çalışma zamanında WebUI sunucusunun varsayılan profilini kullanır. Profili olmayan mevcut işler bu eski davranışı sürdürüyor.', diff --git a/static/panels.js b/static/panels.js index a04f45b1..ec6409a9 100644 --- a/static/panels.js +++ b/static/panels.js @@ -847,6 +847,7 @@ let _cronSelectedSkills=[]; let _cronIsDuplicate = false; let _cronSkillsCache=null; let _cronProfilesCache=null; +let _cronDeliveryOptionsCache=null; function openCronCreate(){ if (typeof switchPanel === 'function' && _currentPanel !== 'tasks') switchPanel('tasks'); @@ -894,7 +895,6 @@ function _renderCronForm({ name, schedule, prompt, deliver, profile, toast_notif const isNoAgent = !!no_agent; const toastNotifications = toast_notifications !== false; title.textContent = isEdit ? (t('edit') + ' · ' + (name || schedule || t('scheduled_jobs'))) : t('new_job'); - const deliverOpt = (v,l) => ``; body.innerHTML = `