gpt4 book ai didi

node.js - botframework 在网络聊天中提及对话 ID

转载 作者:太空宇宙 更新时间:2023-11-04 00:29:24 32 4
gpt4 key购买 nike

我们如何在 botframework 网络聊天 中提及对话 id,而不是随机生成?目前,我们可以提及网络聊天useridusername,但无法提及对话id

最佳答案

有关此主题的更多信息,请查看指南:Send proactive messages .

To be able to send an ad hoc message to a user, the bot must first collect and save information about the user from the current conversation. The address property of the message includes all of the information that the bot will need to send an ad hoc message to the user later.

bot.dialog('/', function(session, args) {
var savedAddress = session.message.address;

// (Save this information somewhere that it can be accessed later, such as in a database.)

var message = 'Hello user, good to meet you! I now know your address and can send you notifications in the future.';
session.send(message);
});

After the bot has collected information about the user, it can send an ad hoc proactive message to the user at any time. To do so, it simply retrieves the user data that it stored previously, constructs the message, and sends it.

function sendProactiveMessage(address) {
var msg = new builder.Message().address(address);
msg.text('Hello, this is a notification');
msg.textLocale('en-US');
bot.send(msg);
}

关于node.js - botframework 在网络聊天中提及对话 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41568479/

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