Spaces:
Sleeping
Sleeping
zhimin-z
commited on
Commit
·
84c3734
1
Parent(s):
9b63255
refine
Browse files
app.py
CHANGED
|
@@ -507,43 +507,43 @@ def get_leaderboard_dataframe():
|
|
| 507 |
return df
|
| 508 |
|
| 509 |
|
| 510 |
-
def submit_agent(identifier, agent_name,
|
| 511 |
"""
|
| 512 |
Submit a new agent to the leaderboard.
|
| 513 |
Validates input and saves submission.
|
| 514 |
"""
|
| 515 |
# Validate required fields
|
| 516 |
if not identifier or not identifier.strip():
|
| 517 |
-
return "ERROR: GitHub identifier is required",
|
| 518 |
if not agent_name or not agent_name.strip():
|
| 519 |
-
return "ERROR: Agent name is required",
|
| 520 |
-
if not
|
| 521 |
-
return "ERROR:
|
| 522 |
if not website or not website.strip():
|
| 523 |
-
return "ERROR: Website URL is required",
|
| 524 |
|
| 525 |
# Clean inputs
|
| 526 |
identifier = identifier.strip()
|
| 527 |
agent_name = agent_name.strip()
|
| 528 |
-
|
| 529 |
website = website.strip()
|
| 530 |
|
| 531 |
# Validate GitHub identifier
|
| 532 |
is_valid, message = validate_github_username(identifier)
|
| 533 |
if not is_valid:
|
| 534 |
-
return f"ERROR: {message}",
|
| 535 |
|
| 536 |
# Check for duplicates by loading agents from HuggingFace
|
| 537 |
agents = load_agents_from_hf()
|
| 538 |
if agents:
|
| 539 |
existing_names = {agent['github_identifier'] for agent in agents}
|
| 540 |
if identifier in existing_names:
|
| 541 |
-
return f"WARNING: Agent with identifier '{identifier}' already exists",
|
| 542 |
|
| 543 |
# Create submission
|
| 544 |
submission = {
|
| 545 |
'name': agent_name,
|
| 546 |
-
'
|
| 547 |
'github_identifier': identifier,
|
| 548 |
'website': website,
|
| 549 |
'status': 'public'
|
|
@@ -551,10 +551,10 @@ def submit_agent(identifier, agent_name, developer, website):
|
|
| 551 |
|
| 552 |
# Save to HuggingFace
|
| 553 |
if not save_agent_to_hf(submission):
|
| 554 |
-
return "ERROR: Failed to save submission",
|
| 555 |
|
| 556 |
# Return success message - data will be populated by backend updates
|
| 557 |
-
return f"SUCCESS: Successfully submitted {agent_name}!
|
| 558 |
|
| 559 |
|
| 560 |
# =============================================================================
|
|
|
|
| 507 |
return df
|
| 508 |
|
| 509 |
|
| 510 |
+
def submit_agent(identifier, agent_name, organization, website):
|
| 511 |
"""
|
| 512 |
Submit a new agent to the leaderboard.
|
| 513 |
Validates input and saves submission.
|
| 514 |
"""
|
| 515 |
# Validate required fields
|
| 516 |
if not identifier or not identifier.strip():
|
| 517 |
+
return "ERROR: GitHub identifier is required", gr.update()
|
| 518 |
if not agent_name or not agent_name.strip():
|
| 519 |
+
return "ERROR: Agent name is required", gr.update()
|
| 520 |
+
if not organization or not organization.strip():
|
| 521 |
+
return "ERROR: Organization name is required", gr.update()
|
| 522 |
if not website or not website.strip():
|
| 523 |
+
return "ERROR: Website URL is required", gr.update()
|
| 524 |
|
| 525 |
# Clean inputs
|
| 526 |
identifier = identifier.strip()
|
| 527 |
agent_name = agent_name.strip()
|
| 528 |
+
organization = organization.strip()
|
| 529 |
website = website.strip()
|
| 530 |
|
| 531 |
# Validate GitHub identifier
|
| 532 |
is_valid, message = validate_github_username(identifier)
|
| 533 |
if not is_valid:
|
| 534 |
+
return f"ERROR: {message}", gr.update()
|
| 535 |
|
| 536 |
# Check for duplicates by loading agents from HuggingFace
|
| 537 |
agents = load_agents_from_hf()
|
| 538 |
if agents:
|
| 539 |
existing_names = {agent['github_identifier'] for agent in agents}
|
| 540 |
if identifier in existing_names:
|
| 541 |
+
return f"WARNING: Agent with identifier '{identifier}' already exists", gr.update()
|
| 542 |
|
| 543 |
# Create submission
|
| 544 |
submission = {
|
| 545 |
'name': agent_name,
|
| 546 |
+
'organization': organization,
|
| 547 |
'github_identifier': identifier,
|
| 548 |
'website': website,
|
| 549 |
'status': 'public'
|
|
|
|
| 551 |
|
| 552 |
# Save to HuggingFace
|
| 553 |
if not save_agent_to_hf(submission):
|
| 554 |
+
return "ERROR: Failed to save submission", gr.update()
|
| 555 |
|
| 556 |
# Return success message - data will be populated by backend updates
|
| 557 |
+
return f"SUCCESS: Successfully submitted {agent_name}! PR data will be automatically populated by the backend system via the maintainers.", gr.update()
|
| 558 |
|
| 559 |
|
| 560 |
# =============================================================================
|