Я тестировал этот код на моем эмуляторе WebOS.Эмулятор webOS использует nodejs версии 6.0.0
Мой код здесь:
// The path to identify the agent that owns the created intent.
const sessionPath = sessionClient.sessionPath(projectId, sessionId);
let promise;
for (const query of queries) {
// The text query request.
const request = {
session: sessionPath,
queryInput: {
text: {
text: query,
languageCode: languageCode,
},
},
};
if (!promise) {
// LOOK: this code is executed
promise = sessionClient.detectIntent(request);
} else {
// ....
}
}emphasized text
promise
.then(responses => {
// ....
})
.catch(err => {
// error has occurred after detectIntent() is called.
console.log('ERROR: ' + err);
});
Сообщение об ошибке здесь: Ошибка: 14 UNAVAILABLE: Ошибка получения метаданных из плагина: Ошибка: генератор уже работает
Я не знаю, что означает эта ошибка.Я ссылался на этот код.но диалог не работает.https://github.com/googleapis/nodejs-dialogflow/blob/master/samples/detect.js