|
|
|
|
@ -5,6 +5,8 @@ from base64 import b64encode
|
|
|
|
|
from collections.abc import Mapping
|
|
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
|
|
from core.variables.utils import SegmentJSONEncoder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TemplateTransformer(ABC):
|
|
|
|
|
_code_placeholder: str = "{{code}}"
|
|
|
|
|
@ -95,7 +97,7 @@ class TemplateTransformer(ABC):
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def serialize_inputs(cls, inputs: Mapping[str, Any]) -> str:
|
|
|
|
|
inputs_json_str = json.dumps(inputs, ensure_ascii=False).encode()
|
|
|
|
|
inputs_json_str = json.dumps(inputs, ensure_ascii=False, cls=SegmentJSONEncoder).encode()
|
|
|
|
|
input_base64_encoded = b64encode(inputs_json_str).decode("utf-8")
|
|
|
|
|
return input_base64_encoded
|
|
|
|
|
|
|
|
|
|
|