mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2024-12-25 16:32:59 +01:00
Merge pull request #841 from ouoertheo/ouoertheo/objectives6
Objective: currentTask fix in MESSAGE_RECEIVED, ignore swipes
This commit is contained in:
commit
f6f51d21c5
@ -19,6 +19,7 @@ let currentChatId = ""
|
|||||||
let currentObjective = null
|
let currentObjective = null
|
||||||
let currentTask = null
|
let currentTask = null
|
||||||
let checkCounter = 0
|
let checkCounter = 0
|
||||||
|
let lastMessageWasSwipe = false
|
||||||
|
|
||||||
|
|
||||||
const defaultPrompts = {
|
const defaultPrompts = {
|
||||||
@ -531,6 +532,7 @@ const defaultSettings = {
|
|||||||
|
|
||||||
// Convenient single call. Not much at the moment.
|
// Convenient single call. Not much at the moment.
|
||||||
function resetState() {
|
function resetState() {
|
||||||
|
lastMessageWasSwipe = false
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,9 +800,12 @@ jQuery(() => {
|
|||||||
eventSource.on(event_types.CHAT_CHANGED, () => {
|
eventSource.on(event_types.CHAT_CHANGED, () => {
|
||||||
resetState()
|
resetState()
|
||||||
});
|
});
|
||||||
|
eventSource.on(event_types.MESSAGE_SWIPED, () => {
|
||||||
|
lastMessageWasSwipe = true
|
||||||
|
})
|
||||||
eventSource.on(event_types.MESSAGE_RECEIVED, () => {
|
eventSource.on(event_types.MESSAGE_RECEIVED, () => {
|
||||||
if (currentChatId == undefined || currentTask == undefined) {
|
if (currentChatId == undefined || jQuery.isEmptyObject(currentTask) || lastMessageWasSwipe) {
|
||||||
|
lastMessageWasSwipe = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if ($("#objective-check-frequency").val() > 0) {
|
if ($("#objective-check-frequency").val() > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user