-
Notifications
You must be signed in to change notification settings - Fork 303
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
Iris
: Add chat in lectures
#9740
Conversation
…is into feature/iris/lecture-chat
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/main/java/de/tum/cit/aet/artemis/iris/web/open/PublicPyrisStatusUpdateResource.java (2)
170-170
: Consider renaming method for consistency.The method name
respondInLectureChat
is inconsistent with other method names in the class which usesetStatusOf
orsetStatus
prefix.Apply this diff to maintain consistency:
- public ResponseEntity<Void> respondInLectureChat(@PathVariable String runId, @RequestBody PyrisLectureChatStatusUpdateDTO statusUpdateDTO, HttpServletRequest request) { + public ResponseEntity<Void> setStatusOfLectureChatJob(@PathVariable String runId, @RequestBody PyrisLectureChatStatusUpdateDTO statusUpdateDTO, HttpServletRequest request) {
158-167
: Add @SInCE tag to Javadoc.Consider adding a @SInCE tag to track when this API was introduced.
Apply this diff to enhance the documentation:
/** * {@code POST /api/public/pyris/pipelines/lecture-chat/runs/{runId}/status} : Set the status of a Lecture Chat job. * * @param runId the ID of the job * @param statusUpdateDTO the status update * @param request the HTTP request * @return a {@link ResponseEntity} with status {@code 200 (OK)} * @throws ConflictException if the run ID in the URL does not match the run ID in the request body * @throws AccessForbiddenException if the token is invalid + * @since 0.1 */
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/PyrisStatusUpdateService.java
(4 hunks)src/main/java/de/tum/cit/aet/artemis/iris/web/open/PublicPyrisStatusUpdateResource.java
(3 hunks)src/test/java/de/tum/cit/aet/artemis/core/connector/IrisRequestMockProvider.java
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- src/test/java/de/tum/cit/aet/artemis/core/connector/IrisRequestMockProvider.java
- src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/PyrisStatusUpdateService.java
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/de/tum/cit/aet/artemis/iris/web/open/PublicPyrisStatusUpdateResource.java (1)
Pattern src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: Call Build Workflow / Build and Push Docker Image
- GitHub Check: Call Build Workflow / Build .war artifact
- GitHub Check: client-tests-selected
- GitHub Check: client-tests
- GitHub Check: Analyse
- GitHub Check: server-tests
🔇 Additional comments (2)
src/main/java/de/tum/cit/aet/artemis/iris/web/open/PublicPyrisStatusUpdateResource.java (2)
23-23
: LGTM!The new imports are correctly organized and necessary for the lecture chat functionality.
Also applies to: 34-34
171-178
: LGTM!The implementation follows best practices with proper error handling, authentication, and consistent patterns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/main/webapp/app/iris/settings/iris-settings-update/iris-settings-update.component.html (1)
37-37
: Extra Whitespace Added
A blank line marker was added at line 37. If this is intentional for improved visual separation between sections, it is acceptable; otherwise, consider removing it to keep the template concise.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
src/main/resources/config/liquibase/master.xml
is excluded by!**/*.xml
📒 Files selected for processing (20)
src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisCourseSettings.java
(2 hunks)src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisExerciseSettings.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisGlobalSettings.java
(2 hunks)src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisSettings.java
(2 hunks)src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisSubSettings.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisSubSettingsType.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/iris/dto/IrisCombinedSettingsDTO.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/iris/repository/IrisSettingsRepository.java
(2 hunks)src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/PyrisStatusUpdateService.java
(4 hunks)src/main/java/de/tum/cit/aet/artemis/iris/service/settings/IrisSettingsService.java
(10 hunks)src/main/java/de/tum/cit/aet/artemis/iris/service/settings/IrisSubSettingsService.java
(4 hunks)src/main/java/de/tum/cit/aet/artemis/iris/web/open/PublicPyrisStatusUpdateResource.java
(3 hunks)src/main/webapp/app/entities/iris/settings/iris-settings.model.ts
(4 hunks)src/main/webapp/app/entities/iris/settings/iris-sub-settings.model.ts
(2 hunks)src/main/webapp/app/iris/settings/iris-settings-update/iris-settings-update.component.html
(2 hunks)src/main/webapp/app/iris/settings/iris-settings-update/iris-settings-update.component.ts
(2 hunks)src/main/webapp/i18n/de/iris.json
(1 hunks)src/main/webapp/i18n/en/iris.json
(2 hunks)src/test/java/de/tum/cit/aet/artemis/core/connector/IrisRequestMockProvider.java
(2 hunks)src/test/java/de/tum/cit/aet/artemis/iris/AbstractIrisIntegrationTest.java
(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (17)
- src/main/webapp/app/entities/iris/settings/iris-sub-settings.model.ts
- src/main/java/de/tum/cit/aet/artemis/iris/dto/IrisCombinedSettingsDTO.java
- src/test/java/de/tum/cit/aet/artemis/iris/AbstractIrisIntegrationTest.java
- src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisSubSettings.java
- src/main/webapp/i18n/en/iris.json
- src/main/webapp/i18n/de/iris.json
- src/test/java/de/tum/cit/aet/artemis/core/connector/IrisRequestMockProvider.java
- src/main/java/de/tum/cit/aet/artemis/iris/repository/IrisSettingsRepository.java
- src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisSettings.java
- src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisExerciseSettings.java
- src/main/webapp/app/iris/settings/iris-settings-update/iris-settings-update.component.ts
- src/main/webapp/app/entities/iris/settings/iris-settings.model.ts
- src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisSubSettingsType.java
- src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisCourseSettings.java
- src/main/java/de/tum/cit/aet/artemis/iris/web/open/PublicPyrisStatusUpdateResource.java
- src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/PyrisStatusUpdateService.java
- src/main/java/de/tum/cit/aet/artemis/iris/domain/settings/IrisGlobalSettings.java
🧰 Additional context used
📓 Path-based instructions (3)
src/main/java/de/tum/cit/aet/artemis/iris/service/settings/IrisSubSettingsService.java (1)
Pattern src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports
src/main/webapp/app/iris/settings/iris-settings-update/iris-settings-update.component.html (1)
Pattern src/main/webapp/**/*.html
: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.
src/main/java/de/tum/cit/aet/artemis/iris/service/settings/IrisSettingsService.java (1)
Pattern src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Call Build Workflow / Build and Push Docker Image
- GitHub Check: Call Build Workflow / Build .war artifact
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: client-tests-selected
- GitHub Check: client-tests
- GitHub Check: server-tests
- GitHub Check: Analyse
🔇 Additional comments (8)
src/main/java/de/tum/cit/aet/artemis/iris/service/settings/IrisSettingsService.java (6)
40-40
: LGTM!The import for
IrisLectureChatSubSettings
is correctly placed and follows Java conventions.
117-117
: LGTM!The lecture chat settings initialization follows the established pattern and correctly uses the helper method for consistent initialization.
Also applies to: 157-161
273-278
: LGTM!The lecture chat settings update logic is correctly implemented in both global and course settings, following the established pattern and maintaining consistency.
Also applies to: 347-352
641-641
: LGTM!The lecture chat settings are correctly integrated into all combination methods, maintaining consistency and proper handling of the minimal flag.
Also applies to: 669-669, 698-698
809-809
: LGTM!The lecture chat feature enablement check is correctly implemented, following the established pattern.
63-63
: Well-structured implementation of lecture chat settings.The implementation follows best practices and maintains consistency with the existing codebase:
- Follows single responsibility principle
- Uses constructor injection
- Maintains consistent patterns across all settings types
- Properly handles settings hierarchy and inheritance
src/main/webapp/app/iris/settings/iris-settings-update/iris-settings-update.component.html (1)
55-67
: New Lecture Chat Settings Section Integration
This newly added block correctly introduces the lecture chat settings under the condition thatsettingsType !== EXERCISE
. The block uses thejhi-iris-common-sub-settings-update
component with the proper bindings for lecture chat-specific settings. Please ensure that:
- The translation key
artemisApp.iris.settings.subSettings.lectureChatSettings
is defined in all relevant localization files (e.g., English and German).- The additional
<hr>
elements provide the intended visual separation without adversely affecting the layout in different display contexts.Overall, the integration aligns with the PR objectives for enabling lecture chat functionality.
src/main/java/de/tum/cit/aet/artemis/iris/service/settings/IrisSubSettingsService.java (1)
213-230
: 🛠️ Refactor suggestionAlign implementation with other chat settings methods.
The lecture chat update method is missing standard chat functionality present in other chat settings:
- Rate limit handling
- Variant handling (allowed and selected variants)
- Category handling for course settings
The authorization check is also more restrictive than necessary.
Apply this diff to align with other chat methods:
public IrisLectureChatSubSettings update(IrisLectureChatSubSettings currentSettings, IrisLectureChatSubSettings newSettings, IrisCombinedLectureChatSubSettingsDTO parentSettings, IrisSettingsType settingsType) { if (newSettings == null) { if (parentSettings == null) { throw new IllegalArgumentException("Cannot delete the Lecture Chat settings"); } return null; } if (currentSettings == null) { currentSettings = new IrisLectureChatSubSettings(); } - if (authCheckService.isAdmin() && (settingsType == IrisSettingsType.COURSE || settingsType == IrisSettingsType.GLOBAL)) { + if (settingsType == IrisSettingsType.EXERCISE || authCheckService.isAdmin()) { currentSettings.setEnabled(newSettings.isEnabled()); } + if (settingsType == IrisSettingsType.COURSE) { + var enabledForCategories = newSettings.getEnabledForCategories(); + currentSettings.setEnabledForCategories(enabledForCategories); + } + + if (authCheckService.isAdmin()) { + currentSettings.setRateLimit(newSettings.getRateLimit()); + currentSettings.setRateLimitTimeframeHours(newSettings.getRateLimitTimeframeHours()); + } + + currentSettings.setAllowedVariants(selectAllowedVariants(currentSettings.getAllowedVariants(), newSettings.getAllowedVariants())); + currentSettings.setSelectedVariant(validateSelectedVariant(currentSettings.getSelectedVariant(), newSettings.getSelectedVariant(), + currentSettings.getAllowedVariants(), parentSettings != null ? parentSettings.allowedVariants() : null)); return currentSettings; }Likely invalid or redundant comment.
src/main/java/de/tum/cit/aet/artemis/iris/service/settings/IrisSubSettingsService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reapprove!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/test/javascript/spec/component/iris/settings/iris-global-settings-update.component.spec.ts (1)
47-53
: Consider adding specific test coverage for lecture chat settings.While the test verifies the presence of all sub-settings components, consider adding a specific test case to verify that the lecture chat settings are properly initialized and rendered with the correct properties.
Example test case:
it('Initializes lecture chat settings correctly', () => { fixture.detectChanges(); const subSettings = fixture.debugElement.queryAll(By.directive(IrisCommonSubSettingsUpdateComponent)); const lectureChatSettings = subSettings.find( element => element.componentInstance.settings === comp.settingsUpdateComponent?.irisSettings.irisLectureChatSettings ); expect(lectureChatSettings).toBeTruthy(); expect(lectureChatSettings?.componentInstance.settings).toBeDefined(); });
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/test/javascript/spec/component/iris/settings/iris-course-settings-update.component.spec.ts
(1 hunks)src/test/javascript/spec/component/iris/settings/iris-global-settings-update.component.spec.ts
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/test/javascript/spec/component/iris/settings/iris-global-settings-update.component.spec.ts (1)
Pattern src/test/javascript/spec/**/*.ts
: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}
src/test/javascript/spec/component/iris/settings/iris-course-settings-update.component.spec.ts (1)
Pattern src/test/javascript/spec/**/*.ts
: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Call Build Workflow / Build .war artifact
- GitHub Check: Call Build Workflow / Build and Push Docker Image
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: client-tests-selected
- GitHub Check: client-tests
- GitHub Check: server-tests
- GitHub Check: Analyse
🔇 Additional comments (2)
src/test/javascript/spec/component/iris/settings/iris-global-settings-update.component.spec.ts (1)
52-52
: LGTM! The updated expectation aligns with lecture chat addition.The change from 6 to 7 instances of IrisCommonSubSettingsUpdateComponent correctly reflects the addition of lecture chat settings, which aligns with the PR's objective of adding Iris chat functionality to lectures.
src/test/javascript/spec/component/iris/settings/iris-course-settings-update.component.spec.ts (1)
65-65
: Verify the increased component count.The increase from 6 to 7 IrisCommonSubSettingsUpdateComponent instances aligns with the addition of lecture chat settings. However, we should verify that all settings are properly tested.
Consider adding an explicit test to verify that
irisLectureChatSettings
is properly initialized in thefillEmptyIrisSubSettings
test case, similar to how other settings are verified.it('Fills the settings if they are empty', () => { fixture.detectChanges(); comp.settingsUpdateComponent!.irisSettings = mockEmptySettings(); comp.settingsUpdateComponent!.fillEmptyIrisSubSettings(); expect(comp.settingsUpdateComponent!.irisSettings.irisChatSettings).toBeTruthy(); expect(comp.settingsUpdateComponent!.irisSettings.irisTextExerciseChatSettings).toBeTruthy(); expect(comp.settingsUpdateComponent!.irisSettings.irisCourseChatSettings).toBeTruthy(); expect(comp.settingsUpdateComponent!.irisSettings.irisLectureIngestionSettings).toBeTruthy(); expect(comp.settingsUpdateComponent!.irisSettings.irisCompetencyGenerationSettings).toBeTruthy(); expect(comp.settingsUpdateComponent!.irisSettings.irisFaqIngestionSettings).toBeTruthy(); + expect(comp.settingsUpdateComponent!.irisSettings.irisLectureChatSettings).toBeTruthy(); });
✅ Verification successful
Verify the increased component count and add test coverage for lecture chat settings.
The adjustment from 6 to 7 component instances aligns with the lecture chat feature addition. This change in the expectation is correct; however, it is advisable to introduce an explicit test verifying that
irisLectureChatSettings
is properly initialized—similar to the verification applied to the other settings.
- Confirm that the additional IrisCommonSubSettingsUpdateComponent instance reflects the lecture chat configuration.
- Add an explicit test case checking that
irisLectureChatSettings
is truthy after invokingfillEmptyIrisSubSettings
.🏁 Scripts executed
The following scripts were executed for the analysis:
Error: No shell scripts found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Token Tracking will be added in a follow up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reapprove after client test fix!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good!
Checklist
General
Server
Client
Motivation and Context
For now Iris was only available in exercises and the course but now it is also available for lectures.
Description
Iris has been added to lectures.
Steps for Testing
Prerequisites:
Testserver States
Note
These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.
Review Progress
Code Review
Manual Tests
Test Coverage
Client
Server
Coverage artifact not found, tests probably failed.
Summary by CodeRabbit
New Features
UI Enhancements
Tests
Documentation