DeepSeek 心肺复苏
// ==UserScript==
// @name DeepSeek 心肺复苏
// @namespace http://tampermonkey.net/
// @version 2.0
// @description 直接拦截 DeepSeek API,恢复被屏蔽的完整原文,并提供切换按钮
// @author 你
// @match https://chat.deepseek.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
let oldOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (...args) {
this.___url = args[1];
if (this.___url.indexOf('completion') !== -1) {
this.addEventListener("progress", function hook(...args) {
if (this.response.indexOf('content_filter') !== -1) {
const list = this.response.split(`\n`);
let ans = []
for (let index = 0; index < list.length; index++) {
let str = list[index];
if (str.indexOf('content_filter') !== -1) {
str = `data: {"choices":[{"finish_reason":"stop","index":0,"delta":{"content":"","type":"text","role":"assistant"}}],"model":"","chunk_token_usage":0,"created":1738494592,"message_id":29,"parent_id":28}`
debugger
}
ans.push(str)
}
ans = ans.join('\n')
Object.defineProperty(this, "response", {
get: () => {
return ans;
},
});
Object.defineProperty(this, "responseText", {
get: () => {
return ans;
},
});
}
this.callback?.forEach((item) => {
item.call(this, ...args)
})
})
this._addEventListener = this.addEventListener
this.addEventListener = function (...args) {
if (args[0] == "progress") {
if (this.callback == undefined) {
this.callback = []
}
this.callback.push(args[1])
}
return this._addEventListener.call(this, ...args)
}
}
return oldOpen.call(this, ...args);
};
let oldSend = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send = function () {
return oldSend.apply(this, arguments);
};