1 | |||
2 | from flask import request |
||
3 | from flask_restplus import Resource |
||
4 | from skf.api.security import security_headers, validate_privilege |
||
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
5 | from skf.api.chatbot.business import answer |
||
6 | from skf.api.chatbot.serializers import question_response, question_chatbot, message |
||
7 | from skf.api.restplus import api |
||
8 | |||
9 | ns = api.namespace('chatbot', description='Operations related to the chatbot interactions') |
||
10 | |||
11 | |||
12 | @ns.route('/question') |
||
13 | @api.response(404, 'Validation error', message) |
||
14 | class ChatbotQuestion(Resource): |
||
15 | |||
16 | @api.expect(question_chatbot) |
||
17 | @api.marshal_with(question_response) |
||
18 | @api.response(400, 'No results found', message) |
||
19 | def post(self): |
||
20 | """ |
||
21 | Returns a answer on a question. |
||
22 | * Privileges required: **none** |
||
23 | """ |
||
24 | data = request.json |
||
25 | print(data) |
||
26 | result = answer(data) |
||
27 | return result, 200, security_headers() |
||
28 | |||
29 |