mirror of https://github.com/Mai-with-u/MaiBot.git
123
parent
5d1915cab5
commit
e092a3a56e
|
|
@ -332,9 +332,9 @@ def random_remove_punctuation(text: str) -> str:
|
|||
|
||||
def process_llm_response(text: str) -> List[str]:
|
||||
# processed_response = process_text_with_typos(content)
|
||||
if len(text) > 200:
|
||||
logger.warning(f"回复过长 ({len(text)} 字符),返回默认回复")
|
||||
return ['懒得说']
|
||||
# if len(text) > 200:
|
||||
# logger.warning(f"回复过长 ({len(text)} 字符),返回默认回复")
|
||||
# return ['懒得说']
|
||||
# 处理长消息
|
||||
typo_generator = ChineseTypoGenerator(
|
||||
error_rate=global_config.chinese_typo_error_rate,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class WillingManager:
|
|||
self.group_reply_willing = {} # 存储每个群的回复意愿
|
||||
self._decay_task = None
|
||||
self._started = False
|
||||
self.min_reply_willing = 0.01
|
||||
self.min_reply_willing = 0.15
|
||||
self.attenuation_coefficient = 0.75
|
||||
|
||||
async def _decay_reply_willing(self):
|
||||
|
|
@ -41,6 +41,9 @@ class WillingManager:
|
|||
|
||||
logger.debug(f"[{group_id}]的初始回复意愿: {current_willing}")
|
||||
|
||||
if current_willing<0.25:
|
||||
current_willing+=0.03 #多说点话
|
||||
|
||||
# 根据消息类型(被cue/表情包)调控
|
||||
if is_mentioned_bot:
|
||||
current_willing = min(
|
||||
|
|
@ -73,7 +76,8 @@ class WillingManager:
|
|||
|
||||
# 回复概率迭代,保底0.01回复概率
|
||||
reply_probability = max(
|
||||
(current_willing - 0.45) * 2,
|
||||
#(current_willing - 0.45) * 2,
|
||||
current_willing,
|
||||
self.min_reply_willing
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ from pypinyin import Style, pinyin
|
|||
|
||||
class ChineseTypoGenerator:
|
||||
def __init__(self,
|
||||
error_rate=0.3,
|
||||
error_rate=0.1,
|
||||
min_freq=5,
|
||||
tone_error_rate=0.2,
|
||||
word_replace_rate=0.3,
|
||||
tone_error_rate=0.1,
|
||||
word_replace_rate=0.1,
|
||||
max_freq_diff=200):
|
||||
"""
|
||||
初始化错别字生成器
|
||||
|
|
@ -372,7 +372,7 @@ class ChineseTypoGenerator:
|
|||
# 优先从词语错误中选择,如果没有则从单字错误中选择
|
||||
correction_suggestion = None
|
||||
# 50%概率返回纠正建议
|
||||
if random.random() < 0.5:
|
||||
if random.random() < 0.8:
|
||||
if word_typos:
|
||||
wrong_word, correct_word = random.choice(word_typos)
|
||||
correction_suggestion = correct_word
|
||||
|
|
|
|||
Loading…
Reference in New Issue