openAI已就绪,请输入你的问题
// ==UserScript== // @name chatGPT tools Plus ++ (cookie版) // @namespace http://tampermonkey.net/ // @version 1.3.1 // @description chatGPT Google&必应&百度侧边栏自定义搜索(免翻墙,cookie登录,极速版) // @author Onion // @match https://cn.bing.com/* // @match https://www.bing.com/* // @match https://chat.openai.com/chat // @match https://www.google.com/* // @match https://www.google.com.hk/* // @include /^https:\/\/www\.baidu\.com\/s\?wd.*$/ // @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com // @grant GM_xmlhttpRequest // @grant GM_addStyle // @require https://cdn.staticfile.org/jquery/3.4.0/jquery.min.js // @require https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js // @require https://cdn.jsdelivr.net/npm/marked@4.2.3/marked.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/markdown-it/13.0.1/markdown-it.min.js // @require https://unpkg.com/axios/dist/axios.min.js // @connect ip-api.com // @connect chat.openai.com // @connect gpt.chatapi.art // @license MIT // @resource css https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.1.0/github-markdown.css // @resource css https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/default.min.css // @require https://cdn.jsdelivr.net/npm/showdown@2.1.0/dist/showdown.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js // @downloadURL none // ==/UserScript== (function() { 'use strict'; // @require https://cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.8.0/highlightjs-line-numbers.min.js //重要声明:感谢隔壁作者:zhengbangbo (https://github.com/zhengbangbo/chat-gpt-userscript)的请求处理方式,之前一直不知道怎么处理SSE响应,原来直接就可以用一般的方式来接收,那么对返回数据处理切割就直接借鉴啦!(反正MIT不是嘛) //cookie 大家自己想办法弄到,别霍霍我了呜呜 //对返回结果增加了markdown解析成html //多亏了zhengbangbo大佬,现在已经解决这个策略问题了! //已经找到流处理方式,现在和插件版已经没有本质区别,速度优化到最快了 //顶级配置 //可以手动配置your_cookie! const your_cookie=getCookieObject().your_cookie const requestUrl = `https://chat.openai.com/backend-api/moderations` var your_qus var abortXml if (window.location.href.indexOf("bing.com") > -1) { getYourCookie() GM_add_box_style(0) addBothStyle() keyEvent() appendBox(0).then((res)=>{pivElemAddEventAndValue(0)}) linkToBing_beautification_script() } if (window.location.href.indexOf("www.google.com") > -1) { getYourCookie() GM_add_box_style(1) addBothStyle() keyEvent() appendBox(1).then((res)=>{pivElemAddEventAndValue(1)}) } if (window.location.href.indexOf("https://www.baidu.com/s?wd") > -1) { getYourCookie() GM_add_box_style(2) addBothStyle() keyEvent() appendBox(2).then((res)=>{pivElemAddEventAndValue(2)}) } if (window.location.href.indexOf("chat.openai.com") > -1) { //$.cookie('yourCookie','dumplings', {domain:'qq.com',path:'/'}); getYourCookie() console.log("httpOnly保护,没法拿到cookie,自己复制粘贴控制台") } //顶级函数 function uuid() { //uuid 产生 var s = []; var hexDigits = "0123456789abcdef"; for (var i = 0; i < 36; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); } s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 s[8] = s[13] = s[18] = s[23] = "-"; var uuid = s.join(""); return uuid; } function GM_add_box_style(case_web){ switch (case_web){ case 0://bing GM_addStyle(` #gptAnswer{ margin: 15px; border-top: solid; border-bottom: solid; } #gptInput{ width:74%; border-radius: 4px; } #gptInputBox{ display: flex; justify-content: space-around; } #button_GPT:hover{ background:#ffffffcc; } #gptDiv{ border-radius: 8px; padding: 10px; margin-bottom: 9px; width:452px; translate:-20px; background:#ffffffcc; backdrop-filter: blur(5px); display: flex; flex-direction: column; } #button_GPT{ } #button_GPT{ background: transparent; border-radius: 4px; } #gptCueBox{ translate: 3px; } `) break; case 1: //google GM_addStyle(` #gptAnswer{ margin: 15px; border-top: solid; border-bottom: solid; } #gptInput{ border-radius: 4px; width: 68%; } #button_GPT:hover{ background:#dcdcdccc; } #gptDiv{ flex: 1; display: flex; flex-direction: column; height: fit-content; } #gptInputBox{ display:flex; justify-content: space-around; } #button_GPT{ background: transparent; border-radius: 3px; font-size: 14px; } #gptStatus{ margin-left: 7px; } `) break;//baidu case 2:GM_addStyle(` #gptAnswer{ margin: 15px; border-top: solid; border-bottom: solid; } #gptInput{ border-radius: 4px; width: 68%; } #button_GPT:hover{ background:#dcdcdccc; } #gptDiv{ flex: 1; display: flex; flex-direction: column; height: fit-content; } #gptInputBox{ display:flex; justify-content: space-around; } #button_GPT{ background: transparent; border-radius: 3px; font-size: 14px; } #gptStatus{ margin-left: 7px; } `) break; default : alert("参数没设定") } } function do_it(){ if(!your_cookie){ document.getElementById('gptAnswer').innerHTML=`
  openAI 已就绪,请输入你的问题
  openAI已就绪,请输入你的问题