fix:修复发送api打字时间,现已成为可选参数。修复可能存在的回复图片问题,为数据库缺失字段提供警告
This commit is contained in:
@@ -199,11 +199,11 @@ class NormalChat:
|
||||
# 使用信号量控制并发数,最多同时处理5个消息
|
||||
semaphore = asyncio.Semaphore(5)
|
||||
|
||||
async def limited_process(task):
|
||||
async with semaphore:
|
||||
async def limited_process(task, sem):
|
||||
async with sem:
|
||||
await task
|
||||
|
||||
limited_tasks = [limited_process(task) for task in tasks]
|
||||
limited_tasks = [limited_process(task, semaphore) for task in tasks]
|
||||
await asyncio.gather(*limited_tasks, return_exceptions=True)
|
||||
except asyncio.CancelledError:
|
||||
logger.info(f"[{self.stream_name}] 兴趣监控任务被取消")
|
||||
|
||||
@@ -40,6 +40,11 @@ class ClassicalWillingManager(BaseWillingManager):
|
||||
else:
|
||||
is_emoji_not_reply = True
|
||||
|
||||
# 处理picid格式消息,直接不回复
|
||||
is_picid_not_reply = False
|
||||
if willing_info.is_picid:
|
||||
is_picid_not_reply = True
|
||||
|
||||
self.chat_reply_willing[chat_id] = min(current_willing, 3.0)
|
||||
|
||||
reply_probability = min(max((current_willing - 0.5), 0.01) * 2, 1)
|
||||
@@ -54,6 +59,9 @@ class ClassicalWillingManager(BaseWillingManager):
|
||||
if is_emoji_not_reply:
|
||||
reply_probability = 0
|
||||
|
||||
if is_picid_not_reply:
|
||||
reply_probability = 0
|
||||
|
||||
return reply_probability
|
||||
|
||||
async def before_generate_reply_handle(self, message_id):
|
||||
|
||||
@@ -180,6 +180,9 @@ class MxpWillingManager(BaseWillingManager):
|
||||
if w_info.is_emoji:
|
||||
probability *= global_config.normal_chat.emoji_response_penalty
|
||||
|
||||
if w_info.is_picid:
|
||||
probability = 0 # picid格式消息直接不回复
|
||||
|
||||
if w_info.group_info and w_info.group_info.group_id in global_config.normal_chat.talk_frequency_down_groups:
|
||||
probability /= global_config.normal_chat.down_frequency_rate
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ class WillingInfo:
|
||||
group_info: Optional[GroupInfo]
|
||||
is_mentioned_bot: bool
|
||||
is_emoji: bool
|
||||
is_picid: bool
|
||||
interested_rate: float
|
||||
# current_mood: float 当前心情?
|
||||
|
||||
@@ -102,6 +103,7 @@ class BaseWillingManager(ABC):
|
||||
group_info=chat.group_info,
|
||||
is_mentioned_bot=is_mentioned_bot,
|
||||
is_emoji=message.is_emoji,
|
||||
is_picid=message.is_picid,
|
||||
interested_rate=interested_rate,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user