|
|
|
@ -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}")
|
|
|
|
|