Commit Graph
187 Commits
Author SHA1 Message Date
5865a1a85b Allow extensions to specify minimum ST client version (#4350)
* allow extensions to specify minimum client version

* using existing version compare function

* Move versionCompare to utils module

---------

Co-authored-by: qvink <qvink@users.noreply.github.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-05 00:31:05 +03:00
Cohee ea5181af08 Preset Manager: Add methods for reading/writing custom data (#4246)
* Preset Manager: Add methods for reading/writing custom data

* Fix loading novel extensions on load

* Move ensurePlainObject to utils

* Init empty object in convertNovelPreset
2025-07-09 23:55:08 +03:00
Cohee a029a6e1f1 Fix convertTextToBase64 for large files
Reference: https://github.com/google/closure-library/blob/b312823ec5f84239ff1db7526f4a75cba0420a33/closure/goog/crypt/crypt.js#L104-L123
2025-07-07 12:57:48 +00:00
CoheeandCopilot e1a55408b6 OpenRouter: match both id/text in select2 (#4237)
* OpenRouter: match both id/text in select2

* Update public/scripts/utils.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-06 14:41:25 +03:00
GregW6andCohee 1547a53d7c Refactor: Replace Deprecated Code (#4221)
* refactor: ♻️ Replace deprecated code defined within this repository

- Replace ““/public/scripts.js” > `callPopup`” with ““/public/scripts/popup.js” > `callGenericPopup`”.
- Replace ““/public/scripts/tokenizers.js” > `getTokenCount`” with ““/public/scripts/tokenizers.js” > `getTokenCountAsync`”.
- Replace ““/public/scripts/extensions/assets/index.js” > `executeSlashCommands`” with ““/public/scripts/extensions/assets/index.js” > `executeSlashCommandsWithOptions`”.

* refactor: ♻️ Replace deprecated code from standard library

1. Replace set of deprecated `escape` and deprecated `unescape` functions with `encodeURIComponent` and `decodeURIComponent` functions.
2. Replace set of `encodeURIComponent` and deprecated `unescape` functions with a custom `convertTextToBinaryString` function.

* refactor: ♻️ Replace deprecated code imported from external library

All of them is from jQuery.
1. Replace `$(document).ready(() => { ... })` → `jQuery(() => { ... })`.
2. Replace event type direct calls.
    1) Change
        - `$('...').change(function () { ... })` → `$('...').on('change', function () { ... })`.
    2) Click
        - `$('...').click(function () { ... })` → `$('...').on('click', function () { ... })`.
        - `$('...').click()` → `$('...').trigger('click')`.
    3) Focus
        - `$('...').focus(function () { ... })` → `$('...').on('focus', function () { ... })`.
        - `$('...').focus()` → `$('...').trigger('focus')`.
    4) Blur
        - `$('...').blur(function () { ... })` → `$('...').on('blur', function () { ... })`.
    5) Keyup
        - `$('...').keyup(function () { ... })` → `$('...').on('keyup', function () { ... })`.

* refactor(Attachment): ♻️ Merge `convertTextToBinaryString` and `convertTextToBase64`

`convertTextToBase64` function use `Uint8Array.prototype.toBase64` if supported by the Browser and use a combination of `Window.btoa` and `String.fromCharCode` as fallback.

* fix: 🐛 Fix Bind World Info to Character Card

Using the new `Popup` class.

* fix: 🐛 Fix Bind World Info to Character Card

Using the new `Popup` class.

* refactor: 🐛 Refactor and fix Character World Info popup

Add singleton back and some optimization.

-   **🛡️ Singleton Pattern:** Implemented a singleton pattern using the `characterWorldPopup` variable. This prevents multiple instances of the popup from being created, ensuring a clean and predictable UI. If the popup is already open, it will be brought into focus instead of creating a duplicate.
-   **♻️ Improved Readability:** The event handling logic has been extracted into clearly named functions (`handlePrimaryWorldSelect`, `handleExtrasWorldSelect`), making the `Popup` constructor cleaner and the overall code more readable and maintainable.
-   **⚙️ Optimized Performance:** The new implementation caches frequently accessed values and jQuery selectors, reducing redundant DOM lookups and improving performance.

---

* refactor(Chat): ♻️ Modernize chat deletion confirmation

Replaces the deprecated `callPopup` with the modern `callGenericPopup` for the chat deletion confirmation dialog.

* Fix /delchat command

* Remove unused code

* Fix type. Change value to debug log

* Remove value logs

* Remove singleton pattern for openCharacterWorldPopup

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-07-04 19:42:51 +03:00
Cohee dbe0111034 Refactor saveBase64AsFile uploads (#4200)
* Refactor saveBase64AsFile uploads

* Add request body check

* Extract server-side constants

* Allow .jfif media attachments

* Allow .bmp uploads

* Enhance image prompt handling: support additional MIME types and prevent upscaling in thumbnails

* Convert file extension to lowercase

* Enhance thumbnail creation: improve image quality and add white background

* Add toast for error in media upload
2025-06-25 21:34:08 +03:00
Wandering MouseandCohee 116bef6c9f Add support for characterFilter to getEntryField and setEntryField (#4185)
* Add support for characterFilter to getEntryField and setEntryField

* No more conflicts between lint and autoformat

* Fix array type default values hint

* Properly capitalize name

* Fix search by name

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-06-21 22:10:56 +03:00
Cohee 8d2b9d2dab Secrets manager (#4131)
* Secret manager (now for real)

* Refactor secret manager dialog

* Add error handling to secrets migration

* Adjust default value

* Add secret-id slash command

* Add secret management slash commands

* Improve type definitions

* Improve compatibility of UUID generator

* Add copy buttons to manager view

* Improve compatibility with Vertex AI service account
- Changed to input since textarea can't be used with datalist
- Unblock regular key placeholder
- Save email as a key label
- Interrupt validation if the input is a UUID (autocompleted)

* Add optional label input for secret values in key manager dialog

* Update masking rules

* /secret-id: make the arg "required" (it's not)
2025-06-11 21:26:19 +03:00
Cohee 732ca6c4e0 Don't toggle drawer if elements not found 2025-06-08 01:55:02 +03:00
Cohee 6dc2077507 Fix expand/collapse all entries 2025-06-06 09:40:59 +00:00
Cohee e12e0ccd84 Support ISO 8601 timestamps 2025-05-26 01:20:28 +03:00
Cohee 4e0685f998 Revert comment 2025-05-04 14:05:44 +03:00
Cohee 1e57342639 Use objects for pagination select creation 2025-05-04 12:56:23 +03:00
Yokayo b9383ace1e eslint fixes 2 2025-05-03 18:16:02 +07:00
Yokayo e27fca6628 eslint fixes 2025-05-03 18:14:26 +07:00
Yokayo 1822c4f91b More work on tl 2025-05-03 18:12:18 +07:00
Cohee a089727591 Extract templates, replace pagination format 2025-05-01 17:46:02 +03:00
Yokayo 666d5712c7 A bit more clarity 2025-04-28 19:03:18 +07:00
Yokayo c453e94486 eslint fixes #2 2025-04-28 18:56:43 +07:00
Yokayo f0d01d35a6 eslint fixes 2025-04-28 18:55:10 +07:00
Yokayo 11908f7363 Work on tl 2025-04-28 18:45:16 +07:00
Wolfsblvt 6eb89bd21c fix some linting 2025-04-25 20:58:28 +02:00
Cohee 058fef1146 Update Jimp and add WASM plugins (#3784)
* Update jimp, use WASM format plugins

* Fix Jimp import path in thumbnails endpoint

* Fix size variable

* Add fetch patch to handle file URLs

* Fix JPEG thumbnailing

* Enhance fetch patch to validate file paths and support specific extensions

* Add default msBmp format

* Update jsconfig

* Update JPEG color space in thumbnail generation to YCbCr

* Install jimp plugins explicitly

* Refactor fetch patch utility functions
2025-04-01 21:55:21 +03:00
Cohee 6af3f2ee7e Remove unused splitSentences function from utils.js 2025-03-12 23:29:55 +02:00
Cohee 1b817cd897 Kokoro: chunk generation, add pre-process func
#3412
2025-03-12 21:35:09 +02:00
Cohee e7189a1260 Refactor hideMessageCallback and unhideMessageCallback to remove unnecessary console logs. Introduce onlyUniqueJson and sortIgnoreCaseAndAccents utility functions 2025-03-12 10:18:02 +02:00
Cohee 1026e1f8e9 Add "name" argument to /hide and /unhide. Add default value for unnamed argument 2025-03-11 23:14:31 +02:00
e23f3a6314 feature: 'kokoro-js' supports TTS #3412 (#3656)
* feature: 'kokoro-js' supports TTS #3412

* Linting, add credits for kokoro library

* Fix voice preview

* Fix display languages on previews

* Fix settings restoration. Debounce model init on settings change

* Fix engine sorting

* Move TTS processing to a web worker. Remove unused gain setting

* Speaking rate fix

* Update status when recreating a worker

* Pass voices list from TTS engine

* Call dispose function on provider change

* Extend worker init timeout to 10 minutes

---------

Co-authored-by: ryan <1014670860@qq.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-03-10 22:54:54 +02:00
Wolfsblvt 8aadada0e2 utility: let setInfoBlock also clear 2025-02-22 21:50:58 +01:00
Wolfsblvt 8bd4fd76ae Merge branch 'staging' into persona-improvements 2025-02-22 19:23:59 +01:00
Cohee 434bdab585 Merge branch 'staging' into fix-char-rename-aux-connections 2025-02-17 20:57:23 +02:00
Wolfsblvt 4f0921856f On char rename, update auxiliary connections
- Move WI char lore (additional lorebooks) based on rename
- Move character-bound Author's Note based on rename
- Extend core `getCharFilename` to be able to take an avatarKey, instead of just uid
2025-02-17 05:32:13 +01:00
Wolfsblvt 9590127bae Handle auto parsing reasoning during streaming
- Add function to handle auto parsing reasoning from the streamed message during streaming
- Only works when the reasoning prefix is EXACTLY at the beginning of the message
- Tried to keep this lightweight, no regex parsing, remembering the index, so it's simple string splicing
- Add utility function that trims a string only if `trim_spaces` is enabled
2025-02-16 03:09:20 +01:00
Wolfsblvt 21af0243d6 Rework reasoning CSS selectors and fixes
- Remove reliance on :empty state of reasoning textbox, now using the actual css class on mes (".mes.reasoning")
- Fix reasoning add not working when Auto-Expand is not enabled
- Clean setting of dataset attributes, now removing when null
2025-02-11 21:45:54 +01:00
Cohee 07ef5122bb Add fallback timeout to runAfterAnimation 2025-01-30 22:00:30 +02:00
Wolfsblvt f9324c74cd Streamline persona toasts, infos and states
- Added "info" block to persona description panel to show when a temporary persona is in use. Hide the long text behind a tooltip
- Reduce toast spam even further, not showing toasts when persona panel is open
- Restyle connection state buttons a bit
- Designed common 'info-block' utility to show markdown-like info blocks, with CSS styling
2025-01-30 00:50:48 +01:00
Cohee 6e2b5d5dc8 Fix copy actions for non-HTTPS/localhost
Fixes #2352
2025-01-16 01:55:26 +02:00
Cohee f869b26664 Ensure unique selectors for loaded extension files 2025-01-09 22:32:15 +02:00
Cohee e33e0b1e64 trimToEndSentence: fix emoji trim after whitespace 2024-12-26 10:45:10 +02:00
Cohee 713c05f808 Add /getcharlore and /getpersonalore commands
Closes #3183
2024-12-14 18:48:14 +02:00
AlpinDale bcbfcb87b5 aphrodite: send an empty sampler priority list if using the default order 2024-12-09 14:05:33 +00:00
Cohee 9493d05f2c Localize only the moment instance 2024-10-28 11:01:48 +02:00
Cohee f918b146e7 Merge branch 'staging' into webpack 2024-10-17 23:08:36 +03:00
Cohee a3693ccf6d Use deepMerge to combine payloads 2024-10-17 22:45:33 +03:00
Cohee 2620522333 Revert epubjs vendoring 2024-10-17 20:59:42 +03:00
Cohee e48cf68a13 Revert pdfjsLib vendoring 2024-10-17 20:53:18 +03:00
Cohee 81bdeb6da8 unvendor: Replace moment 2024-10-17 02:02:45 +03:00
Cohee ca844c8b0a unvendor: Replace Readability 2024-10-17 01:30:04 +03:00
Cohee a32fe00e34 unvendor: Replace pdfjs-dist 2024-10-17 01:16:39 +03:00
Cohee 553920ee8e unvendor: Replace epubjs 2024-10-17 01:03:33 +03:00