mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-18 06:17:06 +00:00
Merge branch 'v2' of https://github.com/ikechan8370/chatgpt-plugin into v2
This commit is contained in:
commit
282c6578d4
7 changed files with 166 additions and 194 deletions
28
README.md
28
README.md
|
|
@ -3,9 +3,9 @@
|
|||
## 特点
|
||||
|
||||
* 支持单人连续对话Conversation,群聊中支持加入其他人的对话
|
||||
* API模式下,使用 GPT-3 API及相关模型配置尽可能逼近ChatGPT体验,支持自定义部分模型参数,仅需OpenAI Api Key,开箱即用
|
||||
* API模式下,使用 gpt-3.5-turbo API,ChatGPT官网同款模型,仅需OpenAI Api Key,开箱即用。**注意收费**
|
||||
* 支持问答图片截图
|
||||
* API3模式下,绕过Cloudflare防护直接访问ChatGPT的SSE API,与官方体验一致,且保留对话记录,在官网可查。
|
||||
* API3模式下,绕过Cloudflare防护直接访问ChatGPT的SSE API,与官方体验一致,且保留对话记录,在官网可查。免费。
|
||||
* 提供基于浏览器的解决方案作为备选,API3不可用的情况下或担心账户安全的用户可以选择使用浏览器模式。
|
||||
* 支持新[必应](https://www.bing.com/new)(Beta)
|
||||
|
||||
|
|
@ -17,14 +17,13 @@ Node.js >= 18 / Node.js >= 14(with node-fetch)
|
|||
|
||||
### 安装
|
||||
|
||||
在安装之前,请先判断自己需要使用哪种模式,本插件支持官方API/第三方API/浏览器/必应四种模式。也可以选择**我全都要**(通过qq发送命令`#chatgpt切换浏览器/API/API2/API3/Bing`实时切换)
|
||||
在安装之前,请先判断自己需要使用哪种模式,本插件支持官方API/第三方API/浏览器/必应四种模式。也可以选择**我全都要**(通过qq发送命令`#chatgpt切换浏览器/API/API3/Bing`实时切换)
|
||||
|
||||
对于轻量用户可以先使用API模式,有较高要求再转为使用其他模式。
|
||||
|
||||
> #### API模式和浏览器模式如何选择?
|
||||
>
|
||||
> * API模式会调用OpenAI官方提供的GPT-3 LLM API,只需要提供API Key。一般情况下,该种方式响应速度更快,可配置项多,且不会像chatGPT官网一样总出现不可用的现象,但其聊天效果明显较官网差。但注意GPT-3的API调用是收费的,新用户有18美元试用金可用于支付,价格为`$0.0200/ 1K tokens`。(问题和回答**加起来**算token)
|
||||
> * 【当前不可用】API2模式会调用第三方提供的基于OpenAI text-davinci-002-render模型(官网同款)的API,需要提供ChatGPT的Token。效果比单纯的GPT-3 API好很多,但同时将Token提供给了第三方API,其中风险自行承担。
|
||||
> * API3模式会调用第三方提供的官网反代API,他会帮你绕过CF防护,需要提供ChatGPT的Token。效果与官网和浏览器一致,但稳定性不一定。设置token和API2方法一样。
|
||||
> * 浏览器模式通过在本地启动Chrome等浏览器模拟用户访问ChatGPT网站,使得获得和官方以及API2模式一模一样的回复质量,同时保证安全性。缺点是本方法对环境要求较高,需要提供桌面环境和一个可用的代理(能够访问ChatGPT的IP地址),且响应速度不如API,而且高峰期容易无法使用。一般作为API3的下位替代。
|
||||
> * 必应(Bing)将调用微软新必应接口进行对话。需要在必应网页能够正常使用新必应且设置有效的Bing登录Cookie方可使用。
|
||||
|
|
@ -43,7 +42,7 @@ pnpm i
|
|||
如果是手工下载的 zip 压缩包,请将解压后的 chatgpt-plugin 文件夹(请删除压缩自带的-master后缀)放置在 Yunzai-Bot 目录下的 plugins 文件夹内
|
||||
|
||||
> 浏览器模式仅为备选,如您需要使用浏览器模式,您还需要有**桌面环境**,优先级建议:必应>API3>浏览器
|
||||
> 2.20更新:必应被大削,变得蠢了,建议还是API3优先
|
||||
> 2.20更新:必应被大削,变得蠢了,建议还是API/API3优先
|
||||
|
||||
3. 修改配置
|
||||
|
||||
|
|
@ -160,17 +159,6 @@ pnpm i
|
|||
发挥你的想象力吧,~~调教~~拟造出你自己的机器人风格!
|
||||
|
||||
|
||||
|
||||
关于部分API模式下配置中的一些模型的配置项:
|
||||
|
||||
* `model`:通常保持空即可,除非你想调用特定的模型,比如你用gpt-3微调的学到特定领域知识的机器人。API1模式下将强制使用chatGPT模型。
|
||||
|
||||
* `promptPrefixOverride`:通常保持空即可。如果你想调整机器人回复的风格,可以在这里加入对机器人的一些暗示,比如要求用中文,要求回答长一点/短一点。甚至可以让它有自己的小脾气。
|
||||
|
||||
* `assistantLabel`:默认为ChatGPT,表示机器人认知中的自己的名字。你可以修改为其他名字。
|
||||
|
||||
* `plus`:如果你购买了ChatGPT Plus,将这个值改为true可以使响应速度更快。
|
||||
|
||||
#### 文本/图片回复模式
|
||||
|
||||
> #chatgpt文本/图片模式
|
||||
|
|
@ -249,10 +237,6 @@ git stash pop
|
|||
|
||||
## 其他
|
||||
|
||||
### 关于未来更新
|
||||
|
||||
OpenAI 即将开放其官方ChatGPT API,且微软必应也公开发布了基于ChatGPT的问答搜索,能够为实现更好、更快的聊天机器人提供更多途径。
|
||||
|
||||
### 常见问题
|
||||
|
||||
1. 如果在linux系统上发现图片模式下emoj无法正常显示,可以搜索安装支持emoj的字体,如Ubuntu可以使用`sudo apt install fonts-noto-color-emoji`
|
||||
|
|
@ -275,7 +259,7 @@ OpenAI 即将开放其官方ChatGPT API,且微软必应也公开发布了基
|
|||
>
|
||||
> 原因:没装依赖
|
||||
>
|
||||
> 解决方式:请参考文档用`pnmp install -w xxx`安装依赖,遇到的情况一般是`pnpm install -w undici chatgpt showdown mathjax-node delay uuid remark strip-markdown random puppeteer-extra-plugin-recaptcha puppeteer-extra puppeteer-extra-plugin-stealth @waylaidwanderer/chatgpt-api keyv-file`,安装完就不报错了
|
||||
> 解决方式:请参考文档在本插件目录下用`pnmp install`安装依赖,安装完就不报错了
|
||||
|
||||
|
||||
|
||||
|
|
@ -287,7 +271,7 @@ OpenAI 即将开放其官方ChatGPT API,且微软必应也公开发布了基
|
|||
* https://github.com/acheong08/ChatGPT
|
||||
* https://github.com/PawanOsman
|
||||
|
||||
图片模式支持 @HalcyonAlcedo
|
||||
图片以及Bing模式支持 @HalcyonAlcedo
|
||||
* https://github.com/HalcyonAlcedo/ChatGPT-Plugin-PageCache
|
||||
|
||||
以及ChatGPT
|
||||
|
|
|
|||
14
apps/chat.js
14
apps/chat.js
|
|
@ -671,21 +671,23 @@ export class chatgpt extends plugin {
|
|||
if (Config.model) {
|
||||
completionParams.model = Config.model
|
||||
}
|
||||
const currentDate = new Date().toISOString().split('T')[0]
|
||||
let promptPrefix = `You are ${Config.assistantLabel}, a large language model trained by OpenAI. ${Config.promptPrefixOverride || defaultPropmtPrefix}
|
||||
Current date: ${currentDate}`
|
||||
this.chatGPTApi = new ChatGPTAPI({
|
||||
apiBaseUrl: Config.openAiBaseUrl,
|
||||
apiKey: Config.apiKey,
|
||||
debug: false,
|
||||
upsertMessage,
|
||||
getMessageById,
|
||||
systemMessage: promptPrefix,
|
||||
completionParams,
|
||||
assistantLabel: Config.assistantLabel,
|
||||
fetch
|
||||
})
|
||||
const currentDate = new Date().toISOString().split('T')[0]
|
||||
let promptPrefix = `You are ${Config.assistantLabel}, a large language model trained by OpenAI. ${Config.promptPrefixOverride || defaultPropmtPrefix}
|
||||
Current date: ${currentDate}`
|
||||
let option = {
|
||||
timeoutMs: 120000,
|
||||
promptPrefix
|
||||
systemMessage: promptPrefix
|
||||
}
|
||||
if (conversation) {
|
||||
option = Object.assign(option, conversation)
|
||||
|
|
@ -773,11 +775,11 @@ export class chatgpt extends plugin {
|
|||
|
||||
async totalAvailable (e) {
|
||||
if (!Config.apiKey) {
|
||||
this.reply('当前未配置OpenAI API key,请在插件配置文件config/config.js中配置。若使用免费的API3则无需关心计费。')
|
||||
this.reply('当前未配置OpenAI API key,请在锅巴面板或插件配置文件config/config.js中配置。若使用免费的API3则无需关心计费。')
|
||||
return false
|
||||
}
|
||||
// 查询OpenAI API剩余试用额度
|
||||
fetch('https://api.openai.com/dashboard/billing/credit_grants', {
|
||||
fetch(`${Config.openAiBaseUrl}/dashboard/billing/credit_grants`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
|
|
|||
|
|
@ -269,10 +269,8 @@ export class ChatgptManagement extends plugin {
|
|||
let message = ` API模式和浏览器模式如何选择?
|
||||
|
||||
// eslint-disable-next-line no-irregular-whitespace
|
||||
API模式会调用OpenAI官方提供的GPT-3 LLM API,只需要提供API Key。一般情况下,该种方式响应速度更快,可配置项多,且不会像chatGPT官网一样总出现不可用的现象,但其聊天效果明显较官网差。但注意GPT-3的API调用是收费的,新用户有18美元试用金可用于支付,价格为$0.0200/ 1K tokens.(问题和回答加起来算token)
|
||||
|
||||
【当前不可用】API2模式会调用第三方提供的基于OpenAI text-davinci-002-render模型(官网同款)的API,需要提供ChatGPT的Token。效果比单纯的GPT-3 API好很多,但同时将Token提供给了第三方API,其中风险自行承担。#chatgpt设置token
|
||||
|
||||
API模式会调用OpenAI官方提供的gpt-3.5-turbo API,只需要提供API Key。一般情况下,该种方式响应速度更快,不会像chatGPT官网一样总出现不可用的现象,但注意gpt-3.5-turbo的API调用是收费的,新用户有18美元试用金可用于支付,价格为$0.0020/ 1K tokens.(问题和回答加起来算token)
|
||||
|
||||
API3模式会调用第三方提供的官网反代API,他会帮你绕过CF防护,需要提供ChatGPT的Token。效果与官网和浏览器一致,但稳定性不一定。设置token和API2方法一样。#chatgpt设置token
|
||||
|
||||
浏览器模式通过在本地启动Chrome等浏览器模拟用户访问ChatGPT网站,使得获得和官方以及API2模式一模一样的回复质量,同时保证安全性。缺点是本方法对环境要求较高,需要提供桌面环境和一个可用的代理(能够访问ChatGPT的IP地址),且响应速度不如API,而且高峰期容易无法使用。
|
||||
|
|
|
|||
|
|
@ -36,9 +36,12 @@ export default {
|
|||
// 以下为API方式(默认)的配置 *
|
||||
// ***********************************************************************************************************************************
|
||||
apiKey: API_KEY,
|
||||
// 如果有openai api的加速反代可以写
|
||||
// openAiBaseUrl: null,
|
||||
// 模型名称,选填。如无特殊需求保持默认即可,会使用chatgpt-api库提供的当前可用的最适合的默认值。保底可用的是 text-davinci-003。当发现新的可用的chatGPT模型会更新这里的值
|
||||
// 20230211: text-chat-davinci-002-sh-alpha-aoruigiofdj83 中午存活了几分钟
|
||||
// model: '',
|
||||
// temperature: 0.8,
|
||||
// ***********************************************************************************************************************************
|
||||
// 以下为API3方式的配置 *
|
||||
// ***********************************************************************************************************************************
|
||||
|
|
@ -48,16 +51,6 @@ export default {
|
|||
// 或者 https://gpt.pawan.krd/backend-api
|
||||
// apiBaseUrl: 'https://chatgpt.duti.tech/api',
|
||||
// ***********************************************************************************************************************************
|
||||
// 以下为API2方式的配置 *
|
||||
// ***********************************************************************************************************************************
|
||||
// 如果购买了plus,改为true将使用收费模型,响应更快
|
||||
// plus: false,
|
||||
// 使用谁提供的第三方API。github开源的有几个,没特别要求保持默认就好
|
||||
// https://chatgpt.pawan.krd/api/completions 来自https://github.com/PawanOsman 使用Cloudflare CDN,三网延迟可能都较高。目前看起来最稳定
|
||||
// https://chatgpt.roki.best/api/completions 对上面那个的二次反代,搭建在Hong Kong(本人自建,不保证稳定性)
|
||||
// https://chatgpt.hato.ai/completions 来自https://github.com/waylaidwanderer(本插件使用的chatgpt库之一的作者)
|
||||
// reverseProxy: 'https://chatgpt.pawan.krd/api/completions',
|
||||
// ***********************************************************************************************************************************
|
||||
// 以下为API/API2方式公用的配置 *
|
||||
// ***********************************************************************************************************************************
|
||||
// 给模型的前言promt。选填。默认完整值:`You are ${this._assistantLabel}, a large language model trained by OpenAI. You answer as concisely as possible for each response (e.g. don’t 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
|
||||
|
|
|
|||
274
guoba.support.js
274
guoba.support.js
|
|
@ -1,7 +1,7 @@
|
|||
import { Config } from './utils/config.js'
|
||||
|
||||
// 支持锅巴
|
||||
export function supportGuoba() {
|
||||
export function supportGuoba () {
|
||||
return {
|
||||
// 插件信息,将会显示在前端页面
|
||||
// 如果你的插件没有在插件库里,那么需要填上补充信息
|
||||
|
|
@ -19,7 +19,7 @@ export function supportGuoba() {
|
|||
// 图标可在 https://icon-sets.iconify.design 这里进行搜索
|
||||
icon: 'simple-icons:openai',
|
||||
// 图标颜色,例:#FF0000 或 rgb(255, 0, 0)
|
||||
iconColor: '#00c3ff',
|
||||
iconColor: '#00c3ff'
|
||||
},
|
||||
// 配置项信息
|
||||
configInfo: {
|
||||
|
|
@ -29,51 +29,51 @@ export function supportGuoba() {
|
|||
field: 'blockWords',
|
||||
label: '输出黑名单',
|
||||
bottomHelpMessage: '检查输出结果中是否有违禁词,如果存在黑名单中的违禁词则不输出',
|
||||
component: 'InputTextArea',
|
||||
component: 'InputTextArea'
|
||||
},
|
||||
{
|
||||
field: 'promptBlockWords',
|
||||
label: '输入黑名单',
|
||||
bottomHelpMessage: '检查输入结果中是否有违禁词,如果存在黑名单中的违禁词则不输出',
|
||||
component: 'InputTextArea',
|
||||
component: 'InputTextArea'
|
||||
},
|
||||
{
|
||||
field: 'imgOcr',
|
||||
label: '图片识别',
|
||||
bottomHelpMessage: '是否识别消息中图片的文字内容,需要同时包含图片和消息才生效',
|
||||
component: 'Switch',
|
||||
component: 'Switch'
|
||||
},
|
||||
{
|
||||
field: 'defaultUsePicture',
|
||||
label: '全局图片模式',
|
||||
bottomHelpMessage: '全局默认以图片形式回复,并自动发出Continue命令补全回答。长回复可能会有bug。',
|
||||
component: 'Switch',
|
||||
component: 'Switch'
|
||||
},
|
||||
{
|
||||
field: 'autoUsePicture',
|
||||
label: '长文本自动转图片',
|
||||
bottomHelpMessage: '字数大于阈值会自动用图片发送,即使是文本模式。',
|
||||
component: 'Switch',
|
||||
field: 'autoUsePicture',
|
||||
label: '长文本自动转图片',
|
||||
bottomHelpMessage: '字数大于阈值会自动用图片发送,即使是文本模式。',
|
||||
component: 'Switch'
|
||||
},
|
||||
{
|
||||
field: 'autoUsePictureThreshold',
|
||||
label: '自动转图片阈值',
|
||||
helpMessage: '长文本自动转图片开启后才生效',
|
||||
bottomHelpMessage: '自动转图片的字数阈值。',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0,
|
||||
},
|
||||
field: 'autoUsePictureThreshold',
|
||||
label: '自动转图片阈值',
|
||||
helpMessage: '长文本自动转图片开启后才生效',
|
||||
bottomHelpMessage: '自动转图片的字数阈值。',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'conversationPreserveTime',
|
||||
label: '对话保留时长',
|
||||
helpMessage: '单位:秒',
|
||||
bottomHelpMessage: '每个人发起的对话保留时长。超过这个时长没有进行对话,再进行对话将开启新的对话。',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0,
|
||||
},
|
||||
field: 'conversationPreserveTime',
|
||||
label: '对话保留时长',
|
||||
helpMessage: '单位:秒',
|
||||
bottomHelpMessage: '每个人发起的对话保留时长。超过这个时长没有进行对话,再进行对话将开启新的对话。',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'toggleMode',
|
||||
|
|
@ -82,207 +82,201 @@ export function supportGuoba() {
|
|||
component: 'Select',
|
||||
componentProps: {
|
||||
options: [
|
||||
{label: 'at', value: 'at'},
|
||||
{label: '#chat', value: 'prefix'},
|
||||
],
|
||||
},
|
||||
{ label: 'at', value: 'at' },
|
||||
{ label: '#chat', value: 'prefix' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'quoteReply',
|
||||
label: '图片引用消息',
|
||||
bottomHelpMessage: '在回复图片时引用原始消息',
|
||||
component: 'Switch',
|
||||
field: 'quoteReply',
|
||||
label: '图片引用消息',
|
||||
bottomHelpMessage: '在回复图片时引用原始消息',
|
||||
component: 'Switch'
|
||||
},
|
||||
{
|
||||
field: 'showQRCode',
|
||||
label: '启用二维码',
|
||||
bottomHelpMessage: '在图片模式中启用二维码。该对话内容将被发送至第三方服务器以进行渲染展示,如果不希望对话内容被上传到第三方服务器请关闭此功能。',
|
||||
component: 'Switch',
|
||||
field: 'showQRCode',
|
||||
label: '启用二维码',
|
||||
bottomHelpMessage: '在图片模式中启用二维码。该对话内容将被发送至第三方服务器以进行渲染展示,如果不希望对话内容被上传到第三方服务器请关闭此功能。',
|
||||
component: 'Switch'
|
||||
},
|
||||
{
|
||||
field: 'cacheUrl',
|
||||
label: '渲染服务器地址',
|
||||
bottomHelpMessage: '用于缓存图片模式会话内容并渲染的服务器地址。',
|
||||
component: 'Input',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'cacheEntry',
|
||||
label: '预制渲染服务器访问代码',
|
||||
bottomHelpMessage: '图片内容渲染服务器开启预制访问代码,当渲染服务器访问较慢时可以开启,但无法保证访问代码可以正常访问页面。',
|
||||
component: 'Switch',
|
||||
field: 'cacheEntry',
|
||||
label: '预制渲染服务器访问代码',
|
||||
bottomHelpMessage: '图片内容渲染服务器开启预制访问代码,当渲染服务器访问较慢时可以开启,但无法保证访问代码可以正常访问页面。',
|
||||
component: 'Switch'
|
||||
},
|
||||
{
|
||||
field: 'drawCD',
|
||||
label: '绘图CD',
|
||||
helpMessage: '单位:秒',
|
||||
bottomHelpMessage: '绘图指令的CD时间,主人不受限制',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0,
|
||||
},
|
||||
field: 'drawCD',
|
||||
label: '绘图CD',
|
||||
helpMessage: '单位:秒',
|
||||
bottomHelpMessage: '绘图指令的CD时间,主人不受限制',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'proxy',
|
||||
label: '代理服务器地址',
|
||||
bottomHelpMessage: '数据通过代理服务器发送,http或socks5代理。',
|
||||
component: 'Input',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'debug',
|
||||
label: '调试信息',
|
||||
bottomHelpMessage: '将输出更多调试信息,如果不希望控制台刷屏的话,可以关闭。',
|
||||
component: 'Switch',
|
||||
field: 'debug',
|
||||
label: '调试信息',
|
||||
bottomHelpMessage: '将输出更多调试信息,如果不希望控制台刷屏的话,可以关闭。',
|
||||
component: 'Switch'
|
||||
},
|
||||
{
|
||||
label: '以下为服务超时配置。',
|
||||
component: 'Divider',
|
||||
label: '以下为服务超时配置。',
|
||||
component: 'Divider'
|
||||
},
|
||||
{
|
||||
field: 'defaultTimeoutMs',
|
||||
label: '默认超时时间',
|
||||
helpMessage: '单位:毫秒',
|
||||
bottomHelpMessage: '各个地方的默认超时时间。',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0,
|
||||
},
|
||||
field: 'defaultTimeoutMs',
|
||||
label: '默认超时时间',
|
||||
helpMessage: '单位:毫秒',
|
||||
bottomHelpMessage: '各个地方的默认超时时间。',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'chromeTimeoutMS',
|
||||
label: '浏览器超时时间',
|
||||
helpMessage: '单位:毫秒',
|
||||
bottomHelpMessage: '浏览器默认超时,浏览器可能需要更高的超时时间。',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0,
|
||||
},
|
||||
field: 'chromeTimeoutMS',
|
||||
label: '浏览器超时时间',
|
||||
helpMessage: '单位:毫秒',
|
||||
bottomHelpMessage: '浏览器默认超时,浏览器可能需要更高的超时时间。',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '以下为API方式(默认)的配置',
|
||||
component: 'Divider',
|
||||
component: 'Divider'
|
||||
},
|
||||
{
|
||||
field: 'apiKey',
|
||||
label: 'OpenAI API Key',
|
||||
bottomHelpMessage: 'OpenAI的ApiKey,用于访问OpenAI的API接口。',
|
||||
component: 'InputPassword',
|
||||
component: 'InputPassword'
|
||||
},
|
||||
{
|
||||
field: 'openAiBaseUrl',
|
||||
label: 'OpenAI API服务器地址',
|
||||
bottomHelpMessage: 'OpenAI的API服务器地址。默认为https://api.openai.com',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'model',
|
||||
label: '模型',
|
||||
bottomHelpMessage: '模型名称,如无特殊需求保持默认即可,会使用chatgpt-api库提供的当前可用的最适合的默认值。保底可用的是 text-davinci-003。当发现新的可用的chatGPT模型会更新这里的值。',
|
||||
component: 'Input',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'thinkingTips',
|
||||
label: '思考提示',
|
||||
bottomHelpMessage: '是否开启AI正在思考中的提示信息。',
|
||||
component: 'Switch',
|
||||
},
|
||||
{
|
||||
label: '以下为API2方式的配置',
|
||||
component: 'Divider',
|
||||
},
|
||||
{
|
||||
field: 'plus',
|
||||
label: 'ChatGPT Plus',
|
||||
bottomHelpMessage: 'ChatGPT Plus访问,如果购买了ChatGPT Plus请开启,响应更快。',
|
||||
component: 'Switch',
|
||||
},
|
||||
{
|
||||
field: 'reverseProxy',
|
||||
label: '第三方API接口',
|
||||
bottomHelpMessage: '使用第三方API。github开源的有几个,没特别要求保持默认就好。',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '以下为API3方式的配置。',
|
||||
component: 'Divider',
|
||||
},
|
||||
{
|
||||
field: 'api',
|
||||
label: 'ChatGPT API反代服务器地址',
|
||||
bottomHelpMessage: 'ChatGPT的API反代服务器,用于绕过Cloudflare访问ChatGPT API',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'apiBaseUrl',
|
||||
label: 'apiBaseUrl地址',
|
||||
bottomHelpMessage: 'apiBaseUrl地址',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '以下为API/API2方式公用的配置',
|
||||
component: 'Divider',
|
||||
field: 'thinkingTips',
|
||||
label: '思考提示',
|
||||
bottomHelpMessage: '是否开启AI正在思考中的提示信息。',
|
||||
component: 'Switch'
|
||||
},
|
||||
{
|
||||
field: 'promptPrefixOverride',
|
||||
label: 'AI风格',
|
||||
bottomHelpMessage: '你可以在这里写入你希望AI回答的风格,比如希望优先回答中文,回答长一点等。',
|
||||
component: 'InputTextArea',
|
||||
component: 'InputTextArea'
|
||||
},
|
||||
{
|
||||
field: 'assistantLabel',
|
||||
label: 'AI名字',
|
||||
bottomHelpMessage: 'AI认为的自己的名字,当你问他你是谁是他会回答这里的名字。',
|
||||
component: 'Input',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'temperature',
|
||||
label: 'temperature',
|
||||
bottomHelpMessage: 'temperature。',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0,
|
||||
max: 2
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '以下为API3方式的配置。',
|
||||
component: 'Divider'
|
||||
},
|
||||
{
|
||||
field: 'api',
|
||||
label: 'ChatGPT API反代服务器地址',
|
||||
bottomHelpMessage: 'ChatGPT的API反代服务器,用于绕过Cloudflare访问ChatGPT API',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'apiBaseUrl',
|
||||
label: 'apiBaseUrl地址',
|
||||
bottomHelpMessage: 'apiBaseUrl地址',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
label: '以下为浏览器方式的配置',
|
||||
component: 'Divider',
|
||||
component: 'Divider'
|
||||
},
|
||||
{
|
||||
field: 'username',
|
||||
label: '用户名',
|
||||
bottomHelpMessage: 'OpenAI用户名。',
|
||||
component: 'Input',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'password',
|
||||
label: '密码',
|
||||
bottomHelpMessage: 'OpenAI密码。',
|
||||
component: 'InputPassword',
|
||||
component: 'InputPassword'
|
||||
},
|
||||
{
|
||||
field: 'UA',
|
||||
label: '浏览器UA',
|
||||
bottomHelpMessage: '模拟浏览器UA,无特殊需求保持默认即可。',
|
||||
component: 'InputTextArea',
|
||||
component: 'InputTextArea'
|
||||
},
|
||||
{
|
||||
field: 'headless',
|
||||
label: '无头模式',
|
||||
bottomHelpMessage: '无界面的服务器可以开启,但遇到验证码时可能无法使用。(实测很容易卡住,几乎不可用)。',
|
||||
component: 'Switch',
|
||||
field: 'headless',
|
||||
label: '无头模式',
|
||||
bottomHelpMessage: '无界面的服务器可以开启,但遇到验证码时可能无法使用。(实测很容易卡住,几乎不可用)。',
|
||||
component: 'Switch'
|
||||
},
|
||||
{
|
||||
field: 'chromePath',
|
||||
label: 'Chrome路径',
|
||||
bottomHelpMessage: '为空使用默认puppeteer的chromium,也可以传递自己本机安装的Chrome可执行文件地址,提高通过率。windows可以是‘C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe’,linux通过which查找路径。',
|
||||
component: 'Input',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: '2captchaToken',
|
||||
label: '验证码平台Token',
|
||||
bottomHelpMessage: '可注册2captcha实现跳过验证码,收费服务但很便宜。否则可能会遇到验证码而卡住。',
|
||||
component: 'InputPassword',
|
||||
},
|
||||
component: 'InputPassword'
|
||||
}
|
||||
],
|
||||
// 获取配置数据方法(用于前端填充显示数据)
|
||||
getConfigData() {
|
||||
getConfigData () {
|
||||
return Config
|
||||
},
|
||||
// 设置配置的方法(前端点确定后调用的方法)
|
||||
setConfigData(data, {Result}) {
|
||||
setConfigData (data, { Result }) {
|
||||
for (let [keyPath, value] of Object.entries(data)) {
|
||||
// 处理黑名单
|
||||
if (keyPath === 'blockWords' || keyPath === 'promptBlockWords')
|
||||
value = value.toString().split(/[,,;;\|]/)
|
||||
if (Config[keyPath] != value)
|
||||
Config[keyPath] = value
|
||||
// 处理黑名单
|
||||
if (keyPath === 'blockWords' || keyPath === 'promptBlockWords') { value = value.toString().split(/[,,;;\|]/) }
|
||||
if (Config[keyPath] != value) { Config[keyPath] = value }
|
||||
}
|
||||
return Result.ok({}, '保存成功~')
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
18
package.json
18
package.json
|
|
@ -3,21 +3,21 @@
|
|||
"type": "module",
|
||||
"author": "ikechan8370",
|
||||
"dependencies": {
|
||||
"@waylaidwanderer/chatgpt-api": "^1.20.2",
|
||||
"chatgpt": "^4.4.1",
|
||||
"@waylaidwanderer/chatgpt-api": "^1.22.5",
|
||||
"chatgpt": "^5.0.0",
|
||||
"delay": "^5.0.0",
|
||||
"keyv-file": "^0.2.0",
|
||||
"node-fetch": "^3.3.0",
|
||||
"openai": "^3.1.0",
|
||||
"puppeteer-extra": "^3.3.4",
|
||||
"puppeteer-extra-plugin-recaptcha": "^3.6.6",
|
||||
"puppeteer-extra-plugin-stealth": "^2.11.1",
|
||||
"openai": "^3.2.1",
|
||||
"puppeteer-extra": "^3.3.6",
|
||||
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
||||
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
||||
"random": "^4.1.0",
|
||||
"undici": "^5.19.1",
|
||||
"undici": "^5.20.0",
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"sharp": "^0.31.3",
|
||||
"jimp": "^0.22.7"
|
||||
"jimp": "^0.22.7",
|
||||
"sharp": "^0.31.3"
|
||||
}
|
||||
}
|
||||
|
|
@ -14,13 +14,14 @@ const defaultConfig = {
|
|||
cacheUrl: 'https://content.alcedogroup.com',
|
||||
cacheEntry: false,
|
||||
apiKey: '',
|
||||
openAiBaseUrl: 'https://api.openai.com',
|
||||
drawCD: 30,
|
||||
model: '',
|
||||
temperature: 0.8,
|
||||
api: 'https://chatgpt.duti.tech/api/conversation',
|
||||
apiBaseUrl: 'https://chatgpt.duti.tech/api',
|
||||
plus: false,
|
||||
reverseProxy: 'https://chatgpt.pawan.krd/api/completions',
|
||||
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.',
|
||||
promptPrefixOverride: 'Your answer shouldn\'t be too verbose. Prefer to answer in Chinese.',
|
||||
assistantLabel: 'ChatGPT',
|
||||
thinkingTips: true,
|
||||
username: '',
|
||||
|
|
@ -33,7 +34,7 @@ const defaultConfig = {
|
|||
debug: true,
|
||||
defaultTimeoutMs: 120000,
|
||||
chromeTimeoutMS: 120000,
|
||||
version: '2.0.3'
|
||||
version: '2.0.9'
|
||||
}
|
||||
const _path = process.cwd()
|
||||
let config = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue