Commit Graph

52 Commits

Author SHA1 Message Date
Cohee 4d1619ba47 Chore: enable brace-style eslint check (#5159)
* eslint: enable brace-style check

* Fix jsdoc and color

* fix: correct CSS color syntax in CreateZenSliders function
2026-02-15 01:46:32 +02:00
Cohee 3f8acaad4e Refactor /search to use per-line async parsing (#5085)
* Refactor /search to use per-line async parsing
Supersedes #5047

* Use named type

* Cache query fragments, add file name match

* Skip invalid chat files in search

* Remove extensions from /search results

* Use file_id when appropriate

* Revert "Use file_id when appropriate"

This reverts commit aaa0274b53da6a677183b6f923163053cfd6d569.

* Clean-up file extension handling

* Move extension append down for non-group
2026-02-02 01:44:15 +02:00
Wolfsblvt 9b0f0dcc9a Fix legacy name prefix removal using wrong variable in bookmarks
Fixes leftover bug from #4993.
In both `getBookmarkName` and `createBranch`, the second regex replacement was incorrectly using the original `name` variable instead of the already-cleaned `cleanName` variable, causing the legacy prefix removal to fail.
2026-01-15 11:01:52 +01:00
Wolfsblvt 491f2a3afd Feature: Enhanced Branch and Checkpoint Naming (#4993)
* Add customizable name builder and max tries to getUniqueName utility

- Add optional `nameBuilder` parameter to allow custom name formatting
- Add `maxTries` parameter to client-side version to prevent infinite loops
- Update JSDoc with new optional parameters
- Use nullish coalescing to set default name builder function
- Default name builder maintains existing "${baseName} (${i})" format

* Add startIndex option to getUniqueName utility for flexible name generation

* Enhance branch creation to use current chat name and ensure unique names

- Import `getCurrentChatDetails` from script.js
- Replace hardcoded branch name format with current chat name as base
- Add custom `buildBranchName` function to format branch names with suffix
- Strip existing " - Branch #N" suffixes before generating new branch name
- Use `getUniqueName` utility with `nameBuilder` to ensure unique branch names
- Remove unused `mainChat` variable and replace with `mainChatName`

* Enhance checkpoint creation to use current chat name and suggest unique names

- Import `getCurrentChatDetails` from script.js to get current chat name
- Add custom `buildCheckpointName` function to format checkpoint names with suffix
- Strip existing " - Checkpoint #N" suffixes before generating new checkpoint name
- Use `getUniqueName` utility with `nameBuilder` to ensure unique checkpoint names
- Pass `suggestedName` to template and popup input for better UX
- Replace manual loop with `getUniqueName`

* Remove automatic timestamp suffix from bookmark names

* Fix getUniqueName utility to correctly handle maxTries and return null on failure

* shut up copilot

* Strip legacy bookmark and branch name prefixes when generating unique names

- Add removal of old "Checkpoint #N - " prefix format in `buildCheckpointName`
- Add removal of old "Branch #N - " prefix format in `buildBranchName`
- Change `cleanName` from const to let to allow multiple replacements
- Ensures clean base names regardless of legacy or current naming format
2026-01-12 01:07:51 +02:00
DeclineThyself 8372e7bf9d "gradually replacing property access with a dot operator" (#4965)
* "gradually replacing property access with a dot operator"
https://github.com/SillyTavern/SillyTavern/pull/4963#discussion_r2663003561

(?<=\w|\])\['([a-zA-Z]\w+)'\]
My regex found 593 matches across 47 files.
Also, two typos.

* Fixed chat[0].chat_metadata type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664275854

* Fixed `swipedElementsDiv[0]?.getAnimations().filter((a) => a.animationName` type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664274593

* Fixed config.MESSAGE_SANITIZE and config.MESSAGE_ALLOW_SYSTEM_UI type errors.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664266271

* Fixed group.date_last_chat type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664295652

* Reverted SlashCommandParser dot property access.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664310931

* LLM fixed canUseNegativeLookbehind.result; type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664314288

* Reverted chat-completions.js bodyParams and headers dot property access.

https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664317848
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664320088
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664324438

* Reverted openai.js data dot property access.

https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664326244

* Reverted tests/frontend/MacroEnvBuilder.e2e.js env.dynamicMacros dot property access.

https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664330990

* Partially reverted `window` dot property access.

* Reverted result.json() and settings dot property access.

* Reverted google.js headers dot property access.

* Fixed regex: `(?<=\w|\])\['([a-zA-Z]\w*)'\]`

* Swapped window to globalThis with dot property access.

* LLM fixed canUseNegativeLookbehind type.

* Refactor property access

* Consistency

---------

Co-authored-by: user <user@exmaple.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-01-08 23:58:21 +02:00
Cohee cd992472d5 Add deprecated user_name and character_name fields for backward compatibility 2025-11-26 19:59:05 +02:00
Cohee 929d377da8 Update group chat metadata format (#4805)
* Migrate group metadata to group chat files

* Skip migration if chat already has metadata

* Fix active group not being set on group conversion

* Improve types in createGroup

* Fix padding in hotswap group avatars

* Fix centering of empty hotswap avatar

* Added automatic backups of migrated data

* Fix 'OVERWRITE' for GC

* Fix metadata parsing order in migration

* Remove color accents from regular migration logs

* Always set gen_id in converted message

* Clone messages before conversion

* Reduce size of add/remove buttons

* Fix group chat file size calculation
2025-11-25 23:48:43 +02:00
Cohee de7c113346 Multiple attachments (#4719)
* Multiple file uploads

* mes_img_wrapper

* mes_video_wrapper

* Named export instead of function wrapper

* Update public/scripts/chats.js

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Fix optional chaining for message extra

* Preserve existing files with paste

* Improve swipe message extras clean-up

* Clean-up: Add chat_backgrounds to known images

* Add ensureMessageMediaIsArray to getContext

* Fix compatibility warning

* Update to media array

* Move de-dupe check logic

* Fix comment

* Fix clean-up logic

* Improve typing

* `feat/multi-file` Added a toggle between the old gallery and new image list. (#4722)

* Added "Toggle Gallery" button.
Added `getContainerInfo`.

* Refactor

* Change checkbox toggle to select

* Ensure media_display is set correctly only if any image_swipes were migrated

* Rename function

* Support Date in parseTimestamp

* Add type to main chat array

* Add media display reload prompt

---------

Co-authored-by: user <user@exmaple.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>

* Use a single wrapper block for media

* Fix type annotation

* Fix video display in list mode

* Refactor saveImageToMessage to include title in media object

* Use named constants in migrateMediaToArray

* Update img control styles

* Fix error container state

* Refactor onImageSwiped

* Remove redundant event handler

* Refactor expandMessageMedia

* Use shared function for display handling, fix notice logic

* Enhance ChatMessage and ChatMessageExtra types

* Refactor media display reload logic

* Improve styling for media containers

* Adjust spacing in file form styles

* Fix scroll handling in appendMediaToMessage

* Reduce flicker in appendMediaToMessage

* Extract scrollOnMediaLoad func

* Improve scroll behavior in gallery display

* Improve delegation for click events

* Add file d&d handler to #form_sheld

* Improve scroll adjust for slow connections

* Adjust debounce timeout

* Add messageMedia enum provider

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: DeclineThyself <FallenHaze@tutamail.com>
Co-authored-by: user <user@exmaple.com>
2025-11-02 20:10:43 +02:00
Cohee 39d99eb09a Add missing fields in convert to group creation 2025-08-10 18:50:56 +03:00
Cohee def10929d2 Optimize performance of getExistingChatNames 2025-06-18 20:08:07 +03:00
I fa38543b1a back to parent chat speed up by not checking for file and if there is an error or no file then send a warning. 2025-06-18 02:56:18 -05:00
Cohee 20cdcc37fc Fix fixable lints 2025-03-19 20:00:33 +02:00
Cohee c92ca8dbfb Merge branch 'staging' into integrity 2025-03-18 01:51:07 +02:00
Yokayo 40c3674da1 Update tl 2025-03-17 16:09:36 +07:00
Cohee 400d29e97e Add chat integrity check to saveChat 2025-03-16 02:24:20 +02:00
Cohee d613e1ee77 Remove group chat starter message 2025-02-27 13:29:21 +00:00
Cohee 33d8a91bf2 Linter fixes 2024-11-16 14:22:46 +02:00
Yokayo 9d664bc679 Update tl 2024-11-06 01:33:24 +07:00
Cohee 6e36b77f1a Remove TAI artifact 2024-10-31 19:57:29 +02:00
Cohee a13d3f643c Fix shift+click in chat manager 2024-09-13 21:35:42 +03:00
Wolfsblvt 6257f8b7f9 Fix /checkpoints-list with ids 2024-09-13 19:44:06 +02:00
Cohee fefa6a0f5b Update old code style 2024-09-13 20:31:50 +03:00
Wolfsblvt dc7bc30f4b Fix /checkpoint-create "mesId" argument 2024-09-13 19:29:54 +02:00
Wolfsblvt 73c14711e1 Fix checkpoint create auto generate (and more)
- Fix empty checkpoint name on mes click to auto generate
- Change /checkpoint-create to not require name and auto generate
- Fix popup input type returning empty string instead of null on empty input field
2024-09-12 23:34:37 +02:00
Wolfsblvt 748005b903 Remove unnecessary double popup for replace 2024-09-10 21:19:35 +02:00
Wolfsblvt 27e0905a1b Changes based on code review 2024-09-10 21:06:31 +02:00
Cohee 5ab781ab30 Unbreak timelines 2024-09-08 14:33:52 +03:00
Wolfsblvt 22d2b7d2a2 Add slash commands for checkpoints and branch 2024-09-08 03:28:54 +02:00
Wolfsblvt cb9e73deca Refactor bookmarks with correct async and export 2024-09-08 00:41:14 +02:00
Wolfsblvt 6c0ecdef69 Refactor move bookmark functionality 2024-09-08 00:34:03 +02:00
Wolfsblvt 6c94297724 Expand checkpoint tooltip to contain name 2024-09-08 00:20:56 +02:00
Wolfsblvt 3217087b0b Refactor checkpoint popups 2024-09-08 00:06:19 +02:00
Wolfsblvt d5b9231157 Update toeast message 2024-09-07 23:00:12 +02:00
Cohee f7de495321 Chat without character selected (#2757)
* WIP: Enable chatting without character selected

* Add burger menu item

* Neutral assistant chat space

* Revert "Neutral assistant chat space"

This reverts commit be2da4a629fb8cfef2f7387272eec9d88b9c4328.

* Revert "Add burger menu item"

This reverts commit d4e8d990c1ae847a4bc18ee0d4b886cbcd065b7f.

* Use simple ephemeral chats

* Only start a new assistant chat if not already in it

* Don't emit event not to clear pending files

* Allow edits, disable checkpoints and branches

* Exclude from tags, allow copy

* Allow hide/unhide

* Allow zooming avatar

* Suppress warning

* Rename neutral character

* Rename neutral back to Assistant
2024-09-03 20:36:30 +03:00
Succubyss a031dbfbc8 fix initial group chat message timestamp when empty 2024-07-24 16:46:19 -05:00
Wolfsblvt 54e111886b Improve logs (+add toasts) on save calls
- Fixes #2429
2024-06-28 03:28:16 +02:00
Wolfsblvt 1c6c9efba1 Refactor convert to group chat to new popup 2024-06-27 01:01:43 +02:00
Cohee 439ef0dc5e #2308 Preserve itemized prompts for branches and checkpoints 2024-05-25 00:07:36 +03:00
Cohee 960c91c147 Add confirmation for convert to group 2023-12-17 21:14:16 +02:00
valadaptive 8027372fc2 Rename group API endpoints 2023-12-06 19:59:58 -05:00
valadaptive 6efe95f4f1 Rename chat API endpoints 2023-12-06 19:58:24 -05:00
valadaptive b689b8bd30 Rename character API endpoints
Precursor to moving the character API into its own module
2023-12-04 17:35:06 -05:00
Cohee 4cb9cd128f Rename bookmarks to checkpoints 2023-12-03 03:11:14 +02:00
Cohee 64a3564892 lint: Comma dangle 2023-12-02 22:06:57 +02:00
Cohee c63cd87cc0 lint: Require semicolons 2023-12-02 21:11:06 +02:00
valadaptive a37f874e38 Require single quotes 2023-12-02 13:04:51 -05:00
valadaptive 518bb58d5a Enable no-unused-vars lint
This is the big one. Probably needs thorough review to make sure I
didn't accidentally remove any setInterval or fetch calls.
2023-12-02 12:11:19 -05:00
city-unit 440ecfc991 Fix toasts 2023-09-21 00:40:38 -04:00
city-unit e0b5df97c4 Add branching as distinct from bookmarking 2023-09-20 22:48:05 -04:00
Cohee 6dd09858d4 Don't remove names from the past chat. Fix non-streaming auto-continue.
We took fair criticism from the NovelAI dev.
2023-09-15 23:32:01 +03:00