Commit Graph
1801 Commits
Author SHA1 Message Date
Cohee ff8d7d64fc a11y: Setup observers for element roles (#4469)
* a11y: Setup observers for element roles

* Reuse a function

* Add error handling
2025-09-01 17:24:13 +03:00
Cohee 5e4bb0415e OpenRouter: Add Google image output parsing 2025-08-26 22:01:38 +03:00
e9e14001e3 Update ru-ru locale (#4449)
* Work on tl

* Small fix

* Fix formatting

---------

Co-authored-by: Yokayo <nonameutubecomm@gmail.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-26 20:37:55 +03:00
Cohee e37b709e96 Add Harmony template (#4431)
* Add Harmony template

* Add Thinking instruct variant and reasoning template

* Specify template hash from unsloth

* Add ggml-org template hash
2025-08-24 20:36:49 +03:00
Cohee dec25d1288 Remove continue prompt "clean-up" function (#4422)
* Remove continue prompt "clean-up" function
Fixes #4415

* Simplify generatedPromptCache handling
2025-08-24 18:03:22 +03:00
RendalandCohee 982b254d01 Add support for maximizing alternate greeting editor (#4413)
* Add support for maximizing alternate greeting editor.

* Use a common style class

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-21 19:30:20 +03:00
MAX-TABandCohee f107df8ca6 feat: Add Character Quick Reply Sets (#4215)
* charQR

* fix

* fix_2

* fix_3

* Fix refresh errors and Implement confirmation dialog logic

* FIX : The character's quick reply set is executed three times during the initial authorization and import.

* Enhance warning dialog content and layout

* refactor: Use local linking for Char QR sets instead of embedding

* Lint fixes

* Clean-up

* Emit CHAT_CHANGED on character deletion

* Remove isVisible filter, I'm sure it was by design

* Revert order of search in executeQuickReplyByName

* fix: Address review comments

* Add private tag to Char Sets

* Add QR rebind on renamed character

* Clean-up diff

* Don't save empty config lists

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-20 20:53:21 +03:00
Christoph 667116f4ff Fix overly sticky auto-scroll behavior (#4382)
The problem: Auto-scroll is overly sticky. While a generated message is streaming in, it is almost impossible to cancel the auto-scroll behavior by scrolling up, it just snaps back down.

The reason is that the 'wheel' and 'touchmove' events trigger before the scroll position is updated. So the scrollIsAtBottom value never becomes false. That is, unless the user manages to scroll up quick enough to beat the call to scrollChatToBottom() in onProgressStreaming().

The 'scroll' event is better because it fires slightly later in the scroll behavior. This makes canceling auto-scroll by scrolling up much more reliable.

Making auto-scroll cancelling more reliable has the side effect that resuming auto-scroll becomes harder. To even this out, this change slightly increases the tolerance for resuming auto-scroll to 5 pixels. This is small enough to be generally unnoticeable but significantly easier to hit than the previous 1 pixel.

I tested this change in
* Firefox on Linux
* Chrome on Linux
* Firefox on Android
* Chrome on Android

In all cases, the auto-scroll behavior is greatly improved:
* While auto-scrolling, scrolling a little bit up immediately cancels the auto-scroll behavior.
* Scrolling all the way down resumes the auto-scroll behavior.
2025-08-14 23:53:26 +03:00
Cohee a88afde22e Do not delete tool call messages containing just the reasoning 2025-08-11 20:34:23 +03:00
Cohee fb058816e8 Add trim argument to /gen and /sysgen. Closes #4361 2025-08-10 15:14:45 +03:00
CoheeandCopilot b0820c4517 Text Completion: Inject Story String @ depth (#4362)
* TC/AF: Add Story String position

* Update public/scripts/power-user.js

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

* Add before/after anchors as story string params

* Move autofix story string at settings load

* Substitute in story string wrappers

* Only add an auto-newline after story string if wrap is enabled

* Do not init names_force_groups with default value

* Update default settings

* Auto-delete obsolete fields from instruct templates

* Update default templates

* Remove newline from GLM-4 prefix

* Format as one line

* Remove auto-fix leftovers from renderStoryString

* Remove pointless reassignments in autoFixMissingField

* Update KoboldAI template

* Add info hint for Story String sequences

* Update default templates

* Reformat extractMessageFromData

* Fix condition in autoFixStoryString

* Update tooltip text for Story String Sequences

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-09 20:33:04 +03:00
Cohee 00121b281a Merge pull request #4347 from crimeragames/release
Fix duplication of multi-line example message separators in instruct mode
2025-08-03 14:10:42 +03:00
angry bird 8b5d1e9610 Update script.js 2025-08-02 19:55:15 +02:00
angry bird 2a96d622fb Fix duplication of multi-line example message separators in instruct mode 2025-08-02 19:45:43 +02:00
Cohee d21afa1ae5 Fix Magistral latest reasoning extraction
Fixes #4339
2025-08-01 19:58:09 +03:00
Aleks L.TandCohee e712ededc9 fixes #4324: injectedIndices becomes invalidated with a off-by-one in… (#4325)
* fixes #4324: injectedIndices becomes invalidated with a off-by-one index shift when PHI/jailbreak message is added. Could lead to dropped injections/history.

* Run formatter

* Fix pre-allocation of injections in Text Completions prompt builder

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-07-28 21:54:32 +03:00
Cohee 7b67769c92 Fix convert to persona with unusual names (#4319)
* Fix convert to persona with unusual names

* Fix picking new persona on current persona deletion

* Prefer actual path on page reload
2025-07-27 14:16:15 +03:00
Cohee a8bb8a6703 Add hint popup on string length overflow 2025-07-26 18:20:45 +03:00
Cohee d641cbecc4 Remove Scale Spellbook from CC sources (#4293) 2025-07-24 22:02:45 +03:00
CoheeandCopilot e0b020f211 Import BYAF (#4300)
* allow byaf import format

* Add byaf import converters

* Fix import of image and scenario

* Update src/byaf.js

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

* Log JSON parsing errors

* Use fsPromises for file acces

* Fix callback variable name

* Clear file input value after file upload to allow re-uploading

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-23 23:05:14 +03:00
Cohee 7429726eb1 Remove Window AI from CC sources (#4294) 2025-07-22 19:45:54 +03:00
Cohee 6217ea9888 Navbar: Do not wait for animation duration if it's zero 2025-07-21 21:11:16 +03:00
Cohee c292f64163 Add generation type triggers to world info (#4286)
* Add generation type triggers to world info

* Simplify includes check

* Refactor getEntryField validation and default value handling

* Remove invalid attribute

* Check for a valid trigger
2025-07-20 00:22:54 +03:00
CoheeandCopilot ba12b32a1f Characters list top panel touchup (#4282)
* Move search bar under buttons
Closes #4275

* Remove horizontal rules from right menu

* Add toggle for search form

* Add container for extension rm buttons

* Be square or be there

* Adjust font sizes

* Square enlargement program

* Adjust margins

* Remove margin from pagination outlet buttons

* Adjust margin on tag controls

* Collapse 1px margins

* Update public/script.js

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

* Remove variable assignment

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-18 20:01:44 +03:00
Cohee d9f4028952 CC/PM: Add generation type trigger prompt filter (#4281)
* CC/PM: Add generation type trigger prompt filter
Closes #4276

* Fix element cast type

* Narrower element types

* Change trigger to multiple select

* Extract class scope function

* Fix control name

* Add 'enabled' property to Prompt class and update type annotations in PromptManager methods

* Clarify placeholder of multiselect
2025-07-17 21:27:26 +03:00
Cohee 1a92157643 Refactor generateRaw/generateQuietPrompt calls (#4277)
* generateQuietPrompt: Update to object arguments

* generateRaw: Update to object arguments

* Fix jsdoc

* Fix lint

* Unwrap JSON schema options

* Remove default args from gen call
2025-07-15 23:11:31 +03:00
bmen25124andCohee cd176039ef Added structured output for common APIs (#4272)
* Added structured output for common APIs

* eslint

* Added frontend impl

* Type name change

* Unprefix json_schema, apply review suggestions

* Add schema to generateQuietPrompt, add comments

* Prettify diff

* Extract JSON from Claude response

* Add structured gen for Mistral

* Hack to support schema for DeepSeek

* Hack JSON schema for AI21

* Add Groq structured gen

* Add JSON mode for pollinations

* Add JSON schema for perplexity

* Add JSON schema for AIML

* Using extractJsonFromData in custom-request, added google rules for flattenSchema

* Fix response parsing

* Fix Google

* Fixed json parse

* Expose generateRaw to getContext

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-07-15 21:54:36 +03:00
556fb4ba08 adding prefill parameter to generateRaw() (#4266)
* adding prefill parameter to generateRaw()

* additional comments

* Substitute params in prefill

* Add prefill prompt for /genraw command

* Fix param comment

* fixing generateRaw param comment

* fixing param comment

---------

Co-authored-by: qvink <qvink@users.noreply.github.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-07-14 20:51:53 +03:00
db318cd75c Ability to specify multiple messages and roles in generateRaw() (#4264)
* adding capability for generateRaw() to specify roles of messages for chat completion

* linting

* additional comments

* Apply review comments, fix type errors

* Fix joiner for non-instruct prompts

* Format joint prompt for novel, fix prefix for non-instruct

* Fix role for string prompts

* Do not trim sysprompt for instruct

* Do not prefix names for CC

* Append newline to systemPrompt in instruct

---------

Co-authored-by: qvink <qvink@users.noreply.github.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-07-13 22:04:44 +03:00
Cohee 19a8a8625c Move event types + new events (#4257)
* Move app events to separate module

* Add event emission for preset changes and deletions

* Remove unnecessary blank line at the beginning of events.js

* Add await to selectPreset call in initTextGenSettings

* Emit events for preset deletion and change in initPresetManager

* Move event emit out of PRESET_CHANGED
2025-07-11 22:00:04 +03:00
Cohee f8b0e8f2ad Move system messages init into separate module (#4251)
* Move system messages init into separate module

* getSystemMessages => initSystemMessages
2025-07-10 19:22:16 +03:00
Cohee d785e7a7ce Makes sense that a new temp chat starts if you were already on a temp chat 2025-07-10 09:21:10 +00:00
Cohee f477ed1d74 Move CHAT_CHANGED injects revive listener to initDefaultSlashCommands 2025-07-10 00:11:00 +03:00
Cohee 96bdc13937 Replace ajax with fetch (#4241)
* Replace ajax with fetch
Fix type errors in power-user / group-chats modules

* Fix single sprite upload

* Return empty object on failed upload
2025-07-06 23:27:53 +03:00
Cohee 55ca4c89b6 Disallow message edits while in delete mode 2025-07-06 20:55:16 +03:00
CoheeandCopilot 28189bb1c7 Move default slash commands to respective module (#4240)
* Move default slash commands to respective module

* Update public/scripts/slash-commands.js

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-06 17:17:19 +03:00
Cohee 8449b4bb27 Move Horde status check to respective module 2025-07-06 16:38:52 +03:00
Cohee c51ce1d018 Move text completion settings to respective module (#4239) 2025-07-06 16:32:48 +03:00
Cohee 3d488a5e7b Move DOMPurify hooks to chats module 2025-07-06 16:13:22 +03:00
CoheeandCopilot 2f56a73368 Move NovelAI settings to respective module (#4238)
* Move NovelAI settings to respective module

* Update public/scripts/nai-settings.js

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-06 16:05:26 +03:00
Marcela Petra Ferraz de NovaesandCohee 38a7668535 Feature/add character tags to message div option (#4225)
* Adding toggle.

* Adding events for the new toggle. Reloading chat when toggled.

* Adding chat reload when tags are added or removed to char.

* Adding main applyCharacterTagsToMessageDivs function to add tags to divs.

* Adding information that the class name is normalized and lowercased to the tooltip.

* Correcting console.traces to console.debug for minimal console printing.

* Lint indentation fix.

* Adding simple cache.

* Adding reload event when a new message is added to chat.

* Changing tags applied from classes to HTML data API.

* Adding guide showing how to select data attributes with CSS.

* Fixing trailing comma pointed out by lint.

* Simplifying re-rendering by deleting previous attributes.

* Adding the feature as default behavior, removing toggles. Will add docs to ST docs.

* Removing code that is no longer needed.

* Re-rendering divs after other tag operations.

* Filtering message ids to only re-render specific divs. Adding suggested changes.

* After testing, it seems to add all messages by one, so it appears it's not needed call this in the printMessages function.

* Lint fixes.

* Cache jquery selector

* Fix local variables assignment

* Move new functions to tags module

* Normalizing tag names before adding them as data-*

* Replace commas with spaces to avoid issues with tag names containing commas.

* Correcting where the comma replacing should go.

* Add error handling for applyCharacterTagsToMessageDivs

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-07-05 22:37:43 +03:00
CoheeandCopilot e0469b4808 Move Kobold Classic settings into related module (#4234)
* Move Kobold Classic settings into related module

* Update public/scripts/kai-settings.js

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-05 21:00:06 +03:00
Cohee fad1fa3a33 Hide prompt cost block for non-TC APIs 2025-07-05 20:52:29 +03:00
CoheeandCopilot 8a6e6503f5 Move itemized prompts into separate module (#4229)
* Move itemized prompts into separate module

* Update public/scripts/itemized-prompts.js

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

* Update public/scripts/itemized-prompts.js

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-05 16:21:17 +03:00
Cohee 257883a5f9 Fix creation of characters with additional WI files assigned 2025-07-04 20:33:17 +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 649a4b19f4 Revert old logic of zoomed img resolve 2025-07-04 01:33:08 +03:00
Cohee 46eb01d8be Fix clickable avatar 2025-07-04 01:29:08 +03:00
Cohee 1e63fdd4b3 Clean-up console.trace calls 2025-07-04 01:25:47 +03:00
kallewoofandCohee 1b2976ae1d feature: customizable mappings for presets per model name / chat template (#4153)
* feature: customizable mappings for presets per chat template

This adds the ability to assign custom context/instruct presets on a per-chat-template(-hash) basis. Users using custom templates may use this feature to auto-enable the preset of their choice, rather than the built-in defaults.

* fix: do not use chat tempate based instruct preset derivation if a preset was auto-selected already

This fixes issues where regex matched presets are overridden.

* reset chat template hash on connect

* handle derive_mappings being null

* unorthodox eslint requirement adherence

* button styling

* un-nest derivation related properties

* Migrate setting

* add bind model to preset button to the miscellaneous section

* switch to unified button for model preset mappings

* fix bind UI

* eslint

* do not include koboldcpp/ggml-model-xxx.gguf in preset saving

* review fixes

* stray console.log / eslint

* Update checkbox state if no model map exists

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-06-29 18:04:00 +03:00