完善消息链路trace并贯通AI与发送动作
This commit is contained in:
@@ -16,6 +16,7 @@ from pymediainfo import MediaInfo
|
||||
import aiofiles
|
||||
|
||||
from utils.video_utils import get_first_frame, get_first_frame_bytes
|
||||
from utils.trace_context import format_trace_prefix
|
||||
from wechat_ipad import UserLoggedOut
|
||||
from wechat_ipad.client.base import WechatAPIClientBase
|
||||
|
||||
@@ -144,7 +145,9 @@ class MessageMixin(WechatAPIClientBase):
|
||||
response = await session.post(f'http://{self.ip}:{self.port}/api/Msg/SendTxt', json=json_param)
|
||||
json_resp = await response.json()
|
||||
if json_resp.get("Success"):
|
||||
self.logging.info("发送文字消息: 对方wxid:{} at:{} 内容:{}", wxid, at, content)
|
||||
# 发送动作也带上 trace_id,便于把“某条入站消息最终发了什么”直接串起来。
|
||||
self.logging.info("{}发送文字消息: 对方wxid:{} at:{} 内容:{}",
|
||||
format_trace_prefix(), wxid, at, content)
|
||||
data = json_resp.get("Data")
|
||||
return data.get("List")[0].get("ClientMsgId"), data.get("List")[0].get("CreateTime"), data.get("List")[
|
||||
0].get("NewMsgId")
|
||||
@@ -191,7 +194,9 @@ class MessageMixin(WechatAPIClientBase):
|
||||
|
||||
if json_resp.get("Success"):
|
||||
json_param.pop('Base64')
|
||||
self.logging.info("发送图片消息: 对方wxid:{} 图片base64略", wxid)
|
||||
# 图片日志不打印 base64 内容,但保留 trace_id,便于关联具体发送动作。
|
||||
self.logging.info("{}发送图片消息: 对方wxid:{} 图片base64略",
|
||||
format_trace_prefix(), wxid)
|
||||
data = json_resp.get("Data")
|
||||
self.logging.debug("发送图片消息成功,返回:{}", data)
|
||||
return data.get("ClientImgId").get("string"), data.get("CreateTime"), data.get("NewMsgId")
|
||||
|
||||
Reference in New Issue
Block a user