Skip to content

Commit cd372cf

Browse files
authored
Merge pull request #18 from BrunoV21/hf-space-demo
Hf space demo
2 parents 9400262 + f52131a commit cd372cf

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

codetide/agents/tide/ui/agent_tide_ui.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ async def load(self):
5959
llm=llm,
6060
tide=await initCodeTide(workspace=self.project_path),
6161
history=self.history,
62-
session_id=self.session_id
62+
session_id=self.session_id,
63+
request_human_confirmation=True
6364
)
6465
self.agent_tide.llm.session_id = self.agent_tide.session_id
6566

codetide/agents/tide/utils.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from codetide.core.defaults import DEFAULT_ENCODING
22

33
from typing import List, Union
4+
import aiofiles.os
45
import aiofiles
56
import os
67
import re
@@ -114,3 +115,30 @@ def parse_steps_markdown(md: str):
114115
})
115116

116117
return steps
118+
119+
async def delete_file(file_path: str) -> bool:
120+
"""
121+
Safely delete a file asynchronously.
122+
123+
Args:
124+
file_path: Path to the file to delete
125+
126+
Returns:
127+
bool: True if file was deleted, False if it didn't exist
128+
129+
Raises:
130+
PermissionError: If lacking permissions to delete
131+
OSError: For other OS-related errors
132+
"""
133+
try:
134+
await aiofiles.os.remove(file_path)
135+
return True
136+
except FileNotFoundError:
137+
# File doesn't exist - consider this "success"
138+
return False
139+
except PermissionError:
140+
# Handle permission issues
141+
raise
142+
except OSError:
143+
# Handle other OS errors (disk full, etc.)
144+
raise

0 commit comments

Comments
 (0)