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-21 13:00:45 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
72fec7f1901993696ee2122d3248609ab6fb8773
72fec7f1
1 parent
d0d97912
update card message
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
19 deletions
client/src/chatbot/chatbot.js
client/src/chatbot/sections/Message.js
client/src/chatbot/chatbot.js
View file @
72fec7f
...
...
@@ -21,7 +21,7 @@ function Chatbot() {
// First Need to take care of the message I sent
let
conversation
=
{
who
:
'
user
'
,
who
:
'
사용자
'
,
content
:
{
text
:
{
text
:
text
...
...
@@ -41,21 +41,18 @@ function Chatbot() {
try
{
if
(
inputString
[
0
]
===
'@'
){
const
response
=
await
Axios
.
post
(
'/api/crawling/textQuery'
,
textQueryVariables
)
let
conversations
=
{}
let
pushConversations
=
[]
for
(
var
i
=
0
;
i
<
3
;
i
++
){
conversation
=
{
who
:
'소통이'
,
content
:
response
.
data
[
i
]
}
dispatch
(
saveMessage
(
conversation
)
)
pushConversations
.
push
(
conversation
)
}
// for (let content of response.data) {
// conversation = {
// who: '소통이',
// content : content
// }
// dispatch(saveMessage(conversation))
// }
conversations
[
"card"
]
=
pushConversations
console
.
log
(
"conversations"
,
conversations
)
dispatch
(
saveMessage
(
conversations
))
}
else
{
//I will send request to the textQuery ROUTE
...
...
@@ -138,17 +135,14 @@ function Chatbot() {
}
const
renderCards
=
(
cards
)
=>
{
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
}
/>
)
cards
.
map
((
card
,
i
)
=>
console
.
log
(
"card.content"
,
card
.
content
))
return
cards
.
map
((
card
,
i
)
=>
<
Card
key
=
{
i
}
cardInfo
=
{
card
.
content
}
/>
)
}
const
renderOneMessage
=
(
message
,
i
)
=>
{
console
.
log
(
'message'
,
message
)
console
.
log
(
'message.card'
,
message
.
card
)
// we need to give some condition here to separate message kinds
...
...
@@ -156,7 +150,7 @@ function Chatbot() {
if
(
message
.
content
&&
message
.
content
.
text
&&
message
.
content
.
text
.
text
)
{
return
<
Message
key
=
{
i
}
who
=
{
message
.
who
}
text
=
{
message
.
content
.
text
.
text
}
/
>
}
else
if
(
message
.
c
ontent
&&
message
.
content
.
description
)
{
else
if
(
message
.
c
ard
)
{
const
AvatarSrc
=
message
.
who
===
'소통이'
?
<
Icon
type
=
"robot"
/>
:
<
Icon
type
=
"smile"
/>
console
.
log
(
"message content"
,
message
.
content
)
...
...
@@ -165,7 +159,7 @@ function Chatbot() {
<
List
.
Item
.
Meta
avatar
=
{
<
Avatar
icon
=
{
AvatarSrc
}
/>
}
title
=
{
message
.
who
}
description
=
{
renderCards
(
message
.
c
ontent
)}
description
=
{
renderCards
(
message
.
c
ard
)}
/
>
<
/List.Item
>
<
/div
>
...
...
client/src/chatbot/sections/Message.js
View file @
72fec7f
...
...
@@ -3,7 +3,7 @@ import { List, Icon, Avatar } from 'antd';
function
Message
(
props
)
{
const
AvatarSrc
=
props
.
who
===
'
bot
'
?
<
Icon
type
=
"robot"
/>
:
<
Icon
type
=
"smile"
/>
const
AvatarSrc
=
props
.
who
===
'
소통이
'
?
<
Icon
type
=
"robot"
/>
:
<
Icon
type
=
"smile"
/>
return
(
<
List
.
Item
style
=
{{
padding
:
'1rem'
}}
>
...
...
Please
register
or
login
to post a comment