Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse files- app.py +55 -3
- jules_template.md +1 -0
app.py
CHANGED
|
@@ -127,6 +127,11 @@ JULES_API_URL = "https://jules.googleapis.com/v1alpha"
|
|
| 127 |
|
| 128 |
# GitHub Client
|
| 129 |
gh = Github(GITHUB_TOKEN) if GITHUB_TOKEN else None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
# Helper for parallel LLM calls
|
| 132 |
def call_llm_parallel(client, model_names, messages, **kwargs):
|
|
@@ -422,13 +427,51 @@ def pull_report_from_pr(pr_url):
|
|
| 422 |
|
| 423 |
# Fetch the report.md file
|
| 424 |
file_path = "user_experience_reports/report.md"
|
| 425 |
-
|
| 426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
|
| 428 |
except Exception as e:
|
| 429 |
print(f"Error pulling report: {e}")
|
| 430 |
return f"Error pulling report: {str(e)}"
|
| 431 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 432 |
# Gradio UI
|
| 433 |
with gr.Blocks() as demo:
|
| 434 |
gr.Markdown("# Jules UX Analysis Orchestrator")
|
|
@@ -452,7 +495,16 @@ with gr.Blocks() as demo:
|
|
| 452 |
start_session_btn = gr.Button("Start Jules Session", variant="primary")
|
| 453 |
|
| 454 |
with gr.Row():
|
| 455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 456 |
|
| 457 |
# Event handlers
|
| 458 |
generate_btn.click(
|
|
|
|
| 127 |
|
| 128 |
# GitHub Client
|
| 129 |
gh = Github(GITHUB_TOKEN) if GITHUB_TOKEN else None
|
| 130 |
+
REPO_NAME = "JsonLord/tiny_web"
|
| 131 |
+
|
| 132 |
+
# Global state for processed reports
|
| 133 |
+
processed_prs = set()
|
| 134 |
+
all_discovered_reports = ""
|
| 135 |
|
| 136 |
# Helper for parallel LLM calls
|
| 137 |
def call_llm_parallel(client, model_names, messages, **kwargs):
|
|
|
|
| 427 |
|
| 428 |
# Fetch the report.md file
|
| 429 |
file_path = "user_experience_reports/report.md"
|
| 430 |
+
try:
|
| 431 |
+
file_content = repo.get_contents(file_path, ref=branch_name)
|
| 432 |
+
content = file_content.decoded_content.decode("utf-8")
|
| 433 |
+
# Mark as processed
|
| 434 |
+
processed_prs.add(pr_number)
|
| 435 |
+
return content
|
| 436 |
+
except:
|
| 437 |
+
return "Report not found yet in this branch."
|
| 438 |
|
| 439 |
except Exception as e:
|
| 440 |
print(f"Error pulling report: {e}")
|
| 441 |
return f"Error pulling report: {str(e)}"
|
| 442 |
|
| 443 |
+
def monitor_repo_for_reports():
|
| 444 |
+
global all_discovered_reports
|
| 445 |
+
if not gh:
|
| 446 |
+
return all_discovered_reports
|
| 447 |
+
|
| 448 |
+
try:
|
| 449 |
+
repo = gh.get_repo(REPO_NAME)
|
| 450 |
+
# List open PRs
|
| 451 |
+
prs = repo.get_pulls(state='open', sort='created', direction='desc')
|
| 452 |
+
|
| 453 |
+
new_content_found = False
|
| 454 |
+
for pr in prs:
|
| 455 |
+
if pr.number not in processed_prs:
|
| 456 |
+
# Check if it has the report
|
| 457 |
+
try:
|
| 458 |
+
file_path = "user_experience_reports/report.md"
|
| 459 |
+
file_content = repo.get_contents(file_path, ref=pr.head.ref)
|
| 460 |
+
content = file_content.decoded_content.decode("utf-8")
|
| 461 |
+
|
| 462 |
+
processed_prs.add(pr.number)
|
| 463 |
+
report_header = f"\n\n## Discovered Report: {pr.title} (PR #{pr.number})\n\n"
|
| 464 |
+
all_discovered_reports = report_header + content + "\n\n---\n\n" + all_discovered_reports
|
| 465 |
+
new_content_found = True
|
| 466 |
+
except:
|
| 467 |
+
# Report not in this PR or not yet created
|
| 468 |
+
continue
|
| 469 |
+
|
| 470 |
+
return all_discovered_reports
|
| 471 |
+
except Exception as e:
|
| 472 |
+
print(f"Error monitoring repo: {e}")
|
| 473 |
+
return all_discovered_reports
|
| 474 |
+
|
| 475 |
# Gradio UI
|
| 476 |
with gr.Blocks() as demo:
|
| 477 |
gr.Markdown("# Jules UX Analysis Orchestrator")
|
|
|
|
| 495 |
start_session_btn = gr.Button("Start Jules Session", variant="primary")
|
| 496 |
|
| 497 |
with gr.Row():
|
| 498 |
+
with gr.Tab("Active Session Reports"):
|
| 499 |
+
report_output = gr.Markdown(label="Final Reports")
|
| 500 |
+
with gr.Tab("Global Repo Feed"):
|
| 501 |
+
gr.Markdown("### Live Monitoring of JsonLord/tiny_web for new UX reports")
|
| 502 |
+
refresh_btn = gr.Button("Refresh Feed Now")
|
| 503 |
+
global_feed = gr.Markdown(value="Waiting for new reports...")
|
| 504 |
+
# Use a Timer to poll every 60 seconds
|
| 505 |
+
timer = gr.Timer(value=60)
|
| 506 |
+
timer.tick(fn=monitor_repo_for_reports, outputs=global_feed)
|
| 507 |
+
refresh_btn.click(fn=monitor_repo_for_reports, outputs=global_feed)
|
| 508 |
|
| 509 |
# Event handlers
|
| 510 |
generate_btn.click(
|
jules_template.md
CHANGED
|
@@ -30,6 +30,7 @@ You are a Senior UX Researcher. Your goal is to conduct an in-depth User Experie
|
|
| 30 |
- **Browser Actions**: Use ONLY the actions defined in the `browser_actions` file in this repository. Use them as a library by running Python code that utilizes the `gradio_client`.
|
| 31 |
- **Navigation**: Start by navigating to the Target URL.
|
| 32 |
- **Sequential Execution**: Complete all 10 tasks in the order they are listed.
|
|
|
|
| 33 |
- **Interaction Logging**: For EVERY action you take:
|
| 34 |
- Log your internal **thoughts**.
|
| 35 |
- Log your **decision** (why you chose this action).
|
|
|
|
| 30 |
- **Browser Actions**: Use ONLY the actions defined in the `browser_actions` file in this repository. Use them as a library by running Python code that utilizes the `gradio_client`.
|
| 31 |
- **Navigation**: Start by navigating to the Target URL.
|
| 32 |
- **Sequential Execution**: Complete all 10 tasks in the order they are listed.
|
| 33 |
+
- **Sequentially Execute Tasks and Append Logs**: I will execute the analysis for each of the 10 tasks one by one. After each task is completed, I will append its styled log directly to the report.md file. This ensures that progress is saved incrementally.
|
| 34 |
- **Interaction Logging**: For EVERY action you take:
|
| 35 |
- Log your internal **thoughts**.
|
| 36 |
- Log your **decision** (why you chose this action).
|