dev
This commit is contained in:
+10
-2
@@ -5,6 +5,7 @@ from astrbot.core.message.message_event_result import MessageChain,Plain
|
|||||||
from ..tool.pattern import Pattern
|
from ..tool.pattern import Pattern
|
||||||
from astrbot.api.star import Star
|
from astrbot.api.star import Star
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import json
|
||||||
|
|
||||||
class TimerService:
|
class TimerService:
|
||||||
def __init__(self,star:Star) -> None:
|
def __init__(self,star:Star) -> None:
|
||||||
@@ -60,6 +61,13 @@ class TimerService:
|
|||||||
logger.error(f"conversation_id获取失败!!umo:{umo}")
|
logger.error(f"conversation_id获取失败!!umo:{umo}")
|
||||||
return False
|
return False
|
||||||
conversation = await conv_mnger.get_conversation(umo,conv_id)
|
conversation = await conv_mnger.get_conversation(umo,conv_id)
|
||||||
|
if conversation is None :
|
||||||
|
conversation = []
|
||||||
|
try:
|
||||||
|
history_list = json.loads(conversation.history)
|
||||||
|
except:
|
||||||
|
logger.error("上下文获取失败")
|
||||||
|
history_list = []
|
||||||
|
|
||||||
except:
|
except:
|
||||||
logger.error("消息管理失败!")
|
logger.error("消息管理失败!")
|
||||||
@@ -67,8 +75,8 @@ class TimerService:
|
|||||||
logger.debug(f"获取上下文:{conversation}")
|
logger.debug(f"获取上下文:{conversation}")
|
||||||
req = await self.star.context.llm_generate(
|
req = await self.star.context.llm_generate(
|
||||||
chat_provider_id=provider,
|
chat_provider_id=provider,
|
||||||
prompt="请输入你的上下文,这里是测试环境,你的输出将会被打印至控制台",
|
prompt="<你等待的时间内对方没有回复>",
|
||||||
# contexts=conversation
|
contexts=history_list
|
||||||
|
|
||||||
)
|
)
|
||||||
logger.debug(f"llm结果:{req.completion_text }")
|
logger.debug(f"llm结果:{req.completion_text }")
|
||||||
|
|||||||
Reference in New Issue
Block a user