From 153214bfc39ba0957d039596b9694243a091f028 Mon Sep 17 00:00:00 2001 From: zhayujie Date: Sun, 16 Apr 2023 02:26:18 +0800 Subject: [PATCH] fix: planet mention str replace --- channel/planet/planet_channel.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/channel/planet/planet_channel.py b/channel/planet/planet_channel.py index 0b56252..83f60b0 100644 --- a/channel/planet/planet_channel.py +++ b/channel/planet/planet_channel.py @@ -8,6 +8,7 @@ from config import channel_conf, channel_conf_val from common import const MENTION_STR = '' +MENTION_STR2 = '' class PlanetChannel(Channel): def startup(self): @@ -43,6 +44,7 @@ class PlanetChannel(Channel): for topic in topics: self._handle_topic(topic) time.sleep(3) + time.sleep(30) except Exception as e: logger.exception("[Planet] process failed, exception={}".format(e)) @@ -57,6 +59,7 @@ class PlanetChannel(Channel): logger.info("[Planet] find new topic, topic={}".format(topic)) # 场景一:用户直接在主题上艾特 query = talk_content.replace(MENTION_STR, '') + query = query.replace(MENTION_STR2, '') # 此时system_prompt使用全局配置, query为主题中的问题 context = {"from_user_id": talk_user_id} @@ -87,6 +90,7 @@ class PlanetChannel(Channel): continue if query.find(self.bot_user_id) != -1: query = query.replace(MENTION_STR, '') + query = query.replace(MENTION_STR2, '') context = {"from_user_id": comment_user_id} reply_txt = super().build_reply_content(query, context) @@ -183,5 +187,6 @@ class PlanetChannel(Channel): "origin": "https://wx.zsxq.com", "referer": "https://wx.zsxq.com/", "sec-ch-ua-platform": "macOS", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"} - + "Content-Type": "application/json; charset=UTF-8", + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" + }