Skip to content

Ai assistant refactoring#4354

Open
mauretto78 wants to merge 48 commits intodevelopfrom
ai-assistant-refactoring
Open

Ai assistant refactoring#4354
mauretto78 wants to merge 48 commits intodevelopfrom
ai-assistant-refactoring

Conversation

@mauretto78
Copy link
Contributor

@mauretto78 mauretto78 commented Jan 26, 2026

Translation Feedback

New endpoint:

  • [POST] /api/app/ai-assistant/feedback

Payload:

  • id_segment (required)
  • id_client (required)
  • source_language (required) - the source language of the string
  • target_language (required) - the target language of the string
  • text (required) - the source string
  • translation (required) - the translation to be evaluated
  • style (required) - one of [faithful, fluid, creative]

Example:

{
    "id_client": "123",
    "localized_source": "Italian (Italy)",
    "localized_target": "English (USA)",
    "text": "Ciao papà",
    "translation": "Hey dad what's up?",
    "style": "creative",
    "id_segment": "123"
}

Canal SSE channel type: ai_assistant_feedback

Response: array

A typical excellent feedback:

[
     "category" => "Excellent",
     "comment" => "The translation takes artistic liberties appropriate to the "Creative" style. By expanding "Ciao papà" to "Hey dad what's up?", it captures a casual, engaging tone while staying true to the spirit of the original greeting. Great job!"
]

A bad feedback:

[
       'category' => 'Does Not Match Source',
       'comment' => 'The translation "Hey Superman" doesn\'t capture the spirit or any recognizable aspect of the original text "Ciao papà." Even with the creative style allowing for adaptation, it diverges significantly, lacking a connection to the original meaning. A rewrite is necessary to reflect the original sentiment creatively.',
]

Alternative translations

New endpoint:

  • [POST] /api/app/ai-assistant/alternative-translations

Payload:

  • id_segment (required)
  • id_client (required)
  • source_language (required) - the source language of the string
  • target_language (required) - the target language of the string
  • source_sentence (required) - the source string
  • source_context_sentences_string (required) - the source contexts (the previous and the next source phrases splitted by a new line.)
  • target_sentence (required) - the source string
  • target_context_sentences_string (required) - the target contexts (the previous and the next target phrases splitted by a new line.)
  • excerpt (required) - target excerpt to be replaced
  • style_instructions (required) - one of [faithful, fluid, creative]

Canal SSE channel type: ai_assistant_alternative_translations

Possible responses:

  • NULL - if Gemini doesn't find any valid alternative, or the sentence/excerpt doesn't make sense
  • string - in some cases Gemini client responds with a string error (example: the response is too slow)
  • array - up to 4 elements. Example: `
[
    {
       "alternative":"Lavable a máquina",
       "context":"Indica que el producto se puede lavar en máquina.",
    }
 ]

Related PR: https://github.com/matecat/matecat_docker_build/pull/15


@mauretto78 mauretto78 added the dependencies Pull requests that update a dependency file label Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file In Progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants