-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test version #1503
test version #1503
Conversation
…csGPT into feat/tools-section
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
feat: tools frontend and endpoints refactor
Tools + agent
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1503 +/- ##
==========================================
- Coverage 35.90% 35.51% -0.40%
==========================================
Files 68 73 +5
Lines 3275 3644 +369
==========================================
+ Hits 1176 1294 +118
- Misses 2099 2350 +251 ☔ View full report in Codecov by Sentry. |
@@ -1801,4 +1806,296 @@ | |||
200, | |||
) | |||
except Exception as err: | |||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | |||
return make_response(jsonify({"success": False, "error": str(err)}), 400) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that detailed error messages and stack traces are not exposed to the end user. Instead, we should log the detailed error information on the server and return a generic error message to the user. This can be achieved by modifying the exception handling code to log the error and return a generic message.
- Modify the exception handling code in the
post
method of theTextToSpeech
class to log the error and return a generic error message. - Add an import statement for the
logging
module to enable logging of errors.
-
Copy modified line R23 -
Copy modified lines R1810-R1811
@@ -22,2 +22,3 @@ | ||
from application.vectorstore.vector_creator import VectorCreator | ||
import logging | ||
|
||
@@ -1808,3 +1809,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error("Error in TextToSpeech post method: %s", str(err)) | ||
return make_response(jsonify({"success": False, "message": "An internal error has occurred."}), 500) | ||
|
} | ||
) | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that detailed error information, including stack traces, is not exposed to the end user. Instead, we should log the detailed error information on the server and return a generic error message to the user. This can be achieved by modifying the exception handling code to log the error and return a generic message.
- Import the
logging
module to enable logging of error messages. - Replace the current exception handling code to log the error message and return a generic error message to the user.
-
Copy modified line R6 -
Copy modified lines R1809-R1810 -
Copy modified lines R1834-R1835 -
Copy modified lines R1853-R1854
@@ -5,3 +5,3 @@ | ||
import uuid | ||
|
||
import logging | ||
from bson.binary import Binary, UuidRepresentation | ||
@@ -1808,3 +1808,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error("Error in TextToSpeech: %s", str(err)) | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
||
@@ -1832,3 +1833,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error("Error in AvailableTools: %s", str(err)) | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
||
@@ -1850,3 +1852,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error("Error in GetTools: %s", str(err)) | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
tool.pop("_id") | ||
user_tools.append(tool) | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that detailed error information is not exposed to the user. Instead, we should log the error on the server and return a generic error message to the user. This can be achieved by modifying the exception handling code to log the error and return a generic message.
- Import the
logging
module to enable logging of errors. - Replace the current exception handling code to log the error and return a generic error message.
-
Copy modified line R6 -
Copy modified lines R1810-R1811 -
Copy modified lines R1835-R1836 -
Copy modified lines R1854-R1855
@@ -5,2 +5,3 @@ | ||
import uuid | ||
import logging | ||
|
||
@@ -1808,3 +1809,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error("Error in TextToSpeech: %s", err) | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
||
@@ -1832,3 +1834,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error("Error in AvailableTools: %s", err) | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
||
@@ -1850,3 +1853,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error("Error in GetTools: %s", err) | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
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) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that detailed error information is not exposed to the user. Instead, we should log the error on the server and return a generic error message to the user. This can be achieved by modifying the exception handling block to log the error and return a generic message.
- Import the
logging
module to enable logging of errors. - Replace the current return statement in the exception block with a logging statement and a generic error message.
-
Copy modified line R6 -
Copy modified lines R1923-R1924
@@ -5,3 +5,3 @@ | ||
import uuid | ||
|
||
import logging | ||
from bson.binary import Binary, UuidRepresentation | ||
@@ -1922,3 +1922,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error(f"Error occurred while creating tool: {err}") | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
{"$set": update_data}, | ||
) | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that detailed error messages and stack traces are not exposed to the end user. Instead, we should log the error details on the server and return a generic error message to the user. This can be achieved by modifying the exception handling code to log the error and return a generic response.
- Import the
logging
module to enable logging of error messages. - Replace the current exception handling code to log the error and return a generic error message.
-
Copy modified line R23 -
Copy modified lines R1975-R1976 -
Copy modified lines R2008-R2009
@@ -22,2 +22,3 @@ | ||
from application.vectorstore.vector_creator import VectorCreator | ||
import logging | ||
|
||
@@ -1973,3 +1974,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error("An error occurred while updating the tool: %s", err) | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
||
@@ -2005,3 +2007,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error("An error occurred while updating the tool configuration: %s", err) | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
{"$set": {"config": data["config"]}}, | ||
) | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that detailed error information, including stack traces, is not exposed to the user. Instead, we should log the error on the server and return a generic error message to the user. This can be achieved by modifying the exception handling code to log the error and return a generic message.
- Import the
logging
module to enable logging of errors. - Replace the current exception handling code to log the error and return a generic error message.
-
Copy modified line R2 -
Copy modified lines R1975-R1976 -
Copy modified lines R2008-R2010
@@ -1,2 +1,3 @@ | ||
import datetime | ||
import logging | ||
import math | ||
@@ -1973,3 +1974,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error("An error occurred while updating tool: %s", err) | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred!"}), 400) | ||
|
||
@@ -2005,3 +2007,5 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error("An error occurred while updating tool config: %s", err) | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred!"}), 400) | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred!"}), 400) | ||
|
{"$set": {"actions": data["actions"]}}, | ||
) | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that detailed error messages and stack traces are not exposed to the end user. Instead, we should log the error details on the server and return a generic error message to the user. This can be achieved by modifying the exception handling code to log the error and return a generic response.
- Import the
logging
module to enable logging of error messages. - Replace the current exception handling code to log the error and return a generic error message.
-
Copy modified line R6 -
Copy modified lines R2007-R2008 -
Copy modified lines R2042-R2043 -
Copy modified lines R2101-R2102
@@ -5,2 +5,3 @@ | ||
import uuid | ||
import logging | ||
|
||
@@ -2005,3 +2006,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error(f"Error updating tool config: {err}") | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
||
@@ -2039,3 +2041,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error(f"Error updating tool actions: {err}") | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
||
@@ -2097,3 +2100,4 @@ | ||
except Exception as err: | ||
return {"success": False, "error": str(err)}, 400 | ||
logging.error(f"Error deleting tool: {err}") | ||
return {"success": False, "error": "An internal error has occurred."}, 400 | ||
|
{"$set": {"status": data["status"]}}, | ||
) | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that detailed error messages and stack traces are not exposed to the end user. Instead, we should log the detailed error information on the server and return a generic error message to the user. This can be achieved by modifying the exception handling code to log the error and return a generic message.
- Import the
logging
module to enable logging of error messages. - Replace the current exception handling code to log the error and return a generic error message.
-
Copy modified line R6 -
Copy modified lines R2041-R2042 -
Copy modified lines R2074-R2075 -
Copy modified lines R2101-R2102
@@ -5,2 +5,3 @@ | ||
import uuid | ||
import logging | ||
|
||
@@ -2039,3 +2040,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error(f"Error updating tool actions: {err}") | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
||
@@ -2071,3 +2073,4 @@ | ||
except Exception as err: | ||
return make_response(jsonify({"success": False, "error": str(err)}), 400) | ||
logging.error(f"Error updating tool status: {err}") | ||
return make_response(jsonify({"success": False, "error": "An internal error has occurred."}), 400) | ||
|
||
@@ -2097,3 +2100,4 @@ | ||
except Exception as err: | ||
return {"success": False, "error": str(err)}, 400 | ||
logging.error(f"Error deleting tool: {err}") | ||
return {"success": False, "error": "An internal error has occurred."}, 400 | ||
|
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Why was this change needed? (You can also link to an open issue here)
Other information: