Commit Graph

281 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 357da3219b Chore: Add code formatting conventions as eslint rules (#5158)
* Add code formatting conventions as eslint rules

* Improve formatting in addQuickReply
2026-02-15 01:16:34 +02:00
Brioch 6c864e8bb2 feat(openrouter): add model quantizations setting (#5080)
* feat(openrouter): add model quantizations setting

* Remove bogus setting

* Simplify nullish coalescing assignment

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-01-30 23:51:22 +02:00
Beinsezii 76f70ec3c2 Add Adaptive P sampler ordering (#5022) 2026-01-16 12:41:06 +02:00
Cohee e77c1d33a6 Fix logit bias with best match tokenizer
Fixes #5017
2026-01-15 21:43:31 +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 2fb4ab3184 Add Adaptive-P settings (#4945)
* TC: Add Adaptive-P settings and UI elements

* Improve compatibility with sampler select
2026-01-03 22:25:16 +02:00
my-alt 29456b9bd2 Enhance text generation API to support model parameter for llama.cpp router mode. Update getStatusTextgen to include model in request body and improve context size handling. (#4914) 2025-12-24 16:30:45 +02:00
my-alt 7f98e3e213 Add model selection support for llama.cpp router mode (#4910)
* Add model selection support for llama.cpp router mode

- Add llamacpp_model setting to textgen-settings.js
- Implement loadLlamaCppModels() function to fetch and populate models
- Add onLlamaCppModelSelect() handler for model selection
- Update status check to load llama.cpp models when connecting
- Update getTextGenModel() to return selected llama.cpp model
- Add model dropdown to HTML UI in llama.cpp section
- Initialize event handlers and Select2 for better UX
- Add llamacpp_model to preset manager for save/load support
- Add llamacpp_model to slash commands support

This implements model selection for llama.cpp router mode, allowing
users to select from multiple models without restarting the server.
Follows the same pattern as Ollama, Tabby, and vLLM implementations.

* Correct spelling

* Fix clear selection position

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-12-21 22:51:44 +02:00
Cohee b7760ddaaa Ollama: Add reasoning content extraction 2025-12-09 00:24:52 +02:00
Beinsezii b5e20f2ff9 "N" support for llama.cpp (#4869)
* llama.cpp supports 'n' now

* Fix response parsing

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-12-08 22:50:34 +02:00
qvink a4cc9b3989 Facillitate extension use of ConnectionManagerRequestService (#4841)
* Separate prompt-building functionality from request-sending functionality

* removing logs and clarifying comments

* separating parameter construction functionality to allow ConnectionManagerRequestService to use all other preset parameters

* fixing chat completion issues, adding documentation to new functions.

* Improving ConnectionManagerRequestService errors. Adding parseReasoningFromString option to override reasoning template.

* Adjusting TextCompletionService prompt formatting

* linting

* Use settingsToUpdate to convert from OAI preset to OAI settings.

* lint

* throw errors when profile ID not found

* Fix missed instances of global completion settings being used (CC and TC), replaced with optional argument. Specified typing for ChatCompletionSettings and TextCompletionSettings.

* Adjusting parameters of parseReasoningFromString and adding getReasoningTemplateByName

* using messages.role as a fallback for custom requests, fixing newline removal.

* parameters => settings
I like how it sounds better

* ditto

* You know I had to do it to 'em

* Update getCustomTokenBans

* Fix calculateLogitBias

* Fix param attributes

* Fix type checks

* Less strict role type on ChatCompletionMessage

* Add missing space

* fixing getChatCompletionModel to use an arbitrary chat completion settings object

* Fixing issues with preset overriding custom data passed.

* Pass model to createGenerationParameters externally

* Unify seed param handling for CHUTES

* Fix non-existing CC source

* Use strict comparison

* Use global settings as a base for generation parameters creation

* removing unnecessary handling of preset fields

* don't pass preset prompts, use the passed payload override messages

* refactoring text generation prompt building of last line

* Pass model to getReasoningEffort

* Pass model name to canPerformToolCalls

* Pass model to createTextGenGenerationData

---------

Co-authored-by: qvink <qvink@users.noreply.github.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-12-03 20:09:02 +02:00
Leandro Jofré 84a1403ce0 Fix - Check for samplers in the connections pannel (#4822) 2025-11-27 00:39:29 +02:00
Cohee 91d26c4b1d TC: Add a toggle for empty json schemas (#4807) 2025-11-24 00:08:18 +02:00
Cohee ac7076c832 TC: Fix being unable to restore null JSON schema 2025-11-23 23:17:03 +02:00
Leandro Jofré e8a75c3329 Feat/Link sampler selection lock to TC API Type (#4782)
* Update - Revert connection profile change TC commands load order

This change was made to prevent preset tied samplers from breaking, such thing doesn't exist anymore.

* Update - Unlink preset renaming logic from sampler selection lock

* Update - Link TC sampler selection lock to API Type

* Fix - Clean comments

* Update - Use localforage selectedSamplers and data selectsampler as main sampler selection storage

* Fix - ESLint errors

* Update - Change lock tooltip with correct description

* Fix - Move and await sampler select localforage initializer to finish

Tried to move it to the most reasonable place possible that allowed to make an await.

* Fix - Make loadTextGenSettings async to load API selected samplers
2025-11-21 01:57:23 +02:00
Leandro Jofré 0d9a72becc Add option to keep manually selected samplers on API Type switch (#4692)
* Feat - Save and load manually selected samplers per preset

* Fix - Sync sampler popup with selected sampler state settings

* Fix - Prevent breaking visualization after disabling keep selected samplers

* Fix - ESLint errors in samplerSelect.js

* Fix - ESLint errors in textgen-settings.js

* Docs - Write JSDocs for new methods in textgen-settings.js

* Update - Make the reset button work individually per preset

* Fix - Trailing whitespace at the end of class selector

* Fix - Update tooltip information for force samplers toggle

* Fix - Prevent calling isSamplerManualPriorityEnabled a bajillion times

* Fix - Unbrick switch from manually-forced to non-manually-forced preset

This prevents samplers non controlled by [data-tg-type] from being sent to the shadow realm if they were previously hidden by [data-tg-samplers]. is_preset_switch is just to prevent breaking muscle memmory of users not using force manually selected samplers.

* Fix - Load manually selected samplers on connection profile switch

Changing preset does not update samplers ONLY IF force manually selection is disabled. Changing API before preset would update the samplers, but using the settings of the previous preset, due to preset being changed AFTER the API.

* Fix - Switch API Type controls in the API Connections panel

* Fix - ESLint errors in textgen-settings.js

* Fix - Update sampler selection only with textgenerationwebui as main API selected

* Styles - Change the sampler selection lock button icon to an actual lock.

* Fix - Await for sampler selection reset to finish

* Update - Normalize function name

* Update - Preserve manual sampler selections on preset renaming

* Fix - Properly reset sampler manual selections

* Update - Ensure selection reset displays API specific samplers

* Fix - ESLint errors

* Fix - Avoid modifying non-existent data

* Update - Move manual sampler control methods to samplerSelect.js

* Fix - Break circular file dependency between textgen-settings.js and samplerSelect.js

setting_names was unavailable during page load, throwing an error and preventing ST from loading.

* Update menu layout

* Remove pointless await

* Update param naming to camelCase

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-11-19 22:56:15 +02:00
Cohee 5837f28599 TC: Allow setting null JSON schema (#4746)
* TC: Allow setting empty JSON schema

* Fix check for llamacpp schema

* Handle grammar/schema for Aphrodite

* Conditional include for guided_json

* Update default presets with null value

* Conditional include into payload for grammar/schema
2025-11-07 23:39:52 +02:00
DreamGenX 4e428c938d update dreamgen presets (#4683)
* update dreamgen presets

* remove dreamgen presets

* remove dreamgen presets
2025-10-23 21:07:08 +03:00
kallewoof b6a055c766 bug-fix: adhere to chat template hash bound settings when a new model appears using the same hash as a bound one (#4393)
* bug-fix: adhere to chat template hash bound settings when a new model appears using the same hash as a bound one

* chore: Improve readability

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-18 10:22:37 +03:00
Forkoz b233402ac9 Ooba nsigma support. (#4258)
* nsigma index.html

* nsigma textgen-settings.js
2025-07-11 22:27:49 +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 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 c51ce1d018 Move text completion settings to respective module (#4239) 2025-07-06 16:32:48 +03:00
Cohee 9481f9989a Closes #4187 [FEATURE_REQUEST] Allow wildcards in Banned Strings List 2025-06-22 20:35:46 +03:00
Cohee fc1020a8e4 Refactor sequence breaker parsing in getTextGenGenerationData function 2025-05-11 11:07:13 +03:00
50h100a 2aa5addb1d Mancer parameters:
- Add XTC
- Add DRY
- Remove Mirostat
2025-05-10 19:04:32 -04:00
DocShotgun 3be991591f Remove special handling of nsigma for llama.cpp
* 0 now changed to disable/no-op upstream
2025-05-06 14:11:00 -07:00
DocShotgun 4a5d0df92f Translate nsigma 0 to -1 to disable for llama.cpp 2025-05-06 09:31:55 -07:00
DocShotgun bf8b3b5013 Remove tfs_z alias for llama.cpp
* This sampler is no longer supported in llama.cpp
2025-05-06 00:39:25 -07:00
DocShotgun bf66a39579 Update llama.cpp textgen settings
* Add min_keep, a llama.cpp-exclusive setting for constraining the effect of truncation samplers
* Enable nsigma for llama.cpp, and add llama.cpp alias top_n_sigma, add nsigma to the llama.cpp sampler order block
* Allow a negative value of nsigma as this represents 'disabled' in llama.cpp (while 0 is deterministic)
* Remove tfs and top_a as these are not supported by llama.cpp (tfs was removed, and top_a was never supported)
* Correct the identification string for typical_p in the llama.cpp sampler order block
* Add penalties to the llama.cpp sampler order block
2025-05-06 00:32:29 -07:00
Shinon 98e96b8c07 Check for error as well when parsing streaming responses 2025-04-30 21:23:13 +08:00
bmen25124 d42a81f97c New connection manager events, ConnectionManagerRequestService (#3603) 2025-03-16 16:58:34 +02:00
bmen25124 7d568dd4e0 Generic generate methods (#3566)
* sendOpenAIRequest/getTextGenGenerationData methods are improved, now it can use custom API, instead of active ones

* Added missing model param

* Removed unnecessary variable

* active_oai_settings -> settings

* settings -> textgenerationwebui_settings

* Better presetToSettings names, simpler settings name in getTextGenGenerationData,

* Removed unused jailbreak_system

* Reverted most core changes, new custom-request.js file

* Forced stream to false, removed duplicate method, exported settingsToUpdate

* Rewrite typedefs to define props one by one

* Added extractData param for simplicity

* Fixed typehints

* Fixed typehints (again)

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-03-03 10:30:20 +02:00
Cohee 5ecfbf3933 Fix element id for nsigma 2025-03-02 23:01:34 +02:00
Wolfsblvt 810d954d12 Add missing samplers to TC restore preset 2025-03-02 00:26:47 +01:00
Cohee 5f024823a9 Improve JSdocs 2025-02-25 10:22:03 +00:00
bmen25124 092ef26144 Exported getTextGenServer, extractMessageFromData, getPresetManager methods. Added optional parameters to some methods for generic usage. 2025-02-25 13:20:06 +03:00
Yokayo 890d10d811 Work on tl 2025-02-16 18:43:57 +07:00
Cohee 1f41124844 Remove pointless return 2025-02-16 02:13:08 +02:00
Cohee 23f0b6ed09 Add a blank line 2025-02-15 12:38:45 +02:00
Cohee c87e203b4a Refactor banned strings kill switch functions into a single toggle function 2025-02-15 12:37:48 +02:00
Cohee c37c9051a6 Fix bug when only global bans are defined 2025-02-15 00:34:07 +02:00
Cohee 8a4cf86b65 Integrate killswitch into the block 2025-02-15 00:28:38 +02:00
Cohee a2a15b9978 Merge branch 'Banned-Strings-Killswitch' into tc-global-banlist 2025-02-15 00:12:16 +02:00
Cohee 412d638e9e Text Completion: Add global banned strings list 2025-02-13 22:07:36 +02:00
Cohee d5959a4681 Add awaits to event emissions 2025-02-08 19:13:05 +02:00
RossAscends c5dad20fc4 add killswitch for banned strings 2025-02-02 12:00:01 +09:00
pcpthm 753a99faf9 Support reasoning for OpenRouter text completion 2025-01-31 21:41:56 +09:00
Cohee e3f0a8d35b TC: Trim spaces in server URLs 2025-01-30 00:25:02 +02:00