Skip to content

Commit eab1a0a

Browse files
committed
Updated command handler for Steffen for debugging purposes
1 parent 04cead6 commit eab1a0a

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

main_server/routes/command_handler.js

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,47 @@ function loadPackages() {
2727
process.stdout.write(']\n\n');
2828
}
2929

30+
// router.post('/', function (req, res, next) {
31+
// console.log("<",req.body.question);
32+
// var response = undefined
33+
// var i = 0;
34+
// while(i < packageList.length && response == undefined) {
35+
// packageList[i](req.body.question, function(data_received){
36+
// response = data_received;
37+
// if (response != undefined){
38+
// i = packageList.length;
39+
// res.send({'ttsText': response});
40+
// }
41+
// else{
42+
// i++;
43+
// }
44+
// })
45+
// }
46+
// });
47+
48+
3049
router.post('/', function (req, res, next) {
31-
var response = '';
32-
for (const package of packageList) {
33-
console.log("<",req.body.question);
34-
package(req.body.question, function(data_received){
50+
console.log("<",req.body.question);
51+
var response = undefined
52+
var i = 0;
53+
for (i = 0; i < packageList.length; i++) {
54+
packageList[i](req.body.question, function(data_received){
3555
response = data_received;
3656
if (response != undefined){
57+
i = packageList.length;
3758
res.send({'ttsText': response});
38-
};
39-
});
40-
}
59+
}
60+
else{
61+
i++;
62+
}
63+
})
64+
}
4165
});
4266

67+
68+
69+
70+
4371
router.post('/reload_packages', function (req, res, next) {
4472
loadPackages();
4573
});

0 commit comments

Comments
 (0)