Spaces:
Sleeping
Sleeping
Commit ·
9522d74
1
Parent(s): 926289c
OS validation
Browse files
app.py
CHANGED
|
@@ -221,7 +221,14 @@ async def get_response_from_agent(
|
|
| 221 |
if os.path.isabs(workspace_directory):
|
| 222 |
WORKSPACE_DIR = workspace_directory
|
| 223 |
else:
|
| 224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
|
| 226 |
os.environ["WORKSPACE_DIR"] = WORKSPACE_DIR
|
| 227 |
if not os.path.exists(WORKSPACE_DIR):
|
|
@@ -230,6 +237,8 @@ async def get_response_from_agent(
|
|
| 230 |
except (FileExistsError,Exception) as e:
|
| 231 |
#print(f"Folder exsist {WORKSPACE_DIR}",file=sys.stderr)
|
| 232 |
logger.error(f"Folder exsist {WORKSPACE_DIR}")
|
|
|
|
|
|
|
| 233 |
|
| 234 |
if not timeout or timeout <= 0:
|
| 235 |
yield gr.ChatMessage(role="assistant", content="❌ Please enter a Timeout.")
|
|
|
|
| 221 |
if os.path.isabs(workspace_directory):
|
| 222 |
WORKSPACE_DIR = workspace_directory
|
| 223 |
else:
|
| 224 |
+
os_name = os.name
|
| 225 |
+
if os_name == "posix":
|
| 226 |
+
WORKSPACE_DIR = os.path.join("/tmp", workspace_directory)
|
| 227 |
+
elif os_name == "nt":
|
| 228 |
+
WORKSPACE_DIR = os.path.join(os.path.expanduser("~"), workspace_directory)
|
| 229 |
+
else:
|
| 230 |
+
yield gr.ChatMessage(role="assistant", content="❌ Please enter a Project Directory Name.")
|
| 231 |
+
return
|
| 232 |
|
| 233 |
os.environ["WORKSPACE_DIR"] = WORKSPACE_DIR
|
| 234 |
if not os.path.exists(WORKSPACE_DIR):
|
|
|
|
| 237 |
except (FileExistsError,Exception) as e:
|
| 238 |
#print(f"Folder exsist {WORKSPACE_DIR}",file=sys.stderr)
|
| 239 |
logger.error(f"Folder exsist {WORKSPACE_DIR}")
|
| 240 |
+
yield gr.ChatMessage(role="assistant", content="❌ Please enter a Project Directory Name.")
|
| 241 |
+
return
|
| 242 |
|
| 243 |
if not timeout or timeout <= 0:
|
| 244 |
yield gr.ChatMessage(role="assistant", content="❌ Please enter a Timeout.")
|