Update prompt manager active character on character edit.

This commit is contained in:
maver
2023-07-07 22:45:53 +02:00
parent 74a7aa513b
commit 4974c81d4c
2 changed files with 13 additions and 0 deletions

View File

@ -356,6 +356,11 @@ PromptManagerModule.prototype.init = function (moduleConfiguration, serviceSetti
this.saveServiceSettings().then(() => this.render());
});
eventSource.on(event_types.CHARACTER_EDITED, (event) => {
this.handleCharacterUpdated(event);
this.saveServiceSettings().then(() => this.render());
})
// Re-render when the group changes.
eventSource.on('groupSelected', (event) => {
this.handleGroupSelected(event)
@ -641,6 +646,12 @@ PromptManagerModule.prototype.handleCharacterSelected = function (event) {
if (0 === promptList.length) this.addPromptListForCharacter(this.activeCharacter, openAiDefaultPromptList);
}
PromptManagerModule.prototype.handleCharacterUpdated = function (event) {
console.log(event)
this.activeCharacter = {id: event.detail.id, ...event.detail.character};
console.log(this.activeCharacter);
}
PromptManagerModule.prototype.handleGroupSelected = function (event) {
const characterDummy = {id: event.detail.id, group: event.detail.group};
this.activeCharacter = characterDummy;