microsoft / BotBuilder-Samples

Welcome to the Bot Framework samples repository. Here you will find task-focused samples in C#, JavaScript/TypeScript, and Python to help you get started with the Bot Framework SDK!
https://github.com/Microsoft/botframework
MIT License
4.37k stars 4.87k forks source link

Integrating composer Adaptive Dialogs in botframework v4 Echo bot #2225

Closed rajeshyalamarthi closed 4 years ago

rajeshyalamarthi commented 4 years ago

Hi,I am trying to integrate composer's adaptive dialog in bot framework V4 echo bot. I loaded all the components which are required. There are no build errors for me, but when i was debugging, at the point where DeclarativeTypeLoader is trying to load root dialog file, it is throwing the error: 'Type specified in JSON 'Microsoft.AdaptiveDialog' was not resolved. Path '$type', line 3, position 37.' Capture

tracyboehrer commented 4 years ago

This is a preview feature that isn't supported yet. However, @stevkan should be able to help.

vishwacsena commented 4 years ago

@rajeshyalamarthi what packages are you using? 4.6-preview2 or are you building off master or the using packages off BotBuilder nightly feed?

rajeshyalamarthi commented 4 years ago

@vishwacsena, there are two packages that are in preview mode. Dialogs.adaptive, Dialogs.Declarative. I installed those two preview packages using CLI. There are no build errors, but still this issue im getting.

stevkan commented 4 years ago

@rajeshyalamarthi, can you post the JSON from your rootDialog file? And, what are you using as a reference for how to integrate adaptive dialogs into your project? Lastly, which version of the two packages are you using?

maximicciullo commented 4 years ago

Hi, I've the same problem as @rajeshyalamarthi mentioned.

vishwacsena commented 4 years ago

@rajeshyalamarthi @maximicciullo - are either of you able to zip and share your sample integration? Also there is a declarative echobot sample here (In case you have not checked this out).

maximicciullo commented 4 years ago

Hi @vishwacsena ,

Attached is the zip file of the sample integration using BotBuilder Sample (this one) and also using a template example of Bot Framework Composer.

You can find into the project a directory called composerDialogs that contains the Main.dialog file generated by Bot Framework Composer.

Also there's a screenshot of the Terminal Exception.

Thanks!

BotBuilderSampleWithComposerError.zip

maximicciullo commented 4 years ago

Hi @vishwacsena, do you have any update about my issue?

Thanks!

vishwacsena commented 4 years ago

@tomlm can you take a look and comment? we should document steps to add adaptive on top of existing v4 dialog based bots.

vishwacsena commented 4 years ago

@maximicciullo @rajeshyalamarthi can you see the delta here and comment if this is what you are looking for? We are likely to clean this up in the upcoming release but this shows how to bring forward a declaratively defined adaptive dialog to work with waterfall dialog.

jamiemaguiredotnet commented 4 years ago

Hi @vishwacsena | @maximicciullo | @rajeshyalamarthi I've tried integrating the delta within a Skill

image

I believ I have added the necessary updates however. Can you advise please? Thanks in advance.

Update: I have now got the project to work (and sample dialog) by manually adding the deltas that were previously mentioned to the project: BotBuilder-Samples-master(2)\BotBuilder-Samples-master\samples\csharp_dotnetcore\19.custom-dialogs\

@vishwacsena - I will try integrate my existing composer dialogues (I have about 20).

jamiemaguiredotnet commented 4 years ago

Hi -@vishwacsena, importing main.dialog from my existing collection of dialogs results in the following error when I try to use it:

image

I have attached main.dialog for reference.

Main.zip

maximicciullo commented 4 years ago

Hi @jamiemaguiredotnet,

How did you fix the issue that you've mentioned before the last one? I got the same one using last changes from master in BotBuilder-Samples-master\samples\csharp_dotnetcore\19.custom-dialogs\ project

Issue -> fail:

Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1] An unhandled exception has occurred while executing the request. System.Exception: /Users/maximiliano.micciullo/Projects/MeBeBot/Tests/botbuilder-samples/samples/csharp_dotnetcore/19.custom-dialogs/composerDialogs/Main.dialog error: Type specified in JSON 'Microsoft.AdaptiveDialog' was not resolved. Path '$type', line 2, position 37.

maximicciullo commented 4 years ago

@vishwacsena I've tested the delta that you've mentioned here and it solves the error about JSON TYPE, but when I replace the main.dialog file with mine (did it with bot framework composer) I got an error about Could not find resource 'TextInput.dialog' Parameter name: TextInput.dialog

This is the exception from terminal:

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1] An unhandled exception has occurred while executing the request. System.Exception: /Users/maximiliano.micciullo/Projects/MeBeBot/Tests/botbuilder-samples/samples/csharp_dotnetcore/19.custom-dialogs/Dialogs/main.dialog error: Could not find resource 'TextInput.dialog' Parameter name: TextInput.dialog

I'm using same main.dialog attached on zip file here. You can find it in composerDialogs folder

jamiemaguiredotnet commented 4 years ago

@maximicciullo - I am also getting an error with my own Composer dialogs.

For me, it seems to stem from the common.lg file.

image

image

image

vishwacsena commented 4 years ago

@maximicciullo @jamiemaguiredotnet see updated delta here

@jamiemaguiredotnet you probably need the useLanguageGeneration on the adapter. @maximicciullo not sure what's causing that. But can you apply the delta and see if you continue to repro?

jamiemaguiredotnet commented 4 years ago

@vishwacsena - thanks for this.

I got much further but ran into another issue using the most recent delta:

image

The issue appears to be with Main.dialog. in the following Activity: image

If I change this activity to be a simple string: image

The demo works: image

In relation to # bfdactivity-827174 , Is the common.lg file format incorrect for the supplied delta ? Or am I missed something else? Many thanks for your support.

jamiemaguiredotnet commented 4 years ago

@vishwacsena EDIT: By manually setting the path to my common.lg file in RootDialog I have been able to get this to work:

image

image

Next, I will try to integrate this Composer Dialogue with a BF Skill.

vishwacsena commented 4 years ago

Glad to hear. Please reactivate this ticket if you guys are blocked.

maximicciullo commented 4 years ago

Hey @vishwacsena, great job!! I'm getting the same issue with my dialog file aobut Text Input error but now I can see that you have uploaded a Dialog from framework composer with Text Input button, so maybe it has changed the way to create "Text input" and mine is obsolete.

Do you have in mind when you will finally release this delta changes?

Many thanks for your help!

jamiemaguiredotnet commented 4 years ago

@vishwacsena I've got further forward but afraid I have hit an issue when trying to fetch a variable back from user scope.

One thing to note is that I had to remove one of the options for the TextInput in the Main.dialog:

image

I can get it to work (to a point) in that my dialogue:

1 - handles the Intent 2 - serves a greeting 3 - asks for a text input

The Problem My new issue is that the dialogues is unable to read back the variable in user scope and echo it back to the user.

Here you can see the execption and the conversation:

image

image

Common.lg and Main.dialog The activity ids exist however in each of these files so at a loss as to why the runtime is throwing the error: image

Latest Cut of Composer The strange thing is, using the most recent cut of Composer, with the same JSON, I can get this to work:

image

Is it possible there is some misalignment in 4.7.0.0-preview and the code in the earlier delta for Text Inputs

You will see from the attached code I'm using v4.7.0.0-preview of the Adaptive DLLs.

I have attached the entire test project I am working with which contains the deltas we have been working with. Any help is appreciated.

Kind Regards.

adaptive-and-composer.zip

rajeshyalamarthi commented 4 years ago

@jamiemaguiredotnet , I too got this issue when i was using 4.7.0.0-preview where i am trying to set the value in user scope. Try it with 4.6.0~preview2. For me it worked.

jamiemaguiredotnet commented 4 years ago

@rajeshyalamarthi - did this work with new Composer created dialogues?

jamiemaguiredotnet commented 4 years ago

@vishwacsena - any updates on this? thanks.

rajeshyalamarthi commented 4 years ago

@jamiemaguiredotnet yeah it is working.

jamiemaguiredotnet commented 4 years ago

Excellent @rajeshyalamarthi . I am getting a User State issue, I believe it has something to do with the User State not being setup somehow in the test project.

jamiemaguiredotnet commented 4 years ago

For anyone else- you need to add this:

image

image

This is with 4.6.0-preview2

stevengum commented 4 years ago

Closing per this comment