best_engine_ai_helper.gui module

Best Engine AI Helper — single-page GUI.

This module holds the self-contained HTML document served by the FastAPI app at GET /gui (see best_engine_ai_helper.api). One file, Tailwind via CDN, vanilla JavaScript — no build step, no framework, no npm, matching the rest of the AI Helpers suite (see audio-helper’s GUI.md).

The page is offered in French (default) and English. Both are rendered from a single template plus a per-language strings table by render_gui(); a header link switches between them (/gui for French, /gui?lang=en for English). The JSON API the page calls is language-neutral, so only the labels differ. GUI_HTML is the French render, kept as a module constant for callers and tests that want the default page directly.

Every user-facing string is authored once, in locales/i18n.yaml (package root’s gui: namespace, loaded through best_engine_ai_helper.i18n) — this module never hardcodes wording. It maps that file’s stable semantic keys onto the template’s {{TOKEN}} placeholders and the JavaScript T object, and falls back to the meta.default_locale declared in the YAML (French) for any language the file does not cover.

Visual language matches the sprezzature-figures gallery (https://harchaoui.org/warith/sprezzature/figures.html): Roboto / Roboto Serif / Roboto Mono, the #007aff brand blue, a neutral gray scale, and a manual light/dark toggle persisted under a data-color-scheme attribute (not hotlinked — fonts are self-served via Google Fonts, not the reference site’s assets).

Author

Warith Harchaoui <warith.harchaoui@deraison.ai>

best_engine_ai_helper.gui.render_gui(lang='fr')[source]

Render the single-page GUI in the requested language.

Parameters:

lang (str) – Two-letter language code. Any value outside locales/i18n.yaml’s meta.supported_locales ("fr", "en") falls back to meta.default_locale so an unknown ?lang= never 500s.

Returns:

The complete HTML document for that language.

Return type:

str