From 19c5af3ebc8e9c2bd25e71e78502f6df4d291916 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Wed, 1 May 2024 09:06:59 +0530 Subject: [PATCH] Handle natural language to cron translation error on web client --- src/khoj/interface/web/config_automation.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/khoj/interface/web/config_automation.html b/src/khoj/interface/web/config_automation.html index 89074796..1b067996 100644 --- a/src/khoj/interface/web/config_automation.html +++ b/src/khoj/interface/web/config_automation.html @@ -172,6 +172,17 @@ // Get cron string from natural language user schedule, if changed const crontime = scheduleEl.getAttribute('data-original') !== scheduleEl.value ? getCronString(scheduleEl.value) : scheduleEl.getAttribute('data-cron'); + if (crontime.startsWith("ERROR:")) { + notificationEl.textContent = `⚠️ Failed to automate. Fix or simplify Schedule input field.`; + notificationEl.style.display = "block"; + let originalScheduleElBorder = scheduleEl.style.border; + scheduleEl.style.border = "2px solid red"; + setTimeout(function() { + scheduleEl.style.border = originalScheduleElBorder; + }, 2000); + + return; + } const encodedCrontime = encodeURIComponent(crontime); // Construct query string and select method for API call