gpt4 book ai didi

c# - 用于在 Telegram 上部署的 Bot Framework 中的新行

转载 作者:太空狗 更新时间:2023-10-30 01:01:40 25 4
gpt4 key购买 nike

方法一:

public async Task WelcomeAsync(
IDialogContext context,
IAwaitable<Message> argument)
{
var message = await argument;
message.SetBotConversationData("DateTime", DateTime.UtcNow);

StorageAccess.StoreTemporaryLog(
StorageAccess.GetDateTime(message.GetBotConversationData<DateTime>("DateTime")),
"user",
message.Text);

await context.PostAsync(
"Welcome to VAM Insurance Bot\n" +
"Do you already have a policy or do you want to buy a new policy?\n" +
"1.Already\n" +
"2.New\n" +
"Please enter the correct choice:");

StorageAccess.StoreTemporaryLog(
StorageAccess.GetDateTime(message.GetBotConversationData<DateTime>("DateTime")),
"bot",
"Welcome to VAM Insurance Bot\n" +
"Do you already have a policy or do you want to buy a new policy?\n" +
"1.Already\n" +
"2.New\n" +
"Please enter the correct choice:");

context.Wait(AlreadyNewAsync);
}

方法二:

public async Task AuthenicateClientAsync(
IDialogContext context,
IAwaitable<Message> argument)
{
var message = await argument;
StorageAccess.StoreStructuredLog(
StorageAccess.GetDateTime(message.GetBotConversationData<DateTime>("DateTime")),
message.GetBotUserData<string>("policyNo"),
"user",
message.Text);

if (DBAccess.AuthenticateOTP(message.Text))
{
await context.PostAsync("You have been successfully authenticated!");

StorageAccess.StoreStructuredLog(
StorageAccess.GetDateTime(
message.GetBotConversationData<DateTime>("DateTime")),
message.GetBotUserData<string>("policyNo"),
"bot",
"You have been successfully authenticated!");

await context.PostAsync(
"What would you like to do?\n" +
"1. View your policy\n" +
"2. Renew you policy\n" +
"3. File an insurance claim\n" +
"Please enter the suitable options number:");

StorageAccess.StoreStructuredLog(
StorageAccess.GetDateTime(
message.GetBotConversationData<DateTime>("DateTime")),
message.GetBotUserData<string>("policyNo"),
"bot",
"What would you like to do?\n" +
"1. View your policy\n" +
"2. Renew you policy\n" +
"3. File an insurance claim\n" +
"Please enter the suitable options number:");

context.Wait(ViewRenewFileClaimAsync);
}
else
{
await context.PostAsync(
"The OTP that you have entered is either incorrect or expired.\n" +
"Would you like to go over again?\n" +
"Yes\n" +
"No");

StorageAccess.StoreStructuredLog(
StorageAccess.GetDateTime(
message.GetBotConversationData<DateTime>("DateTime")),
message.GetBotUserData<string>("policyNo"),
"bot",
"The OTP that you have entered is either incorrect or expired.\n" +
"Would you like to go over again?\n" +
"Yes\n" +
"No");

context.Wait(RepeatAsync);
}
}

这是我项目中对话的两种方法。我已将它们部署在 Azure 上并连接到 Telegram。但是“\n”似乎并不是在任何地方都有效。正如您在屏幕截图中所见,它仅在某些地方有效。如您所见,方法 1 的对话没有换行。但是在方法 2 中,他们正在为最后一个换行。访问https://storageangsu.blob.core.windows.net/policy-number-0123456789/image_damage获取图片

最佳答案

BotFramework 使用 Markdown。你可以在Here或者BotFramework documentation中看到解决方案

关于c# - 用于在 Telegram 上部署的 Bot Framework 中的新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37695613/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com