efbff343424e3ef8dd67358882d297149976ffe4
49 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
efbff34342 | feat: add getWorldInfoNames() to getContext() for WorldInfo enumeration. (#5505) | ||
|
|
d720605be8 |
Bulk extension field updates via merge-attributes with UNSET_VALUE sentinel (#5471)
* feat: add bulk extension field updates with UNSET_VALUE sentinel for key deletion - Add `UNSET_VALUE` sentinel constant to signal complete field removal from character cards - Add `writeExtensionFieldBulk()` function to update extension fields across multiple characters in a single API call - Add `deleteValueByPath()` utility function to remove nested object keys by dot-path - Update `writeExtensionField()` to support `UNSET_VALUE` for deleting extension keys - Extend `/api/characters/merge-attributes * Revert package-lock.json changes * Allow null values in merge-attributes filter path validation Change filter.path existence check to only skip on undefined, not null. This allows merging attributes when the existing value is explicitly null, treating null as a valid value rather than absence of a value. * fix: share forbiddenRegExp between modules * feat: add writeExtensionFieldBulk and UNSET_VALUE constant to getContext * Update src/endpoints/characters.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: validate for .png extension * Update public/scripts/extensions.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor: extract shouldSkip logic as a function param to avoid double parsing --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> |
||
|
|
a7f144f28b |
feat: add getExtensionManifest() to extensions.js and expose via getContext() (#5442)
Returns a structuredClone of the loaded manifest for the given extension name. Accepts either the short name or full internal key (third-party/...). Returns null if the extension is not registered. |
||
|
|
45009cd0e4 |
Deprecate legacy loader and migrate all callsites to action-loader system with informative toasts (#5326)
* Refactor loader.js to use action-loader system and move overlay management into action-loader module - Deprecate showLoader() and hideLoader() in favor of action-loader API - Implement legacy functions as thin wrappers around ActionLoaderHandle - Move overlay management (showOverlay, hideOverlay, isOverlayDisplayed) into action-loader.js - Move Popup-based loader implementation and preloader cleanup to action-loader - Add loader.isBlocking() method to check for active blocking overlays * Migrate from legacy loader functions to action-loader API throughout codebase - Replace showLoader()/hideLoader() imports with loader from action-loader.js - Update firstLoadInit() to use loader.show() with title, message, and ToastMode.STATIC - Pass initLoaderHandle to getSettings() for early hide during onboarding flow - Refactor renameGroupOrCharacterChat() to use loader.show() instead of boolean flag - Wrap handleDeleteChat() with loader.show() and proper error handling - Update BulkEditOver... * Update loader titles and remove redundant reload notification - Change bookmark loader title from "Bookmark" to "Chat History" for clarity - Remove loader notification before extensions reload (redundant with browser reload) * lint fix * Add splash screen support to action loader with custom overlay content - Add `overlayContent` option to ActionLoaderOptions for custom HTML in overlay - Implement splash screen styles with centered logo, spinner, and message - Update firstLoadInit() to use custom splash screen instead of static toast - Pass custom content through showOverlay() to replace default spinner - Adjust non-blocking loader warning to account for custom overlay content * Refactor loader overlay to use DOM elements instead of HTML strings - Add createDefaultLoaderOverlay() function to generate fresh loader overlay elements - Export createOverlay() method on loader utility API for external use - Change overlayContent parameter type from string-only to string|HTMLElement|null - Add getOverlayContent() helper to normalize custom content for Popup - Update firstLoadInit() to build splash screen using DOM manipulation instead of template literals - Add splash-logo class and * Use a true ellipsis * Adjust sizing for desktop * Even truer ellipsis * Add transition to splash screen and fix blur animation on hideOverlay (#5338) * Initial plan * Blur entire splash screen on hideOverlay, not just spinner Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/eee6c06d-7c9d-4363-bc8f-2647ed390368 * Add transition to splash-screen and fix transition detection Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/9368bc36-31a0-4a58-aebd-7b569696ff2e --------- Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com> Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> * Add translations to supported locales * Localize logo alt on welcome screen --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> Co-authored-by: Claude <242468646+Claude@users.noreply.github.com> |
||
|
|
a6486d7f08 |
Add Action Loader Module with Stacking Support and STscript Commands (#5311)
* Add action loader utility with stoppable toast notifications * Add slash commands for action loader control (/loader-wrap, /loader-show, /loader-hide, /loader-stop) * Refactor action loader to support stacking multiple loaders with individual toast management - Convert action loader from singleton to class-based handle system (ActionLoaderHandle) - Support multiple concurrent loaders with single overlay and stacked toasts - Add unique ID generation and tracking for each loader instance - Implement onHide callback alongside existing onStop callback - Add getActiveLoaderHandles() and getLoaderHandleById() utility functions - Refactor hideActionLoader() to accept... * Improve action loader overlay and toast handling with better state checks and cleanup timing - Check isLoaderDisplayed() before showing overlay to prevent conflicts with existing loaders - Use toastr.options.hideDuration for toast removal timing instead of hardcoded 250ms - Simplify hideActionLoader() by using getActiveLoaderHandles() helper - Remove redundant empty check in hideActionLoader() - Add clarifying comment for intentional error throw in createClosureHandler() - Remove redundant 'onStop' default * fix stop button toast removal issue by using toastr.clear force option instead of manual removal with timeout * Fix isLoaderDisplayed() by using double negation operator instead of null comparison * Add non-blocking loader support with `blocking` parameter for toast-only action loaders - Add `blocking` option to ActionLoaderHandle (default: true) - Implement hasBlockingLoaders() helper to check for active blocking loaders - Show/hide overlay only when blocking loaders are active - Add `blocking` named argument to /loader-wrap and /loader-show commands - Update help strings with non-blocking usage examples - Import commonEnumProviders for boolean enum and isFalseBoolean utility * Add optional title parameter to action loader toast notifications and reorder constructor parameters for consistency - Add `title` parameter to ActionLoaderOptions and ActionLoaderHandle constructor - Pass title to toastr.info() for toast notifications - Reorder parameters: blocking, toastMode, message, title, stopTooltip (grouped by importance) - Add warning when creating non-blocking loader without toast (invisible to user) - Update /loader-wrap and /loader-show commands with title argument * Add loader utility API to action-loader and expose it in ST context for convenient programmatic access - Create `loader` object with show/hide/active/get methods and ToastMode/Handle exports - Add JSDoc examples for basic usage, non-blocking tasks, and hiding all loaders - Import and expose `loader` in ST context alongside existing loader functions * Split slash command and functional modules * Create abort controller on app init * Remove HTML tags from "returns" declaration --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> |
||
|
|
7418d272a7 |
Split generateRaw into two functions exposing generateRawData (#5249)
* Split generateRaw into two functions exposing generateRawData * Concise types * Improve comments * Update public/script.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update public/script.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update public/script.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add GenerateRawParams typedef for improved documentation and clarity --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> |
||
|
|
162d45a241 | Feat - Export SlashCommandEnumValue for extensions through getContext (#5191) | ||
|
|
ef25a03650 |
Expose character update APIs for extensions (#5062)
* Expose character update APIs for extensions Add getCharacterSource, importFromExternalUrl, and importTags to the extension context (SillyTavern.getContext()). This allows extensions to: - Get the source URL for a character (Chub, etc.) - Import/update a character from an external URL - Import tags from a character's embedded tag data These functions already exist and are used internally but were not exposed to extensions. This enables extension developers to build features like bulk character update checking and tag synchronization. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix review comments --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> |
||
|
|
bf7efbf7e1 | Merge branch 'release' into staging | ||
|
|
7a497421bb | Add getOneCharacter to getContext | ||
|
|
f8c373f55a |
Macros 2.0 (v0.7.0) -Variable Shorthand: New Operators & Lazy Evaluation (#4997)
* Add new variable shorthand operators and new variable macros
- Add `{{hasvar}}` and `{{deletevar}}` macros for local variables
- Add `{{hasglobalvar}}` and `{{deleteglobalvar}}` macros for global variables
- Implement new variable shorthand operators: `-=`, `||`, `??`, `||=`, `??=`, `==`
- Refactor variable expression evaluation to use direct variable API calls instead of routing through macro registry
- Add comprehensive operator support in lexer with proper token ordering for multi-character operators
* Implement lazy evaluation for variable shorthand value expressions
- Replace eager value evaluation with lazy evaluation pattern for variable operators
- Add `#createLazyValue()` method that caches value expression result on first call
- Change `#executeVariableOperation()` to accept `lazyValue` function instead of pre-evaluated value
- Only evaluate value expressions when actually needed (e.g., when variable is falsy for `||`, when variable doesn't exist for `??`)
- Add comprehensive e2e tests
* Update variable shorthand autocomplete with new operators and add edge case tests
- Add new operators to autocomplete definitions: `-=`, `||`, `??`, `||=`, `??=`, `==`
- Update example lists in `VariableShorthandAutoCompleteOption` and `VariableNameAutoCompleteOption`
- Add operator definitions with descriptions and `needsValue` flags to `VariableOperatorDefinitions`
- Update `parseMacroContext()` to recognize new operators with proper ordering (longer operators checked first)
* Add not equals (!=) operator to variable shorthand expressions
- Add `!=` operator to variable shorthand definitions for local and global variables
- Implement `notEquals` operation in `MacroCstWalker` that returns inverted equality comparison
- Add `NotEquals` token to lexer with pattern `/!=`
- Update parser to handle `!=` operator with value expression
- Add `!=` operator to autocomplete examples and operator definitions
- Update `parseMacroContext()` to recognize `!=` operator and...
* Tiny code review fixes
- Fix typo: "insie" → "inside" in variable shorthand operators comment
- Remove extra space in `{{getglobalvar}}` example usage
* Fix missing closing braces in hasglobalvar macro example usage
* Fix isFalsy to normalize value before checking boolean state in variable shorthand operators
- Apply `normalize()` to value before passing to `isFalseBoolean()` in `isFalsy` helper
- Ensures consistent falsy evaluation for variable shorthand operators like `||`, `??`, `||=`, `??=`
* Fix pipe character inside macro braces being treated as command separator
- Add `isInsideMacroBraces()` method to track unclosed `{{}}` macro braces
- Modify `testCommandEnd()` to only treat `|` as command end when not inside macro braces
- Scan text behind current position to calculate macro brace depth
- Skip second character when detecting `{{` or `}}` pairs
- Ensure `depth` never goes below 0 using `Math.max(0, depth - 1)`
* Add aliases for variable existence and deletion macros
- Add `varexists` alias for `hasvar` macro
- Add `flushvar` alias for `deletevar` macro
- Add `globalvarexists` alias for `hasglobalvar` macro
- Add `flushglobalvar` alias for `deleteglobalvar` macro
* Update variable shorthand operator descriptions to clarify return behavior
- Add "returns nothing" clarification to `=`, `+=`, `-=` operators in examples and definitions
- Add "returns the new value" clarification to `++`, `--` operators in examples and definitions
- Update `VariableOperatorDefinitions` descriptions to match example text
- Ensures users understand which operators return values vs perform silent mutations
|
||
|
|
6f8b6b098e |
Macros 2.0 (v0.3) - Replacing the existing Macro System with a new Macro Engine (#4820)
* Chevrotain lib and env setup
* First draft of the macro lexer
* fix ESLint types loading for chevrotain
* Cleaner lexer modes
* Readme link to Chevrotain & license
* Add jsconfig to tests folder
- Add jsconfig.json to tests folder, to prevent IDE errors on dynamic imports inside the page.evaluate execution.
* Slight improvements on lexer & first tests
* Add more lexer tests
* More edge cases tests
* Reorder tests
* Add macro execution modifiers + more tests
- Added macro flags (execution modifiers) to lexer
- Fixed some lexing issues
- Expanded lexer tests
- Treat lexer errors as failed test
* enable eslint for tests and run it
* Fix lexing unknown flags - treat as error
* Rewrote lexer modes/tokes to capture errors better
* Add lexing for output modifiers
* Clearer names for lexer tokens
* Increase tests default timeout
* Restructure lexer error testcases
* Allow legacy underscores in macro identifiers
* Test case for legacy single-colon syntax
* Improve lexer, removing warnings
* Basic setup for MacroParser + initial tests
* Make parser errors testable
* Add macros stuff to SillyTavern.getContext
* macros test case naming + lint
* Parser consumes basic macros
- Fix lexer mode names
- Add basic macro parsing (identifier, and arguments)
- Tests: basic macro parsing tests
- Tests: simplifyCstNode supports ignoring nodes, or flattening nodes to just plaintext
* Improve macro argument parsing to allow colons in values
Enhances separator handling by fixing separator type detection and enabling colon characters within argument values
Updates validation to require at least one argument component and adds error cases for empty arguments
Includes expanded test coverage for mixed separator scenarios and edge cases
* More nested macro tests
Add error case tests to enforce macro start position requirements
Include nested macro parsing scenarios and invalid syntax checks
Ensures parser correctly handles edge cases with embedded macros
* Unvendor chevrotain
* Add document rule
* Implement visitor, switch built-ins to new type
* Puppeteer -> playwright
* Revert "Implement visitor, switch built-ins to new type"
This reverts commit 706a94b4de62129df6bd6c25e2c6dec692d12226.
* Converted puppeteeer tests
* File rename
* chore: reduce Playwright worker count to 4 for performance/stability
* test: add comprehensive legacy macro parser test suite
- Added 13 test cases covering legacy macro formats (roll, reverse, comment, datetime, time_UTC, banned, setvar)
- Documented parser limitations with TODO comments for whitespace separators, special characters, and empty arguments
- Tests validate parsing of various separator styles (space, colon, +/-) and argument formats (quoted, numeric, empty)
* fix: handle legacy macro syntax with colon or whitespace separator
- Modified arguments rule to support both double-colon (::) and single-colon (:) separators
- Made single-colon separator optional to allow whitespace-separated legacy macros
- Removed TODO comments as parser now correctly handles legacy macro formats
* feat: support space-separated quoted arguments in macro parser
- Added parsing support for equals signs and quotes as valid argument tokens
- Removed TODO comments for legacy macro parsing with quoted arguments
* fix: improves macro argument parsing with colon handling
Enhances parser to correctly handle double colons within legacy single-colon arguments
Introduces separate parsing rules for arguments with different colon constraints
Adds test coverage for arguments containing double colons in legacy format
* fix: allow empty macro arguments after double-colon separator
- Changed argument rule from AT_LEAST_ONE to MANY to permit zero-length arguments
- Updated tests to verify empty argument parsing (e.g., `{{something::}}`)
- Enhanced simplifyCstNode helper with default flatten/ignore keys and improved null handling
* refactor: improve test documentation with inline macro display
- Added inline comments showing the actual macro syntax being tested for better readability
- Removed duplicate comment in error test case
- Cleaned up extra whitespace in legacy macro tests
* feat: add legacy macro preprocessing for time offset format
- Implemented preProcessFixLegacyMacros method to convert {{time_UTC±N}} to {{time::UTC±N}} format
- Updated tests to use new preprocessing step for legacy time macro parsing
- Added runPreProcessFix option to test helper functions for controlled legacy macro handling
* feat: add support for comment macros with double-slash syntax
- Added `DoubleSlash` token to lexer to recognize `//` as a valid macro identifier
- Updated parser to accept either `//` or standard identifiers as macro names
- Enhanced test suite with comprehensive comment macro test cases including multiline support
* feat: implement macro evaluation engine with CST walking and registry integration
(I'm tired, let's just throw this in right now)
- Added CST walker and macro registry to engine initialization
- Enhanced parseDocument to handle empty input, legacy macro preprocessing, and error collection
- Implemented async evaluate method with full macro resolution pipeline
- Added resolveMacro callback to handle unknown macros and registry execution
- Integrated lexing/parsing error handling with console warnings
- Added support for preserving unknown macro
* refactor: improve type safety and code clarity in macro evaluation system
- Simplified typedef imports to use correct Chevrotain types (CstNode, IToken)
- Added TokenRange typedef for consistent offset handling
- Enhanced error messages with context-specific prefixes
- Replaced verbose type casts with inline JSDoc annotations
- Condensed singleton pattern declarations to single lines
- Improved null safety with optional chaining and nullish coalescing
- Extracted resolveMacro logic into private root function
* fix test macro whitespace arguments onls accepting one argument
* Fix OpenRouter embeddings URL
#4736
* Fix: Prevent data loss on bulk regex move to scoped scripts (#4760)
* Fix: Prevent data loss in regex bulk move
* prevents moving to scoped scripts with group selected for bulkedit
* Refactor: make whitelist validation a bit more robust (#4757)
* 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
* Feat: Improve multiline input handling in popups (#4756)
* feat: improve multiline input handling in popups
- Added Ctrl+Enter requirement for submission in multiline input popups to prevent accidental sends
- Exported PopupUtils class for external use
* refactor: remove redundant higher/different rows from input popups
- Removed rows: 2 from callGenericPopup calls where default behavior is sufficient
- Increased rows from 2 to 4 in caption extension for better multiline input experience
* Fix npm audit
* feat: add max-height and scrolling to world entry key input fields (#4769)
- Added 160px max-height to select2 multiple selection, primary key, and secondary key text areas in world entries
- Enabled vertical scrolling with hidden horizontal overflow for better UX with long content
* Bump anti-troll tags limit
Closes #4763
* OpenAI: Add Sora 2 API (#4748)
* OpenAI: Add Sora 2 API
* Add duration control
* Support client generation abort
* Reduce poll log amount
* Simplify selector
* Simplify model-specific control handling
* Gemini: Pass non-success response content to frontend
* Vertex: Add Vertex AI-specific safety setting (#4770)
Closes #4455
* Feature: allows sorting tags by most used (#4768)
* add sorting tags by most used
* Fix whitespaces
* Code review updates
* Remove commented code
* Fix capitalization in comment
* Apply review suggestion
* Simplify template init
* Reformat
* Add documentation for appendViewTagToList and printViewTagList functions
* Reprint renamed tags regardless of sorting mode
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* Move img.swipe notice block up
* Preserve media playback state when running appendMediaToMessage (#4771)
* Preserve media playback state when running appendMediaToMessage
* Better selector specificity
* Fix local variable name
* Move typedef to global.d.ts
* Check for readyState on save/restore
* Only check for currentSrc on restoration callback
* gpt-5.1
* A 500 billion dollar startup can’t filter API payload fields
* Refactor macro argument validation to use requiredArgs and list pattern
- Replace minArgs/maxArgs/enforceArity with requiredArgs and list specification
- Add MacroListSpec typedef for flexible list argument constraints (min/max)
- Rename enforceArity to strictArgs with inverted default behavior
- Update validation logic to separately track required vs. list arguments
- Add requiredArgs and list arrays to MacroExecutionContext for easier access
- Improve error messages to clearly distinguish between required and list
* Refactor MacroRegistry.registerMacro to use options object pattern
- Move handler function into options object as required property
- Improve validation with detailed error messages for all option fields
- Add explicit type checking for requiredArgs, list, strictArgs, and description
- Consolidate name normalization and validation logic
- Simplify list option parsing with clearer conditional structure
- Update all builtin macro registrations to use new signature
* Add e2e tests for macro arity validation errors
- Test ping macro rejects calls with unexpected arguments
- Test upper macro rejects calls without required arguments
- Verify macros remain unresolved and log warnings on arity violations
* re-implement core macros as registered macros
- Create shallow frozen copy of env object before passing to macro handlers
- Add comprehensive MacroEnv typedef with nested types for names, character, system, and extra fields
- Update MacroDefinitionOptions typedef to clarify default values and mark handler as required
- Export variable manipulation functions for external use
- Fix whitespace in ifCallback JSDoc comment
* Defer slash command autocomplete initialization to firstLoadInit
- Move slash command autocomplete setup from module-level to initSlashCommandAutoComplete function
- Add null check for sendTextarea.value before accessing first character
- Import and call initSlashCommandAutoComplete in firstLoadInit sequence
- Export registerCoreMacros, registerInstructMacros, and registerVariableMacros using named export syntax
- Call registerCoreMacros from initMacros with
* Add variable manipulation functions to SillyTavern context API
- Import deleteGlobalVariable, deleteLocalVariable, addGlobalVariable, addLocalVariable, incrementGlobalVariable, incrementLocalVariable, decrementGlobalVariable, and decrementLocalVariable from variables.js
- Expose del, add, inc, and dec methods on both context.variables.local and context.variables.global objects
- Provide consistent API for variable deletion, addition, increment, and decrement operations
* Extract test setup utilities and fix trailing comma in core-macros.js
- Add testSetup utility object with goST and awaitST helper functions for Playwright tests
- Replace duplicated beforeEach setup code in MacroLexer, MacroParser, and MacroRegistry tests with testSetup.goST
- Add explanatory comments indicating tests currently run without ST context
- Fix missing trailing comma in input macro handler registration
* Refactor MacroEngine e2e tests to use real core macros instead of prototypes
- Replace prototype macros (ping, echo, upper, wrap, first) with actual core macros (newline, reverse, setvar, getvar, addvar, roll)
- Use testSetup.awaitST helper from utils.js for beforeEach setup
- Increase test timeout from 10s to 20s due to additional setup requirements
- Remove registerPrototypeMacros import and registration logic from evaluateWithEngine
- Add page.waitForTimeout(1000) to ensure macros are fully initialize
- Remove now obsolete MacroBuiltins.js
* Fix audit in tests
* Rename frontend test utils file to frontent-test-utils.js and update imports
- Rename tests/frontend/utils.js to tests/frontend/frontent-test-utils.js
- Update testSetup imports across MacroEngine, MacroLexer, MacroParser, and MacroRegistry e2e tests
* Refactor MacroRegistry for improved readability and consistency
- Reorder MacroDefinition typedef fields to match registration order (handler moved to end)
- Add inline JSDoc comments to MacroDefinitionOptions properties for clarity
- Simplify name validation logic in unregisterMacro, hasMacro, and getMacro methods using early returns
- Extract argument validation logic into dedicated isArgsValid helper function
- Refactor executeMacro to be async and use Promise.resolve for consistent promise handling
* Add returns field to MacroDefinitionOptions for documenting macro return values
- Add returns property to MacroDefinitionOptions typedef with string type and null default
- Include returns field in MacroDefinition typedef
- Store returns value in macro definition object for documentation purposes
* Add error handling to macro execution and refactor core macro handlers
- Add catch handler in MacroRegistry.executeMacro to log errors and return empty string on handler failures
- Update macro descriptions to use "index" instead of "ID" for message position macros
- Simplify reverse macro description and remove redundant null coalescing
- Add strictArgs: false to comment macro to ensure it's always removed
- Enhance time macro description with UTC offset examples
- Remove unnecessary null check
* Refactor instruct-macros.js for consistency and reduce code duplication
- Rename enabled helper to instEnabled and add sysEnabled helper for clarity
- Consolidate defaultSystemPrompt, instructSystem, and instructSystemPrompt into single registerSimple call
- Simplify systemPrompt handler by removing unnecessary null coalescing and intermediate variables
- Convert chatSeparator and chatStart macros to use registerSimple helper
- Fix JSDoc comment formatting for registerSimple helper function
* Add normalize helper to MacroExecutionContext and refactor variable macros for consistency
- Add normalizeMacroResult method to MacroEngine for converting macro results to strings
- Include normalize function in MacroExecutionContext for handler use
- Update normalizeMacroResult to handle arrays explicitly alongside objects
- Add returns field to variable macros that produce side-effects only
- Refactor variable macro handlers to use destructuring and normalize helper
- Remove redundant null checks an
* chore: Remove duplicate getglobalvar macro registration from variable-macros.js
- Remove redundant getglobalvar macro definition (already registered earlier in the file)
- Import MacroEngine in MacroRegistry for normalizeMacroResult access
- Add fallback binding for normalize in MacroExecutionContext when not provided by caller
- Update executeMacro to use executionContext.normalize instead of standalone normalizeMacroResult
- Remove normalizeMacroResult helper function from MacroRegistry (now handled by MacroEngine)
* Add core environment macros for names, character fields, system info, and deterministic pick
- Add lastGenerationType tracking with event listeners for GENERATION_STARTED and CHAT_CHANGED
- Add ensureLastGenerationTypeTracking helper to initialize event listeners once
- Register name macros: user, char, group, groupNotMuted, notChar, charIfNotGroup
- Register character card field macros: charPrompt, charInstruction, description, personality, scenario, persona, mesExamplesRaw, charDepthPrompt, cre
* Refactor core macros into separate modules by category (env, state, chat, time)
- Move name and character card field macros to new env-macros.js module
- Move system/device/runtime state macros to new state-macros.js module
- Move chat inspection macros (lastMessage, lastMessageId, etc.) to new chat-macros.js module
- Move time/date macros (time, date, weekday, isotime, etc.) to new time-macros.js module
- Remove lastGenerationType tracking logic and helper functions from core-macros.js (moved to state
* Reorganize macro system into engine and definitions directories
- Move macro engine components (MacroEngine, MacroRegistry, MacroLexer, MacroParser, MacroCstWalker) to macros/engine/ subdirectory
- Move macro definition modules (core-macros, env-macros, state-macros, chat-macros, time-macros, variable-macros, instruct-macros) to macros/definitions/ subdirectory
- Create macro-system.js as central entry point that exports engine singletons and initRegisterMacros function
- Refactor variable-macros.js to use S
* Export getGeneratingModel function and add MacroEnvBuilder to macro system exports
- Export getGeneratingModel function from script.js for external use
- Import MacroEnvBuilder in macro-system.js
- Add envBuilder singleton to macros export object alongside existing engine components
* Extract MacroEnv typedefs into separate MacroEnv.types.js file
- Create MacroEnv.types.js with MacroEnv, MacroEnvNames, MacroEnvCharacter, and MacroEnvSystem typedefs
- Remove MacroEnv typedef definitions from MacroRegistry.js
- Update MacroRegistry.js, MacroEngine.js, MacroEnvBuilder.js, and env-macros.js to import MacroEnv from MacroEnv.types.js
- Change MacroEngine.evaluate env parameter type from any to optional MacroEnv
* Add comprehensive e2e tests for MacroEnvBuilder
- Create MacroEnvBuilder.e2e.js with 13 test cases validating environment construction
- Test name override precedence (overrides vs global fallback)
- Test character field population based on replaceCharacterCard flag
- Test original value one-shot helper function behavior
- Test group override string propagation to group/group
* Add substituteParamsAsync function with experimental macro engine support
- Create substituteParamsAsync function in script.js as async alternative to substituteParams
- Use object destructuring pattern for function parameters following RO-RO convention
- Add experimental_macro_engine flag to power_user settings for feature gating
- Add MacroEnvFunctions typedef with original and postProcess function types to MacroEnv.types.js
- Add functions property to MacroEnv typedef for one-shot helpers an
* Add dynamic macro support to MacroEngine with environment-based override and postProcess execution
- Add defOverride parameter to MacroRegistry.executeMacro for temporary macro definitions
- Check env.dynamicMacros in MacroEngine#resolveMacro and create temporary macro definition when found
- Set strictArgs to true for dynamic macros to fail if called with arguments
- Execute env.functions.postProcess on macro results in MacroEngine#resolveMacro with error handling
- Update MacroEnv typedef to make
* Refactor macro handlers to assume non-null env and remove optional chaining
- Remove optional chaining (?.) from env property access in env-macros.js and instruct-macros.js
- Change MacroExecutionContext env property from optional to required in MacroRegistry.js
- Update executeMacro context parameter from optional to required
- Simplify original macro handler to call env.functions.original() directly without try-catch
- Update MacroHandler typedef to use arrow function syntax for consistency
- Remove redundant null checks an
* Refactor MacroRegistry.executeMacro to accept MacroCall object and make MacroExecutionContext properties non-optional
- Change executeMacro to accept MacroCall object instead of separate name and context parameters
- Move normalize function from context parameter to options object in executeMacro
- Construct MacroExecutionContext from MacroCall properties within executeMacro
- Set namedArgs to null in executionContext (currently unused)
- Update MacroEngine.resolveMacro to pass MacroCall directly
* Remove normalize parameter from MacroRegistry.executeMacro and bind normalizeMacroResult directly in execution context
- Remove normalize parameter from executeMacro options object in MacroRegistry.js
- Bind MacroEngine.normalizeMacroResult directly in executionContext instead of accepting override
- Remove normalize option from MacroEngine.resolveMacro call to executeMacro
- Add missing name fields (group, groupNotMuted, notChar) to MacroEnvBuilder default env object
* Make MacroEnvRawContext properties optional and change original function from required to optional in MacroEnvFunctions
- Change MacroEnvRawContext properties from required to optional with null defaults
- Change original function from required to optional in MacroEnvFunctions typedef
- Remove original function from default env object in MacroEnvBuilder (only include when provided)
* Refactor MacroEnvBuilder tests to use optional properties and add macro arity validation tests
- Remove explicit undefined/false assignments from MacroEnvRawContext test objects (now optional with defaults)
- Rename additionalMacro to dynamicMacros in MacroEnvBuilder tests and update property access from env.extra to env.dynamicMacros
- Move original function from env.extra to env.functions in test assertions
- Remove test for additionalMacro overriding original helper (no longer applicable with
* Improve macro error handling with dedicated diagnostics and runtime error propagation
- Import and use logMacroInternalError and logMacroRuntimeWarning from MacroDiagnostics in MacroEngine
- Wrap MacroRegistry.executeMacro call in try-catch to distinguish runtime vs internal errors
- Nest postProcess execution in inner try-catch with dedicated error logging
- Return raw macro syntax on execution failure instead of empty string
- Replace console.warn with logMacroRuntimeWarning for argument count
* Add macro argument type validation with positional argument definitions and runtime type checking
- Add MacroArgType and MacroPositionalArgDef typedefs for argument metadata
- Change requiredArgs option to accept number or MacroPositionalArgDef[] array
- Add requiredArgDefs property to MacroDefinition to store normalized argument definitions
- Validate requiredArgs array elements during macro registration (name, description, type fields)
- Generate default argument definitions when requiredArgs is a
* Add e2e tests for macro type validation and dynamic macro strict arity enforcement
- Add test verifying strict typed macros fail resolution when argument type is invalid
- Add test verifying non-strict typed macros execute with invalid types but log warnings
- Add test verifying dynamic macros reject arguments due to strictArgs enforcement
- Capture and assert runtime warning messages for type validation and arity violations
- Register test macros with integer type requirements and varying strict
* Add mesExamples macro with instruct mode formatting support
- Register mesExamples macro in env-macros.js to format dialogue examples
- Import parseMesExamples, main_api, power_user, and formatInstructModeExamples
- Check instruct mode enabled state and main_api to determine formatting path
- Parse raw examples using parseMesExamples with instruct mode flag
- Return empty string when raw examples are missing or parsed result is empty
- Format examples using formatInstructModeExamples when instruct mode is active
* Add URL navigation wait in test setup and increase Playwright worker count to 4
- Add waitForURL check after user selection in awaitST to ensure navigation completes before preloader check
- Increase Playwright workers from 1 to 4 for parallel test execution
* Add e2e tests for multi-line macro arguments and comment macro functionality
- Add test verifying reverse macro handles multi-line arguments with newline characters
- Add test verifying comment macro removes single-line comments with simple body
- Add test verifying comment macro accepts non-word characters immediately after //
- Add test verifying comment macro ignores additional // sequences inside comment body
- Add test verifying comment macro supports multi-line comment bodies
* Standardize JSDoc type annotations to use explicit null defaults and union types instead of nullable shorthand
* Remove individual test timeout configurations from frontend macro test files
* Add positional argument definitions with sample values and descriptions to core, env, and time macros
- Add sampleValue field to MacroPositionalArgDef typedef (optional string)
- Replace numeric requiredArgs with positional argument definition arrays in roll, banned, outlet, datetimeformat, and timeDiff macros
- Include name, sampleValue, description, and type fields for each positional argument
- Update timeDiff description to clarify absolute difference calculation
- Remove unnecessary blank lines in
* Remove async/await from macro engine evaluation and convert all macro handlers to synchronous execution
Makes me sad, but such is life
* Refactor substituteParams to use options object signature with backward compatibility for legacy positional arguments
- Rename original substituteParams to substituteParamsLegacy with unchanged positional argument signature
- Rename substituteParamsNew to substituteParams as the new primary function
- Add automatic detection and routing of legacy positional argument calls to substituteParamsLegacy
- Update substituteParamsExtended to use new options object signature and mark as deprecated
* forgor
* fix missing import, and package-lock, finally. Maybe.
* Add experimental macro engine toggle to UI settings
- Add experimental_macro_engine setting to default settings.json
- Move experimental_macro_engine property to correct position in power_user object (with other experimental settings)
- Add checkbox UI control in settings panel with flask icon and tooltip explaining nested macro resolution and logical replacement order
- Wire up checkbox event handler to save experimental_macro_engine setting
- Load experimental_macro_engine state on settings initialization
* Refactor macro pre/post-processing from parser to engine and improve error handling
- Move legacy macro pre-processing (time_UTC format) from MacroParser to MacroEngine #runPreProcessors
- Move trim macro post-processing to MacroEngine #runPostProcessors to handle cross-boundary behavior
- Remove MacroLexer import from MacroEngine (now handled by MacroParser.parseDocument)
- Update MacroParser.parseDocument to return separate lexingErrors and parserErrors arrays
* Add {{trim}} macro placeholder that defers to post-processing for cross-boundary whitespace handling
* Add eslint-plugin-playwright
* Add logMacroSyntaxWarning function for structured lexer/parser error reporting with compact human-readable payload
* Small code review fixes
- import event types from events.js
- Add chained fallback to {{input}}, just to be safe
- switched variables.js to export-per-method
- minor text adjustments in registered macro docs
* fix lexer not capturing linebreaks correctly & simplify plaintext token
- Replace alternation-based pattern with negated character class approach
- Use `(?:[^{]|\{(?!\{))+` to match non-brace chars or single braces not followed by another brace
- Add unicode flag for consistency
- Update comment to clarify intent: consume anything that is not the start of a macro '{{'
* Skip macro processing on char/group fields for env build (performance)
- Add returnRaw parameter to getCharacterCardFields to optionally return raw values without baseChatReplace
- Add returnRaw parameter to getGroupCharacterCards for consistent raw value handling
- Replace direct baseChatReplace calls with conditional transform function based on returnRaw flag
- Apply collapseNewlines when returnRaw is true and collapse_newlines setting is enabled
- Update MacroEnvBuilder to use the returnRaw as true
* Fix lexer failing to handle literal '{' before macro openers
- Add PlaintextOpenBrace token to lexer with pattern `/\{(?=\{\{)/` to match single '{' immediately before '{{'
- Update lexer mode definition to consume PlaintextOpenBrace before attempting macro start
- Update parser document rule to handle PlaintextOpenBrace as alternative to Plaintext
- Update MacroCstWalker to collect both Plaintext and Plaintext.OpenBrace tokens when building document items
* Add legacy non-curly marker pre-processing (<USER>, <BOT>, <CHAR>, <GROUP>, <CHARIFNOTGROUP>)
- Add pre-processing step in MacroEngine to rewrite legacy angle-bracket markers into their curly-brace macro equivalents
- Map <USER> → {{user}}, <BOT> → {{char}}, <CHAR> → {{char}}, <GROUP> → {{group}}, <CHARIFNOTGROUP> → {{charIfNotGroup}}
- Add e2e tests verifying legacy marker resolution through the engine pipeline
- Tests cover <USER>, <BOT>/<CHAR>, and <GROUP>/<CHARIFNOTGROUP> markers
* Add env.content to MacroEnv and use it for deterministic {{pick}} hashing
- Add content property to MacroEnv type definition and MacroEnvBuilder to expose the full original input string
- Update {{pick}} macro handler to use env.content hash instead of rawListString hash for seed generation
- Ensures deterministic behavior when the same prompt position contains different list items across evaluations
- Prevents {{pick}} from returning different values when nested macros resolve to different intermediate
* add e2e tests for env.content exposure and deterministic {{pick}} behavior
- Rename getChatIdHashCore → getChatIdHash in core-macros.js for consistency
- Add e2e test verifying env.content is exposed to macro handlers
- Add e2e test confirming {{pick}} returns stable results for same chat and content
- Tests verify deterministic behavior by comparing multiple evaluations with fixed chat_id_hash
* Rename chat macro helper functions to remove 'Core' suffix for consistency
* Add MacrosParser deprecation warnings and bridge to new macro engine when experimental flag enabled
- Import macroSystem and power_user for experimental macro engine integration
- Add @deprecated JSDoc tag to MacrosParser class
- Add #logDeprecated helper to warn about deprecated MacrosParser methods
- Add #registerMacroInNewEngine to bridge legacy macro registrations into new engine
- Add #unregisterMacroInNewEngine to bridge legacy macro unregistrations
- Log deprecation warnings in get, has, register
* Fix lint in tests
* Add comprehensive bracket handling tests and improve macro lexer/parser resilience to invalid syntax
- Add logMacroGeneralError function for non-macro-specific error logging
- Add CST validation check in MacroEngine to return original input if parser produces invalid CST
- Wrap MacroCstWalker.evaluateDocument in try-catch to gracefully handle evaluation failures
- Update MacroLexer Unknown token pattern to capture single closing braces not followed by another closing brace
- Add fallback mode exit
* Add error recovery for incomplete macros by flattening them to plaintext while preserving nested complete macros
- Enable Chevrotain error recovery in MacroParser constructor
- Add #isRecoveryToken helper to detect tokens inserted during error recovery
- Add #flattenIncompleteMacro to recursively convert incomplete macro nodes into plaintext items
- Update #collectDocumentItems to detect recovery-inserted Macro.End tokens and flatten incomplete macros
- Simplify plaintext token collection to use
* Add e2e test verifying nested macros resolve even when outer macro has invalid argument count
* Remove unused macro CST node caching mechanism from MacroCstWalker
* Add JSDoc type re-exports and register shorthand to macro-system.js for improved DX
- Re-export commonly used JSDoc types from MacroRegistry and MacroEnv modules for easier consumption by external code
- Add macros.register shorthand function bound to MacroRegistry.registerMacro for convenient macro registration
- Includes MacroDefinitionOptions, MacroHandler, MacroEnv, and related type definitions
* Migrate legacy macro registrations to new macro system API across multiple modules
- Replace MacrosParser.registerMacro calls with macros.register using object-based configuration
- Update imports from './macros.js' to './macros/macro-system.js'
- Extract macro registration into dedicated registerAuthorsNoteMacros function in authors-note.js
- Add descriptions to all macro registrations for better documentation
- Update MacrosParser iterator to yield from new registry when experimental engine is enabled
* Add MacroCategory to all macro registrations across codebase for improved organization and discoverability
- Import MacroCategory from macro-system.js in authors-note.js, memory/index.js, stable-diffusion/index.js, and macros.js
- Add category property to all macro registrations using appropriate MacroCategory values
- Assign 'legacy' category to MacrosParser auto-registered macros
- Categorize macros across chat, character, prompts, utility, random, state, time, and names categories
* fix lint
* Add MacroBrowser UI component and integrate macro help system into chat interface
- Add implementation of MacroBrowser
- Add macros.css stylesheet link to index.html
- Update core-macros.js ban macro to return empty string instead of 'Empty string' description
- Add sampleValue property to positional argument definitions in MacroRegistry
- Generate default sampleValue for numeric requiredArgs using 'arg{n}' pattern
- Set default description to '<no description>' and returns to '<empty string>' when empty
* Reorder JSDoc typedef declarations in MacroRegistry.js to have the most relevant first
* fix missing category in legacy initMacros
* Add displayOverride and exampleUsage properties to macro registration system
- Add displayOverride property to MacroDefinitionOptions for custom signature display
- Add exampleUsage property to MacroDefinitionOptions for documentation examples
- Update MacroRegistry.registerMacro to validate and process displayOverride and exampleUsage
- Add logMacroRegisterWarning function to MacroDiagnostics for registration-time warnings
- Auto-wrap displayOverride and exampleUsage in curly braces if missing
* Add error handling to MacroRegistry.registerMacro and logMacroRegisterError diagnostic function
- Add logMacroRegisterError function to MacroDiagnostics for registration failures
- Wrap MacroRegistry.registerMacro body in try-catch to handle registration errors gracefully
- Change registerMacro return type from MacroDefinition to MacroDefinition|null
- Log registration errors and return null instead of throwing, preventing macro registration failures from breaking the application
* Optimize character card field access with lazy evaluation to improve macro execution performance
* Add brace unescaping to MacroEngine post-processing to support literal curly braces in macro output
- Add regex replacement to unescape \{ and \} to { and } after macro execution
- Allows users to output literal braces by escaping them with backslashes
- Escaped sequences like \{\{ don't match MacroStart pattern and pass through as plain text
* Add alias system to macro registry with UI support for displaying and navigating macro aliases
- Add `aliases` property to MacroDefinitionOptions for defining alternative macro names
- Add `aliasOf` and `aliasVisible` properties to MacroDefinition to track alias relationships
- Update MacroRegistry.registerMacro to create alias entries pointing to primary definitions
- Add `getPrimaryMacro` method to retrieve primary definition from alias names
- Add filtering options to `getAllMacros` to exclude aliases
* Strip curly braces from MacroBrowser search query to match macro name format in search definitions
* Add enhanced macro autocomplete with argument hints and context-aware suggestions
- Add comprehensive CSS styling for enhanced macro autocomplete items with flex layout
- Add argument hint banner styling with gradient background and border
- Add current argument highlighting in details panel
- Export formatMacroSignature, createSourceIndicator, createAliasIndicator, and createTypeBadge from MacroBrowser for reuse
* Fix macro autocomplete not showing details/arguments because of trailing colons
* Change macro details CSS selectors from `.macroBrowser` to `.macro-details` for better reusability and update autocomplete to use macro enum icon
- Replace all `.macroBrowser` selectors with `.macro-details` in macros.css to allow macro details panel styling to work outside MacroBrowser context
- Change autocomplete option icon from hardcoded '{}' to `enumIcons.macro` for consistency
- Remove redundant `showCategory: false` option from renderMacroDetails call in autocomplete (now handled by default
* Add MacroArgType enum to replace string literal type union for macro argument types
- Add MacroArgType enum with STRING, INTEGER, NUMBER, and BOOLEAN values
- Replace MacroArgType typedef string literal union with enum reference
- Export MacroArgType from macro-system.js alongside MacroCategory
- Remove MacroArgType typedef re-export (now an enum, not a type)
* Add support for multiple argument types in macro definitions
- Update createTypeBadge to handle both single type and array of types, displaying as "type1 | type2" with tooltip
- Add JSDoc comments to MacroArgType enum values explaining each type
- Update MacroArgDefinition typedef to allow type property to be single MacroArgType or array
- Update MacroRegistry.registerMacro to validate array of types and default empty arrays to 'string'
- Update validateArgTypes to check if argument value matches
* Add returnType property to macro definitions with automatic type badge display in macro details panel
- Rename MacroArgType enum to MacroValueType to reflect dual use for arguments and return types
- Add returnType property to MacroDefinitionOptions (defaults to MacroValueType.STRING)
- Add returnType validation in MacroRegistry.registerMacro to ensure valid type values
- Update renderMacroDetails to always show Returns section with type badge
- Add macro-returns-content CSS class with flex layout for type
* Add detailed argument definitions, return types, and example usage to all variable macros
- Replace numeric requiredArgs with detailed argument definition objects including name, type, and description
- Add returnType property to all macros that return values (inc/dec/get variants)
- Add returns property descriptions to all macros
- Add exampleUsage arrays demonstrating typical usage patterns for each macro
- Apply changes consistently
* Add returns descriptions and return types to core macro definitions with improved documentation
* Add returns descriptions, display overrides, and example usage to time macros with improved documentation
* fix lint
* Add returns descriptions and return types to chat, environment, instruct, and state macros with improved documentation
* Add missing properties to dynamic macro definition override to match MacroDefinitionOptions structure
* Replace console logging with MacroDiagnostics logging in MacroEnvBuilder and MacroRegistry
* Add support for array-based argument types in macro autocomplete with union type display and tooltip
* Rename requiredArgs to unnamedArgs and add support for optional unnamed arguments with bracket notation in macro signatures and hints
* Add optional offset argument definition to time macro with type, sample value, and description
* Simplify example usage for random and pick macros by removing surrounding context text
* Add default value display for optional macro arguments in autocomplete and browser documentation
* Fix macro args defaultValue not being converted into the normalized values for register and display
* Allow STscript macro auto completion to still show up when typing closing braces
* Add space macro with optional count argument for inserting multiple spaces
* Add optional count argument to newline macro for inserting multiple newlines with default value of 1
* Remove MutationObserver and CTRL+F keyboard event handling from MacroBrowser
* fix lint
* Register `{{summary}}` macro for both old and new macro engines based on experimental flag
* Register `{{charPrefix}}` and `{{charNegativePrefix}}` macros for both old and new macro engines based on experimental flag
* Update hidden alias badge text to indicate deprecation status
* Simplify macro name validation and error handling in MacroRegistry
Remove redundant `macroName` variable by normalizing `name` parameter early and reusing it throughout the registration flow. Consolidate trim checks in validation condition.
* Remove exp macro engine flag checks from auto complete and help, and remove legacy macro template
Move macro registration to always use new engine regardless of experimental flag. Remove conditional logic for `experimental_macro_engine` in MacroBrowser, system messages, and slash command parser. Delete legacy `macros.html` template and associated static macro help generation. Always use MacroBrowser for macro documentation display.
* Rename macros to camelCase and add backward-compatible aliases
Rename `description`, `personality`, `scenario`, `creatorNotes` to `charDescription`, `charPersonality`, `charScenario`, `charCreatorNotes` respectively. Rename `idle_duration` to `idleDuration`. Add old names as aliases for backward compatibility. Add `comment` as visible alias for `//` macro. Mark `idle_duration` alias as hidden.
* fix `random` and `pick` macros by using list parameter directly instead of raw string
Remove `raw` parameter from `random` and `pick` macro handlers. Simplify legacy comma-separated list handling by using `list[0]` directly instead of `rawListString`. Rename `items` variable to `list` in `pick` macro for consistency.
* fix `random` and `pick` not handling all colon-separated lists as before
Extract `readSingleArgsRandomList` helper function to handle legacy comma-separated and double-colon list parsing. Reuse this helper in both `random` and `pick` macro handlers to eliminate duplicated list parsing logic.
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: bmen25124 <bmen25124@gmail.com>
|
||
|
|
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> |
||
|
|
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> |
||
|
|
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>
|
||
|
|
de7c113346 |
Multiple attachments (#4719)
* 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> |
||
|
|
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> |
||
|
|
dcab740b99 |
Added deleteMessage method (#4666)
* Added deleteMessage * Simpler swipeDeletion param * Added to context * Fix review comments * Only offer swipe deletion if count of swipes > 1 * Improve array check * Fix generation broken after message deleted * Use named constant for confirmation result * Save chat immediately --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> |
||
|
|
59a80fb0a0 | getContext: export showSwipeButtons/hideSwipeButtons | ||
|
|
b7f93b3594 |
expose openThirdPartyExtensionMenu for Video Avatar extension (#4646)
* init * Use less egregious export method --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> |
||
|
|
6d4be9116d |
Added saveMetadataDebounced to context, fixed 0 values for custom-req… (#4386)
* Added saveMetadataDebounced to context, fixed 0 values for custom-request payloads, fixed system role prefix * Update filtering logic --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> |
||
|
|
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> |
||
|
|
f0fbd7e3d4 |
added swipe left and right to st-context
Added swipe_right and swipe_left to st-context as a swipe group. |
||
|
|
27f2fac916 | Export swipe_right in public/script.js and add swipe_right to getContext in st-context.js | ||
|
|
e5d5f953ec | Add symbols to getContext | ||
|
|
80e1226d28 | Exported reloadEditor | ||
|
|
0e41db615e | New exports | ||
|
|
d42a81f97c | New connection manager events, ConnectionManagerRequestService (#3603) | ||
|
|
79a8080b7d |
Merge pull request #3671 from bmen25124/events_type_param
New context methods, added type parameter to message events |
||
|
|
92dacdb386 | better type name, simplified context | ||
|
|
874affb2f2 | exporting parseReasoningFromString() | ||
|
|
ddb77732f2 | New context methods, added type parameters to message events | ||
|
|
50f1e3f0f2 |
Added translation to reasoning block (#3617)
* Added translate to reasoning block * Added mising reset value * Shortcut nullable type * Added reasoning edited/deleted events, better naming * Fixed async call * Added await to saveChat calls * Exported updateReasoningUI * Removed translated reasoning on edit if auto mode is none * Added new value check before updating reasoning block, fixed an issue that display value stays same when we edit the message. * Translate reasoning before the main message * Fixed auto mode translate for reasoning message * Translate reasoning first. Prevent out of bounds access * Fix translating reasoning on swipe generation --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> |
||
|
|
383806325a | Add shallow character load mode | ||
|
|
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> |
||
|
|
73035c1d1c | add clearChat in st-context | ||
|
|
7c72c1d9f3 |
add printMessages in st-content
so that we can use this func in extension |
||
|
|
e312ae6b3b | Add locale data loading for extensions | ||
|
|
7064ce81c7 | Exported getChatCompletionModel with optional parameter | ||
|
|
092ef26144 | Exported getTextGenServer, extractMessageFromData, getPresetManager methods. Added optional parameters to some methods for generic usage. | ||
|
|
d5bdf1cb90 |
Add settings.json-backed KV string storage
Fixes #3461, #3443 |
||
|
|
630c7980d3 | New exported methods: loadWorldInfo(), saveWorldInfo(), updateWorldInfoList(), convertCharacterBook() | ||
|
|
1df209c284 | Export variable manipulation functions to getContext | ||
|
|
9d73189133 | Add updateMessageBlock and appendMediaToMessage to getContext | ||
|
|
bbf28c74f7 | New exported methods: getCharacters(), uuidv4(), humanizedDateTime() | ||
|
|
0e5100180b | expose tokenizers & getTextTokens in getContext | ||
|
|
485e9e2eaa | Fix redundancy in getContext. Add power user settings | ||
|
|
192a1f4014 | getContext: Simplify chatId access | ||
|
|
77841dbc21 | Add types for SillyTavern.getContext |