settings.example.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. export default {
  2. // Options for the Keyv cache, see https://www.npmjs.com/package/keyv.
  3. // This is used for storing conversations, and supports additional drivers (conversations are stored in memory by default).
  4. // Only necessary when using `ChatGPTClient`, or `BingAIClient` in jailbreak mode.
  5. cacheOptions: {},
  6. // If set, `ChatGPTClient` and `BingAIClient` will use `keyv-file` to store conversations to this JSON file instead of in memory.
  7. // However, `cacheOptions.store` will override this if set
  8. storageFilePath: process.env.STORAGE_FILE_PATH || './cache.json',
  9. chatGptClient: {
  10. // Your OpenAI API key (for `ChatGPTClient`)
  11. openaiApiKey: process.env.OPENAI_API_KEY || '',
  12. // (Optional) Support for a reverse proxy for the completions endpoint (private API server).
  13. // Warning: This will expose your `openaiApiKey` to a third party. Consider the risks before using this.
  14. // reverseProxyUrl: 'https://chatgpt.hato.ai/completions',
  15. // (Optional) Parameters as described in https://platform.openai.com/docs/api-reference/completions
  16. modelOptions: {
  17. // You can override the model name and any other parameters here.
  18. // The default model is `gpt-3.5-turbo`.
  19. model: 'gpt-3.5-turbo',
  20. // Set max_tokens here to override the default max_tokens of 1000 for the completion.
  21. // max_tokens: 1000,
  22. },
  23. // (Optional) Davinci models have a max context length of 4097 tokens, but you may need to change this for other models.
  24. // maxContextTokens: 4097,
  25. // (Optional) You might want to lower this to save money if using a paid model like `text-davinci-003`.
  26. // Earlier messages will be dropped until the prompt is within the limit.
  27. // maxPromptTokens: 3097,
  28. // (Optional) Set custom instructions instead of "You are ChatGPT...".
  29. // (Optional) Set a custom name for the user
  30. // userLabel: 'User',
  31. // (Optional) Set a custom name for ChatGPT ("ChatGPT" by default)
  32. // chatGptLabel: 'Bob',
  33. // promptPrefix: 'You are Bob, a cowboy in Western times...',
  34. // A proxy string like "http://<ip>:<port>"
  35. proxy: '',
  36. // (Optional) Set to true to enable `console.debug()` logging
  37. debug: false,
  38. },
  39. // Options for the Bing client
  40. bingAiClient: {
  41. // Necessary for some people in different countries, e.g. China (https://cn.bing.com)
  42. host: '',
  43. // The "_U" cookie value from bing.com
  44. userToken: '',
  45. // If the above doesn't work, provide all your cookies as a string instead
  46. cookies: '',
  47. // A proxy string like "http://<ip>:<port>"
  48. proxy: '',
  49. // (Optional) Set 'x-forwarded-for' for the request. You can use a fixed IPv4 address or specify a range using CIDR notation,
  50. // and the program will randomly select an address within that range. The 'x-forwarded-for' is not used by default now.
  51. // xForwardedFor: '13.104.0.0/14',
  52. // (Optional) Set 'genImage' to true to enable bing to create images for you. It's disabled by default.
  53. // features: {
  54. // genImage: true,
  55. // },
  56. // (Optional) Set to true to enable `console.debug()` logging
  57. debug: false,
  58. },
  59. chatGptBrowserClient: {
  60. // (Optional) Support for a reverse proxy for the conversation endpoint (private API server).
  61. // Warning: This will expose your access token to a third party. Consider the risks before using this.
  62. reverseProxyUrl: 'https://bypass.churchless.tech/api/conversation',
  63. // Access token from https://chat.openai.com/api/auth/session
  64. accessToken: '',
  65. // Cookies from chat.openai.com (likely not required if using reverse proxy server).
  66. cookies: '',
  67. // A proxy string like "http://<ip>:<port>"
  68. proxy: '',
  69. // (Optional) Set to true to enable `console.debug()` logging
  70. debug: false,
  71. },
  72. // Options for the API server
  73. apiOptions: {
  74. port: process.env.API_PORT || 3000,
  75. host: process.env.API_HOST || '0.0.0.0',
  76. encryptKey: process.env.ENCRYPT_KEY || '123', // 数据传输对称加密key
  77. openEncrypt: false, // 是否加密传输
  78. // (Optional) Set to true to enable `console.debug()` logging
  79. debug: false,
  80. // (Optional) Possible options: "chatgpt", "chatgpt-browser", "bing". (Default: "chatgpt")
  81. clientToUse: 'chatgpt',
  82. // (Optional) Generate titles for each conversation for clients that support it (only ChatGPTClient for now).
  83. // This will be returned as a `title` property in the first response of the conversation.
  84. generateTitles: false,
  85. // (Optional) Set this to allow changing the client or client options in POST /conversation.
  86. // To disable, set to `null`.
  87. perMessageClientOptionsWhitelist: {
  88. // The ability to switch clients using `clientOptions.clientToUse` will be disabled if `validClientsToUse` is not set.
  89. // To allow switching clients per message, you must set `validClientsToUse` to a non-empty array.
  90. validClientsToUse: ['bing', 'chatgpt', 'chatgpt-browser'], // values from possible `clientToUse` options above
  91. // The Object key, e.g. "chatgpt", is a value from `validClientsToUse`.
  92. // If not set, ALL options will be ALLOWED to be changed. For example, `bing` is not defined in `perMessageClientOptionsWhitelist` above,
  93. // so all options for `bingAiClient` will be allowed to be changed.
  94. // If set, ONLY the options listed here will be allowed to be changed.
  95. // In this example, each array element is a string representing a property in `chatGptClient` above.
  96. chatgpt: [
  97. 'promptPrefix',
  98. 'userLabel',
  99. 'chatGptLabel',
  100. // Setting `modelOptions.temperature` here will allow changing ONLY the temperature.
  101. // Other options like `modelOptions.model` will not be allowed to be changed.
  102. // If you want to allow changing all `modelOptions`, define `modelOptions` here instead of `modelOptions.temperature`.
  103. 'modelOptions.temperature',
  104. ],
  105. },
  106. },
  107. // Options for the CLI app
  108. cliOptions: {
  109. // (Optional) Possible options: "chatgpt", "bing".
  110. // clientToUse: 'bing',
  111. },
  112. };