dehezhang2 commited on
Commit
42141a8
·
verified ·
1 Parent(s): 744a287

deploy rater (Docker/FastAPI): registration + completeness gate + /api/submit → dataset

Browse files
Files changed (2) hide show
  1. static/index.html +71 -34
  2. static/mobile.html +19 -14
static/index.html CHANGED
@@ -145,10 +145,26 @@
145
  @media (max-width: 900px) {
146
  .case-pane-wrap { grid-template-columns: 1fr; }
147
  }
 
 
 
 
148
  .left-pane { position: sticky; top: 0; align-self: start;
 
149
  padding-top: 4px; padding-bottom: 8px;
150
- max-height: calc(100vh - 130px); overflow-y: auto; }
151
- .right-pane { min-width: 0; }
 
 
 
 
 
 
 
 
 
 
 
152
 
153
  /* ---------- video tabs + single active video ---------- */
154
  .video-tabs { display: flex; gap: 4px; margin: 8px 0 6px; flex-wrap: wrap; }
@@ -193,23 +209,24 @@
193
  .dim-header .dim-hint { font-weight: 400; color: var(--muted); font-size: 11px;
194
  text-transform: none; letter-spacing: 0; }
195
  .q-card { background: var(--panel); border: 1px solid var(--border);
196
- border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
197
- .q-card .q-name { font-size: 14px; font-weight: 600; color: var(--fg); }
198
- .q-card .q-desc { font-size: 12px; color: var(--muted); margin: 2px 0 10px;
199
- line-height: 1.5; }
200
- .q-card .video-rate { display: flex; align-items: center; gap: 10px;
201
- padding: 6px 0; }
202
  .q-card .video-rate + .video-rate { border-top: 1px solid var(--border); }
203
  .q-card .slot-chip { display: inline-flex; align-items: center;
204
- justify-content: center; min-width: 28px; height: 28px; border-radius: 4px;
205
  background: var(--panel-3); color: var(--fg); font-weight: 700;
206
- font-size: 13px; font-family: ui-monospace, monospace;
207
  border: 1px solid var(--border-strong); flex-shrink: 0; }
208
- .q-card .likert { display: flex; gap: 4px; flex: 1; justify-content: flex-start; }
209
- .q-card .likert button { width: 40px; height: 36px; border: 1px solid var(--border);
 
210
  background: var(--panel-3); color: var(--fg); border-radius: 4px;
211
- cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500;
212
- transition: transform 0.08s, border-color 0.15s; }
213
  .q-card .likert button:hover { border-color: var(--accent); transform: translateY(-1px); }
214
  .q-card .likert button.selected { color: #0a1a0a; font-weight: 700;
215
  border-color: rgba(255,255,255,0.2); }
@@ -1723,13 +1740,46 @@ function setActiveSlot(caseId, slotIdx) {
1723
  }
1724
 
1725
  function renderLeftPane(c) {
 
 
 
 
1726
  const pane = el("div", { class: "left-pane" });
1727
- pane.appendChild(renderCaseHeader(c));
1728
  pane.appendChild(renderVideoPanel(c));
1729
  pane.appendChild(renderVideoControls(c));
 
1730
  return pane;
1731
  }
1732
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1733
  function renderRightPane(c) {
1734
  const pane = el("div", { class: "right-pane" });
1735
  const slots = SHUFFLE[c.id];
@@ -2006,26 +2056,13 @@ function restartActive() {
2006
  if (v) { v.currentTime = 0; try { v.play(); } catch(e){} }
2007
  }
2008
 
2009
- // Per-row shuffle of slot positions. Seeded by (rater, case, q_key) so the
2010
- // order is deterministic across refreshes/devices for the same rater but
2011
- // independent across rows — prevents positional bias on any single question.
2012
- // Always-on (independent of the admin reveal toggle); the toggle only
2013
- // controls whether model names are rendered next to slot letters.
2014
- //
2015
- // LCGs have poor low-order bits, so a naive `s % (i+1)` over 2 slots was
2016
- // returning the same answer for ~90% of q_keys with a shared prefix. We
2017
- // (1) warm up the LCG several steps so similar seeds diverge, then
2018
- // (2) sample from the high bits of the state instead of the low bits.
2019
  function rowSlotOrder(caseId, qKey, slotCount) {
2020
- const idx = Array.from({ length: slotCount }, (_, i) => i);
2021
- let s = hashStr(RATER.id + ":" + caseId + ":" + qKey);
2022
- for (let k = 0; k < 6; k++) s = (s * 1664525 + 1013904223) >>> 0;
2023
- for (let i = idx.length - 1; i > 0; i--) {
2024
- s = (s * 1664525 + 1013904223) >>> 0;
2025
- const j = (s >>> 16) % (i + 1);
2026
- [idx[i], idx[j]] = [idx[j], idx[i]];
2027
- }
2028
- return idx;
2029
  }
2030
 
2031
  /* =========================================================================
 
145
  @media (max-width: 900px) {
146
  .case-pane-wrap { grid-template-columns: 1fr; }
147
  }
148
+ /* Left pane: flex column. Video + controls keep their natural height;
149
+ the prompt-box at the bottom flex-grows to fill the remaining vertical
150
+ space (no more empty area below the controls). Pane is sticky and
151
+ capped at viewport height. */
152
  .left-pane { position: sticky; top: 0; align-self: start;
153
+ display: flex; flex-direction: column; gap: 8px;
154
  padding-top: 4px; padding-bottom: 8px;
155
+ height: calc(100vh - 130px); max-height: calc(100vh - 130px);
156
+ min-height: 0; }
157
+ .left-pane > .video-panel, .left-pane > .video-controls,
158
+ .left-pane > .case-meta { flex: 0 0 auto; }
159
+ .left-pane > .prompt-box { flex: 1 1 auto; min-height: 5em;
160
+ max-height: none; overflow-y: auto; }
161
+ /* Right pane: responsive grid of question cards. ~210 px minimum per card
162
+ → 3-4 cards per row on typical desktop widths. Dim headers span all
163
+ columns. */
164
+ .right-pane { min-width: 0; display: grid; gap: 10px;
165
+ grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
166
+ align-content: start; }
167
+ .right-pane > .dim-header { grid-column: 1 / -1; }
168
 
169
  /* ---------- video tabs + single active video ---------- */
170
  .video-tabs { display: flex; gap: 4px; margin: 8px 0 6px; flex-wrap: wrap; }
 
209
  .dim-header .dim-hint { font-weight: 400; color: var(--muted); font-size: 11px;
210
  text-transform: none; letter-spacing: 0; }
211
  .q-card { background: var(--panel); border: 1px solid var(--border);
212
+ border-radius: 8px; padding: 8px 10px; }
213
+ .q-card .q-name { font-size: 13px; font-weight: 600; color: var(--fg); }
214
+ .q-card .q-desc { font-size: 11px; color: var(--muted); margin: 2px 0 6px;
215
+ line-height: 1.4; }
216
+ .q-card .video-rate { display: flex; align-items: center; gap: 6px;
217
+ padding: 3px 0; }
218
  .q-card .video-rate + .video-rate { border-top: 1px solid var(--border); }
219
  .q-card .slot-chip { display: inline-flex; align-items: center;
220
+ justify-content: center; min-width: 24px; height: 24px; border-radius: 4px;
221
  background: var(--panel-3); color: var(--fg); font-weight: 700;
222
+ font-size: 12px; font-family: ui-monospace, monospace;
223
  border: 1px solid var(--border-strong); flex-shrink: 0; }
224
+ .q-card .likert { display: flex; gap: 3px; flex: 1; justify-content: flex-start; }
225
+ .q-card .likert button { flex: 1 1 0; min-width: 0; width: auto;
226
+ height: 30px; border: 1px solid var(--border);
227
  background: var(--panel-3); color: var(--fg); border-radius: 4px;
228
+ cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 500;
229
+ transition: transform 0.08s, border-color 0.15s; padding: 0; }
230
  .q-card .likert button:hover { border-color: var(--accent); transform: translateY(-1px); }
231
  .q-card .likert button.selected { color: #0a1a0a; font-weight: 700;
232
  border-color: rgba(255,255,255,0.2); }
 
1740
  }
1741
 
1742
  function renderLeftPane(c) {
1743
+ // Order: case meta (id + N-of-M) → video tabs + active video → controls
1744
+ // → prompt-box (flex-grows to fill the rest of the pane so there's no
1745
+ // empty space at the bottom). Reference image, when present, sits inside
1746
+ // the prompt-box block as a small thumbnail.
1747
  const pane = el("div", { class: "left-pane" });
1748
+ pane.appendChild(renderCaseMeta(c));
1749
  pane.appendChild(renderVideoPanel(c));
1750
  pane.appendChild(renderVideoControls(c));
1751
+ pane.appendChild(renderPromptBox(c));
1752
  return pane;
1753
  }
1754
 
1755
+ function renderCaseMeta(c) {
1756
+ return el("div", { class: "case-meta",
1757
+ style: "display:flex;align-items:baseline;gap:10px;flex-wrap:wrap" },
1758
+ el("span", { class: "case-id",
1759
+ style: "font-family:ui-monospace,monospace;font-size:18px;font-weight:600" }, c.id),
1760
+ el("span", { class: "case-counter",
1761
+ style: "color:var(--muted);font-size:12px" },
1762
+ t("case_n_of_m", currentIdx + 1, CASES.length)),
1763
+ );
1764
+ }
1765
+
1766
+ function renderPromptBox(c) {
1767
+ const wrap = el("div", { class: "prompt-box" });
1768
+ wrap.appendChild(el("div", { class: "label" }, t("prompt_label")));
1769
+ const localized = (c.prompt_i18n && c.prompt_i18n[LANG]) || c.prompt;
1770
+ const txt = el("div", {});
1771
+ txt.innerHTML = highlightControllability(localized || t("no_prompt"), LANG);
1772
+ wrap.appendChild(txt);
1773
+ if (c.reference_image) {
1774
+ const img = el("img", {
1775
+ class: "ref-img", src: c.reference_image, alt: "reference",
1776
+ onerror: function () { this.style.display = "none"; },
1777
+ });
1778
+ wrap.appendChild(img);
1779
+ }
1780
+ return wrap;
1781
+ }
1782
+
1783
  function renderRightPane(c) {
1784
  const pane = el("div", { class: "right-pane" });
1785
  const slots = SHUFFLE[c.id];
 
2056
  if (v) { v.currentTime = 0; try { v.play(); } catch(e){} }
2057
  }
2058
 
2059
+ // Within a case, every sub-question shows its rating rows in the same A → B
2060
+ // → C order. (The case-level SHUFFLE still varies which video sits under
2061
+ // each letter per-rater per-case, so positional bias across cases is still
2062
+ // neutralised — but inside a single case the rater always sees the same
2063
+ // layout, which is easier to scan and compare.)
 
 
 
 
 
2064
  function rowSlotOrder(caseId, qKey, slotCount) {
2065
+ return Array.from({ length: slotCount }, (_, i) => i);
 
 
 
 
 
 
 
 
2066
  }
2067
 
2068
  /* =========================================================================
static/mobile.html CHANGED
@@ -129,10 +129,17 @@
129
 
130
  /* dimension + question cards. dim-header sits inline above its cards
131
  (not sticky — only the prompt + videos at the top of the page float). */
132
- .dim-header { margin: 16px 0 6px; padding: 0 2px;
 
 
 
 
 
 
133
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
134
  color: var(--accent-strong); font-weight: 700;
135
  display: flex; align-items: baseline; gap: 8px; }
 
136
  .dim-header .dim-hint { font-size: 11px; color: var(--muted); font-weight: 400;
137
  text-transform: none; letter-spacing: 0; }
138
  .q-card { background: var(--panel); border: 1px solid var(--border);
@@ -693,17 +700,12 @@ function buildShuffle(cases){
693
  SHUFFLE[c.id] = idx;
694
  }
695
  }
 
 
 
 
696
  function rowSlotOrder(caseId, qKey, slotCount){
697
- if (!anonymize) return Array.from({length:slotCount},(_,i)=>i);
698
- const idx = Array.from({length:slotCount},(_,i)=>i);
699
- let s = hashStr(RATER.id+":"+caseId+":"+qKey);
700
- for (let k=0;k<6;k++) s = (s*1664525+1013904223)>>>0;
701
- for (let i=idx.length-1;i>0;i--){
702
- s = (s*1664525+1013904223)>>>0;
703
- const j = (s>>>16)%(i+1);
704
- [idx[i],idx[j]] = [idx[j],idx[i]];
705
- }
706
- return idx;
707
  }
708
 
709
  /* ----- Ratings ----- */
@@ -926,11 +928,14 @@ function renderCase(){
926
  main.appendChild(renderVideoStack(c));
927
  // controls
928
  main.appendChild(renderVideoControls());
929
- // rubric
 
 
930
  for (const dim of DIMENSIONS){
931
- main.appendChild(renderDimHeader(dim));
932
- for (const q of dim.questions) main.appendChild(renderQuestionCard(c, q));
933
  }
 
934
  updateProgress();
935
  refreshDrawerActive();
936
  }
 
129
 
130
  /* dimension + question cards. dim-header sits inline above its cards
131
  (not sticky — only the prompt + videos at the top of the page float). */
132
+ /* Responsive grid of question cards. ~280 px min → 1 col on phones,
133
+ 2-3 cols on tablets / landscape. Dim headers span all columns. */
134
+ .question-grid { display: grid; gap: 10px;
135
+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
136
+ align-content: start; }
137
+ .question-grid > .dim-header { grid-column: 1 / -1; }
138
+ .dim-header { margin: 14px 0 4px; padding: 0 2px;
139
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
140
  color: var(--accent-strong); font-weight: 700;
141
  display: flex; align-items: baseline; gap: 8px; }
142
+ .dim-header:first-child { margin-top: 0; }
143
  .dim-header .dim-hint { font-size: 11px; color: var(--muted); font-weight: 400;
144
  text-transform: none; letter-spacing: 0; }
145
  .q-card { background: var(--panel); border: 1px solid var(--border);
 
700
  SHUFFLE[c.id] = idx;
701
  }
702
  }
703
+ // Within a case, every sub-question shows its rating rows in A → B → C
704
+ // order. (Per-rater case-level shuffle still varies which video sits under
705
+ // each letter across cases, but the order inside a case is now stable so
706
+ // the rater always sees a consistent layout.)
707
  function rowSlotOrder(caseId, qKey, slotCount){
708
+ return Array.from({length:slotCount},(_,i)=>i);
 
 
 
 
 
 
 
 
 
709
  }
710
 
711
  /* ----- Ratings ----- */
 
928
  main.appendChild(renderVideoStack(c));
929
  // controls
930
  main.appendChild(renderVideoControls());
931
+ // rubric — laid out as a responsive grid (1 col on phones, 2-3 on tablets).
932
+ const grid = document.createElement("div");
933
+ grid.className = "question-grid";
934
  for (const dim of DIMENSIONS){
935
+ grid.appendChild(renderDimHeader(dim));
936
+ for (const q of dim.questions) grid.appendChild(renderQuestionCard(c, q));
937
  }
938
+ main.appendChild(grid);
939
  updateProgress();
940
  refreshDrawerActive();
941
  }