我们想要建立一个机器人,它将向用户提出问题,然后记录他们的反应。此问答将根据用户的反应智能地完成。
我们目前几乎没有什么初步问题;
请您建议,如果这可以使用任何一个Bot,哪一个应该是首选。
谢谢你,阿米特
发布于 2017-01-30 16:32:17
在您的4种情况下,所有这些都可以使用IBM完成。
1:使用会话服务创建聊天机器人,您可以使用context变量保存所有用户输入。
IBM在Python、节点JS和Java SDK中提供了一些示例,只需单击某些编程语言来检查示例和所有代码。
2:本例使用来自会话简单Node.js链接的Cloudant (nosql),但您可以使用其他链接。
function log(input, output) {
if ( logs ) {
// If the logs db is set, then we want to record all input and responses
var id = uuid.v4();
logs.insert( {'_id': id, 'request': input, 'response': output, 'time': new Date()} );
}
}
if ( cloudantUrl ) {
// If logging has been enabled (as signalled by the presence of the cloudantUrl) then the
// app developer must also specify a LOG_USER and LOG_PASS env vars.
if ( !process.env.LOG_USER || !process.env.LOG_PASS ) {
throw new Error( 'LOG_USER OR LOG_PASS not defined, both required to enable logging!' );
}
// add basic auth to the endpoints to retrieve the logs!
var auth = basicAuth( process.env.LOG_USER, process.env.LOG_PASS );
// If the cloudantUrl has been configured then we will want to set up a nano client
var nano = require( 'nano' )( cloudantUrl );
// add a new API which allows us to retrieve the logs (note this is not secure)
nano.db.get( 'car_logs', function(err) {
if ( err ) {
console.error( err );
nano.db.create( 'car_logs', function(errCreate) {
console.error( errCreate );
logs = nano.db.use( 'car_logs' );
} );
} else {
logs = nano.db.use( 'car_logs' );
}
} );3:所有的呼叫会话都有一些id,您可以使用context变量访问它。示例(使用IBM会话):
context.conversation_id4:您可以使用IBM提供的其他服务,但我推荐: AlchemyAPI或Discovery取决于您到底要做什么。但我敢肯定他们都想帮你。
https://stackoverflow.com/questions/41932537
复制相似问题