Enable ChatGPT Mobile

在桌面浏览器上启用ChatGPT移动版本

当前为 2023-06-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Enable ChatGPT Mobile
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.0
  5. // @license MIT
  6. // @author CY Fung
  7. // @match https://chat.openai.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
  9. // @grant unsafeWindow
  10. // @run-at document-start
  11.  
  12. // @description To enable mobile version of ChatGPT in desktop browsers
  13. // @description:ja デスクトップブラウザでChatGPTモバイル版を有効にする
  14. // @description:zh-TW 在桌面瀏覽器上啟用ChatGPT行動版
  15. // @description:zh-CN 在桌面浏览器上启用ChatGPT移动版本
  16.  
  17. // @description:ko 데스크톱 브라우저에서 ChatGPT 모바일 버전 활성화
  18. // @description:ru Включение мобильной версии ChatGPT в браузерах для компьютера
  19. // @description:af Aktiveer ChatGPT Mobile op rekenaarblaaier
  20. // @description:az Masaüstü brauzerlərdə ChatGPT Mobile versiyasını aktivləşdirin
  21. // @description:id Mengaktifkan versi mobile ChatGPT di browser desktop
  22. // @description:ms Mengaktifkan versi mudah alih ChatGPT di pelayar desktop
  23. // @description:bs Aktivirajte mobilnu verziju ChatGPT-a u desktop preglednicima
  24. // @description:ca Activar la versió mòbil de ChatGPT en navegadors d'escriptori
  25. // @description:cs Povolení mobilní verze ChatGPT v desktopových prohlížečích
  26. // @description:da Aktivér mobilversionen af ChatGPT i desktop-browsere
  27. // @description:de Aktivieren Sie die mobile Version von ChatGPT in Desktop-Browsern
  28. // @description:et Luba ChatGPT mobiiliversioon töölauabrauserites
  29. // @description:es Habilitar la versión móvil de ChatGPT en navegadores de escritorio
  30. // @description:eu Gaitu ChatGPT Mobile-ren bertsioa mahaigaineko nabigatzaileetan
  31. // @description:fr Activer la version mobile de ChatGPT dans les navigateurs de bureau
  32. // @description:gl Activar a versión móbil de ChatGPT nos navegadores de escritorio
  33. // @description:hr Omogućite mobilnu verziju ChatGPT-a u preglednicima za stolna računala
  34. // @description:zu Vumela ukuqalisa i-versi ye-ChatGPT Mobile kumakhompyutha we-deskithophu
  35. // @description:is Virkjaðu ChatGPT Mobile-útgáfu í tölvuvafrum
  36. // @description:it Attiva la versione mobile di ChatGPT nei browser per desktop
  37. // @description:sw Wezesha toleo la ChatGPT Mobile kwenye vivinjari vya kompyuta
  38. // @description:lv Iespējot ChatGPT Mobile versiju datora pārlūkprogrammās
  39. // @description:lt Įgalinkite „ChatGPT Mobile“ versiją darbalaukio naršyklėse
  40. // @description:hu Engedélyezze a ChatGPT Mobile verziót asztali böngészőkben
  41. // @description:nl Schakel de mobiele versie van ChatGPT in op desktopbrowsers
  42. // @description:uz Desktop brauzerlarda ChatGPT Mobile versiyasini yoqish
  43. // @description:pl Włącz wersję mobilną ChatGPT w przeglądarkach na komputery
  44. // @description:pt Ative a versão móvel do ChatGPT nos navegadores de desktop
  45. // @description:pt-BR Ative a versão móvel do ChatGPT em navegadores de desktop
  46. // @description:ro Activează versiunea mobilă ChatGPT în browserele de pe desktop
  47. // @description:sq Aktivizo versionin mobile të ChatGPT në shfletuesit e desktopit
  48. // @description:sk Povoliť mobilnú verziu ChatGPT v desktopových prehliadačoch
  49. // @description:sl Omogočite mobilno različico ChatGPT v namiznih brskalnikih
  50. // @description:sr Активирајте мобилну верзију ChatGPT-а у десктоп прегледачима
  51. // @description:fi Ota käyttöön ChatGPT Mobile -versio työpöytäselaimissa
  52. // @description:sv Aktivera mobila versionen av ChatGPT i skrivbordswebbläsare
  53. // @description:vi Kích hoạt phiên bản di động của ChatGPT trên trình duyệt máy tính
  54. // @description:tr Masaüstü tarayıcılarda ChatGPT Mobile sürümünü etkinleştirin
  55. // @description:be Уключыць мабільную версію ChatGPT у настольных браўзерах
  56. // @description:bg Активиране на мобилната версия на ChatGPT в десктоп браузъри
  57. // @description:ky Стол таракчаларында ChatGPT Mobile версиясын иштетүү
  58. // @description:kk Столтік шолғыштарда ChatGPT Mobile нұсқасын қосу
  59. // @description:mk Овозможи мобилна верзија на ChatGPT во десктоп прелистувачи
  60. // @description:mn Дэскутоп браузерд ChatGPT Mobile ихэвчлэн ашиглах
  61. // @description:uk Увімкнути мобільну версію ChatGPT у браузерах для робочого столу
  62. // @description:el Ενεργοποίηση της κινητής έκδοσης του ChatGPT σε προγράμματα περιήγησης επιφάνειας εργασίας
  63. // @description:hy Միացնել ChatGPT բջջային տարբերակը աշխատանքային ժամանցման զննարկիչներում
  64. // @description:ur ڈیسک ٹاپ براؤزرز میں چیٹ جی پی ٹی موبائل کو فعال کریں
  65. // @description:ar تمكين نسخة ChatGPT المحمول في متصفحات سطح المكتب
  66. // @description:fa فعال کردن نسخه تلفن همراه ChatGPT در مرورگرهای دسکتاپ
  67. // @description:ne डेस्कटप ब्राउजरहरूमा ChatGPT मोबाइल सक्षम गर्नुहोस्
  68. // @description:mr डेस्कटॉप ब्राउझरमध्ये ChatGPT मोबाईल सक्षम करा
  69. // @description:hi डेस्कटॉप ब्राउज़रों में ChatGPT मोबाइल सक्षम करें
  70. // @description:as ডেক্সটপ ব্ৰাউজাৰত ChatGPT মোবাইল সক্ৰিয় কৰক
  71. // @description:bn ডেস্কটপ ব্রাউজারে ChatGPT মোবাইল সক্রিয় করুন
  72. // @description:pa ਡੈਸਕਟਾਪ ਬਰਾ browserਜ਼ਰ 'ਤੇ ਚੈਟਜੀਪੀਟੀ ਮੋਬਾਈਲ ਯੋਗ ਕਰੋ
  73. // @description:gu ડેસ્કટોપ બ્રાઉઝરમાં ChatGPT મોબાઇલ સક્રિય કરો
  74. // @description:or ଡେସ୍କଟପ ବ୍ରାଉଜରରେ ChatGPT ମୋବାଇଲ ସକ୍ରିୟ କରନ୍ତୁ
  75. // @description:ta மேல இணைய உலாவிகளில் ChatGPT மொபைல் பதிப்பை இயக்க
  76. // @description:te డెస్క్‌టాప్ బ్రౌజర్‌లో ChatGPT మొబైల్ వెర్షన్‌ను ప్రారంభించండి
  77. // @description:kn ಡೆಸ್ಕ್‌ಟಾಪ್ ಬ್ರೌಸರ್‌ಗಳಲ್ಲಿ ChatGPT ಮೊಬೈಲ್ ಆವೃತ್ತಿಯನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಿ
  78. // @description:ml ഡെസ്ക്ടോപ് ബ്രൌസറുകളിൽ ChatGPT മൊബൈൽ പതിപ്പ് പ്രവർത്തനമാക്കുക
  79. // @description:si ඩෙස්ක්ටොප් බ්‍රවුසර් වල ChatGPT ජංගම අනුවාදය සක්‍රීය කරන්න
  80. // @description:th เปิดใช้งาน ChatGPT บนมือถือในเบราว์เซอร์เดสก์ท็อป
  81. // @description:lo ເປີດໃຊ້ ChatGPT ສະບັບມືຖືໃນໂປຣແກຣມທ່ອງເວັບໃນຄອມພິວເຕີ
  82. // @description:my ဒက်စ်တော့ဘရောင်ဇာများတွင် ChatGPT မိုဘိုင်းဗားရှင်းကို ဖွင့်ရန်
  83. // @description:ka ჩართეთ ChatGPT Mobile სამუშაო ბრაუზერებში
  84. // @description:am በዴስክቶፕ ብራውዘሮች ውስጥ ChatGPT ተቀናቃኝ ስሪትን አብረውው
  85. // @description:km បើក ChatGPT កំណែទូរស័ព្ទលើកម្មវិធីរុករកលើផ្ទៃតុ
  86.  
  87.  
  88. // ==/UserScript==
  89.  
  90. (() => {
  91. "use strict";
  92.  
  93. const REPLACE_DESKTOP_MODELS = false;
  94.  
  95. const mzs = [{
  96. // category: "other",
  97. desktop: "text-davinci-002-render-sha",
  98. mobile: "text-davinci-002-render-sha-mobile",
  99. human_category_name_mobile: "GPT-3.5-M"
  100. }, {
  101. // category: "other",
  102. desktop: "gpt-4",
  103. mobile: "gpt-4-mobile",
  104. human_category_name_mobile: "GPT-4-M"
  105. }];
  106.  
  107. const gptModels = {}
  108. for (const mz of mzs) {
  109. gptModels[mz.mobile] = {
  110. human_category_name: mz.human_category_name_mobile,
  111. default_model: mz.mobile
  112. };
  113. }
  114.  
  115. /** @type {globalThis.Window} */
  116. const win = typeof unsafeWindow === 'object' ? unsafeWindow : typeof window === 'object' ? window : this;
  117.  
  118.  
  119. /**
  120. * @typedef Category
  121. * @type {object}
  122. * @property {string} category
  123. * @property {string} human_category_name
  124. * @property {string} subscription_level
  125. * @property {string} default_model
  126. * @property {string} browsing_model
  127. * @property {string} code_interpreter_model
  128. * @property {string} plugins_model
  129. */
  130.  
  131. /**
  132. * @typedef Model
  133. * @type {object}
  134. * @property {string} slug
  135. * @property {number} max_tokens
  136. * @property {string} title
  137. * @property {string} description
  138. * @property {string[]} tags
  139. * @property {object} capabilities
  140. */
  141.  
  142. /**
  143. * @typedef JsonRes
  144. * @type {object}
  145. * @property {Category[]} categories
  146. * @property {Model[]} models
  147. */
  148.  
  149.  
  150. ((Response) => {
  151.  
  152. Response.prototype.__json7942__ = Response.prototype.json;
  153. Response.prototype.json = function () {
  154.  
  155. /** @type {globalThis.Response} */
  156. const __this__ = this;
  157. /** @type {Promise<any>} */
  158. let jsonPromise = __this__.__json7942__.apply(__this__, arguments);
  159.  
  160. jsonPromise = jsonPromise.then(__jsonRes__ => {
  161.  
  162.  
  163. if (((__jsonRes__ || 0).categories || 0).length >= 1 && ((__jsonRes__ || 0).models || 0).length >= 1) {
  164.  
  165.  
  166. try {
  167. /** @type {JsonRes} */
  168. const jsonRes = __jsonRes__;
  169.  
  170. const categories = [...jsonRes.categories];
  171. let add_gpt_4_mobile = false;
  172. let add_gpt_3_mobile = false;
  173.  
  174. /** @type {Map<string, Category>} */
  175. const default_models = new Map();
  176. for (const cat of categories) {
  177. default_models.set(`${cat.default_model}`, cat);
  178. }
  179.  
  180. /** @type {Map<string, Model>} */
  181. const availableModels = new Map();
  182. for (const model of jsonRes.models) {
  183. availableModels.set(`${model.slug}`, model);
  184. }
  185.  
  186. const b = (d, m) => (default_models.has(d) && !default_models.has(m) && availableModels.has(d) && availableModels.has(m));
  187.  
  188. let gpt3 = mzs[0];
  189. let gpt4 = mzs[1];
  190. if (b(gpt3.desktop, gpt3.mobile)) add_gpt_3_mobile = true;
  191. if (b(gpt4.desktop, gpt4.mobile)) add_gpt_4_mobile = true;
  192.  
  193. if (add_gpt_3_mobile) {
  194. REPLACE_DESKTOP_MODELS
  195. ? Object.assign(default_models.get(gpt3.desktop), gptModels[gpt3.mobile])
  196. : categories.push(Object.assign({}, default_models.get(gpt3.desktop), gptModels[gpt3.mobile]));
  197. }
  198. if (add_gpt_4_mobile) {
  199. REPLACE_DESKTOP_MODELS
  200. ? Object.assign(default_models.get(gpt4.desktop), gptModels[gpt4.mobile])
  201. : categories.push(Object.assign({}, default_models.get(gpt4.desktop), gptModels[gpt4.mobile]));
  202. }
  203.  
  204. jsonRes.categories = categories;
  205.  
  206. } catch (e) {
  207. console.warn(e);
  208. }
  209.  
  210. }
  211.  
  212. return __jsonRes__;
  213.  
  214. });
  215. return jsonPromise;
  216.  
  217. };
  218. })(win.Response)
  219.  
  220. })();