최한솔

time value test

...@@ -21,12 +21,35 @@ exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, resp ...@@ -21,12 +21,35 @@ exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, resp
21 agent.add(`잘못된 입력값 입니다`); 21 agent.add(`잘못된 입력값 입니다`);
22 } 22 }
23 23
24 + var mytime;
24 function test1(agent){ 25 function test1(agent){
25 - const mytime = agent.parameters.hours;
26 agent.setContext(); 26 agent.setContext();
27 - agent.add('수면 시간이 등록되었습니다'); 27 + const mytime = agent.parameters.hours;
28 + const myresult = mytime+12;
29 + if(mytime>0){
30 + agent.add(`Good. your sleep time is ${myresult}`);
31 + }
28 } 32 }
29 33
34 + function test2(agent) {
35 + const hour = agent.parameters.hours;
36 + const min = agent.parameters.minutes;
37 + const gothour = hour.length > 0;
38 + const gotmin = min.length > 0;
39 + const rehour = (hour)+3;
40 + const remin = min+10;
41 +
42 + if(gothour && gotmin) {
43 + agent.add(`좋습니다. 당신의 취침시간은 ${hour}${min}분 입니다.`);
44 + agent.add(`${rehour}${remin}분에 주무십시오`);
45 + } else if (gothour && !gotmin) {
46 + agent.add('시간이 잘못 입력되었습니다.');
47 + } else if (gothour && !gothour) {
48 + agent.add('시간이 잘못 입력되었습니다.');
49 + } else {
50 + agent.add('취침시간을 00:00 또는 00시00분 으로 입력해 주세요');
51 + }
52 + }
30 // // Uncomment and edit to make your own intent handler 53 // // Uncomment and edit to make your own intent handler
31 // // uncomment `intentMap.set('your intent name here', yourFunctionHandler);` 54 // // uncomment `intentMap.set('your intent name here', yourFunctionHandler);`
32 // // below to get this function to be run when a Dialogflow intent is matched 55 // // below to get this function to be run when a Dialogflow intent is matched
...@@ -60,7 +83,6 @@ exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, resp ...@@ -60,7 +83,6 @@ exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, resp
60 let intentMap = new Map(); 83 let intentMap = new Map();
61 intentMap.set('Default Welcome Intent', welcome); 84 intentMap.set('Default Welcome Intent', welcome);
62 intentMap.set('Default Fallback Intent', fallback); 85 intentMap.set('Default Fallback Intent', fallback);
63 - intentMap.set('test',test1); 86 + intentMap.set('test',test2);
64 - // intentMap.set('your intent name here', googleAssistantHandler);
65 agent.handleRequest(intentMap); 87 agent.handleRequest(intentMap);
66 }); 88 });
......