ユーザーがalexa-sdk
?を使用してAlexaからのコマンドに応答するのにかかる時間を取得することは可能ですか?それをより視覚的にするために、私は以下を測定しようとしています:
User says: "Alexa open my app"
Alexa says: "Welcome to my app, say next to go to the next section"
-- A few seconds pass here, this is what I need to know --
User says: "Next"
ドキュメントに何も見つかりませんでした。通常process.hrtime
、応答の前後にタイマーを開始するようなものを使用しようとしますが、ハンドラーは次のようになります。
let timer;
const StartIntentHandler = {
canHandle(handlerInput) {
return (
handlerInput.requestEnvelope.request.type === 'IntentRequest' &&
handlerInput.requestEnvelope.request.intent.name === 'StartIntent'
);
},
handle(handlerInput) {
timer = process.hrtime();
const speechText = 'Welcome to my app, say next to go to the next section';
return handlerInput.responseBuilder
.speak(speechText)
.reprompt(speechText)
.getResponse();
}
};
const NextIntentHandler = {
canHandle(handlerInput) {
return (
handlerInput.requestEnvelope.request.type === 'IntentRequest' &&
handlerInput.requestEnvelope.request.intent.name ===
'NextIntent'
);
},
handle(handlerInput) {
const diff = process.hrtime(timer);
const timeInNanoseconds = diff[0] * 1e9 + diff[1];
return handlerInput.responseBuilder
.speak(`${timeInNanoseconds} nanoseconds`)
.getResponse();
}
};
ただし、これはAlexaがコマンドを開始する直前にカウントを開始するため、取得する時間は、Alexaがコマンドを話すのにかかる時間+ユーザーが応答するのを遅らせる時間です。
現在、ストップウォッチを使用してAlexaの応答時間を測定し、それを合計時間から差し引いていますが、理想的とは言えません。
Alexaがコマンドの発話を停止したときの情報は、ユーザーが応答を開始したときにユーザーの個人情報であり、開発者には公開されません。
注:ストップウォッチを使用して減算する現在の方法では、ユーザーデバイスが情報をAVS(Alexa音声サービス)クラウドに送信するのにかかる時間とAVSがにかかる時間を考慮していないため、正しい時間の測定値が得られません。スキルラムダを呼び出します。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加