深度搜索特性

复制OpenAI的ChatGPT特性功能,默认无操作,需通过用户脚本配置

  1. // ==UserScript==
  2. // @name DeepSeek Traits
  3. // @name:zh-CN 深度搜索特性
  4. // @namespace http://tampermonkey.net/
  5. // @version 2025-01-24
  6. // @description A recreation of OpenAI's ChatGPT Traits feature. By default does nothing. Configure via userscript.
  7. // @description:zh-CN 复制OpenAI的ChatGPT特性功能,默认无操作,需通过用户脚本配置
  8. // @author https://github.com/xskutsu
  9. // @match *://*.deepseek.com/*
  10. // @grant GM_registerMenuCommand
  11. // @grant GM_getValue
  12. // @grant GM_setValue
  13. // @icon https://www.google.com/s2/favicons?sz=64&domain=deepseek.com
  14. // @license MIT
  15. // ==/UserScript==
  16.  
  17. (function () {
  18. "use strict";
  19. const locale = {
  20. en: {
  21. set: "Set DeepSeek Traits",
  22. clear: "Clear DeepSeek Traits",
  23. prompt: "Enter traits for DeepSeek:",
  24. updated: "Traits Updated!",
  25. confirm: "Are you sure you want to clear DeepSeek Traits?",
  26. cleared: "Traits cleared!",
  27. instruct: "When you respond to this message by the user, please follow these DeepSeek Traits (instructions, guidelines, desires) provided by the user: "
  28. },
  29. zh: {
  30. set: "设置DeepSeek特性",
  31. clear: "清除DeepSeek特性",
  32. prompt: "输入DeepSeek的特性:",
  33. updated: "特性已更新!",
  34. confirm: "确定要清除DeepSeek特性吗?",
  35. cleared: "特性已清除!",
  36. instruct: "当您回复用户的此消息时,请遵循用户提供的这些DeepSeek特质(指示、指南、需求):"
  37. }
  38. };
  39. const t = locale[navigator.language.startsWith('zh') ? 'zh' : 'en'];
  40.  
  41. let DeepSeekTraits = GM_getValue("traits", "");
  42.  
  43. GM_registerMenuCommand(t.set, function () {
  44. const traits = prompt(t.prompt, GM_getValue("traits", "")).trim().replace(/[\n\r\t]/gm, "");
  45. if (traits.length !== 0) {
  46. GM_setValue("traits", traits);
  47. DeepSeekTraits = traits;
  48. alert(t.updated);
  49. }
  50. });
  51.  
  52. GM_registerMenuCommand(t.clear, function () {
  53. if (confirm(t.confirm)) {
  54. GM_setValue("traits", "");
  55. DeepSeekTraits = "";
  56. alert(t.cleared);
  57. }
  58. });
  59.  
  60. function isJson(str) {
  61. try {
  62. JSON.parse(str);
  63. } catch (e) {
  64. return false;
  65. }
  66. return true;
  67. }
  68.  
  69. const originalSend = XMLHttpRequest.prototype.send;
  70. XMLHttpRequest.prototype.send = function(body, ...args) {
  71. if (isJson(body) && DeepSeekTraits.length !== 0) {
  72. const data = JSON.parse(body);
  73. if (data.hasOwnProperty("prompt")) {
  74. data.prompt = `${t.instruct}"${DeepSeekTraits}"\n\nUser:\n${data.prompt}`;
  75. body = JSON.stringify(data);
  76. }
  77. }
  78. originalSend.call(this, body, ...args);
  79. };
  80. })();

QingJ © 2025

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