Skip to content
Snippets Groups Projects

Resolve #3457200 "Ai translations submodule"

Merged Valery Lourie requested to merge issue/ai-3457200:3457200-ai-translations-submodule into 1.0.x
7 unresolved threads

Closes #3457200

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 214 * Adding the translation in database and linking it to the original entity.
    215 *
    216 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
    217 * The entity object.
    218 * @param string $target_language
    219 * The target language.
    220 * @param array $bundleFields
    221 * An array of field name and their translation.
    222 */
    223 public function insertTranslation(
    224 ContentEntityInterface $entity,
    225 string $target_language,
    226 array $bundleFields,
    227 ) {
    228 if ($entity->hasTranslation($target_language)) {
    229 return;
  • Marcus Johansson
  • I checked the code and gave some suggestions - the thing that should change is that the formatted text can't have upcasted text format, that could lead to security issues.

    The rest are recommendations, but the current prompt does not give me good results, I got this as title for instance: Sure! The translation of "test" to Swedish is "test"

    The prompt should also be base prompt injection proofed.

  • Marcus Johansson requested changes

    requested changes

  • 1 ai_translate.translate_content:
    2 path: '/ai_translate/translate/{entity_type}/{entity_id}/{lang_from}/{lang_to}'
    3 defaults:
    4 _controller: '\Drupal\ai_translate\Controller\AiTranslateController::translate'
    5 _title: 'AI powered Translation'
    6 requirements:
    7 _permission: 'create ai content translation'
    • In theory a user that does not have the right to manually translate a content will be able to translate the content if they have this permission, because the original modules permissions are more fine grained, but I think that is fine - only "super editors" should have this permission.

    • Please register or sign in to reply
  • Valery Lourie added 1 commit

    added 1 commit

    • 7010a317 - 3457200: Fix comments from Marcus

    Compare with previous version

  • Valery Lourie added 1 commit

    added 1 commit

    • 83c73ce5 - 3457200: Change the prompt, do not use referrer URL for redirect

    Compare with previous version

  • Valery Lourie added 1 commit

    added 1 commit

    • a9b54b72 - 3457200: Handle multiple values

    Compare with previous version

  • wouters_f added 1 commit

    added 1 commit

    • 2fe35fc9 - [3457200] SHow error if no default selected. with link to config screen

    Compare with previous version

  • Valery Lourie
    Valery Lourie @valthebald started a thread on an outdated change in commit 2fe35fc9
  • 7 7
    8 8 use Drupal\Core\Routing\RouteMatchInterface;
    9 9
    10 /**
    11 * Implements hook_install();
    12 *
    13 * @param $is_syncing
    14 */
    15 function ai_translate_hook_install($is_syncing){
    16 _ai_translate_check_default_provider_and_model();
  • Valery Lourie
    Valery Lourie @valthebald started a thread on an outdated change in commit 2fe35fc9
  • 21 30 return $output;
    22 31 }
    23 32 }
    33
    34
  • Valery Lourie
    Valery Lourie @valthebald started a thread on an outdated change in commit 2fe35fc9
  • 23 32 }
    33
    34
    35 /**
    36 * Check if default provider is chosen and model is selected.
    37 */
    38 function _ai_translate_check_default_provider_and_model() {
    39 $ai_config = \Drupal::service('config.factory')->get('ai.settings');
    40 $default_providers = $ai_config->get('default_providers') ?? [];
    41 if(
    42 !isset($default_providers['chat']['provider_id']) && !isset($default_providers['chat']['model_id'])
    43 ||
    44 $default_providers['chat']['provider_id'] == ""
    45 || $default_providers['chat']['model_id'] == ''
    46 ) {
    47 \Drupal::messenger()->addMessage(t('Please set a default chat provider & model in the <a href="/admin/config/ai/settings">AI module settings</a>.'), 'error', FALSE);
  • Valery Lourie requested changes

    requested changes

  • wouters_f added 47 commits

    added 47 commits

    Compare with previous version

  • wouters_f added 1 commit

    added 1 commit

    Compare with previous version

  • 12 12 *
    13 13 * @param $is_syncing
    14 14 */
    15 function ai_translate_hook_install($is_syncing){
  • 31 31 }
    32 32 }
    33 33
    34
    35 34 /**
    36 35 * Check if default provider is chosen and model is selected.
    37 36 */
    38 37 function _ai_translate_check_default_provider_and_model() {
    39 38 $ai_config = \Drupal::service('config.factory')->get('ai.settings');
    40 39 $default_providers = $ai_config->get('default_providers') ?? [];
  • wouters_f added 3 commits

    added 3 commits

    • 457f4641 - Issue #3456395 by Marcus_Johansson, wouters_f: Remove stream parameter from...
    • 3a60fc30 - Streamed changes and changes to how the config is built
    • bac94476 - Merge of Chat Stream Interface

    Compare with previous version

  • wouters_f added 1 commit

    added 1 commit

    Compare with previous version

  • wouters_f added 1 commit

    added 1 commit

    • 24f32ae9 - [3457200] last changes in the translate module

    Compare with previous version

  • wouters_f added 52 commits

    added 52 commits

    Compare with previous version

  • wouters_f added 1 commit

    added 1 commit

    Compare with previous version

  • Also ready to be merged into DEV.

  • Valery Lourie added 1 commit

    added 1 commit

    • aa5dbf74 - 3457200: Use shorter empty() check

    Compare with previous version

  • Marcus Johansson added this merge request to the merge train at position 4

    added this merge request to the merge train at position 4

  • added 1 commit

    Compare with previous version

  • Marcus Johansson approved this merge request

    approved this merge request

  • Marcus Johansson started a merge train

    started a merge train

  • Please register or sign in to reply
    Loading