Draft: Add conversation persistence and history drawer#1587
Draft
onmete wants to merge 1 commit intoopenshift:mainfrom
Draft
Draft: Add conversation persistence and history drawer#1587onmete wants to merge 1 commit intoopenshift:mainfrom
onmete wants to merge 1 commit intoopenshift:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Persist the active conversation across page refreshes using localStorage and the OLS service conversation endpoints. Add a conversation history drawer (ChatbotConversationHistoryNav) that lets users browse, search, switch between, and delete past conversations. Key changes: - New src/conversations.ts: API calls (list/fetch/delete), response types, transformChatHistory mapping, and localStorage helpers - New useConversationRestore hook: restores last conversation on mount - Redux: add conversations list, isConversationsLoading state, and actions - GeneralPage: integrate conversation history drawer inside Chatbot (drawer must be inside Chatbot to preserve position:fixed overlay) - Prompt: save conversation_id to localStorage on stream start event - Popover: gate first-time-user auto-open on conversation restore - Types: add ConversationSummary type - i18n: add conversation UI strings Made-with: Cursor
04288ac to
ca145b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Draft PR for reference — demonstrates how conversation persistence and a history drawer can be implemented in the OLS console plugin.
conversation_idinlocalStorage; on page refresh, restores the last conversation by fetching its history from the OLS service (GET /v1/conversations/{id})ChatbotConversationHistoryNavinside theChatbotcomponent, providing a searchable side panel to browse, switch between, and delete past conversations (GET /v1/conversations,DELETE /v1/conversations/{id})Chatbotcomponent (not wrapping it) to preserve theposition: fixedfloating overlay behaviorFiles changed
src/conversations.tstransformChatHistory,localStoragehelperssrc/hooks/useConversationRestore.tslocalStorage+ OLS service on mountsrc/components/GeneralPage.tsxChatbotConversationHistoryNavdrawer with conversation list, search, select, delete, new chatsrc/components/Popover.tsxsrc/components/Prompt.tsxconversation_idtolocalStorageon streamstarteventsrc/redux-actions.tssetConversations,removeConversation,setIsConversationsLoadingsrc/redux-reducers.tsconversations,isConversationsLoading+ reducer casessrc/types.tsConversationSummarylocales/en/plugin__lightspeed-console-plugin.jsonArchitecture notes
ChatbotConversationHistoryNavmust be a child ofChatbot, not a wrapper. WrappingChatbotin the drawer breaks theposition: fixedoverlay and causes the chat to render in normal document flow above the OKD console.last_message_timestampfrom the OLS service.useConversationRestorehook runs once on mount and signals completion via a boolean return, allowing dependent effects (like first-time-user auto-open) to wait.Test plan
Made with Cursor