refactor(chat): 简化 kaomoji 恢复函数的参数传递
将 `recover_kaomoji` 函数的调用从传递列表 `[s["..."]]` 改为直接传递字符串 `s["..."]`。此更改简化了代码,并与函数预期的输入类型保持一致,提高了代码的可读性和健壮性。
This commit is contained in:
committed by
Windpicker-owo
parent
c75d53a6b5
commit
2784e59a36
@@ -369,8 +369,8 @@ def process_llm_response(
|
|||||||
recovered_sentences = []
|
recovered_sentences = []
|
||||||
for s in sentences:
|
for s in sentences:
|
||||||
if isinstance(s, dict) and s.get("type") == "typo":
|
if isinstance(s, dict) and s.get("type") == "typo":
|
||||||
s["original"] = recover_kaomoji([s["original"]], kaomoji_mapping)
|
s["original"] = recover_kaomoji(s["original"], kaomoji_mapping)
|
||||||
s["typo"] = recover_kaomoji([s["typo"]], kaomoji_mapping)
|
s["typo"] = recover_kaomoji(s["typo"], kaomoji_mapping)
|
||||||
s["correction"] = recover_kaomoji(s["correction"], kaomoji_mapping)
|
s["correction"] = recover_kaomoji(s["correction"], kaomoji_mapping)
|
||||||
recovered_sentences.append(s)
|
recovered_sentences.append(s)
|
||||||
elif isinstance(s, dict) and s.get("type") == "text":
|
elif isinstance(s, dict) and s.get("type") == "text":
|
||||||
|
|||||||
Reference in New Issue
Block a user