mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-12-16 13:40:53 +08:00
✨ 命令别名
增强,可以在Web UI
中进行设置,优化群聊学习
This commit is contained in:
parent
512685a707
commit
8ecd2dd2f3
@ -353,7 +353,7 @@ class LearningChat:
|
||||
return cmp(len(left_messages) / left_duration, len(right_messages) / right_duration)
|
||||
|
||||
popularity: List[Tuple[int, List[ChatMessage]]] = sorted(total_messages.items(),
|
||||
key=cmp_to_key(group_popularity_cmp))
|
||||
key=cmp_to_key(group_popularity_cmp), reverse=True)
|
||||
logger.debug('群聊学习', f'主动发言:群热度排行<m>{">>".join([str(g[0]) for g in popularity])}</m>')
|
||||
for group_id, messages in popularity:
|
||||
if len(messages) < 30:
|
||||
|
@ -8,6 +8,11 @@ from LittlePaimon.plugins.Learning_Chat.models import ChatMessage, ChatContext,
|
||||
from LittlePaimon.web.api import BaseApiRouter
|
||||
from LittlePaimon.web.api.utils import authentication
|
||||
|
||||
try:
|
||||
import jieba_fast as jieba
|
||||
except ImportError:
|
||||
import jieba
|
||||
|
||||
from .handler import LearningChat
|
||||
from .config import config_manager
|
||||
|
||||
@ -43,6 +48,7 @@ async def post_chat_global_config(data: dict):
|
||||
count=config_manager.config.learn_max_count)
|
||||
await ChatAnswer.filter(count__gt=config_manager.config.learn_max_count).update(
|
||||
count=config_manager.config.learn_max_count)
|
||||
jieba.load_userdict(config_manager.config.dictionary)
|
||||
return {
|
||||
'status': 0,
|
||||
'msg': '保存成功'
|
||||
|
Loading…
x
Reference in New Issue
Block a user