ChatGPT默认为GPT4

ChatGPT switch The default is GPT4

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

  1. // ==UserScript==
  2. // @name ChatGPT is GPT4 by default
  3. // @name:zh-CN ChatGPT默认为GPT4
  4. // @description ChatGPT switch The default is GPT4
  5. // @description:zh-cn ChatGPT切换默认为GPT4
  6. // @version 0.0.1
  7. // @match https://chat.openai.com/
  8. // @match https://chat.openai.com/c?*
  9. // @match https://chat.openai.com/c/*
  10. // @license MIT
  11. // @namespace https://greasyfork.org/users/562260
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. 'use strict';
  16. const DEFAULT_PATH = '/'
  17. const switchGPT4 = () => {
  18. function clickButtonByTextContent(textContent) {
  19. const buttons = document.getElementsByTagName('button');
  20. for (let button of buttons) {
  21. if (button.textContent === textContent) {
  22. button.click();
  23. return;
  24. }
  25. }
  26. }
  27.  
  28. function clickListItemByTextContent(textContent) {
  29. const listItems = document.getElementsByTagName('li');
  30. for (let listItem of listItems) {
  31. if (listItem.textContent === textContent) {
  32. listItem.click();
  33. return;
  34. }
  35. }
  36. }
  37.  
  38. clickButtonByTextContent('ModelDefault (GPT-3.5)');
  39. setTimeout(() => clickListItemByTextContent('GPT-4'), 0);
  40. }
  41.  
  42. const addEvent = () => {
  43. const originalPush = window.history.pushState;
  44. window.history.pushState = function () {
  45. const url = arguments[2]
  46. if (url === DEFAULT_PATH) {
  47. setTimeout(switchGPT4, 100)
  48. }
  49. return originalPush.apply(this, arguments);
  50. };
  51. }
  52. addEvent()
  53. })();
  54.  
  55.  
  56.