From 9aaacf18f0f750013deaf96e14d5d3cd5dcd90f0 Mon Sep 17 00:00:00 2001 From: "Zhangzhichao@123" Date: Mon, 11 Aug 2025 15:29:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=BC=B9=E5=B9=95=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E8=A1=A8=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- message_processor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/message_processor.py b/message_processor.py index 45208a0..70fc4f9 100644 --- a/message_processor.py +++ b/message_processor.py @@ -1,6 +1,6 @@ +import re + from protobuf.douyin import * -import random -from loguru import logger from helper import LiveChatConfig, MessageType live_chat_config = LiveChatConfig() @@ -14,6 +14,9 @@ def parse_chat_msg(payload, queue): user_name = message.user.nick_name user_id = message.user.id content = message.content + content = re.sub(r'\[.*?]', '', content) + if not content.strip(): + return prompt = live_chat_config.chat_prompt.format(content=content, product_name='{product_name}', product_specification='{product_specification}', product_description='{product_description}') queue.put((MessageType.CHAT.value, prompt, content)) # logger.info(f"【聊天msg】[{user_id}]{user_name}: {content}")