mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-11 03:46:52 +08:00
fix: validate response type in transform_response method (#11931)
Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
@@ -33,13 +33,16 @@ class TemplateTransformer(ABC):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def transform_response(cls, response: str) -> dict:
|
def transform_response(cls, response: str):
|
||||||
"""
|
"""
|
||||||
Transform response to dict
|
Transform response to dict
|
||||||
:param response: response
|
:param response: response
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
return json.loads(cls.extract_result_str_from_response(response))
|
result = json.loads(cls.extract_result_str_from_response(response))
|
||||||
|
if not isinstance(result, dict):
|
||||||
|
raise ValueError("Result must be a dict")
|
||||||
|
return result
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user