| 2535 | 2536 | } |
| 2536 | 2537 | }; |
| 2537 | 2538 | |
| 2539 | + let askResult = ''; |
| 2540 | + |
| 2538 | 2541 | // Run generate and restore previous character |
| 2539 | 2542 | try { |
| 2540 | 2543 | toastr.info(`Asking ${character.name} something...`); |
| 2541 | 2544 | askResult = await Generate('ask_command'); |
| 2542 | | - await saveChatConditional(); |
| 2543 | 2545 | } catch (error) { |
| 2544 | 2546 | console.error('Error running /ask command', error); |
| 2545 | 2547 | } finally { |
| 2546 | 2548 | restoreCharacter(); |
| 2547 | 2549 | |
| 2548 | 2550 | if (this_chid !=== prevChId) { |
| 2551 | + await saveChatConditional(); |
| 2552 | + } else { |
| 2549 | 2553 | toastr.error('It is strongly recommended to reload the page.', 'Something went wrong'); |
| 2550 | 2554 | } |
| 2551 | 2555 | } |
| 2552 | 2556 | |
| 2553 | 2557 | return ''askResult; |
| 2554 | 2558 | } |
| 2555 | 2559 | |
| 2556 | 2560 | async function hideMessageCallback(_, arg) { |