C# 如何在由Microsoft bot frame work开发的聊天机器人中获得直接响应初始对话框

C# 如何在由Microsoft bot frame work开发的聊天机器人中获得直接响应初始对话框,c#,botframework,microsoft-teams,C#,Botframework,Microsoft Teams,我现在正在开发聊天机器人,可以回答客户提出的问题。我想删除第一条通讯线路“键入一些单词以回答问题”。然而,我找不到路 初始化通信 if (member.Id != turnContext.Activity.Recipient.Id) { var reply = MessageFactory.Text("質問を続けるには何か入力してください。"); await turnContext.SendActivityAsync(reply, cancellationTo

我现在正在开发聊天机器人,可以回答客户提出的问题。我想删除第一条通讯线路“键入一些单词以回答问题”。然而,我找不到路

初始化通信

if (member.Id != turnContext.Activity.Recipient.Id)
{
    var reply = MessageFactory.Text("質問を続けるには何か入力してください。");
    await turnContext.SendActivityAsync(reply, cancellationToken);
}
向客户提问

private async Task<DialogTurnResult> InputQuestionAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
    {
        _logger.LogInformation("MainDialog.InputQuestionAsync");
        var promptOptions = new PromptOptions { Prompt = MessageFactory.Text("ご質問を話し言葉で入力して下さい。") };
        return await stepContext.PromptAsync(nameof(TextPrompt), promptOptions, cancellationToken);
    }
private async Task<DialogTurnResult> ShowCardStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
    {
        _logger.LogInformation("MainDialog.ShowCardStepAsync");
        var receivedMessage = (string)stepContext.Result;
        var userProfile = await _userProfileAccessor.GetAsync(stepContext.Context, () => new UserProfile(), cancellationToken);
        userProfile.Question = receivedMessage;
        *
        *
        *
        *
        msg = msg + sec.ToString() + ".知りたい質問がありません\n\n" + third.ToString() + ".質問を変える\n\n";
        var reply = MessageFactory.Text(msg);
        list1.Add(sec.ToString());
        list1.Add(third.ToString());
        reply.Attachments.Add(Cards.GetHeroCard(list1).ToAttachment());
        await stepContext.Context.SendActivityAsync(reply, cancellationToken);

        var promptOptions = new PromptOptions { Prompt = MessageFactory.Text("番号を押してください") };
        return await stepContext.PromptAsync(nameof(TextPrompt), promptOptions, cancellationToken);
        }
    }
private async Task InputQuestionAsync(WaterCallStepContext stepContext,CancellationToken CancellationToken)
{
_logger.LogInformation(“MainDialog.InputQuestionAsync”);
var promptOptions=newpromptoptions{Prompt=MessageFactory.Text(“ご質問を話し言葉で入力して下さい。") };
返回wait wait stepContext.PromptAsync(名称(TextPrompt)、提示、取消令牌);
}
回答问题

private async Task<DialogTurnResult> InputQuestionAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
    {
        _logger.LogInformation("MainDialog.InputQuestionAsync");
        var promptOptions = new PromptOptions { Prompt = MessageFactory.Text("ご質問を話し言葉で入力して下さい。") };
        return await stepContext.PromptAsync(nameof(TextPrompt), promptOptions, cancellationToken);
    }
private async Task<DialogTurnResult> ShowCardStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
    {
        _logger.LogInformation("MainDialog.ShowCardStepAsync");
        var receivedMessage = (string)stepContext.Result;
        var userProfile = await _userProfileAccessor.GetAsync(stepContext.Context, () => new UserProfile(), cancellationToken);
        userProfile.Question = receivedMessage;
        *
        *
        *
        *
        msg = msg + sec.ToString() + ".知りたい質問がありません\n\n" + third.ToString() + ".質問を変える\n\n";
        var reply = MessageFactory.Text(msg);
        list1.Add(sec.ToString());
        list1.Add(third.ToString());
        reply.Attachments.Add(Cards.GetHeroCard(list1).ToAttachment());
        await stepContext.Context.SendActivityAsync(reply, cancellationToken);

        var promptOptions = new PromptOptions { Prompt = MessageFactory.Text("番号を押してください") };
        return await stepContext.PromptAsync(nameof(TextPrompt), promptOptions, cancellationToken);
        }
    }
private async Task showcardstepsync(waterwallstepcontext stepContext,CancellationToken CancellationToken)
{
_logger.LogInformation(“MainDialog.ShowCardStepAsync”);
var receivedMessage=(字符串)stepContext.Result;
var userProfile=await _userProfileAccessor.GetAsync(stepContext.Context,()=>newuserprofile(),cancellationToken);
userProfile.Question=receivedMessage;
*
*
*
*
msg=msg+sec.ToString()+”。知りたい質問がありません\n\n“+third.ToString()+”。質問を変える\n\n“;
var reply=MessageFactory.Text(msg);
列表1.Add(sec.ToString());
list1.Add(third.ToString());
reply.Attachments.Add(Cards.GetHeroCard(list1.ToAttachment());
Wait stepContext.Context.SendActivityAsync(回复、取消令牌);
var promptOptions=newpromptoptions{Prompt=MessageFactory.Text(“番号を押してください") };
返回wait wait stepContext.PromptAsync(名称(TextPrompt)、提示、取消令牌);
}
}
[![对话框流的图像][1][1]

添加

var accessor = ConversationState.CreateProperty<DialogState>(nameof(DialogState));
await Dialog.RunAsync(turnContext, accessor, cancellationToken);
var accessor=ConversationState.CreateProperty(nameof(DialogState));
wait Dialog.RunAsync(turnContext、访问器、cancellationToken);
在 OnMembersAddedAsync和OnMessageActivityAsync解决了此问题