问题
Dear Community,
Please help with the Azure BotFramework Python SDK flow implementation I have described below.
Step 1 : I need my bot to ask a question initially when members are added i.e
async def on_members_added_activity(
self, members_added: [ChannelAccount], turn_context: TurnContext
):
for member in members_added:
if member.id != turn_context.activity.recipient.id:
await turn_context.send_activity(
"Welcome to the Sample Bot! May I help you with something?"
)
*This is the 'Welcome Prompt' - "Welcome to the Sample Bot! May I help you with something?"
Step 2: If the response from the user for the 'Welcome Prompt' is 'Yes':
- I need to call QnAMaker and let the user ask a question. After QnAMaker should answers the question from the Knowledge Base, I need to prompt the user again and check if the user needs another query answered. (This is the 'More Help Prompt')
Step 2: If the response to the 'More Help Prompt' is 'Yes':
- Repeat Step 2
Step 3: else if the response to the initial 'Welcome Prompt' or the 'More Help Prompt' is 'No':
- I need to run a Waterfall Dialog and prompt the user for getting various inputs in a sequential manner. Ex: Name, Age etc.
I don't mind if the flow isn't exactly as described above. The prompts can be anywhere or structured differently and I just need the QnaMaker and Dialog triggering and switching to work.
Any help in calling QnaMaker from Waterflow Dialog will also be appreciated.
I found these implemented in the C# and JavaScript SDKs but, couldn't get a reference code in Python.
Thanks in advance for the help.
Edit:
Adding links of C# and JS references which may help.
How to call QnA Maker on a waterfall dialog using C#?
https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/csharp_dotnetcore/49.qnamaker-all-features
https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/javascript_nodejs/49.qnamaker-all-features
回答1:
The Bot Framework SDK v4 is delivered as an open source SDK on GitHub, targeting .NET, JavaScript, Python, and Java.
Reference code using python SDK: https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/python/49.qnamaker-all-features
来源:https://stackoverflow.com/questions/65086558/how-do-i-switch-between-qnamaker-and-waterfall-dialogs-in-python-azure-botframew