JacobLinCool commited on
Commit
1147a5f
·
verified ·
1 Parent(s): ffcf6c4

feat: show quest badge evidence hints

Browse files
Files changed (2) hide show
  1. static/app.js +21 -1
  2. tests/test_frontend_copy.py +4 -0
static/app.js CHANGED
@@ -669,7 +669,12 @@ function renderAtlasDetail(point) {
669
  const quests = (point.quest_matches || [])
670
  .map((match) => {
671
  const confidence = (Number(match.confidence) * 100).toFixed(0);
672
- return `<span>${escapeHtml(atlasQuestLabel(match.quest))} ${confidence}%</span>`;
 
 
 
 
 
673
  })
674
  .join("");
675
  const tags = [...(point.models || []).slice(0, 3), ...visibleProjectTags(point.tags || []).slice(0, 3)]
@@ -685,6 +690,21 @@ function renderAtlasDetail(point) {
685
  `;
686
  }
687
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
688
  function visibleProjectTags(tags) {
689
  return (tags || []).filter((tag) => !String(tag || "").toLowerCase().startsWith("region:"));
690
  }
 
669
  const quests = (point.quest_matches || [])
670
  .map((match) => {
671
  const confidence = (Number(match.confidence) * 100).toFixed(0);
672
+ const label = atlasQuestLabel(match.quest);
673
+ const hint = questBadgeHint(match, label, confidence);
674
+ return (
675
+ `<span title="${escapeAttribute(hint)}" aria-label="${escapeAttribute(hint)}">` +
676
+ `${escapeHtml(label)} ${confidence}%</span>`
677
+ );
678
  })
679
  .join("");
680
  const tags = [...(point.models || []).slice(0, 3), ...visibleProjectTags(point.tags || []).slice(0, 3)]
 
690
  `;
691
  }
692
 
693
+ function questBadgeHint(match, label, confidence) {
694
+ const evidence = String(match?.evidence || "").trim();
695
+ const source = questEvidenceSourceLabel(match?.source);
696
+ const parts = [`${label} ${confidence}% confidence`];
697
+ if (evidence) parts.push(`${source}: ${evidence}`);
698
+ return parts.join(". ");
699
+ }
700
+
701
+ function questEvidenceSourceLabel(source) {
702
+ const normalized = String(source || "").trim().toLowerCase();
703
+ if (normalized === "readme") return "README evidence";
704
+ if (normalized === "app_file") return "App file evidence";
705
+ return "Evidence";
706
+ }
707
+
708
  function visibleProjectTags(tags) {
709
  return (tags || []).filter((tag) => !String(tag || "").toLowerCase().startsWith("region:"));
710
  }
tests/test_frontend_copy.py CHANGED
@@ -29,6 +29,10 @@ def test_main_interface_copy_is_builder_facing() -> None:
29
  assert "stopVoiceRecording" in app_js
30
  assert 'recording: "Stop"' in app_js
31
  assert 'stopping: "Stopping..."' in app_js
 
 
 
 
32
  assert "readNdjson" in app_js
33
  assert "@gradio/client" not in app_js
34
  assert "renderArtifactCanvas" not in app_js
 
29
  assert "stopVoiceRecording" in app_js
30
  assert 'recording: "Stop"' in app_js
31
  assert 'stopping: "Stopping..."' in app_js
32
+ assert "questBadgeHint" in app_js
33
+ assert 'title="${escapeAttribute(hint)}"' in app_js
34
+ assert "README evidence" in app_js
35
+ assert "App file evidence" in app_js
36
  assert "readNdjson" in app_js
37
  assert "@gradio/client" not in app_js
38
  assert "renderArtifactCanvas" not in app_js