diff --git a/src/commons/application/actions/__tests__/SessionActions.test.ts b/src/commons/application/actions/__tests__/SessionActions.test.ts index b8d11c0c8d..77a1d6a65d 100644 --- a/src/commons/application/actions/__tests__/SessionActions.test.ts +++ b/src/commons/application/actions/__tests__/SessionActions.test.ts @@ -605,6 +605,8 @@ test('updateGrading generates correct action object', async () => { const grading: GradingQuery = { answers: [ { + id: 0, + prompts: [], question: await vi.importMock('../../../../features/grading/GradingTypes'), student: { name: 'test student', @@ -620,9 +622,12 @@ test('updateGrading generates correct action object', async () => { id: 100 }, gradedAt: '2019-08-16T13:26:32+00:00' - } + }, + autogradingResults: [], + autoGradingStatus: 'N/A' } ], + enable_llm_grading: false, assessment: { coverPicture: 'https://i.imgur.com/dR7zBPI.jpeg', id: 1, diff --git a/src/commons/application/reducers/__tests__/SessionReducer.test.ts b/src/commons/application/reducers/__tests__/SessionReducer.test.ts index ff9001f136..e847e002bd 100644 --- a/src/commons/application/reducers/__tests__/SessionReducer.test.ts +++ b/src/commons/application/reducers/__tests__/SessionReducer.test.ts @@ -402,8 +402,13 @@ test('UPDATE_ASSESSMENT_OVERVIEWS works correctly in updating assessment overvie // Test data for UPDATE_GRADING const gradingTest1: GradingQuery = { + enable_llm_grading: false, answers: [ { + id: 0, + prompts: [], + autogradingResults: [], + autoGradingStatus: 'N/A', question: await vi.importMock('../../../../features/grading/GradingTypes'), student: { name: 'test student', @@ -430,8 +435,13 @@ const gradingTest1: GradingQuery = { }; const gradingTest2: GradingQuery = { + enable_llm_grading: false, answers: [ { + id: 0, + prompts: [], + autogradingResults: [], + autoGradingStatus: 'N/A', question: await vi.importMock('../../../../features/grading/GradingTypes'), student: { name: 'another test student', diff --git a/src/commons/application/types/SessionTypes.ts b/src/commons/application/types/SessionTypes.ts index 401466989f..a0e3fe33c0 100644 --- a/src/commons/application/types/SessionTypes.ts +++ b/src/commons/application/types/SessionTypes.ts @@ -39,6 +39,10 @@ export type SessionState = { readonly enableAchievements?: boolean; readonly enableSourcecast?: boolean; readonly enableStories?: boolean; + readonly enableLlmGrading?: boolean; + readonly llmModel?: string; + readonly llmApiUrl?: string; + readonly llmCourseLevelPrompt?: string; readonly enableOverallLeaderboard?: boolean; readonly enableContestLeaderboard?: boolean; readonly topLeaderboardDisplay?: number; @@ -109,6 +113,7 @@ export type CourseConfiguration = { enableAchievements: boolean; enableSourcecast: boolean; enableStories: boolean; + enableLlmGrading?: boolean; enableOverallLeaderboard: boolean; enableContestLeaderboard: boolean; topLeaderboardDisplay: number; @@ -117,6 +122,9 @@ export type CourseConfiguration = { sourceVariant: Variant; moduleHelpText: string; assetsPrefix: string; + llmModel?: string; + llmApiUrl?: string; + llmCourseLevelPrompt?: string; }; export type AdminPanelCourseRegistration = { @@ -128,4 +136,4 @@ export type AdminPanelCourseRegistration = { group?: string; }; -export type UpdateCourseConfiguration = Partial; +export type UpdateCourseConfiguration = Partial; diff --git a/src/commons/assessment/AssessmentTypes.ts b/src/commons/assessment/AssessmentTypes.ts index bbd7b13644..b0abc6f308 100644 --- a/src/commons/assessment/AssessmentTypes.ts +++ b/src/commons/assessment/AssessmentTypes.ts @@ -143,6 +143,11 @@ export interface IContestVotingQuestion extends BaseQuestion { type: 'voting'; } +export type LLMPrompt = { + role: string; + content: string; +}; + export type BaseQuestion = { answer: string | number | ContestEntry[] | null; comments?: string; diff --git a/src/commons/dropdown/DropdownCreateCourse.tsx b/src/commons/dropdown/DropdownCreateCourse.tsx index 2d37ce7eb9..4045f3bbfe 100644 --- a/src/commons/dropdown/DropdownCreateCourse.tsx +++ b/src/commons/dropdown/DropdownCreateCourse.tsx @@ -40,9 +40,11 @@ const DropdownCreateCourse: React.FC = props => { enableAchievements: true, enableSourcecast: true, enableStories: false, + enableLlmGrading: false, sourceChapter: Chapter.SOURCE_1, sourceVariant: Variant.DEFAULT, - moduleHelpText: '' + moduleHelpText: '', + llmApiKey: '' }); const [courseHelpTextSelectedTab, setCourseHelpTextSelectedTab] = @@ -222,7 +224,8 @@ const DropdownCreateCourse: React.FC = props => { }) } /> - + +
= props => { }) } /> + + + setCourseConfig({ + ...courseConfig, + enableLlmGrading: (e.target as HTMLInputElement).checked + }) + } + />
@@ -273,6 +288,24 @@ const DropdownCreateCourse: React.FC = props => { fill /> + + + setCourseConfig({ + ...courseConfig, + llmApiKey: e.target.value + }) + } + /> +