refactor: 统一类型注解风格并优化代码结构

- 将裸 except 改为显式 Exception 捕获
- 用列表推导式替换冗余 for 循环
- 为类属性添加 ClassVar 注解
- 统一 Union/Optional 写法为 |
- 移除未使用的导入
- 修复 SQLAlchemy 空值比较语法
- 优化字符串拼接与字典更新逻辑
- 补充缺失的 noqa 注释与异常链

BREAKING CHANGE: 所有插件基类的类级字段现要求显式 ClassVar 注解,自定义插件需同步更新
This commit is contained in:
明天好像没什么
2025-10-31 22:42:39 +08:00
committed by Windpicker-owo
parent a2c53fd54e
commit 5638076328
105 changed files with 663 additions and 562 deletions

View File

@@ -401,9 +401,9 @@ class RelationshipBuilder:
for person_id in users_to_build_relationship:
segments = self.person_engaged_cache[person_id]
# 异步执行关系构建
person = Person(person_id=person_id)
if person.is_known:
asyncio.create_task(self.update_impression_on_segments(person_id, self.chat_id, segments))
import asyncio
asyncio.create_task(self.update_impression_on_segments(person_id, self.chat_id, segments)) # noqa: RUF006
# 移除已处理的用户缓存
del self.person_engaged_cache[person_id]
self._save_cache()