Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
parent
84bf14ad11
commit
2c46da962b
21
test/test-http-POST.js
Normal file
21
test/test-http-POST.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
// ag-0.de: # /opt/node-v10.23.1-linux-x86/bin/node WWW/software/wclbot
|
||||||
|
CleverBot = {
|
||||||
|
ask : function (line,cb) {
|
||||||
|
http.POST(CleverBot.url,{
|
||||||
|
say:line,
|
||||||
|
session:CleverBot.session,
|
||||||
|
context:CleverBot.context
|
||||||
|
}, function (response) {
|
||||||
|
// console.log(response);
|
||||||
|
CleverBot.session=response.session;
|
||||||
|
CleverBot.context.push(line); CleverBot.context.push(response.answer);
|
||||||
|
cb(response.answer)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
context : [],
|
||||||
|
reset : function () { CleverBot.session=null;CleverBot.context=[] },
|
||||||
|
session : null,
|
||||||
|
url : 'http://ag-0.de:12121',
|
||||||
|
}
|
||||||
|
print('Asking cleverbot: Who are you? Answer:');
|
||||||
|
CleverBot.ask('Who are you?',print);
|
Loading…
Reference in New Issue
Block a user