mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 17:08:03 +08:00
chore: use orjson in streaming event JSON serialisation for performance improvement (#24763)
This commit is contained in:
11
api/libs/orjson.py
Normal file
11
api/libs/orjson.py
Normal file
@ -0,0 +1,11 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
import orjson
|
||||
|
||||
|
||||
def orjson_dumps(
|
||||
obj: Any,
|
||||
encoding: str = "utf-8",
|
||||
option: Optional[int] = None,
|
||||
) -> str:
|
||||
return orjson.dumps(obj, option=option).decode(encoding)
|
||||
Reference in New Issue
Block a user