Skip to content

Releases: jls42/BabelFishAI

v1.1.19 - Firefox Support

Choose a tag to compare

@jls42 jls42 released this 16 Dec 21:00
61a09de

🦊 Firefox Support

BabelFishAI est maintenant disponible sur Firefox ! Cette version ajoute la compatibilité complète avec Firefox tout en conservant le support Chrome.

Nouveautés

  • Support Firefox : Extension compatible Firefox (Manifest V3)
  • Build multi-navigateur : Script ./scripts/build.sh pour générer les packages Chrome et Firefox
  • Architecture Firefox : Appels API via le background script (pattern recommandé pour les extensions Firefox)

Améliorations techniques

  • Optimisation du proxy Firefox avec encodage Base64 pour les uploads audio
  • Réduction de la complexité cyclomatique dans focus-utils.js
  • Remplacement de innerHTML par DOMParser pour la sécurité
  • Icônes corrigées (dimensions carrées)
  • Ajout de data_collection_permissions dans le manifest Firefox

Release v1.1.18 - Support Mistral AI (Voxtral)

Choose a tag to compare

@jls42 jls42 released this 14 Dec 19:46
fd50820

🎉 Nouveau Provider : Mistral AI

  • Transcription vocale avec Voxtral : nouveau modèle de transcription de Mistral AI
  • Modèles chat Mistral : Small, Medium, Large et Codestral pour la traduction/reformulation
  • Architecture multi-provider : nouveau système de registre des providers (providers.js)
  • Sélection indépendante du provider pour transcription et traduction

🧹 Nettoyage de la dette technique

  • Suppression des modules deprecated (api.js, translation.js, text-translation.js, languages.js)
  • Réduction des fonctions sur-exposées (focus-utils.js, ui.js)
  • Corrections pour les analyseurs de code statique (SonarCloud, Codacy, DeepSource)

1.1.17

Choose a tag to compare

@jls42 jls42 released this 26 Mar 22:05
c2bcf28

This major refactoring improves the maintainability and readability of the code by breaking down the content.js file (>2000 lines) into specialized modules:

Creation of 9 new utility files:

  • api-utils.js: Functions for interacting with APIs
  • banner-utils.js: Banner display management
  • error-utils.js: Centralized error handling
  • event-handlers.js: User event management
  • focus-utils.js: Focus and selection handling
  • recording-utils.js: Audio recording functionalities
  • text-processing.js: Text processing
  • text-translation.js: Translation and rephrasing
  • transcription-display.js: Displaying results

Transformation of content.js into a lightweight wrapper that:

  • Imports and initializes the modules
  • Exposes the main functions through the BabelFishAI namespace
  • Keeps only the initialization functions specific to the content script

Technical improvements:

  • Better separation of concerns
  • Reduced circular dependencies
  • Improved function documentation
  • More robust error handling
  • Preservation of all existing features

This refactoring facilitates future developments while maintaining compatibility with previous versions.

1.1.16

Choose a tag to compare

@jls42 jls42 released this 22 Mar 10:54
77a387f

Addition of the latest audio transcription models:

  • gpt-4o-transcribe
  • gpt-4o-mini-transcribe

Available for selection in expert mode.

1.1.15

Choose a tag to compare

@jls42 jls42 released this 13 Mar 21:31
253ff09

Fix: Improve automatic copy handling based on context

Improves the behavior of the "Automatic copy to clipboard" option to work more intuitively and contextually:

No longer automatically copies when the text is inserted into an input field.
Automatically copies only when the dialog box is displayed AND no input field is in focus.
Improves detection of valid input fields (inputs, textareas, contentEditable elements).
Respects user display preferences (forces dialog display on certain domains).
This change ensures a better user experience by avoiding unnecessary replacement of clipboard content when the text is already inserted in a field.

1.1.14

Choose a tag to compare

@jls42 jls42 released this 12 Mar 21:58
66dbe71

feat(options): Add auto-copy to clipboard option

  • Adds an "Automatic copy to clipboard" option in the settings.
  • Hides the transcription dialog if auto-copy is enabled.

1.1.13

Choose a tag to compare

@jls42 jls42 released this 09 Mar 15:06
76f8d4f

UI Enhancement: Moving controls to the top of the dialog box

  • Copy button now accessible at the top of the dialog box
  • Reduced spacing and margins for a more compact interface
  • Optimized layout of controls (timer and "keep open" option)
  • Better user experience for long texts without having to scroll

v1.1.12

Choose a tag to compare

@jls42 jls42 released this 09 Mar 01:46
b7755b4

Major Improvements:

  • Context Menu Feature:
    The most significant addition is the implementation of a context menu (right-click on selected text). This menu offers two options:

    • Rephrase Selection: Enhances the style and clarity of the selected text using OpenAI's GPT API.
    • Translate Selection: Translates the selected text into a chosen language via a submenu. The available languages are those already supported by the extension.
      The original text is directly replaced by the rephrased/translated text on the web page.
  • Enhanced Dialog Box:
    The dialog box (used as an alternative to direct insertion into the text field) has been significantly improved:

    • Visual Timer: A visual countdown (progress bar) indicates the time remaining before the dialog box automatically closes.
    • "Keep Open" Option: A switch allows the user to disable automatic closing and keep the dialog box open indefinitely. The timer then transforms into an "infinite" indicator.
    • Copy Button: A button allows the user to easily copy the transcribed/translated text to the clipboard.
    • Aesthetic Improvements: The dialog box now features a more modern style (rounded borders, shadows, better organization).
  • Improved Error and Connection Management:

    • Connection Check: Before making an API call, the code now explicitly checks whether the device is online using navigator.onLine. This prevents unnecessary API call attempts and improves the offline user experience.
    • Clearer Error Messages: Error messages (for example, for API key issues, network errors, etc.) have been enhanced to be more informative and to help the user resolve problems. Specific suggestions are provided (e.g., checking the API key, verifying the internet connection).
    • Automatic Retries: In the event of a temporary network error, the extension automatically retries the API call after a short pause (1.5 seconds).
  • Code Refactoring and Organization:

    • Separate Language Files: The supported languages are now defined in separate files (src/utils/languages-shared.js for the content script and src/utils/languages-data.js for the service worker), which makes the code cleaner and easier to maintain. The service worker loads languages-data.js via importScripts.
    • Centralized Constants: Constants (for states, actions, etc.) are defined in src/constants.js, improving readability and maintainability.
    • UI Utilities: Utility functions for managing the user interface (banner, dialog box) have been grouped in src/utils/ui.js.
    • Modularization: The code is overall better structured and modularized, making it easier to understand and modify.
    • Updated README Files: The README files (in various languages) have been updated to reflect the new features, particularly the context menu and dialog box options.
  • Security:

    • Uses window.clearTimeout instead of clearTimeout for enhanced security.
    • Employs secure methods to access timers and prevent object injection.
  • Minor Changes:

    • The extension version has been updated from 1.1.11 to 1.1.12.
    • The type "module" has been removed from the service_worker definition in manifest.json.
    • Some CSS style adjustments have been made for the dialog box.
    • Improvements have been implemented in the management of the dialog box timer (no more requestAnimationFrame, cleaner timer management).
    • Unused or commented-out code has been removed.

1.1.11

Choose a tag to compare

@jls42 jls42 released this 08 Mar 03:52
8ab63b0

Features:

  • Added automatic text rephrasing via GPT models to improve clarity and fluidity.
  • Added direct buttons on the banner to enable/disable rephrasing and translation.
  • Integrated a language selector in the banner to easily change the target language.
  • Supported the Escape key to cancel the ongoing recording.

Improvements:

  • Automatically hide the banner 4 seconds after the recording is cancelled.
  • Bidirectional synchronization between the options and the control banner.
  • Visual redesign of the banner with modern buttons and smooth animations.
  • Visual optimization of the language selector (removal of double arrows).
  • Added padding to the body to prevent the banner from covering content.

Internationalization:

  • Added translated messages for the new features.
  • Created an event system for dynamic translation management.

Framework:

  • Updated constants to include rephrasing errors.
  • Added a keyboard handler for detecting the Escape key.
  • Improved the text processing flow to include the rephrasing step.

Fix: Preservation of Focus and Cursor during Banner Interactions
This update fixes a significant user experience issue where focus and cursor position were lost during interactions with the banner controls (rephrasing, translation buttons, language selector).

Improvements made:

  • Added a system to memorize and restore focus and text selection.
  • Captured focus on mousedown before interacting with controls.
  • Intelligent restoration of cursor position after the interaction.
  • Improved handling of delays (300ms) to ensure DOM stabilization.
  • Specific management of the language selector, including cases where the user clicks elsewhere after it is opened.
  • Double restoration of focus when cancelling recording with the Escape key.
  • Robust checks to avoid errors on invalid elements.

These improvements ensure a smooth text editing experience without interruption, even when interacting with the extension's controls.

  1. Consolidation of Duplicated Functions:

    • The showBanner function has been consolidated in ui.js and is now used by content.js.
    • The language lists have been centralized in a new module languages.js.
  2. Extraction of CSS:

    • The inline CSS in content.js has been moved to content.css.
    • Manual CSS injection in content.js has been replaced by using an external CSS file.
  3. Improvement in Module Loading:

    • The file languages.js has been added to the list of files to inject in background.js.
    • The i18n.js module is now explicitly loaded in background.js.

Benefits of these changes:

  1. Better Separation of Concerns:

    • Display logic is now in ui.js.
    • Language data is centralized in languages.js.
    • Styles are managed in content.css.
  2. Easier Maintenance:

    • It is now simpler to modify styles because they are in a dedicated CSS file.
    • Changes to user interface functions can be made in one place.
  3. Improved Performance:

    • CSS is now injected by Chrome in an optimized manner.
    • Code duplication has been reduced.
  4. Consolidation of Duplicated Functions:

    • The showBanner function has been consolidated in ui.js and is now used by content.js.
    • The language lists have been centralized in a new module languages.js.
  5. Extraction of CSS:

    • The inline CSS in content.js has been moved to content.css.
    • Manual CSS injection in content.js has been replaced by using an external CSS file.
  6. Modularization of the initBanner Function:

    • The long initBanner function has been decomposed into several smaller, specialized functions:
      • createBannerButton: Creates a control button with an icon and text.
      • createLanguageSelector: Creates the language selector.
      • initializeLanguageSelector: Initializes the selector with the available languages.
      • setupBannerEventListeners: Sets up event handlers for the buttons.
      • Additional utility functions for handling languages.
  7. Code Cleanup:

    • Removed obsolete comments.
    • Removed unnecessary skipcq markers.
  8. Improved Readability:

    • Better organization of functions.
    • Clearer documentation.

These improvements have led to:

  1. Reduced code duplication.
  2. Improved modularity and readability.
  3. Easier future maintenance.
  4. Reduced code size.

Additional Optimizations Implemented:

  1. Enhancement of the handleActiveElementInsertion Function:

    • Reduced conditional checks.
    • Utilized destructuring to extract properties from elements.
    • Implemented a better insertion strategy for contentEditable elements with fallback.
  2. Optimization of the insertTextIntoInput Function:

    • Simplified validation conditions.
    • Reduced code duplication for different insertion strategies.
    • Used destructuring to extract element values.
    • Calculated the new value only once regardless of the execution path.
  3. Optimization of updateBannerColorOptions:

    • Early exit if the banner is unavailable.
    • Used a direct loop instead of Object.keys().forEach().
    • Simplified change verification.
  4. Major Optimization of handleStorageChanges:

    • Cached DOM selectors to avoid repeated queries.
    • Employed a lazy-loading model for DOM elements.
    • Grouped DOM manipulations within requestAnimationFrame.
    • Optimized CSS animations.
    • Implemented more robust error handling.

Benefits:

  1. Better Performance:

    • Fewer repetitive DOM operations.
    • More efficient use of modern browser APIs.
    • Reduced style recalculations and reflows.
  2. More Robust Code:

    • Improved error and edge-case checks.
    • Reduced risk of diverging duplicated code.
    • Enhanced error handling.
  3. Easier Maintainability:

    • More modular organization.
    • Clearer separation of concerns.
    • More readable code with explicit comments.
  4. Resource Savings:

    • Minimized object creation.
    • Better memory utilization.
    • Fewer garbage collection triggers.

1.1.10

Choose a tag to compare

@jls42 jls42 released this 06 Mar 22:55
8002430

Translation:

  • Addition of the 'Automatic' option for the source language in the translation settings.

  • Added the 'Automatic' option to the source language dropdown menu in the options page.

  • Added the translation for the 'Automatic' option in all messages.json files for all supported languages.

  • Modified the translateText function in translation.js to handle the 'Automatic' mode for the source language using an appropriate GPT prompt.

  • Set the default source language to 'Automatic' in options.js.

Fix:

  • The 10-second timeout configured for API calls in src/utils/api.js was mistakenly added.
  • Completely removed the timeout to allow longer transcriptions without interruption.