Showing
5 changed files
with
54 additions
and
9 deletions
| ... | @@ -41,6 +41,7 @@ function Chatbot() { | ... | @@ -41,6 +41,7 @@ function Chatbot() { |
| 41 | try { | 41 | try { |
| 42 | if(inputString[0] === '@'){ | 42 | if(inputString[0] === '@'){ |
| 43 | await Axios.post('/api/crawling/textQuery', textQueryVariables) | 43 | await Axios.post('/api/crawling/textQuery', textQueryVariables) |
| 44 | + | ||
| 44 | } else { | 45 | } else { |
| 45 | //I will send request to the textQuery ROUTE | 46 | //I will send request to the textQuery ROUTE |
| 46 | const response = await Axios.post('/api/dialogflow/textQuery', textQueryVariables) | 47 | const response = await Axios.post('/api/dialogflow/textQuery', textQueryVariables) |
| ... | @@ -79,8 +80,6 @@ function Chatbot() { | ... | @@ -79,8 +80,6 @@ function Chatbot() { |
| 79 | event | 80 | event |
| 80 | } | 81 | } |
| 81 | 82 | ||
| 82 | - | ||
| 83 | - | ||
| 84 | try { | 83 | try { |
| 85 | //I will send request to the textQuery ROUTE | 84 | //I will send request to the textQuery ROUTE |
| 86 | const response = await Axios.post('/api/dialogflow/eventQuery', eventQueryVariables) | 85 | const response = await Axios.post('/api/dialogflow/eventQuery', eventQueryVariables) | ... | ... |
| ... | @@ -19,7 +19,7 @@ function CardComponent(props) { | ... | @@ -19,7 +19,7 @@ function CardComponent(props) { |
| 19 | ]} | 19 | ]} |
| 20 | > | 20 | > |
| 21 | <Meta | 21 | <Meta |
| 22 | - title={props.cardInfo.fields.stack.stringValue} | 22 | + title={props.cardInfo.fields.title.stringValue} |
| 23 | description={props.cardInfo.fields.description.stringValue} | 23 | description={props.cardInfo.fields.description.stringValue} |
| 24 | /> | 24 | /> |
| 25 | 25 | ... | ... |
| ... | @@ -5,6 +5,12 @@ | ... | @@ -5,6 +5,12 @@ |
| 5 | 5. json파일 카드로 넘겨주기 | 5 | 5. json파일 카드로 넘겨주기 |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | +--- | ||
| 9 | +검색결과가 없을 때 -> 다시 dialogflow 라우터로 넘겨줘서 무슨 말인지 이해하지 못했어요 | ||
| 10 | +관련 영상이 3가지 미만일 때 -> 없다고 판단함. | ||
| 11 | +--- | ||
| 12 | + | ||
| 13 | + | ||
| 8 | node 서버: localhost: 5000 | 14 | node 서버: localhost: 5000 |
| 9 | 프론트엔드/ localhost: 3000 | 15 | 프론트엔드/ localhost: 3000 |
| 10 | 16 | ||
| ... | @@ -22,6 +28,9 @@ ex. 내일 오후 2시 되나요? 에서 '내일', '오후 2시'를 파라미터 | ... | @@ -22,6 +28,9 @@ ex. 내일 오후 2시 되나요? 에서 '내일', '오후 2시'를 파라미터 |
| 22 | 문맥 context | 28 | 문맥 context |
| 23 | 내일 오후 2시 되나요? 에서 무엇을 위한 내일 오후 2시인가를 파악하기 위해서 그 전에 대화가 되었던 '수리'라는 것을 기억하는 것을 의미함 | 29 | 내일 오후 2시 되나요? 에서 무엇을 위한 내일 오후 2시인가를 파악하기 위해서 그 전에 대화가 되었던 '수리'라는 것을 기억하는 것을 의미함 |
| 24 | 30 | ||
| 31 | +uuid 제대로 이해하고 다시 작성하기 | ||
| 32 | + | ||
| 33 | + | ||
| 25 | 34 | ||
| 26 | 35 | ||
| 27 | ----- | 36 | ----- | ... | ... |
| ... | @@ -2,7 +2,13 @@ const axios = require('axios'); | ... | @@ -2,7 +2,13 @@ const axios = require('axios'); |
| 2 | const cheerio = require('cheerio'); | 2 | const cheerio = require('cheerio'); |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| 5 | -한글 utf-8 인코딩해서 searchquery에 저장해야함. | 5 | +이런 식으로 전달해야함. card 컴포넌트에 |
| 6 | + { | ||
| 7 | + "description": "Youtube", | ||
| 8 | + "image": "", | ||
| 9 | + "link": "https://www.youtube.com", | ||
| 10 | + "stack": "minjeong" | ||
| 11 | + } | ||
| 6 | */ | 12 | */ |
| 7 | 13 | ||
| 8 | function video(name){ | 14 | function video(name){ |
| ... | @@ -29,16 +35,19 @@ function video(name){ | ... | @@ -29,16 +35,19 @@ function video(name){ |
| 29 | 35 | ||
| 30 | $bodyList.each(function(i, elem){ | 36 | $bodyList.each(function(i, elem){ |
| 31 | videoList[i] = { | 37 | videoList[i] = { |
| 32 | - thumbnail : $(this).find('a.cds_thm').children('img').attr('src'), | 38 | + description : "naverTV", |
| 39 | + image : $(this).find('a.cds_thm').children('img').attr('src'), | ||
| 33 | title : $(this).find('a.cds_thm').attr('title'), | 40 | title : $(this).find('a.cds_thm').attr('title'), |
| 34 | link : "https://tv.naver.com/" + $(this).find('a.cds_thm').attr('href') | 41 | link : "https://tv.naver.com/" + $(this).find('a.cds_thm').attr('href') |
| 35 | } | 42 | } |
| 36 | }) | 43 | }) |
| 37 | 44 | ||
| 38 | - const data = videoList.filter(n => n.title); | 45 | + var data = videoList.filter(n => n.title); |
| 46 | + data = data.slice(0,3) | ||
| 47 | + | ||
| 39 | return data; | 48 | return data; |
| 40 | }) | 49 | }) |
| 41 | - .then(res=>console.log(res)); | 50 | + //.then(res=>console.log(res)); |
| 42 | } | 51 | } |
| 43 | 52 | ||
| 44 | module.exports = video; | 53 | module.exports = video; |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -7,8 +7,36 @@ const getvideo = require('../cheerio/video'); | ... | @@ -7,8 +7,36 @@ const getvideo = require('../cheerio/video'); |
| 7 | router.post('/textQuery',async(req,res)=>{ | 7 | router.post('/textQuery',async(req,res)=>{ |
| 8 | const result = req.body.text; | 8 | const result = req.body.text; |
| 9 | console.log(result.substring(1)); | 9 | console.log(result.substring(1)); |
| 10 | - getvideo(result.substring(1)); | 10 | + var videoList = getvideo(result.substring(1)); |
| 11 | - res.send(result); | 11 | + |
| 12 | + /* | ||
| 13 | + const request = { | ||
| 14 | + session: sessionPath, | ||
| 15 | + queryInput: { | ||
| 16 | + text: { | ||
| 17 | + // The query to send to the dialogflow agent | ||
| 18 | + text: req.body.text, | ||
| 19 | + // The language used by the client (en-US) | ||
| 20 | + languageCode: languageCode, | ||
| 21 | + }, | ||
| 22 | + }, | ||
| 23 | + }; | ||
| 24 | + | ||
| 25 | + // Send request and log result | ||
| 26 | + const responses = await sessionClient.detectIntent(request); | ||
| 27 | + console.log('Detected intent'); | ||
| 28 | + const result = responses[0].queryResult; | ||
| 29 | + console.log(` Query: ${result.queryText}`); | ||
| 30 | + console.log(` Response: ${result.fulfillmentText}`); | ||
| 31 | + */ | ||
| 32 | + res.send(result) | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + res.send(videoList); | ||
| 12 | }) | 40 | }) |
| 13 | 41 | ||
| 14 | module.exports = router; | 42 | module.exports = router; |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment