Skip to content

Comments

Refactor Vision Assistant addon by modularizing the giant plugin into focused feature modules#2

Draft
Copilot wants to merge 11 commits intomainfrom
copilot/modularize-addon-structure-again
Draft

Refactor Vision Assistant addon by modularizing the giant plugin into focused feature modules#2
Copilot wants to merge 11 commits intomainfrom
copilot/modularize-addon-structure-again

Conversation

Copy link

Copilot AI commented Feb 17, 2026

This PR implements the requested addon modularization work (instead of documentation-only planning), while preserving existing behavior.

What Changed

  • Reverted prior PT-BR roadmap documentation addition

    • Removed the previously added modularization plan section from addon/doc/pt_BR/readme.md.
  • Modularized the oversized plugin file into dedicated modules

    • Kept addon/globalPlugins/visionAssistant/__init__.py as the runtime entrypoint/orchestrator.
    • Extracted large responsibilities into focused modules:
      • addon/globalPlugins/visionAssistant/constants.py
        • addon metadata constants
        • model/language/voice option lists
        • config spec setup
        • prompt templates and prompt-related constants
      • addon/globalPlugins/visionAssistant/prompt_helpers.py
        • prompt parsing/normalization
        • prompt config migration/serialization
        • prompt map/build helpers and template application
      • addon/globalPlugins/visionAssistant/markdown_utils.py
        • markdown cleanup and markdown-to-HTML conversion helpers
      • addon/globalPlugins/visionAssistant/services.py
        • utility helpers (mime/proxy/dialog/file helpers)
        • OCR engines
        • translation helper
        • Gemini API service layer and related upload/chat/tts logic
      • addon/globalPlugins/visionAssistant/updater.py
        • update dialog and update manager flow
      • addon/globalPlugins/visionAssistant/dialogs.py
        • extracted UI layer from the main file, including:
          • VisionQADialog
          • SettingsPanel
          • RangeDialog
          • ChatDialog
          • DocumentViewerDialog
  • Further refactor pass on main plugin structure

    • Removed duplicated plugin-instance state handling from __init__.py.
    • Wired plugin-instance synchronization through a single setter in the dialogs module.
    • Reduced __init__.py significantly by moving document reader + Gemini chat related UI flow out of the main file.
  • Improved maintainability-related robustness during extraction

    • Replaced/adjusted broad silent exception handling in extracted service/update modules to safer patterns with logging and explicit except Exception where appropriate.

Scope and Behavior

  • Refactor-focused change only.
  • No intended feature additions or behavior changes to addon functionality.
  • Primary goal is maintainability: breaking a giant file into smaller feature/service-oriented parts.

Validation

  • pre-commit run --all-files passed after each refactor step
  • ✅ Automated code review executed for the modularization commits
  • ✅ CodeQL check executed with no Python alerts
  • ✅ Targeted syntax validation (py_compile) passed for extracted modules and updated entrypoint

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Ed-Fe <79653188+Ed-Fe@users.noreply.github.com>
Copilot AI changed the title [WIP] Modularize addon for improved maintainability Add PT-BR modularization roadmap for Vision Assistant Pro addon Feb 17, 2026
Copilot AI requested a review from Ed-Fe February 17, 2026 23:22
@Ed-Fe
Copy link
Owner

Ed-Fe commented Feb 17, 2026

@copilot Não sei como você fez essa confusão, mas não era para escrever documentação no idioma Português, mas sim, ter um plano em mente e refatorar o addon enteiro para ele ficar mas modular e fácil de mecher. Fassa isso, por favor.

Co-authored-by: Ed-Fe <79653188+Ed-Fe@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 17, 2026

@copilot Não sei como você fez essa confusão, mas não era para escrever documentação no idioma Português, mas sim, ter um plano em mente e refatorar o addon enteiro para ele ficar mas modular e...

Feito no commit 7caa90c. Removi a documentação adicionada antes e comecei a refatoração real do add-on: extraí o bloco grande de constantes/config/prompts de __init__.py para addon/globalPlugins/visionAssistant/constants.py, mantendo a lógica atual com imports para reduzir o tamanho do arquivo principal e facilitar manutenção.

Copilot AI changed the title Add PT-BR modularization roadmap for Vision Assistant Pro addon Refactor Vision Assistant addon by modularizing __init__ constants and prompts Feb 17, 2026
@Ed-Fe
Copy link
Owner

Ed-Fe commented Feb 18, 2026

@copilot great. As you knowthis is a pull request so you need to complete every step of the plan. Only reply to me when you have May the plug-in easier to maintain, breaking up big files into smaller functions / features parts

Copilot AI and others added 5 commits February 18, 2026 00:35
Co-authored-by: Ed-Fe <79653188+Ed-Fe@users.noreply.github.com>
Co-authored-by: Ed-Fe <79653188+Ed-Fe@users.noreply.github.com>
Co-authored-by: Ed-Fe <79653188+Ed-Fe@users.noreply.github.com>
Co-authored-by: Ed-Fe <79653188+Ed-Fe@users.noreply.github.com>
Co-authored-by: Ed-Fe <79653188+Ed-Fe@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 18, 2026

@copilot great. As you knowthis is a pull request so you need to complete every step of the plan. Only reply to me when you have May the plug-in easier to maintain, breaking up big files into smaller ...

Done in commit 8b00249 (with modularization commits stacked before it). I continued the refactor and split the large plugin into dedicated modules (constants.py, prompt_helpers.py, markdown_utils.py, services.py, updater.py), leaving __init__.py much smaller and focused on orchestration, while preserving behavior and revalidating with pre-commit + code review + CodeQL.

Copilot AI changed the title Refactor Vision Assistant addon by modularizing __init__ constants and prompts Refactor Vision Assistant addon by modularizing the giant plugin into focused modules Feb 18, 2026
@Ed-Fe
Copy link
Owner

Ed-Fe commented Feb 18, 2026

@copilot Muito bem! pelo que entendo, ainda temos um grande addon, com o leitor de documentos, o chat com o gemini, e outras coisas no arquivo principal? se sim, continue a refatorisação.

Copilot AI and others added 3 commits February 18, 2026 01:04
Co-authored-by: Ed-Fe <79653188+Ed-Fe@users.noreply.github.com>
Co-authored-by: Ed-Fe <79653188+Ed-Fe@users.noreply.github.com>
Co-authored-by: Ed-Fe <79653188+Ed-Fe@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 18, 2026

@copilot Muito bem! pelo que entendo, ainda temos um grande addon, com o leitor de documentos, o chat com o gemini, e outras coisas no arquivo principal? se sim, continue a refatorisação.

Yes — continued in cd5eabd (stacked on f89f2c1 and 9f055d3). I moved the remaining main UI flow (Document Reader + Chat related dialogs/settings/range/viewer classes) out of __init__.py into dialogs.py, wired dependencies, and kept behavior through targeted validation (py_compile, pre-commit, code review, CodeQL).

Copilot AI changed the title Refactor Vision Assistant addon by modularizing the giant plugin into focused modules Refactor Vision Assistant addon by modularizing the giant plugin into focused feature modules Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants