This commit is contained in:
Timothy Jaeryang Baek
2026-04-17 12:55:56 +09:00
parent 3dd8255816
commit e709d6812f
2 changed files with 5 additions and 6 deletions
+4 -6
View File
@@ -2494,7 +2494,6 @@ async def create_automation(
name: str,
prompt: str,
rrule: str,
model_id: Optional[str] = None,
__request__: Request = None,
__user__: dict = None,
__metadata__: dict = None,
@@ -2502,6 +2501,7 @@ async def create_automation(
"""
Create a scheduled automation that runs a prompt on a recurring or one-time schedule.
Use this when the user wants to schedule a task to run automatically.
The automation will use the current chat model.
The rrule parameter must be a valid iCalendar RRULE string. Common examples:
- Every day at 9am: "DTSTART:20250101T090000\\nRRULE:FREQ=DAILY"
@@ -2516,7 +2516,6 @@ async def create_automation(
:param name: A short descriptive name for the automation
:param prompt: The prompt/instructions to execute on each run
:param rrule: An iCalendar RRULE string defining the schedule
:param model_id: Optional model ID to use. Defaults to the current chat model if omitted.
:return: JSON with the created automation details including id, next scheduled runs
"""
if __request__ is None:
@@ -2535,11 +2534,10 @@ async def create_automation(
if not user:
return json.dumps({'error': 'User not found'})
# Default to current chat's model if not specified
# Always use the calling model for the automation
model_id = (__metadata__ or {}).get('model_id')
if not model_id:
model_id = (__metadata__ or {}).get('model_id') or (__metadata__ or {}).get('model')
if not model_id:
return json.dumps({'error': 'model_id is required (could not detect current model)'})
return json.dumps({'error': 'Could not detect current model'})
# Validate the RRULE
try:
+1
View File
@@ -2460,6 +2460,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
metadata = {
**metadata,
'model_id': form_data.get('model'),
'tool_ids': tool_ids,
'terminal_id': terminal_id,
'files': files,