Spaces:
Runtime error
Runtime error
starsnatched
commited on
Commit
·
4477cf4
1
Parent(s):
e98e0c1
Update document upload logic and extend command execution timeout to 30 seconds
Browse files- run.py +3 -3
- src/tools.py +2 -2
run.py
CHANGED
@@ -7,10 +7,10 @@ from src.chat import ChatSession
|
|
7 |
|
8 |
async def _main() -> None:
|
9 |
async with ChatSession(user="demo_user", session="demo_session") as chat:
|
10 |
-
|
11 |
# print(f"Document uploaded to VM at: {doc_path}")
|
12 |
-
answer = await chat.chat(f"Remove all contents of test.txt and add the text 'Hello, World!' to it.")
|
13 |
-
|
14 |
print("\n>>>", answer)
|
15 |
|
16 |
|
|
|
7 |
|
8 |
async def _main() -> None:
|
9 |
async with ChatSession(user="demo_user", session="demo_session") as chat:
|
10 |
+
doc_path = chat.upload_document("test.txt")
|
11 |
# print(f"Document uploaded to VM at: {doc_path}")
|
12 |
+
# answer = await chat.chat(f"Remove all contents of test.txt and add the text 'Hello, World!' to it.")
|
13 |
+
answer = await chat.chat("What is in /data directory?")
|
14 |
print("\n>>>", answer)
|
15 |
|
16 |
|
src/tools.py
CHANGED
@@ -25,9 +25,9 @@ def execute_terminal(command: str) -> str:
|
|
25 |
|
26 |
The command is executed with network access enabled. Output from both
|
27 |
``stdout`` and ``stderr`` is captured and returned. Commands are killed if
|
28 |
-
they exceed
|
29 |
"""
|
30 |
-
timeout =
|
31 |
if not command:
|
32 |
return "No command provided."
|
33 |
|
|
|
25 |
|
26 |
The command is executed with network access enabled. Output from both
|
27 |
``stdout`` and ``stderr`` is captured and returned. Commands are killed if
|
28 |
+
they exceed 30 seconds.
|
29 |
"""
|
30 |
+
timeout = 30
|
31 |
if not command:
|
32 |
return "No command provided."
|
33 |
|