feat: Add conversation history management and fix WebSocket/Docker networking issues #36
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
This PR adds conversation history management functionality to the frontend and fixes critical WebSocket and Docker networking issues in the backend.
Features Added
1. Conversation History Management
2. Technical Improvements
Bug Fixes
1. WebSocket Connection Errors
Problem: WebSocket errors when clients disconnect - "Cannot call 'send' once a close message has been sent" and "WebSocket is not connected" errors.
Solution:
WebSocketDisconnectexception handling incortex_on/main.pyFiles Changed:
cortex_on/main.py- Enhanced WebSocket endpoint with proper error handling2. Docker Networking Connection Error
Problem:
cortex_onservice couldn't connect toagentic_browserservice - "Cannot connect to host localhost:8000" errors.Solution:
localhost:8000to use Docker service nameagentic_browser:8000AGENTIC_BROWSER_URLenvironment variableFiles Changed:
cortex_on/agents/web_surfer.py- Dynamic API URL configurationcortex_on/agents/orchestrator_agent.py- Updated WebSurfer initialization3. Minor Fixes
a500→500inorchestrator_agent.pyFiles Changed
New Files
frontend/src/dataStore/persistenceMiddleware.ts- Redux middleware for localStoragefrontend/src/utils/conversationUtils.ts- Conversation management utilitiesfrontend/src/components/home/ConversationList.tsx- Conversation sidebar componentfrontend/src/contexts/ConversationContext.tsx- React context for state managementModified Files
frontend/src/dataStore/store.ts- Added persistence middlewarefrontend/src/dataStore/messagesSlice.ts- Added clearMessages action, localStorage loadingfrontend/src/components/home/Header.tsx- Added History buttonfrontend/src/components/home/Chat.tsx- Integrated ConversationListfrontend/src/App.tsx- Added ConversationProvidercortex_on/main.py- Fixed WebSocket error handlingcortex_on/agents/web_surfer.py- Fixed Docker networkingcortex_on/agents/orchestrator_agent.py- Updated WebSurfer init, fixed typo