dev logger
This commit is contained in:
@@ -45,6 +45,8 @@ class MyPlugin(Star):
|
||||
async def pattern_extract(self,event:AstrMessageEvent,req:LLMResponse):
|
||||
if not req.role == 'assistant':
|
||||
return
|
||||
|
||||
logger.info("[wait_msg]:开始解析模板")
|
||||
llm_res = req.completion_text
|
||||
dump = Pattern(llm_res)
|
||||
await event.send(MessageChain().message("awa定时时间消息:{0}过滤后:{1}".format(dump.count,dump.string)))
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
import re
|
||||
|
||||
from astrbot.api import logger
|
||||
class Pattern:
|
||||
_pattern = r'<wt>((?!wt).)*</wt>'
|
||||
|
||||
@@ -27,6 +27,7 @@ class Pattern:
|
||||
num = int(content)
|
||||
return self.sec_range(num)
|
||||
except:
|
||||
logger.debug ("[wait_msg]:模板内容错误:{}".format(content))
|
||||
return None
|
||||
|
||||
def extract(self,o_str:str):
|
||||
@@ -42,6 +43,8 @@ class Pattern:
|
||||
#消除不完整/非法模板
|
||||
o_str= o_str.replace("<wt>","")
|
||||
o_str=o_str.replace("</wt>","")
|
||||
|
||||
logger.info("[wait_msg]:获得模板:{0}s".format(timerSec))
|
||||
return {
|
||||
"content":o_str,
|
||||
"second":timerSec
|
||||
|
||||
Reference in New Issue
Block a user