harvesthealth commited on
Commit
ea4d1b7
·
verified ·
1 Parent(s): 6dc86f3

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +23 -33
  2. 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 pr in prs:
719
- if pr.number not in processed_prs:
720
- # Check if it has the report
721
- try:
722
- file_path = "user_experience_reports/report.md"
723
- file_content = repo.get_contents(file_path, ref=pr.head.ref)
724
- content = file_content.decoded_content.decode("utf-8")
725
-
726
- processed_prs.add(pr.number)
727
- report_header = f"\n\n## Discovered Report: {pr.title} (PR #{pr.number})\n\n"
728
- all_discovered_reports = report_header + content + "\n\n---\n\n" + all_discovered_reports
729
- new_content_found = True
730
- except:
731
- # Report not in this PR or not yet created
732
- continue
 
 
733
 
734
  return all_discovered_reports
735
  except Exception as e:
736
- print(f"Error monitoring repo: {e}")
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
- # Fetch all branches with dates
834
- repo = test_gh.get_repo(repo_name)
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, branch_details
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 report.md.
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/report.md`
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
- `slides.md`
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
- python mkslides.py ../user_experience_reports/slides.md
371
  ```
372
 
373
  ---
@@ -442,7 +443,7 @@ Cards must be reusable in mkslides.
442
 
443
  Once complete:
444
 
445
- Confirm report.md + slides.md are written.
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