Skip to content

AI translations failing after update. #346

@mikiadev

Description

@mikiadev

After updating packages, AI translations no longer work. I have previously used this to translate thousands of strings.. we can see that the endpoint is returning a correct response but it's not accepted?

getting messages [{"id":["hello world"],"references":[{"file":"src/routes/test/+page.svelte","refs":[null]}]}]
translation ok:  {"es":["hola mundo"]}
translation: en..[es] [0]: 1 messages not translated. Retrying...
getting messages [{"id":["hello world"],"references":[{"file":"src/routes/test/+page.svelte","refs":[null]}]}]
translation ok:  {"es":["hola mundo"]}
    ai: {
      name: 'translation',
      batchSize: 12,
      parallel: 1,
      group: {},
      translate: async (messages, instruction) => {
        console.log('getting messages', messages) //, instruction)
        const response = await fetch('https://10.100.0.9/api/v1/chat/completions', { 
          method: 'POST',
          signal: AbortSignal.timeout(1800000),
          headers: {
            'Content-Type': 'application/json',
            Authorization: `Bearer sk-n3v3rg0nn4g1v3y0uup`
          },
          body: JSON.stringify({
            model: 'gemma-4-26B-A4B-it-Q8_0',
            messages: [
              { role: 'system', content: instruction },
              { role: 'user', content: messages }
            ],
            temperature: 0.1
            // max_tokens: 32768
          })
        })
        if (!response.ok) {
          throw new Error(`translation failed: ${response.status} ${response.statusText}`)
        }

        const data = await response.json()
        let translated = data.choices[0].message.content.trim()
        console.log('translation ok: ', translated)
        return translated
      }
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions