优化代码格式和异常处理

- 修复异常处理链,使用from语法保留原始异常
- 格式化代码以符合项目规范
- 优化导入模块的顺序

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
春河晴
2025-03-19 20:27:34 +09:00
parent a829dfdb77
commit fdc098d0db
52 changed files with 3156 additions and 2778 deletions

View File

@@ -10,10 +10,10 @@ from src.common.logger import get_module_logger, LogConfig, TOPIC_STYLE_CONFIG
topic_config = LogConfig(
# 使用海马体专用样式
console_format=TOPIC_STYLE_CONFIG["console_format"],
file_format=TOPIC_STYLE_CONFIG["file_format"]
file_format=TOPIC_STYLE_CONFIG["file_format"],
)
logger = get_module_logger("topic_identifier",config=topic_config)
logger = get_module_logger("topic_identifier", config=topic_config)
driver = get_driver()
config = driver.config
@@ -21,7 +21,7 @@ config = driver.config
class TopicIdentifier:
def __init__(self):
self.llm_topic_judge = LLM_request(model=global_config.llm_topic_judge,request_type = 'topic')
self.llm_topic_judge = LLM_request(model=global_config.llm_topic_judge, request_type="topic")
async def identify_topic_llm(self, text: str) -> Optional[List[str]]:
"""识别消息主题,返回主题列表"""