fix: migrate frontEnd PyQt6 enum scoping and add standalone chatbot launcher#578
Open
apurvafx wants to merge 5 commits into
Conversation
…her for chatbot testing
…tion, sounddevice crash) and add test suite
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.
Related Issues
Relates to the chatbot module PyQt6 migration task under the FOSSEE eSim eSim AI Chatbot internship.
Purpose
src/chatbot/+src/frontEnd/Chatbot.py) had already been migrated to PyQt6 but the rest of the frontEnd (Application.py,DockArea.py,Workspace.py) was still on PyQt5, causingAttributeErrorcrashes at runtime. The entire frontEnd has now been migrated to PyQt6 for compatibility.ollama serveandollama pullto download required models before launching the chatbot. This setup has been automated to make the assistant completely ready on startup without requiring any terminal interaction.src/chatbot/tests/module to assert the correct, secure, and robust behavior of all chatbot pipeline handlers.Approach
1. Front-End PyQt6 Migration
Migrated all PyQt5-style unscoped enums to PyQt6 scoped equivalents across
Application.py,DockArea.py,Workspace.py, andChatbot.pycovering:AlignmentFlag,Orientation,WindowType,ScrollBarPolicyTextElideMode,TextFlag,TextFormatCursorShape,ItemDataRole,CheckStateQFrame.Shape/Shadow,QTextCursor.MoveOperation/MoveModeQSizePolicy.Policy,QDialog.DialogCode,QMessageBox.StandardButton/Icon2. Standalone Chatbot Launcher (Deprecated)
src/run_chatbot.pyas a standalone launcher to verify theChatbotGUIin isolation during the PyQt6 migration. Now that integration is complete and verified, this temporary test script has been removed.3. Headless Ollama Auto-Start & Model Pulling
start_ollamainsrc/chatbot/chatbot_thread.pyto start the server headlessly (with theCREATE_NO_WINDOWflag on Windows) without spawning any terminal popups. Added fallback checks to search standard Windows installation directories ifollamais not in the system'sPATH.ModelPullWorkerbackground thread that checks for missing required models (qwen2.5-coder:3bandnomic-embed-text) on startup and downloads them sequentially, displaying live percentage progress directly in the chatbot status bar.Chatbot.py's constructor and resolvedQThreadsignal naming conflicts (finishedtoresult_ready) to ensure background booting threads exit and transition status safely.4. Critical Security & Robustness Fixes
ingest_pdfsto perform atomic-like updates. All chunks/embeddings are computed in-memory first; database collection deletion and recreation only execute on 100% success to prevent data-loss.maxsize=1000) and updated the audio callback to discard overflow frames silently, preventing memory exhaustion.MAX_IMAGE_PIXELS = 10_000_000limit and dimension check to guard against decompression bombs.analyze_and_extractso they are surfaced cleanly as design errors in the GUI instead of causing backend OOM failures.5. Automated Verification Suite
Added a dedicated testing module under
src/chatbot/tests/containing:test_knowledge_base.py: Verifies non-destructive builds, memory-safe streaming, and relevance thresholds.test_stt_handler.py: Verifies queue limits, graceful microphone exception handling, and safe JSON parsing.tests_image_handler.py: Verifies decompression bomb detection and dimension validation constraints.