Skip to content

Commit

Permalink
Playground: Side-by-Side Expert Evaluation (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikRemo authored Nov 18, 2024
1 parent 9c49cc8 commit acb2929
Show file tree
Hide file tree
Showing 56 changed files with 2,599 additions and 53 deletions.
Empty file.
123 changes: 107 additions & 16 deletions playground/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
},
"dependencies": {
"@blueprintjs/core": "5.5.1",
"@fortawesome/fontawesome-svg-core": "6.6.0",
"@fortawesome/free-solid-svg-icons": "6.6.0",
"@fortawesome/react-fontawesome": "0.2.2",
"@ls1intum/apollon": "3.3.5",
"@monaco-editor/react": "4.6.0",
"@radix-ui/react-collapsible": "1.0.3",
Expand All @@ -31,6 +34,7 @@
"react": "18.2.0",
"react-complex-tree": "2.2.2",
"react-complex-tree-blueprintjs-renderers": "2.2.2",
"react-confetti": "6.1.0",
"react-dom": "18.2.0",
"react-full-screen": "1.1.1",
"react-markdown": "9.0.0",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions playground/src/components/details/editor/file_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type FileEditorProps = {
createNewFeedback?: () => Feedback;
manualRatings?: ManualRating[];
onManualRatingsChange?: (manualRatings: ManualRating[]) => void;
hideFeedbackDetails?: boolean;
};

export default function FileEditor({
Expand All @@ -38,6 +39,7 @@ export default function FileEditor({
createNewFeedback,
manualRatings,
onManualRatingsChange,
hideFeedbackDetails
}: FileEditorProps) {
const monaco = useMonaco();
const editorRef = useRef<editor.IStandaloneCodeEditor>();
Expand Down Expand Up @@ -358,6 +360,7 @@ export default function FileEditor({
}
model={model}
className="mr-4"
hideDetails={hideFeedbackDetails}
/>
</EditorWidget>
)
Expand Down
48 changes: 26 additions & 22 deletions playground/src/components/details/editor/inline_feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type InlineFeedbackProps = {
onManualRatingChange?: (manualRating: ManualRating) => void;
model?: editor.ITextModel;
className?: string;
hideDetails?: boolean;
};

export default function InlineFeedback({
Expand All @@ -28,6 +29,7 @@ export default function InlineFeedback({
onManualRatingChange,
model,
className,
hideDetails,
}: InlineFeedbackProps) {
const [isEditing, setIsEditing] = useState(false);
const [confirmDelete, setConfirmDelete] = useState(false);
Expand Down Expand Up @@ -145,29 +147,31 @@ export default function InlineFeedback({
onMouseEnter={() => setIsHovering(true)}
onMouseLeave={() => setIsHovering(false)}
>
<div className="flex items-center justify-between px-4 py-2 border-b border-gray-300 text-xs text-gray-600">
<div className="break-all">
{referenceType === "unreferenced" && "Unreferenced"}
{"file_path" in feedback &&
referenceType === "unreferenced_file" &&
`References ${feedback.file_path}`}
{referenceType === "referenced" &&
`References ${formatReference(feedback)}`}
</div>
<div className="flex gap-1">
{feedback.structured_grading_instruction_id && (
<span className="text-xs text-orange-800 rounded-full px-2 py-0.5 bg-orange-100">
Grading&nbsp;Instruction&nbsp;
{feedback.structured_grading_instruction_id}
</span>
)}
{feedback.isSuggestion && (
<span className="text-xs text-violet-800 rounded-full px-2 py-0.5 bg-violet-100">
Suggestion
</span>
)}
{hideDetails ? null : (
<div className="flex items-center justify-between px-4 py-2 border-b border-gray-300 text-xs text-gray-600">
<div className="break-all">
{referenceType === "unreferenced" && "Unreferenced"}
{"file_path" in feedback &&
referenceType === "unreferenced_file" &&
`References ${feedback.file_path}`}
{referenceType === "referenced" &&
`References ${formatReference(feedback)}`}
</div>
<div className="flex gap-1">
{feedback.structured_grading_instruction_id && (
<span className="text-xs text-orange-800 rounded-full px-2 py-0.5 bg-orange-100">
Grading&nbsp;Instruction&nbsp;
{feedback.structured_grading_instruction_id}
</span>
)}
{feedback.isSuggestion && (
<span className="text-xs text-violet-800 rounded-full px-2 py-0.5 bg-violet-100">
Suggestion
</span>
)}
</div>
</div>
</div>
)}
<div className="flex justify-start items-start space-x-2 px-4 py-2">
{isEditing && onFeedbackChange ? (
<input
Expand Down
6 changes: 3 additions & 3 deletions playground/src/components/details/exercise_detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function ExerciseDetail({
const specificExerciseDetail = (() => {
switch (exercise.type) {
case "text":
return <TextExerciseDetail exercise={exercise} openedInitially={openedInitially}/>;
return <TextExerciseDetail exercise={exercise} openedInitially={openedInitially} />;
case "programming":
return <ProgrammingExerciseDetail exercise={exercise} openedInitially={openedInitially} />;
default:
Expand All @@ -29,7 +29,7 @@ export default function ExerciseDetail({
})();

return hideDisclosure ? (
<div className="mt-2 space-y-1">
<div className="mt-2 space-y-1 w-full lg:w-[60vw] max-h-[50vh] overflow-y-auto overflow-x-hidden flex flex-col">
<CommonExerciseDetail exercise={exercise} openedInitially={openedInitially} />
{specificExerciseDetail}
</div>
Expand All @@ -40,7 +40,7 @@ export default function ExerciseDetail({
openedInitially={openedInitially}
>
<>
<CommonExerciseDetail exercise={exercise}/>
<CommonExerciseDetail exercise={exercise} />
{specificExerciseDetail}
</>
</Disclosure>
Expand Down
4 changes: 4 additions & 0 deletions playground/src/components/details/submission_detail/text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type TextSubmissionDetailProps = {
onFeedbacksChange?: (feedback: Feedback[]) => void;
manualRatings?: ManualRating[];
onManualRatingsChange?: (manualRatings: ManualRating[]) => void;
hideFeedbackDetails?: boolean;
};

export default function TextSubmissionDetail({
Expand All @@ -23,6 +24,7 @@ export default function TextSubmissionDetail({
onFeedbacksChange,
manualRatings,
onManualRatingsChange,
hideFeedbackDetails,
}: TextSubmissionDetailProps) {
const unreferencedFeedbacks = feedbacks?.filter(
(feedback) => getFeedbackReferenceType(feedback) === "unreferenced"
Expand All @@ -41,6 +43,7 @@ export default function TextSubmissionDetail({
manualRatings={manualRatings}
onManualRatingsChange={onManualRatingsChange}
createNewFeedback={() => createNewFeedback(submission)}
hideFeedbackDetails={hideFeedbackDetails}
/>
</div>
{((unreferencedFeedbacks && unreferencedFeedbacks.length > 0) ||
Expand All @@ -64,6 +67,7 @@ export default function TextSubmissionDetail({
onManualRatingsChange &&
createManualRatingItemUpdater(feedback.id, manualRatings, onManualRatingsChange)
}
hideDetails={hideFeedbackDetails}
/>
)
)}
Expand Down
Loading

0 comments on commit acb2929

Please sign in to comment.