机器学习指令增加

This commit is contained in:
2979302435 2022-06-16 20:46:38 +08:00
parent 80c6bfc297
commit cf44e4b51d
3 changed files with 20 additions and 21 deletions

View File

@ -104,7 +104,7 @@ class Chat:
blacklist_answer = defaultdict(set) blacklist_answer = defaultdict(set)
blacklist_answer_reserve = defaultdict(set) blacklist_answer_reserve = defaultdict(set)
learningGroup = config.paimonLearningGroup# 机器学习群组 learningGroup = config.paimon_chat_group# 机器学习群组
def __init__(self, data: Union[ChatData, GroupMessageEvent, PrivateMessageEvent]): def __init__(self, data: Union[ChatData, GroupMessageEvent, PrivateMessageEvent]):

View File

@ -16,6 +16,7 @@ __paimon_help__ = {
'type': '派蒙机器学习', 'type': '派蒙机器学习',
'range': ['private', 'group', 'guild'] 'range': ['private', 'group', 'guild']
} }
if config.paimon_mongodb_url: if config.paimon_mongodb_url:
try: try:
from .Learning_repeate import main from .Learning_repeate import main
@ -44,7 +45,7 @@ def check_group(event: GroupMessageEvent) -> bool:
async def update_paimon_voice(event: MessageEvent): async def update_paimon_voice(event: MessageEvent):
try: try:
old_len = len([m for m in matchers[10] if m.plugin_name == 'Paimon_Chat']) old_len = len([m for m in matchers[10] if m.plugin_name == 'Paimon_Chat'])
voice_list = await load_json_from_url('https://static.cherishmoon.fun/LittlePaimon/voice/voice_list.json') voice_list = await load_json_from_url('https://www.scuop.top/chat.json')
matchers[10] = [m for m in matchers[10] if m.plugin_name != 'Paimon_Chat'] matchers[10] = [m for m in matchers[10] if m.plugin_name != 'Paimon_Chat']
for key, value in voice_list.items(): for key, value in voice_list.items():
create_matcher(key, value['pattern'], value['cooldown'], value['pro'], value['files']) create_matcher(key, value['pattern'], value['cooldown'], value['pro'], value['files'])
@ -84,6 +85,6 @@ def create_matcher(chat_word: str, pattern: str, cooldown: int, pro: float, resp
@driver.on_startup @driver.on_startup
async def load_voice(): async def load_voice():
voice_list = await load_json_from_url('https://static.cherishmoon.fun/LittlePaimon/voice/voice_list.json') voice_list = await load_json_from_url('https://www.scuop.top/chat.json')
for k, v in voice_list.items(): for k, v in voice_list.items():
create_matcher(k, v['pattern'], v['cooldown'], v['pro'], v['files']) create_matcher(k, v['pattern'], v['cooldown'], v['pro'], v['files'])

View File

@ -5,9 +5,9 @@ from typing import List
class PluginConfig(BaseModel): class PluginConfig(BaseModel):
# 群组模拟抽卡冷却(秒) # 群组模拟抽卡冷却(秒)
paimon_gacha_cd_group: int = 30 paimon_gacha_cd_group: int = 12
# 个人模拟抽卡冷却(秒) # 个人模拟抽卡冷却(秒)
paimon_gacha_cd_user: int = 60 paimon_gacha_cd_user: int = 15
# 树脂提醒停止检查时间(小时) # 树脂提醒停止检查时间(小时)
paimon_remind_start: int = 0 paimon_remind_start: int = 0
paimon_remind_end: int = 8 paimon_remind_end: int = 8
@ -22,46 +22,44 @@ class PluginConfig(BaseModel):
# 对联冷却(秒) # 对联冷却(秒)
paimon_couplets_cd: int = 6 paimon_couplets_cd: int = 6
# 猫图冷却(秒) # 猫图冷却(秒)
paimon_cat_cd: int = 12 paimon_cat_cd: int = 8
# 二次元图冷却(秒) # 二次元图冷却(秒)
paimon_ecy_cd: int = 6 paimon_ecy_cd: int = 8
# 原神壁纸图冷却(秒) # 原神壁纸图冷却(秒)
paimon_ysp_cd: int = 10 paimon_ysp_cd: int = 8
# 派蒙聊天开启群组 # 派蒙聊天开启群组
paimon_chat_group: List[int] = [] paimon_chat_group: List[int] = [870897036, 706346489,1094961993,574124226,884840181,913507017]
# 派蒙猜语音持续时间 # 派蒙猜语音持续时间
paimon_guess_voice: int = 30 paimon_guess_voice: int = 30
# 原神日历开启群组 # 原神日历开启群组
paimon_calender_group: List[int] = [] paimon_calender_group: List[int] = [870897036, 706346489,1094961993,574124226,884840181,913507017]
# 以下为机器学习聊天模块配置 # 以下为机器学习聊天模块配置
# mongodb数据库连接url # mongodb数据库连接url
paimon_mongodb_url: str = None paimon_mongodb_url: str = "mongodb://localhost:27017"
# 派蒙聊天屏蔽用户 # 派蒙聊天屏蔽用户
paimon_chat_ban: List[int] = [] paimon_chat_ban: List[int] = []
# 派蒙聊天学习阈值,越小学习越快 # 派蒙聊天学习阈值,越小学习越快
paimon_answer_threshold: int = 3 paimon_answer_threshold: int = 2
# 派蒙聊天上限阈值 # 派蒙聊天上限阈值
paimon_answer_limit_threshold: int = 25 paimon_answer_limit_threshold: int = 50
# N个群有相同的回复就跨群作为全局回复 # N个群有相同的回复就跨群作为全局回复
paimon_cross_group_threshold: int = 2 paimon_cross_group_threshold: int = 2
# 复读的阈值 # 复读的阈值
paimon_repeat_threshold: int = 3 paimon_repeat_threshold: int = 3
# 主动发言阈值,越小话越多 # 主动发言阈值,越小话越多
paimon_speak_threshold: int = 3 paimon_speak_threshold: int = 2
# 喝醉的概率 # 喝醉的概率
paimon_drunk_probability: float = 0.07 paimon_drunk_probability: float = 0.6
# 用文字转语音来回复的概率 # 用文字转语音来回复的概率
paimon_voice_probability: float = 0.03 paimon_voice_probability: float = 0.1
# 连续主动说话的概率 # 连续主动说话的概率
paimon_speak_continuously_probability: float = 0.5 paimon_speak_continuously_probability: float = 0.7
# 主动说话加上随机戳一戳群友的概率 # 主动说话加上随机戳一戳群友的概率
paimon_speak_poke_probability: float = 0.5 paimon_speak_poke_probability: float = 0.7
# 连续主动说话最多几句话 # 连续主动说话最多几句话
paimon_speak_continuously_max_len: int = 3 paimon_speak_continuously_max_len: int = 10
# 机器学习开启群组
paimonLearningGroup: List[int] = []
# 派蒙收到好友申请或群邀请时是否向超级管理员发通知 # 派蒙收到好友申请或群邀请时是否向超级管理员发通知
paimon_request_remind: bool = True paimon_request_remind: bool = True