Các vấn đề thường gặpKhông thể giải mã JSON phản hồi từ dịch vụ AI
Không thể giải mã JSON phản hồi từ dịch vụ AI
Gato AI Translations for Polylang gửi một prompt đến dịch vụ AI, và phản hồi trả về ở định dạng JSON.
Tùy thuộc vào dữ liệu bạn gửi đi (các chuỗi cần dịch và ngôn ngữ), dịch vụ AI có thể tạo ra phản hồi không phải là JSON hợp lệ. Nhật ký sẽ hiển thị thông báo lỗi như sau:
Error [Query "translate-customposts"] Execution with errors: 🔴 Translation to zh_CN failed - There was an error requesting data from the API for provider 'OpenRouter': Could not JSON-decode the OpenRouter API's 'choices[0].message.content' field in the responseBất cứ khi nào chúng tôi phát hiện vấn đề mới, chúng tôi sẽ điều chỉnh prompt để ngăn nó xảy ra lại.
Hiện tại, prompt chứa nội dung sau:
If a sentence contains HTML:
- Translate the text inside the HTML tags. (eg: `<p>Hello world</p>` => `<p>Hola mundo</p>`)
- Translate the following properties inside the HTML tags: alt, title, placeholder, aria-label, aria-describedby, aria-labelledby, aria-placeholder. Do not translate any other property.
- Ensure that any double quotes (") within a translated string inside an HTML tag attribute are properly escaped by adding a backslash before them (\"), but only if they haven't been escaped already.
- Ensure that the quotes in HTML tag attributes are not escaped (eg: keep `<mark class="has-inline-color">` as is, do not convert to `<mark class=\"has-inline-color\">`).
- Ensure that slashes within HTML tags are not escaped (eg: keep `<p>Hello world</p>` as is, do not convert to `<p>Hello world<\/p>`).
Keep emojis exactly as they are, do not translate them.
Ensure that the response is encoded using UTF-8 for all characters.Nếu bạn gặp lỗi, đó là vấn đề mới mà chúng tôi cần xác định và khắc phục.
Hãy thực hiện như sau:
- Cố gắng hiểu vấn đề là gì
- Tùy chỉnh prompt để giải quyết vấn đề
Khi đã hoạt động được, hãy gửi prompt của bạn cho chúng tôi, và chúng tôi sẽ tích hợp giải pháp đó trực tiếp vào plugin.