-
-
Notifications
You must be signed in to change notification settings - Fork 236
Open
Description
Bug Description
The upsertLocalLoreBook function works correctly in onButtonClick events but fails to persist changes when called from onStart and onOutput events in Lua scripts.
Environment
- RisuAI version: 166.3.0
- Event types affected:
onStart,onOutput - Scripting language: Lua Trigger Script
Steps to Reproduce
- Create a Lua script that calls
upsertLocalLoreBookinonStartoronOutputfunction - Enter new inputs in Risu Chat
- Check if the local lorebook changes are saved
- Compare with the same function call in
onButtonClick(which works correctly)
Expected Behavior
upsertLocalLoreBook should work consistently across all event types (onStart, onOutput, onButtonClick)
Actual Behavior
- ✅
onButtonClick: Changes are saved correctly - ❌
onStart: Changes are not persisted - ❌
onOutput: Changes are not persisted - No errors are thrown in any case
Cause Analysis
The issue was caused by different chat object reference handling between event types:
onButtonClick(viarunLuaButtonTrigger) → directly saves changes viasetCurrentChat()onStart/onOutput(viarunTrigger) → was modifyingchar.chats[char.chatPage]instead ofScriptingEngineState.chat
(KR) 버그 설명
upsertLocalLoreBook 함수가 onButtonClick 이벤트에서는 정상적으로 작동하지만, Lua 스크립트의 onStart와 onOutput 이벤트에서 호출할 때는 변경사항이 저장되지 않는 문제가 있습니다.
환경
- RisuAI 버전: 166.3.0
- 영향받는 이벤트 타입:
onStart,onOutput - 스크립팅 언어: Lua Trigger Script
재현 단계
onStart또는onOutput함수에서upsertLocalLoreBook을 호출하는 Lua 스크립트를 작성- 리스 앱 내 새 메세지 입력
- 로컬 로어북 변경사항이 저장되었는지 확인
- 동일한 함수를
onButtonClick에서 호출했을 때와 비교 (정상 작동함)
예상 동작
upsertLocalLoreBook이 모든 이벤트 타입(onStart, onOutput, onButtonClick)에서 일관되게 작동해야 함
실제 동작
- ✅
onButtonClick: 변경사항이 정상적으로 저장됨 - ❌
onStart: 변경사항이 지속되지 않음 - ❌
onOutput: 변경사항이 지속되지 않음 - 어떤 경우에도 오류는 발생하지 않음
원인 분석
이벤트 타입별로 채팅 객체 참조 처리 방식이 달라서 발생한 문제:
onButtonClick(runLuaButtonTrigger경유) →setCurrentChat()을 통해 직접 변경사항 저장onStart/onOutput(runTrigger경유) →ScriptingEngineState.chat대신char.chats[char.chatPage]를 수정하고 있었음
Metadata
Metadata
Assignees
Labels
No labels