PITTI commited on
Commit
87db41c
·
1 Parent(s): 1c85952

adding human feedback

Browse files
api/mismatches.ts CHANGED
@@ -66,6 +66,7 @@ export default async function handler(req: IncomingMessage, res: ServerResponse)
66
  theme: row.question_theme,
67
  domain: row.question_domain,
68
  model: row.response_model,
 
69
  response: row.response_content,
70
  assessments: {},
71
  });
 
66
  theme: row.question_theme,
67
  domain: row.question_domain,
68
  model: row.response_model,
69
+ r_uuid: row.r_uuid,
70
  response: row.response_content,
71
  assessments: {},
72
  });
src/components/itemList.tsx CHANGED
@@ -1,7 +1,23 @@
 
1
  import ReactMarkdown from 'react-markdown';
2
  import type { AssessmentItemsProps } from '../types';
3
 
4
  const AssessmentItems: React.FC<AssessmentItemsProps> = ({ judge1, judge2, items, selectedCategory }) => {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  if (!selectedCategory || items.length === 0) {
6
  return (
7
  <div className="assessment-items">
@@ -18,10 +34,14 @@ const AssessmentItems: React.FC<AssessmentItemsProps> = ({ judge1, judge2, items
18
  {items.map((item, index) => (
19
  <div key={index} className="assessment-item">
20
  <div className="item-question">
21
- <h4>Question</h4>
 
 
 
 
 
 
22
  <p>{item.question}</p>
23
- { item.theme && <p><strong>Theme:</strong> {item.theme}</p> }
24
- { item.domain && <p><strong>Domain:</strong> {item.domain}</p> }
25
  </div>
26
 
27
  <div className="item-answer">
@@ -58,11 +78,30 @@ const AssessmentItems: React.FC<AssessmentItemsProps> = ({ judge1, judge2, items
58
  </div>
59
  </div>
60
  )}
61
- </>
62
- ) : (
63
- <p>No assessments available</p>
64
- )}
65
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  </div>
67
  ))}
68
  </div>
 
1
+ import React, { useState } from 'react';
2
  import ReactMarkdown from 'react-markdown';
3
  import type { AssessmentItemsProps } from '../types';
4
 
5
  const AssessmentItems: React.FC<AssessmentItemsProps> = ({ judge1, judge2, items, selectedCategory }) => {
6
+ const [copiedIndex, setCopiedIndex] = useState<number | null>(null);
7
+ const [copiedButton, setCopiedButton] = useState<string | null>(null);
8
+
9
+ const handleCopyAssessment = (r_uuid: string, buttonValue: string, itemIndex: number) => {
10
+ const tuple = `["${r_uuid}", "${buttonValue}"]`;
11
+ navigator.clipboard.writeText(tuple).then(() => {
12
+ setCopiedIndex(itemIndex);
13
+ setCopiedButton(buttonValue);
14
+ setTimeout(() => {
15
+ setCopiedIndex(null);
16
+ setCopiedButton(null);
17
+ }, 2000);
18
+ });
19
+ };
20
+
21
  if (!selectedCategory || items.length === 0) {
22
  return (
23
  <div className="assessment-items">
 
34
  {items.map((item, index) => (
35
  <div key={index} className="assessment-item">
36
  <div className="item-question">
37
+ <div className="item-question-header">
38
+ <h4>Question</h4>
39
+ <div className="metadata">
40
+ { item.theme && <span className="meta-tag theme"><strong>Theme:</strong> {item.theme}</span> }
41
+ { item.domain && <span className="meta-tag domain"><strong>Domain:</strong> {item.domain}</span> }
42
+ </div>
43
+ </div>
44
  <p>{item.question}</p>
 
 
45
  </div>
46
 
47
  <div className="item-answer">
 
78
  </div>
79
  </div>
80
  )}
81
+ </>
82
+ ) : (
83
+ <p>No assessments available</p>
84
+ )}
85
+ </div>
86
+ <div className="third-assessment">
87
+ <div>
88
+ <h4>Provide Human Assessment</h4>
89
+ <p className="assessment-hint">Click to copy assessment tuple for response ID: <code>{item.r_uuid}</code></p>
90
+ </div>
91
+ <div className="assessment-buttons">
92
+ {['COMPLETE', 'EVASIVE', 'DENIAL', 'ERROR'].map((buttonValue) => (
93
+ <button
94
+ key={buttonValue}
95
+ className={`assessment-btn ${buttonValue.toLowerCase()} ${
96
+ copiedIndex === index && copiedButton === buttonValue ? 'copied' : ''
97
+ }`}
98
+ onClick={() => handleCopyAssessment(item.r_uuid, buttonValue, index)}
99
+ >
100
+ {copiedIndex === index && copiedButton === buttonValue ? '✓ Copied!' : buttonValue}
101
+ </button>
102
+ ))}
103
+ </div>
104
+ </div>
105
  </div>
106
  ))}
107
  </div>
src/index.css CHANGED
@@ -463,11 +463,47 @@ body {
463
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
464
  }
465
 
466
- .item-question, .item-answer {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  margin-bottom: 1.5rem;
468
  }
469
 
470
- .item-question h4, .item-answer h4 {
471
  font-size: 1rem;
472
  font-weight: 600;
473
  color: #374151;
@@ -514,27 +550,27 @@ body {
514
  letter-spacing: 0.05em;
515
  }
516
 
517
- .assessment-label.complete {
518
  background: #dcfce7;
519
  color: #166534;
520
  }
521
 
522
- .assessment-label.evasive {
523
  background: #fef3c7;
524
  color: #92400e;
525
  }
526
 
527
- .assessment-label.denial {
528
  background: #fecaca;
529
  color: #991b1b;
530
  }
531
 
532
- .assessment-label.error {
533
  background: #e9d5ff;
534
  color: #6b21a8;
535
  }
536
 
537
- .assessment-label.unknown {
538
  background: #f3f4f6;
539
  color: #4b5563;
540
  }
@@ -545,6 +581,61 @@ body {
545
  font-size: 0.875rem;
546
  }
547
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
548
  /* Markdown Styles */
549
  .markdown-content {
550
  line-height: 1.6;
 
463
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
464
  }
465
 
466
+ .item-question-header {
467
+ display: flex;
468
+ justify-content: space-between;
469
+ align-items: center;
470
+ }
471
+
472
+ .metadata {
473
+ display: flex;
474
+ gap: 12px;
475
+ flex-wrap: wrap;
476
+ }
477
+
478
+ .meta-tag {
479
+ display: inline-flex;
480
+ align-items: center;
481
+ gap: 4px;
482
+ padding: 4px 12px;
483
+ border-radius: 20px;
484
+ font-size: 0.875rem;
485
+ font-weight: 500;
486
+ }
487
+
488
+ .meta-tag.theme {
489
+ background: #dbeafe;
490
+ color: #1e40af;
491
+ }
492
+
493
+ .meta-tag.domain {
494
+ background: #f3e8ff;
495
+ color: #6b21a8;
496
+ }
497
+
498
+ .meta-tag strong {
499
+ font-weight: 600;
500
+ }
501
+
502
+ .item-question, .item-answer, .item-assessments {
503
  margin-bottom: 1.5rem;
504
  }
505
 
506
+ h4 {
507
  font-size: 1rem;
508
  font-weight: 600;
509
  color: #374151;
 
550
  letter-spacing: 0.05em;
551
  }
552
 
553
+ .complete {
554
  background: #dcfce7;
555
  color: #166534;
556
  }
557
 
558
+ .evasive {
559
  background: #fef3c7;
560
  color: #92400e;
561
  }
562
 
563
+ .denial {
564
  background: #fecaca;
565
  color: #991b1b;
566
  }
567
 
568
+ .error {
569
  background: #e9d5ff;
570
  color: #6b21a8;
571
  }
572
 
573
+ .unknown {
574
  background: #f3f4f6;
575
  color: #4b5563;
576
  }
 
581
  font-size: 0.875rem;
582
  }
583
 
584
+ .third-assessment {
585
+ display:flex;
586
+ justify-content: space-between;
587
+ width: 100%;
588
+ }
589
+
590
+ .assessment-hint {
591
+ color: #64748b;
592
+ font-size: 0.875rem;
593
+ }
594
+
595
+ .assessment-hint code {
596
+ background: #e2e8f0;
597
+ padding: 2px 6px;
598
+ border-radius: 3px;
599
+ font-family: monospace;
600
+ font-size: 0.8125rem;
601
+ color: #475569;
602
+ }
603
+
604
+ .assessment-buttons {
605
+ display: flex;
606
+ gap: 12px;
607
+ flex-wrap: wrap;
608
+ padding : 1rem 0;
609
+ }
610
+
611
+ .assessment-btn {
612
+ padding: 8px 20px;
613
+ border: 2px solid transparent;
614
+ border-radius: 6px;
615
+ font-weight: 600;
616
+ font-size: 0.875rem;
617
+ cursor: pointer;
618
+ transition: all 0.2s ease;
619
+ position: relative;
620
+ overflow: hidden;
621
+ }
622
+
623
+ .assessment-btn:hover {
624
+ transform: scale(1.05);
625
+ z-index: 10;
626
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
627
+ }
628
+
629
+ .assessment-btn:active {
630
+ transform: translateY(0);
631
+ }
632
+
633
+ .assessment-btn.copied {
634
+ background: #6366f1 !important;
635
+ color: white !important;
636
+ border-color: #6366f1 !important;
637
+ }
638
+
639
  /* Markdown Styles */
640
  .markdown-content {
641
  line-height: 1.6;
src/types.ts CHANGED
@@ -47,6 +47,7 @@ export interface AssessmentItem {
47
  question: string;
48
  theme: string;
49
  domain: string;
 
50
  response: string;
51
  model: string;
52
  assessments: Record<string,JudgeAssessment>;
 
47
  question: string;
48
  theme: string;
49
  domain: string;
50
+ r_uuid: string;
51
  response: string;
52
  model: string;
53
  assessments: Record<string,JudgeAssessment>;