File size: 231 Bytes
105f2e1
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import json


def json_response(payload: dict) -> str:
    return json.dumps(payload, ensure_ascii=False, indent=2)


def tail_text(text: str, limit: int = 4000) -> str:
    if not text:
        return ""
    return text[-limit:]