From 2784e59a368e4de4df68e5fd86591e41629978b3 Mon Sep 17 00:00:00 2001 From: minecraft1024a Date: Sat, 6 Sep 2025 16:24:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(chat):=20=E7=AE=80=E5=8C=96=20kaomoji?= =?UTF-8?q?=20=E6=81=A2=E5=A4=8D=E5=87=BD=E6=95=B0=E7=9A=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=BC=A0=E9=80=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 `recover_kaomoji` 函数的调用从传递列表 `[s["..."]]` 改为直接传递字符串 `s["..."]`。此更改简化了代码,并与函数预期的输入类型保持一致,提高了代码的可读性和健壮性。 --- src/chat/utils/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chat/utils/utils.py b/src/chat/utils/utils.py index b488e3a87..16a1d6217 100644 --- a/src/chat/utils/utils.py +++ b/src/chat/utils/utils.py @@ -369,8 +369,8 @@ def process_llm_response( recovered_sentences = [] for s in sentences: if isinstance(s, dict) and s.get("type") == "typo": - s["original"] = recover_kaomoji([s["original"]], kaomoji_mapping) - s["typo"] = recover_kaomoji([s["typo"]], kaomoji_mapping) + s["original"] = recover_kaomoji(s["original"], kaomoji_mapping) + s["typo"] = recover_kaomoji(s["typo"], kaomoji_mapping) s["correction"] = recover_kaomoji(s["correction"], kaomoji_mapping) recovered_sentences.append(s) elif isinstance(s, dict) and s.get("type") == "text":