Skip to content

⚡️Improve AI translations formatting #662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 13, 2025

Conversation

AntoLC
Copy link
Collaborator

@AntoLC AntoLC commented Feb 25, 2025

Purpose

To translate with the AI we are using lossy functions blocksToMarkdownLossy / tryParseMarkdownToBlocks, it transforms the content editor to markdown. The problem is this transpilation is very lossy, we loose color, background, table size, line break etc...

Proposal

We will use html instead of markdown to do the translation, html can carry much more information that markdown about the content style.

  • ⚡️(AI) improve formating of ai translation
  • ✨(AI) add beautify action to ai transform
  • ✨(AI) add emojify action to ai transform

Demo

What we have now with markdown :

scrnli_Ug6vr23om8ZN8E.webm

With preserved formatting :

scrnli_aTe1Ed2p695SF2.webm

Feature Beautify

scrnli_v7YQ56N18Q3O5n.webm

@AntoLC AntoLC added enhancement improve an existing feature wip i18n experiment AI labels Feb 25, 2025
@AntoLC AntoLC self-assigned this Feb 25, 2025
@AntoLC AntoLC requested a review from arnaud-robin February 25, 2025 09:00
@AntoLC AntoLC force-pushed the refacto/unlossy-ai-translation-the-return branch from 0bd97a5 to bf22553 Compare March 12, 2025 09:36
@AntoLC AntoLC changed the title POC - improve translation and services ⚡️Improve AI translations formatting Mar 12, 2025
@AntoLC AntoLC force-pushed the refacto/unlossy-ai-translation-the-return branch from bf22553 to 8133d29 Compare March 12, 2025 10:45
@AntoLC AntoLC removed the request for review from arnaud-robin March 12, 2025 10:47
@AntoLC AntoLC marked this pull request as ready for review March 12, 2025 10:47
@AntoLC AntoLC requested a review from lunika March 12, 2025 10:51
@AntoLC AntoLC added feature add a new feature and removed wip experiment labels Mar 12, 2025
@AntoLC AntoLC linked an issue Mar 12, 2025 that may be closed by this pull request
@AntoLC AntoLC force-pushed the refacto/unlossy-ai-translation-the-return branch from 3e8a2cf to e8161b9 Compare March 13, 2025 10:29
@AntoLC AntoLC requested a review from virgile-dev March 13, 2025 10:30
Copy link
Collaborator

@virgile-dev virgile-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvements !
Just so that we are aware.
We still have loss with

  • Blockquotes
  • Background color of blocks are lost
  • Some formatting is loss inside paragraph.

@AntoLC
Copy link
Collaborator Author

AntoLC commented Mar 13, 2025

Great improvements ! Just so that we are aware. We still have loss with

  • Blockquotes
  • Background color of blocks are lost
  • Some formatting is loss inside paragraph.

We loose the custom blocks yes, background and usual formatting are normally not lost anymore, but it can happen yes.

AntoLC added 4 commits March 13, 2025 16:27
The ai translation were quite lossy about formatting.
Colors, background, breaklines, table sizes were
lost in the translation.
We improve the AI translation request to keep
the formatting as close as possible by using
html instead of markdown.
The beautify action add emojis to the important
parts of the text and add formatting to the text
to make it more readable.
The emojify action add emojis to the important
parts of the text.
Use the blockquote tag for quote block instead of
a paragraph tag.
@AntoLC AntoLC force-pushed the refacto/unlossy-ai-translation-the-return branch from e8161b9 to 77467f6 Compare March 13, 2025 15:27
@AntoLC AntoLC enabled auto-merge (rebase) March 13, 2025 15:27
@AntoLC AntoLC merged commit da02d3d into main Mar 13, 2025
16 of 19 checks passed
@AntoLC AntoLC deleted the refacto/unlossy-ai-translation-the-return branch March 13, 2025 15:38
@arnaud-robin
Copy link
Member

J'ai review aussi c'est top. Passer par l'export html me semble bien, au pire on aura des artifacts de balise html si jamais le modèle se plante.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI enhancement improve an existing feature feature add a new feature i18n
Projects
None yet
Development

Successfully merging this pull request may close these issues.

⚗️AI return with complex data
4 participants