mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-22 10:25:23 -04:00
chore: bump dify_plugin version to 0.6.0b7 and update trigger event handling
- Updated the version in pyproject.toml from 0.6.0b6 to 0.6.0b7. - Renamed trigger-related methods and classes for clarity, changing invoke_trigger to invoke_trigger_event and updating associated request and response classes. - Adjusted event handling in the GithubTrigger class to improve event dispatching. These changes ensure the plugin is up-to-date and enhance the clarity and functionality of event handling.
This commit is contained in:
@@ -41,9 +41,8 @@ class GithubTrigger(Trigger):
|
||||
|
||||
payload: Mapping[str, Any] = self._validate_payload(request)
|
||||
response = Response(response='{"status": "ok"}', status=200, mimetype="application/json")
|
||||
return EventDispatch(
|
||||
events=[self._dispatch_trigger_event(event_type=event_type, payload=payload)], response=response
|
||||
)
|
||||
event: str = self._dispatch_trigger_event(event_type=event_type, payload=payload)
|
||||
return EventDispatch(events=[event] if event else [], response=response)
|
||||
|
||||
def _dispatch_trigger_event(self, event_type: str, payload: Mapping[str, Any]) -> str:
|
||||
event_type = event_type.lower()
|
||||
@@ -54,7 +53,10 @@ class GithubTrigger(Trigger):
|
||||
if event_type == "issue_comments":
|
||||
return f"issue_comment_{action}"
|
||||
|
||||
raise TriggerDispatchError(f"Unsupported event type: {event_type}")
|
||||
if event_type == "star":
|
||||
return f"star_{action}"
|
||||
|
||||
return ""
|
||||
|
||||
def _validate_payload(self, request: Request) -> Mapping[str, Any]:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user