Commit Graph

142 Commits

Author SHA1 Message Date
柚柚子 752ae243b9 Fix KoboldCpp vector hash deletion (#5508) 2026-04-23 23:03:59 +03:00
TanJeeSchuan e5d4ff5fae Enhance Vectorize All process with error handling, retries and minor improvements (#5479)
* fix (vectors): Fixed Vectorize All progress report and ETA issues

* fix (vectors): Added strip reasoning block function for extras/WebLLM summaries

* feat(vectors): Retry failed summaries with configurable attempts

* feat(vectors): Skip summarization for short messages

* feat(vectors): Skip failed messages during Vectorize All instead of aborting all

Prevents the "Vectorize All" process from stopping on single-message
errors. Failed items are now skipped and reported at the end of the
session rather than aborting the entire sync.

Summarization: Implements per-message retries; failures use the original
text as a fallback or mark for skipping.

Vector Insertion: Differentiates fatal configuration errors (abort) from
transient batch failures (skip and notify).

* Resolved: 'account_id_missing' is missing

* Resolved: Refactored out summarizeSkipOnFailure() functionality into summarize() via options parameter

* Fix eslint and type checks

* feat(vectors): add types to maps and sets, improve summarize function options

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-20 02:33:12 +03:00
Copilot 64e8c8d964 Refactor repetitive vectorization model loading into a generic data-driven function (#5425)
* refactor: replace 12 individual load/populate functions with generic loadRemoteEmbeddingModels

Replaced 6 pairs of load+populate functions (Chutes, NanoGPT, ElectronHub,
OpenRouter, SiliconFlow, WorkersAI) with a single data-driven generic
function and a configuration map, following the pattern used by the
caption extension's processEndpoint helper.

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/29bd42f8-b35b-442f-91fe-bd6c1092436e

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

* address review: always include body, use typeof check, remove omitContentType

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/ccfc6ba8-57fd-4411-8e12-106b5e11be86

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
2026-04-09 23:50:32 +03:00
Wolfsblvt f3521e7007 Migrate built-in extensions to use manifest-based activate hooks (#5435)
* Convert jQuery/IIFE wrappers to exported init() functions and register activate hooks in 8 extension manifests

* Convert remaining extensions to exported init() with activate hooks and await initExtensions()

- Convert jQuery/IIFE wrappers to exported init() functions in expressions, memory, quick-reply, regex, stable-diffusion, translate, tts, and vectors extensions

- Register init functions as activate hooks in extension manifests

- Properly await async initExtensions() in firstLoadInit()

* Fix eslint

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-09 23:49:55 +03:00
Tony Gies a9c377c3c8 feat: add Workers AI text embeddings and multimodal captioning (#5414)
* feat: add Workers AI text embeddings and multimodal captioning

Extends the Cloudflare Workers AI integration to the vectors and
caption extensions.

Embeddings: adds workers_ai source to the vectors extension using the
OpenAI-compatible /v1/embeddings endpoint, with dynamic model listing
from the Cloudflare model search API.

Captioning: adds workers_ai as a multimodal caption API with dynamic
vision model discovery via the multimodal-models endpoint.

* Add logo svg

* Refactor caption dropdown population

* Fix order of sources

* feat: add error handling for missing Workers AI account ID

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-08 23:43:21 +03:00
Copilot c918f4f36d Add opt-in toggle to keep hidden messages in chat vector index (#5378)
* Initial plan

* Add opt-in toggle to keep hidden messages in chat vector index

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/eadc80a1-a417-40df-a374-76d7c4a46ce3

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

* Revert package-lock changes

* Fix: Remove 'vectorized' class from chat messages before adding it

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
2026-03-30 23:39:19 +03:00
Xiangzhe 2cb1861db6 feat: add SiliconFlow.cn chat completion and embedding support (#5316)
* feat: add SiliconFlow.cn endpoint support and embedding vectors

Chat completion:
- Add endpoint selection dropdown (Global/.com vs China/.cn) to existing
  SiliconFlow provider, following the Z.AI endpoint pattern
- Backend switches API URL based on selected endpoint
- Add /api-url slash command support for endpoint switching

Embeddings:
- Add SiliconFlow as a vector/embedding source (OpenAI-compatible)
- Support both .com and .cn endpoints via siliconflow_endpoint setting
  borrowed from the main connection panel (Vertex AI pattern)
- Superset model list with platform attribution (.cn) markers
- Models: Qwen3-Embedding (0.6B/4B/8B) + BGE/BCE models (.cn only)

* Add filter by models type

* Load embedding models from endpoint

* Improve api-url command declaration

* Support endpoint override in custom-request service

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-03-22 00:52:03 +02:00
Maksim c0a4682dcc feat: Add gemini-embedding-2-preview in google vectorization models (#5274)
Co-authored-by: Maksim Sharkov <msharkov@nobilis.team>
2026-03-13 19:58:06 +02:00
Cohee 4d1619ba47 Chore: enable brace-style eslint check (#5159)
* eslint: enable brace-style check

* Fix jsdoc and color

* fix: correct CSS color syntax in CreateZenSliders function
2026-02-15 01:46:32 +02:00
Cohee 357da3219b Chore: Add code formatting conventions as eslint rules (#5158)
* Add code formatting conventions as eslint rules

* Improve formatting in addQuickReply
2026-02-15 01:16:34 +02:00
Copilot 5832cb8b07 Add NanoGPT embeddings support for Vector Storage (#5150)
* Initial plan

* Add NanoGPT embeddings support for Vector Storage

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

* Fix models loading

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
2026-02-14 00:31:30 +02:00
Cohee 9d36b19ef9 Update validation for query messages and max entries 2026-01-16 23:11:07 +02:00
adventchilde / aethel 8926cdc5ce Adding Slash Commands for Vector Storage Extension (#5008)
* Add vector slash commands

* Updated vector-threshold command per feedback. Want to validate it is correct before fixing other commands.

* Added slash commands for several vector storage settings.

* Added slash commands for vector storage, updated w/dev feedback

* Fix min value of entries

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-01-16 22:59:24 +02:00
DeclineThyself 8372e7bf9d "gradually replacing property access with a dot operator" (#4965)
* "gradually replacing property access with a dot operator"
https://github.com/SillyTavern/SillyTavern/pull/4963#discussion_r2663003561

(?<=\w|\])\['([a-zA-Z]\w+)'\]
My regex found 593 matches across 47 files.
Also, two typos.

* Fixed chat[0].chat_metadata type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664275854

* Fixed `swipedElementsDiv[0]?.getAnimations().filter((a) => a.animationName` type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664274593

* Fixed config.MESSAGE_SANITIZE and config.MESSAGE_ALLOW_SYSTEM_UI type errors.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664266271

* Fixed group.date_last_chat type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664295652

* Reverted SlashCommandParser dot property access.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664310931

* LLM fixed canUseNegativeLookbehind.result; type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664314288

* Reverted chat-completions.js bodyParams and headers dot property access.

https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664317848
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664320088
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664324438

* Reverted openai.js data dot property access.

https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664326244

* Reverted tests/frontend/MacroEnvBuilder.e2e.js env.dynamicMacros dot property access.

https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664330990

* Partially reverted `window` dot property access.

* Reverted result.json() and settings dot property access.

* Reverted google.js headers dot property access.

* Fixed regex: `(?<=\w|\])\['([a-zA-Z]\w*)'\]`

* Swapped window to globalThis with dot property access.

* LLM fixed canUseNegativeLookbehind type.

* Refactor property access

* Consistency

---------

Co-authored-by: user <user@exmaple.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-01-08 23:58:21 +02:00
Cohee f26a672811 Omit content type in POST request if no body 2025-12-07 23:26:47 +02:00
Ben 55a07d445d Chutes integration (#4844)
* Chutes integration

* Fix eslint

* Fix key saving

* Fix logo coloration

* Fix tool checks

* Unhide image inlining controls

* Fix order of options

* Fix type use in TTS extension script

* Add Chutes as a vector storage source

* Change log levels to debug

* Fix streamed reasoning parsing

* Skip remote models update

* TTS: Fix API key highlight

* Sort image models A-Z

* TTS: Fixes

* Remove unused SD endpoint

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

* remove chutes quota / balance

* Fix: streamed tool calling

* Hide reasoning effort control

* Add image request debug log

* Fix: scroll down on media load in extensions

* Unhide some samplers

* Bring back reasoning effort

* This code will never execute

* Reformat else if cases

* Add stop strings to request

* Remove conditional from reasoning_effort body param

* Preserve original pricing fields

* Unhide logit bias setting

* Pass repetition penalty and logit bias to backend

* Swap llama tokenizer for llama3

* Pass min_p, remove supported_sampling_parameters checks

* Enable logprobs

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-12-01 00:17:49 +02:00
Cohee 845bd8c999 OpenRouter: Add as vector storage provider (#4736)
* OpenRouter: Add as vector storage provider

* Better array filtering
2025-11-03 21:53:17 +02:00
Cohee 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>
2025-11-02 20:10:43 +02:00
Ngo Dinh Gia Bao f0ceba43e9 feat: [Electron Hub] Support Vector Storage, Better searching for image engine (#4540)
* feat: [Electron Hub] Add Vector Storage, Better searching for image model list

* feat: [Electron Hub] Add quality parameter for Image Engine

* fixed ESLint

* Update public/scripts/extensions/vectors/index.js

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* small tweaks

* Use default getOpenAIVector

* Refactor and clean-up code

* Move endpoint filtering logic to backend

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-10-21 23:38:12 +03:00
Cohee 780633e05a text-embedding-005 2025-10-08 21:24:55 +03:00
Cohee 82d9fa79e8 Add vectorization via Vertex AI (#4311)
* Add vectorization via Vertex AI

* Enable batching for Google vectors

* Add batch embeddings for Vertex

* Split embed methods for Vertex/AI Studio
2025-07-25 23:59:30 +03:00
Cohee 1a92157643 Refactor generateRaw/generateQuietPrompt calls (#4277)
* generateQuietPrompt: Update to object arguments

* generateRaw: Update to object arguments

* Fix jsdoc

* Fix lint

* Unwrap JSON schema options

* Remove default args from gen call
2025-07-15 23:11:31 +03:00
Cohee 579ef1e86c Refactor API key management in extensions 2025-06-26 21:24:51 +03:00
Cohee 441dffc0da Vectors: Allow chunk overlap when forced chunking on delimiter 2025-06-15 01:48:17 +03:00
Cohee 7659dfb85c Remove reasoning from raw builder summaries 2025-05-13 00:59:27 +03:00
Cohee a122109e0c Add new model option 'embed-v4.0' to Cohere vectorization settings
Closes #3951
2025-05-04 12:26:44 +03:00
Cohee 05daddb60c Fix KoboldCpp saved vectors retrieval 2025-04-27 23:18:39 +03:00
pl752 07fb92b37d Added vector secondary url placeholder example 2025-04-16 17:39:29 +05:00
pl752 f8bccb472f Adjusted naming and validation 2025-04-16 17:34:58 +05:00
pl752 bfe50403af Forgot semicolons 2025-04-16 16:45:01 +05:00
pl752 5cf3198da1 Added option to use secondary API URL in vector extension 2025-04-16 16:04:33 +05:00
Cohee 78bda9954d Increase maximum injection depth and WI order (#3800) 2025-04-13 21:31:57 +03:00
Cohee 70fe5b6e01 Add Gemini embedding model for vector storage 2025-04-01 21:42:26 +03:00
Cohee 80e821d12d Add support for KoboldCpp embeddings in Vector Storage (#3795)
* Add support for KoboldCpp embeddings in vector processing

* Add validation for KoboldCpp embeddings to handle empty data

* Improve toast handling
2025-04-01 21:21:29 +03:00
Cohee 1cb9287684 Vectors WebLLM (#3631)
* Add WebLLM support for vectorization

* Load models when WebLLM extension installed

* Consistency updated

* Move checkWebLlm to initEngine

* Refactor vector request handling to use getAdditionalArgs

* Add error handling for unsupported WebLLM extension

* Add prefix to error causes
2025-03-09 00:51:44 +02:00
Cohee 58bbfc0d4e Add types for global translation function 2025-02-19 22:18:09 +02:00
Cohee 058c86f3c1 Vectors: Don't use headers for source-specific fields in requests 2025-02-16 23:59:00 +02:00
Cohee f83dccda39 Mark 'Extras' option as deprecated in built-in extensions 2025-02-08 21:56:54 +02:00
Eradev 1f9fa74786 Rewritten minLogLevel feature 2025-01-15 10:02:32 -05:00
zerofata 89c984830b rename resultSize to count 2025-01-12 07:20:36 +13:00
zerofata fc5debc660 replaced returnChunks with return arg to use existing helper functions 2025-01-11 17:42:19 +13:00
zerofata 7f5ce54b1f Add returnChunks and resultSize args to /db-search 2025-01-11 11:32:05 +13:00
Cohee 77bee453ab Vectors: Add only custom boundary chunking 2025-01-03 20:44:25 +02:00
Cohee 02900520c9 chore: Add index property to HashedMessage 2025-01-03 03:09:16 +02:00
Cohee eff4da42c5 Vector storage: skip for quiet prompts 2025-01-03 03:04:45 +02:00
Cohee 2f5f9a437d Allow running generate interceptors on quiet prompts 2025-01-03 01:10:14 +02:00
Cohee 378dfd3626 Vectors: escape file names 2024-11-18 15:24:26 +00:00
Cohee aaed09f606 Data Bank: display file ingestion progress 2024-11-18 15:18:45 +00:00
Cohee ba0d6bfa26 Vectors: fix force_chunk_delimiter value init 2024-10-16 07:53:53 +00:00
Cohee 69283f511f Optimize summarization on query 2024-10-15 23:27:18 +03:00