fix(chat): 修复typo_generator中词典文件的路径问题

词典文件的路径从依赖`rjieba`包的位置改为相对于当前文件的相对路径,以确保在不同环境下都能正确找到文件。
This commit is contained in:
minecraft1024a
2025-10-06 20:45:17 +08:00
parent b7a255c4ae
commit dea897d9aa
2 changed files with 349046 additions and 1 deletions

349045
src/chat/utils/dict.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -56,7 +56,7 @@ class ChineseTypoGenerator:
# 使用内置的词频文件
char_freq = defaultdict(int)
dict_path = os.path.join(os.path.dirname(rjieba.__file__), "dict.txt")
dict_path = os.path.join(os.path.dirname(__file__), "dict.txt")
# 读取rjieba的词典文件
with open(dict_path, encoding="utf-8") as f: