Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programming exercises: Increase AI feedback request limit #8746

Merged
merged 4 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private void checkRateLimitOrThrow(ProgrammingExerciseStudentParticipation parti
if (countOfAthenaResultsInProcessOrSuccessful >= 3) {
throw new BadRequestAlertException("Cannot send additional AI feedback requests now. Try again later!", "participation", "preconditions not met");
}
if (countOfSuccessfulRequests >= 3) {
if (countOfSuccessfulRequests >= 20) {
throw new BadRequestAlertException("Maximum number of AI feedback requests reached.", "participation", "preconditions not met");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export class ExerciseDetailsStudentActionsComponent implements OnInit, OnChanges
const athenaResults = this.gradedParticipation.results.filter((result) => result.assessmentType === 'AUTOMATIC_ATHENA');
const countOfSuccessfulRequests = athenaResults.filter((result) => result.successful === true).length;

if (countOfSuccessfulRequests >= 3) {
if (countOfSuccessfulRequests >= 20) {
const rateLimitExceededWarning = this.translateService.instant('artemisApp.exercise.maxAthenaResultsReached');
window.alert(rateLimitExceededWarning);
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,13 @@ describe('ExerciseDetailsStudentActionsComponent', () => {

it('assureConditionsSatisfied should alert and return false if the maximum number of successful Athena results is reached', () => {
jest.spyOn(window, 'alert').mockImplementation(() => {});
const numResults = 20;
const results: Array<{ assessmentType: AssessmentType; successful: boolean }> = [];

for (let i = 0; i < numResults; i++) {
results.push({ assessmentType: AssessmentType.AUTOMATIC_ATHENA, successful: true });
}

comp.exercise = {
type: ExerciseType.PROGRAMMING,
dueDate: dayjs().add(5, 'minutes'),
Expand All @@ -585,9 +592,7 @@ describe('ExerciseDetailsStudentActionsComponent', () => {
assessmentType: AssessmentType.AUTOMATIC,
score: 100,
},
{ assessmentType: AssessmentType.AUTOMATIC_ATHENA, successful: true },
{ assessmentType: AssessmentType.AUTOMATIC_ATHENA, successful: true },
{ assessmentType: AssessmentType.AUTOMATIC_ATHENA, successful: true },
...results,
],
},
] as StudentParticipation[],
Expand Down
Loading