-
Notifications
You must be signed in to change notification settings - Fork 44.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(platform): Support manually setting up webhooks (#8750)
- Resolves #8748 The webhooks system as is works really well for full blown enterprise webhooks managed via a UI. It does not work for more "chill guy" webhook tools that just send notifications sometimes. ## Changes 🏗️ - feat(blocks): Add Compass transcription trigger block - feat(backend): Amend webhooks system to support manual-set-up webhooks - Make event filter input optional on webhook-triggered nodes - Make credentials optional on webhook-triggered nodes - Add code path to re-use existing manual webhook on graph update - Add `ManualWebhookManagerBase` - feat(frontend): Add UI to pass webhook URL to user on manual-set-up webhook blocks ![image](https://github.com/user-attachments/assets/1c35f161-7fe4-4916-8506-5ca9a838f398) - fix(backend): Strip webhook info from node objects for graph export - refactor(backend): Rename `backend.integrations.webhooks.base` to `._base` --------- Co-authored-by: Reinier van der Leer <[email protected]> Co-authored-by: Zamil Majdy <[email protected]>
- Loading branch information
1 parent
89a9354
commit 746f3d4
Showing
19 changed files
with
449 additions
and
132 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
autogpt_platform/backend/backend/blocks/compass/triggers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from pydantic import BaseModel | ||
|
||
from backend.data.block import ( | ||
Block, | ||
BlockCategory, | ||
BlockManualWebhookConfig, | ||
BlockOutput, | ||
BlockSchema, | ||
) | ||
from backend.data.model import SchemaField | ||
from backend.integrations.webhooks.compass import CompassWebhookType | ||
|
||
|
||
class Transcription(BaseModel): | ||
text: str | ||
speaker: str | ||
end: float | ||
start: float | ||
duration: float | ||
|
||
|
||
class TranscriptionDataModel(BaseModel): | ||
date: str | ||
transcription: str | ||
transcriptions: list[Transcription] | ||
|
||
|
||
class CompassAITriggerBlock(Block): | ||
class Input(BlockSchema): | ||
payload: TranscriptionDataModel = SchemaField(hidden=True) | ||
|
||
class Output(BlockSchema): | ||
transcription: str = SchemaField( | ||
description="The contents of the compass transcription." | ||
) | ||
|
||
def __init__(self): | ||
super().__init__( | ||
id="9464a020-ed1d-49e1-990f-7f2ac924a2b7", | ||
description="This block will output the contents of the compass transcription.", | ||
categories={BlockCategory.HARDWARE}, | ||
input_schema=CompassAITriggerBlock.Input, | ||
output_schema=CompassAITriggerBlock.Output, | ||
webhook_config=BlockManualWebhookConfig( | ||
provider="compass", | ||
webhook_type=CompassWebhookType.TRANSCRIPTION, | ||
), | ||
test_input=[ | ||
{"input": "Hello, World!"}, | ||
{"input": "Hello, World!", "data": "Existing Data"}, | ||
], | ||
# test_output=[ | ||
# ("output", "Hello, World!"), # No data provided, so trigger is returned | ||
# ("output", "Existing Data"), # Data is provided, so data is returned. | ||
# ], | ||
) | ||
|
||
def run(self, input_data: Input, **kwargs) -> BlockOutput: | ||
yield "transcription", input_data.payload.transcription |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.