|
8 | 8 | title='ChatForge API', |
9 | 9 | description='Scalable AI Chatbot API built with Flask, OpenAI, and vector memory', |
10 | 10 | doc='/docs/', |
11 | | - prefix='/api' |
| 11 | + prefix='/api', |
| 12 | + authorizations={ |
| 13 | + 'Bearer': { |
| 14 | + 'type': 'apiKey', |
| 15 | + 'in': 'header', |
| 16 | + 'name': 'Authorization', |
| 17 | + 'description': 'Type in the *\'Value\'* input box: **Bearer {token}**' |
| 18 | + } |
| 19 | + }, |
| 20 | + security='Bearer' |
12 | 21 | ) |
13 | 22 |
|
14 | 23 | # Namespace definitions |
|
78 | 87 | @api_blueprint.route('/') |
79 | 88 | class APIInfo(Resource): |
80 | 89 | @api.doc('api_info') |
| 90 | + @api.marshal_with(success_response_model) |
81 | 91 | def get(self): |
82 | 92 | """API information and health check""" |
83 | 93 | return { |
84 | 94 | 'message': 'ChatForge API is running', |
85 | | - 'status': 'healthy', |
86 | | - 'version': '1.0.0', |
87 | | - 'docs': '/api/docs/' |
| 95 | + 'status': 200, |
| 96 | + 'data': { |
| 97 | + 'version': '1.0.0', |
| 98 | + 'docs': '/api/docs/' |
| 99 | + } |
88 | 100 | } |
89 | 101 |
|
| 102 | +# Auth namespace endpoints |
| 103 | +@auth_ns.route('/login') |
| 104 | +class Login(Resource): |
| 105 | + @auth_ns.doc('login') |
| 106 | + @auth_ns.expect(login_model) |
| 107 | + @auth_ns.marshal_with(success_response_model, code=200) |
| 108 | + @auth_ns.marshal_with(error_response_model, code=401) |
| 109 | + def post(self): |
| 110 | + """ |
| 111 | + User login endpoint |
| 112 | + |
| 113 | + Returns JWT access token on successful authentication |
| 114 | + """ |
| 115 | + pass |
| 116 | + |
| 117 | +@auth_ns.route('/register') |
| 118 | +class Register(Resource): |
| 119 | + @auth_ns.doc('register') |
| 120 | + @auth_ns.expect(register_model) |
| 121 | + @auth_ns.marshal_with(success_response_model, code=201) |
| 122 | + @auth_ns.marshal_with(error_response_model, code=400) |
| 123 | + def post(self): |
| 124 | + """ |
| 125 | + User registration endpoint |
| 126 | + |
| 127 | + Creates a new user account |
| 128 | + """ |
| 129 | + pass |
| 130 | + |
| 131 | +# Bot namespace endpoints |
| 132 | +@bot_ns.route('/query') |
| 133 | +class ChatQuery(Resource): |
| 134 | + @bot_ns.doc('chat_query') |
| 135 | + @bot_ns.expect(chat_query_model) |
| 136 | + @bot_ns.marshal_with(success_response_model, code=200) |
| 137 | + @bot_ns.marshal_with(error_response_model, code=403) |
| 138 | + def post(self): |
| 139 | + """ |
| 140 | + Send a chat query to the bot |
| 141 | + |
| 142 | + Processes user message and returns AI-generated response |
| 143 | + """ |
| 144 | + pass |
| 145 | + |
| 146 | +@bot_ns.route('/create_bot') |
| 147 | +class CreateBot(Resource): |
| 148 | + @bot_ns.doc('create_bot', security='Bearer') |
| 149 | + @bot_ns.expect(create_bot_model) |
| 150 | + @bot_ns.marshal_with(success_response_model, code=201) |
| 151 | + @bot_ns.marshal_with(error_response_model, code=400) |
| 152 | + def post(self): |
| 153 | + """ |
| 154 | + Create a new chatbot |
| 155 | + |
| 156 | + Requires JWT authentication |
| 157 | + """ |
| 158 | + pass |
| 159 | + |
0 commit comments