From 6a3827e99e7b98d29a2fd2f1b050260d98af0a8e Mon Sep 17 00:00:00 2001 From: Formartha Date: Tue, 5 Mar 2024 15:44:14 +0200 Subject: [PATCH] added ability to track status of upsert as well as improved ngnix --- README.md | 4 ++++ ai1899/api_routes.py | 9 +++++++++ nginx.conf | 10 ++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4af373f..7ca1299 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ ai1899 cover +------ + +[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/mit) + What? ------ ai1899 is a project designed for anyone seeking to utilize humanized queries for selecting test cases efficiently. diff --git a/ai1899/api_routes.py b/ai1899/api_routes.py index 6befcc4..6b2c63a 100644 --- a/ai1899/api_routes.py +++ b/ai1899/api_routes.py @@ -158,6 +158,15 @@ async def upsert_collection(): return jsonify({'error': str(e)}), 500 +@ai_api.route('/check_upsert_status/', methods=["GET"]) +def check_task_status(task_id): + if request.method == "GET": + result = uc.AsyncResult(task_id) + return result.state # This will return the state of the task as a string + else: + return jsonify({"error": "Method Not Allowed"}), 405 + + @ai_api.route("/collections", methods=["GET"]) def get_collections(): return jsonify({"collections": [col.name for col in client.get_collections().collections]}), 200 diff --git a/nginx.conf b/nginx.conf index 52db918..6a28ad7 100644 --- a/nginx.conf +++ b/nginx.conf @@ -5,15 +5,17 @@ http { listen 80; location /ai/ { + rewrite ^/ai/(.*) /ai/$1 break; proxy_pass http://ai:5555/; } - # There is a known issue with qdrant behind reverse proxy, pending for solution: https://github.com/qdrant/qdrant-web-ui/issues/94 - #location /qdrant/ { - # proxy_pass http://qdrant-container:6333/dashboard/; - #} + location /qdrant/ { + rewrite ^/qdrant/(.*) /$1 break; + proxy_pass http://qdrant-container:6333/; + } location /redis-commander/ { + rewrite ^/redis-commander/(.*) /$1 break; proxy_pass http://redis-commander:8081/; }