Commit Graph

245 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
Cohee 5a7875ba28 Update Pollinations API (#5060)
* Upgrade Pollinations API
Done: text, caption
To do: TTS, image
Fixes #5020

* Update Pollinations TTS to new API

* Update Pollinations API for images
2026-01-26 20:31:13 +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 f4b071e71a Fix: Prevent swipe hotkeys when focused into a video element 2025-12-11 00:59:29 +02:00
DeclineThyself 7c24667f49 Fixed isModifiedKeyboardEvent order of operations. (#4866)
https://github.com/SillyTavern/SillyTavern/pull/4819#discussion_r2595641856

Co-authored-by: user <user@exmaple.com>
2025-12-07 21:37:32 +02:00
Ben 55a07d445d Chutes integration (#4844)
* Chutes integration

* Fix eslint

* Fix key saving

* Fix logo coloration

* Fix tool checks

* Unhide image inlining controls

* Fix order of options

* Fix type use in TTS extension script

* Add Chutes as a vector storage source

* Change log levels to debug

* Fix streamed reasoning parsing

* Skip remote models update

* TTS: Fix API key highlight

* Sort image models A-Z

* TTS: Fixes

* Remove unused SD endpoint

* Skip setting context size if models list is not yet loaded

* remove chutes quota / balance

* Fix: streamed tool calling

* Hide reasoning effort control

* Add image request debug log

* Fix: scroll down on media load in extensions

* Unhide some samplers

* Bring back reasoning effort

* This code will never execute

* Reformat else if cases

* Add stop strings to request

* Remove conditional from reasoning_effort body param

* Preserve original pricing fields

* Unhide logit bias setting

* Pass repetition penalty and logit bias to backend

* Swap llama tokenizer for llama3

* Pass min_p, remove supported_sampling_parameters checks

* Enable logprobs

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-12-01 00:17:49 +02:00
Cohee 3c7d81571d Fix: button visibility checks in swipe gesture handlers 2025-11-27 12:56:24 +02:00
DeclineThyself fc85b205ac Backport feat/chat-tree and fix #4709 (#4712)
* Performance improvements due to using chatElement instead of $('#chat').

* Reverts change `hideSwipeButtons()` change.

https://github.com/SillyTavern/SillyTavern/pull/4576#discussion_r2394996102

* I’ve been working on a PR for issue #1731: [Swipes on every AI message, not just the last one](https://github.com/SillyTavern/SillyTavern/issues/1731). I’d appreciate feedback to avoid unnecessary effort.

Currently, I have User and Assistant branches working.
I have not touched `/api/chats/save` or '/api/chats/get', so branches do not persist.

To keep `context.chat` unmodified (so extensions and the rest of the code remain unaffected), I’ve stored branches in `chatTree`:
```javascript
chatTree = {
  branch_id: 1,
  branch: [
    { mes: "Hi" },
    { mes: "Hello", branch_id: 0, branch: [...] },
  ]
}
```

When a message is swiped, chatTree is updated via `saveChatToTree()`, then the next branch is loaded using get`ChatFromTree()`.

Questions:
According to Cohee: [This requires reorganizations in the file format for chats, not viable in the short term.](https://github.com/SillyTavern/SillyTavern/issues/1731#issuecomment-1937845036)
I'm hesitant to proceed. May I store chatTree.json files alongside the existing .jsonl chats?
Should I create a new /save endpoint, modify the existing one, or discontinue using .jsonl for saving.

Known issues:
Branches do not persist on refresh.
Swiping multiple messages at once throws `Cannot read properties of undefined (reading 'mes')
`. This will be fixed in the UI.
Branches persist between chats/characters. This will be fixed when loading a chat.
The Swipe arrows overlap with messages.
No animation plays when swiping then editing a user message.

* Fixed bug.

Gemini:
The calculation of mesId is fragile and contains a bug. The fallback chat[chat.length - 1] is a message object, and Number(object) will result in NaN. This will break the swipe functionality if the preceding expressions are falsy. Additionally, chat.indexOf(message) will almost always point to the last message in the chat, which is incorrect when swiping on an earlier message.

A more robust approach is recommended to reliably get the message ID from the clicked element.

    const mesId = Number($(this).closest('.mes').attr('mesid'));

* Fixes swipes on long chats.

* chatTree is now persistent. Fixed bugs.

* Fixed bugs.
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2390042262
The logic to rename the chat tree file (.json) is currently in an unreachable else block. The if condition !fs.existsSync(pathToOriginalFile) || fs.existsSync(pathToRenamedFile) will almost always evaluate to true after the preceding copyFileSync and unlinkSync operations, because pathToOriginalFile will no longer exist. This prevents the chat tree file from being renamed, which breaks the persistence of message branches when a chat is renamed.

The scrollChatToMessage function is implemented incorrectly. Calling .scrollTop() without any arguments on a jQuery object retrieves the current vertical scroll position; it does not scroll the element into view. This function will not have the intended effect of scrolling the chat to the specified message.

* Fixed bugs. https://github.com/SillyTavern/SillyTavern/pull/4573#pullrequestreview-3282889120

There's a typo in the property name being deleted. It should be branch to match the data structure you've defined, not branches. This error will prevent the pruning logic from working correctly, potentially leading to corrupted or bloated chatTree data.

The modified treeData is not being saved here. Instead, the global chatTree is being sent in the request. This will cause any renames of group members within message branches to be lost upon saving. You should send treeData, which contains the modifications.

This function may have performance issues on large chats due to multiple structuredClone calls within a loop. swipelessMessage is created from a deep clone, and then it's deep-cloned again for every swipe. While this ensures data integrity, it is inefficient. Consider refactoring to reduce the number of deep-cloning operations, for instance, by creating swipelessMessage once per message and deep-cloning it only when creating a new branch for a swipe.

* Fix warning. https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2390183161

The logic for renaming the chat tree file seems to have a flaw. The condition !fs.existsSync(pathToOriginalTreeFile) || fs.existsSync(pathToRenamedTreeFile) will be true if the original tree file does not exist. In this case, a warning is logged. However, it's a valid scenario for a chat to not have a corresponding tree file, so no warning should be logged. The current logic could lead to confusing log messages.

* Refactored chatTree into `public/scripts/chat-tree.js`.

https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2390269514

* Displaying swipes on past messages and the entire chat tree functionality is now an opt-in toggle.

https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2390273599

* Only allow one concurrent swipe.
Fixed:
Swiping multiple messages at once throws Cannot read properties of undefined (reading 'mes') .

* Fixed bugs.
Now `swipe_id >= swipes.length` is set to swipes.length.

* Fixed bug.
Swiping a user message did not re-show swipe buttons after the generation finished.

* Moved `Show Swipes for All Messages` Toggle to `Chat/Message Handling`.
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2395008961

* `JSON.stringify doesn't add spaces by default`
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2395047031

* Fixed "Tree file left behind when renaming chats"

https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2395546142

* Fixed "Guard chatTree recursion in group member rename"
https://github.com/SillyTavern/SillyTavern/pull/4573#pullrequestreview-3290587129

* Re-implement: https://github.com/SillyTavern/SillyTavern/pull/4576#discussion_r2395506501

* Moved chat trees to a separate directory. https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2395045583
Enabled chat tree backups.

* Removed structuredClone() for improved performance.

* Fixed bugs.
Characters are now correctly renamed in the chatTree.
Directories are now recursively created.

* Reverts `hideSwipeButtons` to original functionality when `show_swipes_for_all_messages` is false.

https://github.com/SillyTavern/SillyTavern/pull/4576#discussion_r2395375718

* Added `refreshSwipeButtons`.
Updated `showSwipeButtons` and `hideSwipeButtons`.
Fixed bugs.

* Fixed.
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2400143193
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2400143202

* Added `clamp` to util.js.
Refactored `swipe`.

* Fixed bugs.
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2400685914
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2400685911

* Fixed bugs.

* Fixed swipe animations.

* Fixed bug by setting ids with `Number`.

* Delete swipes, and bugfixes.

* Merged `refactor/swipe`.

* Fixed bug created in `Delete swipes, and bugfixes.`.

* Merged from origin/staging.

* Merged changes from refactor/swipe.

* Fixed bug and refactored `syncWithSwipeId`.

* Merged from `origin/staging`.

* Fixed merge.

* Fixed overlapping message generations.

* Warn user, and refresh chat.

* Added metadata to chatTree file.

* Fixed "a sacrifice for the sake of simplicity." https://github.com/SillyTavern/SillyTavern/pull/2752#issuecomment-2323512022

Gemini:
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2464165990
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2464165991

* Improved swipeGenerate's animation.

* Added `SWIPE_SOURCE` constant.

* await `switchSwipesAllMessages`.

* Added `swipeState`.

* Fixed:
https://github.com/SillyTavern/SillyTavern/pull/4573#issuecomment-3449690308

* Done:
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2466884547
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2466884547
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2466894947
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2466902075
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2466911245
https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2466938169

* Removed `NEUTRAL_CHAT_TREE_KEY`

* Moved backups

* Fixed `/send` and fixed a bug in `sendMessageAs`.

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2466913570

* Fixes usage of `ENOENT`: https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2466929980

* Removed LLM attribution.

* Updated link and warning.

* Removed debugging comments.

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4573#discussion_r2466905341

* Replaced `isSwipingAllowed` with `swipeState`.

* Backported many changes from feat/chat-tree.

* Refactored `showSwipeButtons` and `hideSwipeButtons` into `refreshSwipeButtons`

* Refactored `showSwipeButtons` and `hideSwipeButtons` into `refreshSwipeButtons`

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2472109888
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2472113323

* Merged from `refactor/backport-chat-tree`.

* Proposed fix for https://github.com/SillyTavern/SillyTavern/issues/4709
Reverts commit: https://github.com/SillyTavern/SillyTavern/commit/1b3db273891c1ba8c781d2f691ad2e41937ca2aa

On PR: https://github.com/SillyTavern/SillyTavern/pull/2940

* Proposed fix for https://github.com/SillyTavern/SillyTavern/issues/4709
Reverts commit: https://github.com/SillyTavern/SillyTavern/commit/1b3db273891c1ba8c781d2f691ad2e41937ca2aa

On PR: https://github.com/SillyTavern/SillyTavern/pull/2940

* Fixed regenerate and continue while editing the last message.

* Added swipesHidden.
Messages can now be designated as non-swipeable with `message.extra.swipeable`.

* Use `.hidden` and classes instead of `.css` to display swipe chevrons.

* Fixed:
https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3465749700
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2476136375
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2476140043
https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3465776056
https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3465794330

* Fixed bug.

* Fixed broken JQuery animation.

* Fixed:
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2479003956
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2479011525
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2479014001

* Fixed active arrow transition.

* Fixed swipe shake direction.

* Fixed truthy check.

* Added temporary link to documentation PR.

* Moved `switchSwipesAllMessages`

* Fixed failed generations deleting the branch.
Fixed `forceSwipeId`.
Always call `saveChatConditional` if the `swipe_id` has changed.

* ESLint.

* Fixed bug.
Better `syncSwipeToMes` error handling.

* Backported changes from `feat/chat-tree`

Added failed swipe animation.
Fixed `newSwipeId`.

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4712

* Fixed:
https://github.com/SillyTavern/SillyTavern/pull/4712#pullrequestreview-3406878337

* Fixed:
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2483143387

* Fixed:
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2483143387

* Added `showSwipes: false` to `showMoreMessages`.

And a few more performance improvements.

* Fixed animations.

* Added `'.mes'` to `.children`.

* Significantly improved `animateSwipeTransition` performance on large chats.

* Improved `syncSwipeToMes` error handling.

* Significantly improved `animateSwipeTransition` performance on large chats.

* Improved `syncSwipeToMes` error handling.

* Corrected Merge.

* Corrected Merge.

* Improved: `redisplayChat`
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2484177521

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2484215469

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2484217230

* Added a temporary implementation of `branchChat`.

* Fixed bug when generating a swipe.

* Fixed bug in `branchChat`.

* Fixed Off by one error due to `chatElement.children()` selecting `show_more_messages`.
https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3478331073

* Fixed Off by one error due to `chatElement.children()` selecting `show_more_messages`.
https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3478331073

* Cleaned system messages array and moved `swipeable`

* Removed CSS nesting.

* Fixed merge.

* Improved `syncSwipeToMes` error handling.

* Matched `swipes-counter` fade to chevrons.
https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3478192184

* Wrapped `transition-behavior: allow-discrete;` in `@supports`.

* Fixed types.

* Improved swipeability feedback and functions.

* Improved `refreshSwipeButtons` performance again.

* Swapped `.attr` to `.prop`.

* Fixed: `@supports (transition-behavior: allow-discrete)`

* Fixed and clarified typo.

* Fixed:
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495919425
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495923036
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495927019
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495930080
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495943870
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495950927
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495954387
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495974324
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495974683

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495957181
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495960920
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495968137
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495968922
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495959430
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495924599

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495918468
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495931979
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495933092
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2495939511

* Improved `refreshSwipeButtons` performance by skipping 'swipes-counter' updates by default.

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2496382916
https://github.com/SillyTavern/SillyTavern/pull/4712#discussion_r2496379401

* Removed chevron fade-in on Cohee's request: https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3493829978

* Set most system messages to `swipeable: false`.

* Implemented `OVERSWIPE_BEHAVIOR`.

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3499706714

* Fix formatting, make comments IDE friendly

* IDE friendly enum comments

* Move animation frames to a dedicated file

* Do not compare with -1

* overswipeBehavior => getOverswipeBehavior

* Formatting fix

* Don't let regenerate on is_system

* Fixed canceled generations in pristine chats.
https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3499819670

* Fixed `AUTO_SWIPE` when `animation_duration = 0`.

* Fixed mistake in `redisplayChat`.

* Holding the swipe button speeds up `swipeDuration`.

* Fixed 'animationend' never ending.
Altered resetTime.

* Swapped from `saveChatConditional` to `saveChatDebounced` in `swipe`.

* Skip the animation if it's faster than 50ms instead of 10ms.

* Typo.

* Fixed:
https://github.com/SillyTavern/SillyTavern/pull/4712#pullrequestreview-3457198109

* Adjust duration reset cooldown

* Add quotes to selector

* Specify type for message parameter in swipe function

* Add type for swipe UI event

* Disabled fade-in during printMessages.
https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3539315919

* Typo.

* Added quotes to selector .

* Reduce reset time 500 -> 350

* Loops do not cause a generation so their chevrons should not have increased opacity.
https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3543692019

* Revert reset time

* Renamed `heldSwipes` to `recentSwipes`.

* Autofix the swipes array during `updateSwipeCounter`.

* User messages should not have swipes.

* Chevrons should always be shown on pristine greetings: https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3557893373

* Improve formatting

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3559617088

* Show `pristineGreetingSwipeNotice` once.

* `clearMessageData` when swipe-regenerating a message.

* accountStorage is already imported in the module

* Removed `await`.

* Removed pristine greeting notice.
https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3560758598

* Removed redundant functions in `StreamingProcessor` and fixed streamed replies missing counters.

* Moved `markUIGenStopped` after `eventSource.emit`.

Swapped to `saveChatDebounced` to fix: https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3567014810.

* Save a structuredClone of `chat` to prevent an invalid chat from being saved.

* Only `structuredClone` `chat` on `saveChatDebounced`.

* Revert "Only `structuredClone` `chat` on `saveChatDebounced`."

This reverts commit 49498b7aa1410107b294555fb945d977e60bfebf.

* Revert "Save a structuredClone of `chat` to prevent an invalid chat from being saved."

This reverts commit 5f137ed1380107fde0765b951dc634081bdbf2ff.

* Prevent `saveChatDebounced` from saving while the swipe is in progress.
See: https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3567077312

* Fixed animation never ending: https://github.com/SillyTavern/SillyTavern/pull/4712#issuecomment-3567106213

* `forceMesId` and `forceSwipeId` are not objects.

* Fixed Reduced Motion causing a warning when swiping back.

* Only  hide `.mes_buttons` when generating.

* Fix eslint

* Reset duration on switching direction

---------

Co-authored-by: user <user@exmaple.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-11-26 17:38:31 +02:00
Cohee 5993084ee6 Unify chat timestamps format (#4806)
* Unify chat timestamps format

* Handle ISO timestamps in stats.js

* Refactor timestamp parsing on server

* Switch to ISO timestamps for character/messages creation dates

* Fix type error

* Early exist in saveGroupChat if group not found

* Remove redundant fields from temp.chat export header

* Auto-fix char creation date format on edit

* Add name to fallback chat file names

* Rename parseTimestamp server side function
2025-11-26 15:55:15 +02:00
QiyuanChen 5c974bd148 feat: add siliconflow chat provider (#4764)
* feat: add siliconflow chat provider

* fix: remove siliconflow seed handling

* fix: enable SiliconFlow image inlining from shared vision list

* fix: handle SiliconFlow model context limits and sizing

* fix: drop SiliconFlow reasoning effort handling since controls are hidden

* fix: parse SiliconFlow reasoning in streaming and non-streaming

* fix: add missing comma in supported models list

* Remove seed from HTML template

* Combine streamed reasoning parsing blocks

* Update logo image

* Unhide image inlining controls

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-11-19 22:10:29 +02:00
Cohee 4add4f0090 Add official GLM API as CC provider (#4678)
* Add UI elements

* Add support for model configuration

* fix: update API request parameters for improved handling

* Add logo img

* Fix tool calling with negative index

* Include tool calls into 'last in context' calculation

* feat: add support for captioning
2025-10-21 22:37:27 +03:00
DeclineThyself 20556aa3dd Refactored swipe and moved messageEdit to a separate function. (#4610)
* Extracted `messageEdit` and `messageEditCancel` from `.mes_edit` and `.mes_edit_cancel`

* Fixed.
https://github.com/SillyTavern/SillyTavern/pull/4633#discussion_r241505
https://github.com/SillyTavern/SillyTavern/pull/4633#pullrequestreview-3316588180

* Refactored `swipe` and moved `messageEdit` to a separate function.
Also, a few more minor changes.

* Fixed bug.
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2404789035
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2404789038

* Fixed.
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408682277
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408689706
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408690772
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408697066
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408705156
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408708088
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408725971
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408726241
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408740050
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408745918
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408753165
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408761262
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408764531
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408781694
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408784426
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408794672
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408802366
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408803433

* Fixed:
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408702506

https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408805635

https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2410368443

https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2408791120

* Bugfixes. Incomplete.

* Fix formatting

* Use scrollTop because scrollIntoView breaks layout on phones.

* Only show '?' in `formaSwipeCounter` if something is wrong.
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2412169005

* Respect animation_duration if it's >= 0.

* Disabled expandNewMessage's animation on Cohee's request. https://github.com/SillyTavern/SillyTavern/pull/4610/files#r2408731744

* Only hide the swipe counter when a generation is ongoing.
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2440588779

* refreshSwipeButtons

* Adjust swipeDuration constant

* feat: add refreshSwipeButtons and isSwipingAllowed to context

* Fixed image swipes.

https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2442489827

https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2442490042

* Fixed.
https://github.com/SillyTavern/SillyTavern/pull/4610#issuecomment-3418657967

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2442480238

* Fixed.
https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2442536011

* Minor refactor.

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2443359660 https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2443359435

* Fixed: https://github.com/SillyTavern/SillyTavern/pull/4610#discussion_r2443357913

* Fix registration of click events

* Fix passing data to swipe events

---------

Co-authored-by: user <user@exmaple.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-10-20 20:51:33 +03:00
Cohee 4e01c9c0dc Use variable for mobile jumbo list button 2025-09-18 21:19:44 +03:00
RossAscends 1e7309fa17 i forgor one of em 2025-09-17 20:46:49 +09:00
RossAscends 2c25b5f012 completely ignore panel pins on mobile 2025-09-17 20:44:11 +09:00
nfuller286 1147507d06 feat: Add Azure OpenAI chat completions provider (#4456)
* feat: Add Azure OpenAI chat completions provider

This commit introduces comprehensive support for integrating Azure OpenAI as a new chat completion source within SillyTavern. The implementation specifically navigates Azure's reliance on deployment names, differing from standard model selection.

Includes:

- **New Feat / UI:** Dedicated settings in `public/index.html` for Azure parameters (Base URL, Deployment Name, API Version, API Key) and a new `public/img/azure_openai.svg` icon.
- **Frontend Logic (`public/scripts/openai.js`):** Manages Azure OpenAI settings and dynamic URL generation. The 'Connect' button triggers a `GET /models` endpoint call solely for API configuration validation (key, URL, version). Upon successful validation, a subsequent `POST` request is made to the AI, and the active model is extracted from its response payload, then populated for UI display (no direct user model selection).
- **Backend Logic (`src/endpoints/backends/chat-completions.js`):** Implements `sendAzureOpenAIRequest` to proxy requests, handling Azure’s unique authentication and URL structures. Enhanced the `/status` endpoint for Azure-specific validation.
- **Secret Management:** Secure handling of Azure OpenAI API keys in `public/scripts/secrets.js` and `src/endpoints/secrets.js`.
- **Autoconnect:** `public/scripts/RossAscends-mods.js` modified to enable automatic connection for Azure OpenAI if an API key is present.

Impact:
- Users can now connect to and utilize Azure OpenAI services.
- Requires new configuration details in the UI.
- Enhances API routing and validation with Azure-specific behavior.
- Navigates model handling: model name is *derived dynamically* from AI response, not directly selected, aligning with internal SillyTavern structure.

* fixed the html issues, openai.ujs and secrets.js

	modified:   public/index.html#
    modified:   public/scripts/openai.js
	modified:   public/scripts/secrets.js

* Extends Azure OpenAI with advanced capabilities

Enables advanced features such as function calling, image inlining, and model reasoning in the UI for Azure OpenAI.

Refactors the backend to support structured output (JSON mode), native thinking, and reasoning effort for compatible Azure OpenAI models. Adds support for logprobs, multiple responses (`n`), and seed, aligning with standard OpenAI behavior.

Improves request handling with a retry mechanism for rate limits and more robust error reporting. Ensures correct parameter handling for model-specific features and conflicts, such as when native thinking is enabled. Optimizes the Azure OpenAI status probe for efficiency.
	modified:   public/index.html
	modified:   public/scripts/openai.js
	modified:   src/endpoints/backends/chat-completions.js

* PR fixes
Simplification
Removed reasoning logic from backend
	modified:   src/endpoints/backends/chat-completions.js

	modified:   src/endpoints/backends/chat-completions.js

* Fix PR comments
Removed the front end compiled url UI element and related.
Misc simplifications
	modified:   public/index.html
	modified:   public/scripts/openai.js
	modified:   src/endpoints/backends/chat-completions.js

* Fixed accidental api temporary disabled
	modified:   public/index.html

* Don't transfer status code verbatim

* Fix formatting

* Enable tool calling

* Fix logo coloration

* Move model arrays to shared constants

* Fix capitalization

* Remove obsolete comment

* Improve response schema parameter format

* Fix tokenizer model selection

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-09-10 11:44:30 +03:00
Wolfsblvt d1349b10bb feat: add ctrl+enter handling for non-empty text input during regeneration (#4504)
Closes #4497
2025-09-09 16:15:27 +03:00
Ngo Dinh Gia Bao 8687bb99f3 Add Electron Hub as Chat Completions Provider (#4458)
* fixed merge conflicts

* Supported max tokens + fixed wrong image model mapping

* fixed merge conflicts

* fixed merge conflicts

* updated the logic

* updated the logic

* replaced hard coded reasoning_effort mode list with a dynamic function

* replaced hard coded reasoning_effort model list with a dynamic function

* Fix eslint

* Adjust reasoning effort logic

* Code clean-up

* Add logo

* Add inline image quality

* Fix multimodal models list

* Fix seed not passed

* Add "detail" error parser

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-09-04 21:25:31 +03:00
Cohee 2bc503ec00 Fix eslint 2025-09-03 14:12:23 +03:00
Cohee adfbc3555c eslint fix 2025-08-25 17:36:55 +03:00
TensorNull 41c74fd142 Add CometAPI as a model provider in "Chat Completion" (#4402)
* feat: Add support for CometAPI, including API key management and model selection features.

* Some code fixes

* Fix loading model from presets

* Add logo image

* Enable tool calling, reasoning effort, reasoning display, structured generation

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-22 20:30:42 +03:00
RossAscends c53803730a allow topbar overlap during MUI element resizing 2025-08-22 11:57:34 +09:00
ershang-fireworks e9be0f1c64 Add Fireworks AI Provider Support (#4374)
* add fireworks provider

* fix

* add context length

* Fireworks fixes

* Add logo image

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-14 20:52:46 +03:00
Cohee 659930d5ba Persist actionable tag states on reload (#4368)
* Persist actionable tag states on reload
Closes #3666

* Remove unneeded simulated clicks
2025-08-14 01:23:13 +03:00
Cohee 0e38bfbf05 Feat/moonshot api (#4330)
* moonshot

* Partial mode + JSON schema

* Add logo image

* Limit max temp to 1

* Add to captioning extension
2025-07-31 00:01:04 +03:00
Cohee a28a33cb02 Fix type errors in Ross-mods.js 2025-07-28 22:26:01 +03:00
Cohee 086f873f2f Deprecate 01.ai chat completion source (#4327) 2025-07-28 21:29:01 +03:00
Cohee d641cbecc4 Remove Scale Spellbook from CC sources (#4293) 2025-07-24 22:02:45 +03:00
Cohee 7429726eb1 Remove Window AI from CC sources (#4294) 2025-07-22 19:45:54 +03:00
Cohee 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
GregW6 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
Dmitry fece612f09 Merge pull request #4135 from D1m7asis/release
feat: Added AI/ML API Provider Support
2025-06-13 20:59:18 +03:00
Cohee d33b21282e Fix eslint 2025-06-06 09:55:18 +00:00
RossAscends edbc257e81 - replace top bar toggle animations with opacity fades
- refactor MovingUI
- refactor getWorldEntry
2025-06-06 05:29:18 +09:00
Cohee 5c2cfed18b Implement auto-connect for VertexAI full 2025-05-28 20:37:50 +03:00
NijikaMyWaifu 157315cd68 Add Vertex AI express mode support (#3977)
* Add Vertex AI express mode support
Split Google AI Studio and Vertex AI

* Add support for Vertex AI, including updating default models and related settings, modifying frontend HTML to include Vertex AI options, and adjusting request processing logic in the backend API.

* Log API name in the console

* Merge sysprompt toggles back

* Use Gemma tokenizers for Vertex and LearnLM

* AI Studio parity updates

* Add link to express mode doc. Also technically it's not a form

* Split title

* Use array includes

* Add support for Google Vertex AI in image captioning feature

* Specify caption API name, add to compression list

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-05-22 20:10:53 +03:00
Cohee 420d568cd3 Pollinations - Text (#3985)
* [wip] Pollinations for text

* Implement generate API request

* Determine Pollinations model tools via models list

* Add Pollinations option to /model command

* Add Pollinations support to caption

* Update link to pollinations site

* Fix type errors in openai.js

* Fix API connection test to use AbortController for request cancellation

* Remove hard coded list of pollinations vision models

* Remove openai-audio from captioning models
2025-05-11 20:14:11 +03:00
Cohee 310b0f30cd Add branch selection on extension installer
Closes #3865
2025-04-28 22:53:22 +03:00
Cohee 6878c79fc8 Prevent send on Enter when IME composing
Fixes #2398
2025-04-23 09:26:15 +00:00
Cohee 1c52099ed6 Add xAI as chat completion source 2025-04-10 22:59:10 +03:00
Cohee 0d111652b5 Remove from auto-connect logic 2025-03-27 20:38:34 +02:00
Gness Erquint e57396040d No swiping hotkeys when modifiers are held. 2025-03-15 00:43:37 +03:00
Cohee 19b7deaed0 Ditto for right swipe 2025-03-09 14:08:24 +02:00
Cohee 6aaa533410 Prevent rollover on keyboard left swipe if repeating
Closes #3636
2025-03-09 13:42:30 +02:00
Cohee 858b750346 Document the magic number for future generations 2025-03-05 09:26:16 +00:00
Cohee 5d69189f8f Hard limit hotswaps to 25 entries 2025-03-04 23:49:32 +02:00
Wolfsblvt 8bd4fd76ae Merge branch 'staging' into persona-improvements 2025-02-22 19:23:59 +01:00
Cohee 0cdc389794 Fix type handling of active_character_id 2025-02-17 21:00:09 +02:00
Wolfsblvt ab27b29819 cleanup group on auto load if name not found 2025-02-17 09:58:37 +01:00