jupyter-ai
jupyter-ai copied to clipboard
Last mentioned persona should be stored as an ID
Problem
PR #1405 adds the /refresh-persona slash command, which has an interesting side effect: personas may be removed from the chat.
The issue is that self.last_mentioned_persona stores a reference to the instance itself. That instance may no longer be available in case the last mentioned persona was a local persona that was deleted.
Proposed Solution
Store the ID of the last mentioned persona instead, and make last_mentioned_persona a computed property that may return None.