Sofia
Account created on 11 February 2008, almost 17 years ago
#

Merge Requests

More

Recent comments

🇧🇬Bulgaria valthebald Sofia

As far as stickyHeaderState is entirely client-processed and is not collected/processed by the server (who should it be?), I'd argue it's not a subject to GDPR or similar regulations.
GDPR, as it states in the very first article, is about

...rules relating to the protection of natural persons with regard to the processing of personal data and rules relating to the free movement of personal data.

since there is no processing of personal data, I'd say there is no need to get user consent

🇧🇬Bulgaria valthebald Sofia

Fixed most of the comments (2 left are for the future).
Also, brought back editing of default translation prompt (patch to have per-language left it hidden) and display of default prompt that has a condition

🇧🇬Bulgaria valthebald Sofia

@mkalkbrenner did you have a chance to check this?

🇧🇬Bulgaria valthebald Sofia

Tested and works for text fields attached to entity being translated and referenced entities

🇧🇬Bulgaria valthebald Sofia

valthebald made their first commit to this issue’s fork.

🇧🇬Bulgaria valthebald Sofia

Solr-based logger mimicking dblog UI - https://www.drupal.org/project/search_api_solr/issues/3475570 Provide Search API-based alternative to dblog Active

🇧🇬Bulgaria valthebald Sofia

valthebald changed the visibility of the branch 3475570-solronly to hidden.

🇧🇬Bulgaria valthebald Sofia

valthebald changed the visibility of the branch 3475570-logger to hidden.

🇧🇬Bulgaria valthebald Sofia

@mkalkbrenner sure, I will create a MR later today

🇧🇬Bulgaria valthebald Sofia

@mkalkbrenner: PoC of lighter, Solr-only logger implementation https://git.drupalcode.org/sandbox/valthebald-3476169
TL;DR; where possible, I followed dblog patterns, replacing database specifics with solarium queries

🇧🇬Bulgaria valthebald Sofia

Finally had some time to work on this.
@Marcus_Johansson:
1. I have added a third party subform to Field UI's FieldConfigEditForm:
2. Defaults lead to AI translate settings form

@yonailo: I noticed (and fixed) some PHP messages coming from changes in the upstream, hopefully this fixes your case.
If not, please provide more details

🇧🇬Bulgaria valthebald Sofia

(ai_translate) One click translations for Layout builder Active can't be resolved before this one, both issues can be either fixed together, or this one is committed earlier (possible?)

🇧🇬Bulgaria valthebald Sofia

Totally agree with #22
In any case, having complex conditions like the one from #20 goes beyond the scope of this issue

🇧🇬Bulgaria valthebald Sofia

@W01F I doubt such a flexibility can be achieved using single prompt, but be addressed in a more generic solution ( [META] Create a reusable "Prompt Entity" and field Active seems natural umbrella)
I.e. when translating a taxonomy term that has layout builder blocks or paragraphs, what would be an entity type context?
I suggest to use this specific issue as a proof of concept, and then work on a more generic solution in another issue. What do you think?

🇧🇬Bulgaria valthebald Sofia

I have enabled the plugin, and got this far -
but when I click "Save changes to editor", this simply clears selection text

🇧🇬Bulgaria valthebald Sofia

Since the documentation is growing (and it makes sense!), I am going to offload this to a new help topic

🇧🇬Bulgaria valthebald Sofia

Addressed concerns from #11:

  1. Processing every piece of content in a separate batch operation to avoid timeouts
  2. Text fields are now translated only when the field is translatable
  3. The (officially unsupported) case of translatable paragraphs reference is not handled and raises errors.
🇧🇬Bulgaria valthebald Sofia

Added link to Twig documentation on d.o., added validation of prompt twig

🇧🇬Bulgaria valthebald Sofia

I really liked suggestion to use Twig for prompts :)
What is done in this MR:

  • Added ai_translate.settings simple config object and provided default value in config/install
  • Added hook_update_N() to have the config for existing installations
  • Added configuration form to edit the prompt, plain textarea for now
  • Switched from hard-coded prompt text to config value in AiTranslateController
🇧🇬Bulgaria valthebald Sofia

Here's what was done:

  1. Created new plugin type TextExtractor and accompanying plugin manager for field text extractors
  2. TextExtractorInterface has 2 methods: extract() that returns an array of translatable metadata (value + optional format, delta etc.) from entity field, and setValue() that does the opposite and sets translated value back into the entity
  3. Created 2 TextExtractor plugins - text (the list of field types supported before) and entity_reference (including entity_reference_revisions)
  4. Since entity references can increase the number of texts to translate, translate controller now processes the texts in chunks
  5. Created drush command ai:translate that does exactly the same as translate controller, but in one chunk. I know it's possible to process batches in drush as well, but not sure if that was needed
🇧🇬Bulgaria valthebald Sofia

I'm afraid we're over-engineering the starting point.
Visual editing, inheritance and so on of prompts is great, but just for the purposes of being able to change default prompt, even simple configuration entity would suffice.
If aiprompt is not finding its way into "core" ai (or ai's composer.json as dependency) real soon, ai and its submodules cannot rely on the very existence of prompt entity.
As an immediate solution, I would suggest having prompt as a config entity (I am going to try this approach as a PoC for ai_translate and specifically 💬 Can't modify prompt for translating Needs review )
aiprompt can add visual editing, separate ConfigEntity class etc., but "core" ai should have something to start with

🇧🇬Bulgaria valthebald Sofia

@mindaugasd: by next release, do you mean next release of aiprompt or of ai?

🇧🇬Bulgaria valthebald Sofia

Probably related to [META] Create a reusable "Prompt Entity" and field Active ?
We can provide default starting prompt instead of hard-coding it in the module

🇧🇬Bulgaria valthebald Sofia

Updated the fork following the interface change in 1.4.5

🇧🇬Bulgaria valthebald Sofia

This https://git.drupalcode.org/project/ai/-/merge_requests/37/diffs is not ready for the prime time yet, but done some preparation:

  1. Text extraction from entity fields is not done with plugins (of type FieldTextExctrator)
  2. Extraction of field types supported currently (hard-coded in $allowed_types variable) is moved to TextFieldExtractor, which is the only plugin so far
  3. Next step is creation of ReferenceExtractor plugin that will support entity reference and entity reference revisions
  4. After that, add the batch creation when the number of extracted texts to translate exceeds certain level. Not sure if this should be done in the same or separate issue.
  5. To mitigate possible need of batch, create a drush command that will create a translation
🇧🇬Bulgaria valthebald Sofia

Shouldn't translation of paragraphs/blocks be the part of translating the host entity? I would add entity reference (and entity reference revision as a subclass of it) to the list of supported field types when translating the entity

🇧🇬Bulgaria valthebald Sofia

@anup.sinha that was the first thing on my mind after seeing initial patch :)
I believe we should have a separate issue for that

🇧🇬Bulgaria valthebald Sofia

@Marcus_Johansson: I've added a few comments, none of them are show stoppers

🇧🇬Bulgaria valthebald Sofia

Am I the only one to suddenly think of webform and its structure/UI?
Component chaining, parameters, plugins, conditionals etc... webform has it all, with stable UI to configure.
Can we borrow some of webform approaches?

🇧🇬Bulgaria valthebald Sofia

I was searching for this issue while fixing ai_translate module :)
Hard-coding the prompts is definitely not the best idea, and doesn't give users much flexibility.
So, what is a prompt? Config entity with token support? In this case, initial prompts are placed in config/install and then configurable at some "prompt UI"?

🇧🇬Bulgaria valthebald Sofia

I get fatal errors with this branch, will provide details (and probable fix) later today

🇧🇬Bulgaria valthebald Sofia

Added paragraph describing the necessity to update entity field definitions

🇧🇬Bulgaria valthebald Sofia

@xlyz: I still believe this belongs to commerce_sync rather than this module

🇧🇬Bulgaria valthebald Sofia

I've submitted my suggestions from #12:

  • Removed node as hard-coded entity type, expecting ContentEntityInterface now. AiTranslateRouteSubscriber::alterRoutes() was already adding "Translate with AI" links to all supported entity types.
  • Changed signature of AiTranslateController::translate() to AiTranslateController::translate($entity_type, $entity_id, $lang_from, $lang_to)
  • Changed permission name to "create ai content translation" and added module's .permissions.yml
  • Enabled translation from original to default language (entity is not necessarily created in site default language, but it would be good to have an option to translate from original language to default one)

Performed several tests locally, module worked for me for both nodes and taxonomy terms

Things that are not working yet:

  • The only supported base field is label
  • All fields are treated as text_format (value + format), including plain text

Both issues do not look to me as deal breakers to include the module to HEAD, but up to you to decide.

🇧🇬Bulgaria valthebald Sofia

I will submit some changes later tonight

🇧🇬Bulgaria valthebald Sofia

I'd put the logic of when to throw the new exceptions (quota/rate) into providers, the core handling them in the unified way

🇧🇬Bulgaria valthebald Sofia

@Marcus_Johansson - what do you mean external module? As in having it's own composer package, or submodule of drupal/ai?

🇧🇬Bulgaria valthebald Sofia

As I said, I'd be glad to help when it comes to the coding part :)
Suggested changes are not that big to postpone them

🇧🇬Bulgaria valthebald Sofia

Moving to Needs work because of comments

Production build 0.71.5 2024