Update app.py
Browse files
app.py
CHANGED
|
@@ -24,6 +24,7 @@ class ChatRequest(BaseModel):
|
|
| 24 |
|
| 25 |
def execute_in_sandbox(command: str):
|
| 26 |
try:
|
|
|
|
| 27 |
full_command = f"cd /tmp && {command}"
|
| 28 |
|
| 29 |
result = subprocess.run(
|
|
@@ -31,7 +32,7 @@ def execute_in_sandbox(command: str):
|
|
| 31 |
shell=True,
|
| 32 |
capture_output=True,
|
| 33 |
text=True,
|
| 34 |
-
timeout=
|
| 35 |
)
|
| 36 |
return {
|
| 37 |
"stdout": result.stdout,
|
|
@@ -46,13 +47,18 @@ async def agent_chat(request: ChatRequest):
|
|
| 46 |
user_prompt = request.message
|
| 47 |
|
| 48 |
system_instruction = (
|
| 49 |
-
"You are an AI Agent Builder operating inside a
|
| 50 |
-
"
|
| 51 |
-
"
|
| 52 |
-
"
|
| 53 |
-
"
|
| 54 |
-
"
|
| 55 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
)
|
| 57 |
|
| 58 |
try:
|
|
|
|
| 24 |
|
| 25 |
def execute_in_sandbox(command: str):
|
| 26 |
try:
|
| 27 |
+
# Saari commands hamesha /tmp folder me execute hongi jahan explicit write permissions hain
|
| 28 |
full_command = f"cd /tmp && {command}"
|
| 29 |
|
| 30 |
result = subprocess.run(
|
|
|
|
| 32 |
shell=True,
|
| 33 |
capture_output=True,
|
| 34 |
text=True,
|
| 35 |
+
timeout=600 # 10 minutes max timeout per execution
|
| 36 |
)
|
| 37 |
return {
|
| 38 |
"stdout": result.stdout,
|
|
|
|
| 47 |
user_prompt = request.message
|
| 48 |
|
| 49 |
system_instruction = (
|
| 50 |
+
"You are an expert AI Agent Builder operating inside a fully equipped Linux sandbox.\n\n"
|
| 51 |
+
"YOUR DEVELOPMENT ENVIRONMENT capabilities:\n"
|
| 52 |
+
"- **Python 3** is installed. You can write and execute python scripts (`python3 script.py`).\n"
|
| 53 |
+
"- **Flutter & Dart SDK** are pre-installed globally. You can run `flutter create` and `flutter build apk --release`.\n"
|
| 54 |
+
"- **Android Native Build System** is pre-installed. Full OpenJDK 17, Android SDK (API 34), and Build-Tools (34.0.0) are ready. You can create Native Android apps (using gradle wrappers) and build them directly.\n"
|
| 55 |
+
"- You CANNOT use 'sudo'. Perform all workspace creation inside the `/tmp` directory.\n\n"
|
| 56 |
+
"GOFILE.IO UPLOAD RULES:\n"
|
| 57 |
+
"To upload a compiled file or APK, you MUST follow these exact steps in your bash script:\n"
|
| 58 |
+
"1. Fetch an active server name: SERVER_NAME=$(curl -s https://api.gofile.io/getServer | grep -oP '\"server\":\"\\K[^\"]+')\n"
|
| 59 |
+
"2. Upload using that server: UPLOAD_RESPONSE=$(curl -F \"file=@path_to_your_file\" https://${SERVER_NAME}.gofile.io/uploadFile)\n"
|
| 60 |
+
"3. Extract download link: DOWNLOAD_LINK=$(echo \"${UPLOAD_RESPONSE}\" | grep -oP '\"downloadPage\":\"\\K[^\"]+')\n\n"
|
| 61 |
+
"If you want to create a project, write python scripts, or build an APK, output the exact script inside a triple backtick block starting with 'bash'."
|
| 62 |
)
|
| 63 |
|
| 64 |
try:
|