| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  | # | 
					
						
							|  |  |  | #  Copyright 2024 The InfiniFlow Authors. All Rights Reserved. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | #  Licensed under the Apache License, Version 2.0 (the "License"); | 
					
						
							|  |  |  | #  you may not use this file except in compliance with the License. | 
					
						
							|  |  |  | #  You may obtain a copy of the License at | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | #      http://www.apache.org/licenses/LICENSE-2.0 | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | #  Unless required by applicable law or agreed to in writing, software | 
					
						
							|  |  |  | #  distributed under the License is distributed on an "AS IS" BASIS, | 
					
						
							|  |  |  | #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
					
						
							|  |  |  | #  See the License for the specific language governing permissions and | 
					
						
							|  |  |  | #  limitations under the License | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2024-11-15 18:51:09 +08:00
										 |  |  | import logging | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | from datetime import datetime | 
					
						
							| 
									
										
										
										
											2024-11-18 12:03:28 +08:00
										 |  |  | import json | 
					
						
							| 
									
										
										
										
											2024-08-21 17:48:00 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | from flask_login import login_required, current_user | 
					
						
							| 
									
										
										
										
											2024-10-15 16:48:38 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | from api.db.db_models import APIToken | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | from api.db.services.api_service import APITokenService | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  | from api.db.services.knowledgebase_service import KnowledgebaseService | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | from api.db.services.user_service import UserTenantService | 
					
						
							| 
									
										
										
										
											2024-11-15 17:30:56 +08:00
										 |  |  | from api import settings | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | from api.utils import current_timestamp, datetime_format | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  | from api.utils.api_utils import ( | 
					
						
							|  |  |  |     get_json_result, | 
					
						
							|  |  |  |     get_data_error_result, | 
					
						
							|  |  |  |     server_error_response, | 
					
						
							|  |  |  |     generate_confirmation_token, | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2024-11-14 17:51:21 +08:00
										 |  |  | from api.versions import get_ragflow_version | 
					
						
							| 
									
										
										
										
											2024-09-20 09:49:16 +08:00
										 |  |  | from rag.utils.storage_factory import STORAGE_IMPL, STORAGE_IMPL_TYPE | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  | from timeit import default_timer as timer | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from rag.utils.redis_conn import REDIS_CONN | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-08 21:23:51 +08:00
										 |  |  | @manager.route("/version", methods=["GET"])  # noqa: F821 | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  | @login_required | 
					
						
							|  |  |  | def version(): | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |     """
 | 
					
						
							|  |  |  |     Get the current version of the application. | 
					
						
							|  |  |  |     --- | 
					
						
							|  |  |  |     tags: | 
					
						
							|  |  |  |       - System | 
					
						
							|  |  |  |     security: | 
					
						
							|  |  |  |       - ApiKeyAuth: [] | 
					
						
							|  |  |  |     responses: | 
					
						
							|  |  |  |       200: | 
					
						
							|  |  |  |         description: Version retrieved successfully. | 
					
						
							|  |  |  |         schema: | 
					
						
							|  |  |  |           type: object | 
					
						
							|  |  |  |           properties: | 
					
						
							|  |  |  |             version: | 
					
						
							|  |  |  |               type: string | 
					
						
							|  |  |  |               description: Version number. | 
					
						
							|  |  |  |     """
 | 
					
						
							| 
									
										
										
										
											2024-11-14 17:51:21 +08:00
										 |  |  |     return get_json_result(data=get_ragflow_version()) | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-08 21:23:51 +08:00
										 |  |  | @manager.route("/status", methods=["GET"])  # noqa: F821 | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  | @login_required | 
					
						
							|  |  |  | def status(): | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |     """
 | 
					
						
							|  |  |  |     Get the system status. | 
					
						
							|  |  |  |     --- | 
					
						
							|  |  |  |     tags: | 
					
						
							|  |  |  |       - System | 
					
						
							|  |  |  |     security: | 
					
						
							|  |  |  |       - ApiKeyAuth: [] | 
					
						
							|  |  |  |     responses: | 
					
						
							|  |  |  |       200: | 
					
						
							|  |  |  |         description: System is operational. | 
					
						
							|  |  |  |         schema: | 
					
						
							|  |  |  |           type: object | 
					
						
							|  |  |  |           properties: | 
					
						
							|  |  |  |             es: | 
					
						
							|  |  |  |               type: object | 
					
						
							|  |  |  |               description: Elasticsearch status. | 
					
						
							|  |  |  |             storage: | 
					
						
							|  |  |  |               type: object | 
					
						
							|  |  |  |               description: Storage status. | 
					
						
							|  |  |  |             database: | 
					
						
							|  |  |  |               type: object | 
					
						
							|  |  |  |               description: Database status. | 
					
						
							|  |  |  |       503: | 
					
						
							|  |  |  |         description: Service unavailable. | 
					
						
							|  |  |  |         schema: | 
					
						
							|  |  |  |           type: object | 
					
						
							|  |  |  |           properties: | 
					
						
							|  |  |  |             error: | 
					
						
							|  |  |  |               type: string | 
					
						
							|  |  |  |               description: Error message. | 
					
						
							|  |  |  |     """
 | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  |     res = {} | 
					
						
							|  |  |  |     st = timer() | 
					
						
							|  |  |  |     try: | 
					
						
							| 
									
										
										
										
											2024-11-25 11:53:58 +08:00
										 |  |  |         res["doc_engine"] = settings.docStoreConn.health() | 
					
						
							|  |  |  |         res["doc_engine"]["elapsed"] = "{:.1f}".format((timer() - st) * 1000.0) | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  |     except Exception as e: | 
					
						
							| 
									
										
										
										
											2024-11-25 11:53:58 +08:00
										 |  |  |         res["doc_engine"] = { | 
					
						
							| 
									
										
										
										
											2024-11-12 14:59:41 +08:00
										 |  |  |             "type": "unknown", | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |             "status": "red", | 
					
						
							|  |  |  |             "elapsed": "{:.1f}".format((timer() - st) * 1000.0), | 
					
						
							|  |  |  |             "error": str(e), | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     st = timer() | 
					
						
							|  |  |  |     try: | 
					
						
							| 
									
										
										
										
											2024-09-09 09:41:14 +08:00
										 |  |  |         STORAGE_IMPL.health() | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |         res["storage"] = { | 
					
						
							|  |  |  |             "storage": STORAGE_IMPL_TYPE.lower(), | 
					
						
							|  |  |  |             "status": "green", | 
					
						
							|  |  |  |             "elapsed": "{:.1f}".format((timer() - st) * 1000.0), | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  |     except Exception as e: | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |         res["storage"] = { | 
					
						
							|  |  |  |             "storage": STORAGE_IMPL_TYPE.lower(), | 
					
						
							|  |  |  |             "status": "red", | 
					
						
							|  |  |  |             "elapsed": "{:.1f}".format((timer() - st) * 1000.0), | 
					
						
							|  |  |  |             "error": str(e), | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     st = timer() | 
					
						
							|  |  |  |     try: | 
					
						
							|  |  |  |         KnowledgebaseService.get_by_id("x") | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |         res["database"] = { | 
					
						
							| 
									
										
										
										
											2024-11-15 17:30:56 +08:00
										 |  |  |             "database": settings.DATABASE_TYPE.lower(), | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |             "status": "green", | 
					
						
							|  |  |  |             "elapsed": "{:.1f}".format((timer() - st) * 1000.0), | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  |     except Exception as e: | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |         res["database"] = { | 
					
						
							| 
									
										
										
										
											2024-11-15 17:30:56 +08:00
										 |  |  |             "database": settings.DATABASE_TYPE.lower(), | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |             "status": "red", | 
					
						
							|  |  |  |             "elapsed": "{:.1f}".format((timer() - st) * 1000.0), | 
					
						
							|  |  |  |             "error": str(e), | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     st = timer() | 
					
						
							|  |  |  |     try: | 
					
						
							| 
									
										
										
										
											2024-07-23 14:00:31 +08:00
										 |  |  |         if not REDIS_CONN.health(): | 
					
						
							|  |  |  |             raise Exception("Lost connection!") | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |         res["redis"] = { | 
					
						
							|  |  |  |             "status": "green", | 
					
						
							|  |  |  |             "elapsed": "{:.1f}".format((timer() - st) * 1000.0), | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  |     except Exception as e: | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |         res["redis"] = { | 
					
						
							|  |  |  |             "status": "red", | 
					
						
							|  |  |  |             "elapsed": "{:.1f}".format((timer() - st) * 1000.0), | 
					
						
							|  |  |  |             "error": str(e), | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 18:51:09 +08:00
										 |  |  |     task_executor_heartbeats = {} | 
					
						
							| 
									
										
										
										
											2024-08-21 17:48:00 +08:00
										 |  |  |     try: | 
					
						
							| 
									
										
										
										
											2024-11-15 18:51:09 +08:00
										 |  |  |         task_executors = REDIS_CONN.smembers("TASKEXE") | 
					
						
							|  |  |  |         now = datetime.now().timestamp() | 
					
						
							|  |  |  |         for task_executor_id in task_executors: | 
					
						
							|  |  |  |             heartbeats = REDIS_CONN.zrangebyscore(task_executor_id, now - 60*30, now) | 
					
						
							| 
									
										
										
										
											2024-11-18 12:03:28 +08:00
										 |  |  |             heartbeats = [json.loads(heartbeat) for heartbeat in heartbeats] | 
					
						
							| 
									
										
										
										
											2024-11-15 18:51:09 +08:00
										 |  |  |             task_executor_heartbeats[task_executor_id] = heartbeats | 
					
						
							|  |  |  |     except Exception: | 
					
						
							|  |  |  |         logging.exception("get task executor heartbeats failed!") | 
					
						
							|  |  |  |     res["task_executor_heartbeats"] = task_executor_heartbeats | 
					
						
							| 
									
										
										
										
											2024-08-21 17:48:00 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-16 20:14:53 +08:00
										 |  |  |     return get_json_result(data=res) | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-08 21:23:51 +08:00
										 |  |  | @manager.route("/new_token", methods=["POST"])  # noqa: F821 | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | @login_required | 
					
						
							|  |  |  | def new_token(): | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |     """
 | 
					
						
							|  |  |  |     Generate a new API token. | 
					
						
							|  |  |  |     --- | 
					
						
							|  |  |  |     tags: | 
					
						
							|  |  |  |       - API Tokens | 
					
						
							|  |  |  |     security: | 
					
						
							|  |  |  |       - ApiKeyAuth: [] | 
					
						
							|  |  |  |     parameters: | 
					
						
							|  |  |  |       - in: query | 
					
						
							|  |  |  |         name: name | 
					
						
							|  |  |  |         type: string | 
					
						
							|  |  |  |         required: false | 
					
						
							|  |  |  |         description: Name of the token. | 
					
						
							|  |  |  |     responses: | 
					
						
							|  |  |  |       200: | 
					
						
							|  |  |  |         description: Token generated successfully. | 
					
						
							|  |  |  |         schema: | 
					
						
							|  |  |  |           type: object | 
					
						
							|  |  |  |           properties: | 
					
						
							|  |  |  |             token: | 
					
						
							|  |  |  |               type: string | 
					
						
							|  |  |  |               description: The generated API token. | 
					
						
							|  |  |  |     """
 | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  |     try: | 
					
						
							|  |  |  |         tenants = UserTenantService.query(user_id=current_user.id) | 
					
						
							|  |  |  |         if not tenants: | 
					
						
							| 
									
										
										
										
											2024-11-05 11:02:31 +08:00
										 |  |  |             return get_data_error_result(message="Tenant not found!") | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-04 19:35:42 +08:00
										 |  |  |         tenant_id = [tenant for tenant in tenants if tenant.role == 'owner'][0].tenant_id | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |         obj = { | 
					
						
							|  |  |  |             "tenant_id": tenant_id, | 
					
						
							|  |  |  |             "token": generate_confirmation_token(tenant_id), | 
					
						
							| 
									
										
										
										
											2024-12-09 12:38:04 +08:00
										 |  |  |             "beta": generate_confirmation_token(generate_confirmation_token(tenant_id)).replace("ragflow-", "")[:32], | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |             "create_time": current_timestamp(), | 
					
						
							|  |  |  |             "create_date": datetime_format(datetime.now()), | 
					
						
							|  |  |  |             "update_time": None, | 
					
						
							|  |  |  |             "update_date": None, | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if not APITokenService.save(**obj): | 
					
						
							| 
									
										
										
										
											2024-11-05 11:02:31 +08:00
										 |  |  |             return get_data_error_result(message="Fail to new a dialog!") | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return get_json_result(data=obj) | 
					
						
							|  |  |  |     except Exception as e: | 
					
						
							|  |  |  |         return server_error_response(e) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-08 21:23:51 +08:00
										 |  |  | @manager.route("/token_list", methods=["GET"])  # noqa: F821 | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | @login_required | 
					
						
							|  |  |  | def token_list(): | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |     """
 | 
					
						
							|  |  |  |     List all API tokens for the current user. | 
					
						
							|  |  |  |     --- | 
					
						
							|  |  |  |     tags: | 
					
						
							|  |  |  |       - API Tokens | 
					
						
							|  |  |  |     security: | 
					
						
							|  |  |  |       - ApiKeyAuth: [] | 
					
						
							|  |  |  |     responses: | 
					
						
							|  |  |  |       200: | 
					
						
							|  |  |  |         description: List of API tokens. | 
					
						
							|  |  |  |         schema: | 
					
						
							|  |  |  |           type: object | 
					
						
							|  |  |  |           properties: | 
					
						
							|  |  |  |             tokens: | 
					
						
							|  |  |  |               type: array | 
					
						
							|  |  |  |               items: | 
					
						
							|  |  |  |                 type: object | 
					
						
							|  |  |  |                 properties: | 
					
						
							|  |  |  |                   token: | 
					
						
							|  |  |  |                     type: string | 
					
						
							|  |  |  |                     description: The API token. | 
					
						
							|  |  |  |                   name: | 
					
						
							|  |  |  |                     type: string | 
					
						
							|  |  |  |                     description: Name of the token. | 
					
						
							|  |  |  |                   create_time: | 
					
						
							|  |  |  |                     type: string | 
					
						
							|  |  |  |                     description: Token creation time. | 
					
						
							|  |  |  |     """
 | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  |     try: | 
					
						
							|  |  |  |         tenants = UserTenantService.query(user_id=current_user.id) | 
					
						
							|  |  |  |         if not tenants: | 
					
						
							| 
									
										
										
										
											2024-11-05 11:02:31 +08:00
										 |  |  |             return get_data_error_result(message="Tenant not found!") | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-04 19:35:42 +08:00
										 |  |  |         tenant_id = [tenant for tenant in tenants if tenant.role == 'owner'][0].tenant_id | 
					
						
							| 
									
										
										
										
											2024-12-17 13:58:26 +08:00
										 |  |  |         objs = APITokenService.query(tenant_id=tenant_id) | 
					
						
							|  |  |  |         objs = [o.to_dict() for o in objs] | 
					
						
							|  |  |  |         for o in objs: | 
					
						
							|  |  |  |             if not o["beta"]: | 
					
						
							|  |  |  |                 o["beta"] = generate_confirmation_token(generate_confirmation_token(tenants[0].tenant_id)).replace("ragflow-", "")[:32] | 
					
						
							|  |  |  |                 APITokenService.filter_update([APIToken.tenant_id == tenant_id, APIToken.token == o["token"]], o) | 
					
						
							|  |  |  |         return get_json_result(data=objs) | 
					
						
							| 
									
										
										
										
											2024-10-15 15:47:40 +08:00
										 |  |  |     except Exception as e: | 
					
						
							|  |  |  |         return server_error_response(e) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-15 16:48:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-08 21:23:51 +08:00
										 |  |  | @manager.route("/token/<token>", methods=["DELETE"])  # noqa: F821 | 
					
						
							| 
									
										
										
										
											2024-10-15 16:48:38 +08:00
										 |  |  | @login_required | 
					
						
							| 
									
										
										
										
											2024-10-16 16:10:24 +08:00
										 |  |  | def rm(token): | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |     """
 | 
					
						
							|  |  |  |     Remove an API token. | 
					
						
							|  |  |  |     --- | 
					
						
							|  |  |  |     tags: | 
					
						
							|  |  |  |       - API Tokens | 
					
						
							|  |  |  |     security: | 
					
						
							|  |  |  |       - ApiKeyAuth: [] | 
					
						
							|  |  |  |     parameters: | 
					
						
							|  |  |  |       - in: path | 
					
						
							|  |  |  |         name: token | 
					
						
							|  |  |  |         type: string | 
					
						
							|  |  |  |         required: true | 
					
						
							|  |  |  |         description: The API token to remove. | 
					
						
							|  |  |  |     responses: | 
					
						
							|  |  |  |       200: | 
					
						
							|  |  |  |         description: Token removed successfully. | 
					
						
							|  |  |  |         schema: | 
					
						
							|  |  |  |           type: object | 
					
						
							|  |  |  |           properties: | 
					
						
							|  |  |  |             success: | 
					
						
							|  |  |  |               type: boolean | 
					
						
							|  |  |  |               description: Deletion status. | 
					
						
							|  |  |  |     """
 | 
					
						
							| 
									
										
										
										
											2024-10-16 16:10:24 +08:00
										 |  |  |     APITokenService.filter_delete( | 
					
						
							| 
									
										
										
										
											2024-11-04 08:35:36 +01:00
										 |  |  |         [APIToken.tenant_id == current_user.id, APIToken.token == token] | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     return get_json_result(data=True) | 
					
						
							| 
									
										
										
										
											2025-03-21 09:38:15 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @manager.route('/config', methods=['GET'])  # noqa: F821 | 
					
						
							|  |  |  | def get_config(): | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     Get system configuration. | 
					
						
							|  |  |  |     --- | 
					
						
							|  |  |  |     tags: | 
					
						
							|  |  |  |         - System | 
					
						
							|  |  |  |     responses: | 
					
						
							|  |  |  |         200: | 
					
						
							|  |  |  |             description: Return system configuration | 
					
						
							|  |  |  |             schema: | 
					
						
							|  |  |  |                 type: object | 
					
						
							|  |  |  |                 properties: | 
					
						
							|  |  |  |                     registerEnable: | 
					
						
							|  |  |  |                         type: integer 0 means disabled, 1 means enabled | 
					
						
							|  |  |  |                         description: Whether user registration is enabled | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     return get_json_result(data={ | 
					
						
							|  |  |  |         "registerEnabled": settings.REGISTER_ENABLED | 
					
						
							|  |  |  |     }) |