-
Notifications
You must be signed in to change notification settings - Fork 358
Iris: Introduce context selection for new dashboard chats
#12023
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
base: develop
Are you sure you want to change the base?
Iris: Introduce context selection for new dashboard chats
#12023
Conversation
…ise or a Lecture. Adjust CourseChatbotComponent & IrisBaseChatbotComponent to use the new UI
…nitial context selection from CourseChatbotComponent to ContextSelectionComponent
…of navigating to an existing one if there is one with the same context
…te new chats instead of reusing the latest
…w programming and text exercises, Improve UI (uniform box sizes, show when no due date)
…shboard-chat # Conflicts: # package-lock.json
|
@Senan04 Test coverage has been automatically updated in the PR description. |
WalkthroughAdds a ContextSelection UI component (course/lecture/exercise), integrates it into the Iris base chatbot via new inputs, updates IrisChatService to optionally force new sessions on context switches, and adds translations plus unit tests. Changes
Sequence DiagramsequenceDiagram
participant User
participant ContextSelection as Context Selection
participant CourseStorage as Course Storage
participant CourseManagement as Course Management
participant ChatService as Iris Chat Service
User->>ContextSelection: open / choose context
ContextSelection->>CourseStorage: request lectures/exercises for courseId
alt Cache hit
CourseStorage-->>ContextSelection: return cached data
else Cache miss
ContextSelection->>CourseManagement: fetch course data
CourseManagement-->>ContextSelection: return lectures/exercises
end
ContextSelection->>ContextSelection: filter/search & present list
User->>ContextSelection: select course/lecture/exercise
ContextSelection->>ChatService: switchTo(mode, id?, forceNew=true)
ChatService->>ChatService: close()
ChatService->>ChatService: start(forceNew=true)
ChatService-->>ContextSelection: session ready
ContextSelection-->>User: chat mode switched
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
🤖 Fix all issues with AI agents
In
`@src/main/webapp/app/iris/overview/base-chatbot/iris-base-chatbot.component.html`:
- Line 2: Remove the invalid <script> tag from the Angular template (the line
loading "../../shared/context-selection/context-selection.component.ts") because
Angular templates must not include script imports; instead rely on the existing
ContextSelectionComponent import in the component TypeScript and its inclusion
in the component's imports array. Locate iris-base-chatbot.component.html and
delete that <script> line; verify that ContextSelectionComponent is still
referenced only via the component class import and the imports array in the
corresponding TypeScript file (where ContextSelectionComponent is imported and
registered).
In `@src/main/webapp/app/iris/overview/services/iris-chat.service.ts`:
- Around line 533-542: Update the JSDoc for the switchTo method to clarify
forceNew behavior: explain that forceNew only applies when the context actually
changes (isDifferent=true) and therefore will create a new session when
switching to a different context; note that when selecting the same context (no
change to sessionCreationIdentifier) forceNew has no effect because start() is
not invoked. Reference the switchTo method and the
sessionCreationIdentifier/start/close calls so reviewers can locate where the
behavior is enforced.
🧹 Nitpick comments (3)
src/main/webapp/app/iris/overview/context-selection/context-selection.component.scss (1)
12-85: Add focus-visible styling for keyboard navigation.Hover/active states are defined, but explicit focus-visible styling improves keyboard accessibility while keeping the theme consistent.
♿ Suggested focus-visible styles
.context-selection-box { display: flex; @@ &:hover:not(:disabled) { background-color: var(--iris-tool-background); border-color: var(--primary); } + &:focus-visible { + outline: 2px solid var(--primary); + outline-offset: 2px; + } + &:active:not(:disabled) { transform: scale(0.98); } @@ .back-button { display: flex; @@ &:hover { background-color: var(--iris-suggestion-background); border-color: var(--primary); } + + &:focus-visible { + outline: 2px solid var(--primary); + outline-offset: 2px; + } }Also applies to: 115-136
src/main/webapp/app/iris/overview/context-selection/context-selection.component.ts (2)
114-140: Consider fetching when cache is partially hydrated.If the cached course can contain only lectures or only exercises, the current length check can skip the server call and leave the missing list empty. Guarding on undefined lists avoids that edge case.
♻️ Suggested tweak to cache guard
- const cachedCourse = this.courseStorageService.getCourse(courseId); - if (cachedCourse?.lectures?.length || cachedCourse?.exercises?.length) { - return of({ lectures: cachedCourse.lectures ?? [], exercises: cachedCourse.exercises ?? [] }); - } + const cachedCourse = this.courseStorageService.getCourse(courseId); + const hasCachedLectures = cachedCourse?.lectures !== undefined; + const hasCachedExercises = cachedCourse?.exercises !== undefined; + if (hasCachedLectures && hasCachedExercises) { + return of({ lectures: cachedCourse.lectures ?? [], exercises: cachedCourse.exercises ?? [] }); + }
167-174: Guard against missing/unsupported exercise types.
Exercise.typeis optional; defaulting to programming when it’s absent can open the wrong scope. A small guard keeps the selection state consistent.Based on learnings, defensive guards help avoid inconsistent states without user-facing noise.🛡️ Defensive guard
selectExercise(exercise: Exercise): void { + if (!exercise.type || !SUPPORTED_EXERCISE_TYPES.includes(exercise.type)) { + return; + } this.selection.set({ type: 'exercise', exercise }); this.currentView.set('main'); if (exercise.id !== undefined) { const mode = exercise.type === ExerciseType.TEXT ? ChatServiceMode.TEXT_EXERCISE : ChatServiceMode.PROGRAMMING_EXERCISE; this.chatService.switchTo(mode, exercise.id, true); } }
src/main/webapp/app/iris/overview/base-chatbot/iris-base-chatbot.component.html
Outdated
Show resolved
Hide resolved
|
@Senan04 Test coverage has been automatically updated in the PR description. |
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||
…of IrisBaseChatbotComponent
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: 1
🤖 Fix all issues with AI agents
In `@src/main/webapp/app/iris/overview/services/iris-chat.service.ts`:
- Around line 538-541: The code calls this.start(forceNew) unconditionally when
isDifferent is true, but must guard against missing sessionCreationIdentifier
(or newIdentifier) as closeAndStart() did; update the block around isDifferent
to check that this.sessionCreationIdentifier (or the computed newIdentifier) is
defined before invoking this.start(forceNew), and bail out (or return) if it's
undefined to avoid the "Session creation identifier not set" error; reference
the existing methods closeAndStart(), close(), start(),
sessionCreationIdentifier and variable newIdentifier when making the change.
|
@Senan04 Test coverage has been automatically updated in the PR description. |
|
@Senan04 Test coverage has been automatically updated in the PR description. |
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||||||||||||||
…ection-dashboard-chat' into feature/iris/initial-context-selection-dashboard-chat
|
@Senan04 Test coverage has been automatically updated in the PR description. |
End-to-End (E2E) Test Results Summary
|
|||||||||||||||||||||||||||||||||
maxgutke
left a comment
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.
I tested this PR on TS1. I followed the instructions and everything worked as expected
Checklist
General
Client
Motivation and Context
Opening a new chat on an exercise or lecture page initializes the conversation with the corresponding exercise/lecture as the chat context. Previously, opening a new chat on the dashboard initialized it with the entire course as context, without the option to select a specific exercise or lecture.
This pull request introduces a new context selection feature. When a user starts a new chat from the course dashboard, they now have the flexibility to choose a specific context through a new context selection interface.
Closes IRIS-94
Description
Key Features:
ContextSelectionComponentis displayed for new chat sessions, allowing users to select one of the following contexts:Implementation Details:
ContextSelectionComponentis shown within theIrisBaseChatbotComponentwhen there are no messages in the current session and the feature is enabled.CourseChatbotComponentnow activates this feature by default.IrisChatService.switchTo&IrisChatService.startmethods were updated with the option to force the creation of a new session.ContextSelectionComponenthave been added.Steps for Testing
Prerequisites:
Testserver States
You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.
Review Progress
Performance Review
Code Review
Manual Tests
Performance Tests
Test Coverage
Last updated: 2026-01-27 09:23:31 UTC
Screenshots
Summary by CodeRabbit
New Features
Tests
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.