* Add persona CRUD slash commands with enhanced utilities
- Add `/persona-create`, `/persona-update`, `/persona-delete`, `/persona-duplicate`, and `/persona-get` slash commands for programmatic persona management
- Move `persona_description_positions` enum from power-user.js to personas.js for better encapsulation
- Add position and role parsing utilities (`parsePersonaPosition`, `parsePersonaRole`) with name-to-value mapping
- Extend `initPersona()` to accept optional position, depth, role, and lorebook parameters
- Refactor `deleteUserAvatar()` to delegate to new `deletePersona
* Add NaN validation for descriptionDepth parameter in createPersonaCallback
- Add isNaN() check for depth parameter after Number() conversion
- Display warning toast when invalid depth value is provided
- Fall back to DEFAULT_DEPTH when depth is NaN
- Change depth from const to let to allow reassignment after validation
* Refactor persona lookup to support avatar key targeting and fix enum provider currying
- Refactor `autoSelectPersona()` to accept optional `personaKey` parameter for targeting specific persona when multiple share the same name
- Replace manual persona lookup loops with `findPersona()` helper calls in `autoSelectPersona()` and `setNameCallback()`
- Update `setNameCallback()` to pass both persona name and avatar key to `autoSelectPersona()` for precise targeting
- Refactor `commonEnumProviders.personas()`
* Add range and silent parameters to /persona-sync command with optional confirmation suppression
- Add optional start/end range parameters to syncUserNameToPersona() function
- Add silent parameter to suppress confirmation popup when needed
- Update /persona-sync slash command to accept range argument (index or range string) and named silent argument
- Parse range using stringToRange() utility, default to full chat if not provided
- Update confirmation message to reflect whether syncing all messages or specified
* Add `from` named argument to /persona-sync command for filtering by persona name
- Add `from` named argument to filter messages by persona name (case-insensitive)
- Rename `silent` argument to `quiet` with inverted default (true) for consistency
- Add userMessageNamesEnumProvider() to provide autocomplete for existing user message names in chat
- Update syncUserNameToPersona() to accept nameFilter parameter and filter messages accordingly
- Update confirmation message to reflect name filtering when
* Add async/await wrapper to sync_name_button click handler for proper promise handling
Function now has arguments, so using just the function as the event is shown as wrong usage
* Post-merge imports fix
* Use canonical command name in examples
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* feat: emit PERSONA_CREATED event when duplicating a persona
Adds PERSONA_CREATED event emission in duplicatePersona() to notify listeners when a persona is duplicated. Includes the new avatarId, name, and duplicatedFromAvatarId in the event payload.
* fix: event data and execution order
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* fix: require long press to open swipe picker on phones
* fix: clarify parameter description in assignLorebookToChat function
* fix: update event parameter type in onSwipeCounterClick to include TouchEvent
* fix: update event parameter types in onSwipeCounterClick and addLongPressEvent
* Unify chat lorebook button click behavior with character lorebook button
* Update locale strings for chat lorebook button
* Unify chat lorebook button click behavior with character lorebook button
* Update locale strings for chat lorebook button
* Also unify character lorebook button to support Alt modifier
* Update locale strings for character lorebook button
* Update public/locales/fr-fr.json
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add long-press support for lorebook buttons on mobile
* Update locale strings for lorebook button long-press
* Fix long-press to use event delegation for dynamic elements
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: reprint non-tainted group chat on switching personas
* feat: mark chat as tainted when sending user message
* feat: mark chat as tainted when adding custom messages or captions
* feat: export createOrEditCharacter function and integrate it into retriggerFirstMessageOnEmptyChat
* fix: optimize loadPersonaForCurrentChat by storing current chat ID in a variable
* Improve conditions of first message retrigger
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* feat: allow create new world books via /getpersonabook and /getcharbook
Refactor character world info management into dedicated functions
Extract character world assignment logic from UI handlers into reusable functions
Add support for automatic lorebook creation in slash commands
Improve code maintainability by centralizing world info operations
* refactor: update boolean enum provider from onOffToggle to trueFalse in world info commands
* fix: improve world info name uniqueness check using getUniqueName utility
* Unset current persona WI on file deletion
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* fix: (new) group chat doesn't respect persona connections
Fixes#3876
* refactor: simplify persona connection filtering with destructuring and type comparison
* fix: remove redundant type check in persona connection filtering logic
(char avatar and group key *should* always be unique and different anyway, no need to check on type. Makes this more flexible)
Moves retrigger logic to setUserAvatar entry point
to avoid duplicate calls when updating personas
Removes redundant triggers from name/avatar handlers
Fixes#3774
Ensure numeric type for character ID comparisons
Explicitly converts this_chid to Number in multiple functions
to prevent type mismatch issues when checking character connections
and persona states