mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-17 09:51:35 +00:00
feat: notify automation owners when a run fails (#33331)
When a scheduled automation failed (for example because its model was deleted), the owner could only see it as an error in the run history, so they found out much later when the results stopped showing up. Automation run failed is now one of the automatic events users can pick for their notification targets under Settings > Notifications, and every failed run, scheduled or started by hand, sends the automation name and the error to those targets. In Admin Settings > General > Events, webhooks set to Specific users or groups now receive these failures when the owner is among those users or groups, and webhooks set to System events only stop receiving them. Closes #33228
This commit is contained in:
parent
77398eba31
commit
e49ff5df64
2 changed files with 10 additions and 3 deletions
|
|
@ -705,6 +705,7 @@ NOTIFICATION_EVENTS = (
|
|||
EVENTS.CHANNEL_MESSAGE.name,
|
||||
EVENTS.CALENDAR_ALERT.name,
|
||||
EVENTS.RETRIEVAL_CONTENT_PROCESS_FAILED.name,
|
||||
EVENTS.AUTOMATION_RUN_FAILED.name,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ async def execute_automation(app, automation: AutomationModel) -> None:
|
|||
EVENTS.AUTOMATION_RUN_FAILED,
|
||||
actor=user,
|
||||
subject_id=automation.id,
|
||||
data={'name': automation.name, 'error': error},
|
||||
data={'name': automation.name, 'error': error, 'message': f'{automation.name}: {error}'},
|
||||
)
|
||||
return
|
||||
|
||||
|
|
@ -470,7 +470,7 @@ async def execute_automation(app, automation: AutomationModel) -> None:
|
|||
EVENTS.AUTOMATION_RUN_FAILED,
|
||||
actor=user,
|
||||
subject_id=automation.id,
|
||||
data={'name': automation.name, 'error': error},
|
||||
data={'name': automation.name, 'error': error, 'message': f'{automation.name}: {error}'},
|
||||
)
|
||||
return
|
||||
|
||||
|
|
@ -559,7 +559,13 @@ async def execute_automation(app, automation: AutomationModel) -> None:
|
|||
app,
|
||||
EVENTS.AUTOMATION_RUN_FAILED,
|
||||
subject_id=automation.id,
|
||||
data={'name': automation.name, 'error': error, **({'chat_id': chat.id} if chat else {})},
|
||||
data={
|
||||
'name': automation.name,
|
||||
'error': error,
|
||||
'user_id': automation.user_id,
|
||||
'message': f'{automation.name}: {error}',
|
||||
**({'chat_id': chat.id} if chat else {}),
|
||||
},
|
||||
)
|
||||
if isinstance(e, asyncio.CancelledError):
|
||||
raise
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue