|
|
|
|
@@ -7,7 +7,7 @@ import uuid
|
|
|
|
|
from bson.binary import Binary, UuidRepresentation
|
|
|
|
|
from bson.dbref import DBRef
|
|
|
|
|
from bson.objectid import ObjectId
|
|
|
|
|
from flask import Blueprint, jsonify, make_response, redirect, request
|
|
|
|
|
from flask import Blueprint, current_app, jsonify, make_response, redirect, request
|
|
|
|
|
from flask_restx import fields, inputs, Namespace, Resource
|
|
|
|
|
from werkzeug.utils import secure_filename
|
|
|
|
|
|
|
|
|
|
@@ -82,7 +82,8 @@ class DeleteConversation(Resource):
|
|
|
|
|
try:
|
|
|
|
|
conversations_collection.delete_one({"_id": ObjectId(conversation_id)})
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error deleting conversation: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -96,7 +97,8 @@ class DeleteAllConversations(Resource):
|
|
|
|
|
try:
|
|
|
|
|
conversations_collection.delete_many({"user": user_id})
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error deleting all conversations: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -113,7 +115,8 @@ class GetConversations(Resource):
|
|
|
|
|
for conversation in conversations
|
|
|
|
|
]
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error retrieving conversations: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
return make_response(jsonify(list_conversations), 200)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -137,7 +140,8 @@ class GetSingleConversation(Resource):
|
|
|
|
|
if not conversation:
|
|
|
|
|
return make_response(jsonify({"status": "not found"}), 404)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error retrieving conversation: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
return make_response(jsonify(conversation["queries"]), 200)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -169,7 +173,8 @@ class UpdateConversationName(Resource):
|
|
|
|
|
{"_id": ObjectId(data["id"])}, {"$set": {"name": data["name"]}}
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error updating conversation name: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -220,7 +225,8 @@ class SubmitFeedback(Resource):
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error submitting feedback: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -243,7 +249,8 @@ class DeleteByIds(Resource):
|
|
|
|
|
if result:
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error deleting indexes: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
@@ -276,7 +283,8 @@ class DeleteOldIndexes(Resource):
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
pass
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error deleting old indexes: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
sources_collection.delete_one({"_id": ObjectId(source_id)})
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
@@ -388,8 +396,8 @@ class UploadFile(Resource):
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
except Exception as err:
|
|
|
|
|
print(f"Error: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error uploading file: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
return make_response(jsonify({"success": True, "task_id": task.id}), 200)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -434,7 +442,8 @@ class UploadRemote(Resource):
|
|
|
|
|
loader=loader,
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error uploading remote source: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True, "task_id": task.id}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -466,7 +475,8 @@ class TaskStatus(Resource):
|
|
|
|
|
):
|
|
|
|
|
task_meta = str(task_meta) # Convert to a string representation
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error getting task status: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"status": task.status, "result": task_meta}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -541,7 +551,8 @@ class PaginatedSources(Resource):
|
|
|
|
|
return make_response(jsonify(response), 200)
|
|
|
|
|
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error retrieving paginated sources: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_ns.route("/api/sources")
|
|
|
|
|
@@ -601,7 +612,8 @@ class CombinedJson(Resource):
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error retrieving sources: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify(data), 200)
|
|
|
|
|
|
|
|
|
|
@@ -627,7 +639,8 @@ class CheckDocs(Resource):
|
|
|
|
|
if os.path.exists(vectorstore) or data["docs"] == "default":
|
|
|
|
|
return {"status": "exists"}, 200
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error checking document: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"status": "not found"}), 404)
|
|
|
|
|
|
|
|
|
|
@@ -665,7 +678,8 @@ class CreatePrompt(Resource):
|
|
|
|
|
)
|
|
|
|
|
new_id = str(resp.inserted_id)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error creating prompt: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"id": new_id}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -692,7 +706,8 @@ class GetPrompts(Resource):
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error retrieving prompts: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify(list_prompts), 200)
|
|
|
|
|
|
|
|
|
|
@@ -733,7 +748,8 @@ class GetSinglePrompt(Resource):
|
|
|
|
|
|
|
|
|
|
prompt = prompts_collection.find_one({"_id": ObjectId(prompt_id)})
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error retrieving prompt: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"content": prompt["content"]}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -757,7 +773,8 @@ class DeletePrompt(Resource):
|
|
|
|
|
try:
|
|
|
|
|
prompts_collection.delete_one({"_id": ObjectId(data["id"])})
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error deleting prompt: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -790,7 +807,8 @@ class UpdatePrompt(Resource):
|
|
|
|
|
{"$set": {"name": data["name"], "content": data["content"]}},
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error updating prompt: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -825,7 +843,8 @@ class GetApiKeys(Resource):
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error retrieving API keys: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
return make_response(jsonify(list_keys), 200)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -869,7 +888,8 @@ class CreateApiKey(Resource):
|
|
|
|
|
resp = api_key_collection.insert_one(new_api_key)
|
|
|
|
|
new_id = str(resp.inserted_id)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error creating API key: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"id": new_id, "key": key}), 201)
|
|
|
|
|
|
|
|
|
|
@@ -895,7 +915,8 @@ class DeleteApiKey(Resource):
|
|
|
|
|
if result.deleted_count == 0:
|
|
|
|
|
return {"success": False, "message": "API Key not found"}, 404
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return {"success": False, "error": str(err)}, 400
|
|
|
|
|
current_app.logger.error(f"Error deleting API key: {err}")
|
|
|
|
|
return {"success": False}, 400
|
|
|
|
|
|
|
|
|
|
return {"success": True}, 200
|
|
|
|
|
|
|
|
|
|
@@ -1095,7 +1116,8 @@ class ShareConversation(Resource):
|
|
|
|
|
201,
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error sharing conversation: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_ns.route("/api/shared_conversation/<string:identifier>")
|
|
|
|
|
@@ -1150,7 +1172,8 @@ class GetPubliclySharedConversations(Resource):
|
|
|
|
|
res["api_key"] = shared["api_key"]
|
|
|
|
|
return make_response(jsonify(res), 200)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error getting shared conversation: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_ns.route("/api/get_message_analytics")
|
|
|
|
|
@@ -1191,7 +1214,8 @@ class GetMessageAnalytics(Resource):
|
|
|
|
|
else None
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error getting API key: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
end_date = datetime.datetime.now(datetime.timezone.utc)
|
|
|
|
|
|
|
|
|
|
if filter_option == "last_hour":
|
|
|
|
|
@@ -1284,7 +1308,8 @@ class GetMessageAnalytics(Resource):
|
|
|
|
|
daily_messages[entry["_id"]["day"]] = entry["total_messages"]
|
|
|
|
|
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error getting message analytics: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(
|
|
|
|
|
jsonify({"success": True, "messages": daily_messages}), 200
|
|
|
|
|
@@ -1326,7 +1351,8 @@ class GetTokenAnalytics(Resource):
|
|
|
|
|
else None
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error getting API key: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
end_date = datetime.datetime.now(datetime.timezone.utc)
|
|
|
|
|
|
|
|
|
|
if filter_option == "last_hour":
|
|
|
|
|
@@ -1435,7 +1461,8 @@ class GetTokenAnalytics(Resource):
|
|
|
|
|
daily_token_usage[entry["_id"]["day"]] = entry["total_tokens"]
|
|
|
|
|
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error getting token analytics: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(
|
|
|
|
|
jsonify({"success": True, "token_usage": daily_token_usage}), 200
|
|
|
|
|
@@ -1477,8 +1504,9 @@ class GetFeedbackAnalytics(Resource):
|
|
|
|
|
else None
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
|
|
|
|
|
current_app.logger.error(f"Error getting API key: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
end_date = datetime.datetime.now(datetime.timezone.utc)
|
|
|
|
|
|
|
|
|
|
if filter_option == "last_hour":
|
|
|
|
|
@@ -1575,7 +1603,8 @@ class GetFeedbackAnalytics(Resource):
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error getting feedback analytics: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(
|
|
|
|
|
jsonify({"success": True, "feedback": daily_feedback}), 200
|
|
|
|
|
@@ -1617,7 +1646,8 @@ class GetUserLogs(Resource):
|
|
|
|
|
else None
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error getting API key: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
query = {}
|
|
|
|
|
if api_key:
|
|
|
|
|
@@ -1701,7 +1731,8 @@ class ManageSync(Resource):
|
|
|
|
|
update_data,
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error updating sync frequency: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -1736,7 +1767,8 @@ class TextToSpeech(Resource):
|
|
|
|
|
200,
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error synthesizing audio: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_ns.route("/api/available_tools")
|
|
|
|
|
@@ -1760,7 +1792,8 @@ class AvailableTools(Resource):
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error getting available tools: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True, "data": tools_metadata}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -1778,7 +1811,8 @@ class GetTools(Resource):
|
|
|
|
|
tool.pop("_id")
|
|
|
|
|
user_tools.append(tool)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error getting user tools: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True, "tools": user_tools}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -1850,7 +1884,8 @@ class CreateTool(Resource):
|
|
|
|
|
resp = user_tools_collection.insert_one(new_tool)
|
|
|
|
|
new_id = str(resp.inserted_id)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error creating tool: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"id": new_id}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -1901,7 +1936,8 @@ class UpdateTool(Resource):
|
|
|
|
|
{"$set": update_data},
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error updating tool: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -1933,7 +1969,8 @@ class UpdateToolConfig(Resource):
|
|
|
|
|
{"$set": {"config": data["config"]}},
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error updating tool config: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -1967,7 +2004,8 @@ class UpdateToolActions(Resource):
|
|
|
|
|
{"$set": {"actions": data["actions"]}},
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error updating tool actions: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -1999,7 +2037,8 @@ class UpdateToolStatus(Resource):
|
|
|
|
|
{"$set": {"status": data["status"]}},
|
|
|
|
|
)
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return make_response(jsonify({"success": False, "error": str(err)}), 400)
|
|
|
|
|
current_app.logger.error(f"Error updating tool status: {err}")
|
|
|
|
|
return make_response(jsonify({"success": False}), 400)
|
|
|
|
|
|
|
|
|
|
return make_response(jsonify({"success": True}), 200)
|
|
|
|
|
|
|
|
|
|
@@ -2025,7 +2064,8 @@ class DeleteTool(Resource):
|
|
|
|
|
if result.deleted_count == 0:
|
|
|
|
|
return {"success": False, "message": "Tool not found"}, 404
|
|
|
|
|
except Exception as err:
|
|
|
|
|
return {"success": False, "error": str(err)}, 400
|
|
|
|
|
current_app.logger.error(f"Error deleting tool: {err}")
|
|
|
|
|
return {"success": False}, 400
|
|
|
|
|
|
|
|
|
|
return {"success": True}, 200
|
|
|
|
|
|
|
|
|
|
|