feat: support browser-based solution. update readme

This commit is contained in:
ikechan8370 2023-02-11 23:17:38 +08:00
parent e59ed0c048
commit 6fdcbf12e2
11 changed files with 1557 additions and 67 deletions

View file

@ -1,25 +1,45 @@
// 例如http://127.0.0.1:7890
const PROXY = ''
const API_KEY = ''
export const Config = {
// 模型名称。如无特殊需求保持默认即可会使用chatgpt-api库提供的当前可用的最适合的默认值。保底可用的是 text-davinci-003。当发现新的可用的chatGPT模型会更新这里的值
// 20230211 text-chat-davinci-002-sh-alpha-aoruigiofdj83 中午存活了几分钟
model: '',
// 如果回答包括屏蔽词,就不返回。例如:'屏蔽词1,屏蔽词2,屏蔽词3'
blockWords: '',
apiKey: API_KEY,
// 暂时不支持proxy
proxy: PROXY,
// 改为true后全局默认以图片形式回复并自动发出Continue命令补全回答
// ***********************************************************************************************************************************
// 通用配置 *
// ***********************************************************************************************************************************
// 如果回答包括屏蔽词,就不返回。
blockWords: ['屏蔽词1', '屏蔽词b'],
// 改为true后全局默认以图片形式回复并自动发出Continue命令补全回答。长回复可能会有bug。
defaultUsePicture: false,
// 每个人发起的对话保留时长。超过这个时长没有进行对话,再进行对话将开启新的对话。单位:秒
conversationPreserveTime: 0,
// 触发方式 可选值at 或 prefix 。at模式下只有at机器人才会回复。prefix模式下不需要at但需要添加前缀#chat
toggleMode: 'prefix',
// 默认完整值:`You are ${this._assistantLabel}, a large language model trained by OpenAI. You answer as concisely as possible for each response (e.g. dont be verbose). It is very important that you answer as concisely as possible, so please remember this. If you are generating a list, do not have too many items. Keep the number of items short. Current date: ${currentDate}\n\n
// ***********************************************************************************************************************************
// 以下为API方式(默认)的配置 *
// ***********************************************************************************************************************************
apiKey: API_KEY,
// 模型名称选填。如无特殊需求保持默认即可会使用chatgpt-api库提供的当前可用的最适合的默认值。保底可用的是 text-davinci-003。当发现新的可用的chatGPT模型会更新这里的值
// 20230211 text-chat-davinci-002-sh-alpha-aoruigiofdj83 中午存活了几分钟
model: '',
// 给模型的暗示promt。选填。默认完整值`You are ${this._assistantLabel}, a large language model trained by OpenAI. You answer as concisely as possible for each response (e.g. dont be verbose). It is very important that you answer as concisely as possible, so please remember this. If you are generating a list, do not have too many items. Keep the number of items short. Current date: ${currentDate}\n\n
// 此项配置会覆盖掉中间部分。保持为空将使用网友从对话中推测出的指令。
// 你可以在这里写入你希望AI回答的风格比如希望优先回答中文回答长一点等
promptPrefixOverride: 'Your answer shouldn\'t be too verbose. If you are generating a list, do not have too many items. Keep the number of items short. Prefer to answer in Chinese.',
// AI认为的自己的名字当你问他你是谁是他会回答这里的名字。
assistantLabel: 'ChatGPT'
assistantLabel: 'ChatGPT',
// ***********************************************************************************************************************************
// 以下为浏览器方式的配置 *
// ***********************************************************************************************************************************
username: '',
password: '',
// UA: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
// 服务器无interface的话只能用true但是可能遇到验证码就一定要配置下面的2captchaToken了
// true时使用无头模式无界面的服务器可以为true但遇到验证码时可能无法使用。(实测很容易卡住,几乎不可用)
headless: false,
// 为空使用默认puppeteer的chromium也可以传递自己本机安装的Chrome可执行文件地址提高通过率。windows可以是C:\\Program Files\\Google\\Chrome\\Application\\chrome.exelinux通过which查找路径
chromePath: '',
// 可注册2captcha实现跳过验证码收费服务但很便宜。否则可能会遇到验证码而卡住。
'2captchaToken': '',
// http或socks5代理
proxy: PROXY
}