WeblateOrg / weblate

Web based localization tool with tight version control integration.

Home Page:https://weblate.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

better UI feedback on machine translation results

JohnRDOrazio opened this issue · comments

Describe the problem

Here's a use case: since starting to use machine translation with OpenAI, I have put a cap / limit on monthly usage in the OpenAI platform settings (so not a Weblate setting, but an OpenAI setting), to avoid accidental requests that could potentially skyrocket costs without results. After upgrading Weblate to v5.6 I'm no longer getting errors and the machine translation is working well, but upon reaching the monthly limit there is no UI feedback about this. Also, there is no way (I least that I know of) to interrupt or stop a job (I've noticed that they continue in the background even if I navigate away from the auto-translate page).

I noticed in one of the last auto translations for a specific language that only so many strings were translated. I was wondering why this might be, and going to the OpenAI platform page I see that the monthly limit I set has been reached. So this is a good thing, knowing that costs will not skyrocket or go over a given limit. But there is no feedback on this situation in the Weblate interface.

Out of curiosity I started a new machine translation on a different language and I inspected the network activity in Chrome Dev Tools. Reading the response messages I see a message "error: you have reached your monthly limit".

Describe the solution you would like

It would be nice to have a section in the Weblate interface where we can see currently running or scheduled background jobs, with the possibility of maybe stopping them.

It would also be nice to have better feedback on the current status of running jobs, such as:

  • there is a lock in place, so the current job is not able to progress
  • what other jobs are currently running that could be holding the lock
  • an imposed limit has been reached so the job cannot progress
  • etc.

And perhaps a running job can detect that no progress is possible because there is a lock or a limit or for any other reason and could simply quit because of this. Or if the job will automatically retry after a certain amount of time in case the lock is freed up in the meantime, we could see this in the UI: "job X cannot progress because lock is being held by job Y, retrying in 5 seconds ...".

Describe alternatives you have considered

No response

Screenshots

No response

Additional context

No response

Here is an example response from the network activity in Chrome inspector:

{
    "completed": false,
    "progress": 1,
    "result": {
        "progress": 1,
        "translation": 449
    },
    "log": "liturgical-calendar/liturgical-anniversary-calculator-data/pt: starting automatic translation cd9dd00a-816c-4fbb-92b8-9a01e7fbaf19: mt: openai\nliturgical-calendar/liturgical-anniversary-calculator-data/pt: fetching translations from OpenAI, 20 per request\nliturgical-calendar/liturgical-anniversary-calculator-data/pt: failed automatic translation: RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}\nliturgical-calendar/liturgical-anniversary-calculator-data/pt: failed automatic translation: RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}\nliturgical-calendar/liturgical-anniversary-calculator-data/pt: failed automatic translation: RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}\nliturgical-calendar/liturgical-anniversary-calculator-data/pt: failed automatic translation: RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}"
}

Doing a quick search online I found that there are some UIs available to inspect running celery jobs, such as https://flower.readthedocs.io/en/latest/ . Perhaps something like this can be integrated into the Weblate UI...

though looking a bit more at flower I see that the UI doesn't have real time updates, you have to refresh the page to see any changes in status.

Another project that uses websockets for real time updates is https://wscelery.readthedocs.io/en/latest/ .

The task progress is shown to browser (it's just not using websocket). For automatic translation, only the progress is shown, not the logs. It uses API: https://docs.weblate.org/en/latest/api.html#tasks