-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreview.html
More file actions
611 lines (570 loc) · 19.5 KB
/
review.html
File metadata and controls
611 lines (570 loc) · 19.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Try on browser — OpenAIReview</title>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P2VZL2X4NX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-P2VZL2X4NX');
</script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Lora:wght@600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #fafafa;
--surface: #ffffff;
--border: #e5e7eb;
--text: #1a1a2e;
--text-secondary: #6b7280;
--text-muted: #9ca3af;
--accent: #800000;
--accent-light: #fdf2f2;
--accent-hover: #600000;
--green: #10b981;
--green-light: #ecfdf5;
--orange: #f59e0b;
--orange-light: #fffbeb;
--radius: 12px;
--radius-sm: 8px;
--shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
--shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
--shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
--shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
--shadow-focus: 0 0 0 3px rgba(128,0,0,0.15);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: var(--bg);
color: var(--text);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
/* ── Header ── */
.header {
background: var(--surface);
border-bottom: 1px solid var(--border);
padding: 0 32px;
height: 64px;
display: flex;
align-items: center;
gap: 24px;
position: sticky;
top: 0;
z-index: 100;
}
.header .logo {
font-size: 16px;
font-weight: 700;
color: var(--accent);
letter-spacing: -0.3px;
}
.header-links {
margin-left: auto;
display: flex;
gap: 20px;
font-size: 14px;
font-weight: 500;
}
.header-links a {
color: var(--text-secondary);
transition: color 0.15s;
}
.header-links a:hover { color: var(--text); }
/* ── Hero wrapper with dot pattern ── */
.hero-wrapper {
position: relative;
overflow: hidden;
background-color: var(--bg);
background-image: radial-gradient(circle, rgba(128,0,0,0.07) 1px, transparent 1px);
background-size: 26px 26px;
min-height: calc(100vh - 64px - 80px); /* 64px header, 80px footer approximation */
display: flex;
align-items: center;
justify-content: center;
}
/* ── Hero ── */
.hero {
max-width: 800px;
margin: 0 auto;
padding: 48px 32px;
text-align: center;
position: relative;
z-index: 1;
}
.hero h1 {
font-family: 'Lora', Georgia, 'Times New Roman', serif;
font-size: 34px;
font-weight: 700;
letter-spacing: -0.3px;
line-height: 1.2;
margin-bottom: 12px;
color: var(--text);
}
.hero .subtitle {
font-size: 17px;
color: var(--text-secondary);
line-height: 1.65;
max-width: 560px;
margin: 0 auto 32px;
}
/* ── Upload Section ── */
.upload-section {
max-width: 640px;
margin: 0 auto;
width: 100%;
}
.upload-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 32px;
box-shadow: var(--shadow-md);
text-align: left;
}
.drop-zone {
border: 2px dashed var(--border);
border-radius: var(--radius-sm);
padding: 36px 24px;
text-align: center;
cursor: pointer;
transition: border-color 0.2s, background 0.2s;
margin-bottom: 20px;
position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
border-color: var(--accent);
background: var(--accent-light);
}
.drop-zone input[type="file"] {
position: absolute;
inset: 0;
opacity: 0;
cursor: pointer;
width: 100%;
height: 100%;
}
.drop-icon {
width: 40px;
height: 40px;
margin: 0 auto 12px;
color: var(--text-muted);
}
.drop-icon svg { width: 40px; height: 40px; stroke: currentColor; }
.drop-label {
font-size: 15px;
font-weight: 500;
margin-bottom: 4px;
}
.drop-hint {
font-size: 12px;
color: var(--text-muted);
}
.drop-zone.file-selected .drop-label { color: var(--accent); }
.submit-btn {
width: 100%;
background: var(--accent);
color: #fff;
border: none;
border-radius: var(--radius-sm);
padding: 13px 24px;
font-size: 15px;
font-weight: 600;
cursor: pointer;
transition: background 0.15s, box-shadow 0.2s;
font-family: inherit;
}
.submit-btn:hover:not(:disabled) {
background: var(--accent-hover);
box-shadow: var(--shadow-md);
}
.submit-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.upload-status {
margin-top: 16px;
font-size: 14px;
display: none;
}
.upload-status.visible { display: block; }
.upload-status.error { color: #dc2626; }
.token-box {
background: var(--accent-light);
border: 1px solid #f9c0c0;
border-radius: var(--radius-sm);
padding: 20px;
margin-top: 20px;
display: none;
}
.token-box.visible { display: block; }
.token-box .token-label {
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
color: var(--accent);
margin-bottom: 8px;
}
.token-box .token-value {
font-family: 'SF Mono', 'Fira Code', monospace;
font-size: 13px;
word-break: break-all;
margin-bottom: 12px;
color: var(--text);
background: #fff;
border: 1px solid var(--border);
border-radius: 6px;
padding: 8px 12px;
}
.token-box .token-cta {
font-size: 13px;
font-weight: 500;
color: var(--text-secondary);
margin-bottom: 12px;
}
.view-btn {
display: inline-block;
background: var(--accent);
color: #fff;
border-radius: var(--radius-sm);
padding: 9px 18px;
font-size: 13px;
font-weight: 600;
text-decoration: none;
transition: background 0.15s;
}
.view-btn:hover { background: var(--accent-hover); color: #fff; }
/* ── Token lookup ── */
.token-lookup {
display: flex;
gap: 8px;
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid var(--border);
}
.token-lookup input {
flex: 1;
padding: 10px 14px;
font-size: 13px;
font-family: 'SF Mono', 'Fira Code', monospace;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
outline: none;
transition: border-color 0.15s, box-shadow 0.15s;
color: var(--text);
}
.token-lookup input::placeholder { color: var(--text-muted); }
.token-lookup input:focus { border-color: var(--accent); box-shadow: var(--shadow-focus); }
.token-lookup button {
padding: 10px 16px;
font-size: 13px;
font-weight: 600;
font-family: inherit;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
cursor: pointer;
color: var(--text-secondary);
white-space: nowrap;
transition: border-color 0.15s, color 0.15s;
}
.token-lookup button:hover { border-color: var(--accent); color: var(--accent); }
/* ── Footer ── */
.footer {
border-top: 1px solid var(--border);
padding: 32px;
text-align: center;
font-size: 13px;
color: var(--text-secondary);
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
}
/* ── Responsive ── */
@media (max-width: 768px) {
.header {
flex-wrap: wrap;
height: auto;
min-height: 64px;
padding: 12px 16px;
gap: 10px;
}
.header-links {
width: 100%;
justify-content: flex-start;
}
.hero-wrapper {
min-height: auto;
align-items: flex-start;
}
.hero { padding: 40px 16px 48px; }
.hero h1 { font-size: 28px; }
.hero .subtitle { font-size: 15px; }
.upload-card { padding: 24px 20px; }
.drop-zone { padding: 28px 16px; }
.token-lookup {
flex-direction: column;
align-items: stretch;
}
.token-lookup button { width: 100%; }
#email-input { font-size: 16px !important; }
}
@media (max-width: 480px) {
.upload-card { padding: 20px 16px; }
.drop-label { font-size: 14px; }
.drop-hint { line-height: 1.5; }
}
</style>
</head>
<body>
<div class="header">
<a href="/index.html" class="logo">OpenAIReview</a>
<div class="header-links">
<a href="/blog.html">Blog</a>
<a href="https://github.com/ChicagoHAI/OpenAIReview" target="_blank">GitHub</a>
</div>
</div>
<!-- Hero Section for Upload -->
<div class="hero-wrapper">
<div class="hero">
<h1>Upload your paper</h1>
<p class="subtitle">
Get feedback from our AI reviewer
</p>
<!-- Upload Section -->
<div class="upload-section">
<div class="upload-card">
<div id="upload-form">
<!-- Tab toggle -->
<div style="display:flex;gap:0;margin-bottom:16px;border:1px solid var(--border);border-radius:var(--radius-sm);overflow:hidden;">
<button id="tab-file" onclick="switchTab('file')"
style="flex:1;padding:9px 16px;font-size:13px;font-weight:600;font-family:inherit;border:none;cursor:pointer;background:var(--accent-light);color:var(--accent);transition:background 0.15s,color 0.15s;">
Upload file
</button>
<button id="tab-url" onclick="switchTab('url')"
style="flex:1;padding:9px 16px;font-size:13px;font-weight:600;font-family:inherit;border:none;cursor:pointer;background:var(--surface);color:var(--text-secondary);transition:background 0.15s,color 0.15s;">
Paste link
</button>
</div>
<!-- Pane container — fixed height keeps card size uniform across tabs -->
<div style="position:relative;margin-bottom:20px;">
<!-- File drop zone -->
<div id="pane-file" style="width:100%;">
<div class="drop-zone" id="drop-zone" style="margin-bottom:0;box-sizing:border-box;width:100%;">
<input type="file" id="pdf-input" accept=".pdf,.tex,.md,.txt" />
<div class="drop-icon">
<svg viewBox="0 0 24 24" fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 16V4m0 0L8 8m4-4 4 4"/>
<path d="M20 16v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-2"/>
</svg>
</div>
<div class="drop-label" id="drop-label">Drop file here or click to browse</div>
<div class="drop-hint">PDF, TeX, Markdown, TXT · max 10 MB · 3 reviews/email/day</div>
</div>
</div><!-- end pane-file -->
<!-- URL input pane — same height as drop zone via padding -->
<div id="pane-url" style="display:none;width:100%;padding:36px 0;flex-direction:column;justify-content:center;gap:8px;box-sizing:border-box;">
<input type="url" id="url-input" placeholder="https://arxiv.org/abs/..."
style="width:100%;padding:10px 14px;font-size:14px;font-family:inherit;border:1px solid var(--border);border-radius:var(--radius-sm);outline:none;transition:border-color 0.15s,box-shadow 0.15s;color:var(--text);"
onfocus="this.style.borderColor='var(--accent)';this.style.boxShadow='var(--shadow-focus)'"
onblur="this.style.borderColor='var(--border)';this.style.boxShadow='none'" />
<div style="font-size:12px;color:var(--text-muted);">arXiv URLs only (abs or html) · 3 reviews/email/day</div>
</div><!-- end pane-url -->
</div><!-- end pane container -->
<div style="font-size:14px;color:var(--text-muted);margin-bottom:8px;line-height:1.5;">
Papers are capped at 20 pages and 20k tokens. Each review may take 15–20 minutes. You will get an email when your review is ready. For longer manuscripts, use our tool on <a href="https://github.com/ChicagoHAI/OpenAIReview">GitHub</a>.<br>
We only use your submission for reviewing purposes. If you give feedback on the result page, your feedback (and submission) may be used in an open benchmark for improving AI reviewing.
</div>
<input type="email" id="email-input" placeholder="your@email.com — we'll notify you when done" required
style="width:100%;padding:10px 14px;font-size:14px;font-family:inherit;border:1px solid var(--border);border-radius:var(--radius-sm);outline:none;margin-bottom:12px;transition:border-color 0.15s,box-shadow 0.15s;color:var(--text);"
onfocus="this.style.borderColor='var(--accent)';this.style.boxShadow='var(--shadow-focus)'"
onblur="this.style.borderColor='var(--border)';this.style.boxShadow='none'" />
<button class="submit-btn" id="submit-btn">Get Review</button>
</div><!-- end upload-form -->
<div class="upload-status" id="upload-status"></div>
<div class="token-box" id="token-box">
<div class="token-label">Save your token</div>
<div class="token-value" id="token-value"></div>
<div class="token-cta">Your review is being processed. You'll receive an email when it's ready. Save this token as a backup to view your results directly.</div>
<a class="view-btn" id="view-btn" href="#">Check review status →</a>
</div>
<div class="token-lookup">
<input type="text" id="lookup-input" placeholder="Paste a token to view past review" spellcheck="false" />
<button onclick="lookupToken()">View review →</button>
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<div class="footer">
<div>Built by <a href="https://chicagohai.github.io/" target="_blank">Chicago Human+AI Lab (ChicagoHAI)</a></div>
</div>
<script>
const BACKEND_URL = 'https://openaireview-backend-947059889174.us-central1.run.app';
function lookupToken() {
const token = document.getElementById('lookup-input').value.trim();
if (!token) return;
window.location.href = `/results.html?token=${encodeURIComponent(token)}`;
}
document.addEventListener('DOMContentLoaded', () => {
document.getElementById('lookup-input').addEventListener('keydown', (e) => {
if (e.key === 'Enter') lookupToken();
});
initUpload();
});
let activeTab = 'file';
function switchTab(tab) {
activeTab = tab;
const isFile = tab === 'file';
document.getElementById('pane-file').style.display = isFile ? '' : 'none';
document.getElementById('pane-url').style.display = isFile ? 'none' : 'flex';
document.getElementById('tab-file').style.background = isFile ? 'var(--accent-light)' : 'var(--surface)';
document.getElementById('tab-file').style.color = isFile ? 'var(--accent)' : 'var(--text-secondary)';
document.getElementById('tab-url').style.background = isFile ? 'var(--surface)' : 'var(--accent-light)';
document.getElementById('tab-url').style.color = isFile ? 'var(--text-secondary)' : 'var(--accent)';
}
function initUpload() {
const dropZone = document.getElementById('drop-zone');
const fileInput = document.getElementById('pdf-input');
const dropLabel = document.getElementById('drop-label');
const submitBtn = document.getElementById('submit-btn');
const statusEl = document.getElementById('upload-status');
const tokenBox = document.getElementById('token-box');
const tokenValue = document.getElementById('token-value');
const viewBtn = document.getElementById('view-btn');
const emailInput = document.getElementById('email-input');
let selectedFile = null;
fileInput.addEventListener('change', () => {
if (fileInput.files[0]) selectFile(fileInput.files[0]);
});
dropZone.addEventListener('dragover', (e) => {
e.preventDefault();
dropZone.classList.add('drag-over');
});
dropZone.addEventListener('dragleave', () => dropZone.classList.remove('drag-over'));
dropZone.addEventListener('drop', (e) => {
e.preventDefault();
dropZone.classList.remove('drag-over');
const f = e.dataTransfer.files[0];
if (f) selectFile(f);
});
const ALLOWED_EXTS = ['.pdf', '.tex', '.md', '.txt'];
function selectFile(f) {
const ext = f.name.slice(f.name.lastIndexOf('.')).toLowerCase();
if (!ALLOWED_EXTS.includes(ext)) {
showStatus('Unsupported file type. Please upload a PDF, .tex, .md, or .txt file.', true);
return;
}
if (f.size > 10 * 1024 * 1024) {
showStatus('File is too large. Maximum size is 10 MB.', true);
return;
}
selectedFile = f;
dropLabel.textContent = f.name;
dropZone.classList.add('file-selected');
hideStatus();
}
submitBtn.addEventListener('click', async () => {
const email = emailInput.value.trim();
if (!email || !email.includes('@')) {
showStatus('Please enter a valid email address to receive your results.', true);
return;
}
const form = new FormData();
form.append('email', email);
if (activeTab === 'file') {
if (!selectedFile) {
showStatus('Please select a file to review.', true);
return;
}
form.append('file', selectedFile);
} else {
const urlVal = document.getElementById('url-input').value.trim();
if (!urlVal) {
showStatus('Please enter a URL to review.', true);
return;
}
if (!urlVal.startsWith('http')) {
showStatus('URL must start with http or https.', true);
return;
}
form.append('url', urlVal);
}
submitBtn.disabled = true;
tokenBox.classList.remove('visible');
showStatus(activeTab === 'file' ? 'Uploading and queuing review...' : 'Fetching URL and queuing review...', false);
let token;
try {
const resp = await fetch(`${BACKEND_URL}/review`, { method: 'POST', body: form });
if (resp.status === 429) {
const err = await resp.json().catch(() => ({}));
const rawDetail = err.detail ? err.detail.trimEnd() : '';
const detail = rawDetail ? ' ' + escapeHtml(rawDetail.endsWith('.') ? rawDetail : rawDetail + '.') : '';
showStatus('Rate limit reached today:' + detail + ' Try again tomorrow on the web or check out our <a href="https://github.com/ChicagoHAI/OpenAIReview" target="_blank">tool</a> online.', true);
submitBtn.disabled = false;
return;
}
if (!resp.ok) {
const err = await resp.json().catch(() => ({}));
showStatus(escapeHtml(err.detail || `Submission failed (${resp.status}).`), true);
submitBtn.disabled = false;
return;
}
const data = await resp.json();
token = data.token;
} catch (e) {
showStatus('Could not reach the review server. It may be starting up (cold start ~30s) — try again.', true);
submitBtn.disabled = false;
return;
}
document.getElementById('upload-form').style.display = 'none';
tokenValue.textContent = token;
const resultsUrl = `/results.html?token=${token}`;
viewBtn.href = resultsUrl;
tokenBox.classList.add('visible');
showStatus('Your paper is being reviewed. You\'ll be redirected automatically when it\'s ready...', false);
pollStatus(token, resultsUrl);
});
async function pollStatus(token, resultsUrl) {
while (true) {
await new Promise(r => setTimeout(r, 15000));
try {
const resp = await fetch(`${BACKEND_URL}/status/${token}`);
if (!resp.ok) continue;
const { status } = await resp.json();
if (status === 'done') {
window.location.href = resultsUrl;
return;
}
if (status === 'error') {
showStatus('Review failed. Please try submitting again.', true);
return;
}
} catch (_) { /* network blip, keep polling */ }
}
}
function escapeHtml(s) {
return s.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');
}
function showStatus(msg, isError) {
statusEl.innerHTML = msg;
statusEl.className = 'upload-status visible' + (isError ? ' error' : '');
}
function hideStatus() {
statusEl.className = 'upload-status';
}
}
</script>
</body>
</html>