mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-11 00:06:04 +00:00
refactor: AI对话基本完成
This commit is contained in:
@@ -50,8 +50,8 @@ class LongTextProcessStage(stage.PipelineStage):
|
||||
|
||||
async def process(self, query: core_entities.Query, stage_inst_name: str) -> entities.StageProcessResult:
|
||||
if len(str(query.resp_message_chain)) > self.ap.cfg_mgr.data['blob_message_threshold']:
|
||||
query.message_chain = MessageChain(await self.strategy_impl.process(str(query.resp_message_chain)))
|
||||
query.resp_message_chain = MessageChain(await self.strategy_impl.process(str(query.resp_message_chain)))
|
||||
return entities.StageProcessResult(
|
||||
result_type=entities.ResultType.CONTINUE,
|
||||
new_query=query
|
||||
)
|
||||
)
|
||||
|
||||
@@ -26,13 +26,11 @@ class ChatMessageHandler(handler.MessageHandler):
|
||||
conversation = await self.ap.sess_mgr.get_conversation(session)
|
||||
|
||||
async for result in conversation.use_model.requester.request(query, conversation):
|
||||
conversation.messages.append(result)
|
||||
|
||||
query.resp_message_chain = mirai.MessageChain([mirai.Plain(str(result))])
|
||||
|
||||
yield entities.StageProcessResult(
|
||||
result_type=entities.ResultType.CONTINUE,
|
||||
new_query=query
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user