chatgpt-alive

Lightweight and effective solution for the ChatGPT disconnection issue requiring page refresh.

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

  1. // ==UserScript==
  2. // @name chatgpt-alive
  3. // @name:zh-CN chatgpt-alive
  4. // @namespace https://github.com/scout9ll/chatgpt-alive-extension
  5. // @version 0.1.2
  6. // @description Lightweight and effective solution for the ChatGPT disconnection issue requiring page refresh.
  7. // @description:zh-cn 轻量有效的解决chatgpt断连需要刷新页面的问题
  8. // @author scout9ll
  9. // @match https://chat.openai.com/*
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
  11. // @grant none
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. const iframe = document.createElement("iframe");
  18. iframe.style.display = "none";
  19. document.body.appendChild(iframe);
  20. const heartbeatUrl = "/api/auth/session";
  21. const gapRange = [50000, 200000];
  22. function hiChatgpt() {
  23. setTimeout(() => {
  24. fetch(heartbeatUrl)
  25. .then((res) => {
  26. if (!res.ok) iframe.src = "/404";
  27. })
  28. .finally(() => {
  29. hiChatgpt();
  30. });
  31. }, Math.random() * (gapRange[1] - gapRange[0]) + gapRange[0]);
  32. }
  33. hiChatgpt();
  34. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址