Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
296641b
1
Parent(s): 0fd14b5
Add approval display details for hf_repo_files and hf_repo_git
Browse files- agent/main.py +42 -0
agent/main.py
CHANGED
|
@@ -334,6 +334,48 @@ async def event_listener(
|
|
| 334 |
patterns = [patterns]
|
| 335 |
print(f"Patterns to delete: {', '.join(patterns)}")
|
| 336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
# Get user decision for this item
|
| 338 |
response = await prompt_session.prompt_async(
|
| 339 |
f"Approve item {i}? (y=yes, yolo=approve all, n=no, or provide feedback): "
|
|
|
|
| 334 |
patterns = [patterns]
|
| 335 |
print(f"Patterns to delete: {', '.join(patterns)}")
|
| 336 |
|
| 337 |
+
elif tool_name == "hf_repo_git":
|
| 338 |
+
# Handle git operations (branches, tags, PRs, repo management)
|
| 339 |
+
repo_id = arguments.get("repo_id", "")
|
| 340 |
+
repo_type = arguments.get("repo_type", "model")
|
| 341 |
+
|
| 342 |
+
# Build repo URL
|
| 343 |
+
if repo_type == "model":
|
| 344 |
+
repo_url = f"https://huggingface.co/{repo_id}"
|
| 345 |
+
else:
|
| 346 |
+
repo_url = f"https://huggingface.co/{repo_type}s/{repo_id}"
|
| 347 |
+
|
| 348 |
+
print(f"Repository: {repo_id}")
|
| 349 |
+
print(f"Type: {repo_type}")
|
| 350 |
+
print(f"URL: {repo_url}")
|
| 351 |
+
|
| 352 |
+
if operation == "delete_branch":
|
| 353 |
+
branch = arguments.get("branch", "")
|
| 354 |
+
print(f"Branch to delete: {branch}")
|
| 355 |
+
|
| 356 |
+
elif operation == "delete_tag":
|
| 357 |
+
tag = arguments.get("tag", "")
|
| 358 |
+
print(f"Tag to delete: {tag}")
|
| 359 |
+
|
| 360 |
+
elif operation == "merge_pr":
|
| 361 |
+
pr_num = arguments.get("pr_num", "")
|
| 362 |
+
print(f"PR to merge: #{pr_num}")
|
| 363 |
+
|
| 364 |
+
elif operation == "create_repo":
|
| 365 |
+
private = arguments.get("private", False)
|
| 366 |
+
space_sdk = arguments.get("space_sdk")
|
| 367 |
+
print(f"Private: {private}")
|
| 368 |
+
if space_sdk:
|
| 369 |
+
print(f"Space SDK: {space_sdk}")
|
| 370 |
+
|
| 371 |
+
elif operation == "update_repo":
|
| 372 |
+
private = arguments.get("private")
|
| 373 |
+
gated = arguments.get("gated")
|
| 374 |
+
if private is not None:
|
| 375 |
+
print(f"Private: {private}")
|
| 376 |
+
if gated is not None:
|
| 377 |
+
print(f"Gated: {gated}")
|
| 378 |
+
|
| 379 |
# Get user decision for this item
|
| 380 |
response = await prompt_session.prompt_async(
|
| 381 |
f"Approve item {i}? (y=yes, yolo=approve all, n=no, or provide feedback): "
|