-
Notifications
You must be signed in to change notification settings - Fork 85
feat(lightspeed): add conversation sorting with persistence, persisting pinned chats and pinned chats toggle per-user #2003
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: main
Are you sure you want to change the base?
Conversation
…toggle pinned chat Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Changed Packages
|
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
HusneShabbir
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.
chore(e2e): enhance existing lightspeed e2e tests
|
New changes are detected. LGTM label has been removed. |
fix(e2e): unskip file attachemnet tests
workspaces/lightspeed/plugins/lightspeed/src/hooks/usePinnedChatsSettings.ts
Show resolved
Hide resolved
Signed-off-by: its-mitesh-kumar <[email protected]>
|
debsmita1
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.
Tested the changes locally
Screen.Recording.2026-01-09.at.12.42.57.PM.mov
| const sortData = sortSnapshot.value ?? {}; | ||
|
|
||
| setIsPinningChatsEnabled( | ||
| (enabledData[user] as boolean | undefined) ?? true, |
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.
for Guest users, avoid persisting the preferences
| }, []); | ||
|
|
||
| const onSortSelect = useCallback( | ||
| (_event?: React.MouseEvent<Element>, value?: string | number) => { |
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.
| (_event?: React.MouseEvent<Element>, value?: string | number) => { | |
| (_event?: MouseEvent<Element>, value?: string | number) => { |
| ); | ||
|
|
||
| const sortToggle = useCallback( | ||
| (toggleRef: React.Ref<MenuToggleElement>) => ( |
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.
| (toggleRef: React.Ref<MenuToggleElement>) => ( | |
| (toggleRef: Ref<MenuToggleElement>) => ( |
| * Hook to manage pinned chats settings with persistence using Backstage StorageApi. | ||
| * Settings are scoped per-user to support multi-user environments. | ||
| * | ||
| * @param user - The user entity ref (e.g., "user:default/guest") |
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.
for Guest users, avoid persisting the preferences
| handlePinningChatsToggle, | ||
| pinChat, | ||
| unpinChat, | ||
| handleSortChange, |
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.
Is there a reason to combine sorting and pinning logic into one hook? It would be better if sorting and pinning logic are separated into there own hooks. Easier to read and maintain. Plus sorting action won't affect pinning data to cause rerenders and vice versa.
| "@backstage/theme": "^0.7.0", | ||
| "@material-ui/core": "^4.9.13", | ||
| "@material-ui/lab": "^4.0.0-alpha.61", | ||
| "@monaco-editor/react": "^4.7.0", |
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.
Why is this PR adding monaco editor as a dependency here?
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.
@monaco-editor/react and @monaco-editor are required peer dependencies of @patternfly/[email protected]. We upgraded to this prerelease version to use the new searchActionEnd prop on ChatbotConversationHistoryNav for the sort dropdown feature.
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.
The chatbot pre-release verison adds monaco-editor as a peer-dependency, without this in our dependency shows module not found errs
|
@its-mitesh-kumar My chat preferences persist, but when switching to the database My preferences are not saved |
| const chatsData = { ...chatsSnapshot.value }; | ||
| chatsData[user] = updated; | ||
| bucket.set(PINNED_CHATS_KEY, chatsData); |
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.
Remove the user information in the user settings bucket value.
Usersettings backend will work based on the user token attached in the request header, you do not need to save or send the user information explicitly. The backend automatically attaches the logged in userEntityRef and uses that for all the GET, PUT, DELETE methods.
| chatsData[user] = updated; | ||
| bucket.set(PINNED_CHATS_KEY, chatsData); |
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.
same here, refer my above 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.
Yi is currently adding it and ja locales in rhdh-plugins repo in this PR #2009. Since these are new strings can you also use cursor to add strings for those locales?
So that we will at-least have the AI generated strings rather than completely missing out.




Description
Adds conversation sorting and per-user settings persistence using Backstage's StorageApi. Users can now sort conversations by date (newest/oldest) or name (A-Z/Z-A) via a dropdown next to the search input. Pinned chats, the pinned chats toggle state, and sort order now persist across sessions, scoped per-user. Upgraded
@patternfly/chatbot to 6.5.0-prerelease.28for searchActionEnd prop support.Fixes
UI after Changes
Screen.Recording.2026-01-05.at.10.04.13.PM.mov
✔️ Checklist