MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / process_response

Function process_response

SwissArmyTransformer/examples/chatglm/chat_sat.py:55–68  ·  view source on GitHub ↗
(response)

Source from the content-addressed store, hash-verified

53 return tokens, attention_mask, position_ids
54
55def process_response(response):
56 response = response.strip()
57 response = response.replace("[[训练时间]]", "2023年")
58 punkts = [
59 [",", ","],
60 ["!", "!"],
61 [":", ":"],
62 [";", ";"],
63 ["\?", "?"],
64 ]
65 for item in punkts:
66 response = re.sub(r"([\u4e00-\u9fff])%s" % item[0], r"\1%s" % item[1], response)
67 response = re.sub(r"%s([\u4e00-\u9fff])" % item[0], r"%s\1" % item[1], response)
68 return response
69
70def chat(model, tokenizer,
71 query: str, history: List[Tuple[str, str]] = None,

Callers 1

chatFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected