Toggle navigation
Toggle navigation
This project
Loading...
Sign in
서민정
/
SEARCH-AND-CHAT
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
2
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
서민정
2020-05-19 11:46:14 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ccf04f7a6387ed8dc96ee45dc663c80efbd2c5fe
ccf04f7a
1 parent
c79f207b
update crawling and update data passing
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
9 deletions
client/src/chatbot/chatbot.js
client/src/chatbot/sections/card.js
note.md
server/cheerio/video.js
server/routes/crawling.js
client/src/chatbot/chatbot.js
View file @
ccf04f7
...
...
@@ -41,6 +41,7 @@ function Chatbot() {
try
{
if
(
inputString
[
0
]
===
'@'
){
await
Axios
.
post
(
'/api/crawling/textQuery'
,
textQueryVariables
)
}
else
{
//I will send request to the textQuery ROUTE
const
response
=
await
Axios
.
post
(
'/api/dialogflow/textQuery'
,
textQueryVariables
)
...
...
@@ -79,8 +80,6 @@ function Chatbot() {
event
}
try
{
//I will send request to the textQuery ROUTE
const
response
=
await
Axios
.
post
(
'/api/dialogflow/eventQuery'
,
eventQueryVariables
)
...
...
client/src/chatbot/sections/card.js
View file @
ccf04f7
...
...
@@ -19,7 +19,7 @@ function CardComponent(props) {
]}
>
<
Meta
title
=
{
props
.
cardInfo
.
fields
.
stack
.
stringValue
}
title
=
{
props
.
cardInfo
.
fields
.
title
.
stringValue
}
description
=
{
props
.
cardInfo
.
fields
.
description
.
stringValue
}
/
>
...
...
note.md
View file @
ccf04f7
...
...
@@ -5,6 +5,12 @@
5.
json파일 카드로 넘겨주기
---
검색결과가 없을 때 -> 다시 dialogflow 라우터로 넘겨줘서 무슨 말인지 이해하지 못했어요
관련 영상이 3가지 미만일 때 -> 없다고 판단함.
---
node 서버: localhost: 5000
프론트엔드/ localhost: 3000
...
...
@@ -22,6 +28,9 @@ ex. 내일 오후 2시 되나요? 에서 '내일', '오후 2시'를 파라미터
문맥 context
내일 오후 2시 되나요? 에서 무엇을 위한 내일 오후 2시인가를 파악하기 위해서 그 전에 대화가 되었던 '수리'라는 것을 기억하는 것을 의미함
uuid 제대로 이해하고 다시 작성하기
-----
...
...
server/cheerio/video.js
View file @
ccf04f7
...
...
@@ -2,7 +2,13 @@ const axios = require('axios');
const
cheerio
=
require
(
'cheerio'
);
/*
한글 utf-8 인코딩해서 searchquery에 저장해야함.
이런 식으로 전달해야함. card 컴포넌트에
{
"description": "Youtube",
"image": "",
"link": "https://www.youtube.com",
"stack": "minjeong"
}
*/
function
video
(
name
){
...
...
@@ -29,16 +35,19 @@ function video(name){
$bodyList
.
each
(
function
(
i
,
elem
){
videoList
[
i
]
=
{
thumbnail
:
$
(
this
).
find
(
'a.cds_thm'
).
children
(
'img'
).
attr
(
'src'
),
description
:
"naverTV"
,
image
:
$
(
this
).
find
(
'a.cds_thm'
).
children
(
'img'
).
attr
(
'src'
),
title
:
$
(
this
).
find
(
'a.cds_thm'
).
attr
(
'title'
),
link
:
"https://tv.naver.com/"
+
$
(
this
).
find
(
'a.cds_thm'
).
attr
(
'href'
)
}
})
const
data
=
videoList
.
filter
(
n
=>
n
.
title
);
var
data
=
videoList
.
filter
(
n
=>
n
.
title
);
data
=
data
.
slice
(
0
,
3
)
return
data
;
})
.
then
(
res
=>
console
.
log
(
res
));
//
.then(res=>console.log(res));
}
module
.
exports
=
video
;
\ No newline at end of file
...
...
server/routes/crawling.js
View file @
ccf04f7
...
...
@@ -7,8 +7,36 @@ const getvideo = require('../cheerio/video');
router
.
post
(
'/textQuery'
,
async
(
req
,
res
)
=>
{
const
result
=
req
.
body
.
text
;
console
.
log
(
result
.
substring
(
1
));
getvideo
(
result
.
substring
(
1
));
res
.
send
(
result
);
var
videoList
=
getvideo
(
result
.
substring
(
1
));
/*
const request = {
session: sessionPath,
queryInput: {
text: {
// The query to send to the dialogflow agent
text: req.body.text,
// The language used by the client (en-US)
languageCode: languageCode,
},
},
};
// Send request and log result
const responses = await sessionClient.detectIntent(request);
console.log('Detected intent');
const result = responses[0].queryResult;
console.log(` Query: ${result.queryText}`);
console.log(` Response: ${result.fulfillmentText}`);
*/
res
.
send
(
result
)
res
.
send
(
videoList
);
})
module
.
exports
=
router
;
\ No newline at end of file
...
...
Please
register
or
login
to post a comment