在JSON枚举FormFlow对话框中键入另一个答案

时间:2018-05-02 14:37:33

标签: botframework

我正在使用JSON FormFlow对话框。

public async Task StartAsync(IDialogContext context)
        {
            context.Wait(MessageReceivedAsync);
        }

public async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument)
        {
            var activity = await argument;
            if (activity.Type == ActivityTypes.Message)
            {
                context.Call(FormDialog.FromForm(() => BuildJsonForm(), FormOptions.PromptInStart), DialogCompleted);
            }
        }
public static IForm<JObject> BuildJsonForm()
    {


        using (var stream = File.OpenRead("my.json"))
        {
            var schema = JObject.Parse(new StreamReader(stream).ReadToEnd());
            return new FormBuilderJson(schema)
                .AddRemainingFields()
                .Build();
        }
    }

my.json内部我有枚举:

"properties": {
"EnumExample": {
  "Prompt": { "Patterns": [ "To what language translate {||}" ] },

  "Describe": { "Image": "" },
  "type": [
    "string",
    "null"
  ],
  "enum": [
    "en",
    "fr",
    "ru",
    "de",
    "es"
  ],
  "Values": {
    "en": {
      "Describe": "English"
    },
    "fr": {
      "Describe": "French"
    },
    "ru": {
      "Describe": "Russian"
    },
    "de": {
      "Describe": "German"
    },
    "es": {
      "Describe": "Spanish"
    }
  }
}

问题:我如何支持用户选择Enum选项之一以及自由文本输入,这样我就可以运行另一个对话框或在该输入上运行Luis API。例如,用户将键入&#34;我想和运营商谈谈#34;而不是在我的JSON FormFlow对话框中回答Enum? 感谢

0 个答案:

没有答案