zhimin-z
commited on
Commit
·
4d7e97c
1
Parent(s):
cf08c02
refine
Browse files
app.py
CHANGED
|
@@ -515,13 +515,13 @@ def submit_agent(identifier, agent_name, organization, website):
|
|
| 515 |
"""
|
| 516 |
# Validate required fields
|
| 517 |
if not identifier or not identifier.strip():
|
| 518 |
-
return "ERROR: GitHub identifier is required",
|
| 519 |
if not agent_name or not agent_name.strip():
|
| 520 |
-
return "ERROR: Agent name is required",
|
| 521 |
if not organization or not organization.strip():
|
| 522 |
-
return "ERROR: Organization name is required",
|
| 523 |
if not website or not website.strip():
|
| 524 |
-
return "ERROR: Website URL is required",
|
| 525 |
|
| 526 |
# Clean inputs
|
| 527 |
identifier = identifier.strip()
|
|
@@ -532,14 +532,14 @@ def submit_agent(identifier, agent_name, organization, website):
|
|
| 532 |
# Validate GitHub identifier
|
| 533 |
is_valid, message = validate_github_username(identifier)
|
| 534 |
if not is_valid:
|
| 535 |
-
return f"ERROR: {message}",
|
| 536 |
|
| 537 |
# Check for duplicates by loading agents from HuggingFace
|
| 538 |
agents = load_agents_from_hf()
|
| 539 |
if agents:
|
| 540 |
existing_names = {agent['github_identifier'] for agent in agents}
|
| 541 |
if identifier in existing_names:
|
| 542 |
-
return f"WARNING: Agent with identifier '{identifier}' already exists",
|
| 543 |
|
| 544 |
# Create submission
|
| 545 |
submission = {
|
|
@@ -552,10 +552,10 @@ def submit_agent(identifier, agent_name, organization, website):
|
|
| 552 |
|
| 553 |
# Save to HuggingFace
|
| 554 |
if not save_agent_to_hf(submission):
|
| 555 |
-
return "ERROR: Failed to save submission",
|
| 556 |
|
| 557 |
# Return success message - data will be populated by backend updates
|
| 558 |
-
return f"SUCCESS: Successfully submitted {agent_name}! PR data will be populated by the backend system.",
|
| 559 |
|
| 560 |
|
| 561 |
# =============================================================================
|
|
|
|
| 515 |
"""
|
| 516 |
# Validate required fields
|
| 517 |
if not identifier or not identifier.strip():
|
| 518 |
+
return "ERROR: GitHub identifier is required", gr.update()
|
| 519 |
if not agent_name or not agent_name.strip():
|
| 520 |
+
return "ERROR: Agent name is required", gr.update()
|
| 521 |
if not organization or not organization.strip():
|
| 522 |
+
return "ERROR: Organization name is required", gr.update()
|
| 523 |
if not website or not website.strip():
|
| 524 |
+
return "ERROR: Website URL is required", gr.update()
|
| 525 |
|
| 526 |
# Clean inputs
|
| 527 |
identifier = identifier.strip()
|
|
|
|
| 532 |
# Validate GitHub identifier
|
| 533 |
is_valid, message = validate_github_username(identifier)
|
| 534 |
if not is_valid:
|
| 535 |
+
return f"ERROR: {message}", gr.update()
|
| 536 |
|
| 537 |
# Check for duplicates by loading agents from HuggingFace
|
| 538 |
agents = load_agents_from_hf()
|
| 539 |
if agents:
|
| 540 |
existing_names = {agent['github_identifier'] for agent in agents}
|
| 541 |
if identifier in existing_names:
|
| 542 |
+
return f"WARNING: Agent with identifier '{identifier}' already exists", gr.update()
|
| 543 |
|
| 544 |
# Create submission
|
| 545 |
submission = {
|
|
|
|
| 552 |
|
| 553 |
# Save to HuggingFace
|
| 554 |
if not save_agent_to_hf(submission):
|
| 555 |
+
return "ERROR: Failed to save submission", gr.update()
|
| 556 |
|
| 557 |
# Return success message - data will be populated by backend updates
|
| 558 |
+
return f"SUCCESS: Successfully submitted {agent_name}! PR data will be automatically populated by the backend system via the maintainers.", gr.update()
|
| 559 |
|
| 560 |
|
| 561 |
# =============================================================================
|