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-20 21:36:01 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d0d97912ee4391d2cc880b28e4a4a3a2cf4aae75
d0d97912
1 parent
8a037754
update card.js and show card on front
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
15 deletions
client/src/chatbot/chatbot.js
client/src/chatbot/sections/card.js
client/src/chatbot/chatbot.js
View file @
d0d9791
...
...
@@ -41,15 +41,21 @@ function Chatbot() {
try
{
if
(
inputString
[
0
]
===
'@'
){
const
response
=
await
Axios
.
post
(
'/api/crawling/textQuery'
,
textQueryVariables
)
console
.
log
(
"res"
,
response
)
for
(
let
content
of
response
.
data
)
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
conversation
=
{
who
:
'소통이'
,
content
:
content
who
:
'소통이'
,
content
:
response
.
data
[
i
]
}
dispatch
(
saveMessage
(
conversation
))
}
// for (let content of response.data) {
// conversation = {
// who: '소통이',
// content : content
// }
// dispatch(saveMessage(conversation))
// }
}
else
{
//I will send request to the textQuery ROUTE
...
...
@@ -81,8 +87,6 @@ function Chatbot() {
}
//eventQuery 삭제하기.
const
eventQuery
=
async
(
event
)
=>
{
// We need to take care of the message Chatbot sent
...
...
@@ -94,7 +98,6 @@ function Chatbot() {
//I will send request to the textQuery ROUTE
const
response
=
await
Axios
.
post
(
'/api/dialogflow/eventQuery'
,
eventQueryVariables
)
for
(
let
content
of
response
.
data
.
fulfillmentMessages
)
{
let
conversation
=
{
who
:
'소통이'
,
content
:
content
...
...
@@ -135,7 +138,12 @@ function Chatbot() {
}
const
renderCards
=
(
cards
)
=>
{
return
cards
.
map
((
card
,
i
)
=>
<
Card
key
=
{
i
}
cardInfo
=
{
card
.
content
}
/>
)
let
Cards
=
[];
//넣을 배열
let
pushCard
=
{};
pushCard
[
"content"
]
=
cards
;
Cards
.
push
(
pushCard
);
Cards
.
map
((
card
,
i
)
=>
console
.
log
(
"card.content"
,
card
.
content
))
return
Cards
.
map
((
card
,
i
)
=>
<
Card
key
=
{
i
}
cardInfo
=
{
card
.
content
}
/>
)
}
...
...
@@ -151,7 +159,7 @@ function Chatbot() {
else
if
(
message
.
content
&&
message
.
content
.
description
)
{
const
AvatarSrc
=
message
.
who
===
'소통이'
?
<
Icon
type
=
"robot"
/>
:
<
Icon
type
=
"smile"
/>
console
.
log
(
"message content"
,
message
.
content
)
return
<
div
>
<
List
.
Item
style
=
{{
padding
:
'1rem'
}}
>
<
List
.
Item
.
Meta
...
...
client/src/chatbot/sections/card.js
View file @
d0d9791
...
...
@@ -4,24 +4,24 @@ import { Card, Icon } from 'antd';
const
{
Meta
}
=
Card
;
function
CardComponent
(
props
)
{
console
.
log
(
props
)
console
.
log
(
"props"
,
props
)
return
(
<
Card
style
=
{{
width
:
300
}}
cover
=
{
<
img
alt
=
{
props
.
cardInfo
.
content
.
description
}
src
=
{
props
.
cardInfo
.
content
.
image
}
/
>
alt
=
{
props
.
cardInfo
.
description
}
src
=
{
props
.
cardInfo
.
image
}
/
>
}
actions
=
{[
<
a
target
=
"_blank"
rel
=
"noopener noreferrer"
href
=
{
props
.
cardInfo
.
content
.
link
}
>
<
a
target
=
"_blank"
rel
=
"noopener noreferrer"
href
=
{
props
.
cardInfo
.
link
}
>
<
Icon
type
=
"ellipsis"
key
=
"ellipsis"
/>
<
/a
>
]}
>
<
Meta
title
=
{
props
.
cardInfo
.
content
.
title
}
description
=
{
props
.
cardInfo
.
content
.
description
}
title
=
{
props
.
cardInfo
.
title
}
description
=
{
props
.
cardInfo
.
description
}
/
>
<
/Card
>
...
...
Please
register
or
login
to post a comment