From eb81f65fab8630b68c8529cbcee6b5538bf0da32 Mon Sep 17 00:00:00 2001 From: josc146 Date: Tue, 31 Oct 2023 11:27:30 +0800 Subject: [PATCH] improve chatgpt web user guide --- src/_locales/de/main.json | 2 +- src/_locales/en/main.json | 2 +- src/_locales/es/main.json | 2 +- src/_locales/fr/main.json | 2 +- src/_locales/in/main.json | 2 +- src/_locales/it/main.json | 2 +- src/_locales/ja/main.json | 2 +- src/_locales/ko/main.json | 2 +- src/_locales/pt/main.json | 2 +- src/_locales/ru/main.json | 2 +- src/_locales/tr/main.json | 2 +- src/_locales/zh-hans/main.json | 2 +- src/_locales/zh-hant/main.json | 2 +- src/services/apis/chatgpt-web.mjs | 18 ++++++++++++++++-- 14 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/_locales/de/main.json b/src/_locales/de/main.json index 111041c..6bdb230 100644 --- a/src/_locales/de/main.json +++ b/src/_locales/de/main.json @@ -127,6 +127,6 @@ "Rate limit": "Rate-Limit erreicht", "Jump to bottom": "Zum Ende springen", "Explain": "Erklären", - "Failed to get arkose token, please keep https://chat.openai.com open": "Arkose-Token konnten nicht abgerufen werden. Bitte halten Sie https://chat.openai.com geöffnet", + "Failed to get arkose token.": "Arkose-Token konnte nicht abgerufen werden.", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Bitte halten Sie https://chat.openai.com geöffnet und versuchen Sie es erneut. Wenn es immer noch nicht funktioniert, geben Sie einige Zeichen in das Eingabefeld der ChatGPT-Webseite ein und versuchen Sie es erneut." } diff --git a/src/_locales/en/main.json b/src/_locales/en/main.json index 9c64fa7..c3cb71d 100644 --- a/src/_locales/en/main.json +++ b/src/_locales/en/main.json @@ -127,6 +127,6 @@ "Rate limit": "Rate limit exceeded", "Jump to bottom": "Jump to bottom", "Explain": "Explain", - "Failed to get arkose token, please keep https://chat.openai.com open": "Failed to get arkose token, please keep https://chat.openai.com open", + "Failed to get arkose token.": "Failed to get arkose token.", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again." } diff --git a/src/_locales/es/main.json b/src/_locales/es/main.json index 127f4fc..1932260 100644 --- a/src/_locales/es/main.json +++ b/src/_locales/es/main.json @@ -127,6 +127,6 @@ "Rate limit": "Límite de velocidad alcanzado", "Jump to bottom": "Saltar al final", "Explain": "Explicar", - "Failed to get arkose token, please keep https://chat.openai.com open": "No se pudo obtener el token de arkose, por favor mantenga https://chat.openai.com abierto", + "Failed to get arkose token.": "No se pudo obtener el token de arkose.", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Por favor, mantenga https://chat.openai.com abierto e inténtelo de nuevo. Si aún no funciona, escriba algunos caracteres en el cuadro de entrada de la página web de chatgpt e inténtelo de nuevo." } diff --git a/src/_locales/fr/main.json b/src/_locales/fr/main.json index 6c9c207..b663ab7 100644 --- a/src/_locales/fr/main.json +++ b/src/_locales/fr/main.json @@ -127,6 +127,6 @@ "Rate limit": "Limite de taux atteinte", "Jump to bottom": "Aller en bas", "Explain": "Expliquer", - "Failed to get arkose token, please keep https://chat.openai.com open": "Impossible d'obtenir le jeton arkose, veuillez garder https://chat.openai.com ouvert", + "Failed to get arkose token.": "Échec de l'obtention du jeton arkose.", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Veuillez garder https://chat.openai.com ouvert et réessayer. Si cela ne fonctionne toujours pas, tapez quelques caractères dans la boîte de saisie de la page web chatgpt et réessayez." } diff --git a/src/_locales/in/main.json b/src/_locales/in/main.json index cf877db..a373796 100644 --- a/src/_locales/in/main.json +++ b/src/_locales/in/main.json @@ -127,6 +127,6 @@ "Rate limit": "Batas penggunaan terlampaui", "Jump to bottom": "Lompat ke bawah", "Explain": "Jelaskan", - "Failed to get arkose token, please keep https://chat.openai.com open": "Gagal mendapatkan token arkose, harap tetap buka https://chat.openai.com", + "Failed to get arkose token.": "Gagal mendapatkan token arkose.", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Harap tetap buka https://chat.openai.com dan coba lagi. Jika masih tidak berhasil, ketik beberapa karakter di kotak masukan halaman web chatgpt dan coba lagi." } diff --git a/src/_locales/it/main.json b/src/_locales/it/main.json index 1022a2e..cf20d4e 100644 --- a/src/_locales/it/main.json +++ b/src/_locales/it/main.json @@ -127,6 +127,6 @@ "Rate limit": "Limite di frequenza delle richieste raggiunto", "Jump to bottom": "Salta in fondo", "Explain": "Spiega", - "Failed to get arkose token, please keep https://chat.openai.com open": "Impossibile ottenere il token arkose, per favore mantieni aperto https://chat.openai.com", + "Failed to get arkose token.": "Impossibile ottenere il token arkose", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Per favore, mantieni aperto https://chat.openai.com e riprova. Se ancora non funziona, digita alcuni caratteri nella casella di input della pagina web di chatgpt e riprova." } diff --git a/src/_locales/ja/main.json b/src/_locales/ja/main.json index 97271b6..689fdab 100644 --- a/src/_locales/ja/main.json +++ b/src/_locales/ja/main.json @@ -127,6 +127,6 @@ "Rate limit": "レート制限", "Jump to bottom": "最下部にジャンプ", "Explain": "説明", - "Failed to get arkose token, please keep https://chat.openai.com open": "arkoseトークンを取得できませんでした。https://chat.openai.com を開いたままにしてください", + "Failed to get arkose token.": "arkoseトークンの取得に失敗しました。", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "https://chat.openai.com を開いたままにして、もう一度試してください。それでもうまくいかない場合は、chatgpt webページの入力ボックスにいくつかの文字を入力してからもう一度試してください。" } diff --git a/src/_locales/ko/main.json b/src/_locales/ko/main.json index 57ebbab..da8a3cc 100644 --- a/src/_locales/ko/main.json +++ b/src/_locales/ko/main.json @@ -127,6 +127,6 @@ "Rate limit": "요청 비율 제한", "Jump to bottom": "아래로 이동", "Explain": "설명", - "Failed to get arkose token, please keep https://chat.openai.com open": "arkose 토큰을 가져오지 못했습니다. https://chat.openai.com 을 열어두세요.", + "Failed to get arkose token.": "arkose 토큰을 가져오지 못했습니다.", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "https://chat.openai.com 을 열어두고 다시 시도하세요. 여전히 작동하지 않으면 chatgpt 웹 페이지의 입력 상자에 몇 가지 문자를 입력한 다음 다시 시도하세요." } diff --git a/src/_locales/pt/main.json b/src/_locales/pt/main.json index 3600d67..e729bc5 100644 --- a/src/_locales/pt/main.json +++ b/src/_locales/pt/main.json @@ -127,6 +127,6 @@ "Rate limit": "Limite de taxa atingido", "Jump to bottom": "Ir para o fundo", "Explain": "Explicar", - "Failed to get arkose token, please keep https://chat.openai.com open": "Falha ao obter o token arkose, por favor, mantenha https://chat.openai.com aberto", + "Failed to get arkose token.": "Falha ao obter o token arkose.", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Por favor, mantenha https://chat.openai.com aberto e tente novamente. Se ainda não funcionar, digite alguns caracteres na caixa de entrada da página da web do chatgpt e tente novamente." } diff --git a/src/_locales/ru/main.json b/src/_locales/ru/main.json index 3a8fc66..98af461 100644 --- a/src/_locales/ru/main.json +++ b/src/_locales/ru/main.json @@ -127,6 +127,6 @@ "Rate limit": "Лимит запросов", "Jump to bottom": "Перейти вниз", "Explain": "Объяснить", - "Failed to get arkose token, please keep https://chat.openai.com open": "Не удалось получить токен arkose, пожалуйста, оставьте открытым https://chat.openai.com", + "Failed to get arkose token.": "Не удалось получить токен arkose.", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Пожалуйста, оставьте открытым https://chat.openai.com и попробуйте еще раз. Если это все еще не работает, введите несколько символов в поле ввода веб-страницы chatgpt и попробуйте еще раз." } diff --git a/src/_locales/tr/main.json b/src/_locales/tr/main.json index 57db7cf..5523b4f 100644 --- a/src/_locales/tr/main.json +++ b/src/_locales/tr/main.json @@ -127,6 +127,6 @@ "Rate limit": "Hız sınırı aşıldı", "Jump to bottom": "En alta git", "Explain": "Açıkla", - "Failed to get arkose token, please keep https://chat.openai.com open": "Arkose jetonu alınamadı, lütfen https://chat.openai.com adresini açık tutun", + "Failed to get arkose token.": "Arkose jetonu alınamadı.", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Lütfen https://chat.openai.com adresini açık tutun ve tekrar deneyin. Hala çalışmazsa, chatgpt web sayfasının girdi kutusuna bazı karakterler yazın ve tekrar deneyin." } diff --git a/src/_locales/zh-hans/main.json b/src/_locales/zh-hans/main.json index c586b00..8e292a8 100644 --- a/src/_locales/zh-hans/main.json +++ b/src/_locales/zh-hans/main.json @@ -127,6 +127,6 @@ "Rate limit": "请求频率过高", "Jump to bottom": "跳转到底部", "Explain": "解释", - "Failed to get arkose token, please keep https://chat.openai.com open": "获取arkose token失败, 请保持 https://chat.openai.com 打开", + "Failed to get arkose token.": "获取arkose token失败.", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "请保持 https://chat.openai.com 打开并重试. 如果仍然不起作用, 请在chatgpt网页的输入框中输入一些字符, 然后再试一次." } diff --git a/src/_locales/zh-hant/main.json b/src/_locales/zh-hant/main.json index d6d6f8d..3f257f6 100644 --- a/src/_locales/zh-hant/main.json +++ b/src/_locales/zh-hant/main.json @@ -127,6 +127,6 @@ "Rate limit": "請求太頻繁,超過限制次數", "Jump to bottom": "轉跳至底部", "Explain": "解釋", - "Failed to get arkose token, please keep https://chat.openai.com open": "無法取得 arkose token,請保持 https://chat.openai.com 開啟", + "Failed to get arkose token.": "無法取得 arkose token.", "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "請保持 https://chat.openai.com 開啟並重試,如果還是無法通過驗證,請在 ChatGPT 網頁版輸入框輸入一些文字後再重試" } diff --git a/src/services/apis/chatgpt-web.mjs b/src/services/apis/chatgpt-web.mjs index 72e0470..159cb18 100644 --- a/src/services/apis/chatgpt-web.mjs +++ b/src/services/apis/chatgpt-web.mjs @@ -6,6 +6,7 @@ import { chatgptWebModelKeys, getUserConfig, Models } from '../../config/index.m import { pushRecord, setAbortController } from './shared.mjs' import Browser from 'webextension-polyfill' import { v4 as uuidv4 } from 'uuid' +import { t } from 'i18next' async function request(token, method, path, data) { const apiUrl = (await getUserConfig()).customChatGptWebApiUrl @@ -83,7 +84,14 @@ export async function generateAnswersWithChatgptWebApi(port, question, session, }) .join('; ') - if (!config.chatgptArkoseReqUrl) throw new Error('Please login at https://chat.openai.com first') + if (!config.chatgptArkoseReqUrl) + throw new Error( + t('Please login at https://chat.openai.com first') + + '\n\n' + + t( + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.", + ), + ) const arkoseToken = await fetch( config.chatgptArkoseReqUrl + '?' + config.chatgptArkoseReqParams, { @@ -98,7 +106,13 @@ export async function generateAnswersWithChatgptWebApi(port, question, session, .then((resp) => resp.token) .catch(() => null) if (!arkoseToken) - throw new Error('Failed to get arkose token, please keep https://chat.openai.com open') + throw new Error( + t('Failed to get arkose token.') + + '\n\n' + + t( + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.", + ), + ) let answer = '' await fetchSSE(`${config.customChatGptWebApiUrl}${config.customChatGptWebApiPath}`, { method: 'POST',