mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 22:07:10 +00:00
fix: at都被挤到消息最前面的问题
This commit is contained in:
parent
7bf5996dce
commit
8bdbd623b3
10 changed files with 18 additions and 53 deletions
36
LowerNode.md
36
LowerNode.md
|
|
@ -1,36 +0,0 @@
|
||||||
## 本页面已过时
|
|
||||||
|
|
||||||
### Node.js >= 14 (并且 <18)时的安装方法
|
|
||||||
|
|
||||||
**如果不是 CentOS 7, RHEL 7, Ubuntu 18 请自行搜索并升级你的 Node.js 版本!**
|
|
||||||
|
|
||||||
**此教程是为了因 glibc 不支持升级 Node.js 的Linux发行版准备的。**
|
|
||||||
1. 进入 Yunzai 根目录
|
|
||||||
2. 安装依赖
|
|
||||||
```
|
|
||||||
pnpm install -w undici chatgpt showdown mathjax-node delay uuid remark strip-markdown node-fetch @waylaidwanderer/chatgpt-api keyv-file
|
|
||||||
```
|
|
||||||
**若使用API模式,chatgpt的版本号注意要大于4.2.0**
|
|
||||||
|
|
||||||
若不使用浏览器模式,可以不安装`random puppeteer-extra-plugin-recaptcha puppeteer-extra puppeteer-extra-plugin-stealth`这几个
|
|
||||||
|
|
||||||
3. 克隆项目
|
|
||||||
```
|
|
||||||
git clone https://github.com/ikechan8370/chatgpt-plugin.git ./plugins/chatgpt-plugin
|
|
||||||
```
|
|
||||||
4. 修改配置
|
|
||||||
|
|
||||||
修改 Yunzai根目录/node_modules/.pnpm/chatgpt\@4.1.0/node_modules/chatgpt/build/index.js
|
|
||||||
|
|
||||||
**此处 chatgpt\@4.1.0 路径不是绝对的!请根据自己安装的版本进行替换!**
|
|
||||||
|
|
||||||
**将 // src/fetch.ts 部分修改成如下样子,其他部分不要动**
|
|
||||||
```
|
|
||||||
// src/fetch.ts
|
|
||||||
import fetch from 'node-fetch';
|
|
||||||
globalThis.fetch = fetch;
|
|
||||||
```
|
|
||||||
|
|
||||||
再编辑`Yunzai根目录/plugins/chatgpt-plugin/config/config.js`文件,根据其中的注释修改必要配置项。
|
|
||||||
|
|
||||||
---
|
|
||||||
8
Redis.md
8
Redis.md
|
|
@ -1,8 +0,0 @@
|
||||||
## 本插件使用的一些redis键值说明
|
|
||||||
|
|
||||||
### 官方(API3/浏览器模式)
|
|
||||||
* CHATGPT:QQ_CONVERSATION:123456789 qq号为123456789的人当前正在使用哪个对话
|
|
||||||
* CHATGPT:CONVERSATION_LAST_MESSAGE_ID:26001339-9043-435d-8394-c553a3109fdf id为`26001339-9043-435d-8394-c553a3109fdf`的对话,最后一条用户发出的消息的id
|
|
||||||
* CHATGPT:CONVERSATION_LAST_MESSAGE_PROMPT:26001339-9043-435d-8394-c553a3109fdf id为`26001339-9043-435d-8394-c553a3109fdf`的对话,最后一条用户发出的消息的内容(问题)
|
|
||||||
* CHATGPT:CONVERSATION_CREATE_TIME:26001339-9043-435d-8394-c553a3109fdf id为`26001339-9043-435d-8394-c553a3109fdf`的对话创建时间
|
|
||||||
* CHATGPT:CONVERSATION_LENGTH:26001339-9043-435d-8394-c553a3109fdf id为`26001339-9043-435d-8394-c553a3109fdf`的对话当前长度(不计分支)
|
|
||||||
|
|
@ -6,7 +6,7 @@ import fs from 'fs'
|
||||||
import { emojiRegex, googleRequestUrl } from '../utils/emoj/index.js'
|
import { emojiRegex, googleRequestUrl } from '../utils/emoj/index.js'
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import { mkdirs } from '../utils/common.js'
|
import { mkdirs } from '../utils/common.js'
|
||||||
import uploadRecord from "../utils/uploadRecord.js";
|
import uploadRecord from '../utils/uploadRecord.js'
|
||||||
|
|
||||||
let useSilk = false
|
let useSilk = false
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import plugin from '../../../lib/plugins/plugin.js'
|
import plugin from '../../../lib/plugins/plugin.js'
|
||||||
import { Config } from '../utils/config.js'
|
import { Config } from '../utils/config.js'
|
||||||
import { BingAIClient } from '@waylaidwanderer/chatgpt-api'
|
|
||||||
import { exec } from 'child_process'
|
import { exec } from 'child_process'
|
||||||
import { checkPnpm, formatDuration, parseDuration, getPublicIP } from '../utils/common.js'
|
import { checkPnpm, formatDuration, parseDuration, getPublicIP } from '../utils/common.js'
|
||||||
import SydneyAIClient from '../utils/SydneyAIClient.js'
|
import SydneyAIClient from '../utils/SydneyAIClient.js'
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ const defaultConfig = {
|
||||||
viewHost: '',
|
viewHost: '',
|
||||||
chatViewWidth: 1280,
|
chatViewWidth: 1280,
|
||||||
chatViewBotName: '',
|
chatViewBotName: '',
|
||||||
version: 'v2.5.0'
|
version: 'v2.5.1'
|
||||||
}
|
}
|
||||||
const _path = process.cwd()
|
const _path = process.cwd()
|
||||||
let config = {}
|
let config = {}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Configuration, OpenAIApi } from 'openai'
|
import { Configuration, OpenAIApi } from 'openai'
|
||||||
import {Config, defaultOpenAIAPI, defaultOpenAIReverseProxy, officialChatGPTAPI} from './config.js'
|
import { Config, defaultOpenAIAPI, defaultOpenAIReverseProxy } from './config.js'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import {isCN, mkdirs} from './common.js'
|
import { isCN, mkdirs } from './common.js'
|
||||||
let proxy
|
let proxy
|
||||||
if (Config.proxy) {
|
if (Config.proxy) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -47,7 +47,6 @@ export async function createImage (prompt, n = 1, size = '512x512') {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function imageVariation (imageUrl, n = 1, size = '512x512') {
|
export async function imageVariation (imageUrl, n = 1, size = '512x512') {
|
||||||
|
|
||||||
let basePath = Config.openAiBaseUrl
|
let basePath = Config.openAiBaseUrl
|
||||||
if (Config.openAiBaseUrl && Config.proxy && !Config.openAiForceUseReverse) {
|
if (Config.openAiBaseUrl && Config.proxy && !Config.openAiForceUseReverse) {
|
||||||
// 如果配了proxy,而且有反代,但是没开启强制反代
|
// 如果配了proxy,而且有反代,但是没开启强制反代
|
||||||
|
|
|
||||||
|
|
@ -489,6 +489,10 @@ export async function convertFaces (msg, handleAt = false, e) {
|
||||||
if (!foundFace) {
|
if (!foundFace) {
|
||||||
if (handleAt && msg[i] === '@') {
|
if (handleAt && msg[i] === '@') {
|
||||||
foundAt = true
|
foundAt = true
|
||||||
|
if (tmpMsg) {
|
||||||
|
msgs.push(tmpMsg)
|
||||||
|
tmpMsg = ''
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (handleAt && foundAt) {
|
if (handleAt && foundAt) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { Config } from './config.js'
|
import { Config } from './config.js'
|
||||||
import { ChatGPTAPI } from 'chatgpt'
|
import { ChatGPTAPI } from 'chatgpt'
|
||||||
import { getMessageById, upsertMessage } from './common.js'
|
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
let proxy
|
let proxy
|
||||||
if (Config.proxy) {
|
if (Config.proxy) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Config } from './config.js'
|
import { Config } from './config.js'
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import {wrapTextByLanguage} from "./common.js";
|
import { wrapTextByLanguage } from './common.js'
|
||||||
let proxy
|
let proxy
|
||||||
if (Config.proxy) {
|
if (Config.proxy) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import Contactable, { core } from 'oicq'
|
// import Contactable, { core } from 'oicq'
|
||||||
import querystring from 'querystring'
|
import querystring from 'querystring'
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
|
@ -7,6 +7,14 @@ import util from 'util'
|
||||||
import stream from 'stream'
|
import stream from 'stream'
|
||||||
import crypto from 'crypto'
|
import crypto from 'crypto'
|
||||||
import child_process from 'child_process'
|
import child_process from 'child_process'
|
||||||
|
let module
|
||||||
|
try {
|
||||||
|
module = await import('oicq')
|
||||||
|
} catch (err) {
|
||||||
|
module = await import('icqq')
|
||||||
|
}
|
||||||
|
const { core } = module
|
||||||
|
const Contactable = module.default
|
||||||
// import { pcm2slk } from 'node-silk'
|
// import { pcm2slk } from 'node-silk'
|
||||||
let errors = {}
|
let errors = {}
|
||||||
let pcm2slk
|
let pcm2slk
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue