mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 05:17:10 +00:00
fix: 伪人错误记录历史的问题
This commit is contained in:
parent
eb71222ed8
commit
089f6b6316
3 changed files with 10 additions and 0 deletions
|
|
@ -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])
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue