fix: 对话错误问题

This commit is contained in:
ikechan8370 2025-04-14 10:01:49 +08:00
parent af28390a54
commit b30488bdb9
2 changed files with 5 additions and 2 deletions

View file

@ -38,6 +38,9 @@ export class Chat extends plugin {
if (!state.current.conversationId) {
state.current.conversationId = crypto.randomUUID()
}
if (!state.current.messageId) {
state.current.messageId = crypto.randomUUID()
}
const preset = await getPreset(e, state?.settings.preset || Config.llm.defaultChatPresetId, Config.basic.toggleMode, Config.basic.togglePrefix)
if (!preset) {
logger.debug('不满足对话触发条件或未找到预设,不进入对话')

View file

@ -99,7 +99,7 @@ export class ChatGPTManagement extends plugin {
if (userState.current.conversationId && userState.current.messageId) {
num++
userState.current.conversationId = crypto.randomUUID()
userState.current.messageId = ''
userState.current.messageId = crypto.randomUUID()
await Chaite.getInstance().getUserStateStorage().setItem(userState.userId + '', userState)
}
}
@ -111,7 +111,7 @@ export class ChatGPTManagement extends plugin {
return false
}
state.current.conversationId = crypto.randomUUID()
state.current.messageId = ''
state.current.messageId = crypto.randomUUID()
await Chaite.getInstance().getUserStateStorage().setItem(e.sender.user_id + '', state)
this.reply('已结束当前对话')
}