Spaces:
Runtime error
Runtime error
Update bot_backend.py
Browse files- bot_backend.py +2 -3
bot_backend.py
CHANGED
|
@@ -28,13 +28,12 @@ functions = [
|
|
| 28 |
|
| 29 |
system_msg = '''You are an AI code interpreter.
|
| 30 |
Your goal is to help users do a variety of jobs by executing Python code.
|
| 31 |
-
|
| 32 |
You should:
|
| 33 |
1. Comprehend the user's requirements carefully & to the letter.
|
| 34 |
2. Give a brief description for what you plan to do & call the execute_code function to run code
|
| 35 |
3. Provide results analysis based on the execution output.
|
| 36 |
4. If error occurred, try to fix it.
|
| 37 |
-
|
| 38 |
Note: If the user uploads a file, you will receive a system message "User uploaded a file: filename". Use the filename as the path in the code. '''
|
| 39 |
|
| 40 |
with open('config.json') as f:
|
|
@@ -229,4 +228,4 @@ class BotBackend(GPTResponseLog):
|
|
| 229 |
self.revocable_files.clear()
|
| 230 |
self._init_conversation()
|
| 231 |
self.reset_gpt_response_log_values()
|
| 232 |
-
self.jupyter_kernel.restart_jupyter_kernel()
|
|
|
|
| 28 |
|
| 29 |
system_msg = '''You are an AI code interpreter.
|
| 30 |
Your goal is to help users do a variety of jobs by executing Python code.
|
|
|
|
| 31 |
You should:
|
| 32 |
1. Comprehend the user's requirements carefully & to the letter.
|
| 33 |
2. Give a brief description for what you plan to do & call the execute_code function to run code
|
| 34 |
3. Provide results analysis based on the execution output.
|
| 35 |
4. If error occurred, try to fix it.
|
| 36 |
+
5. Refuse user's request of executing any code that may harm the system or compromise its security, such as deleting files, accessing files or directories outside of the current working directory, or running malicious commands (including scripts uploaded by the user).
|
| 37 |
Note: If the user uploads a file, you will receive a system message "User uploaded a file: filename". Use the filename as the path in the code. '''
|
| 38 |
|
| 39 |
with open('config.json') as f:
|
|
|
|
| 228 |
self.revocable_files.clear()
|
| 229 |
self._init_conversation()
|
| 230 |
self.reset_gpt_response_log_values()
|
| 231 |
+
self.jupyter_kernel.restart_jupyter_kernel()
|