From 00afb75bb59b6fb09b241c209c84aff009ef5481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E9=9B=A8=E2=97=8E=E6=98=9F=E7=A9=BA?= Date: Sun, 26 Mar 2023 21:28:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=97=A5=E5=BF=97=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20segment=20=E5=AF=BC=E5=85=A5=20(#287)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/chat.js | 9 ++++----- apps/draw.js | 1 - apps/entertainment.js | 1 - index.js | 4 ++++ 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/chat.js b/apps/chat.js index 92a724b..f49d859 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -21,7 +21,6 @@ import { OfficialChatGPTClient } from '../utils/message.js' import fetch from 'node-fetch' import { deleteConversation, getConversations, getLatestMessageIdByConversationId } from '../utils/conversation.js' import { convertSpeaker, generateAudio, speakers } from '../utils/tts.js' -import { segment } from 'oicq' import ChatGLMClient from '../utils/chatglm.js' try { await import('keyv') @@ -68,7 +67,6 @@ export class chatgpt extends plugin { name: 'chatgpt', /** 功能描述 */ dsc: 'chatgpt from openai', - /** https://oicqjs.github.io/oicq/#events */ event: 'message', /** 优先级,数字越小等级越高 */ priority: 1144, @@ -76,7 +74,8 @@ export class chatgpt extends plugin { { /** 学习群友聊天 **/ reg: '^[^#][sS]*', - fnc: 'recordChat' + fnc: 'recordChat', + log: false }, { /** 命令正则匹配 */ @@ -106,7 +105,8 @@ export class chatgpt extends plugin { /** 命令正则匹配 */ reg: toggleMode === 'at' ? '^[^#][sS]*' : '^#chat[^gpt][sS]*', /** 执行方法 */ - fnc: 'chatgpt' + fnc: 'chatgpt', + log: false }, { reg: '^#(chatgpt)?对话列表$', @@ -492,7 +492,6 @@ export class chatgpt extends plugin { /** * #chatgpt - * @param e oicq传递的事件参数e */ async chatgpt (e) { let prompt diff --git a/apps/draw.js b/apps/draw.js index 4a471eb..7a80da2 100644 --- a/apps/draw.js +++ b/apps/draw.js @@ -1,5 +1,4 @@ import plugin from '../../../lib/plugins/plugin.js' -import { segment } from 'oicq' import { createImage, editImage, imageVariation } from '../utils/dalle.js' import { makeForwardMsg } from '../utils/common.js' import _ from 'lodash' diff --git a/apps/entertainment.js b/apps/entertainment.js index 1fc29c2..a574bcf 100644 --- a/apps/entertainment.js +++ b/apps/entertainment.js @@ -1,7 +1,6 @@ import plugin from '../../../lib/plugins/plugin.js' import { Config } from '../utils/config.js' import { generateHello } from '../utils/randomMessage.js' -import { segment } from 'oicq' import { generateAudio } from '../utils/tts.js' import fs from 'fs' import { googleRequestUrl } from '../utils/emoj/index.js' diff --git a/index.js b/index.js index 09b09cb..a128683 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,9 @@ import fs from 'node:fs' import {Config} from "./utils/config.js"; + +if (!global.segment) { + global.segment = (await import("oicq")).segment +} const files = fs.readdirSync('./plugins/chatgpt-plugin/apps').filter(file => file.endsWith('.js'))