diff --git a/apps/bym.js b/apps/bym.js index 64d0566..34196ae 100644 --- a/apps/bym.js +++ b/apps/bym.js @@ -22,6 +22,9 @@ export class bym extends plugin { } async bym (e) { + if (!Chaite.getInstance()) { + return false + } if (!ChatGPTConfig.bym.enable) { return false } @@ -82,6 +85,7 @@ export class bym extends plugin { // sendMessageOption.disableHistoryRead = true // sendMessageOption.disableHistorySave = true sendMessageOption.conversationId = 'bym' + e.user_id + Date.now() + sendMessageOption.parentMessageId = undefined // 设置多轮调用回掉 sendMessageOption.onMessageWithToolCall = async content => { const { msgs, forward } = await toYunzai(e, [content]) diff --git a/apps/chat.js b/apps/chat.js index d5e76ed..689dac8 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -27,6 +27,9 @@ export class Chat extends plugin { } async chat (e) { + if (!Chaite.getInstance()) { + return false + } let state = await Chaite.getInstance().getUserStateStorage().getItem(e.sender.user_id + '') if (!state) { state = new YunzaiUserState(e.sender.user_id, e.sender.nickname, e.sender.card) @@ -61,6 +64,8 @@ export class Chat extends plugin { toggleMode: Config.basic.toggleMode, togglePrefix: Config.basic.togglePrefix }) + sendMessageOptions.conversationId = state?.current?.conversationId + sendMessageOptions.parentMessageId = state?.current?.messageId || state?.conversations.find(c => c.id === sendMessageOptions.conversationId)?.lastMessageId if (Config.llm.enableGroupContext && e.isGroup) { const contextPrompt = await getGroupContextPrompt(e, Config.llm.groupContextLength) sendMessageOptions.systemOverride = sendMessageOptions.systemOverride ? sendMessageOptions.systemOverride + '\n' + contextPrompt : (preset.sendMessageOption.systemOverride + contextPrompt) diff --git a/models/chaite/cloud.js b/models/chaite/cloud.js index ab6afe9..a8996c0 100644 --- a/models/chaite/cloud.js +++ b/models/chaite/cloud.js @@ -173,6 +173,7 @@ export async function initChaite () { }) chaite.getGlobalConfig().setHost(ChatGPTConfig.chaite.host) chaite.getGlobalConfig().setPort(ChatGPTConfig.chaite.port) + chaite.getGlobalConfig().setDebug(ChatGPTConfig.basic.debug) logger.info('Chaite.RAGManager 初始化完成') chaite.runApiServer() }