Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -289,7 +289,7 @@ def select_or_create_personas(theme, customer_profile, num_personas):
|
|
| 289 |
# Ask LLM to judge
|
| 290 |
pool_summaries = [{"index": i, "name": p["name"], "minibio": p.get("minibio", "")} for i, p in enumerate(pool)]
|
| 291 |
|
| 292 |
-
prompt = f
|
| 293 |
You are an expert in user experience research and persona management.
|
| 294 |
We need {num_personas} persona(s) for a UX analysis task with the following theme: {theme}
|
| 295 |
And target customer profile: {customer_profile}
|
|
@@ -308,7 +308,7 @@ def select_or_create_personas(theme, customer_profile, num_personas):
|
|
| 308 |
... (up to {num_personas})
|
| 309 |
]
|
| 310 |
}}
|
| 311 |
-
|
| 312 |
|
| 313 |
try:
|
| 314 |
response = client.chat.completions.create(
|
|
@@ -407,7 +407,7 @@ def generate_tasks(theme, customer_profile):
|
|
| 407 |
if not client:
|
| 408 |
return [f"Task {i+1} for {theme} (BLABLADOR_API_KEY not set)" for i in range(10)]
|
| 409 |
|
| 410 |
-
prompt = f
|
| 411 |
Generate 10 sequential tasks for a user to perform on a website related to the theme: {theme}.
|
| 412 |
The user profile is: {customer_profile}.
|
| 413 |
|
|
@@ -422,7 +422,7 @@ def generate_tasks(theme, customer_profile):
|
|
| 422 |
CRITICAL: You MUST return a JSON object with a "tasks" key containing a list of strings.
|
| 423 |
Example: {{"tasks": ["task 1", "task 2", ...]}}
|
| 424 |
Do not include any other text in your response.
|
| 425 |
-
|
| 426 |
|
| 427 |
models_to_try = ["alias-large", "alias-huge", "alias-fast"]
|
| 428 |
|
|
@@ -545,7 +545,7 @@ def start_and_monitor_sessions(personas, tasks, url):
|
|
| 545 |
if pr_url:
|
| 546 |
yield f"PR created for {current_session.get('title')}: {pr_url}. Pulling report...", all_reports
|
| 547 |
report_content = pull_report_from_pr(pr_url)
|
| 548 |
-
all_reports += f"\
|
| 549 |
sessions.pop(i)
|
| 550 |
break # Restart loop since we modified the list
|
| 551 |
else:
|
|
@@ -588,7 +588,7 @@ def pull_report_from_pr(pr_url):
|
|
| 588 |
|
| 589 |
try:
|
| 590 |
# Extract repo and PR number from URL
|
| 591 |
-
match = re.search(r"github\
|
| 592 |
if not match:
|
| 593 |
return "Error: Could not parse PR URL."
|
| 594 |
|
|
@@ -687,8 +687,8 @@ def monitor_repo_for_reports():
|
|
| 687 |
content = file_content.decoded_content.decode("utf-8")
|
| 688 |
|
| 689 |
processed_prs.add(pr.number)
|
| 690 |
-
report_header = f"\
|
| 691 |
-
all_discovered_reports = report_header + content + "\
|
| 692 |
new_content_found = True
|
| 693 |
except:
|
| 694 |
# Report not in this PR or not yet created
|
|
|
|
| 289 |
# Ask LLM to judge
|
| 290 |
pool_summaries = [{"index": i, "name": p["name"], "minibio": p.get("minibio", "")} for i, p in enumerate(pool)]
|
| 291 |
|
| 292 |
+
prompt = f"""
|
| 293 |
You are an expert in user experience research and persona management.
|
| 294 |
We need {num_personas} persona(s) for a UX analysis task with the following theme: {theme}
|
| 295 |
And target customer profile: {customer_profile}
|
|
|
|
| 308 |
... (up to {num_personas})
|
| 309 |
]
|
| 310 |
}}
|
| 311 |
+
"""
|
| 312 |
|
| 313 |
try:
|
| 314 |
response = client.chat.completions.create(
|
|
|
|
| 407 |
if not client:
|
| 408 |
return [f"Task {i+1} for {theme} (BLABLADOR_API_KEY not set)" for i in range(10)]
|
| 409 |
|
| 410 |
+
prompt = f"""
|
| 411 |
Generate 10 sequential tasks for a user to perform on a website related to the theme: {theme}.
|
| 412 |
The user profile is: {customer_profile}.
|
| 413 |
|
|
|
|
| 422 |
CRITICAL: You MUST return a JSON object with a "tasks" key containing a list of strings.
|
| 423 |
Example: {{"tasks": ["task 1", "task 2", ...]}}
|
| 424 |
Do not include any other text in your response.
|
| 425 |
+
"""
|
| 426 |
|
| 427 |
models_to_try = ["alias-large", "alias-huge", "alias-fast"]
|
| 428 |
|
|
|
|
| 545 |
if pr_url:
|
| 546 |
yield f"PR created for {current_session.get('title')}: {pr_url}. Pulling report...", all_reports
|
| 547 |
report_content = pull_report_from_pr(pr_url)
|
| 548 |
+
all_reports += f"\n\n# Report for {current_session.get('title')}\n\n{report_content}"
|
| 549 |
sessions.pop(i)
|
| 550 |
break # Restart loop since we modified the list
|
| 551 |
else:
|
|
|
|
| 588 |
|
| 589 |
try:
|
| 590 |
# Extract repo and PR number from URL
|
| 591 |
+
match = re.search(r"github\.com/([^/]+/[^/]+)/pull/(\d+)", pr_url)
|
| 592 |
if not match:
|
| 593 |
return "Error: Could not parse PR URL."
|
| 594 |
|
|
|
|
| 687 |
content = file_content.decoded_content.decode("utf-8")
|
| 688 |
|
| 689 |
processed_prs.add(pr.number)
|
| 690 |
+
report_header = f"\n\n## Discovered Report: {pr.title} (PR #{pr.number})\n\n"
|
| 691 |
+
all_discovered_reports = report_header + content + "\n\n---\n\n" + all_discovered_reports
|
| 692 |
new_content_found = True
|
| 693 |
except:
|
| 694 |
# Report not in this PR or not yet created
|