Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-155
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-155
2021-155
Commits
aab52fe9
Commit
aab52fe9
authored
Jul 02, 2021
by
Ekanayake P.M.D.P IT18013610
☺
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'it18013610' into 'master'
Scrapper configured See merge request
!6
parents
e7a4969f
520bf736
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
145 additions
and
4 deletions
+145
-4
backend/python/auto-answer/scrapper.py
backend/python/auto-answer/scrapper.py
+5
-3
backend/python/auto-answer/youtube.py
backend/python/auto-answer/youtube.py
+0
-1
backend/requirements.txt
backend/requirements.txt
+10
-0
client/components/automated-answer-container/automated-answer-container.module.css
...ed-answer-container/automated-answer-container.module.css
+35
-0
client/components/automated-answer-container/index.js
client/components/automated-answer-container/index.js
+33
-0
client/components/automated-answer/automated-answer.module.css
...t/components/automated-answer/automated-answer.module.css
+15
-0
client/components/automated-answer/index.js
client/components/automated-answer/index.js
+11
-0
client/components/automated-answer/no-automated-answer/index.js
.../components/automated-answer/no-automated-answer/index.js
+14
-0
client/components/automated-answer/no-automated-answer/no-automated-answer.module.css
...answer/no-automated-answer/no-automated-answer.module.css
+19
-0
client/pages/questions/[slug].js
client/pages/questions/[slug].js
+3
-0
No files found.
backend/python/auto-answer/scrapper.py
View file @
aab52fe9
...
...
@@ -21,9 +21,9 @@ def saveAnswer(ans_id, stackoverflow, videos):
if
__name__
==
"__main__"
:
# title = input("Enter question title: ")
title
=
"python django or flask for web development"
# sys.argv[1]
tags
=
[
"react"
]
# sys.argv[2
]
AUTO_ANS_ID
=
"60d746076689344694ad9e30"
# sys.argv[3]
title
=
sys
.
argv
[
1
]
# "python django or flask for web development"
tags
=
sys
.
argv
[
2
]
# ["react"
]
AUTO_ANS_ID
=
sys
.
argv
[
3
]
# "60d746076689344694ad9e30" #
stack
=
STOF
(
title
)
ans
=
stack
.
searchQuestion
()
...
...
@@ -37,3 +37,5 @@ if __name__ == "__main__":
youtube
=
Youtube
(
title
,
tags
)
videos
=
youtube
.
find_videos
()
saveAnswer
(
AUTO_ANS_ID
,
ans
,
videos
)
print
(
"WORKED"
)
sys
.
stdout
.
flush
()
backend/python/auto-answer/youtube.py
View file @
aab52fe9
...
...
@@ -27,4 +27,3 @@ class Youtube:
videos
.
append
(
i
[
"link"
])
print
(
i
[
"link"
])
return
videos
backend/requirements.txt
0 → 100644
View file @
aab52fe9
bson==0.5.10
beautifulsoup4==4.9.3
dnspython==2.1.0
lxml==4.6.1
pymongo==3.11.4
regex==2020.7.14
requests==2.24.0
requests-html==0.10.0
scipy==1.5.4
youtube-search-python==1.4.6
client/components/automated-answer-container/automated-answer-container.module.css
0 → 100644
View file @
aab52fe9
.container
{
padding-top
:
10px
;
h2
{
font-size
:
18px
;
font-weight
:
400
;
color
:
var
(
--black-800
);
}
}
.header
{
display
:
flex
;
align-items
:
center
;
margin-top
:
10px
;
margin-bottom
:
10px
;
}
.fill
{
flex
:
1
;
}
.spinner
{
display
:
flex
;
margin
:
auto
;
height
:
3em
;
width
:
3em
;
}
.wrapper
{
background-color
:
var
(
--black-800
);
color
:
var
(
--white
);
border-radius
:
5px
;
margin
:
2rem
1rem
2rem
1rem
;
padding
:
1em
1em
;
box-shadow
:
rgba
(
99
,
99
,
99
,
0.2
)
0px
2px
8px
0px
;
}
client/components/automated-answer-container/index.js
0 → 100644
View file @
aab52fe9
import
React
,
{
useEffect
,
useState
}
from
'
react
'
import
NoAutomatedAnswer
from
'
../automated-answer/no-automated-answer
'
import
{
Spinner
}
from
'
../icons
'
import
styles
from
'
./automated-answer-container.module.css
'
const
AutomatedAnswerContainer
=
({
question_id
})
=>
{
const
[
loading
,
setLoading
]
=
useState
(
true
)
useEffect
(()
=>
{
setTimeout
(()
=>
{
setLoading
(
false
)
},
4000
)
console
.
log
(
question_id
)
},
[
question_id
])
return
(
<
div
className
=
{
styles
.
container
}
>
<
div
className
=
{
styles
.
header
}
>
<
div
className
=
{
styles
.
fill
}
>
<
h2
>
Automated
Answer
<
/h2
>
<
/div
>
<
/div
>
<
div
className
=
{
styles
.
wrapper
}
>
{
loading
?
(
<
Spinner
className
=
{
styles
.
spinner
}
/
>
)
:
(
<
NoAutomatedAnswer
question_id
=
{
question_id
}
/
>
)}
<
/div
>
<
/div
>
)
}
export
default
AutomatedAnswerContainer
client/components/automated-answer/automated-answer.module.css
0 → 100644
View file @
aab52fe9
.container
{
display
:
grid
;
grid-template-rows
:
auto
1
fr
auto
auto
;
padding
:
20px
;
grid-gap
:
10px
;
}
.textarea
{
height
:
200px
;
}
.status
{
color
:
var
(
--red-500
);
font-size
:
12px
;
}
client/components/automated-answer/index.js
0 → 100644
View file @
aab52fe9
import
React
from
'
react
'
const
AutomatedAnswer
=
({
automatedAnswer
})
=>
{
return
(
<
div
>
<
h1
>
Actual
automated
answer
<
/h1
>
<
/div
>
)
}
export
default
AutomatedAnswer
client/components/automated-answer/no-automated-answer/index.js
0 → 100644
View file @
aab52fe9
import
React
from
'
react
'
import
styles
from
'
./no-automated-answer.module.css
'
const
NoAutomatedAnswer
=
({
question_id
})
=>
{
return
(
<
div
className
=
{
styles
.
no_automated_answer
}
>
<
h1
className
=
{
styles
.
title
}
>
No
Automated
answer
found
for
this
question
<
/h1
>
<
button
className
=
{
styles
.
generate_btn
}
>
Generate
one
<
/button
>
<
/div
>
)
}
export
default
NoAutomatedAnswer
client/components/automated-answer/no-automated-answer/no-automated-answer.module.css
0 → 100644
View file @
aab52fe9
.no_automated_answer
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
}
.generate_btn
{
color
:
#fff
;
background-color
:
var
(
--blue-500
);
border
:
1px
solid
transparent
;
box-shadow
:
inset
0
1px
0
0
rgb
(
255
255
255
/
40%
);
padding
:
0.8em
;
margin
:
1em
;
}
.title
{
font-size
:
1.5em
;
text-align
:
center
;
}
client/pages/questions/[slug].js
View file @
aab52fe9
...
...
@@ -14,6 +14,7 @@ import CommentItem from '../../components/post/comment-list/comment-item'
import
AnswerContainer
from
'
../../components/answer-container
'
import
AddAnswer
from
'
../../components/add-answer
'
import
{
Spinner
}
from
'
../../components/icons
'
import
AutomatedAnswerContainer
from
'
../../components/automated-answer-container
'
const
QuestionDetail
=
({
questionId
,
title
})
=>
{
const
[
question
,
setQuestion
]
=
useState
(
null
)
...
...
@@ -93,6 +94,8 @@ const QuestionDetail = ({ questionId, title }) => {
<
/CommentList
>
<
/PostWrapper
>
<
AutomatedAnswerContainer
question_id
=
{
questionId
}
/
>
{
question
.
answers
.
length
>
0
&&
(
<
AnswerContainer
answersCount
=
{
question
.
answers
.
length
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment