mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
chore: add noqa for specific lines, update docstring, improve logging and variable naming
This commit is contained in:
@@ -1539,7 +1539,7 @@ class AgentManager:
|
|||||||
await self._session_workers[session_id]
|
await self._session_workers[session_id]
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
pass
|
pass
|
||||||
self._session_workers.pop(session_id, None)
|
self._session_workers.pop(session_id, None) # noqa
|
||||||
|
|
||||||
# 清理队列
|
# 清理队列
|
||||||
self._session_queues.pop(session_id, None)
|
self._session_queues.pop(session_id, None)
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ def _patch_gemini_thought_signature():
|
|||||||
# 补丁 2:修复 _parse_chat_history 中 first_fc_seen 只修复第一个
|
# 补丁 2:修复 _parse_chat_history 中 first_fc_seen 只修复第一个
|
||||||
# function_call 的问题。用 wrapper 在原函数返回后,确保所有 model
|
# function_call 的问题。用 wrapper 在原函数返回后,确保所有 model
|
||||||
# 消息中所有 function_call 都带有 thought_signature。
|
# 消息中所有 function_call 都带有 thought_signature。
|
||||||
_original_parse_chat_history = _cm._parse_chat_history
|
_original_parse_chat_history = _cm._parse_chat_history # noqa
|
||||||
|
|
||||||
def _patched_parse_chat_history(*args, **kwargs):
|
def _patched_parse_chat_history(*args, **kwargs):
|
||||||
result = _original_parse_chat_history(*args, **kwargs)
|
result = _original_parse_chat_history(*args, **kwargs)
|
||||||
@@ -498,13 +498,13 @@ def _patch_openai_responses_empty_output_support():
|
|||||||
if callable(model_copy):
|
if callable(model_copy):
|
||||||
try:
|
try:
|
||||||
return model_copy(update={"output": []})
|
return model_copy(update={"output": []})
|
||||||
except Exception as err:
|
except Exception as e:
|
||||||
logger.debug(f"复制 Responses 对象失败,回退原地修补 output:{err}")
|
logger.debug(f"复制 Responses 对象失败,回退原地修补 output:{e}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
setattr(response, "output", [])
|
setattr(response, "output", [])
|
||||||
except Exception as err:
|
except Exception as e:
|
||||||
logger.debug(f"原地修补 Responses output 失败:{err}")
|
logger.debug(f"原地修补 Responses output 失败:{e}")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@wraps(original_construct)
|
@wraps(original_construct)
|
||||||
|
|||||||
@@ -610,6 +610,7 @@ class TelegramModule(_ModuleBase, _MessageBase[Telegram]):
|
|||||||
:param text: 新的消息内容
|
:param text: 新的消息内容
|
||||||
:param title: 消息标题
|
:param title: 消息标题
|
||||||
:param buttons: 新的按钮列表
|
:param buttons: 新的按钮列表
|
||||||
|
:param metadata: 其他元信息
|
||||||
:return: 编辑是否成功
|
:return: 编辑是否成功
|
||||||
"""
|
"""
|
||||||
if channel != self._channel:
|
if channel != self._channel:
|
||||||
|
|||||||
@@ -225,14 +225,14 @@ class Telegram:
|
|||||||
).get_res(file_url)
|
).get_res(file_url)
|
||||||
if resp and resp.content:
|
if resp and resp.content:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Telegram图片下载成功: file_id=%s, file_path=%s, content_bytes=%s",
|
"Telegram文件下载成功: file_id=%s, file_path=%s, content_bytes=%s",
|
||||||
file_id,
|
file_id,
|
||||||
file_info.file_path,
|
file_info.file_path,
|
||||||
len(resp.content),
|
len(resp.content),
|
||||||
)
|
)
|
||||||
return resp.content
|
return resp.content
|
||||||
logger.warn(
|
logger.warn(
|
||||||
"Telegram图片下载失败: file_id=%s, file_path=%s, file_url=%s, proxy_enabled=%s",
|
"Telegram文件下载失败: file_id=%s, file_path=%s, file_url=%s, proxy_enabled=%s",
|
||||||
file_id,
|
file_id,
|
||||||
getattr(file_info, "file_path", None),
|
getattr(file_info, "file_path", None),
|
||||||
file_url,
|
file_url,
|
||||||
|
|||||||
Reference in New Issue
Block a user