mirror of https://github.com/langgenius/dify.git
feat(trigger): trigger plugin protocol improvements
This commit is contained in:
parent
a152ce45d3
commit
dff536ab6d
|
|
@ -37,7 +37,8 @@ def trigger_endpoint(endpoint_id: str):
|
|||
return jsonify({"error": "Endpoint not found"}), 404
|
||||
return response
|
||||
except ValueError as e:
|
||||
raise NotFound(str(e))
|
||||
logger.exception("Endpoint processing failed for {endpoint_id}: {e}")
|
||||
return jsonify({"error": "Endpoint processing failed", "message": str(e)}), 500
|
||||
except Exception as e:
|
||||
logger.exception("Webhook processing failed for {endpoint_id}")
|
||||
return jsonify({"error": "Internal server error", "message": str(e)}), 500
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import binascii
|
||||
import json
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Literal, Optional
|
||||
|
||||
|
|
@ -247,6 +248,16 @@ class TriggerInvokeEventResponse(BaseModel):
|
|||
variables: Mapping[str, Any] = Field(default_factory=dict)
|
||||
cancelled: Optional[bool] = False
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=(), arbitrary_types_allowed=True)
|
||||
|
||||
@field_validator("variables", mode="before")
|
||||
@classmethod
|
||||
def convert_variables(cls, v):
|
||||
if isinstance(v, str):
|
||||
return json.loads(v)
|
||||
else:
|
||||
return v
|
||||
|
||||
|
||||
class TriggerSubscriptionResponse(BaseModel):
|
||||
subscription: dict[str, Any]
|
||||
|
|
|
|||
Loading…
Reference in New Issue