Skip to content
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

Merged
merged 25 commits into from
Dec 23, 2024
Merged

test version #1503

merged 25 commits into from
Dec 23, 2024

Conversation

dartpain
Copy link
Contributor

  • 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:

Copy link

vercel bot commented Dec 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-gpt ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 23, 2024 5:43pm
nextra-docsgpt ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 23, 2024 5:43pm

@github-actions github-actions bot added the application Application label Dec 20, 2024
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 33.07544% with 346 lines in your changes missing coverage. Please review.

Project coverage is 35.51%. Comparing base (1323261) to head (41b4c28).
Report is 35 commits behind head on main.

Files with missing lines Patch % Lines
application/api/user/routes.py 29.48% 110 Missing ⚠️
application/parser/chunking.py 16.25% 67 Missing ⚠️
application/tools/agent.py 15.06% 62 Missing ⚠️
application/parser/embedding_pipeline.py 25.00% 27 Missing ⚠️
application/tools/implementations/telegram.py 40.74% 16 Missing ⚠️
application/tools/implementations/cryptoprice.py 39.13% 14 Missing ⚠️
application/tools/tool_manager.py 62.85% 13 Missing ⚠️
application/utils.py 33.33% 8 Missing ⚠️
application/worker.py 22.22% 7 Missing ⚠️
application/llm/openai.py 14.28% 6 Missing ⚠️
... and 7 more
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.
📢 Have feedback on the report? Share it here.

@@ -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
flows to this location and may be exposed to an external user.

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 the TextToSpeech class to log the error and return a generic error message.
  • Add an import statement for the logging module to enable logging of errors.
Suggested changeset 1
application/api/user/routes.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/application/api/user/routes.py b/application/api/user/routes.py
--- a/application/api/user/routes.py
+++ b/application/api/user/routes.py
@@ -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)
 
EOF
@@ -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)

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
}
)
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
flows to this location and may be exposed to an external user.

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.

  1. Import the logging module to enable logging of error messages.
  2. Replace the current exception handling code to log the error message and return a generic error message to the user.
Suggested changeset 1
application/api/user/routes.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/application/api/user/routes.py b/application/api/user/routes.py
--- a/application/api/user/routes.py
+++ b/application/api/user/routes.py
@@ -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)
 
EOF
@@ -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)

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
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
flows to this location and may be exposed to an external user.

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.

  1. Import the logging module to enable logging of errors.
  2. Replace the current exception handling code to log the error and return a generic error message.
Suggested changeset 1
application/api/user/routes.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/application/api/user/routes.py b/application/api/user/routes.py
--- a/application/api/user/routes.py
+++ b/application/api/user/routes.py
@@ -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)
 
EOF
@@ -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)

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
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
flows to this location and may be exposed to an external user.

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.

  1. Import the logging module to enable logging of errors.
  2. Replace the current return statement in the exception block with a logging statement and a generic error message.
Suggested changeset 1
application/api/user/routes.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/application/api/user/routes.py b/application/api/user/routes.py
--- a/application/api/user/routes.py
+++ b/application/api/user/routes.py
@@ -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)
 
EOF
@@ -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)

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
{"$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
flows to this location and may be exposed to an external user.

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.

  1. Import the logging module to enable logging of error messages.
  2. Replace the current exception handling code to log the error and return a generic error message.
Suggested changeset 1
application/api/user/routes.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/application/api/user/routes.py b/application/api/user/routes.py
--- a/application/api/user/routes.py
+++ b/application/api/user/routes.py
@@ -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)
 
EOF
@@ -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)

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
{"$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
flows to this location and may be exposed to an external user.

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.

  1. Import the logging module to enable logging of errors.
  2. Replace the current exception handling code to log the error and return a generic error message.
Suggested changeset 1
application/api/user/routes.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/application/api/user/routes.py b/application/api/user/routes.py
--- a/application/api/user/routes.py
+++ b/application/api/user/routes.py
@@ -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)
 
EOF
@@ -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)

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
{"$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
flows to this location and may be exposed to an external user.

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.

  1. Import the logging module to enable logging of error messages.
  2. Replace the current exception handling code to log the error and return a generic error message.
Suggested changeset 1
application/api/user/routes.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/application/api/user/routes.py b/application/api/user/routes.py
--- a/application/api/user/routes.py
+++ b/application/api/user/routes.py
@@ -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
 
EOF
@@ -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

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
{"$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
flows to this location and may be exposed to an external user.

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.

  1. Import the logging module to enable logging of error messages.
  2. Replace the current exception handling code to log the error and return a generic error message.
Suggested changeset 1
application/api/user/routes.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/application/api/user/routes.py b/application/api/user/routes.py
--- a/application/api/user/routes.py
+++ b/application/api/user/routes.py
@@ -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
 
EOF
@@ -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

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@dartpain dartpain merged commit cca5ef0 into main Dec 23, 2024
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants