调参仙人有福了,添加了willing_manager的自选功能

This commit is contained in:
SengokuCola
2025-03-14 21:34:52 +08:00
parent ccc6d9e48c
commit c0f9298517
11 changed files with 286 additions and 30 deletions

View File

@@ -7,6 +7,7 @@ class LogClassification(Enum):
MEMORY = "memory"
EMOJI = "emoji"
CHAT = "chat"
PBUILDER = "promptbuilder"
class LogModule:
logger = loguru.logger.opt()
@@ -32,6 +33,10 @@ class LogModule:
# 表情包系统日志格式
emoji_format = "<green>{time:HH:mm}</green> | <level>{level: <8}</level> | <yellow>表情包</yellow> | <cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>"
promptbuilder_format = "<green>{time:HH:mm}</green> | <level>{level: <8}</level> | <yellow>Prompt</yellow> | <cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>"
# 根据日志类型选择日志格式和输出
if log_type == LogClassification.CHAT:
self.logger.add(
@@ -39,6 +44,12 @@ class LogModule:
format=chat_format,
# level="INFO"
)
elif log_type == LogClassification.PBUILDER:
self.logger.add(
sys.stderr,
format=promptbuilder_format,
# level="INFO"
)
elif log_type == LogClassification.MEMORY:
# 同时输出到控制台和文件