* refactor: extract IP whitelist validation into helper function
- Added isIPInWhitelist helper with error handling for individual whitelist entry checks
- Replaced inline whitelist matching logic with reusable function calls
- Added JSDoc type annotations and error logging for failed IP matching attempts
* refactor: simplify whitelist validation with upfront filtering
- Moved IP validation to startup time instead of per-request checking
- Extracted validateWhitelist function to filter invalid entries once at initialization
- Simplified isIPInWhitelist by removing redundant error handling after validation
* fix: correct IP whitelist matching to use parsed CIDR notation
* Refactor flattenSchema to simplify JSON schema for Google Generative AI API compatibility
* Added unit test and github action
* Add unit tests workflow and update test script in package.json
* Downgrade eslint-plugin-jest to make min node version 18
* Add audio-player component
* Enhance audio player functionality and styles
- Adjust audio player layout and styles in CSS for better spacing and alignment.
- Add audio element to message template in HTML.
- Implement audio attachment handling in JavaScript, including a new AudioPlayer class.
- Update media attachment structure to include titles for audio files.
- Extend supported media file types in constants.
* Add audio inlining control
* Fix file formats list
* Simplify hints
* Add to prompt
* Add progress title hint
* Add to scrollOnMediaLoad
* Add audio size hint
* Add gallery controls
* Delete removed media attachments from server
* Adjust min width
* No-op when swiping a singular media
* Fix clean-up
* Fix silent deletion logic
* More accurate media prompt estimations
* Round durations with ceiling function
* Adjust rounding logic
* you don't have to say it twice
* Export deleteFileFromServer
* Don't reference module from HTML
* Clean-up styles
* Move formatTime to utils
* Add fa-fw to delete
* 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>
* + Fix discarding all scenarios aside from the first one, which would cause all chats other than the first one to be lost.
+ Accumulate alternative starting messages from all scenarios, as different scenarios are how Backyard handles having alternative greetings. A scenario with multiple messages in its "firstMessages" array is invalid as per BYAF spec.
+ Return scenarios so that they can be used to populate chats, scenario overrides, and in the future, the other character settings overrides as well.
* + Added support for importing chats (including swipes) from BYAF. This brings the core functionality of BYAF imports mostly in-line with the standard, without the inclusion of any features that are currently missing from ST.
> The only supported feature not yet implemented is scenario overrides per-chat. This will be the the goal of the next commit.
* + Implemented scenario overrides, fully bringing ST's BYAF import as in-line with the BYAF standard as possible without adding new feature functionality to ST.
+ Also added some new chat metadata fields in preparation for example message and system prompt overrides.
* + Added support for pulling alternate icons from the BYAF archive. They are not used yet, but they are safely stored.
+ Added support for pulling backgrounds from the BYAF archive. They are not used yet but they are stored and linked to the chats they originally belonged to.
+ Saved every remaining field that was previously discarded from BYAF that a user actually needs in a way that could be used in the future, and can be accessed by the user if needed after import. Any fields that are not preserved at this point are specfic to either Backyard AI's desktop application, or to the BYAF manifest itself, and therefore have no relevance to a user.
> With this, BYAF import should be fully supported and in-line with the official spec.
* + Updated comments and method names to reflect changes appropriately. First round of touch ups.
* + More comment updates.
* - Removed commented code, that is no longer needed for reference.
* > No longer sanitize for filenames in the character card, as there's no need. The sanitization now happens when generating the filename, which is subsequently used for file operations.
+ Added replacement function for sanitizing filenames which uses visually similar but valid for filenames replacement characters instead of deleting the characters for better data parity.
* + Preserve isNSFW flag as a tag, so it's not lost on import.
* + preserve labels on character alt avatars
* + Deduplicate first messages, so that 5 chats with the same first message don't create 5 identical first messages.
* + Adjusted icon naming logic to produce more sensible results.
* > User path.basename and path.extname for getting the base name and extension of files, respectively.
* > Should use camelCase for local function names.
* > Use a set for greetings instead of explicitly checking for duplicates.
* > Missed a snake case local function name.
* > Updated background import logic to integrate with existing per-chat background system.
* + Updated logic to skip import of chats and backgrounds when a character is being updated/replaced.
* + Added copy of getUniqueName helper function from frontend utils to backend utils.
+ Refactored duplicated logic for getting unique filenames for backgrounds and character alt icons to use the newly available function.
* > fixed adding an extra dot to the filenames for icons after switching to path.extname for getting the extension
* > Updated metadata settings generation in byaf chat so that it doesn't overwrite valid yet 'falsy' values with defaults. Oops
* > Remove variable for configuration that will likely never need to exist.
* > custom_background should be an empty string if chat_background is falsy
* > Make an array empty if chat_background is falsy.
* > Prefer camelCase for local variable names.
* + Added definitions for ByafParseResult and ByafChatBackground.
> Updated overused and unweildy anonymous types to the newly defined types.
* + When importing a character with chats, the character will now no longer open to a new empty chat, but instead will pick the first of the imported chats to open up to.
* Rename prev_paths => paths
* Prettify logs display
* Set fallback chat name if scenario is untitled
* card.data.name => card.name
* Optimize first scenario message access
* + Moved custom replacement function from importFromByaf into util.js as sanitizeSafeCharacterReplacements() so that the replacement logic may be reused anywhere for consistency.
* > Missed a couple. Updated for consistency
* + Preserve character full/display name without it needing to be safe as a filename.
> Change logic for naming the folder the alt images live in to match the logic the sprites endpoint uses to get character sprites for consistency
* > Only add full_name extension if displayName exists.
* full_name => display_name
* - No longer use safe lookalike replacements for filename sanitization to be consistent with how web browsers sanitize invalid characters in filenames before saving to disk.
* Tiny formatting fix
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* Enhance contribution guidelines for pull requests
Added guidelines for maintaining workflow during PRs.
* fix abort generation error when koboldcpp is set with a password
* add parameter type, and remove unecessary line
* oops, missing comma
* eslint
* remove header content type
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
* 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
* Remove dead Gemini 1.5 models, and clean up
* Remove dead models (error 404): Gemini 1.5, `gemini-2.5-pro-exp-03-25`, `gemini-2.5-flash-preview-04-17`
* Adjust the Gemini → descriptions
* Assign default models to 2.5 Pro and Sonnet 4.5 (3.5 and 3.7 will be retiring soon)
* Add `gemini-2.5-flash-image`
* Don't forget learnlm-1.5-pro
* Update default claude
* Vertex: Clean-up 2.5 preview models
* Disable thinking for 2.5-flash-image
* Bring back banana preview
* Update defaults in more places
* Add gemini preview-09-2025 and robotics-er
* unbrick my last commit
* Add gemini-robotics-er to captions
* Set max context for gemini-robotics-er
dang
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* feat: add outlet prompt support for world info entries
* feat: add outlet name field with autocomplete for world info entries
* feat: add outlet entries for world info support to WI parsing
* feat: add tooltip and validation for WI outlet name entries
* Trim macro outlet name
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* refactor: consolidate WI injection cleanup and fix strict equality comparison
* fix: update outlet macro regex pattern to use double colon delimiter
* fix: replace carriage returns with newlines in WI entry outlet tooltip
* fix: add null checks and array validation for WI outlet entries handling
* feat: add outletName field to world info entry definition schema (supports /setwientryfield command)
* fix: add outletName field to export of character lore books
* do not remove outlet name on position change, but filter out for auto complete
* Match WI extensions field name
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* outlet name being used in char WI import too
* docs: add outlet macro documentation to help template
* be explicit about risu/novel/agnai wi not supporting outlets
* Inject A/N and TC sysprompt after populating outlets
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* 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>
* 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>
* SSL: support passphrase for private key
* Recommend CLI argument or environment variable for key passphrase
* Fix SSL passphrase handling to ensure it is always a string