Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse files- app.py +23 -33
- jules_template.md +6 -5
app.py
CHANGED
|
@@ -709,31 +709,33 @@ def monitor_repo_for_reports():
|
|
| 709 |
if not gh:
|
| 710 |
return all_discovered_reports
|
| 711 |
|
|
|
|
| 712 |
try:
|
|
|
|
| 713 |
repo = gh.get_repo(REPO_NAME)
|
| 714 |
-
# List open PRs
|
| 715 |
-
prs = repo.get_pulls(state='open', sort='created', direction='desc')
|
| 716 |
|
| 717 |
new_content_found = False
|
| 718 |
-
for
|
| 719 |
-
|
| 720 |
-
|
| 721 |
-
|
| 722 |
-
|
| 723 |
-
|
| 724 |
-
|
| 725 |
-
|
| 726 |
-
|
| 727 |
-
|
| 728 |
-
|
| 729 |
-
|
| 730 |
-
|
| 731 |
-
|
| 732 |
-
|
|
|
|
|
|
|
| 733 |
|
| 734 |
return all_discovered_reports
|
| 735 |
except Exception as e:
|
| 736 |
-
|
| 737 |
return all_discovered_reports
|
| 738 |
|
| 739 |
# Gradio UI
|
|
@@ -830,22 +832,10 @@ with gr.Blocks() as demo:
|
|
| 830 |
user = test_gh.get_user().login
|
| 831 |
status = f"Success: Connected as {user} to {repo_name}"
|
| 832 |
|
| 833 |
-
#
|
| 834 |
-
|
| 835 |
-
branches = list(repo.get_branches())
|
| 836 |
-
branch_details = []
|
| 837 |
-
for b in branches:
|
| 838 |
-
try:
|
| 839 |
-
commit = repo.get_commit(b.commit.sha)
|
| 840 |
-
date = commit.commit.author.date.isoformat()
|
| 841 |
-
branch_details.append({"name": b.name, "last_commit": date, "sha": b.commit.sha})
|
| 842 |
-
except:
|
| 843 |
-
branch_details.append({"name": b.name, "last_commit": "Unknown", "sha": b.commit.sha})
|
| 844 |
-
|
| 845 |
-
# Sort by date
|
| 846 |
-
branch_details.sort(key=lambda x: x["last_commit"], reverse=True)
|
| 847 |
|
| 848 |
-
return status,
|
| 849 |
except Exception as e:
|
| 850 |
return f"Error: {str(e)}", None
|
| 851 |
|
|
|
|
| 709 |
if not gh:
|
| 710 |
return all_discovered_reports
|
| 711 |
|
| 712 |
+
add_log("Monitoring repository for new reports across branches...")
|
| 713 |
try:
|
| 714 |
+
branches = get_repo_branches(REPO_NAME)
|
| 715 |
repo = gh.get_repo(REPO_NAME)
|
|
|
|
|
|
|
| 716 |
|
| 717 |
new_content_found = False
|
| 718 |
+
for branch_name in branches[:10]: # Check only top 10 recent branches for performance
|
| 719 |
+
reports = get_reports_in_branch(REPO_NAME, branch_name)
|
| 720 |
+
for report_file in reports:
|
| 721 |
+
report_key = f"{branch_name}/{report_file}"
|
| 722 |
+
if report_key not in processed_prs:
|
| 723 |
+
try:
|
| 724 |
+
content = get_report_content(REPO_NAME, branch_name, report_file)
|
| 725 |
+
report_header = f"\n\n## Discovered Report: {report_file} (Branch: {branch_name})\n\n"
|
| 726 |
+
all_discovered_reports = report_header + content + "\n\n---\n\n" + all_discovered_reports
|
| 727 |
+
processed_prs.add(report_key)
|
| 728 |
+
new_content_found = True
|
| 729 |
+
add_log(f"New report found: {report_file} in {branch_name}")
|
| 730 |
+
except:
|
| 731 |
+
continue
|
| 732 |
+
|
| 733 |
+
if not new_content_found:
|
| 734 |
+
add_log("No new reports found in recent branches.")
|
| 735 |
|
| 736 |
return all_discovered_reports
|
| 737 |
except Exception as e:
|
| 738 |
+
add_log(f"Error monitoring repo: {e}")
|
| 739 |
return all_discovered_reports
|
| 740 |
|
| 741 |
# Gradio UI
|
|
|
|
| 832 |
user = test_gh.get_user().login
|
| 833 |
status = f"Success: Connected as {user} to {repo_name}"
|
| 834 |
|
| 835 |
+
# Use existing optimized logic
|
| 836 |
+
branches = get_repo_branches(repo_name, github_client=test_gh)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 837 |
|
| 838 |
+
return status, branches
|
| 839 |
except Exception as e:
|
| 840 |
return f"Error: {str(e)}", None
|
| 841 |
|
jules_template.md
CHANGED
|
@@ -16,6 +16,7 @@ You will simulate a persona performing tasks, but the final output must read lik
|
|
| 16 |
- Persona: {{persona_context}}
|
| 17 |
- Tasks: {{tasks_list}}
|
| 18 |
- Target URL: {{url}}
|
|
|
|
| 19 |
|
| 20 |
---
|
| 21 |
|
|
@@ -54,7 +55,7 @@ config_manager.update("reasoning_model", "alias-large")
|
|
| 54 |
* Use ONLY browser_actions.
|
| 55 |
* Navigate first to Target URL.
|
| 56 |
* Execute ALL tasks sequentially.
|
| 57 |
-
* After EACH task, append styled logs to
|
| 58 |
|
| 59 |
---
|
| 60 |
|
|
@@ -106,7 +107,7 @@ Flat menu → No scanning → Choice paralysis → Lost conversion
|
|
| 106 |
|
| 107 |
## 4. REPORT GENERATION (MAJOR UPGRADE)
|
| 108 |
|
| 109 |
-
Create `/user_experience_reports/
|
| 110 |
|
| 111 |
This must be a BUSINESS PRESENTATION DOCUMENT.
|
| 112 |
|
|
@@ -348,7 +349,7 @@ What happens if nothing changes?
|
|
| 348 |
|
| 349 |
In addition to report.md, generate:
|
| 350 |
|
| 351 |
-
`
|
| 352 |
|
| 353 |
This file contains presentation cards compatible with mkslides.
|
| 354 |
|
|
@@ -367,7 +368,7 @@ pip install -r requirements.txt
|
|
| 367 |
Then render:
|
| 368 |
|
| 369 |
```bash
|
| 370 |
-
|
| 371 |
```
|
| 372 |
|
| 373 |
---
|
|
@@ -442,7 +443,7 @@ Cards must be reusable in mkslides.
|
|
| 442 |
|
| 443 |
Once complete:
|
| 444 |
|
| 445 |
-
Confirm
|
| 446 |
|
| 447 |
Session will open PR automatically.
|
| 448 |
|
|
|
|
| 16 |
- Persona: {{persona_context}}
|
| 17 |
- Tasks: {{tasks_list}}
|
| 18 |
- Target URL: {{url}}
|
| 19 |
+
- Report ID: {{report_id}}
|
| 20 |
|
| 21 |
---
|
| 22 |
|
|
|
|
| 55 |
* Use ONLY browser_actions.
|
| 56 |
* Navigate first to Target URL.
|
| 57 |
* Execute ALL tasks sequentially.
|
| 58 |
+
* After EACH task, append styled logs to `/user_experience_reports/report_{{report_id}}.md`.
|
| 59 |
|
| 60 |
---
|
| 61 |
|
|
|
|
| 107 |
|
| 108 |
## 4. REPORT GENERATION (MAJOR UPGRADE)
|
| 109 |
|
| 110 |
+
Create `/user_experience_reports/report_{{report_id}}.md`
|
| 111 |
|
| 112 |
This must be a BUSINESS PRESENTATION DOCUMENT.
|
| 113 |
|
|
|
|
| 349 |
|
| 350 |
In addition to report.md, generate:
|
| 351 |
|
| 352 |
+
`user_experience_reports/slides_{{report_id}}.md`
|
| 353 |
|
| 354 |
This file contains presentation cards compatible with mkslides.
|
| 355 |
|
|
|
|
| 368 |
Then render:
|
| 369 |
|
| 370 |
```bash
|
| 371 |
+
mkslides build ../user_experience_reports/
|
| 372 |
```
|
| 373 |
|
| 374 |
---
|
|
|
|
| 443 |
|
| 444 |
Once complete:
|
| 445 |
|
| 446 |
+
Confirm report_{{report_id}}.md + slides_{{report_id}}.md are written.
|
| 447 |
|
| 448 |
Session will open PR automatically.
|
| 449 |
|