fix: logger三合一
This commit is contained in:
@@ -16,6 +16,7 @@ from .relationship_manager import relationship_manager
|
||||
from .willing_manager import willing_manager # 导入意愿管理器
|
||||
from .utils import is_mentioned_bot_in_txt, calculate_typing_time
|
||||
from ..memory_system.memory import memory_graph
|
||||
from loguru import logger
|
||||
|
||||
class ChatBot:
|
||||
def __init__(self):
|
||||
@@ -98,8 +99,8 @@ class ChatBot:
|
||||
# 过滤词
|
||||
for word in global_config.ban_words:
|
||||
if word in message.detailed_plain_text:
|
||||
print(f"\033[1;32m[{message.group_name}]{message.user_nickname}:\033[0m {message.processed_plain_text}")
|
||||
print(f"\033[1;32m[过滤词识别]\033[0m 消息中含有{word},filtered")
|
||||
logger.info(f"\033[1;32m[{message.group_name}]{message.user_nickname}:\033[0m {message.processed_plain_text}")
|
||||
logger.info(f"\033[1;32m[过滤词识别]\033[0m 消息中含有{word},filtered")
|
||||
return
|
||||
|
||||
current_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(message.time))
|
||||
@@ -113,7 +114,7 @@ class ChatBot:
|
||||
# topic1 = topic_identifier.identify_topic_jieba(message.processed_plain_text)
|
||||
# topic2 = await topic_identifier.identify_topic_llm(message.processed_plain_text)
|
||||
# topic3 = topic_identifier.identify_topic_snownlp(message.processed_plain_text)
|
||||
print(f"\033[1;32m[主题识别]\033[0m 使用{global_config.topic_extract}主题: {topic}")
|
||||
logger.info(f"\033[1;32m[主题识别]\033[0m 使用{global_config.topic_extract}主题: {topic}")
|
||||
|
||||
all_num = 0
|
||||
interested_num = 0
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Dict, Any, Optional, Set
|
||||
import os
|
||||
from nonebot.log import logger, default_format
|
||||
import logging
|
||||
import configparser
|
||||
import tomli
|
||||
import sys
|
||||
@@ -85,9 +83,9 @@ class BotConfig:
|
||||
personality_config=toml_dict['personality']
|
||||
personality=personality_config.get('prompt_personality')
|
||||
if len(personality) >= 2:
|
||||
print(f"载入自定义人格:{personality}")
|
||||
logger.info(f"载入自定义人格:{personality}")
|
||||
config.PROMPT_PERSONALITY=personality_config.get('prompt_personality',config.PROMPT_PERSONALITY)
|
||||
print(f"载入自定义日程prompt:{personality_config.get('prompt_schedule',config.PROMPT_SCHEDULE_GEN)}")
|
||||
logger.info(f"载入自定义日程prompt:{personality_config.get('prompt_schedule',config.PROMPT_SCHEDULE_GEN)}")
|
||||
config.PROMPT_SCHEDULE_GEN=personality_config.get('prompt_schedule',config.PROMPT_SCHEDULE_GEN)
|
||||
|
||||
if "emoji" in toml_dict:
|
||||
@@ -141,10 +139,10 @@ class BotConfig:
|
||||
topic_config=toml_dict['topic']
|
||||
if 'topic_extract' in topic_config:
|
||||
config.topic_extract=topic_config.get('topic_extract',config.topic_extract)
|
||||
print(f"载入自定义主题提取为{config.topic_extract}")
|
||||
logger.info(f"载入自定义主题提取为{config.topic_extract}")
|
||||
if config.topic_extract=='llm' and 'llm_topic' in topic_config:
|
||||
config.llm_topic_extract=topic_config['llm_topic']
|
||||
print(f"载入自定义主题提取模型为{config.llm_topic_extract['name']}")
|
||||
logger.info(f"载入自定义主题提取模型为{config.llm_topic_extract['name']}")
|
||||
|
||||
# 消息配置
|
||||
if "message" in toml_dict:
|
||||
|
||||
Reference in New Issue
Block a user