From 5bc4fb64721a25d2e47f40dfdfef9a31565bbdfb Mon Sep 17 00:00:00 2001 From: lss233 <8984680+lss233@users.noreply.github.com> Date: Sun, 10 Sep 2023 20:26:07 +0800 Subject: [PATCH] fix: prompt engine handle preset correctly --- framework/platforms/qq_bot.py | 2 +- framework/prompt_engine.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/platforms/qq_bot.py b/framework/platforms/qq_bot.py index 4b7e6d87..708c56f9 100644 --- a/framework/platforms/qq_bot.py +++ b/framework/platforms/qq_bot.py @@ -26,7 +26,7 @@ async def post_response_function(client, message: Message, text=None, image=None send_payload['channel_id'] = message.channel_id if text: - send_payload['content'] = text + send_payload['content'] = text.replace('.', ' . ') if image: send_payload['file_image'] = await image.get_bytes() await send_func(**send_payload) diff --git a/framework/prompt_engine.py b/framework/prompt_engine.py index 1d8c0724..16540f33 100644 --- a/framework/prompt_engine.py +++ b/framework/prompt_engine.py @@ -118,7 +118,10 @@ async def execute_action_block(action_flow: List[ActionBlockBaseModel], context: for i in range(block.retry + 1): try: result = action_callable(**args) - if result and inspect.iscoroutine(result): + if result and inspect.isasyncgen(result): + async for result in result: + pass + elif result and inspect.iscoroutine(result): result = await result if block.name: