Googolplexic commited on
Commit
d72e516
·
1 Parent(s): 5389598

refactor: enhance API configuration validation and update UI for start time input

Browse files
Files changed (2) hide show
  1. api_monitor.py +6 -7
  2. main.py +3 -3
api_monitor.py CHANGED
@@ -89,7 +89,7 @@ def validate_api_configuration(
89
  additional_params,
90
  schedule_interval_minutes,
91
  stop_after_hours,
92
- start_at,
93
  ):
94
  """
95
  TOOL: Validate and store API configuration for monitoring.
@@ -118,10 +118,11 @@ def validate_api_configuration(
118
  - param_keys_values: Parameter key-value pairs, one per line
119
  - header_keys_values: Header key-value pairs, one per line
120
  - additional_params: Optional JSON string for complex parameters - schedule_interval_minutes: Minutes between calls
121
- - stop_after_hours: Hours after which to stop (supports decimals, max 168 = 1 week)
122
- - start_at: When to start the monitoring (datetime string or None for immediate)
 
123
 
124
- Input Examples: 1. Simple GET request to monitor stock price:
125
  mcp_api_key: "your_mcp_key_here"
126
  name: "NVDA Stock Price"
127
  description: "Monitor NVIDIA stock price every 30 minutes"
@@ -133,9 +134,7 @@ def validate_api_configuration(
133
  additional_params: "{}"
134
  schedule_interval_minutes: 30
135
  stop_after_hours: 1.5
136
- start_at: ""
137
-
138
- 2. API with complex parameters:
139
  mcp_api_key: "your_mcp_key_here"
140
  name: "Weather Alert Monitor"
141
  description: "Monitor severe weather alerts"
 
89
  additional_params,
90
  schedule_interval_minutes,
91
  stop_after_hours,
92
+ start_at, # IMPORTANT: Use empty string "" for immediate start (most common case)
93
  ):
94
  """
95
  TOOL: Validate and store API configuration for monitoring.
 
118
  - param_keys_values: Parameter key-value pairs, one per line
119
  - header_keys_values: Header key-value pairs, one per line
120
  - additional_params: Optional JSON string for complex parameters - schedule_interval_minutes: Minutes between calls
121
+ - stop_after_hours: Hours after which to stop (supports decimals, max 168 = 1 week) - start_at: Optional datetime string for when to start the monitoring.
122
+ IMPORTANT: Leave as empty string "" for immediate start (most common use case).
123
+ Only provide a datetime string (e.g., "2024-06-15 09:00:00") if you need to schedule monitoring for a specific future time.
124
 
125
+ Input Examples: 1. Simple GET request to monitor stock price (IMMEDIATE START - most common):
126
  mcp_api_key: "your_mcp_key_here"
127
  name: "NVDA Stock Price"
128
  description: "Monitor NVIDIA stock price every 30 minutes"
 
134
  additional_params: "{}"
135
  schedule_interval_minutes: 30
136
  stop_after_hours: 1.5
137
+ start_at: "" 2. API with complex parameters (SCHEDULED START):
 
 
138
  mcp_api_key: "your_mcp_key_here"
139
  name: "Weather Alert Monitor"
140
  description: "Monitor severe weather alerts"
main.py CHANGED
@@ -41,14 +41,14 @@ validation_tab = gr.Interface(
41
  value="{}",
42
  ),
43
  gr.Number(
44
- label="Schedule Interval (minutes)", value=20, minimum=1, maximum=1440
45
  ),
46
  gr.Number(
47
  label="Stop After (hours)", value=24, minimum=0.1, maximum=168, step=0.1
48
  ),
49
  gr.Textbox(
50
- label="Start Time (optional)",
51
- placeholder="YYYY-MM-DD HH:MM:SS or leave empty for immediate start",
52
  value="",
53
  ),
54
  ],
 
41
  value="{}",
42
  ),
43
  gr.Number(
44
+ label="Schedule Interval (minutes)", value=20, minimum=0.1, maximum=1440
45
  ),
46
  gr.Number(
47
  label="Stop After (hours)", value=24, minimum=0.1, maximum=168, step=0.1
48
  ),
49
  gr.Textbox(
50
+ label="Start Time (optional - leave empty for immediate start)",
51
+ placeholder="Leave empty for immediate start, or enter YYYY-MM-DD HH:MM:SS for scheduled start",
52
  value="",
53
  ),
54
  ],