Spaces:
Sleeping
Sleeping
Initial Draft
Browse files
lib/api/endpoints/VectorStoreAPI.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask.views import MethodView
|
2 |
+
from flask import request,Response
|
3 |
+
import json
|
4 |
+
import traceback
|
5 |
+
import logging
|
6 |
+
|
7 |
+
class VectorStoreAPI(MethodView):
|
8 |
+
lv_logger = logging.getLogger(__name__)
|
9 |
+
|
10 |
+
def get(self):
|
11 |
+
resp = { "error": False, "message":None,"data":None}
|
12 |
+
status = 200
|
13 |
+
return Response(json.dumps(resp), status=status, mimetype='application/json')
|
14 |
+
|
15 |
+
def post(self):
|
16 |
+
try:
|
17 |
+
lv_data = request.get_json()
|
18 |
+
print(lv_data)
|
19 |
+
return Response(json.dumps({"status":"success"}), status=200, mimetype='application/json')
|
20 |
+
except Exception as e:
|
21 |
+
self.lv_logger.error(e)
|
22 |
+
self.lv_logger.error(type(e))
|
23 |
+
self.lv_logger.error(traceback.format_exc())
|
24 |
+
|
25 |
+
print("Error in VectorStoreAPI.post: ", e)
|
26 |
+
print("Error in VectorStoreAPI.post: ", traceback.format_exc())
|
27 |
+
return Response(json.dumps({"status":"failed"}), status=500, mimetype='application/json')
|