8000 NumberPrompt doesn't accept retry value · Issue #281 · microsoft/botbuilder-python · GitHub
[go: up one dir, main page]

Skip to content
NumberPrompt doesn't accept retry value #281
Closed
@Zerryth

Description

@Zerryth

Version

v4.5

Describe the bug

When you send an invalid number to a NumberPrompt, it sends out a retry prompt.
When attempting to send a 2nd response after being reprompted, you get a timeout error.

To Reproduce

  1. Create a NumberPrompt object
  2. When it prompts you for a number, send in a non-numeric value (e.g. "hello")
    • this will trigger a retry prompt (e.g. "You must enter a number.")
  3. Try sending in another value--no matter what type of value, you get a timeout error

image

image

Expected behavior

To be able to send in a 2nd value when reprompted

Additional context

async def test_number_prompt_retry(self):
        async def exec_test(turn_context: TurnContext) -> None:
            dialog_context: DialogContext = await dialogs.create_context(turn_context)

            results: DialogTurnResult = await dialog_context.continue_dialog()

            if results.status == DialogTurnStatus.Empty:
                options = PromptOptions(
                    prompt=Activity(type=ActivityTypes.message, text="Enter a number."),
                    retry_prompt=Activity(
                        type=ActivityTypes.message, text="You must enter a number."
                    ),
                )
                await dialog_context.prompt("NumberPrompt", options)
            elif results.status == DialogTurnStatus.Complete:
                number_result = results.result
                await turn_context.send_activity(
                    MessageFactory.text(f"Bot received the number '{number_result}'.")
                )

            await convo_state.save_changes(turn_context)

        adapter = TestAdapter(exec_test)

        convo_state = ConversationState(MemoryStorage())
        dialog_state = convo_state.create_property("dialogState")
        dialogs = DialogSet(dialog_state)
        number_prompt = NumberPrompt(
            dialog_id="NumberPrompt", validator=None, default_locale=Culture.English
        )
        dialogs.add(number_prompt)

        step1 = await adapter.send("hello")
        step2 = await step1.assert_reply("Enter a number.")
        # TODO: something is breaking in the validators or retry prompt
        # where it does not accept the 2nd answer after reprompting the user
        # for another value
        step3 = await step2.send("hello")
        step4 = await step3.assert_reply("You must enter a number.")
        step5 = await step4.send("64")
        await step5.assert_reply("Bot received the number '64'.")

[bug]

Metadata

Metadata

Assignees

Labels

P0Must Fix. Release-blocker

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0