qa: 增加显式 return 语句

This commit is contained in:
春河晴
2025-06-10 15:42:48 +09:00
parent eacdbb8d31
commit 1534e99094
5 changed files with 8 additions and 3 deletions

View File

@@ -195,6 +195,7 @@ class DatabaseAPI:
return None if single_result else []
elif query_type in ["create", "update", "delete", "count"]:
return None
raise "unknown query type"
async def db_raw_query(
self,

View File

@@ -109,6 +109,7 @@ class DefaultExpressor:
# logger.debug(f"创建思考消息thinking_message{thinking_message}")
await self.heart_fc_sender.register_thinking(thinking_message)
return None
async def deal_reply(
self,

View File

@@ -88,10 +88,10 @@ class HeartFCSender:
"""
if not message.chat_stream:
logger.error("消息缺少 chat_stream无法发送")
return
raise "消息缺少 chat_stream无法发送"
if not message.message_info or not message.message_info.message_id:
logger.error("消息缺少 message_info 或 message_id无法发送")
return
raise "消息缺少 message_info 或 message_id无法发送"
chat_id = message.chat_stream.stream_id
message_id = message.message_info.message_id

View File

@@ -120,6 +120,7 @@ class DefaultReplyer:
# logger.debug(f"创建思考消息thinking_message{thinking_message}")
await self.heart_fc_sender.register_thinking(thinking_message)
return None
async def deal_reply(
self,

View File

@@ -111,11 +111,13 @@ class Timer:
async def async_wrapper(*args, **kwargs):
with self:
return await func(*args, **kwargs)
return None
@wraps(func)
def sync_wrapper(*args, **kwargs):
with self:
return func(*args, **kwargs)
return None
wrapper = async_wrapper if asyncio.iscoroutinefunction(func) else sync_wrapper
wrapper.__timer__ = self # 保留计时器引用