Skip to content

Commit c35f6b8

Browse files
erohmensingalwx
authored andcommitted
fix shell event loop already running
1 parent b912341 commit c35f6b8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

rasa/core/channels/console.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ def print_bot_output(
6363
cli_utils.print_color(json.dumps(message.get("custom"), indent=2), color=color)
6464

6565

66-
def get_user_input(button_question: questionary.Question) -> Optional[Text]:
66+
async def get_user_input(button_question: questionary.Question) -> Optional[Text]:
6767
if button_question is not None:
6868
response = cli_utils.payload_from_button_question(button_question)
6969
if response == cli_utils.FREE_TEXT_INPUT_PROMPT:
7070
# Re-prompt user with a free text input
71-
response = get_user_input(None)
71+
response = await get_user_input(None)
7272
else:
73-
response = questionary.text(
73+
response = await questionary.text(
7474
"",
7575
qmark="Your input ->",
7676
style=Style([("qmark", "#b373d6"), ("", "#b373d6")]),
77-
).ask()
77+
).ask_async()
7878
return response.strip() if response is not None else None
7979

8080

@@ -127,7 +127,7 @@ async def record_messages(
127127
button_question = None
128128
await asyncio.sleep(0.5) # Wait for server to start
129129
while not utils.is_limit_reached(num_messages, max_message_limit):
130-
text = get_user_input(button_question)
130+
text = await get_user_input(button_question)
131131

132132
if text == exit_text or text is None:
133133
break

0 commit comments

Comments
 (0)