fix(chatbot): patch windows startup crashes, sqlite thread segfaults, and clipboard temp images#570
Open
Conversation
…nd clipboard image leaks
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.
This PR addresses and resolves critical stability issues, performance bottlenecks, and resource leaks within the eSim AI Copilot / Chatbot module on Windows. The changes ensure a stable startup experience, prevent backend crashes during queries, make the interface highly responsive, and clean up temporary storage leaks on the filesystem.
Key Fixes
1. Windows Startup Crashes (Missing Configuration Files)
config.inifiles underlibrary/config/did not exist. The application encountered a traceback (No section: 'eSim') during initialization and closed instantly.Appconfig.pyfiles. If directories or configurations are missing, they are dynamically generated with default parameters pointing to correct absolute paths relative to the project root.2. PyQt5 / ChromaDB Threading Conflict (Memory Access Violations)
sys.executable. User queries and matching contexts are piped securely via standard streams using Base64 encoding to prevent encoding issues.3. Chat Input Submission Lag
OllamaWorker). The main thread remains fluid and renders the "thinking..." animation instantly.4. Clipboard Image Disk Space Leaks
.esim/clipboard_images/but never deleted, leading to storage leaks._cleanup_unused_clipboard_images) that matches folder contents against staged assets and active conversation contexts. This routine runs during:Files Changed
src/configuration/Appconfig.py: Added self-healing configuration creation block.nghdl/src/Appconfig.py: Added self-healing configuration block for NGHDL workspace config.src/frontEnd/Application.py: Corrected Windows platform checks and propagated app close events to the chatbot widget.src/chatbot/knowledge_base.py: Refactored database client connections to load lazily on a thread-local level.src/chatbot/chatbot_thread.py: Refactored RAG search to execute in a thread-safe background subprocess.src/frontEnd/Chatbot.py: Integrated image garbage collection hooks and reverted blocking main thread events..gitignore: Added exceptions to ignore local runtimeconfig.inifiles,.nghdl/directory, localworkspace.txt, and subfolder__pycache__directories.Verification and Testing
py_compile..esimand.nghdldirectories and verified the files automatically regenerated on launch..esim/clipboard_images/directory.