Compare commits

...
202 Commits
Author SHA1 Message Date
Wolfsblvt ad29cbda62 docs: route new provider contributions before implementation (#6099)
* docs: route new provider contributions before implementation

* docs: point provider PR authors to integration guide
2026-10-03 00:05:27 +02:00
EmandWolfsblvt bc81b9f7e3 Change API button warning from credit to charge (#6049)
* Change API button warning from credit to charge

Updated the warning message for the test API button to indicate a charge instead of a credit. (you are using tokens to send the message, the provider is not giving you tokens because you sent a test)

* fix: clarify test message usage charges

---------

Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
2026-09-23 23:19:13 +02:00
EmandWolfsblvt 8901f28b01 Fix typos in property descriptions in char-data.js (#6054)
* Fix typos in property descriptions in char-data.js

Wether → Whether x6

* docs: correct character description property text

---------

Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
2026-09-23 23:16:59 +02:00
Em 9758a6cd5e Fix typo in readme regarding open source status (#6047)
Corrected 'open sourced' to 'open source' for consistency.
2026-09-23 23:08:52 +02:00
Em ca7330f1af Fix typo in comment for tool calls (#6052)
assistent → assistant
2026-09-23 23:08:18 +02:00
Em a1c7f19bac Fix typo in comment (#6053)
posible  →  possible
2026-09-23 23:07:45 +02:00
Wolfsblvt e9860754ad feat: add GPT-6 Sol and Luna, Opus 5.5, and Gemini 3.8 Flash (#6070) 2026-09-23 21:59:01 +02:00
Wolfsblvt 7c39941963 Merge pull request #6038 from SillyTavern/release
Sync npm publishing workflow to staging.
2026-09-14 21:16:18 +02:00
Wolfsblvt 06bde939fb Fix npm release publishing workflow (#6037)
Allow npm releases to be retried from an existing release tag through the trusted publishing workflow, and scope the `allow-directory` workaround to the publish command.
2026-09-14 21:01:34 +02:00
Wolfsblvt 7e8663cd9c Merge pull request #6036 from SillyTavern/staging
1.19.0
2026-09-14 19:55:46 +02:00
Wolfsblvt 61139aa9b6 Update release version number (#6035) 2026-09-14 19:44:18 +02:00
Wolfsblvt 5e8d463ed4 feat: add Claude Fable 5.1 and GPT-6 Astra (#6015) 2026-09-14 19:03:39 +02:00
F.B. c0a417b240 Add image embed for DeepSeek V4 Flash Vision Exp (#5964) (#5996)
Add deepseek-v4-flash-vision-exp to image embed whitelist.
Block image embed in non `user` msg as DS doesn't allow this.
2026-09-07 23:09:17 +02:00
X00LAandClaude Sonnet 5 cc053e8356 Fix CORS proxy forwarding raw zstd-compressed bytes to the client (#6007)
undici (Node's fetch) transparently decompresses gzip, deflate, and br,
but not zstd. When a browser's full Accept-Encoding header is forwarded
as-is to the target origin, a Cloudflare-fronted server may respond
with zstd, and corsProxyMiddleware pipes those still-compressed bytes
straight through — the client receives garbage instead of the expected
body (e.g. "SyntaxError: Unexpected token" when parsing JSON).

Cap the outgoing Accept-Encoding to the encodings undici can actually
decode, so the target always responds with something we can forward
correctly.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-07 23:07:13 +02:00
Siyuan ChenandWolfsblvt d6b244cd25 Fix: Avoid cpSync crash when renaming characters (#6012)
* Fix: Avoid cpSync crash when renaming characters

Add a no-op filter to fs.cpSync during character renaming.

This avoids Node.js's native copyDir fast path, which can terminate
the process on Windows with affected Node.js versions instead of
throwing a catchable filesystem error.

Refs: https://github.com/nodejs/node/issues/63970

* docs: explain character rename copy workaround

---------

Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
2026-09-07 23:05:18 +02:00
voodoohop e7c4f8ee98 fix: resolve Pollinations TTS model aliases (#6010) 2026-09-07 23:03:43 +02:00
QiuLGandQiuLG a8f7e0d900 Fix Quick Reply overwrite cancellation (#6005)
Co-authored-by: QiuLG <195722592+QiuLsG@users.noreply.github.com>
2026-09-07 23:00:44 +02:00
saitewasreset 4613abc26e Google AI Studio: Fetch all model pages (#5954)
Paginate the Gemini models endpoint before returning available
generateContent models, and reject incomplete model lists.
2026-09-01 00:58:51 +02:00
Jeremy SchoemakerandWolfsblvt dd326d244f Return a degraded preview instead of dropping a chat whose last line is unparseable (#5969)
* fix: return a degraded preview instead of {} when a chat's last line is unparseable

getChatInfo resolved an empty object when the last line of a chat .jsonl
failed to parse or lacked known fields (truncated write, external edit).
All three consumers (chat list, search, recents) drop entries without a
file_name, so an otherwise intact chat silently disappeared from the UI
while still occupying its name for uniqueness checks (#5940).

Resolve the already-built chatData instead: file_id, file_name, file_size
and mtime-based last_mes are known good from stat(), chat_items comes from
the line count, and mes falls back to the existing placeholder. Matcher
results from the intact lines are preserved for search.

Fixes #5940

* fix: exclude unreadable chat line from message count

Keep degraded previews aligned with the messages that can actually be loaded by excluding both the metadata line and broken trailing line.

---------

Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
2026-09-01 00:38:40 +02:00
Zhewen Tan ccd8287833 fix: preserve zero NovelAI Math1 temperature (#5965) 2026-08-31 23:36:06 +02:00
Em 30eaf26a43 Update TavernAI link in README (#5987)
Update TavernAI link in README
2026-08-27 01:33:51 +02:00
PeterGriffin 98af17a8a4 fix(chat): delete associated tool calls with messages (#5949) 2026-08-21 06:35:50 +02:00
primorLee 0a9ba91852 fix: parse boolean values in env migrations (#5950) 2026-08-21 06:33:08 +02:00
Christoph 814734d4af Fix duplicate tool call IDs if provider repeats id, type, name (#5948)
Before this fix, tool call IDs were duplicated repeatedly with streaming requests if the provider repeats the "id" field in each streaming chunk:

```
{
    role: 'tool',
    content: 'content',
    tool_call_id: 'chatcmpl-tool-aa62chatcmpl-tool-aa62chatcmpl-tool-aa62chatcmpl-tool-aa62'
},
```

After this fix:

```
{
    role: 'tool',
    content: 'content',
    tool_call_id: 'chatcmpl-tool-aa62'
},
```

Example of raw streaming chunks received from Fireworks AI exhibiting this behavior of repeating "id", "type", "name":

```json
{
  "id": "chatcmpl-b7de",
  "object": "chat.completion.chunk",
  "created": 1783459695,
  "model": "accounts/fireworks/models/glm-5p2",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "index": 0,
            "id": "chatcmpl-tool-aa62",
            "type": "function",
            "function": {
              "name": "debug_tool",
              "arguments": ""
            },
            "name": null
          }
        ]
      },
      "finish_reason": null,
      "raw_output": null
    }
  ],
  "usage": null
}
{
  "id": "chatcmpl-b7de",
  "object": "chat.completion.chunk",
  "created": 1783459695,
  "model": "accounts/fireworks/models/glm-5p2",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "index": 0,
            "id": "chatcmpl-tool-aa62",
            "type": "function",
            "function": {
              "name": null,
              "arguments": "{\"input\": \""
            },
            "name": null
          }
        ]
      },
      "finish_reason": null,
      "raw_output": null
    }
  ],
  "usage": null
}
{
  "id": "chatcmpl-b7de",
  "object": "chat.completion.chunk",
  "created": 1783459695,
  "model": "accounts/fireworks/models/glm-5p2",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "index": 0,
            "id": "chatcmpl-tool-aa62",
            "type": "function",
            "function": {
              "name": null,
              "arguments": "First"
            },
            "name": null
          }
        ]
      },
      "finish_reason": null,
      "raw_output": null
    }
  ],
  "usage": null
}
```
2026-08-21 06:16:41 +02:00
Christoph 8992872765 Fireworks: Request and process reasoning (#5947)
This change enables reasoning effort selection for the Fireworks provider as documented at https://docs.fireworks.ai/guides/reasoning#using-reasoning_effort.
2026-08-19 23:47:16 +02:00
Christoph 558d72dde2 Fireworks AI: Set session affinity header for improved caching (#5826)
This change adds a chat-specific "x-session-affinity" HTTP header to requests to Fireworks that use the full prompt. Quiet requests like summarization requests that don't use the same prompt prefix are excluded.

This improves prompt caching by
1. Adding a stable "x-session-affinity" header, which Fireworks AI recommends to route requests to the same replica
2. Separating different chats into different sessions
3. Separating main LLM calls from quiet calls which have a completely different prompt prefix

See https://docs.fireworks.ai/guides/prompt-caching.

This uses an HMAC with the cookie secret instead of simply hashing the chat title to avoid leaking chat titles. Session affinity headers may not fall under zero-data retention in Fireworks or could be cached by proxies on the way. Chat titles are tiny, so the HMAC computation is instant.
2026-08-19 23:25:15 +02:00
WolfsblvtandClaude Fable 5 4ad7af3c06 fix: use provider error fields instead of statusText for HTTP 200 errors (#5945)
Providers can return an HTTP 200 response whose body carries an error
object without a message field, or the error as a plain string. The
error message fell back to response.statusText, which is 'OK' for any
200 response, producing the opaque 'Error: OK'. Error messages now fall
back to the error's code or type field, then the string form, and only
use statusText for non-2xx responses where it carries meaning. Applies
to the non-streaming request path and both streaming error toasts.

Fixes #5647

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 21:05:04 +02:00
WolfsblvtandClaude Fable 5 bcc42de2e9 Give non-ASCII chat names distinct backup keys and throttles (#5944)
* fix: give non-ASCII chat names distinct backup keys and throttles

Backup filenames replace all non-alphanumeric characters with
underscores, so names such as equal-length CJK ones collapsed to the
same key and shared a single backup quota: busy chats evicted the
backups of unrelated quiet ones. The backup key now appends a short
hash of the raw name whenever the name contains non-ASCII characters,
keeping keys distinct and stable while ASCII names keep their exact
current keys and retention.

The backup throttle was also keyed per user only, so rapid saves in
one chat deferred or swallowed the backup of another chat saved in the
same window. It is now keyed per user and chat.

Fixes #5780

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: replace stray NUL byte in backup throttle key separator

A literal 0x00 byte slipped into the template string separator, which
made Git treat the whole file as binary.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: reunite backupChat docblock with its function

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 20:49:43 +02:00
WolfsblvtandClaude Fable 5 b4e162324b fix: mint a fresh integrity slug for new branches and checkpoints (#5943)
Branches and checkpoints inherited the parent chat's integrity UUID
through the chat_metadata spread in saveChat and saveGroupBookmarkChat,
so every member of a branch family shared one slug and the integrity
guard could not tell them apart. A save aimed at the wrong file within
the family would pass validation. New branches and checkpoints now get
their own slug at creation. Existing files are unaffected.

Fixes #5942

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 20:30:01 +02:00
Marcela Petra Ferraz de Novaes 2c61f3be1e fix: never resize avatars option does not work for group chat avatar (#5936)
* Check the never_resize_avatars setting to request or not cropping for group avatars.

* Change max width of thumbnail to 300px so square images are allowed.
2026-08-19 20:17:30 +02:00
48e7d605df fix(expressions): guard against null/undefined default-expression labels (#5938)
* fix(expressions): guard against null/undefined default-expression labels

Classifiers can return a falsy or literal "null"/"undefined" expression
label, and setDefaultEmojiForImage then requested the nonexistent
/img/default-expressions/null.png, producing a 404.

Fall back to DEFAULT_FALLBACK_EXPRESSION (joy) when the label is falsy,
a literal "null"/"undefined", or a custom expression without a default
asset. This is the only place the default-expressions URL is built, so the
guard covers all 404 paths.

Fixes #5863

* fix(expressions): fall back for any label without a default asset

Generalize the guard to a whitelist check against DEFAULT_EXPRESSIONS.
Every entry in that list has a matching default-expressions asset, so
any other label (falsy, literal null/undefined strings, custom
expressions, or unexpected classifier output) falls back to the
default expression instead of requesting a missing image.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 20:13:23 +02:00
WolfsblvtandClaude Fable 5 12b4fc50aa tests: set extensions enabled override for discover suite
PR #5571 added an extensionsEnabledFeatureGuard middleware that reads
extensions.enabled via getConfigValue. The test environment has no
config.yaml, so getConfig() exits the process and kills the Jest
worker, failing the extensions-discover suite. Set the env var
override so the guard resolves without touching the config file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 20:06:43 +02:00
Yongjie Guan 742d5601be Prevent proxy access keys from triggering password-manager prompts in Chromium-based browsers (#5913)
* fix: prevent proxy keys from triggering password manager

Render reverse proxy credentials as visually masked text fields with password-neutral DOM identifiers while preserving existing settings, preset, and request field names. Align the Azure OpenAI key input and add regression coverage.

* fix: preserve masked secret clipboard protection
2026-08-19 20:05:15 +02:00
4ed1372411 fix: correct malformed multimodal caption request for oobabooga (#5915)
Closes #4448

The 'ooba' special case in the caption-image route split the correctly
structured message (a single user message with a content array
containing text + image_url) into two separate messages, moving
image_url to a top-level property with an empty content array.

oobabooga's own multimodal image handling (modules/image_utils.py)
only looks for images inside content array items with
type: 'image_url', so this transformation caused the image to be
silently dropped, producing hallucinated or "I can't see an image"
captions - even though the request appeared to contain valid image
data.

Removing the special case lets 'ooba' use the same, already-correct
message structure as every other multimodal-capable API.

Verified against a local oobabooga (llama.cpp/GGUF loader) with a
vision-capable GGUF + mmproj pair: before the fix, captions ignored
the attached image; after the fix, captions accurately describe real
photos.

Co-authored-by: bbastex <bbastex@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-17 03:33:13 +02:00
Christoph 86b55c8696 Fireworks: Update model fetching because /v1/models is broken (#5831)
* Fireworks AI: Fetch model list from custom URL

Fireworks provides the model list on a custom URL in a custom format, see https://docs.fireworks.ai/api-reference/list-models. The standard /v1/models endpoint no longer works correctly and returns a wrong list of models:

```
Available models: [
  'accounts/fireworks/models/deepseek-v4-pro',
  'accounts/fireworks/models/flux-1-schnell-fp8',
  'accounts/fireworks/models/glm-5p1',
  'accounts/fireworks/models/glm-5p2',
  'accounts/fireworks/models/gpt-oss-120b',
  'accounts/fireworks/models/kimi-k2p5',
  'accounts/fireworks/models/kimi-k2p6'
]
```

Many new models like Deepseek V4 Pro, Kimi K2.7 Code are missing.

* Fireworks AI: Add "fast" models

Some models have a "fast" variant. The model list endpoint does not return this information, so for now the available fast versions are listed explicitly.

Fast models have the same parameters (max context etc.) as the regular ones. They are only faster and cost more.
2026-08-17 03:30:30 +02:00
Martin TibkeandMartin Tibke 1a7f88861d fix(tags): drop filters for tags with no assigned entities (#5911)
Filter lists only print tags that are assigned to at least one entity, so a
persisted filter on an unassigned tag has no element to toggle. "Clear all
filters" cannot reset it either, since it works by clicking the printed
elements. The result is a character list that stays empty on every app start,
showing only an "N characters hidden" notice with no visible cause.

removeMissingTagFilters() already dropped filters for deleted tags and for
empty open bogus folders (#5225). Generalize that check to any tag without
assigned entities, which covers plain tags as well, and clear the matching
account storage entry so the filter does not come back on the next reload.

Co-authored-by: Martin Tibke <martin@tibke.net>
2026-08-17 03:01:40 +02:00
WolfsblvtandClaude Fable 5 800caeb9e0 fix: skip extension folders without a manifest during discovery (#5934)
A manually deleted extension often leaves a folder husk on disk, for
example when Windows fails to remove locked .git files. The discover
endpoint listed any directory, so the husk kept reporting as an
installed extension: /extension-exists and /extension-state returned
true after a fresh load and the manifest fetch produced a 404 in the
console on every load. Discovery now skips folders without a
manifest.json and logs a warning naming the exact path, and the
client drops any discovered name whose manifest could not be loaded
so state queries cannot report ghost extensions.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 02:47:08 +02:00
f91050136c fix: show full Generic textgen model list in a select (#5897)
Browsers filter datalist suggestions to the current input value, so
Generic OpenAI-compatible text completion looked like a single model
while Chat Custom's select showed the full /v1/models list. Add an
Available Models select (select2 + reconnect) matching other textgen
backends, and keep the optional free-text Model ID field.

Co-authored-by: trahloc <trahloc@proton.me>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 02:21:11 +02:00
f199580102 fix: remove GroupId requirement from MiniMax TTS (#5920)
* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension (#5778)

* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension

Added New versions and new Default model

* Add glm-5.2 option to model selection dropdown

* fix: remove GroupId requirement from MiniMax TTS

MiniMax's current API (sk-cp- keys) uses Bearer auth only. GroupId
is a legacy parameter from the pre-2025 API that the current API
tolerates/ignores. Requiring it blocks new users from setting up
MiniMax TTS.

- Backend: drop groupId from required params and URL
- Frontend: remove Group ID input field and all validation checks

Fixes #5909

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Samueras <Samueras@jackoedv.de>
Co-authored-by: chen-jiying <chen-jiying@users.noreply.github.com>
2026-08-17 01:36:56 +02:00
eaf2858e43 fix: use exact ArrayBuffer slices for BYAF imports (#5917)
* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension (#5778)

* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension

Added New versions and new Default model

* Add glm-5.2 option to model selection dropdown

* Refactor file reading to use getArrayBufferSlice

* Update util.js

* Update util-pure.test.js

* test: add real-archive regression for BYAF pooled buffer handling

Builds an actual BYAF zip in memory, embeds it at an offset inside a
larger backing buffer to simulate Node's buffer pooling, and proves
through the real parser that the exact ArrayBuffer slice parses
correctly while the raw oversized backing buffer does not.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Samueras <Samueras@jackoedv.de>
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 01:28:15 +02:00
1cfdcd82e1 fix: skip non-image ComfyUI outputs (#5910)
* fix: skip non-image ComfyUI outputs

* test: cover ComfyUI gif fallback and no-output error paths

Extends the skip-non-image regression with the gifs fallback that
animated workflows rely on and the error path when no output node
carries images or gifs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: CaoBochun <caobochun@bytedance.com>
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 01:19:49 +02:00
7228502f0b Add Claude Opus 5 / Sonnet 5 and Gemini 3.7 Flash / 3.6 Flash / 3.5 Flash-Lite (#5883)
* feature: add Claude Opus 5, Sonnet 5, and Gemini 3.6 Flash / 3.5 Flash-Lite

Enable adaptive thinking and strip rejected sampling/prefill fields so the new models work with Chat Completions and Image Captioning.

* feature: add Gemini 3.7 Flash

Strip rejected sampling/prefill fields and map min thinking to low so the model works with Chat Completions and Image Captioning.

* feat: refresh Claude and Gemini model lists on top of Claude 5 support

Builds on the Claude 5 and Gemini wiring in this branch: removes
retired models from the Claude and Gemini dropdowns and captioning
lists (claude-opus-4-1 verified retired with a live 404; Gemini 2.0
experimental models, 2.5 preview snapshots, and gemini-3-pro-preview
are shut down per Google's model docs), labels deprecated models
without touching option values so saved selections keep working, adds
claude-fable-5 to the captioning list, and moves new-install defaults
to claude-sonnet-5 and gemini-3.7-flash. Claude 5 generation, vision,
web search, and effort mapping verified live against the API; the
trailing-prefill test now uses a plain loop so the tests lint passes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 01:10:28 +02:00
WolfsblvtandClaude Fable 5 4f6977b779 feat: verify GPT-5.6 support and refresh OpenAI model list (#5932)
Verifies Sol, Terra, and Luna live against the API: generation,
vision, effort values (none/low/xhigh), the unlisted gpt-5.6 alias,
and the sampler contract (temperature and top_p are rejected even
with reasoning off, so the strict stripping stays). Removes models
OpenAI has shut down from the model dropdowns, labels announced
deprecations without touching option values, orders groups newest
first, and moves the new-install and captioning defaults off
gpt-4-turbo, which shuts down on October 23, 2026.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 00:37:46 +02:00
6fea520309 Don't do a full chat reload from /addswipe (#5903)
* Don't reload chat from addswipe

* test: add /addswipe regression and harden e2e login helper

Covers both /addswipe modes through the real command pipeline:
swipe data, counters, visible text, and message element identity,
which a full chat reload would break. The login helper now tries
accounts from last to first so password-protected accounts don't
break local e2e runs, and the test waits out fresh-account
onboarding before measuring.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 00:13:30 +02:00
aca0684c0b Fix crash when a chat is deleted during a search/recent scan (#5871)
* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension (#5778)

* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension

Added New versions and new Default model

* Add glm-5.2 option to model selection dropdown

* Fix crash when a chat file is deleted mid-scan

getChatInfo() stats a chat file without handling ENOENT. If the file
is deleted (e.g. from the UI) while a search or the recent-chats list
is scanning the same directory, the stat throws, and since it's inside
new Promise(async (res) => {...}) with no reject wired up, it becomes
an unhandled rejection that kills the whole server process.

This catches ENOENT and resolves with { match: false } instead, same
as the fallback already used elsewhere in this function/its callers
for corrupted or unmatched entries.

* fix: handle all mid-scan chat deletion races in getChatInfo

The stat guard alone left the function unsound: it lived inside an
async promise executor, so a non-ENOENT error became an unhandled
rejection and the promise never settled. A file deleted between the
stat and the stream opening still crashed via an unhandled stream
error, which readline re-emits, and a file truncated to empty mid-scan
hung the request because the close handler never resolved.

getChatInfo now uses plain async/await up to the streaming part,
resolves a no-match sentinel when the file vanishes at either point,
resolves an empty object on truncation, and properly rejects
everything else. Comes with deterministic regression tests for each
race window.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Samueras <Samueras@jackoedv.de>
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-16 23:51:08 +02:00
0x4kgi 54aedc8797 Add/enable low reasoning effort for Deepseek (#5924)
Also mapping min/minimum as low as it makes sense here.
2026-08-16 23:45:06 +02:00
b5cc683074 Update BFL generation and polling endpoints to api.bfl.ai (#5681)
* Fix BFL API endpoint and polling URL handling

* fix: send authentication header when polling BFL results

The bfl.ai API requires the x-key header on the polling request as
well; the retired bfl.ml API tolerated unauthenticated polling. Without
the header every poll returns 403 and generation never completes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-16 23:41:48 +02:00
WolfsblvtandClaude Fable 5 cd2c65c9d4 fix: await chat completion preset application when switching presets (#5930)
Applying a CC preset deferred the actual settings update behind an
unawaitable event continuation, so /preset resolved before the preset
was applied. A connection profile switch runs /api, /preset, /api in
sequence, and the preset's stored chat_completion_source would land
after the final /api check, reverting the source to the previous
provider. Requests then silently went to the wrong endpoint.

The preset application chain is now captured in a promise that
selectPreset awaits, so /preset resolves only when the preset is fully
applied and follow-up commands sequence correctly. The UI dropdown
path is unchanged, and callers that do not await selectPreset keep
the exact previous behavior.

Fixes #5926
Fixes #5147

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-16 23:21:01 +02:00
ed563cb7d8 fix: reject localhost and .localhost domains in /api/search/visit to prevent SSRF bypass (#5749)
* fix: reject localhost and .localhost domains in /api/search/visit to prevent SSRF bypass

The hostname check in /api/search/visit only validated IP addresses using
ipRegex, but did not block 'localhost' or subdomains ending in '.localhost'.
This allowed SSRF bypasses to internal services via localhost URLs.

Changes:
- Add explicit rejection of 'localhost' hostname
- Add rejection of any hostname ending in '.localhost' (RFC 6761 reserved)

Closes GHSA-wm7j-m6jm-8797

* fix: enforce SSRF boundary for /api/search/visit at connection time

The URL string checks only guard the literal input. Hostnames resolving
to private addresses, redirects into internal services, and DNS
rebinding all bypassed them. The visit endpoint now routes its outbound
request through a strict PrivateRequestAgent even when the private
request filter is disabled: the resolved IP is validated at connection
time on every hop and the connection is pinned to the validated IP.
When the private request filter is enabled its configured whitelist
keeps applying, and an enabled request proxy keeps owning routing.
Also rejects bracketed IPv6 literals, which kept their brackets and
slipped past the hostname check.

Fixes GHSA-wm7j-m6jm-8797

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-16 22:56:44 +02:00
WolfsblvtandClaude Fable 5 32e1966757 fix: require confirmation before overwriting chats with unparseable headers (#5928)
An existing non-empty chat file whose first line could not be parsed as a
JSON object passed the integrity check as if it were a legacy chat, so a
save silently replaced the file and only the replacement got backed up.
The check now fails closed for unparseable, truncated, or non-object
headers, routing the client into the existing overwrite confirmation
dialog. A UTF-8 BOM in front of an otherwise valid header is stripped
before parsing. Empty files, valid legacy headers, and force saves behave
as before.

Fixes #5454

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-16 22:23:29 +02:00
Frank Schubert 380e31e8c5 fix: fetch only current prompt from ComfyUI history endpoint (#5790)
The ComfyUI polling loop fetches /history every 100ms to check if the
current prompt has completed. This returns the entire history, which
grows unboundedly. After ~170 generations, the JSON response exceeds
Node.js's 512MB string length limit, crashing the server with:

  RangeError: Invalid string length

Fix by requesting /history/{id} instead, which returns only the single
prompt entry needed. This is a supported ComfyUI API endpoint that
returns the same data structure.
2026-07-12 00:43:10 +02:00
Tony Gies 46bd341ec1 perf(plugins): list plugin dirs without per-entry statSync (#5690)
updatePlugins called fs.statSync on every entry returned by readdirSync
just to test isDirectory(). Pass withFileTypes to readdirSync and filter
on the Dirent type instead. Symlinks are still treated as directories.
2026-07-12 00:31:20 +02:00
Tony Gies aaf12b4925 perf(util): read each file's mtime once when getImages sorts by date (#5689)
The previous date sort read file modification times while comparing
items, which meant stat'ing the same files over and over for one
listing. mtimes are now read once per file before sorting. Files that
disappear during the call (e.g. concurrent deletion) sort to the start
instead of crashing.
2026-07-12 00:25:22 +02:00
DeathStalker471andWolfsblvt c4672e953e chore: Sync NanoGPT providers: UOMI and Wafer (#5707)
* Sync Nanogpt providers again

* Sort providers alphabetically

---------

Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
2026-07-12 00:21:37 +02:00
cloak1505 4259eb7220 Sync OpenRouter providers list (#5686) 2026-07-12 00:04:43 +02:00
DragonFSKY 0168803f41 Fix whitespace-only reasoning block controls (#5636)
* Fix whitespace-only reasoning block controls

* Fix duplicate hidden reasoning editor

* Fix hidden reasoning open state cleanup

* Add reasoning message edit regression tests
2026-07-11 23:54:25 +02:00
Wolfsblvt 2463e83966 Fix: remove trailing whitespace from variable macros (#5848)
- Restore root lint compliance for the variable macro registry.
2026-07-11 23:23:19 +02:00
Wolfsblvt 0a1a746bfd Fix: ignore local third-party extensions during linting (#5847)
- Keep root lint focused on core sources.
- Ignore local .windsurf IDE settings.
2026-07-11 23:22:56 +02:00
Jason WuandWolfsblvt 902bd10382 Add Claude Opus 4.8, GPT-5.6 models, and migrate Gemini 3.1 Flash Lite and Gemini image models to stable (#5845)
* feature: support Claude Opus 4.8 model

* feature: support OpenAI GPT 5.6 models

* fix: replace deprecated Gemini preview model with stable gemini-3.1-flash-lite

* Fix GPT-5.6 Chat Completions effort mapping

- Map Maximum reasoning effort to xhigh because max is Responses-only
- Clarify model-specific OpenAI and adaptive Claude effort guidance
- Cover stable Gemini 3.1 Flash-Lite thinking-level routing

Tests:
- npm run test:unit -- --runInBand
- ESLint on all changed JavaScript files

* Fix: migrate Gemini image models to stable IDs

- Replace shut-down Gemini image preview selectors for Google AI and Vertex AI
- Migrate saved chat and caption model settings to the stable replacements
- Enable image generation for the stable model IDs
- Correct the Gemini 3.1 Flash Image context fallback to 128K
- Add regression coverage for stable Gemini 3 image thinking levels

Tests:
- npm run test:unit -- --runInBand
- ESLint on all changed JavaScript files

---------

Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
2026-07-11 16:22:04 +02:00
maxime-fleury 29ed34939c Fix translation for 'Persona Description' in French (#5830)
Fix translation in french
2026-07-08 20:34:58 +02:00
Noahandransxd 37943ea4b1 Optimize World Info entry sorting to avoid O(n^2) lookups (#5809)
* Optimize World Info entry sorting to avoid O(n^2) lookups

The comparator in checkWorldInfo called sortedEntries.indexOf() twice per
comparison, making the sort O(n^2 log n). Build an index Map once and use
it for lookups instead. Sort order is unchanged.

* Address review: build index map before sort, use -1 for unknown entries

Move sortedEntriesIndex creation to immediately before the activatedNow
sort so indices match the current sortedEntries array. Use ?? -1 so
externally force-activated (cloned) entries behave like indexOf(-1).

* Skip index map when at most one entry needs sorting

Build sortedEntriesIndex only when activatedNow.size > 1, since the
comparator is not used for zero or one activated entries.

---------

Co-authored-by: ransxd <ransxd@users.noreply.github.com>
2026-07-08 20:21:46 +02:00
Lukas Straub 29e0df4886 Openrouter: Enable logprobs if requested by user (#5804) 2026-07-07 20:24:53 +02:00
6b49e9e7d0 Add claude-fable-5 support to Claude and OpenAI-compatible request builders (#5757)
* Add claude-fable-5 support to Claude and OpenAI-compatible request builders

* Fix: request Fable thinking summaries on auto

- Request summarized adaptive thinking for claude-fable auto effort when reasoning display is enabled

- Preserve existing effort mapping and sampler stripping behavior

Verification:

- node --check src/endpoints/backends/chat-completions.js

- git diff --check

---------

Co-authored-by: TheLonelyDevil9 <TheLonelyDevil9@users.noreply.github.com>
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
2026-07-07 20:22:32 +02:00
WolfsblvtandSamueras bba96c6fbe Update TTS model from Gemini 2.5 to 3.1 in TTS Extension (#5778) (#5824)
* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension

Added New versions and new Default model

* Add glm-5.2 option to model selection dropdown

Co-authored-by: Samueras <Samueras@jackoedv.de>
2026-07-07 19:52:38 +02:00
Samueras 8172dcd0ee Update TTS model from Gemini 2.5 to 3.1 in TTS Extension (#5778)
* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension

Added New versions and new Default model

* Add glm-5.2 option to model selection dropdown
2026-07-07 19:36:20 +02:00
Samueras 10ae84fb62 Add glm-5.2 to contextMap (#5770)
* Add glm-5.2 to contextMap

Add glm-5.2 to contextMap

* Update contextMap for glm-5.2 max value
2026-07-07 19:29:45 +02:00
RossAscends bf6f0b0c46 Merge pull request #5814 from underscorex86/patch-5
change novelai user information to be called from image.novelai.net
confirmed via Anlatan discord announcement.
2026-07-04 13:51:32 +09:00
underscore_x 3594fe224a change user information to be called from image.novelai.net
"for 3rd party API customers: GET /user/information, GET /user/data, GET /user/subscription should now be called from https://image.novelai.net. The old URL will be non-functional in a couple of hours. The old URL is currently non-functional."

from NAI devs, this change has already been implemented from NAI side, no backward compat.
2026-07-04 05:43:04 +01:00
Tosd 1ca70787f9 Add gemini-3.5-flash to Google AI Studio and Vertex model lists (#5675) 2026-05-20 13:06:50 +03:00
Cohee 691f0ce604 Temporarily comment out allow-remote setting in .npmrc due to npm bug (#5668)
https://github.com/npm/cli/issues/9347
2026-05-19 21:04:48 +03:00
Cohee fe048f6bdc Improve remote tokenizer encode validation (#5665)
* fix: handle unsupported text generation types in encode endpoint

* fix: simplify URL handling in encode endpoint by using trimV1 utility
2026-05-19 00:45:56 +03:00
Blueberry 93bd9e217e Macros: Access array and object elements (#4383) (#5649)
* Macros: Access array items by index (#4383)

* Macros: Access array and object elements (#4383)

* fix spacing

* setvarkey setvarindex

* setglobalvarindex getglobalvarindex
2026-05-19 00:13:47 +03:00
Cohee fd582be5ca Add rate limit to account reset (#5603) 2026-05-18 23:25:50 +03:00
Cohee 3a453d4cfa Enforce stricter npm source restrictions in .npmrc (#5663) 2026-05-18 22:51:39 +03:00
40ca51f4f1 Pollinations: Add API endpoint selection (#5625)
* Split Pollinations into two separate API providers: (Key) and (No Key)

- Replaces the single "Pollinations" source with two distinct entries:
  - "Pollinations (Key)": uses gen.pollinations.ai/v1 with Bearer token auth,
    supports BYOP OAuth flow with app key pk_Gu8Ta8q6QhS67hSg and manual key entry
  - "Pollinations (No Key)": uses text.pollinations.ai/v1, no authentication required
- Renames CHAT_COMPLETION_SOURCES.POLLINATIONS to POLLINATIONS_KEY/POLLINATIONS_NOKEY
  throughout the codebase (constants, endpoints, frontend scripts)
- Adds BYOP authorize button and OAuth callback handler for key-based source
- Updates all data-source attributes, secret key mappings, model selectors,
  tool-calling, reasoning, slash-commands, caption, and SD extension references

https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj

* Fix POLLINATIONS_NOKEY: exempt from API key check, fix placeholder text

- Add POLLINATIONS_NOKEY to the keyless providers exemption in the
  /generate endpoint's API key guard (was hitting the 400 check)
- Remove 'pk_...' from the key input placeholder since pk_ is the
  app key used in the BYOP auth link, not the user's secret key

https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj

* Add Pollinations anonymous/authenticated endpoint selector

Implements reviewer feedback to use a single Pollinations provider with
an endpoint dropdown (similar to Z.AI) rather than two separate sources.

- Add POLLINATIONS_ENDPOINT enum (anonymous / authenticated)
- Anonymous uses text.pollinations.ai/v1, no API key required
- Authenticated uses gen.pollinations.ai/v1, requires sk_... key with BYOP OAuth support
- Key input and BYOP button are hidden when anonymous endpoint is selected
- Backend skips key guard for anonymous requests
- Reasoning effort and JSON schema only sent for authenticated mode
- Connection status check passes for anonymous without a saved key

https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj

* Fix broken Pollinations references after resolving merge conflicts

- Replace POLLINATIONS_KEY/NOKEY in CHAT_COMPLETION_SOURCES with POLLINATIONS
- Fix SECRET_KEYS.POLLINATIONS → SECRET_KEYS.POLLINATIONS_KEY in backend
- Update all chat_completion_sources references in openai.js to use unified POLLINATIONS
- Consolidate duplicate model select/change handlers into single pollinations_model
- Keep backward compat in caption-image handler for pollinations_key/nokey multimodal API
- Fix openai.js inline handler to route pollinations to correct endpoint based on endpoint field

https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj

* Complete Pollinations unification: remove all pollinations_key/nokey splits

- Fix committed merge conflict in openai.js (Wolfsblvt review)
- Replace POLLINATIONS_KEY/NOKEY in chat_completion_source dropdown with single POLLINATIONS option
- Replace pollinations_key,pollinations_nokey in all data-source attributes with pollinations
- Merge duplicate /pollinations_key and /pollinations_nokey multimodal routes into single /pollinations
- Update caption extension: single "Pollinations" option using pollinations_endpoint from oai_settings
- Update slash-commands.js model selector to single pollinations entry
- Clean up caption-image handler (openai.js) to use only 'pollinations' api type
- Pass pollinations_endpoint in caption request body (shared.js)
- Add settings migration: pollinations_key → pollinations, pollinations_nokey → pollinations (anonymous)

https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj

* Address Cohee review: named constants, mock key, revert POLLINATIONS_KEY rename, default to authenticated

- Use POLLINATIONS_ENDPOINT named constants throughout (no magic 'anonymous' strings)
- Use mock key pattern (set key to POLLINATIONS_ENDPOINT.ANONYMOUS value) so no guard exception needed
- Revert POLLINATIONS_KEY rename back to POLLINATIONS in secrets.js files
- Default pollinations_endpoint to AUTHENTICATED so saved keys aren't bypassed
- Remove redundant isPollinationsAnon check from getReasoningEffort() (backend handles it)
- Unify tool-calling.js, caption, shared, stable-diffusion to single POLLINATIONS source

https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj

* Fix ESLint padded-blocks error in BYOP OAuth callback

https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj

* fix: regression in caption API validation

* fix: remove unneeded migration

* fix: remove duplicate keyless check in apiSourceConfig

* fix: regression in extractReasoningFromData

* refactor: simplify UI unhide logic

* fix: remove BYOP flow due to security concerns

* fix: use a string instead of a constant reference for placeholder key

* fix: reconnect when switching endpoints

* feat: support pollinations in /api-url command

* fix: remove endpoint check from image generation (it always uses authenticated)

* fix: default to authenticated

* fix: use a named constant in auto-connect logic

* fix: filter by modality in anon models list

* fix: remove bespoke model loading logic for anon endpoint

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-05-18 22:45:53 +03:00
Wolfsblvt 060f224f28 Add MessageFormatter: a structured hook system for extensions to transform message content pre-DOM (#5652)
* feat(core): add MessageFormatter pipeline for extension message hooks

Introduces a new MessageFormatter singleton class (public/scripts/message-formatter.js)
that allows extensions to transform message text at well-defined stages of the
messageFormatting() pipeline, before the result reaches the DOM.

The pipeline exposes three hook stages (all before DOMPurify sanitization):
- BEFORE_REGEX  -- raw Markdown, before custom regex rules
- AFTER_REGEX   -- plain Markdown, after regex, before showdown conversion
- AFTER_MARKDOWN -- rendered HTML, after showdown, before sanitization (default)

There is intentionally no post-sanitize stage to prevent XSS vectors.

Extensions register hooks via getContext().messageFormatter.addHook(fn, { stage, order }).
Stage and order enums (formatting_stage, hook_order) are re-exported on the
singleton instance itself so extensions need no additional imports beyond getContext().

The formatter also exposes a .format() shim over messageFormatting() for
convenience. messageFormatting() itself gains full JSDoc documentation.

* feat(core): add pipeline documentation to MessageFormatter.format()

Adds detailed JSDoc documentation to the MessageFormatter.format() method
describing the complete 11-step message formatting pipeline, from prompt-bias
stripping through DOMPurify sanitization. Clarifies that all extension hooks
(beforeRegex, afterRegex, afterMarkdown) run before sanitization to ensure
their output is always sanitised.

* feat(core): add async detection and non-string return guards to MessageFormatter

Adds runtime and registration-time safety checks to the MessageFormatter hook system:
- Throws TypeError at registration if an async function is passed to addHook()
- Emits console warning and ignores return value if a hook returns non-string at runtime
- Detects Promise returns and includes helpful hint that hook may be async
- Updates JSDoc to clarify synchronous string return requirement and error conditions

* test(frontend): add comprehensive e2e tests for MessageFormatter

Adds full test coverage for the MessageFormatter singleton class including:
- Module exports validation (formatting_stage, hook_order enums)
- Singleton instance constant re-exports
- Registration validation (rejects non-functions, async functions, unknown stages)
- Hook execution pipeline (stage isolation, order sorting, context freezing)
- Error handling (continues on throw, warns on non-string/Promise returns)
- Stage injection

* refactor(core): rename ch_name parameter to characterName in MessageFormatter

Renames the `ch_name` parameter to `characterName` throughout MessageFormatter for improved code clarity and consistency with modern naming conventions. Updates JSDoc typedef and method signatures.
2026-05-18 21:51:16 +03:00
Wolfsblvt aec9754b31 Fix: Scoped comment macro {{//}}...{{///}} not removing its content (#5643)
* fix: handle scoped comment macro closing tag tokenization edge case

The lexer greedily tokenizes '//' before '/', causing {{///}} to parse as {{// /}} instead of {{/ //}}. Added special case detection in MacroCstWalker to check if the comment macro's first argument starts with '/' and treat it as a closing block. Removed list/strictArgs flags from comment macro definition and added comprehensive e2e tests for scoped comment blocks.

* refactor: DRY, remove unneccessarily duplicated private extractMacroInfo
2026-05-18 21:48:49 +03:00
Wolfsblvt 9f8c3e156a Lorebook "Apply Current Sorting" — Order control, ascending mode, step size, and live validation feedback (#5653)
* feat: enhance world info sorting with ascending/descending modes and animation

- Add autoFocus property to popup inputs with autofocus attribute and tabIndex
- Add slide animation to setInfoBlock/clearInfoBlock with configurable animate option
- Replace simple input prompt with detailed popup for applying current sorting
- Add ascending/descending order toggle for world info entry sorting
- Add configurable step value between order assignments
- Add real-time warning when starting value is below

* fix: improve world info sorting warning to account for step value

- Update warning calculation to consider step size when detecting order collisions
- Add step input parameter to updateWarning function
- Attach input listener to step field for real-time warning updates
- Display more detailed warning message showing the calculated final order value
2026-05-18 20:14:45 +03:00
Wolfsblvt 355598bb30 fix: disable pipe/filter feature to prevent breaking macros with pipe characters in arguments (#5644)
Temporarily commented out Filter.Pipe and Filter.EscapedPipe token handling in MacroLexer to fix issue where pipe characters in argument values (e.g., {{setvar::foo::|bar}}) were incorrectly parsed as filter operators. Added regression tests for pipe handling in argument values and skipped existing output modifier tests until filter flag (>) logic is properly implemented.

Resolves: #5618
2026-05-18 19:56:38 +03:00
mekineerandCohee 45d166ff6a fix(autocomplete): guard MutationObserver against detached textarea (#5660)
When a textarea is removed from the DOM before the autocomplete
clone-positioning logic runs, parentElement is null and
MutationObserver.observe throws. This can happen when extensions
abort generation early (via generate_interceptor) and the textarea
is torn down before autocomplete finishes setup.

Add a null check so the observer is only attached when the parent
still exists.

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-05-18 19:35:36 +03:00
realyxl 69cf5571ba Update outdated readme-zh_cn.md and readme-ja_jp.md (#5659) 2026-05-18 19:33:36 +03:00
加乘 81be2c51a2 Update outdated readme-zh_tw.md (#5639) 2026-05-18 19:32:19 +03:00
DeathStalker471 a900958bef chore: Sync NanoGPT providers: Tensorix, and Xiaomi (#5646)
* Sync NanoGPT providers, Tensorix, and Xiaomi

* fix lint
2026-05-18 19:31:18 +03:00
underscore_x 56061f793c fix mislabelled popup for "Replace existing Quick Reply set" (#5662)
* fix mislabelled popup for "Replace existing Quick Reply Set"

it currently provides a popup asking for confirmation "Replace existing World Info" when user tries to create a new QR Set with an existing name.

Checked that it does not conflict/reuse anything from the actual world info screen.

* capitalisation
2026-05-18 19:30:26 +03:00
FeldherrenandCohee 77ba2c21a5 Add message indicating that the 'Request mode reasoning' checkbox controls whether reasoning is generated at the source, for Deepseek API (#5633)
* Add message indicating that the 'Request mode reasoning' checkbox
controls whether reasoning is generated at the source, for Deepseek API.

* Added zai and moonshot to conditions for showing message indicating reasoning is enabled/disabled by 'request model reasoning' toggle..

* Added new message indicating openrouter's behaviour when 'request model reasoning' setting is disabled.

* fix: grammar

* fix: duplication for openrouter

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-05-13 22:43:37 +03:00
Leandro Jofré 597517730b Feat/New features for character expressions (#5574)
* update: improve fetching of selected default expression
It includes the fallback values #emoji and #none.

* update: allow expression-list to filter custom expressions
It can allow, filter out, or only include custom expressions in the result.

* update: separate getLastExpression from the slash command to use on macros

* feat: register defaultExpression macro
It will fetch the label of the currently selected global fallback expression.

* feat: register lastExpression macro
It will return the last expression used by the selected character.

* feat: register availableExpressions macro
Returns a list of all expressions provided by the Classifier API.

* update: fix macros labels

* update: normalize return label for defaultExpression macro

* Fix - Typos

* Update - Add compatibility with old macro engine

* Fix - Remove redundant structuredClone

* Update - Consider sprite folders to fetch the last expression used

* Update - Improve last message handling when name is provided

* Fix - Update description of getLastCharacterMessage

* Update - Bring back using active character as fallback for groups
Just weighted that if no name is provided, doing fallback to the active character generating prompt is more useful for groups than grabbing the expression used by another character, after randomly removing that prev commit.
2026-05-13 22:35:45 +03:00
44af6bc169 Update persona lore on WI rename (#5637)
* Fix personal lore stale update on rename (#5628)

* Add test for rename persona lore

Co-authored-by: Copilot <copilot@github.com>

* Fix stale update on personal lore rename

Co-authored-by: Copilot <copilot@github.com>

Given the recent work to fix #5610, this is a continuation to fix a
similiar bug in the persona lore.

* Add newline for linter check

---------

Co-authored-by: Copilot <copilot@github.com>

* feat: update links for other personas

---------

Co-authored-by: Unnatural Developer <40277404+unnaturaldeveloper@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
2026-05-13 22:04:03 +03:00
RojikkuandCohee 3913dfffb9 fix(content-manager) parseChubUrl should clean URL before relying on length (#5604)
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-05-13 22:03:26 +03:00
Tantoofaaz777 d08bbb1096 Skip inactive autocomplete repositioning (#5635) 2026-05-13 20:53:50 +03:00
Manthan AwganandCohee b1f5c29921 Refactor custom header and body handling in OpenAI scripts to use substituteParams function for improved parameter substitution. (#5627)
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-05-13 20:43:58 +03:00
Cohee bfff81bbf9 fix: event type in note-position command (#5624) 2026-05-12 00:54:26 +03:00
Unnatural DeveloperandCohee d5b6b7924b Fix stale chat bound lore name after rename (#5610)
* Add test to reproduce chat lore bug

Co-authored-by: Copilot <copilot@github.com>

Given that I wanted to reliably reproduce the bug, I created a playwright Docker container as part of this commit, along with the applicable unit test. The included docker-compose includes an environment variable that is passed for use by the frontend test harness, default to the host that the playwright and the ST instance containers are running on.

* Fix stale chat bound lore name after rename

Co-authored-by: Copilot <copilot@github.com>

Given the function renameWorldInfo and the resulting call to updateWorldInfoLinks, this fix ensures that if the world_info key in the chat_metadata is still set to the old name, it will be updated to the name

Resolves: #5608

* Start to separate test runner from branch

Given the bug fix for #5608 should be separate from the test runner
compose file, this commit removes the file from the branch associated
with the bug fix.

* Fix frontend test setup to check for login page

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

* Make change to eslint configuration

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

Given the updates to the setup of frontend-utils, configure eslint to
recognize browser and jquery specific globals

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-05-12 00:27:11 +03:00
CasualAutopsyandCohee e0c1dbad8f Add expand editor button to CC quick prompts (#5607)
* Add expand editor button to quick prompts

* fix: clean-up html

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-05-12 00:25:37 +03:00
ReithanandCohee 37b3e9e461 fix /tokens command returning inflated count for OpenAI API (#5601)
* fix /tokens command returning inflated count for OpenAI API

* Apply repo owner's patch to improve token counting fix

- Remove artificial 'role: system' wrapper that caused inflated counts
- Initialize token_count to 0 instead of -1
- Simplify web tokenizer to join message content directly
- Maintains caching functionality while fixing the overhead issue

* lint

* Revert to using cached implementation

* lint 2: revenge

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-05-12 00:19:48 +03:00
Wolfsblvt 29a18ce0c6 Refactor getUniqueName utility for allowBaseName option (#5602)
* feat: add allowBaseName option to getUniqueName utility function

* feat: simplify getUniqueName by removing allowBaseName option and changing default startIndex to 0
2026-05-05 22:33:04 +03:00
Cohee 51ad27fb86 Merge pull request #5591 from SillyTavern/staging
Staging
2026-05-03 18:45:46 +03:00
Cohee 982dfec022 Update release version number (#5590) 2026-05-03 18:44:24 +03:00
Forkoz 95ca4315bd Add encode_special_tokens to tokenizers.js (#5589) 2026-05-03 18:39:36 +03:00
Cohee 97392a4ca0 Refactor extension management and assets download menu (#5583)
* feat: refactor extension and asset management

* feat: refactor name selector

* fix: make text localizable

* fix: handle abort errors in extension version checks

* fix: replace returns with throws

* fix: remove debug prefix from toast

* fix: preserve file names of imported characters
2026-05-02 20:01:44 +03:00
Cohee e5ae782705 Add option to return malformed JSON string from extractJsonFromData (#5578)
* feat: add option to return malformed JSON string from extractJsonFromData
Fixes #5569

* fix: add fallback for Perplexity case
2026-05-02 18:31:06 +03:00
Cohee 9d61bbc3ed fix: npm audit package dependencies (#5572) 2026-05-02 17:41:39 +03:00
Cohee 3eb3861596 Extension clone improvements (part 2) (#5571)
* fix: remove the cloned directory if it contains no manifest

* fix: apply feature flag guard to user extension data hosting

* fix: disable inactive controls when feature flag is off

* fix: change response status to 404
2026-05-02 17:08:57 +03:00
CoheeandCopilot c325c6d8e9 Add account version tags to cookies (#5563)
* feat: add user account version to session cookie

Co-authored-by: Copilot <copilot@github.com>

* feat: include user handle in account version hash calculation

* feat: refactor recovery code generation to use a dedicated function

* fix: don't overwrite current session version if updating another user

Co-authored-by: Copilot <copilot@github.com>

* fix: reset session version instead of nullifying the entire session

* fix: short circuit and clear cookie on request invalidation

Co-authored-by: Copilot <copilot@github.com>

* fix: update account version on recovery

---------

Co-authored-by: Copilot <copilot@github.com>
2026-05-02 17:07:57 +03:00
Leandro Jofré 91c40280ed Update/Turn expression-set-fallback into expression-fallback (#5564)
* Update - Turn expression-set-fallback into expression-fallback
Make the extension a getter and setter instead of a setter only.

* Update - Rewrite the help string and add usage examples

* Fix - Remove the alias
2026-05-01 17:04:49 +03:00
CoheeandCopilot b2fa6a0afb Add rate limit to basic auth middleware (#5504)
* feat: add rate limiting to basic auth flow

* fix: round up retry-after duration

* feat: enhance point consume logic

* fix: move unauthorized webpage reading inside response function

* refactor: move getIpAddress to express-common

* fix: check for rate limit before checking creds

* fix: use correct rate limit pattern in /recover-step2

* feat: handle CF forwarded IP header in rate limit, whitelist and access logger

* feat: add individual config toggles for forwarded headers

* feat: enhance IP address retrieval to include forwarded IP for access logging

* chore: clean-up diff

* fix: don't consume points for missing credentials

* feat: log rate limited method and URL

Co-authored-by: Copilot <copilot@github.com>

* feat: make rate limiter points configurable

Co-authored-by: Copilot <copilot@github.com>

* feat: implement retry-after header for rate limiting responses

Co-authored-by: Copilot <copilot@github.com>

---------

Co-authored-by: Copilot <copilot@github.com>
2026-05-01 00:09:24 +03:00
DeathStalker471andCohee 4ca9863f38 feat: add nanogpt provider selection (#5544)
* add nanogpt provider selection

* update payg text

* fix: resync providers from endpoint

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-30 23:55:42 +03:00
Leandro Jofré 3a9c10d680 Feat - Add expression-set-fallback slash command (#5551)
* Feat - Add expression-set-fallback slash command

* Fix ESLint

* Fix - Use proper name convention for slash command method

* Fix - Change misleading expression-set-fallback help string label

* Fix - Use normal description for expression label argument

* Update - Make expression-set-fallback case unsensitive
Also fixed array creation by removing the spread syntax and added warning.
2026-04-30 23:41:04 +03:00
Reithan 338e35fc8a Fix json schema use for openAI compat CUSTOM endpoints in several use paths (#5561)
* pass jsonSchema options through sendStreamingRequest in Generate

* translate json_schema to response_format for CUSTOM chat completion source

* pass jsonSchema through generateGroupWrapper params in group chat generation
2026-04-30 23:38:01 +03:00
CoheeandCopilot 5512473b29 Extension management improvements (#5552)
* feat: enhance asset management with extension categories

Co-authored-by: Copilot <copilot@github.com>

* fix: enhance extension name validation in server endpoints

* feat: display extension author in the extensions list

* fix: unify server error response format

Co-authored-by: Copilot <copilot@github.com>

* feat: add splash on installing third-party for the first time

* fix: add URL format validation, unify validation error messages

Co-authored-by: Copilot <copilot@github.com>

* fix: apply object freeze to EMPTY_AUTHOR value

Co-authored-by: Copilot <copilot@github.com>

* fix: typecheck extensionName in API requests

Co-authored-by: Copilot <copilot@github.com>

* feat: add feature flag guard to extensions endpoints

Co-authored-by: Copilot <copilot@github.com>

* fix: parse URL before checking

Co-authored-by: Copilot <copilot@github.com>

* fix: use case insensitive regex check

* fix: make debug log more useful

Co-authored-by: Copilot <copilot@github.com>

* fix: add pre-validation of URL format and protocol

Co-authored-by: Copilot <copilot@github.com>

* fix: leaner installation success toast

* fix: settings data loss when extensions are disabled

* fix: don't try to auto-focus elements that don't exist

Co-authored-by: Copilot <copilot@github.com>

* fix: set Popup.defaultResult to negative

Co-authored-by: Copilot <copilot@github.com>

* revert: restore undefined default result

---------

Co-authored-by: Copilot <copilot@github.com>
2026-04-30 23:31:50 +03:00
Cohee 45f2951854 fix: temperature -> maxTemperature (#5554) 2026-04-29 03:26:27 +03:00
.:bubfix:. 44f433d10b Minor adjustments to the SVG icons. (#5546)
- Created an SVG version of the SillyTavern logo
- The modified images are 4 times smaller (-43.7 KiB), with no visible loss in quality
2026-04-29 01:34:52 +03:00
Cohee 08e1ce8ec5 Merge pull request #5549 from SillyTavern/release
Backmerge release into staging
2026-04-28 19:16:00 +03:00
Cohee aa50edcf45 fix: update backup archive to ignore migration secrets files (#5548) 2026-04-28 19:14:54 +03:00
CoheeandCopilot Autofix powered by AI 2e4ca3dabf fix: improve sanitation of toasts that bypass HTML escaping (#5540)
* fix: improve sanitation of toasts that bypass HTML escaping

* fix: replace absolute lib.js import with relative

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-28 01:00:31 +03:00
.:bubfix:. bd9479fef8 Better SVG for Kobold/KoboldCpp (#5543)
- 23 times smaller than the original.
- This time with genuine transparency.
2026-04-28 00:18:47 +03:00
crsp6447 940b3722cf Fix: Prevent crash in cachingAtDepthForOpenRouterClaude on empty content from trailing tool calls (#5541)
* Prevent crash in cachingAtDepthForOpenRouterClaude when message has no text

* Apply optional chaining suggestion
2026-04-27 23:53:14 +03:00
338119ab77 Implement private IP range request host validator (#5497)
* feat: implement private IP range request host validator for server-side HTTP requests

* feat: add link-local address support

* fix: use correct config keys

* fix: if config missing use default loopback addresses

* fix: re-use resolved address for connection

* test: add unit coverage for private request filter and proxy interaction

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/1813593e-2263-45e2-aa53-74d39515f1df

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

* test: remove request-proxy.test.js

* perf: cache resolved matches

* fix: remove unused import

* fix: use proper ipv4 loopback cidr

* fix: correct raiseError comment

* test: uses tls.connect for secure endpoints

* Implement private IP range request host validator

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/e76ba122-136e-43ad-b4bc-ea48a01fcdda

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

* Revert "Implement private IP range request host validator"

This reverts commit 14e2714702.

* fix: close request without sending status in CORS forwarding when headers were sent

* fix: not enabled -> disabled

* feat: add enableKeepAlive option to PrivateRequestAgent

Co-authored-by: Copilot <copilot@github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
2026-04-27 01:51:18 +03:00
WolfsblvtandCohee 1bb2a5ea19 Fix missing filename sanitization on V2 JSON character import + harden getPngName as safety nee (#5538)
* fix: sanitize character filenames on V2 JSON import and harden getPngName

- Add missing sanitize() call in importFromJson V2 spec branch to match all other import paths
- Sanitize data.name before readFromV2() so the name field sync happens automatically
- Add sanitize() as defense-in-depth inside getPngName() to catch future oversights
- Refactor getPngName() to use getUniqueName() utility for consistent name generation

* fix: sanitize data.name before readFromV2 in importFromPng and importFromCharX

Same bug as importFromJson: readFromV2() overwrites the top-level name
with the unsanitized data.name, undoing any prior sanitize() call.
Fix by sanitizing data.name before readFromV2 so the sync preserves it.

* fix: sanitize top-level name field in JSON and CharX import paths

* fix: incorrect path rejection in isPathUnderParent

* fix: increase maxTries in getPngName

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-27 01:13:19 +03:00
DeathStalker471andCohee 7201d87f2e feat: Add NanoGPT credit stats UI (#5537)
* Add NanoGPT credit stats UI

* fix lint

* fix: type check

* fix: migrate inline styles to css

* feat: add sub active date display

* feat: add link to balance page

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-27 00:13:06 +03:00
d327412e29 Chat Completion: common model sorting and grouping settings, improved NanoGPT model list (#5536)
* Improve NanoGPT Model List

* Update token multiplier condition to !== 1 to support showing discounts

* Add Model Sorting

* rework sorting to be more compact

* feat: combine CC model sorting/grouping settings

Co-authored-by: Copilot <copilot@github.com>

* fix: adjust migration logic

Co-authored-by: Copilot <copilot@github.com>

* feat: implement grouping for Chutes

* fix: apply review suggestions

* fix: call reconnect instead of direct status check

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
2026-04-26 23:25:56 +03:00
CoheeandCopilot 97dba399e4 Implement S256 challenge in OpenRouter OAuth flow (#5501)
* feat: implement S256 challenge in OpenRouter OAuth flow

* fix: add error handling for missing OpenRouter authorization code

* fix: save verifier to accountStorage

Co-authored-by: Copilot <copilot@github.com>

* fix: comment on getVerifierKey

---------

Co-authored-by: Copilot <copilot@github.com>
2026-04-26 22:32:53 +03:00
Cohee 25fb4ceb50 fix: remove legacy filter state restoration (#5535) 2026-04-26 21:06:54 +03:00
Cohee c249e5384c feat: pass koboldcpp reasoning effort (#5491)
Fixes #5489
2026-04-26 00:02:07 +03:00
CoheeandCopilot 09d72828cb feat: add gemma 4 for AI studio (#5493)
* feat: add gemma 4 for AI studio

* fix: update max context return value for gemma-3n-e4b-it model

* refactor: iterate array of [regex, number]

* gemma4: enable tool calling and sysprompt

Co-authored-by: Copilot <copilot@github.com>

---------

Co-authored-by: Copilot <copilot@github.com>
2026-04-25 22:22:55 +03:00
CoheeandCopilot 09bb7622ed OpenAI: Add gpt-5.5, gpt-5.4-mini/nano, gpt-image-2 (#5529)
* feat: gpt-image-2 for OpenAI image generation

* gpt-5.5

Co-authored-by: Copilot <copilot@github.com>

* fix: adjust reasoning effort mapping

Co-authored-by: Copilot <copilot@github.com>

* fix: html format

---------

Co-authored-by: Copilot <copilot@github.com>
2026-04-25 21:46:52 +03:00
CopilotandCohee1207 7948886c1d Add Tool Call Recurse Limit slider to Chat Completion settings (#5518)
* feat: add Tool Call Recurse Limit slider to Chat/Message Handling settings

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/ecbde89f-8f4d-4e91-9189-a998d12ca76b

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

* feat: move tool call recurse limit to openai_settings under Chat Completion settings

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/132e4c28-9564-47cd-92c1-e8ab50d88905

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

* refactor: use CSS :has() selector instead of JS toggle for tool_call_recurse_limit_block visibility

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/c562deb5-05ce-4ebf-84a0-9eeea9d24433

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

* fix: wrap tool_call_recurse_limit_block in range-block for correct layout

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/4d25a367-ac12-4e54-83b0-1543eb6f370a

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

* fix: data-i18n attribute

---------

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-25 21:05:39 +03:00
feg 0a493cad89 add macro support for image caption extension prompt (multimodal) (#5527)
* added macro processing to caption ext

added
`prompt = substituteParamsExtended(prompt);`
to the captionmultimodal function
(so it can use macros and stuff)

* caption ext updated from old substituteparams

* removed comment
2026-04-25 20:14:45 +03:00
Christoph 29e3136473 fix: Don't apply layout hack in Firefox Mobile while editing text (#5531)
This fixes the following bug in Firefox Mobile on Android:

**Steps to reproduce:**

1. Swipe a word into the chat input edit field in Firefox Mobile on Android, for examples "Test".
2. In GBoard (default Android keyboard), tap on a different suggestion, for examples "Rest".

**Expected behavior:** The word "Test" is replaced with "Rest".

**Actual behavior:** The word becomes "TestRest".

I confirmed with bisecting that the commit f897a4ab1a introduced the issue.

This change fixes the issue by disabling the layout hack while editing text.
Disabling the layout hack is limited to Firefox Mobile because

* I could not reproduce the bug in Chrome on Android
* This way, if it causes a new bug, only Firefox Mobile users are affected
2026-04-25 19:56:52 +03:00
DeathStalker471andCohee b1ef254f78 fix: disable HTTP keepAlive (Node 18 behavior) with a config toggle (#5519)
* implement disable keepalive, handle request-proxy and config logic

* Invert keep-alive boolean setting

* fix: clean-up server.js diff

* fix: boolean flag type

* feat: disable keep-alive by default

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-24 22:53:35 +03:00
77cbcd8774 feat: add DeepSeek V4 model support with thinking mode and reasoning effort (#5522)
* fix: align DeepSeek provider with V4 API

* Fix DeepSeek beta routing for standard chat completions

* feat: add DeepSeek V4 model support with thinking mode and reasoning effort

* Address DeepSeek review feedback

* Set DeepSeek default model to v4 flash

* fix: clean-up deprecated models, add migration

* fix: move reasoning effort mapping to resolveReasoningEffort

* fix: lint empty line

* fix: remove duplicate code

* fix: add coder model to migration logic

---------

Co-authored-by: dclef <drclef233@gmail.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-24 21:47:30 +03:00
aecbb9a2ee feat: add MiniMax as a chat completion provider (#5452)
* feat: add MiniMax as a chat completion provider

Add MiniMax (https://www.minimax.io) as a first-class chat completion
provider. MiniMax already has TTS integration in SillyTavern; this
extends support to LLM chat completions via their OpenAI-compatible API.

Supported models:
- MiniMax-M2.5 (default) — 204K context
- MiniMax-M2.5-highspeed — same capability, faster inference

Key implementation details:
- Reuses existing SECRET_KEYS.MINIMAX (shared with TTS)
- API endpoint: https://api.minimax.io/v1
- Temperature clamped to (0.0, 1.0] as required by MiniMax API
- Returns hardcoded model list since MiniMax doesn't expose /v1/models
- Full UI integration: model selector, sampler parameters, streaming

Co-Authored-By: octo-patch <octo-patch@users.noreply.github.com>

* feat: upgrade MiniMax default model to M2.7

- Add MiniMax-M2.7 and MiniMax-M2.7-highspeed to model list
- Set MiniMax-M2.7 as default model
- Keep all previous models as alternatives

* feat: independent request function, vision support, temp clamping for MiniMax

- Extract sendMinimaxRequest() following Chutes pattern (PR #4844)
  with function calling and JSON Schema structured output support
- Clamp temperature to (0.01, 1.0] on backend; limit frontend UI max to 1.0
- Enable image inlining for MiniMax M2.7 model
- Add MiniMax to slash-commands model selector and tokenizer mapping
- Add minimax_model to default preset

* feat: add VLM-based vision support for MiniMax M2.7

M2.7 does not natively accept image input. When images are detected
in messages, pre-process them via the MiniMax VLM endpoint
(/v1/coding_plan/vlm) to convert images to text descriptions before
sending to the chat completions API. Uses the same API key.

* feat: add M2-her model to MiniMax provider

M2-her is MiniMax's dialogue/roleplay-optimized model with 64K context
and 2048 max completion tokens. Text-only (no vision).

* feat: add MiniMax China endpoint (minimaxi.com) support

Add endpoint selector (Global/China) for MiniMax, mirroring the
SiliconFlow pattern. Users can now choose between api.minimax.io
(international) and api.minimaxi.com (China domestic).

* fix: merge consecutive same-role messages for MiniMax

MiniMax API rejects consecutive messages with the same role with
error 'invalid chat setting (2013)'. Merge them before sending.

* review: address PR feedback on MiniMax provider

Backend (src/endpoints/backends/chat-completions.js):
- Drop the entire MiniMax VLM image-preprocessing path; vision is no
  longer advertised for this provider, so M2.7 messages now go straight
  to /chat/completions without a separate VLM round-trip.
- Drop the json_schema -> response_format mapping (MiniMax does not
  document structured-output support; relying on it was speculative).
- Drop the backend temperature clamp; the same clamp now lives in the
  frontend so the wire payload matches what the user sees.
- Drop the MINIMAX branch in /status that returned a hard-coded model
  list; the frontend hardcodes the same list and bypasses /status via
  noValidateSources, so the round-trip was wasted.
- Add a streaming Transform + non-streaming helper that move
  <think>...</think> blocks from delta.content / message.content to
  reasoning_content. MiniMax M2.x emit chain-of-thought inline in
  content; without this transform the raw <think> tags leak into the
  rendered chat. Includes a state machine that holds back partial
  marker bytes so a marker split across SSE chunks is still detected.

Frontend:
- public/scripts/openai.js: add MINIMAX to noValidateSources so the key
  is accepted without a /models call; remove the dead saveModelList
  branch; clamp temperature to (0.0, 1.0] in createGenerationParameters.
- public/scripts/reasoning.js: add MINIMAX to the non-streaming
  reasoning_content extraction case (the backend transform now produces
  this field for MiniMax responses).
- public/scripts/slash-commands.js: add MINIMAX to the /api enum and
  add a MiniMax case to /api-url so users can switch endpoint by
  command.
- public/scripts/custom-request.js: pass minimax_endpoint through the
  override-payload merge alongside the other per-source endpoint fields.
- public/scripts/tokenizers.js: stop returning openai_model (which was
  always a MiniMax model id and thus an unknown tokenizer); fall back
  to gpt-3.5-turbo for a coarse but functional estimate.
- public/scripts/tool-calling.js: add MINIMAX to supportedSources so
  function-calling settings are exposed.
- public/index.html: drop the "-- Connect to the API --" placeholder
  option from the model select (the model list is hardcoded and always
  populated); remove minimax from the vision data-source attributes
  on the inline-media controls.
- public/img/minimax.svg: replace the multicolor brand SVG with a
  single-color currentColor version that matches the other provider
  icons in the connect panel.

* review: drop backend <think> parsing, defer to frontend

Per reviewer feedback: SillyTavern's reasoningHandler / reasoning_auto_parse
setting already extracts <think>...</think> blocks on the client side, so the
backend doesn't need to rewrite MiniMax responses. Removes the SSE Transform,
the non-streaming helper, and the corresponding case in reasoning.js.

* fix: remove isImageInliningSupported declaration for MINIMAX

* fix: remove MINIMAX from stream reasoning parsing

* fix: add to autoconnect logic

* fix: add missing MINIMAX models from docs

* fix: freq. and pres. pen aren't supported for MINIMAX

* fix: use clamp function for adjusting temperature

* fix: pass minimax_endpoint from connection profile to ChatCompletionService

* fix: update supported APIs in slash command documentation

* fix: replace bespoke merge with standard MERGE_TOOLS processing

* fix: add data-i18n attributes for headers

---------

Co-authored-by: octo-patch <octo-patch@users.noreply.github.com>
Co-authored-by: octo-patch <octo-patch@github.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-24 00:43:05 +03:00
StagnatingandCohee a028bec87b Display OpenRouter credit balance in UI (#5513)
* Display OpenRouter credit balance in UI

Adds a "View Remaining Credits" click handler that fetches the
current balance from the OpenRouter /credits endpoint via a new
server-side /api/openrouter/credits route, and renders it next
to the link. The anchor still points at openrouter.ai/account
so middle-click / right-click "open in new tab" keeps working.

* Return 500 on OpenRouter credits failure

* Reduce to two decimals

* Update view credits URL

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-23 23:21:28 +03:00
柚柚子 752ae243b9 Fix KoboldCpp vector hash deletion (#5508) 2026-04-23 23:03:59 +03:00
Theros efbff34342 feat: add getWorldInfoNames() to getContext() for WorldInfo enumeration. (#5505) 2026-04-23 11:24:10 +03:00
cloak1505 6d2165149b Sync OpenRouter providers list (#5503) 2026-04-22 22:04:15 +03:00
柚柚子 ff31ca6692 feat: add Adaptive-P controls for oobabooga (#5502)
* feat: add ooba adaptive-p controls

* fix: align ooba adaptive-p sampler order
2026-04-22 21:34:52 +03:00
4df18ccb0b Add Slug Parameter to Action Loader for Programmatic Identification (#5490)
* feat: add slug parameter to action-loader for programmatic identification

Add optional `slug` parameter to ActionLoaderHandle for easier identification via code or CSS. Update all loader.show() calls across the codebase to include descriptive slugs ('app-init', 'chat-rename', 'chat-delete', 'bulk-delete', 'chat-load', 'image-generation', 'legacy-loader'). Add data attributes (data-slug, data-loader-id, data-blocking) to toast content div. Expose slug via getter and make id private with getter.

* Apply suggestions from code review

Fix slug jsdoc wording

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix: Add identifier to second loader in img gen

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-20 22:29:40 +03:00
TanJeeSchuanandCohee 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
Wolfsblvt 8aeda4a101 Add Persona CRUD Slash Commands with Shared Avatar Utilities (#5466)
* Add persona CRUD slash commands with enhanced utilities

- Add `/persona-create`, `/persona-update`, `/persona-delete`, `/persona-duplicate`, and `/persona-get` slash commands for programmatic persona management
- Move `persona_description_positions` enum from power-user.js to personas.js for better encapsulation
- Add position and role parsing utilities (`parsePersonaPosition`, `parsePersonaRole`) with name-to-value mapping
- Extend `initPersona()` to accept optional position, depth, role, and lorebook parameters
- Refactor `deleteUserAvatar()` to delegate to new `deletePersona

* Add NaN validation for descriptionDepth parameter in createPersonaCallback

- Add isNaN() check for depth parameter after Number() conversion
- Display warning toast when invalid depth value is provided
- Fall back to DEFAULT_DEPTH when depth is NaN
- Change depth from const to let to allow reassignment after validation

* Refactor persona lookup to support avatar key targeting and fix enum provider currying

- Refactor `autoSelectPersona()` to accept optional `personaKey` parameter for targeting specific persona when multiple share the same name
- Replace manual persona lookup loops with `findPersona()` helper calls in `autoSelectPersona()` and `setNameCallback()`
- Update `setNameCallback()` to pass both persona name and avatar key to `autoSelectPersona()` for precise targeting
- Refactor `commonEnumProviders.personas()`
2026-04-20 02:26:08 +03:00
Wolfsblvt 15a3e3f072 feat: add click-to-edit support for reasoning blocks and auto-focus reasoning textarea (#5487)
Extend click-to-edit functionality to reasoning blocks in addition to message text. When clicking on a reasoning block, automatically focus the reasoning textarea after entering edit mode.
2026-04-20 02:11:42 +03:00
WolfsblvtandCohee 53f251c52a Fix: Prevent "Show More Messages" Button from Triggering Message Edit Mode (#5486)
* fix: prevent event bubbling on show more messages button

Replace mouseup/touchend with click event and add stopPropagation/preventDefault to prevent unintended event bubbling when loading more messages.

* Add hover style to "show more messages"

* add button role to show_more_messages

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-20 01:44:33 +03:00
WolfsblvtandCohee d8b3d36a84 Refactor: Replace SD image generation indicator with ActionLoader system (#5472)
* refactor: replace custom generation indicator with action-loader

Remove custom generation tracking (activeGenerations counter, generationToast) and replace with action-loader's non-blocking stoppable toast. Import loader from action-loader.js and use loader.show() with onStop callback in generatePicture() and generateMediaSwipe(). Remove updateGenerationIndicator(), startGenerationTracking(), and endGenerationTracking() functions. Remove manual stop button show/hide logic and generation counter updates

* Remove legacy stop button, add sentinel handler value

* fix: reassign loaderHandle in generateMediaSwipe

* feat: add data attributes to action-loader toast for easier selection

Add loaderId, title, and blocking data attributes to toast content div to enable programmatic identification and filtering of active loader toasts

* Revert "feat: add data attributes to action-loader toast for easier selection"

This reverts commit e8da27b4c9.

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-20 01:10:20 +03:00
Cohee b8f2b1cfa6 fix: enhance URL validation for Z.AI image generation (#5482)
* fix: enhance URL validation for Z.AI image generation and handle potential delays
Fixes #5480

* fix: retry 404 in a loop

* fix: handle Z.AI image and video unavailability with appropriate warnings and responses
2026-04-20 00:28:55 +03:00
Cohee b44b12b527 Add 'pm-render' command to refresh prompt manager content (#5483) 2026-04-20 00:07:25 +03:00
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>
2026-04-20 00:06:28 +03:00
b436971a09 fix: correct typo in cacheScores debug log and add JSDoc to filterDataByState (#5468)
* fix: limit max-height of select[multiple] on mobile to prevent Chrome 145+ full-screen rendering (fixes #5242)

* fix: correct typo in cacheScores debug log and add JSDoc to filterDataByState (fixes #5252)

* fix: Correct jsdoc syntax

---------

Co-authored-by: octo-patch <octo-patch@github.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-19 22:04:45 +03:00
Octopusandocto-patch a678299700 fix: limit max-height of select[multiple] on mobile to prevent Chrome 145+ full-screen rendering (fixes #5242) (#5467)
Co-authored-by: octo-patch <octo-patch@github.com>
2026-04-19 21:54:10 +03:00
Wolfsblvt 552936a0d8 fix: exclude other group members' reasoning from prompt context in group chats (#5473)
In group chats, only include reasoning from the currently generating character instead of all group members. This prevents reasoning from other characters being injected into the prompt context when generating responses.

- Filter reasoning in coreChat loop based on message author matching name2
- Filter reasoning in setOpenAIMessages based on message author matching name2
- Add isOtherGroupMember check before adding reasoning to messages
2026-04-19 16:08:52 +03:00
ashishch432 d1e719eb48 add claude-opus-4-7 (#5465) 2026-04-19 15:47:40 +03:00
Wolfsblvt 4003251c2f Increase Top K max value from 200 to 500 for text generation WebUI (#5474)
Raises the maximum allowed Top K sampling parameter from 200 to 500 in both the range slider and number input controls to support higher token selection limits.
2026-04-19 15:20:06 +03:00
awaaeandCohee 767746beb2 WI: Rename "New" button to "Create"
* Fix internationalization issues

* fix(i18n): update world creation key and zh-cn translations

Changes the i18n key for the world editor's "New" button to "Create" to
avoid conflict with listing filters. Updates the Chinese translation
for the "New" key to "最新" (Latest).

* fix(i18n): correct translation key for world creation button

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-16 21:12:58 +03:00
EnerccioandPeter Vanusanik 277285d30c implemented emit events for itemized-prompts.js (#5461)
* implemented emit events for itemized-prompts.js

* removed redundant ITEMIZED_PROMPTS_DELETED_ALL event and updated emit logic accordingly

---------

Co-authored-by: Peter Vanusanik <pvan@bach.cz>
2026-04-16 21:10:19 +03:00
WolfsblvtandCohee 0ac31c8fcd Enhanced /persona-sync Command with Range, Name Filter, and Quiet Mode (#5460)
* Add range and silent parameters to /persona-sync command with optional confirmation suppression

- Add optional start/end range parameters to syncUserNameToPersona() function
- Add silent parameter to suppress confirmation popup when needed
- Update /persona-sync slash command to accept range argument (index or range string) and named silent argument
- Parse range using stringToRange() utility, default to full chat if not provided
- Update confirmation message to reflect whether syncing all messages or specified

* Add `from` named argument to /persona-sync command for filtering by persona name

- Add `from` named argument to filter messages by persona name (case-insensitive)
- Rename `silent` argument to `quiet` with inverted default (true) for consistency
- Add userMessageNamesEnumProvider() to provide autocomplete for existing user message names in chat
- Update syncUserNameToPersona() to accept nameFilter parameter and filter messages accordingly
- Update confirmation message to reflect name filtering when

* Add async/await wrapper to sync_name_button click handler for proper promise handling

Function now has arguments, so using just the function as the event is shown as wrong usage

* Post-merge imports fix

* Use canonical command name in examples

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-15 23:41:10 +03:00
Cohee 3f72d3df80 Improve OpenRouter model lists in extensions (#5459)
* fix: extensions OpenRouter model lists

* fix: update JSDoc for optional mapping function parameter in fetchModelsByModality

* fix: update JSDoc to clarify return type of fetchModelsByModality function

* fix: encode output modality in fetchModelsByModality API request
2026-04-15 23:18:26 +03:00
Reithan 051346c517 Enable interleaved tool reasoning for custom OpenAI-compat endpoints (#5445)
* enable interleaved tool reasoning for custom OpenAI-compat endpoints

Add chat_completion_sources.CUSTOM to interleaved_reasoning_providers so
that local OpenAI-compatible endpoints (e.g. KoboldCPP in Chat Completions
mode) can forward reasoning context in tool-call chains when the user has
configured Interleaved Thinking.

Also expose the Interleaved Thinking UI control for the Custom source so
users can actually opt in — previously the dropdown was hidden behind a
data-source="openrouter" guard.

The custom streaming path already correctly accumulates delta.reasoning_content
from streaming chunks; this change only removes the provider gate that was
silently discarding that data before it reached the API payload.

* don't override invocation reasoning with prior-turn assistant reasoning

When an invocation already has its own reasoning captured at execution
time, preserve it instead of replacing it with previousAssistantReasoning
from the backward scan. The override was correct when invocations never
carried their own reasoning, but now that the custom/openrouter paths
capture per-invocation reasoning, the unconditional replacement caused
all tool calls in a chain to receive the same stale reasoning from an
earlier unrelated assistant turn.

Fall back to previousAssistantReasoning only when clone.reasoning is empty.
2026-04-15 23:16:39 +03:00
CasualAutopsy af7bd65f42 Impersonate with last_input_sequence (#5456) 2026-04-15 22:43:41 +03:00
CopilotandCohee1207 78628f7dbb Integrate Cloudflare Workers AI text-to-image into SD extension (#5434)
* feat: integrate Cloudflare Workers AI for text-to-image generation in SD extension

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/efc79e4d-2119-4cdb-8afb-f26e318a38ef

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

* fix: address review - use oai_settings for account ID, sort dropdown alphabetically, remove Account ID input, move debug log

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/bf0dda38-df40-44f4-8a63-0c952b48905d

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

* Clean-up diffs

* feat: add refresh models button to Workers AI section

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/ab6b5e7a-84d2-44d1-9f6e-3d330de04ef1

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

* fix: revert unrelated package-lock.json changes

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/ab6b5e7a-84d2-44d1-9f6e-3d330de04ef1

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

* Fix models loading

* refactor: update model refresh button ID and add class to select elements

* Send formData to BFL models

* fix: adjust use FormData condition

* fix: validate Workers AI account ID before proceeding with image model 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-04-15 22:00:08 +03:00
WolfsblvtandCohee 64c96e895c Add Streaming Display Utility and New Generation Slash Commands (/genstream, /reasoning-format) (#5438)
* Add StreamingDisplay class for live LLM generation output with floating toast panel

- Add StreamingDisplay class to show streaming reasoning and content in a floating toast panel
- Extract createModelIcon() helper from insertSVGIcon() for reusable API/model icon creation
- StreamingDisplay automatically appends inside topmost open dialog (same pattern as fixToastrForDialogs)
- Add CSS with fade-in animation, pulsating activity indicator, and separate reasoning/content sections
- Support optional model icon in header

* Add ConnectionManagerRequestService.getProfileIcon() method for retrieving profile API icons

- Add static getProfileIcon() method to ConnectionManagerRequestService
- Returns HTMLImageElement created via createModelIcon() for a given profile's API/model
- Accepts optional profileId parameter, defaults to currently selected profile
- Returns null if Connection Manager is disabled, profile not found, or profile has no API
- Import createModelIcon from script.js

* Use animation_duration directly in hide() and CSS transition instead of constant

- Remove ANIMATION_DURATION_MS constant and use animation_duration directly in hide() method
- Replace hardcoded 0.3s CSS transitions with CSS variable var(--animation-duration, 125ms)
- Read animation_duration value inline in hide() for accurate timing

* Add /genstream slash command with live streaming display and reasoning support

- Add /genstream slash command that generates text via Connection Manager with live streaming UI
- Add formatReasoning() helper function (inverse of parseReasoningFromString) to format reasoning/content into template-wrapped strings
- Add connectionProfiles enum provider for profile selection in slash commands
- StreamingDisplay: add delay parameter to hide() method (default 1000ms) to show final result before dismiss

* Add /reasoning-format slash command to format reasoning and content into template-wrapped strings

- Add /reasoning-format (alias: /format-reasoning) slash command that wraps reasoning/content using Reasoning Formatting settings
- Accept required 'reasoning' named argument and optional unnamed 'content' argument
- Validate that prefix/suffix are configured before formatting
- Return formatted string via formatReasoning() helper for use with /reasoning-parse
- Show warning toasts if prefix/suffix missing

* Rename /genstream command to /profile-genstream and move to appropriate module

* Apply messageFormatting to StreamingDisplay reasoning and content text for proper rendering

- Import messageFormatting from script.js
- Replace textContent with innerHTML using messageFormatting() in updateReasoning() and updateText()
- Pass isSystem=true for reasoning, isSystem=false for content to match formatting expectations
- Update css to utilize pre-formatted paragraphs correctly

* Strip auto-added quotes from <q> tags in StreamingDisplay and add 'mes_text' class for consistent chat message formatting

- Add CSS rules to remove browser-default quotes from <q> tags in reasoning and content sections
- Add 'mes_text' class to textContent div to match chat message formatting behavior
- Prevents double quotes when messageFormatting already adds them via <q> tags

* Add minimize/close buttons and complete state to StreamingDisplay with configurable auto-hide

- Add minimize button to collapse/restore content sections while keeping header visible
- Add close button to manually dismiss display (generation continues in background)
- Replace CSS pseudo-element with explicit LED indicator element for better state control
- Add complete() method to mark generation done: changes LED from pulsing orange to solid green
- Add configurable auto-hide delay after completion

* Add stop button to StreamingDisplay with abort support and onStop/onComplete closures for /profile-genstream

- Add stop button to StreamingDisplay when onStop handler is provided
- Add markStopped() method with solid red LED state indicator
- Add AbortController integration to /profile-genstream for request cancellation
- Add onStop and onComplete closure arguments to /profile-genstream command
- Update complete() method signature to use options object with label and delay
- Disable stop button immediately

* Position StreamingDisplay above bottom form block using CSS variable with fallback

- Change bottom positioning from fixed 20px to dynamic calculation
- Use max() to position above --bottomFormBlockSize + 5px or minimum 20px
- Ensures StreamingDisplay doesn't overlap with bottom UI elements

* Rename /profile-genstream arguments for clarity: label→generating, completedLabel→completed, hideDelay→delay

- Rename `label` argument to `generating` to better reflect its purpose as the in-progress state label
- Rename `completedLabel` to `completed` for consistency and brevity
- Rename `hideDelay` to `delay` for simpler naming
- Update all internal references and variable names to match new argument names
- Update argument descriptions and default values accordingly

* Remove variable resolution from /profile-genstream arguments: system, length, and delay

- Remove ARGUMENT_TYPE.VARIABLE_NAME from typeList for system, length, and delay arguments
- Replace resolveVariable() calls with direct argument access for system, length, and delay
- Simplify type checking to use typeof directly on args properties
- Maintain existing default values and validation logic

* Add warning toast and early return when connection profile not found in /profile-genstream

- Display toastr warning when fuzzy search fails to find matching profile
- Return empty string to prevent execution with invalid profile
- Improves user feedback for incorrect profile names or IDs

* Extract buildResultText() helper in /profile-genstream to return partial results when stopped

- Add buildResultText() helper function to centralize result formatting logic
- Return partial generated text when user stops generation instead of empty string
- Reuse buildResultText() for both stopped and completed states
- Maintains consistent reasoning formatting in both cases

* fix lint

* Update documentation to reflect argument name change from hideDelay to delay

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-15 21:38:13 +03:00
CopilotandCohee1207 4d67a6986b fix: missing closing bracket in jQuery selector in setInContextMessages() (#5451)
* Initial plan

* fix: add missing closing bracket in jQuery selector in setInContextMessages()

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/756522d8-8fe8-4c14-bcea-31d520619fb5

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-15 21:21:32 +03:00
WolfsblvtandCohee d72f4b6fcb Emit PERSONA_CREATED event on persona duplication (#5448)
* feat: emit PERSONA_CREATED event when duplicating a persona

Adds PERSONA_CREATED event emission in duplicatePersona() to notify listeners when a persona is duplicated. Includes the new avatarId, name, and duplicatedFromAvatarId in the event payload.

* fix: event data and execution order

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-14 00:19:02 +03:00
WolfsblvtandCohee 737cb95adb Add clean extension lifecycle hook for optional data cleanup (#5449)
* Add 'clean' extension hook support with optional cleanup on delete

- Add hasExtensionHook() helper to check if an extension defines a specific manifest hook
- Add 'clean' hook type to callExtensionHook() JSDoc
- Add clean button to extension UI when 'clean' hook is present
- Add onCleanClick() handler to run clean hook with confirmation
- Add cleanExtension() function to execute clean hook and reload page
- Modify deleteExtension() to optionally run clean hook before deletion
- Show cleanup checkbox on extension delete popup

* fix lint

Remove unused `callGenericPopup` import from extensions.js

* Force save settings before page reload in extension clean and delete operations

Add explicit saveSettings() calls in cleanExtension() and deleteExtension() to prevent race conditions where clean/delete hooks might update settings that get lost during the subsequent page reload.

* Remove admin permission check from extension clean operation

The clean hook is extension-defined and may not require admin privileges. Permission checks should be handled by the extension's clean hook implementation if needed, rather than enforcing a blanket restriction at the UI level.

* fix: show clean button for built-ins

* Update hasExtensionHook to support built-in extensions

* Revert "Update hasExtensionHook to support built-in extensions"

This reverts commit 31be55ea66.

* Revert "fix: show clean button for built-ins"

This reverts commit 5f86fec70c.

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-14 00:18:43 +03:00
ReithanandCohee 1a561f3bb0 KoboldCpp: Allow grammar to keep place during continue (#5444)
* allow grammar to keep place during continue

* lint

* fix: require kai flag for grammar to be set

* fix: don't retain if grammar is empty

* fix: default to undefined if not retain

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-13 20:57:47 +03:00
WolfsblvtandCohee f4f390f325 Fix: Missing signature and toolSignatures fields in ChatCompletionService streaming state (#5439)
* Fix: Add signature and toolSignatures fields to ChatCompletionService streaming state object

* fix: pass images array to getStreamingReply

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-13 20:19:02 +03:00
Wolfsblvt 6a325d2b22 Add disabled property support to all popup input types (#5441)
Adds optional `disabled` boolean property to PopupInputConfiguration JSDoc and implements it across all input types (checkbox, text, textarea, number). When set to true, the input element will be rendered in a disabled state.
2026-04-13 19:39:16 +03:00
Wolfsblvt 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.
2026-04-13 19:27:56 +03:00
WolfsblvtandCohee 7d3d1231a9 Chore: Add persona lifecycle events (PERSONA_CREATED, PERSONA_UPDATED, PERSONA_RENAMED, PERSONA_DELETED) (#5443)
* Add persona lifecycle events (created, updated, renamed, deleted) and emit them throughout persona management functions

* fix: await event emissions

* fix: await event in convertCharacterToPersona

* fix: await PERSONA_UPDATED in callbacks

* fix: delete multiple personas without reloading the chat

* fix: add CHAT_RENAMED event and adjust welcome screen pin update logic

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-13 19:24:38 +03:00
Cohee 24379db88d Gemma 4 reasoning: drop newline there (#5433)
https://github.com/SillyTavern/SillyTavern/commit/9e0ecefd6456c2103fd3b195a7cefebd7e01cf67#r181874666
2026-04-10 21:31:40 +03:00
CopilotandCohee1207 ff10249ab5 Add configurable welcome screen recent chats, fix pin loss on rename, and add popup number input validation (#5436)
* Add configurable recent chats settings and fix pin loss on chat rename

- Add gear icon button to welcome screen header for settings
- Settings popup with Max recent chats (default: 15) and Collapsed recent chats (default: 3) options
- Settings stored in accountStorage as 'recentChatsSettings'
- Add PinnedChatsManager.rename() to migrate pin state when chats are renamed
- Call rename() from both character and group chat rename functions

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/99fa84c4-a82b-4253-96ff-a0621fb63f5c

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

* Fix pin rename: use file_name with .jsonl extension to match stored pin keys

The data-file attribute contains chat_name (without .jsonl), but PinnedChatsManager
stores keys using file_name (with .jsonl). Append .jsonl to both old and new names
when calling PinnedChatsManager.rename() in character and group chat rename functions.

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/c8e4f720-1d0b-49ef-b57b-ba9d85c42d4f

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

* Refactor to support number inputs

* Restore package-lock

* Use clamp() from utils.js instead of manual Math.min/Math.max

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/1669884c-1bd3-4b60-808d-5610f24838e6

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

* Revert unintended package-lock.json changes

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/1669884c-1bd3-4b60-808d-5610f24838e6

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

* Use input values instead of magic numbers

* Add auto-clamping on number inputs in popups and range placeholders in welcome-screen settings

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/9af8ad07-77bc-46db-9ec6-0030fecf0f8d

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

* Use constants for min/max chat limits to avoid hardcoded duplication in tooltips

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/9af8ad07-77bc-46db-9ec6-0030fecf0f8d

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

* Improve input validation by using Number.isFinite for min/max values in Popup class

---------

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-10 21:30:43 +03:00
CopilotandCohee1207 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
WolfsblvtandCohee 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
Wolfsblvt fb915b4321 Add /regex-state slash command to check regex script status (#5428)
* feat: add /regex-state command to check script enabled status

Adds a new slash command that returns 'on' or 'off' to indicate whether a regex script is currently enabled or disabled.

* refactor: change /regex-state return values from 'on'/'off' to 'true'/'false'

Updates the /regex-state slash command to return boolean string values ('true'/'false') instead of ('on'/'off') for better consistency with standard boolean conventions.
2026-04-09 23:27:36 +03:00
Alex DillsandCohee fa9a28c6f3 Fix stable-diffusion.cpp model routing and URL path handling (#5427)
* fix: include model field in sd.cpp SDAPI requests and preserve URL path

The sd.cpp integration overwrites the URL pathname when constructing
requests, which breaks proxy servers like llama-swap that use path-based
routing (e.g. /upstream/model-name). Additionally, the model field was
never included in SDAPI requests, which is required by llama-swap to
route requests to the correct backend.

Changes:
- Server: Append to URL pathname instead of overwriting (same pattern as #5178)
- Server: Pass model field through to sd-server payload
- Client: Add model name text input for sd.cpp source settings
- Client: Send model name in generate request payload

* fix: fetch models from server and populate standard Model dropdown

Instead of a separate text input for the model name, fetch the model
list from the sd.cpp server's /v1/models endpoint and populate the
standard Model dropdown. This provides a seamless experience where
users just pick a model from the dropdown like any other source.

Works with both standalone sd-server and proxy servers like llama-swap
that expose multiple models via the OpenAI-compatible models endpoint.

* fix: don't send clip_skip=1 to sd.cpp, it produces blank images

sd-server generates blank white images when clip_skip is set to 1.
Since clip_skip=1 means 'use all CLIP layers' (the default behavior),
only send the parameter when it's > 1.

* Fix eslint

* Replace string appends with urlJoin

* fix: convert URL strings to URL objects in sdcpp routes

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-09 23:12:21 +03:00
Wolfsblvt ff4c6fa1bb chore: add arguments logging to deprecated MacrosParser method warnings (#5429)
Extends the #logDeprecated helper to accept and log the arguments passed to deprecated methods, providing better debugging context for migration. Updates all deprecated method calls (get, has, registerMacro, unregisterMacro) to forward their arguments to the deprecation logger.
2026-04-09 22:33:54 +03:00
Wolfsblvt 81c85f8049 fix: skip pseudo-elements when generating focus-visible styles (#5430)
Prevents invalid CSS by skipping rules containing `::` (pseudo-elements like `::before`, `::after`, `::-webkit-scrollbar`) when converting `:hover` to `:focus-visible`, as pseudo-elements cannot receive focus.
2026-04-09 22:28:39 +03:00
Wolfsblvt 67eba1b472 fix: treat all English locale variants as supported fallback language (#5431)
Previously only exact 'en' was accepted as fallback when a language wasn't found. Now accepts any English variant (en-US, en-AU, etc.) to prevent spurious warnings for valid English locales.
2026-04-09 22:24:29 +03:00
Wolfsblvt df27574247 Fix: Remove unused ComfyUI RunPod API key input mapping (#5432) 2026-04-09 22:20:34 +03:00
Tony GiesandCohee 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
bumpratandCohee 94a5773412 refactor(tts): remove redundant 4-space codeblock filter (#5406)
* refactor(tts): remove redundant 4-space codeblock filter

- Deleted the regex that removed lines starting with four spaces.
- Original intent was to strip "indented code blocks" (Markdown legacy syntax).
- In practice, SillyTavern already handles explicit code fences (```...``` and ~~~...~~~).
- Indented code blocks are rarely used and the regex caused unnecessary text loss in normal messages.
- Simplifies codeblock skipping logic and avoids accidental removal of valid content.

* Remove commented out code

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-08 22:11:21 +03:00
WolfsblvtandCohee 5e68410d4e Add Entry Preview to World Info Deletion Confirmation Dialog (#5423)
* feat: add entry preview to world info deletion confirmation dialog

Displays entry comment or first two lines of content in the deletion confirmation popup to help users verify they're deleting the correct entry.

* fix: sanitize world info entry preview text in deletion confirmation dialog

Adds DOMPurify sanitization to the entry preview text displayed in the deletion confirmation popup to prevent potential XSS vulnerabilities from unsanitized user content.

* DOMPurify -> escapeHtml

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-08 20:31:00 +03:00
Cohee 5ec635aa40 fix npm audit in src/electron (#5405) 2026-04-06 00:46:27 +03:00
Tony GiesandCohee 700fc05411 feat: add Cloudflare Workers AI provider (#5385)
* feat: add Cloudflare Workers AI provider

Adds support for Cloudflare Workers AI using its OpenAI-compatible API.

Workers AI-specific stuff includes:
- Model list fetching and capabilities detection
- Tokenizer auto-detection for typical hosted model families
- Streaming not supported when using structured output

Closes #5305

* Make the entire header clickable

* Add missing samplers

* Fix non-streaming reasoning parsing

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-06 00:24:47 +03:00
KKTsNandCohee c9c652eece fix: improve streaming error propagation and forwarded response logging (#5317)
* Fix: Improve streaming error handling and forwarded response logging

* Fix: fix ESLint error  Strings must use singlequote  quotes

* fix: preserve and log forwarded stream errors

* chore: narrow forwarded stream error fix scope

* fix: make forwardFetchResponse awaitable and forward upstream error text

* Restore original happy path handling

* Remove redundant checks in forwardFetchResponse function

* Don't send anything on parsing error end

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-05 23:01:47 +03:00
Cohee d96d1451ab Add IP whitelist for SSO authentication headers (#5404)
* feat: add trusted proxies configuration for SSO authentication

* Refactor check to accept IP address directly

* Refactor IP patterns validation

* Unify warning message format
2026-04-05 22:20:39 +03:00
Tony Gies a45ec30cf0 Add tests for Cache, MemoryLimitedMap, and other util.js coverage gaps (#5365) 2026-04-05 21:05:08 +03:00
Tony Gies 8d8e3833f6 Add unit tests for TavernCardValidator (#5366)
* Add unit tests for TavernCardValidator
2026-04-05 21:03:18 +03:00
Tony GiesandCohee 760263b78a Add unit tests for prompt-converters.js (#5364)
* Add unit tests for prompt-converters.js

* fix: add type annotation for prompt-converters module

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-05 20:54:38 +03:00
Tony GiesandCohee 128888f605 Skip TTS for voices explicitly set to disabled (fixes #4970) (#5367)
* Skip TTS for voices explicitly set to disabled (fixes #4970)

* Always show disabled message in commands and fix restoring voice map UI

* Always show a message on manual TTS trigger

* Fix null current job on disabled

* Adjust type annotation

* Force update worker when disabled play is attempted

* Treat audio control queue as manual

* Update TTS message processing to include manual flag

* Don't show toast if was already shown by manual playback

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-05 20:25:26 +03:00
Cohee 8e8f501279 Immutable public and global content management (#5390)
* Use custom init script instead of postinstall

* Revert changes to start scripts in src\electron

* Add global data to content manager

* Add migration for public overrides and user.css location update

* Update npm publish workflow to use 'omit=dev' flag in npm ci commands

* Rename user.css readme file

* Fix indentation in userCssMiddleware function

* Add directory creation for content target

* Restore template compile location

* Move stylesheet up in index.json

* Use path.resolve for user.css file path in userCssMiddleware

* Correct capitalization in "Not Found" error page title and heading

* Remove init run from startup scripts

* Simplify user CSS file path resolution

* Update userCssMiddleware comment
2026-04-05 19:32:28 +03:00
LumiandCohee 9e0ecefd64 Add Gemma 4 instruct, context, and reasoning presets (#5403)
* Add Gemma 4 context preset

* Add new instruction preset for Gemma 4

* Add Gemma 4 reasoning preset

* Add to index.json

* Disable wrapping, fix story string

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-05 19:25:11 +03:00
Cohee 0f4a0147fd Add VSCode settings for TypeScript SDK configuration (#5394)
* Add VSCode settings for TypeScript SDK configuration

* Install typescript as a dev dependency
2026-04-02 23:47:31 +03:00
Cohee 21e8cf9060 glm-5v-turbo (#5393)
* glm-5v-turbo

* Add support for image and video inlining
2026-04-02 20:19:01 +03:00
Cohee e2d8c0200f Use custom init script instead of postinstall (#5384)
* Use custom init script instead of postinstall

* Revert changes to start scripts in src\electron

* feat: add --ignore-scripts flag to npm install commands in batch and shell scripts

* feat: add --ignore-scripts flag to npm ci in Dockerfile
2026-04-01 23:34:00 +03:00
Cohee 04ef0632ee Save chat before emitting event for user message (#5389)
Fixes #5388
2026-04-01 23:19:56 +03:00
Cohee d2b2b1b4a6 fix: require long press to open swipe picker on phones (#5382)
* fix: require long press to open swipe picker on phones

* fix: clarify parameter description in assignLorebookToChat function

* fix: update event parameter type in onSwipeCounterClick to include TouchEvent

* fix: update event parameter types in onSwipeCounterClick and addLongPressEvent
2026-03-31 20:08:56 +03:00
ClaudeandCohee1207 a8021ee6e1 Fix /genraw user instruct format not applied and unwanted system newline (#5372)
* Initial plan

* Fix /genraw user instruct format and system newline bugs

- Fix Bug #1: Change default role for string prompts from 'system' to 'user'
  to ensure user instruct formatting is properly applied
- Fix Bug #2: Remove unconditional newline after system prompt when using
  instruct mode, respecting the actual system instruct format

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/7bfd62eb-2898-468d-9ea9-42d694a394b9

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

* fix: add runtime string type check for substituteParams content

* Add fallback wrap for story string

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
2026-03-31 01:02:31 +03:00
CopilotandCohee1207 63feac9423 feat: swipe picker expand/collapse, copy button, and left-align text (#5380)
* Initial plan

* feat: add expand/collapse, copy button, and left-align text in swipe picker

Addresses user feedback for swipe picker (added in 1.17.0):
1. Left-align swipe text (was inheriting centered alignment)
2. Add expand/collapse toggle using hidden checkbox + CSS :has
3. Add copy-to-clipboard button using shared copyText utility

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/90892f1c-3c75-404b-a93b-2abe672cc0e3

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

* revert unintended package-lock.json changes from npm install

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/90892f1c-3c75-404b-a93b-2abe672cc0e3

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

* fix: address review feedback - hide checkbox, use chevron icons, align buttons with fa-fw

- Fix checkbox visibility by using !important to override input[type=checkbox] grid display
- Change expand icon to fa-chevron-down and collapse to fa-chevron-up
- Add fa-fw class to all action buttons (copy, expand/collapse, branch, delete) for even sizing
- Add align-items: baseline to the actions container

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/c8ca349f-3579-442a-baa1-fc138ba1d7a6

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

* revert unintended package-lock.json changes

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/c8ca349f-3579-442a-baa1-fc138ba1d7a6

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

* fix: update class names for chat action elements in swipe picker

* fix: prevent chevron layout shift and swap button order

- Use single label element as icon (fa-chevron-down) instead of two
  child <i> elements toggling visibility, preventing layout shift
- Override ::before content to chevron-up when expanded via CSS
- Swap chevron and copy button order (chevron first, then copy)

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/284283b1-6c7f-4371-bc4a-94d841513879

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

* style: add comment for FA unicode value in CSS

Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/284283b1-6c7f-4371-bc4a-94d841513879

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

* Rotate the chevron instead of changing content

* Make the ui full height

---------

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-31 00:41:03 +03:00
CopilotandCohee1207 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
XiangzheandCohee b89293418d fix: return Error objects from invokeFunctionTool and create error invocations (#5351)
* fix: return Error objects from invokeFunctionTool and create error invocations

invokeFunctionTool previously called .toString() on caught errors,
converting them to plain strings. This made the instanceof Error
check in invokeFunctionTools dead code.

Changes:
- Return Error objects directly from invokeFunctionTool
- Create error invocations with error: true flag when tools fail
- Record failed stealth tools in stealthCalls
- Preserve signature/reasoning on error invocations
- Add error field to ToolInvocation typedef

* fix: use Error.toString to avoid behavioral changes

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-03-30 23:26:48 +03:00
lunar sheepandCohee ff1ca1412a feat(secrets): update readSecret function to accept optional secret ID (#5356)
* feat(secrets): update readSecret function to accept optional secret ID

* add secret_id to ConnectionManagerRequestService payload

* fix: pass secret_id for Text Completion types

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-03-30 22:30:45 +03:00
Cohee 6bd766f857 CI: Update node to 24, run ci without scripts (#5376) (#5377) 2026-03-30 20:50:24 +03:00
Cohee 004f1336e6 CI: Update node to 24, run ci without scripts (#5376) 2026-03-30 20:49:12 +03:00
Cohee b4c721d7bc Fix npm audit in /tests (#5370) 2026-03-28 19:59:42 +02:00
238 changed files with 15176 additions and 3176 deletions
+1
View File
@@ -70,6 +70,7 @@ module.exports = {
'**/dist/**',
'**/.git/**',
'public/lib/**',
'public/scripts/extensions/third-party/**',
'backups/**',
'data/**',
'cache/**',
+6
View File
@@ -1,5 +1,11 @@
<!-- Put X in the box below to confirm -->
<!--
Adding a new named external provider or service?
Read https://docs.sillytavern.app/for-contributors/provider-integrations/
before implementing or submitting it, and link the prior issue when the guide requires one.
-->
## Checklist:
- [ ] I have read the [Contribution guidelines](https://github.com/SillyTavern/SillyTavern/blob/release/CONTRIBUTING.md).
+2 -1
View File
@@ -26,7 +26,7 @@ SillyTavernは、多くのLLM API(KoboldAI/CPP、Horde、NovelAI、Ooba、Tabb
SillyTavern(略してST)は、テキスト生成LLM、画像生成エンジン、TTS音声モデルと対話するための、ローカルにインストールされるユーザーインターフェースです。
2023年2月にTavernAI 1.2.8のフォークとして始まり、SillyTavernは現在200人以上の貢献者と2年間の独立した開発を経て、知識豊富なAI愛好家のための主要なソフトウェアとして機能し続けています。
2023年2月にTavernAI 1.2.8のフォークとして始まり、SillyTavernは現在300人以上の貢献者と3年間の独立した開発を経て、知識豊富なAI愛好家のための主要なソフトウェアとして機能し続けています。
## 私たちのビジョン
@@ -79,6 +79,7 @@ SillyTavern(略してST)は、テキスト生成LLM、画像生成エンジ
* CncAnonのTavernAITurbo modの一部を許可を得て使用
* PepperTacoの作品に触発されたビジュアルノベルモード (<https://github.com/peppertaco/Tavern/>)
* GoogleによるNoto Sansフォント (OFLライセンス)
* Chevrotainによるレキサー/パーサー (Apache-2.0ライセンス) <https://github.com/chevrotain/chevrotain>
* Font Awesomeによるアイコンテーマ <https://fontawesome.com> (アイコン: CC BY 4.0, フォント: SIL OFL 1.1, コード: MITライセンス)
* @OtisAlejandroによるデフォルトコンテンツ(Seraphinaキャラクターと伝承本)と@kallmefloccによる10K Discordユーザー記念背景
* [@mrguymiah](https://github.com/mrguymiah)と[@Bronya-Rand](https://github.com/Bronya-Rand)によるDockerガイド
+2 -1
View File
@@ -26,7 +26,7 @@ SillyTavern 为众多 LLM API(KoboldAI/CPP、Horde、NovelAI、Ooba、Tabby、
SillyTavern(简称 ST)是一个本地安装的用户界面,允许您与文本生成 LLM、图像生成引擎和 TTS 语音模型进行交互。
SillyTavern 于 2023 年 2 月作为 TavernAI 1.2.8 的一个分支开始,如今已拥有超过 200 名贡献者和 2 年的独立开发经验,并继续作为资深 AI 爱好者领先的软件。
SillyTavern 于 2023 年 2 月作为 TavernAI 1.2.8 的一个分支开始,如今已拥有超过 300 名贡献者和 3 年的独立开发经验,并继续作为资深 AI 爱好者领先的软件。
## 我们的愿景
@@ -79,6 +79,7 @@ SillyTavern 于 2023 年 2 月作为 TavernAI 1.2.8 的一个分支开始,如
* CncAnon 的 TavernAITurbo mod 的部分内容经许可使用
* 视觉小说模式的灵感来自 PepperTaco 的工作 (<https://github.com/peppertaco/Tavern/>)
* Noto Sans 字体 by Google (OFL 许可证)
* Lexer/Parser 由 Chevrotain 提供 (Apache-2.0 许可证) <https://github.com/chevrotain/chevrotain>
* 图标主题 by Font Awesome <https://fontawesome.com> (图标: CC BY 4.0, 字体: SIL OFL 1.1, 代码: MIT 许可证)
* 默认内容由 @OtisAlejandro (Seraphina 角色和世界书) 和 @kallmeflocc (10K Discord 用户庆祝背景) 提供
* Docker 指南由 [@mrguymiah](https://github.com/mrguymiah) 和 [@Bronya-Rand](https://github.com/Bronya-Rand) 提供
+3 -2
View File
@@ -26,7 +26,7 @@ SillyTavern 提供一個統一的前端介面,整合多種大型語言模型
SillyTavern(簡稱 ST)是一款本地安裝的使用者介面,讓您能與大型語言模型(LLM)、影像生成引擎以及語音合成模型互動的前端。
SillyTavern 起源於 2023 年 2 月,作為 TavernAI 1.2.8 的分支版本發展至今。目前已有超過 200 位貢獻者,並擁有超過兩年的獨立開發歷史。如今,它已成為 AI 愛好者中備受推崇的軟體之一。
SillyTavern 起源於 2023 年 2 月,作為 TavernAI 1.2.8 的分支版本發展至今。目前已有超過 300 位貢獻者,並擁有超過三年的獨立開發歷史。如今,它已成為 AI 愛好者中備受推崇的軟體之一。
## 我們的願景
@@ -42,7 +42,7 @@ SillyTavern 的硬體需求相當低。任何能夠運行 NodeJS 20 或更高版
### 歡迎加入我們的 Discord 伺服器
| [![][discord-shield-badge]][discord-link] | [加入我們的 Disocrd 伺服器](https://discord.gg/sillytavern) 以獲得技術支援、分享您喜愛的角色與提示詞。 |
| [![][discord-shield-badge]][discord-link] | [加入我們的 Discord 伺服器](https://discord.gg/sillytavern) 以獲得技術支援、分享您喜愛的角色與提示詞。 |
| :---------------------------------------- | :----------------------------------------------------------------------------------------------------------------- |
或直接聯繫開發者:
@@ -79,6 +79,7 @@ SillyTavern 的硬體需求相當低。任何能夠運行 NodeJS 20 或更高版
* 經授權使用部分來自 CncAnon 的 TavernAITurbo 模組
* 視覺小說模式(Visual Novel Mode)的靈感,來源於 PepperTaco 的貢獻(<https://github.com/peppertaco/Tavern/>)
* Noto Sans 字體由 Google 提供(OFL 許可)
* Lexer/Parser 由 Chevrotain 提供 (Apache-2.0 許可) <https://github.com/chevrotain/chevrotain>
* 主題圖示由 Font Awesome <https://fontawesome.com> 提供(圖示:CC BY 4.0,字體:SIL OFL 1.1,程式碼:MIT 許可)
* 預設資源來源於 @OtisAlejandro(包含角色 Seraphina 與知識書)與 @kallmeflocc(SillyTavern 官方 Discord 伺服器成員突破 10K 的慶祝背景)
* Docker 安裝指南由 [@mrguymiah](https://github.com/mrguymiah) 和 [@Bronya-Rand](https://github.com/Bronya-Rand) 編寫
+2 -2
View File
@@ -29,7 +29,7 @@ Beginning in February 2023 as a fork of TavernAI 1.2.8, SillyTavern now has over
1. We aim to empower users with as much utility and control over their LLM prompts as possible. The steep learning curve is part of the fun!
2. We do not provide any online or hosted services, nor programmatically track any user data.
3. SillyTavern is a passion project brought to you by a dedicated community of LLM enthusiasts, and will always be free and open sourced.
3. SillyTavern is a passion project brought to you by a dedicated community of LLM enthusiasts, and will always be free and open source.
## Do I need a powerful PC to run SillyTavern?
@@ -75,7 +75,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.**
* [TavernAI](https://github.com/TavernAI/TavernAI) 1.2.8 by Humi: MIT License
* [TavernAI](https://github.com/TavernAI/TavernAI-v1) 1.2.8 by Humi: MIT License
* Portions of CncAnon's TavernAITurbo mod used with permission
* Visual Novel Mode inspired by the work of PepperTaco (<https://github.com/peppertaco/Tavern/>)
* Noto Sans font by Google (OFL license)
+21 -4
View File
@@ -1,4 +1,4 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# Publish to npm for a new release or explicitly retry an existing release tag.
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Node.js Package
@@ -6,6 +6,16 @@ name: Node.js Package
on:
release:
types: [created]
workflow_dispatch:
inputs:
tag:
description: Existing release tag to publish
required: true
type: string
env:
PUBLISH_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.event.release.tag_name }}
PUBLISH_REF: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.tag) || github.ref }}
permissions:
id-token: write # Required for OIDC
@@ -16,19 +26,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
ref: ${{ env.PUBLISH_REF }}
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
with:
node-version: 24
- run: npm ci
- name: Verify release tag matches package version
run: test "$(node -p "require('./package.json').version")" = "$PUBLISH_TAG"
- run: npm ci --omit=dev --ignore-scripts
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
ref: ${{ env.PUBLISH_REF }}
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
with:
node-version: 24
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
- run: npm ci --omit=dev --ignore-scripts
# https://github.com/npm/cli/issues/9755
- run: npm publish --allow-directory=all
+5 -5
View File
@@ -34,10 +34,10 @@ jobs:
# https://github.com/marketplace/actions/setup-node-js-environment
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
node-version: 20
node-version: 24
- name: Run npm install
run: npm ci
run: npm ci --ignore-scripts
- name: Run ESLint
# Action ESLint
@@ -72,13 +72,13 @@ jobs:
# https://github.com/marketplace/actions/setup-node-js-environment
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
node-version: 20
node-version: 24
- name: Install root dependencies
run: npm ci
run: npm ci --ignore-scripts
- name: Install test dependencies
run: npm ci --prefix tests
run: npm ci --ignore-scripts --prefix tests
- name: Run unit tests
run: npm run test:unit --prefix tests
+1
View File
@@ -34,6 +34,7 @@ whitelist.txt
.vscode/**
!.vscode/extensions.json
.idea/
.windsurf/
secrets.json
/dist
/backups/
+8
View File
@@ -0,0 +1,8 @@
ignore-scripts=true
min-release-age=7
allow-directory=none
allow-file=none
allow-git=none
# Temporarily disabled due to an npm bug:
# https://github.com/npm/cli/issues/9347
# allow-remote=none
+4
View File
@@ -0,0 +1,4 @@
{
"js/ts.tsdk.promptToUseWorkspaceVersion": true,
"js/ts.tsdk.path": "./node_modules/typescript/lib"
}
+13 -2
View File
@@ -62,6 +62,16 @@ Write at least somewhat meaningful PR descriptions and commit messages. There's
- What did you do to achieve this?
- How would a reviewer test the change?
### Discuss new provider integrations before implementing them
Do not use a completed pull request as the first product discussion for a new named external provider or service.
- Model routers, resellers, rerouters, gateways, and aggregators should use **Custom (OpenAI-compatible)** and publish provider-owned setup instructions. Provider-specific convenience may be implemented as a third-party UI extension or server plugin.
- New first-party model, TTS, speech, web search, image, vectorization, embedding, reranking, and similar integrations are exceptional and should begin with a public issue and maintainer discussion before implementation.
- Existing-provider maintenance and provider-neutral improvements to generic compatibility remain welcome.
Read [Integrating an External Provider](https://docs.sillytavern.app/for-contributors/provider-integrations/) before starting implementation.
### We (likely) don't speak your language
English is the primary language of communication in this project. Please use only English when writing commit messages, PR descriptions, comments and other text. This does not apply to contributions to localization files.
@@ -81,5 +91,6 @@ We do not prohibit nor encourage the use of AI tools for coding assistance to he
## Further reading
1. [How to write UI extensions](https://docs.sillytavern.app/for-contributors/writing-extensions/)
2. [How to write server plugins](https://docs.sillytavern.app/for-contributors/server-plugins)
1. [How to integrate an external provider](https://docs.sillytavern.app/for-contributors/provider-integrations/)
2. [How to write UI extensions](https://docs.sillytavern.app/for-contributors/writing-extensions/)
3. [How to write server plugins](https://docs.sillytavern.app/for-contributors/server-plugins)
+1 -1
View File
@@ -19,7 +19,7 @@ COPY --chown=node:node . ./
RUN \
echo "*** Install npm packages ***" && \
npm ci --no-audit --no-fund --loglevel=error --no-progress --omit=dev && npm cache clean --force
npm ci --no-audit --no-fund --loglevel=error --no-progress --omit=dev --ignore-scripts && npm cache clean --force
# Create config directory and link config.yaml. Added hardcoded dirs(constants.js?)
# that must be present for Non-Root Mode and volumeless docker runs.
+1 -1
View File
@@ -1,7 +1,7 @@
@echo off
pushd %~dp0
set NODE_ENV=production
call npm install --no-save --no-audit --no-fund --loglevel=error --no-progress --omit=dev
call npm install --no-save --no-audit --no-fund --loglevel=error --no-progress --omit=dev --ignore-scripts
node server.js %*
pause
popd
+1 -1
View File
@@ -20,7 +20,7 @@ if %errorlevel% neq 0 (
)
)
set NODE_ENV=production
call npm install --no-save --no-audit --no-fund --loglevel=error --no-progress --omit=dev
call npm install --no-save --no-audit --no-fund --loglevel=error --no-progress --omit=dev --ignore-scripts
node server.js %*
:end
pause
+1 -1
View File
@@ -102,7 +102,7 @@ if %errorlevel% neq 0 (
echo Installing npm packages and starting server
set NODE_ENV=production
call npm install --no-save --no-audit --no-fund --loglevel=error --no-progress --omit=dev
call npm install --no-save --no-audit --no-fund --loglevel=error --no-progress --omit=dev --ignore-scripts
node server.js %*
:end
+50 -3
View File
@@ -41,6 +41,9 @@ port: 8000
# Interval in seconds to write a heartbeat file. Set to 0 to disable.
# This is used primarily for Docker healthchecks.
heartbeatInterval: 0
# Enable HTTP/HTTPS keep-alive globally.
# Disabling restores old Node 18 behavior, can help if ECONNRESET and other network errors occur.
enableKeepAlive: false
# -- SSL options --
ssl:
# Enable SSL/TLS encryption
@@ -55,7 +58,7 @@ ssl:
# -- SECURITY CONFIGURATION --
# Toggle whitelist mode
whitelistMode: true
# Whitelist will also verify IP in X-Forwarded-For / X-Real-IP headers
# When enabled, whitelist will also verify IP in headers enabled in `forwardedHeaders` section.
enableForwardedWhitelist: true
# Whitelist of allowed IP addresses
whitelist:
@@ -127,6 +130,13 @@ sso:
# as that used for authentik. (Ensure the username in authentik
# is an exact match in lowercase with that in sillytavern).
authentikAuth: false
# List of trusted proxy IPs for SSO authentication.
# Supports wildcards or CIDR notation for subnets.
# Example: ['127.0.0.1', '192.168.1.1']
# Set to ['*'] to trust all proxies (NOT RECOMMENDED unless you have other security measures in place)
trustedProxies:
- ::1
- 127.0.0.1
# Host whitelist configuration. Recommended if you're using a listen mode
hostWhitelist:
@@ -141,6 +151,26 @@ hostWhitelist:
# - .trycloudflare.com
hosts: []
# Perform whitelist checks against server-side HTTP requests that resolve to private IP addresses.
# This is an additional layer of security to prevent Server-Side Request Forgery (SSRF) attacks.
# Recommended when listen mode is enabled, or if your server is accessible by untrusted users.
privateAddressWhitelist:
# Enable private address whitelist to block requests to private IP ranges.
enabled: false
# If true, requests to hosts that cannot be resolved will be allowed instead of blocked.
allowUnresolvedHosts: false
# Log blocked and allowed requests to the console.
log:
# Log blocked requests to the console with a warning message
blockedRequests: true
# Log allowed requests to the console with an info message
allowedRequests: false
# List of allowed private IP ranges (in CIDR notation or wildcard format).
# Allows loopback IP ranges by default, but you can customize this list to fit your needs.
allowedRanges:
- '127.0.0.0/8' # Loopback (IPv4)
- '::1/128' # Loopback (IPv6)
# User session timeout *in seconds* (defaults to 24 hours).
## Set to a positive number to expire session after a certain time of inactivity
## Set to 0 to expire session when the browser is closed
@@ -159,9 +189,26 @@ logging:
minLogLevel: 0
# -- RATE LIMITING CONFIGURATION --
rateLimiting:
# Use X-Real-IP header instead of socket IP for rate limiting
# Only enable this if you are using a properly configured reverse proxy (like Nginx/traefik/Caddy)
# Use any of the enabled headers in the `forwardedHeaders` section to identify the client IP for rate limiting.
# If disabled, only the socket IP will be used, which may not work correctly if you are behind a reverse proxy.
preferRealIpHeader: false
# Set the maximum number of allowed failed basic authentication attempts before rate limiting is applied. Set to 0 to disable rate limiting for basic auth.
basicAuthMaxAttempts: 5
# Set the maximum number of allowed failed account login attempts before rate limiting is applied. Set to 0 to disable rate limiting for account logins.
accountsLoginMaxAttempts: 5
# Set the maximum number of allowed failed account recovery attempts before rate limiting is applied. Set to 0 to disable rate limiting for account recovery.
accountsRecoverMaxAttempts: 5
# Set the maximum number of allowed failed account reset attempts before rate limiting is applied. Set to 0 to disable rate limiting for account resets.
accountsResetMaxAttempts: 5
# Set to true to enable support for real IPs in certain request headers for features like IP whitelisting, rate limiting and access logging.
# Only change if you are sure that you use a correctly configured reverse proxy, otherwise this may lead to IP spoofing.
forwardedHeaders:
# X-Real-IP header (common with Nginx and Caddy)
xRealIp: true
# X-Forwarded-For header (common with many proxies, but may contain multiple IPs - only the first one will be used)
xForwardedFor: true
# CF-Connecting-IP header (used by Cloudflare Tunnels)
cfConnectingIp: false
## BACKUP CONFIGURATION
backups:
@@ -2,11 +2,11 @@
<html>
<head>
<title>Not found</title>
<title>Not Found</title>
</head>
<body>
<h1>Not found</h1>
<h1>Not Found</h1>
<p>
The requested URL was not found on this server.
</p>
+32
View File
@@ -642,5 +642,37 @@
{
"filename": "presets/reasoning/Think XML.json",
"type": "reasoning"
},
{
"filename": "presets/reasoning/Gemma 4.json",
"type": "reasoning"
},
{
"filename": "presets/instruct/Gemma 4.json",
"type": "instruct"
},
{
"filename": "presets/context/Gemma 4.json",
"type": "context"
},
{
"filename": "user.css",
"type": "stylesheet"
},
{
"filename": "errors/forbidden-by-whitelist.html",
"type": "error_page"
},
{
"filename": "errors/host-not-allowed.html",
"type": "error_page"
},
{
"filename": "errors/unauthorized.html",
"type": "error_page"
},
{
"filename": "errors/url-not-found.html",
"type": "error_page"
}
]
@@ -0,0 +1,14 @@
{
"story_string": "{{#if anchorBefore}}{{anchorBefore}}\n{{/if}}{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{personality}}\n{{/if}}{{#if scenario}}{{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{#if anchorAfter}}{{anchorAfter}}\n{{/if}}{{trim}}",
"example_separator": "",
"chat_start": "",
"use_stop_strings": false,
"names_as_stop_strings": true,
"story_string_position": 0,
"story_string_depth": 1,
"story_string_role": 0,
"always_force_name2": true,
"trim_sentences": false,
"single_line": false,
"name": "Gemma 4"
}
@@ -0,0 +1,25 @@
{
"input_sequence": "<|turn>user\n",
"output_sequence": "<|turn>model\n",
"last_output_sequence": "",
"system_sequence": "<|turn>system\n",
"stop_sequence": "<turn|>",
"wrap": false,
"macro": true,
"names_behavior": "force",
"activation_regex": "",
"first_output_sequence": "",
"skip_examples": false,
"output_suffix": "<turn|>\n",
"input_suffix": "<turn|>\n",
"system_suffix": "<turn|>\n",
"user_alignment_message": "",
"system_same_as_user": false,
"last_system_sequence": "",
"first_input_sequence": "",
"last_input_sequence": "",
"sequences_as_stop_strings": true,
"story_string_prefix": "<|turn>system\n",
"story_string_suffix": "<turn|>\n",
"name": "Gemma 4"
}
+6 -4
View File
@@ -1,7 +1,7 @@
{
"chat_completion_source": "openai",
"openai_model": "gpt-4-turbo",
"claude_model": "claude-sonnet-4-5",
"openai_model": "gpt-5.6-terra",
"claude_model": "claude-sonnet-5",
"openrouter_model": "OR_Website",
"openrouter_use_fallback": false,
"openrouter_group_models": false,
@@ -10,6 +10,8 @@
"mistralai_model": "mistral-large-latest",
"chutes_model": "deepseek-ai/DeepSeek-V3-0324",
"chutes_sort_models": "alphabetically",
"minimax_model": "MiniMax-M2.7",
"minimax_endpoint": "global",
"electronhub_model": "gpt-4o-mini",
"electronhub_sort_models": "alphabetically",
"electronhub_group_models": false,
@@ -18,8 +20,8 @@
"custom_include_body": "",
"custom_exclude_body": "",
"custom_include_headers": "",
"google_model": "gemini-2.5-pro",
"vertexai_model": "gemini-2.5-pro",
"google_model": "gemini-3.7-flash",
"vertexai_model": "gemini-3.7-flash",
"temperature": 1,
"frequency_penalty": 0,
"presence_penalty": 0,
@@ -0,0 +1,6 @@
{
"name": "Gemma 4",
"prefix": "<|channel>thought\n",
"suffix": "<channel|>",
"separator": "\n\n"
}
+1 -1
View File
@@ -622,7 +622,7 @@
},
"wi_format": "{0}",
"openai_model": "gpt-4-turbo",
"claude_model": "claude-sonnet-4-5",
"claude_model": "claude-sonnet-5",
"ai21_model": "jamba-large",
"openrouter_model": "OR_Website",
"reverse_proxy": "",
+3 -3
View File
@@ -1,6 +1,6 @@
#!/bin/sh
# Function to handle startup logic (Config check + Postinstall + Start)
# Function to handle startup logic (Config check + init + Start)
start_sillytavern() {
local PREFIX="$1"
shift # Remove the first argument (PREFIX) so $@ contains the rest
@@ -11,8 +11,8 @@ start_sillytavern() {
$PREFIX cp "default/config.yaml" "config/config.yaml"
fi
# Execute postinstall to auto-populate config.yaml with missing values
$PREFIX npm run postinstall
# Execute init script to auto-populate config.yaml with missing values
$PREFIX npm run init
# Start the server
exec $PREFIX node server.js --listen "$@"
Vendored
+4
View File
@@ -41,6 +41,10 @@ declare global {
* Authenticated user handle.
*/
handle: string | null;
/**
* Account version tag: shake256 derivative of password hash and salt.
*/
version: string | null;
/**
* Last time the session was extended.
*/
+80 -80
View File
@@ -1,13 +1,12 @@
{
"name": "sillytavern",
"version": "1.17.0",
"version": "1.19.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sillytavern",
"version": "1.17.0",
"hasInstallScript": true,
"version": "1.19.0",
"license": "AGPL-3.0",
"dependencies": {
"@adobe/css-tools": "^4.4.4",
@@ -39,13 +38,14 @@
"@mozilla/readability": "^0.6.0",
"@popperjs/core": "^2.11.8",
"@zeldafan0225/ai_horde": "^5.2.0",
"agent-base": "^7.1.3",
"archiver": "^7.0.1",
"bing-translate-api": "^4.1.0",
"body-parser": "^1.20.2",
"bowser": "^2.12.1",
"bytes": "^3.1.2",
"chalk": "^5.6.0",
"chevrotain": "^11.1.1",
"chevrotain": "^11.2.0",
"command-exists": "^1.2.9",
"compression": "^1.8.1",
"cookie-parser": "^1.4.6",
@@ -54,7 +54,7 @@
"crc": "^4.3.2",
"csrf-sync": "^4.2.1",
"diff-match-patch": "^1.0.5",
"dompurify": "^3.2.6",
"dompurify": "^3.4.2",
"droll": "^0.2.1",
"env-paths": "^3.0.0",
"express": "^4.21.0",
@@ -74,8 +74,9 @@
"ipaddr.js": "^2.2.0",
"is-docker": "^3.0.0",
"isomorphic-git": "^1.36.3",
"js-sha256": "^0.11.1",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"lodash": "^4.18.1",
"mime-types": "^3.0.2",
"moment": "^2.30.1",
"morphdom": "^2.7.7",
@@ -109,7 +110,7 @@
"sillytavern": "src/server-global.js"
},
"devDependencies": {
"@chevrotain/types": "^11.0.3",
"@chevrotain/types": "^11.2.0",
"@types/archiver": "^6.0.3",
"@types/bytes": "^3.1.5",
"@types/command-exists": "^1.2.3",
@@ -123,7 +124,7 @@
"@types/jquery-cropper": "^1.0.4",
"@types/jquery.transit": "^0.9.33",
"@types/jqueryui": "^1.12.24",
"@types/lodash": "^4.17.20",
"@types/lodash": "^4.17.24",
"@types/mime-types": "^3.0.1",
"@types/multer": "^2.1.0",
"@types/node": "^18.19.84",
@@ -139,7 +140,8 @@
"eslint": "^8.57.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsdoc": "^48.10.0",
"eslint-plugin-playwright": "^2.3.0"
"eslint-plugin-playwright": "^2.3.0",
"typescript": "^5.9.3"
},
"engines": {
"node": ">= 20"
@@ -177,42 +179,42 @@
"license": "Apache-2.0"
},
"node_modules/@chevrotain/cst-dts-gen": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-11.1.1.tgz",
"integrity": "sha512-fRHyv6/f542qQqiRGalrfJl/evD39mAvbJLCekPazhiextEatq1Jx1K/i9gSd5NNO0ds03ek0Cbo/4uVKmOBcw==",
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-11.2.0.tgz",
"integrity": "sha512-ssJFvn/UXhQQeICw3SR/fZPmYVj+JM2mP+Lx7bZ51cOeHaMWOKp3AUMuyM3QR82aFFXTfcAp67P5GpPjGmbZWQ==",
"license": "Apache-2.0",
"dependencies": {
"@chevrotain/gast": "11.1.1",
"@chevrotain/types": "11.1.1",
"@chevrotain/gast": "11.2.0",
"@chevrotain/types": "11.2.0",
"lodash-es": "4.17.23"
}
},
"node_modules/@chevrotain/gast": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-11.1.1.tgz",
"integrity": "sha512-Ko/5vPEYy1vn5CbCjjvnSO4U7GgxyGm+dfUZZJIWTlQFkXkyym0jFYrWEU10hyCjrA7rQtiHtBr0EaZqvHFZvg==",
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-11.2.0.tgz",
"integrity": "sha512-c+KoD6eSI1xjAZZoNUW+V0l13UEn+a4ShmUrjIKs1BeEWCji0Kwhmqn5FSx1K4BhWL7IQKlV7wLR4r8lLArORQ==",
"license": "Apache-2.0",
"dependencies": {
"@chevrotain/types": "11.1.1",
"@chevrotain/types": "11.2.0",
"lodash-es": "4.17.23"
}
},
"node_modules/@chevrotain/regexp-to-ast": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/@chevrotain/regexp-to-ast/-/regexp-to-ast-11.1.1.tgz",
"integrity": "sha512-ctRw1OKSXkOrR8VTvOxrQ5USEc4sNrfwXHa1NuTcR7wre4YbjPcKw+82C2uylg/TEwFRgwLmbhlln4qkmDyteg==",
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/@chevrotain/regexp-to-ast/-/regexp-to-ast-11.2.0.tgz",
"integrity": "sha512-lG73pBFqbXODTbXhdZwv0oyUaI+3Irm+uOv5/W79lI3g5hasYaJnVJOm3H2NkhA0Ef4XLBU4Scr7TJDJwgFkAw==",
"license": "Apache-2.0"
},
"node_modules/@chevrotain/types": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-11.1.1.tgz",
"integrity": "sha512-wb2ToxG8LkgPYnKe9FH8oGn3TMCBdnwiuNC5l5y+CtlaVRbCytU0kbVsk6CGrqTL4ZN4ksJa0TXOYbxpbthtqw==",
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-11.2.0.tgz",
"integrity": "sha512-vBMSj/lz/LqolbGQEHB0tlpW5BnljHVtp+kzjQfQU+5BtGMTuZCPVgaAjtKvQYXnHb/8i/02Kii00y0tsuwfsw==",
"license": "Apache-2.0"
},
"node_modules/@chevrotain/utils": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-11.1.1.tgz",
"integrity": "sha512-71eTYMzYXYSFPrbg/ZwftSaSDld7UYlS8OQa3lNnn9jzNtpFbaReRRyghzqS7rI3CDaorqpPJJcXGHK+FE1TVQ==",
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-11.2.0.tgz",
"integrity": "sha512-+7whECg4yNWHottjvr2To2BRxL4XJVjIyyv5J4+bJ0iMOVU8j/8n1qPDLZS/90W/BObDR8VNL46lFbzY/Hosmw==",
"license": "Apache-2.0"
},
"node_modules/@es-joy/jsdoccomment": {
@@ -549,7 +551,6 @@
"resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.22.12.tgz",
"integrity": "sha512-xcmww1O/JFP2MrlGUMd3Q78S3Qu6W3mYTXYuIqFq33EorgYHV/HqymHfXy9GjiCJ7OI+7lWx6nYFOzU7M4rd1Q==",
"license": "MIT",
"peer": true,
"dependencies": {
"@jimp/core": "^0.22.12"
}
@@ -1011,7 +1012,6 @@
"resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-1.6.0.tgz",
"integrity": "sha512-uSUD1mqXN9i1SGSz5ov3keRZ7S9L32/mAQG08wUwZiEi5FpbV0K8A8l1zkazAIZi9IJzLlTauRNU41Mi8IF9fA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@jimp/core": "1.6.0",
"@jimp/types": "1.6.0",
@@ -1043,7 +1043,6 @@
"resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.22.12.tgz",
"integrity": "sha512-dghs92qM6MhHj0HrV2qAwKPMklQtjNpoYgAB94ysYpsXslhRTiPisueSIELRwZGEr0J0VUxpUY7HgJwlSIgGZw==",
"license": "MIT",
"peer": true,
"dependencies": {
"@jimp/utils": "^0.22.12"
},
@@ -1139,7 +1138,6 @@
"resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.22.12.tgz",
"integrity": "sha512-xslz2ZoFZOPLY8EZ4dC29m168BtDx95D6K80TzgUi8gqT7LY6CsajWO0FAxDwHz6h0eomHMfyGX0stspBrTKnQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@jimp/utils": "^0.22.12"
},
@@ -1176,7 +1174,6 @@
"resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.22.12.tgz",
"integrity": "sha512-xImhTE5BpS8xa+mAN6j4sMRWaUgUDLoaGHhJhpC+r7SKKErYDR0WQV4yCE4gP+N0gozD0F3Ka1LUSaMXrn7ZIA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@jimp/utils": "^0.22.12",
"tinycolor2": "^1.6.0"
@@ -1220,7 +1217,6 @@
"resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.22.12.tgz",
"integrity": "sha512-FNuUN0OVzRCozx8XSgP9MyLGMxNHHJMFt+LJuFjn1mu3k0VQxrzqbN06yIl46TVejhyAhcq5gLzqmSCHvlcBVw==",
"license": "MIT",
"peer": true,
"dependencies": {
"@jimp/utils": "^0.22.12"
},
@@ -1308,7 +1304,6 @@
"resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.22.12.tgz",
"integrity": "sha512-3NyTPlPbTnGKDIbaBgQ3HbE6wXbAlFfxHVERmrbqAi8R3r6fQPxpCauA8UVDnieg5eo04D0T8nnnNIX//i/sXg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@jimp/utils": "^0.22.12"
},
@@ -1321,7 +1316,6 @@
"resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.22.12.tgz",
"integrity": "sha512-9YNEt7BPAFfTls2FGfKBVgwwLUuKqy+E8bDGGEsOqHtbuhbshVGxN2WMZaD4gh5IDWvR+emmmPPWGgaYNYt1gA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@jimp/utils": "^0.22.12"
},
@@ -1922,7 +1916,6 @@
"integrity": "sha512-Crp6WY9aTYP3qPi2wGDo9iUe/rceX01UMhnF1jmwDcKCFM6cx7YhGP/Mpr3y9AASpfHixIG0E6azCcL5OcDHsQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "^4.17.33",
@@ -2018,9 +2011,9 @@
}
},
"node_modules/@types/lodash": {
"version": "4.17.20",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA==",
"version": "4.17.24",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.24.tgz",
"integrity": "sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==",
"dev": true,
"license": "MIT"
},
@@ -2612,7 +2605,6 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -2799,9 +2791,9 @@
}
},
"node_modules/archiver-utils/node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
"integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
@@ -3021,14 +3013,23 @@
}
},
"node_modules/axios": {
"version": "1.13.5",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.5.tgz",
"integrity": "sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==",
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.15.2.tgz",
"integrity": "sha512-wLrXxPtcrPTsNlJmKjkPnNPK2Ihe0hn0wGSaTEiHRPxwjvJwT3hKmXF4dpqxmPO9SoNb2FsYXj/xEo0gHN+D5A==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.11",
"form-data": "^4.0.5",
"proxy-from-env": "^1.1.0"
"proxy-from-env": "^2.1.0"
}
},
"node_modules/axios/node_modules/proxy-from-env": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz",
"integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==",
"license": "MIT",
"engines": {
"node": ">=10"
}
},
"node_modules/b4a": {
@@ -3083,9 +3084,9 @@
}
},
"node_modules/basic-ftp": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.2.0.tgz",
"integrity": "sha512-VoMINM2rqJwJgfdHq6RiUudKt2BV+FY5ZFezP/ypmwayk68+NzzAQy4XXLlqsGD4MCzq3DrmNFD/uUmBJuGoXw==",
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.3.1.tgz",
"integrity": "sha512-bopVNp6ugyA150DDuZfPFdt1KZ5a94ZDiwX4hMgZDzF+GttD80lEy8kj98kbyhLXnPvhtIo93mdnLIjpCAeeOw==",
"license": "MIT",
"engines": {
"node": ">=10.0.0"
@@ -3190,9 +3191,9 @@
"license": "MIT"
},
"node_modules/brace-expansion": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
"integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -3232,7 +3233,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.9.0",
"caniuse-lite": "^1.0.30001759",
@@ -3503,16 +3503,16 @@
}
},
"node_modules/chevrotain": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-11.1.1.tgz",
"integrity": "sha512-f0yv5CPKaFxfsPTBzX7vGuim4oIC1/gcS7LUGdBSwl2dU6+FON6LVUksdOo1qJjoUvXNn45urgh8C+0a24pACQ==",
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-11.2.0.tgz",
"integrity": "sha512-mHCHTxM51nCklUw9RzRVc0DLjAh/SAUPM4k/zMInlTIo25ldWXOZoPt7XEIk/LwoT4lFVmJcu9g5MHtx371x3A==",
"license": "Apache-2.0",
"dependencies": {
"@chevrotain/cst-dts-gen": "11.1.1",
"@chevrotain/gast": "11.1.1",
"@chevrotain/regexp-to-ast": "11.1.1",
"@chevrotain/types": "11.1.1",
"@chevrotain/utils": "11.1.1",
"@chevrotain/cst-dts-gen": "11.2.0",
"@chevrotain/gast": "11.2.0",
"@chevrotain/regexp-to-ast": "11.2.0",
"@chevrotain/types": "11.2.0",
"@chevrotain/utils": "11.2.0",
"lodash-es": "4.17.23"
}
},
@@ -4322,13 +4322,10 @@
}
},
"node_modules/dompurify": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.3.2.tgz",
"integrity": "sha512-6obghkliLdmKa56xdbLOpUZ43pAR6xFy1uOrxBaIDjT+yaRuuybLjGS9eVBoSR/UPU5fq3OXClEHLJNGvbxKpQ==",
"version": "3.4.2",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.2.tgz",
"integrity": "sha512-lHeS9SA/IKeIFFyYciHBr2n0v1VMPlSj843HdLOwjb2OxNwdq9Xykxqhk+FE42MzAdHvInbAolSE4mhahPpjXA==",
"license": "(MPL-2.0 OR Apache-2.0)",
"engines": {
"node": ">=20"
},
"optionalDependencies": {
"@types/trusted-types": "^2.0.7"
}
@@ -4567,7 +4564,6 @@
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
@@ -5209,9 +5205,9 @@
"license": "ISC"
},
"node_modules/follow-redirects": {
"version": "1.15.11",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
"integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz",
"integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==",
"funding": [
{
"type": "individual",
@@ -6378,6 +6374,12 @@
"integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==",
"license": "BSD-3-Clause"
},
"node_modules/js-sha256": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.11.1.tgz",
"integrity": "sha512-o6WSo/LUvY2uC4j7mO50a2ms7E/EAdbP0swigLV+nzHKTTaYnaLIWJ02VdXrsJX0vGedDESQnLsOekr94ryfjg==",
"license": "MIT"
},
"node_modules/js-yaml": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
@@ -6614,9 +6616,9 @@
}
},
"node_modules/lodash": {
"version": "4.17.23",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz",
"integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==",
"version": "4.18.1",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
"integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",
"license": "MIT"
},
"node_modules/lodash-es": {
@@ -7926,9 +7928,9 @@
}
},
"node_modules/readdir-glob/node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
"integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
@@ -8125,7 +8127,6 @@
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
"integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
"license": "MIT",
"peer": true,
"dependencies": {
"fast-deep-equal": "^3.1.3",
"fast-uri": "^3.0.1",
@@ -9143,7 +9144,6 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
+11 -8
View File
@@ -29,13 +29,14 @@
"@mozilla/readability": "^0.6.0",
"@popperjs/core": "^2.11.8",
"@zeldafan0225/ai_horde": "^5.2.0",
"agent-base": "^7.1.3",
"archiver": "^7.0.1",
"bing-translate-api": "^4.1.0",
"body-parser": "^1.20.2",
"bowser": "^2.12.1",
"bytes": "^3.1.2",
"chalk": "^5.6.0",
"chevrotain": "^11.1.1",
"chevrotain": "^11.2.0",
"command-exists": "^1.2.9",
"compression": "^1.8.1",
"cookie-parser": "^1.4.6",
@@ -44,7 +45,7 @@
"crc": "^4.3.2",
"csrf-sync": "^4.2.1",
"diff-match-patch": "^1.0.5",
"dompurify": "^3.2.6",
"dompurify": "^3.4.2",
"droll": "^0.2.1",
"env-paths": "^3.0.0",
"express": "^4.21.0",
@@ -64,8 +65,9 @@
"ipaddr.js": "^2.2.0",
"is-docker": "^3.0.0",
"isomorphic-git": "^1.36.3",
"js-sha256": "^0.11.1",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"lodash": "^4.18.1",
"mime-types": "^3.0.2",
"moment": "^2.30.1",
"morphdom": "^2.7.7",
@@ -113,8 +115,9 @@
"type": "git",
"url": "https://github.com/SillyTavern/SillyTavern.git"
},
"version": "1.17.0",
"version": "1.19.0",
"scripts": {
"init": "node src/server-init.js",
"start": "node server.js",
"debug": "node --inspect server.js",
"start:global": "node server.js --global",
@@ -122,7 +125,6 @@
"start:deno": "deno run --allow-run --allow-net --allow-read --allow-write --allow-sys --allow-env server.js",
"start:bun": "bun server.js",
"start:no-csrf": "node server.js --disableCsrf",
"postinstall": "node post-install.js",
"lint": "eslint \"src/**/*.js\" \"public/**/*.js\" ./*.js",
"lint:fix": "eslint \"src/**/*.js\" \"public/**/*.js\" ./*.js --fix",
"plugins:update": "node plugins update",
@@ -137,7 +139,7 @@
},
"main": "server.js",
"devDependencies": {
"@chevrotain/types": "^11.0.3",
"@chevrotain/types": "^11.2.0",
"@types/archiver": "^6.0.3",
"@types/bytes": "^3.1.5",
"@types/command-exists": "^1.2.3",
@@ -151,7 +153,7 @@
"@types/jquery-cropper": "^1.0.4",
"@types/jquery.transit": "^0.9.33",
"@types/jqueryui": "^1.12.24",
"@types/lodash": "^4.17.20",
"@types/lodash": "^4.17.24",
"@types/mime-types": "^3.0.1",
"@types/multer": "^2.1.0",
"@types/node": "^18.19.84",
@@ -167,6 +169,7 @@
"eslint": "^8.57.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsdoc": "^48.10.0",
"eslint-plugin-playwright": "^2.3.0"
"eslint-plugin-playwright": "^2.3.0",
"typescript": "^5.9.3"
}
}
+4 -3
View File
@@ -39,9 +39,10 @@ if (command === 'install') {
}
async function updatePlugins() {
const directories = fs.readdirSync(pluginsPath)
.filter(file => !file.startsWith('.'))
.filter(file => fs.statSync(path.join(pluginsPath, file)).isDirectory());
const directories = fs.readdirSync(pluginsPath, { withFileTypes: true })
.filter(dirent => dirent.isDirectory() || dirent.isSymbolicLink())
.filter(dirent => !dirent.name.startsWith('.'))
.map(dirent => dirent.name);
console.log(`Found ${color.cyan(directories.length)} directories in ./plugins`);
-114
View File
@@ -1,114 +0,0 @@
/**
* Scripts to be done before starting the server for the first time.
*/
import fs from 'node:fs';
import path from 'node:path';
import process from 'node:process';
import yaml from 'yaml';
import chalk from 'chalk';
import { createRequire } from 'node:module';
import { addMissingConfigValues } from './src/config-init.js';
/**
* Colorizes console output.
*/
const color = chalk;
/**
* Converts the old config.conf file to the new config.yaml format.
*/
function convertConfig() {
if (fs.existsSync('./config.conf')) {
if (fs.existsSync('./config.yaml')) {
console.log(color.yellow('Both config.conf and config.yaml exist. Please delete config.conf manually.'));
return;
}
try {
console.log(color.blue('Converting config.conf to config.yaml. Your old config.conf will be renamed to config.conf.bak'));
fs.renameSync('./config.conf', './config.conf.cjs'); // Force loading as CommonJS
const require = createRequire(import.meta.url);
const config = require(path.join(process.cwd(), './config.conf.cjs'));
fs.copyFileSync('./config.conf.cjs', './config.conf.bak');
fs.rmSync('./config.conf.cjs');
fs.writeFileSync('./config.yaml', yaml.stringify(config));
console.log(color.green('Conversion successful. Please check your config.yaml and fix it if necessary.'));
} catch (error) {
console.error(color.red('FATAL: Config conversion failed. Please check your config.conf file and try again.'), error);
return;
}
}
}
/**
* Creates the default config files if they don't exist yet.
*/
function createDefaultFiles() {
/**
* @typedef DefaultItem
* @type {object}
* @property {'file' | 'directory'} type - Whether the item should be copied as a single file or merged into a directory structure.
* @property {string} defaultPath - The path to the default item (typically in `default/`).
* @property {string} productionPath - The path to the copied item for production use.
*/
/** @type {DefaultItem[]} */
const defaultItems = [
{
type: 'file',
defaultPath: './default/config.yaml',
productionPath: './config.yaml',
},
{
type: 'directory',
defaultPath: './default/public/',
productionPath: './public/',
},
];
for (const defaultItem of defaultItems) {
try {
if (defaultItem.type === 'file') {
if (!fs.existsSync(defaultItem.productionPath)) {
fs.copyFileSync(
defaultItem.defaultPath,
defaultItem.productionPath,
);
console.log(
color.green(`Created default file: ${defaultItem.productionPath}`),
);
}
} else if (defaultItem.type === 'directory') {
fs.cpSync(defaultItem.defaultPath, defaultItem.productionPath, {
force: false, // Don't overwrite existing files!
recursive: true,
});
console.log(
color.green(`Synchronized missing files: ${defaultItem.productionPath}`),
);
} else {
throw new Error(
'FATAL: Unexpected default file format in `post-install.js#createDefaultFiles()`.',
);
}
} catch (error) {
console.error(
color.red(
`FATAL: Could not write default ${defaultItem.type}: ${defaultItem.productionPath}`,
),
error,
);
}
}
}
try {
// 0. Convert config.conf to config.yaml
convertConfig();
// 1. Create default config files
createDefaultFiles();
// 2. Add missing config values
addMissingConfigValues(path.join(process.cwd(), './config.yaml'));
} catch (error) {
console.error(error);
}
+7
View File
@@ -0,0 +1,7 @@
# Looking for user.css?
user.css is now located under your data root directory in the "_css" folder.
Example for the default data root:
/data/_css/user.css
+12 -2
View File
@@ -97,13 +97,23 @@ label[for="extensions_autoconnect"] {
font-size: 1.05em;
}
.extensions_info .extension_version {
.extensions_info :is(.extension_version, .extension_author) {
opacity: 0.8;
font-size: 0.8em;
font-weight: normal;
margin-left: 2px;
}
.extensions_info :is(.extension_version, .extension_author):empty {
display: none;
}
.extensions_info .extension_author {
display: inline-flex;
gap: 2px;
align-items: baseline;
}
.extensions_info .extension_block a {
color: var(--SmartThemeBodyColor);
}
@@ -161,4 +171,4 @@ input.extension_missing[type="checkbox"] {
z-index: 1;
margin-bottom: 10px;
padding: 5px;
}
}
+5
View File
@@ -500,6 +500,11 @@
.horde_multiple_hint {
display: none;
}
select[multiple] {
max-height: 50px;
overflow-y: auto;
}
}
/*landscape mode phones and ipads*/
+236
View File
@@ -0,0 +1,236 @@
/* ─────────────────────────────────────────────────────────────────────────────
Streaming Display — floating toast panel for live LLM generation output.
Shows reasoning (thinking) and content as they stream in.
Used by extensions that leverage ConnectionManagerRequestService streaming.
───────────────────────────────────────────────────────────────────────────── */
.streaming-display {
position: fixed;
bottom: max(calc(var(--bottomFormBlockSize) + 5px), 20px);
right: 20px;
width: min(550px, calc(100vw - 40px));
max-height: 70vh;
background: var(--SmartThemeBlurTintColor);
border: 1px solid var(--SmartThemeBorderColor);
border-radius: 10px;
padding: 14px;
z-index: 9000;
display: flex;
flex-direction: column;
gap: 10px;
opacity: 0;
transform: translateY(20px);
transition: opacity var(--animation-duration, 125ms) ease, transform var(--animation-duration, 125ms) ease;
overflow: hidden;
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
backdrop-filter: blur(12px);
}
.streaming-display-visible {
opacity: 1;
transform: translateY(0);
}
/* Header label with animated activity indicator */
.streaming-display-label {
font-weight: 600;
font-size: 0.95em;
color: var(--SmartThemeBodyColor);
display: flex;
align-items: center;
gap: 8px;
user-select: none;
}
/* LED status indicator - pulsing while streaming */
.streaming-display-led {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background: rgb(225, 138, 36);
animation: streaming-display-pulse 1.5s ease-in-out infinite;
flex-shrink: 0;
}
/* Completed state: solid green LED */
.streaming-display-complete .streaming-display-led {
background: #4caf50;
animation: none;
opacity: 1;
box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}
/* Stopped state: solid red LED */
.streaming-display-stopped .streaming-display-led {
background: #f44336;
animation: none;
opacity: 1;
box-shadow: 0 0 8px rgba(244, 67, 54, 0.6);
}
@keyframes streaming-display-pulse {
0%, 100% { opacity: 0.4; transform: scale(0.9); }
50% { opacity: 1; transform: scale(1.1); }
}
/* Label text takes available space */
.streaming-display-label-text {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Window control buttons container */
.streaming-display-controls {
display: flex;
align-items: center;
gap: 4px;
margin-left: auto;
flex-shrink: 0;
}
/* Window control buttons */
.streaming-display-btn {
width: 22px;
height: 22px;
border: none;
border-radius: 4px;
background: transparent;
color: var(--SmartThemeBodyColor);
font-size: 14px;
line-height: 1;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
opacity: 0.6;
transition: opacity 0.15s ease, background-color 0.15s ease;
}
.streaming-display-btn:hover {
opacity: 1;
background-color: rgba(255, 255, 255, 0.1);
}
.streaming-display-btn-close:hover {
background-color: rgba(244, 67, 54, 0.2);
}
.streaming-display-btn-stop {
font-size: 10px;
}
.streaming-display-btn-stop:hover {
background-color: rgba(244, 150, 36, 0.2);
color: rgb(225, 138, 36);
}
/* Content container - collapsible for minimize */
.streaming-display-content {
display: flex;
flex-direction: column;
gap: 10px;
overflow: hidden;
transition: max-height var(--animation-duration, 125ms) ease, opacity var(--animation-duration, 125ms) ease;
}
/* Minimized state - hide content sections */
.streaming-display-minimized .streaming-display-content {
max-height: 0;
opacity: 0;
}
.streaming-display-minimized {
gap: 0;
}
/* Model/API icon in the label */
.streaming-display-icon {
width: 1.1em;
height: 1.1em;
flex-shrink: 0;
}
/* Minimized state adjustments */
.streaming-display-minimized.streaming-display {
padding: 10px 14px;
}
/* Reasoning (thinking) section */
.streaming-display-reasoning {
background: color-mix(in srgb, var(--SmartThemeBodyColor) 5%, transparent);
border-radius: 6px;
padding: 8px 10px;
border-left: 3px solid color-mix(in srgb, var(--SmartThemeBodyColor) 25%, transparent);
}
.streaming-display-reasoning-label {
font-size: 0.8em;
font-weight: 600;
opacity: 0.5;
margin-bottom: 4px;
letter-spacing: 0.03em;
text-transform: uppercase;
}
.streaming-display-reasoning-content {
font-size: 0.82em;
opacity: 0.65;
max-height: 25vh;
overflow-y: auto;
word-break: break-word;
line-height: 1.45;
scrollbar-width: thin;
}
.streaming-display-reasoning-content p {
margin: 0.3em 0;
}
.streaming-display-reasoning-content p:first-child {
margin-top: 0;
}
.streaming-display-reasoning-content p:last-child {
margin-bottom: 0;
}
/* Main content section */
.streaming-display-text {
border-top: 1px solid color-mix(in srgb, var(--SmartThemeBorderColor) 50%, transparent);
padding-top: 8px;
min-height: 1.5em;
}
.streaming-display-text-content {
font-size: 0.9em;
color: var(--SmartThemeBodyColor);
max-height: 40vh;
overflow-y: auto;
word-break: break-word;
line-height: 1.5;
scrollbar-width: thin;
}
.streaming-display-text-content p {
margin: 0.4em 0;
}
.streaming-display-text-content p:first-child {
margin-top: 0;
}
.streaming-display-text-content p:last-child {
margin-bottom: 0;
}
/* Strip auto-added quotes from <q> tags, as message formatting adds them */
.streaming-display-reasoning-content q:before,
.streaming-display-reasoning-content q:after,
.streaming-display-text-content q:before,
.streaming-display-text-content q:after {
content: '';
}
+4
View File
@@ -565,6 +565,10 @@ label[for="bind_preset_to_connection"]:has(input:checked) {
display: none;
}
#openai_settings:has(#openai_function_calling:not(:checked)) #tool_call_recurse_limit_block {
display: none;
}
#adaptive_p_block:has([data-tg-samplers="adaptive_target"][style*="display: none"]):has([data-tg-samplers="adaptive_decay"][style*="display: none"]) {
display: none;
}
+1
View File
@@ -17,6 +17,7 @@
.welcomePanel.recentHidden .welcomeRecent,
.welcomePanel.recentHidden .recentChatsTitle,
.welcomePanel.recentHidden .hideRecentChats,
.welcomePanel.recentHidden .recentChatsSettings,
.welcomePanel:not(.recentHidden) .showRecentChats {
display: none;
}
+5 -77
View File
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

+6 -47
View File
@@ -1,48 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.0"
width="431.92484pt"
height="430.70734pt"
viewBox="0 0 431.92484 430.70734"
preserveAspectRatio="xMidYMid"
id="svg8"
sodipodi:docname="koboldhorde.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs12" />
<sodipodi:namedview
id="namedview10"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="pt"
showgrid="false"
inkscape:zoom="1.5043945"
inkscape:cx="237.63713"
inkscape:cy="285.82928"
inkscape:window-width="2560"
inkscape:window-height="1377"
inkscape:window-x="5112"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg8" />
<g
transform="matrix(0.1,0,0,-0.1,-40.075165,470.78832)"
stroke="none"
id="g6">
<path
d="m 2495,4698 c -3,-7 -6,-76 -7,-153 l -3,-140 -115,-5 c -63,-3 -114,-9 -114,-14 1,-4 34,-41 74,-82 l 72,-74 -4,-125 -3,-124 -65,-67 c -74,-75 -224,-205 -257,-223 -27,-14 -54,-3 -89,38 -22,26 -24,26 -156,26 -132,0 -135,0 -172,28 -52,40 -60,67 -41,135 9,30 14,56 11,59 -7,7 -47,-16 -77,-43 l -25,-24 -18,41 c -10,23 -39,56 -68,80 -63,49 -110,53 -160,12 -58,-49 -67,-65 -68,-118 0,-49 2,-53 63,-113 62,-61 63,-62 118,-62 h 56 l 72,-80 73,-80 h 51 c 61,0 66,-3 92,-53 11,-21 46,-69 77,-105 l 58,-67 -320,-3 -321,-2 -55,26 c -47,22 -67,42 -131,125 -79,102 -128,139 -186,139 -23,0 -27,-4 -27,-28 0,-61 91,-163 177,-198 64,-27 97,-59 167,-162 36,-55 75,-107 86,-117 24,-22 80,-108 80,-123 0,-6 -15,-35 -34,-64 -18,-29 -66,-113 -106,-185 l -72,-133 h -80 -79 l 2,80 c 1,44 0,83 -4,86 -3,3 -31,-8 -63,-24 -67,-33 -197,-82 -220,-82 -9,0 -34,-13 -57,-29 -36,-25 -55,-30 -129,-36 -77,-6 -87,-9 -92,-28 -13,-48 -15,-47 157,-47 90,0 232,-3 315,-7 l 152,-6 v -39 -38 h 281 280 l 57,47 c 31,25 80,56 109,69 87,39 78,44 -89,45 -84,1 -232,4 -328,8 l -175,6 55,28 c 30,15 63,27 72,27 16,0 58,44 58,61 0,17 92,150 113,164 12,7 57,17 100,21 l 77,7 62,-43 c 49,-35 72,-45 115,-48 31,-3 53,0 53,5 0,11 -93,102 -156,152 l -42,32 -4,90 c -2,50 -9,94 -16,101 -7,7 -12,16 -12,20 0,4 56,8 123,8 68,0 212,3 319,7 l 195,6 -56,50 c -72,65 -71,63 -71,125 0,29 -7,69 -15,89 -8,19 -15,37 -15,39 0,2 28,4 61,4 57,0 65,3 110,41 l 49,41 v 69 70 l 55,51 c 106,98 95,132 95,-292 v -371 l -45,-42 -44,-42 -2,-194 c -2,-219 -6,-209 76,-210 22,-1 50,-8 62,-16 18,-13 23,-13 30,-2 5,9 33,16 71,20 35,3 66,8 69,11 3,3 8,93 11,199 l 5,194 -47,32 -46,32 v 202 c 0,111 -3,281 -7,377 l -6,174 39,-31 c 107,-86 106,-85 111,-143 7,-89 10,-96 65,-134 43,-29 62,-36 101,-36 h 48 l -5,-32 c -3,-18 -8,-64 -10,-103 l -5,-70 -56,-50 c -30,-28 -55,-53 -55,-55 0,-3 78,-3 172,-2 95,2 237,1 315,-3 l 142,-7 -14,-29 c -9,-17 -15,-56 -15,-97 0,-85 -1,-86 -161,-228 -66,-58 -118,-111 -116,-118 9,-27 130,16 213,76 45,32 47,33 164,34 l 118,2 78,-114 c 44,-62 79,-122 79,-131 0,-16 -18,-19 -205,-24 -113,-3 -238,-7 -277,-8 -40,0 -73,-5 -73,-11 0,-5 21,-18 48,-30 26,-12 81,-43 123,-70 l 75,-50 h 316 316 l 9,38 9,37 58,3 c 53,3 58,1 51,-15 -4,-10 -11,-39 -15,-66 -5,-35 -15,-57 -40,-82 -40,-41 -33,-57 13,-30 18,11 79,35 137,55 l 105,35 9,50 c 5,28 14,53 20,57 6,4 52,8 103,8 h 91 l 11,31 c 6,18 11,33 11,34 0,2 -46,4 -103,7 -96,3 -106,5 -152,36 -27,18 -67,37 -89,43 -44,12 -112,44 -136,64 -8,7 -27,15 -42,17 -27,5 -27,5 -34,-73 l -7,-79 h -89 -89 l -57,118 c -31,64 -69,137 -84,161 -22,36 -28,57 -28,102 0,56 2,60 54,116 29,32 81,98 116,147 49,69 76,96 122,125 138,84 191,138 202,204 l 7,37 h -41 c -59,0 -88,-19 -159,-104 -65,-78 -120,-127 -181,-165 -34,-20 -46,-21 -362,-21 -192,0 -328,4 -328,9 0,5 19,24 42,42 22,18 61,64 85,101 44,68 44,68 90,68 44,0 49,3 134,86 84,82 89,86 122,80 49,-9 84,7 145,67 50,49 52,53 52,105 0,65 -10,84 -62,122 -61,45 -119,42 -165,-6 -18,-20 -43,-54 -54,-75 -10,-21 -22,-39 -26,-39 -3,0 -20,9 -37,19 -17,11 -40,21 -50,23 -17,3 -19,-3 -17,-57 1,-46 -3,-68 -19,-93 -31,-51 -68,-61 -191,-55 -131,7 -152,2 -179,-42 -12,-19 -29,-35 -38,-35 -17,0 -405,306 -429,337 -7,10 -13,45 -13,80 v 63 h 89 c 53,0 93,4 96,11 4,6 -4,22 -16,36 -32,34 -134,120 -150,125 -9,3 -13,49 -13,180 -1,97 -3,178 -6,181 -3,3 -33,8 -67,12 -49,5 -64,4 -68,-7 z"
id="path2" />
<path
d="m 2166,2764 c -3,-9 -6,-59 -6,-112 v -97 l -49,-42 -50,-43 h -145 -146 v -110 -110 h -25 c -17,0 -43,-16 -75,-46 -53,-49 -96,-63 -164,-50 -30,6 -42,18 -89,89 -30,45 -61,97 -70,114 -16,30 -20,31 -83,35 -36,1 -68,0 -71,-5 -2,-4 25,-67 61,-140 36,-72 68,-150 72,-173 6,-38 3,-44 -33,-80 -21,-21 -62,-58 -91,-82 -29,-24 -61,-60 -71,-80 -26,-49 -106,-125 -161,-152 -56,-28 -116,-83 -141,-132 -36,-70 -25,-84 51,-64 48,12 64,25 154,118 149,155 126,148 509,148 174,0 317,-4 317,-8 0,-5 -14,-21 -31,-38 -17,-16 -53,-63 -81,-104 l -50,-75 -57,-6 c -54,-7 -58,-9 -122,-79 l -67,-73 -58,6 c -71,8 -88,0 -149,-71 -34,-41 -45,-62 -45,-88 0,-51 23,-98 64,-129 31,-24 43,-27 85,-23 73,7 121,50 145,130 5,16 8,16 48,-2 63,-29 69,-27 62,20 -6,34 -2,45 20,75 48,63 67,70 182,66 134,-3 172,4 180,35 13,52 26,48 147,-43 63,-49 167,-130 231,-182 l 116,-94 v -57 -57 l -86,-6 c -48,-3 -89,-8 -91,-11 -3,-3 26,-33 63,-68 136,-125 121,-89 123,-288 1,-96 4,-176 6,-179 3,-2 22,12 44,32 22,19 51,43 65,52 25,17 26,20 26,126 v 109 h 119 c 66,0 122,4 125,9 3,5 -33,46 -80,90 l -86,82 7,109 c 8,130 17,146 140,256 43,38 100,90 127,117 64,61 94,63 137,8 l 32,-40 145,-3 146,-3 30,-34 c 27,-30 30,-39 26,-82 -5,-48 -4,-49 21,-48 14,1 40,4 56,8 26,5 32,2 45,-21 8,-15 32,-46 53,-68 35,-36 44,-40 86,-40 38,0 57,7 90,30 45,33 61,63 61,116 0,27 -11,46 -52,91 -66,74 -63,73 -127,73 -53,0 -55,1 -132,75 l -79,75 h -79 c -51,0 -82,4 -89,13 -5,6 -15,38 -22,70 -8,38 -22,70 -41,92 -30,33 -30,34 -9,45 14,8 116,10 328,8 355,-3 350,-2 442,-101 150,-161 142,-154 194,-161 64,-10 75,1 51,55 -26,56 -86,105 -154,125 -45,13 -65,26 -101,67 -25,28 -75,83 -111,122 -37,38 -86,101 -109,140 l -42,69 32,56 c 40,70 140,277 140,291 0,10 -40,6 -112,-12 -30,-8 -42,-18 -59,-52 -28,-54 -75,-125 -107,-159 -49,-53 -158,-50 -221,7 -21,19 -49,38 -63,44 -21,8 -26,18 -31,63 -4,29 -7,78 -7,110 v 56 l -160,4 -159,3 -39,38 -39,38 -7,112 c -4,61 -8,113 -11,115 -8,9 -40,-21 -195,-186 -89,-95 -170,-177 -181,-183 -30,-15 -11,-34 -263,249 -60,67 -112,122 -116,122 -4,0 -11,-7 -14,-16 z m 388,-524 c 4,0 59,50 121,110 62,61 117,110 123,110 16,0 72,-75 72,-96 0,-18 -290,-304 -308,-304 -11,0 -326,287 -330,301 -4,10 41,75 65,95 10,9 38,-13 131,-102 64,-62 121,-114 126,-114 z m -759,-97 c 4,-21 7,-44 8,-52 2,-11 31,-14 143,-15 l 141,-1 69,-60 c 37,-33 128,-118 201,-190 l 133,-130 v -230 c 0,-218 -4,-275 -19,-275 -3,0 -35,24 -71,53 l -65,53 -12,79 c -6,44 -12,81 -12,81 -1,1 -17,14 -37,29 -25,20 -54,30 -93,34 -42,5 -55,10 -52,21 2,8 7,51 12,95 l 8,80 51,47 c 29,25 49,51 45,57 -4,7 -93,11 -268,12 -144,1 -295,4 -335,8 l -73,6 45,43 c 45,43 46,45 46,105 0,61 1,63 56,125 31,34 60,62 64,62 5,0 12,-17 15,-37 z m 1608,-34 47,-41 v -82 c 0,-69 3,-86 20,-104 12,-12 25,-22 31,-22 6,0 8,-4 5,-9 -3,-5 -71,-12 -150,-16 l -144,-7 -159,-148 c -87,-81 -187,-171 -223,-201 l -65,-55 -5,-66 c -3,-45 -11,-72 -24,-87 -36,-39 -125,-103 -136,-96 -6,4 -10,92 -10,254 v 248 l 103,99 c 108,106 215,206 285,267 l 42,37 h 149 c 158,0 161,1 161,51 0,29 20,23 73,-22 z"
id="path4" />
</g>
<?xml version="1.0" encoding="UTF-8"?>
<svg id="svg8" width="431.92pt" height="430.69pt" preserveAspectRatio="xMidYMid" version="1.0" viewBox="0 0 431.92 430.69" xmlns="http://www.w3.org/2000/svg">
<g id="g3" transform="matrix(.1 0 0 -.1 -40.075 470.79)">
<path id="path1" d="m2495 4698c-9-97-8-195-10-293-65-14-170 12-229-19 45-55 96-105 146-156-3-83-5-166-7-249-102-101-201-211-322-290-27-14-54-3-89 38-65 77-439-60-369 189 45 119-53 28-91-8-51 115-151 211-246 133-124-105-64-173-5-231 48-64 103-62 174-62 48-54 96-107 145-160 66 0 107 14 143-53 37-63 87-117 135-172-289 13-616-97-827 146-162 210-213 129-213 111 0-155 182-121 344-360 77-118 166-205 166-240-69-128-143-254-212-382h-159c-6 53 16 115-2 166-102-50-248-79-340-135-92-64-208-14-221-64-13-48-15-47 157-47 156 0 311-7 467-13v-77h561c52 44 105 87 166 116 87 39 78 44-89 45-145 2-166 2-503 14 42 19 81 47 127 55 43 0 115 188 171 225 56 21 118 23 177 28 56-38 107-85 177-91 31-3 53 0 53 5-53 72-127 130-198 184l-4 90c-5 123-28 104-28 121 210 14 425 14 637 21-58 55-127 86-127 175 0 72-30 121-30 128 0 2 28 4 61 4 68-7 111 42 159 82v139l55 51c106 98 95 132 95-292v-371c-30-28-59-56-89-84l-2-194c-2-219-6-209 76-210 22-1 50-8 62-16 18-13 23-13 30-2 5 9 33 16 71 20 35 3 66 8 69 11 6 6 10 155 16 393-31 21-62 43-93 64 3 251-4 502-13 753 60-51 142-89 150-174 7-89 10-96 65-134 44-37 95-36 149-36-12-68-15-137-20-205-37-35-78-66-111-105 0-22 2 19 629-12-23-39-28-82-29-126 0-85-1-86-161-228-66-58-118-111-116-118 9-27 130 16 213 76 45 32 47 33 164 34l118 2c46-83 124-154 157-245 0-47-496-7-555-43 81-49 166-97 246-150h632l18 75c20-2 119 19 109-12-20-51-3-96-55-148-40-41-33-57 13-30 32 20 119 49 242 90 9 34 6 78 29 107 12 8 86 8 194 8 4 12 22 62 22 65 0 2-46 4-103 7-194 6-120 46-241 79-97 26-138 76-178 81-44 11-38-118-41-152h-178c-47 93-87 190-141 279-88 140 63 263 142 365 149 210 291 154 331 366-217 0-138-117-381-269-71-42-690-15-690-12 70 58 140 211 217 211 110 0 171 181 256 166 107-20 302 172 135 294-157 116-226-120-245-120-9 0-60 37-87 42-17 3-19-3-17-57 6-274-307-57-389-190-12-19-29-35-38-35-17 0-405 306-429 337-18 45-13 96-13 143h89c53 0 93 4 96 11 17 26-154 157-166 161-21 7-9 351-19 361-2 2-126 29-135 5z"/>
<path id="path3" d="m2160 2555c-33-28-66-57-99-85h-291v-220c-128 0-96-128-264-96-55 11-143 173-159 203-19 41-119 33-154 30-6-12 122-252 133-313 15-96-132-130-195-242-71-133-240-162-302-284-36-70-25-84 51-64 48 12 64 25 154 118 149 155 126 148 509 148 174 0 317-4 317-8-60-67-112-142-162-217-114 4-177-83-246-158-101 14-134 18-207-65-166-201 173-364 249-110 15 49 125-85 110 18-4 24-16 149 202 141 134-3 172 4 180 35 13 52 26 48 147-43 117-90 232-183 347-276v-114c-58-3-122-7-177-17-3-3 26-33 63-68 136-125 121-89 123-288 1-96 4-176 6-179 114 63 135 89 135 210v109c78 11 169-18 244 9-43 65-109 118-166 172-24 285 101 312 274 482 81 84 115 36 169-32l291-6c34-35 60-64 56-116-12-117 80 11 122-61 123-230 398-46 238 129-66 74-63 73-127 73-88 2-151 93-211 150h-79c-93 0-94 3-111 83-25 121-96 113-50 137 14 8 116 10 328 8 355-3 350-2 442-101 150-161 142-154 194-161 138-22 24 143-103 180-112 52-233 185-363 398 58 114 136 224 172 347 0 10-40 6-112-12-75-20-186-386-387-204-48 42-86 37-94 107-8 55-7 111-7 166-106 3-213 5-319 7l-78 76c-6 74-9 151-18 227-18 20-336-347-376-369-60-30-362 398-379 371-15-25-20-173-20-225zm394-315c12 0 229 220 244 220 16 0 72-75 72-96 0-18-290-304-308-304-11 0-326 287-330 301-4 10 41 75 65 95 23 20 239-216 257-216zm-751-149c84-11 197-15 284-16 140-120 271-251 403-380-10-256-8-257-19-505 0-5-57 42-136 106-8 53-16 107-24 160-89 89-191 52-182 84 3 11 9 61 20 175 54 50 55 51 96 104-12 21-352-1-676 26 51 48 91 72 91 148-4 72 60 129 120 187 7 7 17-43 23-89zm1647-23c1-67-10-140 20-186 6-15 39-17 36-31-5-9-121-15-294-23-146-138-294-274-447-404-8-49 3-111-29-153-36-39-125-103-136-96-8 6-10 64-10 502 141 137 282 273 430 403 299-9 306-19 310 51 16 48 96-42 120-63z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

+2
View File
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="svg1" width="329.35" height="307.64" version="1.1" viewBox="0 0 329.35 307.64" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><g id="layer1" transform="translate(-779.42 -7.5519)"><path id="path9" transform="translate(429.83 -2.2682)" d="m647.8 18.2-1.9 3.5-45 0.1-36.5 42.6c-20.2-12.3-43-0.7-48.7 9.8-1 1.8-1.4 1.5-5.9-3.1-14.2-15-34.2-11.1-39.7-8.4-4.7 2.3-4.9 2.3-6.6 0.5-12.3-13.8-24.3-27.7-36.4-41.5l-44.3-0.1-2-3.2c-8.1-12.9-28.1-9.2-30.9 5.7-3.4 18.1 22.4 28.1 31.1 11.8l1.8-3.2h39.3l34 39c-2.7 5.4-6 10.6-7.3 16.6-0.5 3.2-1.4 4.3-4.8 6.3-5 3-9.2 7.1-13.5 11.1-10.6 0.1-23.9 1.6-25.6-12-0.4-14.2-13.9-20.4-24.7-14.7-11.9 6.3-11.7 24.3 0.4 30.1 4.2 2 10.8 2.1 14.5 0.2 7.5-3.9 4.9 7.4 21.5 7.4 6.2 0 6.9 0.2 6.2 1.8-1 13.1-3.6 10.8-10.2 38.8l-24.5 0.6-4.2-4.4c-11.8-12.6-29.6-5.5-29.6 10.5 0 16.3 20.2 24.6 31.3 8.1l2.9-4.3 24.2 0.6c5.7 25.5 10.2 17.2 7.7 27.1-1.9 18.1-6.8 13.4-21.7 13.4l-12 8.9c-27.2-8.2-33.1 21.6-18.3 29.1 11.7 6 24.9-1.8 24.9-14.6 0-5.1 0.1-5.4 4.7-8.9 6-5.1 14.3-3.3 21.6-3 5.3 9.6 12.3 18.6 24 20.1 9.1 1.2 4.4 5.9 14.5 18l-31.9 36.4h-30.6l-2.4-3.7c-6.3-9.5-21.8-10.7-28.7 1.3-8 14 7.1 29.9 21.3 23.5 3.8-1.7 9.5-7.2 9.5-9.2 12-1.6 24.4-0.9 36.5-0.9l17.4-20.1c14.3-16.5 17.8-20 19.5-19.6 20.4 5.4 32.4 0 45.7-14.6 2.9 3.8 17 20.1 39 14.8 6.9-1.7 7-1.7 8.7 0.3 11.2 13 22.5 26 33.7 39l36.2 0.1 2.4 3.8c9 14 32.2 8.1 30.7-10.4-1.5-18.4-23.8-19.2-30.8-7.9l-2.2 3.5h-30.7l-32-37.1c4.1-4.8 7.2-10 9.2-16 1.3-4.1 17 1.6 29.6-21.9 10.6-0.2 25.6-1.4 27.1 12.4 0 12.9 13.2 20.6 24.9 14.6 14.8-7.5 11.1-39.7-18.3-29.1-10.3-8.2-9.6-8.9-21.7-8.9-14.3 1.2-9.6-5.6-12.1-15.1-2.5-8.3 1.7-1.7 7.4-25.9h25.6l1.2 3c5.8 13.9 32 13.5 32-7.1 0-19.1-23.6-21.3-30.4-9.8l-1.7 2.9c-4.7-0.4-26.5 1.8-26.9-2.3 0-10.3-7.7-17.7-9-37.7 6.7 0 12.9 0.5 18.2-4.7 5.3-4 6.3-4.5 8-3.4 12.7 7.9 33.4-9.6 21.3-25.4-9.5-12.5-31.4-5.7-30.4 11.2-0.4 12.3-14.3 11.3-23.3 11.3-4.8-4.3-9.6-8.9-15.2-12.1-8.9-4.7-2.6-7.7-12.6-21.7 11.2-13 22.3-26.1 33.5-39.1h40l2 3.2c10 15.8 35.5 5.4 30.5-13.1-4.8-18-24-15.5-30.5-4.8zm-84.2 59.5c6.4 7.1 8.3 15.9 5.5 25.2-1.5 5.1-8.2 12.6-13.3 14.9-14.8 6.7-2.7-13.1-13.5-13.1-4.8 0-5.6 2-4.1 10.1 1.1 6.4 0.4 12.6-0.5 19 2.8 0 8.7 1.8 10.5-0.2 0.3-0.5 1.8-4 4.1-4.4 21.3-3.4 27.1-26.6 28-26.6 2.1 0 24.8 17.7 13.8 37.2-6.5-1.8-21.6-21.7-24.8-7.4 0 3.7 22.3 19.3 21.5 26.5-1 9.3 5.3 9.7 7.9 7.1 1.3-1.3 1.6-3.3 1.4-10 1.4-31.4 10.3 28.3-1.6 22.5-6.4-5.6-20-8.6-24.8-5.4-3.9 2.5-4.2 10.6 3.8 9.1 7.5-1.4 15.7 3.3 19.2 11 6.5 14.3 2.4 30.5-9.1 35.7-17.5 7.9-2.6-46.6-54.6-12.9-5.9 5.2-7.2 8.1-4.8 10.6 3.8 2.7 27.5-9.9 32.5-11.9 12.3 5.4 14.8 35-7.5 42.6-12.4 4.2-25.4-1.4-31.4-13.4-2.3-4.5-2.3-5-2.6-49.3v-84c0.4-23.8 1-26.2 7.6-33.1 9.3-9.7 26-11.8 36.8 0.2zm-55.3 163.3c-0.1 5.9-9.8 17.8-24.5 17.8-16.2 0-41.9-21.7-10.9-53.5 6.7 7.1 11.7 16.1 19.9 21.6 7.5 4.7 10.5-1.9 8.1-5.6-1-1.5-10.4-12.7-16.6-19.1 0.1-6.2 0-13.1 0-19.3-0.7 0-8.7-0.2-9 0-0.3 0.3-0.5 6.1-0.5 10-0.9 9.4-21.7 8.8-25.2 34.6-1.4 9.9-16.6-1-19.1-9.4-1.5-5.2-1.5-16.4 0-21.6 3.3-10.9 17.3-15.3 21.2-16.4-2.1-2.5-4.8-4.9-5.9-8.1 0-3.8-17.3 9.8-18.6 7.8-9.4-14.6 2.1-52.8 1.1-22.2-0.3 8.2 0.7 10.2 5 10.2 3.6 0 4.9-2.4 4.2-7.6-0.6-4.3 8.7-25.5 21.1-25.5-4-19.2-24 14.8-27-0.7-3.6-18.7 15.7-30.2 16.5-30.2 0.5 0 5.3 15.4 17.5 22.5 7.8 4.6 16.2 7.4 25.2 7.4-3.8-25.1 4.9-28.9-4.2-28.9-9 0-1.8 17.9-11.8 14.5-14.2-4.9-20.9-22.1-13.8-35.6 11.6-22.2 42.9-14.1 44.8 0.6z" fill="#a11b1b"/><path id="path2" transform="translate(429.83 -2.2682)" d="m461.3 217.7c-20-1-19-0.4-19-10.1 0-4.4 0.4-7.8 0.8-7.5s11.1 0.8 23.8 1.1c27.9 0.8 26.9 1.1 26.9-9.7v-7.3h-17.5c-25.1 0-30.4-2.1-33.7-13.4-2.4-8.1-1.5-24.5 1.5-29.4 4.3-6.9 7.7-8.1 25.1-8.9 9.7-0.4 15.7-0.6 39 0.5v15.7h-18.9c-18.3 0-23.6 0.7-25.3 3.3-1.3 2-0.9 10.2 0.6 12.2 3.5 4.8 31.3-0.3 41.5 5.4 6.9 3.8 7.9 8.6 8.3 21.4 0.4 12.6-0.2 17.1-4.4 21.4-6.1 6.2-12.7 6.9-48.9 5.1zm78.9-0.7c0.5-22.6-0.3-45.2-0.4-67.8l-25.5 0.2v-17.2h72.5l0.6 16.4-25.6 0.6c-0.5 22.2 0.5 45.5-0.3 67.8-0.3 3.3-21.3 2.3-21.3 0z" fill="#fff"/></g></svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

+1
View File
@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Minimax</title><path d="M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z"></path></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

+2 -60
View File
@@ -1,60 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="8.2832384mm"
height="9.4351206mm"
viewBox="0 0 8.2832384 9.4351206"
version="1.1"
id="svg1"
xml:space="preserve"
inkscape:version="1.3 (0e150ed, 2023-07-21)"
sodipodi:docname="scale.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="1.0289025"
inkscape:cx="8.7471843"
inkscape:cy="8.2612296"
inkscape:window-width="1280"
inkscape:window-height="688"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" /><defs
id="defs1" /><g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-88.746886,-143.1532)"><g
id="g1"
transform="matrix(0.26458333,0,0,0.26458333,88.077577,143.1532)"><path
d="m 14.3423,8.42148 0.0218,-0.00723 2.1725,-0.51502 c 0.4642,-0.10879 0.8631,-0.40619 1.1025,-0.81965 l 0.5041,-0.87044 0.0146,-0.02902 0.0145,0.02902 0.5041,0.87044 c 0.2394,0.41346 0.6383,0.71086 1.1025,0.81965 l 2.1725,0.51502 0.0254,0.01087 H 21.9514 L 19.7789,8.94737 C 19.3147,9.0562 18.9158,9.35359 18.6764,9.76705 l -0.5041,0.87045 -0.0145,0.029 -0.0146,-0.029 -0.5041,-0.87045 C 17.3997,9.35359 17.0008,9.0562 16.5366,8.94737 L 14.3641,8.43239 14.3423,8.42512 Z"
id="path10" /><path
d="M 14.3423,2.245 14.3641,2.23775 16.5366,1.72274 C 17.0008,1.61393 17.3997,1.31653 17.6391,0.903078 L 18.1432,0.0290146 18.1578,0 18.1723,0.0290146 18.6764,0.899453 C 18.9158,1.31291 19.3147,1.61031 19.7789,1.71911 L 21.9514,2.23412 21.9768,2.245 H 21.9514 L 19.7789,2.76726 C 19.3147,2.87607 18.9158,3.17347 18.6764,3.58692 L 18.1723,4.45738 18.1578,4.48639 18.1432,4.45738 17.6391,3.58692 C 17.3997,3.17347 17.0008,2.87607 16.5366,2.76726 L 14.3641,2.25225 Z"
id="path11" /><path
d="M 18.183,15.7998 C 17.9328,13.7832 16.754,11.9807 14.9697,10.9507 11.749,9.03938 8.96364,8.82176 6.23265,6.73999 L 2.52967,8.79638 18.183,17.8344 33.8364,8.79638 30.1334,6.74359 c -2.731,2.08181 -5.5164,2.29943 -8.737,4.21071 -1.7844,1.0301 -2.9631,2.8326 -3.2134,4.8491 z"
id="path12" /><path
d="M 18.183,35.6603 C 17.824,35.653 17.4649,35.5551 17.1458,35.3701 L 2.52967,26.9269 V 8.79646 L 17.1458,17.236 c 0.3227,0.185 0.6782,0.2829 1.0372,0.2902 0.3591,-0.0073 0.7181,-0.1052 1.0373,-0.2902 L 33.8364,8.79646 V 26.9306 l -14.6161,8.4395 c -0.3228,0.185 -0.6782,0.2829 -1.0373,0.2902 z"
id="path13" /><path
d="m 18.183,35.6603 c 0.3591,-0.0073 0.7181,-0.1052 1.0373,-0.2902 l 14.616,-8.4395 V 8.79646 L 19.2203,17.236 c -0.3228,0.185 -0.6782,0.2829 -1.0373,0.2902"
id="path14" /><path
d="M 18.183,17.5262 C 17.824,17.5189 17.4649,17.421 17.1458,17.236 L 2.52967,8.79646 V 26.9306 l 14.61613,8.4395 c 0.3227,0.185 0.6782,0.2829 1.0372,0.2902"
id="path15" /><path
d="M 18.1831,17.5262 C 17.824,17.5189 17.465,17.421 17.1458,17.236 l -1.4507,-0.8378 v 18.1341 l 1.4507,0.8378 c 0.3228,0.185 0.6782,0.2829 1.0373,0.2902 0.359,-0.0073 0.7181,-0.1052 1.0372,-0.2902 l 1.4508,-0.8378 V 16.3946 l -1.4508,0.8378 c -0.3227,0.1849 -0.6782,0.2829 -1.0372,0.2901 z"
id="path16" /><path
d="M 9,5.32055 9.02174,5.31328 11.1942,4.79826 c 0.4643,-0.10879 0.8632,-0.40618 1.1026,-0.81964 l 0.5041,-0.87044 0.0145,-0.02902 0.0145,0.02902 0.5041,0.87044 c 0.2394,0.41346 0.6384,0.71085 1.1026,0.81964 l 2.1725,0.51502 0.0253,0.01087 H 16.6091 L 14.4366,5.84644 C 13.9724,5.95523 13.5734,6.25263 13.334,6.66609 L 12.8299,7.53653 12.8154,7.56555 12.8009,7.53653 12.2968,6.66609 C 12.0574,6.25263 11.6585,5.95523 11.1942,5.84644 L 9.02174,5.33142 9,5.32415 Z"
id="path17" /><path
d="m 19.6593,5.32055 0.0218,-0.00727 2.1724,-0.51502 c 0.4642,-0.10879 0.8632,-0.40618 1.1026,-0.81964 l 0.5041,-0.87044 0.0145,-0.02902 0.0145,0.02902 0.5042,0.87044 c 0.2393,0.41346 0.6383,0.71085 1.1025,0.81964 l 2.1724,0.51502 0.0255,0.01087 H 27.2683 L 25.0959,5.84644 C 24.6317,5.95523 24.2327,6.25263 23.9934,6.66609 L 23.4892,7.53653 23.4747,7.56555 23.4602,7.53653 22.9561,6.66609 C 22.7167,6.25263 22.3177,5.95523 21.8535,5.84644 L 19.6811,5.33142 19.6593,5.32415 Z"
id="path18" /></g></g></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg id="svg1" width="8.28mm" height="9.4349mm" version="1.1" viewBox="0 0 8.28 9.4349" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path id="path9" d="m4.14 0c-0.05 0.08-0.1 0.16-0.14 0.24-0.07 0.11-0.17 0.19-0.29 0.22-0.2 0.04-0.39 0.09-0.58 0.13 0.19 0.05 0.38 0.1 0.58 0.14 0.12 0.03 0.22 0.11 0.29 0.22 0.04 0.08 0.09 0.16 0.14 0.24 0.04-0.08 0.09-0.16 0.13-0.24 0.07-0.11 0.17-0.19 0.29-0.22 0.2-0.04 0.39-0.09 0.59-0.14-0.2-0.04-0.39-0.09-0.59-0.14-0.12-0.02-0.22-0.1-0.29-0.21-0.04-0.08-0.09-0.16-0.13-0.24zm-1.42 0.81c-0.04 0.08-0.09 0.16-0.14 0.24-0.06 0.11-0.16 0.19-0.29 0.22-0.19 0.05-0.38 0.09-0.58 0.14 0.19 0.05 0.39 0.09 0.58 0.14 0.12 0.03 0.23 0.11 0.29 0.22 0.05 0.08 0.09 0.16 0.14 0.24 0.05-0.09 0.09-0.17 0.14-0.25 0.06-0.11 0.17-0.18 0.29-0.21 0.19-0.05 0.39-0.1 0.58-0.14-0.19-0.05-0.39-0.09-0.58-0.14-0.12-0.03-0.23-0.11-0.29-0.22-0.05-0.08-0.09-0.16-0.14-0.24zm2.82 0c-0.04 0.08-0.09 0.16-0.14 0.24-0.06 0.11-0.16 0.19-0.29 0.22-0.19 0.05-0.38 0.09-0.58 0.14 0.19 0.05 0.39 0.09 0.58 0.14 0.12 0.03 0.23 0.11 0.29 0.22 0.05 0.08 0.09 0.16 0.14 0.24 0.05-0.09 0.09-0.17 0.14-0.25 0.06-0.11 0.17-0.18 0.29-0.21 0.19-0.05 0.39-0.1 0.58-0.14-0.19-0.05-0.39-0.09-0.58-0.14-0.12-0.03-0.23-0.11-0.29-0.22-0.05-0.08-0.09-0.16-0.14-0.24zm-1.4 0.83c-0.05 0.07-0.1 0.15-0.14 0.23-0.07 0.11-0.17 0.19-0.29 0.22-0.2 0.05-0.39 0.09-0.58 0.14 0.19 0.05 0.39 0.09 0.58 0.14 0.12 0.03 0.23 0.11 0.29 0.22 0.05 0.08 0.09 0.16 0.14 0.24 0.04-0.09 0.09-0.17 0.13-0.25 0.07-0.11 0.17-0.18 0.29-0.21 0.2-0.05 0.39-0.1 0.59-0.14-0.2-0.05-0.39-0.09-0.59-0.14-0.12-0.03-0.22-0.11-0.29-0.22-0.04-0.08-0.09-0.16-0.13-0.23zm-3.16 0.14-0.98 0.55v4.8c1.29 0.74 2.58 1.49 3.87 2.23 0.25 0.14 0.46 0.05 0.55 0 1.29-0.75 2.57-1.49 3.86-2.23v-4.8l-0.98-0.55c-1.11 0.86-2.96 0.79-3.16 2.4-0.2-1.61-2.04-1.55-3.16-2.4z"/></svg>

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

+6 -87
View File
@@ -1,88 +1,7 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="1280.000000pt" height="1217.000000pt" viewBox="0 0 1280.000000 1217.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.15, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,1217.000000) scale(0.100000,-0.100000)" stroke="none">
<path d="M7704 12160 c-84 -17 -256 -71 -307 -96 -186 -94 -274 -202 -399
-492 -32 -74 -72 -152 -90 -175 -80 -100 -141 -163 -211 -215 -41 -32 -145
-120 -232 -197 -228 -203 -324 -268 -491 -331 -160 -60 -436 -92 -899 -104
-428 -11 -478 -15 -585 -50 -499 -163 -1061 -520 -1543 -979 l-78 -75 -100 49
c-54 27 -99 52 -99 55 0 3 35 46 77 95 131 154 287 370 387 537 77 130 96 168
96 200 0 36 -2 38 -25 32 -15 -4 -39 0 -60 10 -29 14 -42 15 -77 5 -147 -39
-405 -230 -705 -523 -79 -76 -143 -136 -143 -132 0 3 37 49 81 102 45 54 132
165 195 248 64 86 132 166 159 186 95 72 107 84 129 129 13 25 33 91 45 146
12 55 29 120 38 144 22 59 11 76 -53 78 -27 0 -63 4 -80 8 -23 5 -44 0 -85
-20 -78 -39 -264 -232 -441 -455 -80 -102 -192 -243 -249 -315 -135 -171 -213
-258 -273 -306 -57 -46 -91 -50 -108 -14 -16 35 15 222 42 250 10 11 35 65 54
120 19 55 69 182 110 283 42 100 75 186 74 190 -1 4 4 25 11 46 14 39 12 113
-5 328 l-7 77 -72 6 c-80 8 -99 2 -153 -49 -101 -93 -192 -314 -302 -728 -110
-413 -138 -498 -195 -589 -13 -20 -79 -99 -145 -175 -206 -235 -338 -412 -628
-844 -188 -278 -318 -656 -353 -1020 -16 -171 -1 -459 33 -638 9 -50 15 -62
29 -60 11 2 31 -19 60 -62 60 -88 105 -118 205 -134 140 -22 189 -10 460 118
49 24 131 68 182 99 51 31 92 51 92 44 0 -7 -34 -185 -75 -396 l-74 -383 41
-67 c23 -36 53 -82 67 -101 l25 -35 -33 30 c-51 46 -34 16 56 -98 105 -132
471 -492 628 -618 130 -105 509 -381 670 -489 384 -257 905 -493 1135 -515 49
-4 137 -27 255 -65 192 -63 338 -106 475 -140 47 -11 92 -23 99 -26 23 -8 -73
-49 -282 -120 -492 -168 -840 -315 -1062 -447 -330 -197 -432 -274 -532 -403
-27 -35 -57 -53 -210 -124 -124 -57 -199 -86 -248 -95 -118 -21 -186 -60 -221
-127 -14 -28 -17 -124 -5 -168 4 -15 1 -43 -10 -70 -19 -51 -16 -70 11 -70 14
0 21 -10 25 -37 4 -21 12 -49 18 -63 21 -43 179 -193 257 -243 41 -27 134 -87
205 -133 209 -137 484 -268 770 -367 55 -19 163 -62 240 -94 77 -33 201 -81
275 -107 74 -27 191 -68 260 -93 179 -65 382 -113 721 -172 271 -47 301 -50
350 -40 36 8 116 10 239 6 276 -8 386 -41 584 -172 53 -35 153 -111 222 -169
145 -121 277 -222 384 -293 143 -96 584 -356 659 -390 42 -19 87 -40 101 -48
14 -7 41 -16 62 -20 45 -9 93 23 107 69 5 17 12 39 16 49 5 12 2 17 -8 17 -8
0 -29 21 -45 47 -30 46 -189 207 -322 326 l-65 59 63 -47 c34 -26 110 -92 168
-147 93 -89 129 -111 129 -82 0 5 4 16 9 23 7 11 -13 36 -81 100 -108 103
-189 162 -433 316 -185 117 -268 185 -336 277 -19 25 -39 60 -45 78 -10 27 -9
34 10 54 27 28 108 40 386 57 219 13 1193 2 1213 -13 27 -22 132 15 132 46 0
8 -16 33 -35 56 -19 23 -35 50 -35 60 0 18 -46 35 -55 19 -3 -4 -31 1 -63 12
-149 52 -318 76 -737 105 -235 16 -261 16 -435 1 -102 -10 -214 -17 -250 -17
-114 0 -360 70 -360 103 0 16 32 46 80 75 45 26 325 127 407 146 34 8 75 23
90 34 60 42 161 85 358 152 235 80 316 118 406 190 81 65 86 74 65 117 -9 18
-16 44 -16 57 l0 23 -162 -3 c-129 -1 -190 -7 -295 -28 -222 -44 -459 -119
-758 -238 -238 -95 -287 -112 -425 -144 -169 -38 -325 -50 -487 -36 -76 7
-160 18 -188 26 l-50 13 28 12 c16 6 30 11 32 11 12 0 345 143 470 202 332
157 506 266 675 420 l73 67 -12 55 c-7 31 -20 65 -29 76 -101 125 -621 -82
-1438 -572 -133 -80 -241 -138 -256 -138 -49 0 -615 99 -802 140 -252 56 -364
92 -411 135 -20 19 -45 37 -56 40 -21 7 -24 32 -6 56 22 29 245 92 467 133 47
8 213 36 370 61 476 76 694 134 917 244 131 65 236 136 357 244 45 40 140 120
211 178 161 132 280 255 324 339 33 62 34 65 28 156 -5 80 -10 102 -38 155
-31 58 -117 153 -186 206 -18 14 -116 65 -219 114 -243 116 -360 193 -504 333
-188 183 -293 261 -565 422 -82 48 -171 105 -198 125 l-47 38 42 5 c24 3 111
12 193 21 493 52 979 180 1545 407 263 106 500 246 735 435 126 101 364 329
502 482 101 111 328 407 426 556 40 61 57 80 53 60 -125 -518 -151 -1060 -65
-1343 25 -80 96 -214 139 -262 18 -19 27 -27 20 -17 -7 9 -10 17 -8 17 3 0 43
-25 89 -55 171 -113 412 -161 1029 -206 451 -32 470 -33 734 -14 271 19 415
17 541 -10 110 -23 118 -29 72 -51 -41 -20 -43 -23 -24 -47 10 -14 18 -14 53
-5 34 9 53 8 105 -6 90 -25 320 -118 479 -193 230 -110 431 -199 535 -238 124
-46 312 -95 385 -99 30 -2 83 -9 117 -17 61 -13 62 -13 65 -48 2 -30 7 -37 28
-39 51 -8 174 54 178 89 1 8 5 31 8 51 5 28 1 46 -16 72 -82 134 -460 330
-1014 527 -140 50 -173 65 -155 70 96 28 461 151 584 196 326 121 639 263 813
371 42 26 99 58 125 71 114 55 208 178 193 251 -9 45 -55 100 -101 121 -162
74 -676 -86 -1330 -413 -73 -37 -114 -53 -105 -42 8 11 56 66 105 124 50 58
110 130 135 160 65 82 184 203 275 280 76 64 84 74 145 194 54 107 65 136 68
190 6 87 -5 103 -73 111 -67 9 -106 -5 -219 -76 -219 -139 -550 -418 -1035
-873 l-223 -210 -114 38 c-63 20 -114 39 -114 40 0 2 14 34 31 72 18 38 61
139 96 224 36 85 80 191 98 235 19 44 41 121 50 170 9 50 25 132 36 183 10 51
19 108 19 128 0 45 -23 100 -48 113 -32 17 -92 13 -127 -9 -111 -69 -302 -428
-489 -918 -22 -56 -32 -72 -45 -68 -53 17 -275 68 -386 90 -242 47 -310 55
-500 60 -119 3 -209 10 -240 19 -107 30 -209 104 -164 119 16 5 -5 45 -43 80
-32 30 -33 46 -14 140 25 118 65 191 296 548 48 74 101 169 118 210 16 41 50
125 76 185 84 204 97 320 50 450 -40 112 -41 105 27 155 85 63 378 365 475
490 101 130 244 343 354 526 46 76 124 201 172 278 49 76 100 166 114 200 28
66 55 121 281 566 218 431 289 627 323 890 6 47 18 125 27 173 14 75 14 101 4
165 -19 128 -101 273 -210 375 -28 26 -51 50 -51 52 0 3 14 5 30 5 17 0 30 3
30 8 -1 22 -136 101 -289 167 -216 95 -278 115 -466 153 -304 63 -465 66 -712
13 -355 -76 -560 -80 -928 -16 -304 53 -410 63 -501 45z m2941 -1516 c-15 -49
-44 -132 -67 -184 -59 -140 -200 -441 -204 -437 -2 2 28 75 66 162 69 155 185
443 210 518 24 75 20 29 -5 -59z m-3225 -9228 c92 -8 187 -23 215 -32 l50 -18
-35 -7 c-87 -19 -329 -31 -406 -21 -443 60 -615 88 -588 94 48 12 586 0 764
-16z"/>
</g>
<?xml version="1.0" encoding="UTF-8"?>
<svg id="svg1" width="1281.8pt" height="1215.8pt" preserveAspectRatio="xMidYMid" version="1.0" viewBox="0 0 1281.8 1215.8" xmlns="http://www.w3.org/2000/svg">
<metadata id="metadata1">Created by potrace 1.15, written by Peter Selinger 2001-2017</metadata>
<g id="g1" transform="matrix(.1 0 0 -.1 1.9156 1216.5)">
<path id="path1" d="m6998 11572c-96-258-333-414-533-587-370-329-494-412-1390-435-874 36-1595-534-2206-1104-62 39-142 56-199 104 0 9 262 294 464 632 74 121 192 285-66 247-417-111-1220-1151-572-305 100 137 564 539 318 683-471 46-1109-1370-1236-1102 23 505 514 977 207 1300-445 44-287-954-795-1541-1448-1651-1018-2700-654-2758 335-53 734 316 734 261 0-180-204-689-108-846 752-1155 2134-1636 3377-2057 99-35-1443-411-1876-970-121-157-587-192-679-346-256-719 2022-1610 3117-1657 812 100 1428-660 2088-1018 130-59 213-134 286 50-220 493-1110 853-956 1021 132 137 1731-15 1731 90 0 8-16 33-35 56-357 414-1665-11-1935 283 0 119 972 340 1341 597 121 97 56 186-113 194-574-4-1043-309-1478-410-184-41-447-69-725 3 83 35 240 88 530 225 448 212 563 317 748 487-10 44-16 92-41 131-101 125-621-82-1438-572-133-80-241-138-256-138-49 0-615 99-802 140-338 75-525 153-473 231 22 29 245 92 467 133 435 77 883 115 1287 305 216 102 386 272 568 422 257 211 446 400 314 650-170 319-510 265-909 653-388 377-556 379-810 585 78 10 157 17 235 26 2709 261 3344 2357 3261 1940-125-518-151-1060-65-1343 200-639 1746-555 2003-537 674 40 1167-320 1761-550 726-269 856-137 765 9-161 263-1223 582-1169 597 508 133 2142 769 1614 1010-297 136-1465-492-1435-455 91 57 965 1014 655 1059-597-178-1028-736-1477-1159-75 29-155 45-228 78 0 20 239 507 275 701 27 105 141 556-120 415-211-131-498-997-534-986-290 78-585 141-886 150-236-1-496 47-461 358 71 337 157 167 490 943 217 528-107 470 77 605 459 340 1060 1370 1115 1494 351 733 1106 1835 145 2401-1027 452-1067-31-2106 150-558 97-937 83-1207-543z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

+9
View File
@@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="64" height="64">
<path d="M8.16 23h21.177v-5.86l-4.023-2.307-.694-.3-16.46.113z" fill="none" />
<path
d="M22.012 22.222c.197-.675.122-1.294-.206-1.754-.3-.422-.807-.666-1.416-.694l-11.545-.15c-.075 0-.14-.038-.178-.094s-.047-.13-.028-.206c.038-.113.15-.197.272-.206l11.648-.15c1.38-.066 2.88-1.182 3.404-2.55l.666-1.735a.38.38 0 0 0 .02-.225c-.75-3.395-3.78-5.927-7.4-5.927-3.34 0-6.17 2.157-7.184 5.15-.657-.488-1.5-.75-2.392-.666-1.604.16-2.9 1.444-3.048 3.048a3.58 3.58 0 0 0 .084 1.191A4.84 4.84 0 0 0 0 22.1c0 .234.02.47.047.703.02.113.113.197.225.197H21.58a.29.29 0 0 0 .272-.206l.16-.572z"
/>
<path
d="M25.688 14.803l-.32.01c-.075 0-.14.056-.17.13l-.45 1.566c-.197.675-.122 1.294.206 1.754.3.422.807.666 1.416.694l2.457.15c.075 0 .14.038.178.094s.047.14.028.206c-.038.113-.15.197-.272.206l-2.56.15c-1.388.066-2.88 1.182-3.404 2.55l-.188.478c-.038.094.028.188.13.188h8.797a.23.23 0 0 0 .225-.169A6.41 6.41 0 0 0 32 21.106a6.32 6.32 0 0 0-6.312-6.302"
/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

+294 -230
View File
@@ -697,7 +697,7 @@
</span>
</div>
</div>
<div class="range-block" data-source="openai,claude,aimlapi,openrouter,ai21,makersuite,vertexai,mistralai,custom,cohere,perplexity,groq,siliconflow,electronhub,chutes,nanogpt,deepseek,xai,pollinations,moonshot,fireworks,cometapi,azure_openai,zai">
<div class="range-block" data-source="openai,claude,aimlapi,openrouter,ai21,makersuite,vertexai,mistralai,custom,cohere,perplexity,groq,siliconflow,minimax,electronhub,chutes,nanogpt,deepseek,xai,pollinations,moonshot,fireworks,cometapi,azure_openai,zai,workers_ai">
<div class="range-block-title" data-i18n="Temperature">
Temperature
</div>
@@ -710,7 +710,7 @@
</div>
</div>
</div>
<div class="range-block" data-source="openai,aimlapi,openrouter,custom,cohere,perplexity,groq,siliconflow,mistralai,electronhub,nanogpt,deepseek,xai,pollinations,moonshot,fireworks,cometapi,azure_openai,chutes">
<div class="range-block" data-source="openai,aimlapi,openrouter,custom,cohere,perplexity,groq,siliconflow,mistralai,electronhub,nanogpt,deepseek,xai,pollinations,moonshot,fireworks,cometapi,azure_openai,chutes,workers_ai">
<div class="range-block-title" data-i18n="Frequency Penalty">
Frequency Penalty
</div>
@@ -723,7 +723,7 @@
</div>
</div>
</div>
<div class="range-block" data-source="openai,aimlapi,openrouter,custom,cohere,perplexity,groq,siliconflow,mistralai,electronhub,nanogpt,deepseek,xai,pollinations,moonshot,fireworks,cometapi,azure_openai,chutes">
<div class="range-block" data-source="openai,aimlapi,openrouter,custom,cohere,perplexity,groq,siliconflow,mistralai,electronhub,nanogpt,deepseek,xai,pollinations,moonshot,fireworks,cometapi,azure_openai,chutes,workers_ai">
<div class="range-block-title" data-i18n="Presence Penalty">
Presence Penalty
</div>
@@ -736,7 +736,7 @@
</div>
</div>
</div>
<div class="range-block" data-source="claude,aimlapi,openrouter,makersuite,vertexai,cohere,perplexity,electronhub,chutes,nanogpt">
<div class="range-block" data-source="claude,aimlapi,openrouter,makersuite,vertexai,cohere,perplexity,electronhub,chutes,nanogpt,workers_ai">
<div class="range-block-title" data-i18n="Top K">
Top K
</div>
@@ -749,7 +749,7 @@
</div>
</div>
</div>
<div class="range-block" data-source="openai,claude,aimlapi,openrouter,ai21,makersuite,vertexai,mistralai,custom,cohere,perplexity,groq,siliconflow,electronhub,chutes,nanogpt,deepseek,xai,pollinations,moonshot,fireworks,cometapi,azure_openai,zai">
<div class="range-block" data-source="openai,claude,aimlapi,openrouter,ai21,makersuite,vertexai,mistralai,custom,cohere,perplexity,groq,siliconflow,minimax,electronhub,chutes,nanogpt,deepseek,xai,pollinations,moonshot,fireworks,cometapi,azure_openai,zai,workers_ai">
<div class="range-block-title" data-i18n="Top P">
Top P
</div>
@@ -762,7 +762,7 @@
</div>
</div>
</div>
<div class="range-block" data-source="openrouter,nanogpt,chutes">
<div class="range-block" data-source="openrouter,nanogpt,chutes,workers_ai">
<div class="range-block-title" data-i18n="Repetition Penalty">
Repetition Penalty
</div>
@@ -809,18 +809,21 @@
<div class="inline-drawer-content">
<div class="range-block m-t-1">
<div class="justifyLeft" data-i18n="Main">Main</div>
<i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="main_prompt_quick_edit_textarea" data-i18n="[title]Expand the editor"></i>
<div class="wide100p">
<textarea id="main_prompt_quick_edit_textarea" class="text_pole textarea_compact autoSetHeight" rows="6" placeholder="&mdash;" data-pm-prompt="main"></textarea>
</div>
</div>
<div class="range-block m-t-1">
<div class="justifyLeft" data-i18n="Auxiliary">Auxiliary</div>
<i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="nsfw_prompt_quick_edit_textarea" data-i18n="[title]Expand the editor"></i>
<div class="wide100p">
<textarea id="nsfw_prompt_quick_edit_textarea" class="text_pole textarea_compact autoSetHeight" rows="6" placeholder="&mdash;" data-pm-prompt="nsfw"></textarea>
</div>
</div>
<div class="range-block m-t-1">
<div class="justifyLeft" data-i18n="Post-History Instructions">Post-History Instructions</div>
<i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="jailbreak_prompt_quick_edit_textarea" data-i18n="[title]Expand the editor"></i>
<div class="wide100p">
<textarea id="jailbreak_prompt_quick_edit_textarea" class="text_pole textarea_compact autoSetHeight" rows="6" placeholder="&mdash;" data-pm-prompt="jailbreak"></textarea>
</div>
@@ -986,7 +989,7 @@
</div>
</div>
</div>
<div class="range-block" data-source="openai,openrouter,mistralai,custom,cohere,groq,electronhub,chutes,nanogpt,xai,pollinations,aimlapi,makersuite,vertexai,azure_openai">
<div class="range-block" data-source="openai,openrouter,mistralai,custom,cohere,groq,electronhub,chutes,nanogpt,xai,pollinations,aimlapi,makersuite,vertexai,azure_openai,workers_ai">
<div class="range-block-title justifyLeft" data-i18n="Seed">
Seed
</div>
@@ -1269,8 +1272,8 @@
<span data-i18n="Top K">Top K</span>
<div class="fa-solid fa-circle-info opacity50p" title="Top K sets a maximum amount of top tokens that can be chosen from.&#13;E.g Top K is 20, this means only the 20 highest ranking tokens will be kept (regardless of their probabilities being diverse or limited).&#13;Set to 0 (or -1, depending on your backend) to disable." data-i18n="[title]Top_K_desc"></div>
</small>
<input class="neo-range-slider" type="range" id="top_k_textgenerationwebui" name="volume" min="-1" max="200" step="1">
<input class="neo-range-input" type="number" min="-1" max="200" step="1" data-for="top_k_textgenerationwebui" id="top_k_counter_textgenerationwebui">
<input class="neo-range-slider" type="range" id="top_k_textgenerationwebui" name="volume" min="-1" max="500" step="1">
<input class="neo-range-input" type="number" min="-1" max="500" step="1" data-for="top_k_textgenerationwebui" id="top_k_counter_textgenerationwebui">
</div>
<div data-tg-samplers="top_p" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
<small>
@@ -1400,7 +1403,7 @@
<input class="neo-range-input" type="number" min="0" max="20" step="1" data-for="max_tokens_second_textgenerationwebui" id="max_tokens_second_counter_textgenerationwebui">
</div>
<div data-tg-type="koboldcpp, llamacpp, tabby" id="adaptive_p_block" class="wide100p">
<div data-tg-type="koboldcpp, llamacpp, ooba, tabby" id="adaptive_p_block" class="wide100p">
<h4 class="wide100p textAlignCenter">
<label data-i18n="Adaptive-P">Adaptive-P</label>
<a href="https://github.com/MrJackSpade/adaptive-p-docs" target="_blank">
@@ -1831,6 +1834,7 @@
<div data-name="tfs" draggable="true"><span>Tail Free Sampling</span><small></small></div>
<div data-name="top_a" draggable="true"><span>Top A</span><small></small></div>
<div data-name="min_p" draggable="true"><span>Min P</span><small></small></div>
<div data-name="adaptive_p" draggable="true"><span>Adaptive-P</span><small></small></div>
<div data-name="mirostat" draggable="true"><span>Mirostat</span><small></small></div>
<div data-name="xtc" draggable="true"><span>XTC</span><small></small></div>
<div data-name="encoder_repetition_penalty" draggable="true"><span>Encoder Repetition Penalty</span><small></small></div>
@@ -1996,7 +2000,7 @@
</b>
</div>
</div>
<div class="range-block" data-source="openai,cohere,mistralai,custom,claude,aimlapi,openrouter,groq,siliconflow,deepseek,makersuite,vertexai,ai21,xai,pollinations,moonshot,fireworks,cometapi,electronhub,chutes,azure_openai,zai,nanogpt">
<div class="range-block" data-source="openai,cohere,mistralai,custom,claude,aimlapi,openrouter,groq,siliconflow,minimax,deepseek,makersuite,vertexai,ai21,xai,pollinations,moonshot,fireworks,cometapi,electronhub,chutes,azure_openai,zai,nanogpt,workers_ai">
<label for="openai_function_calling" class="checkbox_label flexWrap widthFreeExpand">
<input id="openai_function_calling" type="checkbox" />
<span data-i18n="Enable function calling">Enable function calling</span>
@@ -2010,8 +2014,22 @@
<span data-i18n="enable_functions_desc_3">Can be utilized by various extensions to provide additional functionality.</span>
<strong data-i18n="enable_functions_desc_4">Not supported when Prompt Post-Processing with "no tools" is used!</strong>
</div>
<div id="tool_call_recurse_limit_block" class="range-block wide100p">
<div class="range-block-title">
<small data-i18n="Tool Call Recurse Limit">Tool Call Recurse Limit</small>
<div class="fa-solid fa-circle-info opacity50p margin5" data-i18n="[title]Maximum number of tool call recursion steps per generation." title="Maximum number of tool call recursion steps per generation."></div>
</div>
<div class="range-block-range-and-counter">
<div class="range-block-range">
<input type="range" id="tool_call_recurse_limit" name="tool_call_recurse_limit" min="1" max="50" step="1">
</div>
<div class="range-block-counter">
<input type="number" min="1" max="50" step="1" data-for="tool_call_recurse_limit" id="tool_call_recurse_limit_counter">
</div>
</div>
</div>
</div>
<div class="range-block" data-source="openrouter">
<div class="range-block" data-source="openrouter,custom">
<div class="flex-container flexFlowColumn wide100p textAlignCenter marginTop10">
<div class="flex-container oneline-dropdown">
<label for="tool_reasoning_mode" data-i18n="Interleaved Thinking">
@@ -2035,7 +2053,7 @@
</em>
</div>
</div>
<div class="range-block" data-source="openai,aimlapi,openrouter,mistralai,makersuite,vertexai,claude,custom,xai,pollinations,moonshot,cohere,cometapi,nanogpt,electronhub,azure_openai,zai,siliconflow,chutes">
<div class="range-block" data-source="openai,aimlapi,openrouter,mistralai,makersuite,vertexai,claude,custom,xai,pollinations,moonshot,cohere,cometapi,nanogpt,electronhub,azure_openai,zai,siliconflow,chutes,workers_ai">
<label for="openai_media_inlining" class="checkbox_label flexWrap widthFreeExpand">
<input id="openai_media_inlining" type="checkbox" />
<span data-i18n="Send inline media">Send inline media</span>
@@ -2059,7 +2077,7 @@
<strong data-source="makersuite,vertexai" data-i18n="video_inlining_hint_4">Videos must be less than 20 MB and under 1 minute long.</strong>
<strong data-source="makersuite,vertexai" data-i18n="audio_inlining_hint_2">Audio must be less than 20 MB.</strong>
</div>
<div class="flex-container flexFlowColumn wide100p textAlignCenter marginTop10" data-source="openai,custom,xai,pollinations,cohere,cometapi,nanogpt,moonshot,aimlapi,openrouter,mistralai,electronhub,azure_openai,zai,siliconflow,chutes,makersuite,vertexai">
<div class="flex-container flexFlowColumn wide100p textAlignCenter marginTop10" data-source="openai,custom,xai,pollinations,cohere,cometapi,nanogpt,moonshot,aimlapi,openrouter,mistralai,electronhub,azure_openai,zai,siliconflow,chutes,makersuite,vertexai,workers_ai">
<div class="flex-container oneline-dropdown">
<label for="openai_inline_image_quality" data-i18n="Inline Image Quality">
Inline Image Quality
@@ -2120,7 +2138,7 @@
</div>
</div>
</div>
<div class="range-block" data-source="deepseek,aimlapi,openrouter,custom,claude,xai,makersuite,vertexai,pollinations,moonshot,mistralai,fireworks,cometapi,electronhub,chutes,azure_openai,nanogpt,zai">
<div class="range-block" data-source="deepseek,aimlapi,openrouter,custom,claude,xai,makersuite,vertexai,pollinations,moonshot,mistralai,fireworks,cometapi,electronhub,chutes,azure_openai,nanogpt,zai,workers_ai">
<label for="openai_show_thoughts" class="checkbox_label widthFreeExpand">
<input id="openai_show_thoughts" type="checkbox" />
<span data-i18n="Request model reasoning">Request model reasoning</span>
@@ -2129,12 +2147,15 @@
<span data-i18n="Allows the model to return its thinking process.">
Allows the model to return its thinking process.
</span>
<strong data-i18n="This setting affects visibility only." data-source-mode="except" data-source="zai,moonshot,openrouter">
<strong data-i18n="This setting enables or disables reasoning generation by the model." data-source="deepseek,zai,moonshot">
This setting enables or disables reasoning generation by the model.
</strong>
<strong data-i18n="This setting affects visibility only." data-source-mode="except" data-source="zai,moonshot,openrouter,deepseek">
This setting affects visibility only.
</strong>
</div>
</div>
<div class="flex-container flexFlowColumn wide100p textAlignCenter marginTop10" data-source="openai,custom,claude,xai,makersuite,vertexai,aimlapi,openrouter,pollinations,perplexity,cometapi,electronhub,azure_openai,chutes,nanogpt">
<div class="flex-container flexFlowColumn wide100p textAlignCenter marginTop10" data-source="openai,custom,claude,xai,makersuite,vertexai,aimlapi,openrouter,pollinations,perplexity,cometapi,electronhub,azure_openai,chutes,nanogpt,deepseek,fireworks">
<div class="flex-container oneline-dropdown" title="Constrains effort on reasoning for reasoning models.&#10;Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response." data-i18n="[title]Constrains effort on reasoning for reasoning models.">
<label for="openai_reasoning_effort">
<span data-i18n="Reasoning Effort">Reasoning Effort</span>
@@ -2148,14 +2169,17 @@
<option data-i18n="openai_reasoning_effort_high" value="high">High</option>
<option data-i18n="openai_reasoning_effort_maximum" value="max">Maximum</option>
</select>
<div class="toggle-description justifyLeft marginBot5" data-source="openai,custom,xai,aimlapi,openrouter,pollinations,perplexity,cometapi,electronhub,azure_openai,chutes" data-i18n="OpenAI-style options: low, medium, high. Minimum and maximum are aliased to low and high. Auto does not send an effort level.">
OpenAI-style options: low, medium, high. Minimum and maximum are aliased to low and high. Auto does not send an effort level.
<div class="toggle-description justifyLeft marginBot5" data-source="openai,custom,xai,aimlapi,openrouter,pollinations,perplexity,cometapi,electronhub,azure_openai,chutes" data-i18n="OpenAI-compatible effort levels vary by model. Minimum and maximum may use model-specific aliases. Auto does not send an effort level.">
OpenAI-compatible effort levels vary by model. Minimum and maximum may use model-specific aliases. Auto does not send an effort level.
</div>
<div class="toggle-description justifyLeft marginBot5" data-source="fireworks" data-i18n="Fireworks supports low, medium, high, and max as distinct effort levels. Minimum is aliased to low. Auto does not send an effort level.">
Fireworks supports low, medium, high, and max as distinct effort levels. Minimum is aliased to low. Auto does not send an effort level.
</div>
<strong class="toggle-description justifyLeft marginBot5" data-source="openrouter">
Request model reasoning = Off with Reasoning Effort = Minimum disables reasoning entirely on models that support that, but can cause errors with some models.
</strong>
<div class="toggle-description justifyLeft marginBot5" data-source="claude" data-i18n="Allocates a portion of the response length for thinking (min: 1024 tokens, low: 10%, medium: 25%, high: 50%, max: 95%), but minimum 1024 tokens. Auto does not request thinking.">
Allocates a portion of the response length for thinking (min: 1024 tokens, low: 10%, medium: 25%, high: 50%, max: 95%), but minimum 1024 tokens. Auto does not request thinking.
<div class="toggle-description justifyLeft marginBot5" data-source="claude" data-i18n="Selects an effort level on adaptive-thinking models. On older Claude models, it allocates a portion of the response length to thinking. Auto does not request thinking.">
Selects an effort level on adaptive-thinking models. On older Claude models, it allocates a portion of the response length to thinking. Auto does not request thinking.
</div>
<div class="toggle-description justifyLeft marginBot5" data-source="makersuite,vertexai">
<span data-i18n="Sets a dynamic reasoning depth level for thinking (Flash 3/Pro 3). High and low are supported by both, minimal and medium are Flash 3 only. Auto lets the model decide.">
@@ -2183,7 +2207,7 @@
Constrains the verbosity of the model's response.
</div>
<strong class="toggle-description justifyLeft marginBot5" data-source="claude">
On Opus 4.6 / Sonnet 4.6, a non-automatic Reasoning Effort takes precedence over Verbosity.
On adaptive-thinking Claude models, a non-automatic Reasoning Effort takes precedence over Verbosity.
</strong>
</div>
</div>
@@ -2445,7 +2469,8 @@
<small data-i18n="Click Authorize below or get the key from">
Click "Authorize" below or get the key from </small> <a target="_blank" href="https://openrouter.ai/keys/">OpenRouter</a>.
<br>
<a href="https://openrouter.ai/account" target="_blank" data-i18n="View Remaining Credits">View Remaining Credits</a>
<a href="https://openrouter.ai/settings/credits" target="_blank" class="openrouter_view_credits" data-i18n="View Remaining Credits">View Remaining Credits</a>
<span class="openrouter_credits_display marginLeft5"></span>
</div>
<div class="flex-container">
<input id="api_key_openrouter-tg" name="api_key_openrouter" class="text_pole flex1 api_key_openrouter" value="" type="text" autocomplete="off">
@@ -2571,8 +2596,19 @@
<small data-i18n="Example: http://127.0.0.1:5000">Example: http://127.0.0.1:5000</small>
<input id="generic_api_url_text" name="generic_api_url" class="text_pole wide100p" value="" autocomplete="off" data-server-history="generic">
</div>
<datalist id="generic_model_fill"></datalist>
<input id="generic_model_textgenerationwebui" list="generic_model_fill" class="text_pole wide100p" placeholder="Model ID (optional)" data-i18n="[placeholder]Model ID (optional)" type="text">
<h4 data-i18n="Enter a Model ID">Enter a Model ID</h4>
<div class="flex-container">
<input list="generic_model_fill" id="generic_model_textgenerationwebui" class="text_pole wide100p" placeholder="Model ID (optional)" data-i18n="[placeholder]Model ID (optional)" type="text" autocomplete="off">
<datalist id="generic_model_fill"></datalist>
</div>
<h4 data-i18n="Available Models">Available Models</h4>
<div class="flex-container">
<select id="generic_model_select" class="text_pole wide100p">
<option value="" data-i18n="-- Connect to the API --">
-- Connect to the API --
</option>
</select>
</div>
</div>
<div data-tg-type="ooba" class="flex-container flexFlowColumn">
<div class="flex-container flexFlowColumn">
@@ -2894,6 +2930,7 @@
<option value="azure_openai">Azure OpenAI</option>
<option value="chutes">Chutes</option>
<option value="claude">Claude</option>
<option value="workers_ai">Cloudflare Workers AI</option>
<option value="cohere">Cohere</option>
<!-- Temporarily disabled. -->
<!-- <option value="cometapi">CometAPI</option> -->
@@ -2904,6 +2941,7 @@
<option value="makersuite">Google AI Studio</option>
<option value="vertexai">Google Vertex AI</option>
<option value="mistralai">MistralAI</option>
<option value="minimax">MiniMax</option>
<option value="moonshot">Moonshot AI</option>
<option value="nanogpt">NanoGPT</option>
<option value="openrouter">OpenRouter</option>
@@ -2973,8 +3011,8 @@
<br>
</div>
<div class="flex-container width100p">
<input id="openai_proxy_password" type="password" class="text_pole flex1" placeholder="" form="openai_form" autocomplete="off" />
<div id="openai_proxy_password_show" title="Peek a password" data-i18n="[title]Peek a password" class="menu_button fa-solid fa-eye-slash fa-fw"></div>
<input id="openai_proxy_access_key" type="text" class="text_pole flex1 masked-secret" placeholder="" autocomplete="off" autocapitalize="none" autocorrect="off" spellcheck="false" />
<div id="openai_proxy_access_key_show" title="Peek a password" data-i18n="[title]Peek a password" class="menu_button fa-solid fa-eye-slash fa-fw"></div>
</div>
</div>
</div>
@@ -3028,91 +3066,98 @@
<div>
<h4 data-i18n="OpenAI Model">OpenAI Model</h4>
<select id="model_openai_select">
<optgroup label="GPT-6">
<option value="gpt-6-astra">gpt-6-astra</option>
<option value="gpt-6-sol">gpt-6-sol</option>
<option value="gpt-6-luna">gpt-6-luna</option>
</optgroup>
<optgroup label="GPT-5.6">
<option value="gpt-5.6">gpt-5.6</option>
<option value="gpt-5.6-sol">gpt-5.6-sol</option>
<option value="gpt-5.6-terra">gpt-5.6-terra</option>
<option value="gpt-5.6-luna">gpt-5.6-luna</option>
</optgroup>
<optgroup label="GPT-5.5">
<option value="gpt-5.5">gpt-5.5</option>
<option value="gpt-5.5-2026-04-23">gpt-5.5-2026-04-23</option>
</optgroup>
<optgroup label="GPT-5.4">
<option value="gpt-5.4">gpt-5.4</option>
<option value="gpt-5.4-2026-03-05">gpt-5.4-2026-03-05</option>
<option value="gpt-5.4-mini">gpt-5.4-mini</option>
<option value="gpt-5.4-mini-2026-03-17">gpt-5.4-mini-2026-03-17</option>
<option value="gpt-5.4-nano">gpt-5.4-nano</option>
<option value="gpt-5.4-nano-2026-03-17">gpt-5.4-nano-2026-03-17</option>
</optgroup>
<optgroup label="GPT-5.3">
<option value="gpt-5.3-chat-latest">gpt-5.3-chat-latest</option>
<option value="gpt-5.3-chat-latest">gpt-5.3-chat-latest (deprecated)</option>
</optgroup>
<optgroup label="GPT-5.2">
<option value="gpt-5.2">gpt-5.2</option>
<option value="gpt-5.2-2025-12-11">gpt-5.2-2025-12-11</option>
<option value="gpt-5.2-chat-latest">gpt-5.2-chat-latest</option>
<option value="gpt-5.2-chat-latest">gpt-5.2-chat-latest (deprecated)</option>
</optgroup>
<optgroup label="GPT-5.1">
<option value="gpt-5.1">gpt-5.1</option>
<option value="gpt-5.1-2025-11-13">gpt-5.1-2025-11-13</option>
<option value="gpt-5.1-chat-latest">gpt-5.1-chat-latest</option>
<option value="gpt-5.1-chat-latest">gpt-5.1-chat-latest (deprecated)</option>
</optgroup>
<optgroup label="GPT-5">
<option value="gpt-5">gpt-5</option>
<option value="gpt-5-2025-08-07">gpt-5-2025-08-07</option>
<option value="gpt-5-chat-latest">gpt-5-chat-latest</option>
<option value="gpt-5-2025-08-07">gpt-5-2025-08-07 (deprecated)</option>
<option value="gpt-5-chat-latest">gpt-5-chat-latest (deprecated)</option>
<option value="gpt-5-mini">gpt-5-mini</option>
<option value="gpt-5-mini-2025-08-07">gpt-5-mini-2025-08-07</option>
<option value="gpt-5-mini-2025-08-07">gpt-5-mini-2025-08-07 (deprecated)</option>
<option value="gpt-5-nano">gpt-5-nano</option>
<option value="gpt-5-nano-2025-08-07">gpt-5-nano-2025-08-07</option>
</optgroup>
<optgroup label="GPT-4o">
<option value="gpt-4o">gpt-4o</option>
<option value="gpt-4o-2024-11-20">gpt-4o-2024-11-20</option>
<option value="gpt-4o-2024-08-06">gpt-4o-2024-08-06</option>
<option value="gpt-4o-2024-05-13">gpt-4o-2024-05-13</option>
<option value="chatgpt-4o-latest">chatgpt-4o-latest</option>
</optgroup>
<optgroup label="GPT-4o mini">
<option value="gpt-4o-mini">gpt-4o-mini</option>
<option value="gpt-4o-mini-2024-07-18">gpt-4o-mini-2024-07-18</option>
<option value="gpt-5-nano-2025-08-07">gpt-5-nano-2025-08-07 (deprecated)</option>
</optgroup>
<optgroup label="GPT-4.1">
<option value="gpt-4.1">gpt-4.1</option>
<option value="gpt-4.1-2025-04-14">gpt-4.1-2025-04-14</option>
<option value="gpt-4.1-mini">gpt-4.1-mini</option>
<option value="gpt-4.1-mini-2025-04-14">gpt-4.1-mini-2025-04-14</option>
<option value="gpt-4.1-nano">gpt-4.1-nano</option>
<option value="gpt-4.1-nano-2025-04-14">gpt-4.1-nano-2025-04-14</option>
<option value="gpt-4.1-nano">gpt-4.1-nano (deprecated)</option>
<option value="gpt-4.1-nano-2025-04-14">gpt-4.1-nano-2025-04-14 (deprecated)</option>
</optgroup>
<optgroup label="o1">
<option value="o1">o1</option>
<option value="o1-2024-12-17">o1-2024-12-17</option>
<option value="o1-mini">o1-mini</option>
<option value="o1-mini-2024-09-12">o1-mini-2024-09-12</option>
<option value="o1-preview">o1-preview</option>
<option value="o1-preview-2024-09-12">o1-preview-2024-09-12</option>
<optgroup label="o4">
<option value="o4-mini">o4-mini (deprecated)</option>
<option value="o4-mini-2025-04-16">o4-mini-2025-04-16 (deprecated)</option>
</optgroup>
<optgroup label="o3">
<option value="o3">o3</option>
<option value="o3-2025-04-16">o3-2025-04-16</option>
<option value="o3-mini">o3-mini</option>
<option value="o3-mini-2025-01-31">o3-mini-2025-01-31</option>
<option value="o3-2025-04-16">o3-2025-04-16 (deprecated)</option>
<option value="o3-mini">o3-mini (deprecated)</option>
<option value="o3-mini-2025-01-31">o3-mini-2025-01-31 (deprecated)</option>
</optgroup>
<optgroup label="o4">
<option value="o4-mini">o4-mini</option>
<option value="o4-mini-2025-04-16">o4-mini-2025-04-16</option>
<optgroup label="o1">
<option value="o1">o1 (deprecated)</option>
<option value="o1-2024-12-17">o1-2024-12-17 (deprecated)</option>
</optgroup>
<optgroup label="GPT-4.5">
<option value="gpt-4.5-preview">gpt-4.5-preview</option>
<option value="gpt-4.5-preview-2025-02-27">gpt-4.5-preview-2025-02-27</option>
<optgroup label="GPT-4o">
<option value="gpt-4o">gpt-4o</option>
<option value="gpt-4o-2024-11-20">gpt-4o-2024-11-20</option>
<option value="gpt-4o-2024-08-06">gpt-4o-2024-08-06</option>
<option value="gpt-4o-2024-05-13">gpt-4o-2024-05-13</option>
</optgroup>
<optgroup label="GPT-4o mini">
<option value="gpt-4o-mini">gpt-4o-mini</option>
<option value="gpt-4o-mini-2024-07-18">gpt-4o-mini-2024-07-18</option>
</optgroup>
<optgroup label="GPT-4 Turbo and GPT-4">
<option value="gpt-4-turbo">gpt-4-turbo</option>
<option value="gpt-4-turbo-2024-04-09">gpt-4-turbo-2024-04-09</option>
<option value="gpt-4-turbo-preview">gpt-4-turbo-preview</option>
<option value="gpt-4-0125-preview">gpt-4-0125-preview (2024)</option>
<option value="gpt-4-1106-preview">gpt-4-1106-preview (2023)</option>
<option value="gpt-4">gpt-4</option>
<option value="gpt-4-0613">gpt-4-0613 (2023)</option>
<option value="gpt-4-0314">gpt-4-0314 (2023)</option>
<option value="gpt-4-turbo">gpt-4-turbo (deprecated)</option>
<option value="gpt-4-turbo-2024-04-09">gpt-4-turbo-2024-04-09 (deprecated)</option>
<option value="gpt-4">gpt-4 (deprecated)</option>
<option value="gpt-4-0613">gpt-4-0613 (2023, deprecated)</option>
</optgroup>
<optgroup label="GPT-3.5 Turbo">
<option value="gpt-3.5-turbo">gpt-3.5-turbo</option>
<option value="gpt-3.5-turbo-0125">gpt-3.5-turbo-0125 (2024)</option>
<option value="gpt-3.5-turbo-1106">gpt-3.5-turbo-1106 (2023)</option>
<option value="gpt-3.5-turbo-instruct">gpt-3.5-turbo-instruct</option>
<option value="gpt-3.5-turbo">gpt-3.5-turbo (deprecated)</option>
<option value="gpt-3.5-turbo-0125">gpt-3.5-turbo-0125 (2024, deprecated)</option>
<option value="gpt-3.5-turbo-1106">gpt-3.5-turbo-1106 (2023, deprecated)</option>
<option value="gpt-3.5-turbo-instruct">gpt-3.5-turbo-instruct (deprecated)</option>
</optgroup>
<optgroup label="Other">
<option value="babbage-002">babbage-002</option>
<option value="davinci-002">davinci-002</option>
<option value="babbage-002">babbage-002 (deprecated)</option>
<option value="davinci-002">davinci-002 (deprecated)</option>
</optgroup>
<optgroup id="openai_external_category" label="External">
</optgroup>
@@ -3143,6 +3188,13 @@
<h4 data-i18n="Claude Model">Claude Model</h4>
<select id="model_claude_select">
<optgroup label="Versions">
<option value="claude-fable-5-1">claude-fable-5-1</option>
<option value="claude-fable-5">claude-fable-5</option>
<option value="claude-opus-5-5">claude-opus-5-5</option>
<option value="claude-opus-5">claude-opus-5</option>
<option value="claude-sonnet-5">claude-sonnet-5</option>
<option value="claude-opus-4-8">claude-opus-4-8</option>
<option value="claude-opus-4-7">claude-opus-4-7</option>
<option value="claude-opus-4-6">claude-opus-4-6</option>
<option value="claude-opus-4-5">claude-opus-4-5</option>
<option value="claude-opus-4-5-20251101">claude-opus-4-5-20251101</option>
@@ -3151,21 +3203,10 @@
<option value="claude-sonnet-4-5-20250929">claude-sonnet-4-5-20250929</option>
<option value="claude-haiku-4-5">claude-haiku-4-5</option>
<option value="claude-haiku-4-5-20251001">claude-haiku-4-5-20251001</option>
<option value="claude-opus-4-1">claude-opus-4-1</option>
<option value="claude-opus-4-1-20250805">claude-opus-4-1-20250805</option>
<option value="claude-opus-4-0">claude-opus-4-0</option>
<option value="claude-opus-4-20250514">claude-opus-4-20250514</option>
<option value="claude-sonnet-4-0">claude-sonnet-4-0</option>
<option value="claude-sonnet-4-20250514">claude-sonnet-4-20250514</option>
<option value="claude-3-7-sonnet-latest">claude-3-7-sonnet-latest</option>
<option value="claude-3-7-sonnet-20250219">claude-3-7-sonnet-20250219</option>
<option value="claude-3-5-sonnet-latest">claude-3-5-sonnet-latest</option>
<option value="claude-3-5-sonnet-20241022">claude-3-5-sonnet-20241022</option>
<option value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option>
<option value="claude-3-5-haiku-latest">claude-3-5-haiku-latest</option>
<option value="claude-3-5-haiku-20241022">claude-3-5-haiku-20241022</option>
<option value="claude-3-opus-20240229">claude-3-opus-20240229</option>
<option value="claude-3-haiku-20240307">claude-3-haiku-20240307</option>
<option value="claude-opus-4-0">claude-opus-4-0 (deprecated)</option>
<option value="claude-opus-4-20250514">claude-opus-4-20250514 (deprecated)</option>
<option value="claude-sonnet-4-0">claude-sonnet-4-0 (deprecated)</option>
<option value="claude-sonnet-4-20250514">claude-sonnet-4-20250514 (deprecated)</option>
</optgroup>
</select>
</div>
@@ -3176,7 +3217,8 @@
<small data-i18n="Click Authorize below or get the key from">
Click "Authorize" below or get the key from </small> <a target="_blank" href="https://openrouter.ai/keys/">OpenRouter</a>.
<br>
<a href="https://openrouter.ai/account" target="_blank" data-i18n="View Remaining Credits">View Remaining Credits</a>
<a href="https://openrouter.ai/settings/credits" target="_blank" class="openrouter_view_credits" data-i18n="View Remaining Credits">View Remaining Credits</a>
<span class="openrouter_credits_display marginLeft5"></span>
</div>
<div class="flex-container">
<input id="api_key_openrouter" name="api_key_openrouter" class="text_pole flex1 api_key_openrouter" value="" type="text" autocomplete="off">
@@ -3195,36 +3237,6 @@
<input id="openrouter_use_fallback" type="checkbox" />
<span data-i18n="Allow fallback models">Allow fallback models</span>
</label>
<div class="marginTopBot5">
<div class="inline-drawer wide100p">
<div class="inline-drawer-toggle inline-drawer-header">
<b data-i18n="OpenRouter Model Sorting">OpenRouter Model Sorting</b>
<div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
</div>
<div class="inline-drawer-content m-b-1">
<div class="marginTopBot5">
<label for="openrouter_sort_models" class="checkbox_label">
<select id="openrouter_sort_models">
<option data-i18n="Alphabetically" value="alphabetically">Alphabetically</option>
<option data-i18n="Price" value="pricing.prompt">Price (cheapest)</option>
<option data-i18n="Context Size" value="context_length">Context Size</option>
</select>
</label>
</div>
<div class="marginTopBot5">
<label for="openrouter_group_models" class="checkbox_label">
<input id="openrouter_group_models" type="checkbox" />
<span data-i18n="Group by vendors">Group by vendors</span>
</label>
<div class="toggle-description justifyLeft wide100p">
<span data-i18n="Group by vendors Description">
Put OpenAI models in one group, Anthropic models in other group, etc. Can be combined with sorting.
</span>
</div>
</div>
</div>
</div>
</div>
<div>
<h4>
<span data-i18n="Model Providers">Model Providers</span>
@@ -3302,48 +3314,43 @@
<div>
<h4 data-i18n="Google Model">Google Model</h4>
<select id="model_google_select">
<optgroup label="Gemini 3.8">
<option value="gemini-3.8-flash">gemini-3.8-flash</option>
</optgroup>
<optgroup label="Gemini 3.7">
<option value="gemini-3.7-flash">gemini-3.7-flash</option>
</optgroup>
<optgroup label="Gemini 3.6">
<option value="gemini-3.6-flash">gemini-3.6-flash</option>
</optgroup>
<optgroup label="Gemini 3.5">
<option value="gemini-3.5-flash">gemini-3.5-flash</option>
<option value="gemini-3.5-flash-lite">gemini-3.5-flash-lite</option>
</optgroup>
<optgroup label="Gemini 3.1">
<option value="gemini-3.1-pro-preview">gemini-3.1-pro-preview</option>
<option value="gemini-3.1-flash-lite-preview">gemini-3.1-flash-lite-preview</option>
<option value="gemini-3.1-flash-image-preview">gemini-3.1-flash-image-preview</option>
<option value="gemini-3.1-flash-lite">gemini-3.1-flash-lite</option>
<option value="gemini-3.1-flash-image">gemini-3.1-flash-image</option>
</optgroup>
<optgroup label="Gemini 3.0">
<option value="gemini-3-pro-preview">gemini-3-pro-preview</option>
<option value="gemini-3-pro-image-preview">gemini-3-pro-image-preview</option>
<option value="gemini-3-pro-image">gemini-3-pro-image</option>
<option value="gemini-3-flash-preview">gemini-3-flash-preview</option>
</optgroup>
<optgroup label="Gemini 2.5">
<option value="gemini-2.5-pro">gemini-2.5-pro</option>
<option value="gemini-2.5-pro-preview-06-05">gemini-2.5-pro-preview-06-05</option>
<option value="gemini-2.5-pro-preview-05-06">gemini-2.5-pro-preview-05-06</option>
<option value="gemini-2.5-pro-preview-03-25">gemini-2.5-pro-preview-03-25</option>
<option value="gemini-2.5-flash">gemini-2.5-flash</option>
<option value="gemini-2.5-flash-preview-09-2025">gemini-2.5-flash-preview-09-2025</option>
<option value="gemini-2.5-flash-preview-05-20">gemini-2.5-flash-preview-05-20</option>
<option value="gemini-2.5-flash-lite">gemini-2.5-flash-lite</option>
<option value="gemini-2.5-flash-lite-preview-09-2025">gemini-2.5-flash-lite-preview-09-2025</option>
<option value="gemini-2.5-flash-lite-preview-06-17">gemini-2.5-flash-lite-preview-06-17</option>
<option value="gemini-2.5-flash-image">gemini-2.5-flash-image</option>
<option value="gemini-2.5-flash-image-preview">gemini-2.5-flash-image-preview</option>
</optgroup>
<optgroup label="Gemini 2.0">
<option value="gemini-2.0-pro-exp-02-05">gemini-2.0-pro-exp-02-05 → 2.5-exp-03-25</option>
<option value="gemini-2.0-pro-exp">gemini-2.0-pro-exp → 2.5-exp-03-25</option>
<option value="gemini-exp-1206">gemini-exp-1206 → 2.5-exp-03-25</option>
<option value="gemini-2.0-flash-001">gemini-2.0-flash-001</option>
<option value="gemini-2.0-flash-exp-image-generation">gemini-2.0-flash-exp-image-generation</option>
<option value="gemini-2.0-flash-preview-image-generation">gemini-2.0-flash-preview-image-generation</option>
<option value="gemini-2.0-flash-exp">gemini-2.0-flash-exp</option>
<option value="gemini-2.0-flash">gemini-2.0-flash</option>
<option value="gemini-2.0-flash-thinking-exp-01-21">gemini-2.0-flash-thinking-exp-01-21 → 2.5-flash-preview-05-20</option>
<option value="gemini-2.0-flash-thinking-exp-1219">gemini-2.0-flash-thinking-exp-1219 → 2.5-flash-preview-05-20</option>
<option value="gemini-2.0-flash-thinking-exp">gemini-2.0-flash-thinking-exp → 2.5-flash-preview-05-20</option>
<option value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001</option>
<option value="gemini-2.0-flash-lite-preview-02-05">gemini-2.0-flash-lite-preview-02-05</option>
<option value="gemini-2.0-flash-lite-preview">gemini-2.0-flash-lite-preview</option>
<option value="gemini-2.0-flash-lite">gemini-2.0-flash-lite</option>
<option value="gemini-2.0-flash-001">gemini-2.0-flash-001 (deprecated)</option>
<option value="gemini-2.0-flash">gemini-2.0-flash (deprecated)</option>
<option value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001 (deprecated)</option>
<option value="gemini-2.0-flash-lite">gemini-2.0-flash-lite (deprecated)</option>
</optgroup>
<optgroup label="Gemma">
<option value="gemma-4-31b-it">gemma-4-31b-it</option>
<option value="gemma-4-26b-a4b-it">gemma-4-26b-a4b-it</option>
<option value="gemma-3n-e4b-it">gemma-3n-e4b-it</option>
<option value="gemma-3n-e2b-it">gemma-3n-e2b-it</option>
<option value="gemma-3-27b-it">gemma-3-27b-it</option>
@@ -3480,14 +3487,26 @@
<h4 data-i18n="Google Model">Google Model</h4>
<select id="model_vertexai_select">
<!-- data-mode="full" is for models that require a service account -->
<optgroup label="Gemini 3.8">
<option value="gemini-3.8-flash">gemini-3.8-flash</option>
</optgroup>
<optgroup label="Gemini 3.7">
<option value="gemini-3.7-flash">gemini-3.7-flash</option>
</optgroup>
<optgroup label="Gemini 3.6">
<option value="gemini-3.6-flash">gemini-3.6-flash</option>
</optgroup>
<optgroup label="Gemini 3.5">
<option value="gemini-3.5-flash">gemini-3.5-flash</option>
<option value="gemini-3.5-flash-lite">gemini-3.5-flash-lite</option>
</optgroup>
<optgroup label="Gemini 3.1">
<option value="gemini-3.1-pro-preview">gemini-3.1-pro-preview</option>
<option value="gemini-3.1-flash-lite-preview">gemini-3.1-flash-lite-preview</option>
<option value="gemini-3.1-flash-image-preview">gemini-3.1-flash-image-preview</option>
<option value="gemini-3.1-flash-lite">gemini-3.1-flash-lite</option>
<option value="gemini-3.1-flash-image">gemini-3.1-flash-image</option>
</optgroup>
<optgroup label="Gemini 3.0">
<option value="gemini-3-pro-preview">gemini-3-pro-preview</option>
<option value="gemini-3-pro-image-preview">gemini-3-pro-image-preview</option>
<option value="gemini-3-pro-image">gemini-3-pro-image</option>
<option value="gemini-3-flash-preview">gemini-3-flash-preview</option>
</optgroup>
<optgroup label="Gemini 2.5">
@@ -3495,14 +3514,11 @@
<option value="gemini-2.5-flash">gemini-2.5-flash</option>
<option value="gemini-2.5-flash-lite">gemini-2.5-flash-lite</option>
<option value="gemini-2.5-flash-image">gemini-2.5-flash-image</option>
<option value="gemini-2.5-flash-image-preview">gemini-2.5-flash-image-preview</option>
</optgroup>
<optgroup label="Gemini 2.0">
<option value="gemini-2.0-flash-exp" data-mode="full">gemini-2.0-flash-exp</option>
<option value="gemini-2.0-flash-preview-image-generation" data-mode="full">gemini-2.0-flash-preview-image-generation</option>
<option value="gemini-2.0-flash">gemini-2.0-flash</option>
<option value="gemini-2.0-flash-001">gemini-2.0-flash-001</option>
<option value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001</option>
<option value="gemini-2.0-flash">gemini-2.0-flash (deprecated)</option>
<option value="gemini-2.0-flash-001">gemini-2.0-flash-001 (deprecated)</option>
<option value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001 (deprecated)</option>
</optgroup>
</select>
</div>
@@ -3566,6 +3582,32 @@
<option value="" data-i18n="-- Connect to the API --">-- Connect to the API --</option>
</select>
</div>
<div id="minimax_form" data-source="minimax">
<h4 data-i18n="MiniMax API Key">MiniMax API Key</h4>
<div class="flex-container">
<input id="api_key_minimax" name="api_key_minimax" class="text_pole flex1" value="" type="text" autocomplete="off">
<div title="Manage API keys" data-i18n="[title]Manage API keys" class="menu_button fa-solid fa-key fa-fw manage-api-keys" data-key="api_key_minimax"></div>
</div>
<div data-for="api_key_minimax" class="neutral_warning" data-i18n="For privacy reasons, your API key will be hidden after you click 'Connect'.">
For privacy reasons, your API key will be hidden after you click 'Connect'.
</div>
<h4 data-i18n="MiniMax Endpoint">MiniMax Endpoint</h4>
<select id="minimax_endpoint">
<option value="global" data-i18n="Global (minimax.io)">Global (minimax.io)</option>
<option value="cn" data-i18n="China (minimaxi.com)">China (minimaxi.com)</option>
</select>
<h4 data-i18n="MiniMax Model">MiniMax Model</h4>
<select id="model_minimax_select">
<option value="MiniMax-M2.7">MiniMax-M2.7</option>
<option value="MiniMax-M2.7-highspeed">MiniMax-M2.7-highspeed</option>
<option value="MiniMax-M2.5">MiniMax-M2.5</option>
<option value="MiniMax-M2.5-highspeed">MiniMax-M2.5-highspeed</option>
<option value="MiniMax-M2.1">MiniMax-M2.1</option>
<option value="MiniMax-M2.1-highspeed">MiniMax-M2.1-highspeed</option>
<option value="MiniMax-M2">MiniMax-M2</option>
<option value="M2-her">M2-her</option>
</select>
</div>
<div id="electronhub_form" data-source="electronhub">
<h4 data-i18n="Electron Hub API Key">Electron Hub API Key</h4>
<div>
@@ -3584,37 +3626,6 @@
<option value="" data-i18n="-- Connect to the API --">-- Connect to the API --</option>
</select>
</div>
<div class="marginTopBot5">
<div class="inline-drawer wide100p">
<div class="inline-drawer-toggle inline-drawer-header">
<b data-i18n="Electron Hub Model Sorting">Electron Hub Model Sorting</b>
<div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
</div>
<div class="inline-drawer-content m-b-1">
<div class="marginTopBot5">
<label for="electronhub_sort_models" class="checkbox_label">
<select id="electronhub_sort_models">
<option data-i18n="Alphabetically" value="alphabetically">Alphabetically</option>
<option data-i18n="Input Price" value="pricing.input">Input Price (cheapest)</option>
<option data-i18n="Output Price" value="pricing.output">Output Price (cheapest)</option>
<option data-i18n="Context Size" value="context_length">Context Size</option>
</select>
</label>
</div>
<div class="marginTopBot5">
<label for="electronhub_group_models" class="checkbox_label">
<input id="electronhub_group_models" type="checkbox" />
<span data-i18n="Group by vendors">Group by vendors</span>
</label>
<div class="toggle-description justifyLeft wide100p">
<span data-i18n="Group by vendors Description">
Put OpenAI models in one group, Anthropic models in other group, etc. Can be combined with sorting.
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="chutes_form" data-source="chutes">
<h4 data-i18n="Chutes API Key">Chutes API Key</h4>
@@ -3634,29 +3645,11 @@
<option value="" data-i18n="-- Connect to the API --">-- Connect to the API --</option>
</select>
</div>
<div class="marginTopBot5">
<div class="inline-drawer wide100p">
<div class="inline-drawer-toggle inline-drawer-header">
<b data-i18n="Chutes Model Sorting">Chutes Model Sorting</b>
<div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
</div>
<div class="inline-drawer-content m-b-1">
<div class="marginTopBot5">
<label for="chutes_sort_models" class="checkbox_label">
<select id="chutes_sort_models">
<option data-i18n="Alphabetically" value="alphabetically">Alphabetically</option>
<option data-i18n="Input Price" value="pricing.input">Input Price (cheapest)</option>
<option data-i18n="Output Price" value="pricing.output">Output Price (cheapest)</option>
<option data-i18n="Context Size" value="context_length">Context Size</option>
</select>
</label>
</div>
</div>
</div>
</div>
</div>
<div id="nanogpt_form" data-source="nanogpt">
<h4 data-i18n="NanoGPT API Key">NanoGPT API Key</h4>
<a href="https://nano-gpt.com/balance" target="_blank" rel="noopener noreferrer" class="nanogpt_view_credits" data-i18n="View Remaining Credits">View Remaining Credits</a>
<span class="nanogpt_credits_display marginLeft5"></span>
<div class="flex-container">
<input id="api_key_nanogpt" name="api_key_nanogpt" class="text_pole flex1" value="" type="text" autocomplete="off">
<div title="Manage API keys" data-i18n="[title]Manage API keys" class="menu_button fa-solid fa-key fa-fw manage-api-keys" data-key="api_key_nanogpt"></div>
@@ -3670,6 +3663,39 @@
<option value="" data-i18n="-- Connect to the API --">-- Connect to the API --</option>
</select>
</div>
<div>
<h4>
<span data-i18n="Model Providers">Model Providers</span>
<i id="nanogpt_provider_warning" class="fa-solid fa-circle-exclamation displayNone" title="Deselect inapplicable provider(s) or select an applicable provider to avoid a 404 error."></i>
</h4>
<select id="nanogpt_provider">
<option value="" data-i18n="Auto">Auto</option>
</select>
<label class="checkbox_label marginTopBot5" for="nanogpt_payg_override" data-i18n="[title]Force NanoGPT pay-as-you-go billing for this request." title="Force NanoGPT pay-as-you-go billing for this request.">
<input id="nanogpt_payg_override" type="checkbox" />
<span data-i18n="Use pay-as-you-go billing">Use pay-as-you-go billing</span>
</label>
</div>
</div>
<div id="workers_ai_form" data-source="workers_ai">
<h4><a href="https://dash.cloudflare.com/?to=/:account/ai/workers-ai/api-quick-start" target="_blank" rel="noopener noreferrer" data-i18n="Cloudflare Workers AI API Key">Cloudflare Workers AI API Key</a></h4>
<div class="flex-container">
<input id="api_key_workers_ai" name="api_key_workers_ai" class="text_pole flex1" value="" type="text" autocomplete="off">
<div title="Manage API keys" data-i18n="[title]Manage API keys" class="menu_button fa-solid fa-key fa-fw manage-api-keys" data-key="api_key_workers_ai"></div>
</div>
<div data-for="api_key_workers_ai" class="neutral_warning" data-i18n="For privacy reasons, your API key will be hidden after you click 'Connect'.">
For privacy reasons, your API key will be hidden after you click 'Connect'.
</div>
<h4><a href="https://dash.cloudflare.com/?to=/:account/workers-and-pages" target="_blank" rel="noopener noreferrer" data-i18n="Cloudflare Account ID">Cloudflare Account ID</a></h4>
<div class="flex-container">
<input id="workers_ai_account_id" class="text_pole flex1" value="" type="text" autocomplete="off" placeholder="e.g. 023e105f4ecef8ad9ca31a8372d0c353" data-i18n="[placeholder]e.g. 023e105f4ecef8ad9ca31a8372d0c353">
</div>
<div>
<h4 data-i18n="Workers AI Model">Workers AI Model</h4>
<select id="model_workers_ai_select">
<option value="" data-i18n="-- Connect to the API --">-- Connect to the API --</option>
</select>
</div>
</div>
<div id="deepseek_form" data-source="deepseek">
<h4 data-i18n="DeepSeek API Key">DeepSeek API Key</h4>
@@ -3683,9 +3709,7 @@
<div>
<h4 data-i18n="DeepSeek Model">DeepSeek Model</h4>
<select id="model_deepseek_select">
<option value="deepseek-chat">deepseek-chat</option>
<option value="deepseek-coder">deepseek-coder</option>
<option value="deepseek-reasoner">deepseek-reasoner</option>
<option value="" data-i18n="-- Connect to the API --">-- Connect to the API --</option>
</select>
</div>
</div>
@@ -3859,17 +3883,24 @@
</select>
</div>
<div id="pollinations_form" data-source="pollinations">
<h4>
<a href="https://enter.pollinations.ai/" target="_blank" rel="noopener noreferrer" data-i18n="Pollinations API Key">
Pollinations API Key
</a>
</h4>
<div class="flex-container">
<input id="api_key_pollinations" name="api_key_pollinations" class="text_pole flex1" value="" type="text" autocomplete="off">
<div title="Manage API keys" data-i18n="[title]Manage API keys" class="menu_button fa-solid fa-key fa-fw manage-api-keys" data-key="api_key_pollinations"></div>
</div>
<div data-for="api_key_pollinations" class="neutral_warning" data-i18n="For privacy reasons, your API key will be hidden after you click 'Connect'.">
For privacy reasons, your API key will be hidden after you click 'Connect'.
<h4 data-i18n="Pollinations Endpoint">Pollinations Endpoint</h4>
<select id="pollinations_endpoint">
<option value="anonymous" data-i18n="Anonymous (No Key)">Anonymous (No Key)</option>
<option value="authenticated" data-i18n="Authenticated (API Key)">Authenticated (API Key)</option>
</select>
<div id="pollinations_key_section">
<h4>
<a href="https://enter.pollinations.ai/" target="_blank" rel="noopener noreferrer" data-i18n="Pollinations API Key">
Pollinations API Key
</a>
</h4>
<div class="flex-container">
<input id="api_key_pollinations" name="api_key_pollinations" class="text_pole flex1" value="" type="text" placeholder="sk_..." autocomplete="off">
<div title="Manage API keys" data-i18n="[title]Manage API keys" class="menu_button fa-solid fa-key fa-fw manage-api-keys" data-key="api_key_pollinations"></div>
</div>
<div data-for="api_key_pollinations" class="neutral_warning" data-i18n="For privacy reasons, your API key will be hidden after you click 'Connect'.">
For privacy reasons, your API key will be hidden after you click 'Connect'.
</div>
</div>
<h4 data-i18n="Pollinations Model">Pollinations Model</h4>
<select id="model_pollinations_select">
@@ -3923,7 +3954,9 @@
</select>
<h4 data-i18n="Z.AI Model">Z.AI Model</h4>
<select id="model_zai_select">
<option value="glm-5.2">glm-5.2</option>
<option value="glm-5-turbo">glm-5-turbo</option>
<option value="glm-5v-turbo">glm-5v-turbo</option>
<option value="glm-5.1">glm-5.1</option>
<option value="glm-5">glm-5</option>
<option value="glm-4.7">glm-4.7</option>
@@ -3968,7 +4001,7 @@
<!-- Azure API Key -->
<h4><span data-i18n="Azure API Key">Azure API Key</span></h4>
<div class="flex-container">
<input id="api_key_azure_openai" data-setting="api_key_azure_openai" class="text_pole flex1" type="password" autocomplete="off">
<input id="api_key_azure_openai" data-setting="api_key_azure_openai" class="text_pole flex1" type="text" autocomplete="off">
<div title="Manage API keys" data-i18n="[title]Manage API keys" class="menu_button fa-solid fa-key fa-fw manage-api-keys" data-key="api_key_azure_openai"></div>
</div>
<div class="neutral_warning" data-i18n="For privacy reasons, your API key will be hidden after you click 'Connect'." data-for="api_key_azure_openai">
@@ -3986,6 +4019,37 @@
<small data-i18n="The underlying model of your deployment. This is detected automatically when you connect.">The underlying model of your deployment. This is detected automatically when you connect.</small>
</div>
</div>
<div id="model_sorting_form" data-source="openrouter,chutes,electronhub,nanogpt,aimlapi">
<div class="inline-drawer wide100p">
<div class="inline-drawer-toggle inline-drawer-header">
<b data-i18n="Model Sorting">Model Sorting</b>
<div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
</div>
<div class="inline-drawer-content m-b-1">
<div class="marginTopBot5">
<label for="cc_sort_models" class="checkbox_label">
<select id="cc_sort_models">
<option data-i18n="Alphabetically" value="alphabetically">Alphabetically</option>
<option data-i18n="Prompt Price (cheapest)" value="pricing.prompt">Prompt Price (cheapest)</option>
<option data-i18n="Completion Price (cheapest)" value="pricing.completion">Completion Price (cheapest)</option>
<option data-i18n="Context Size" value="context_length">Context Size</option>
</select>
</label>
</div>
<div class="marginTopBot5">
<label for="cc_group_models" class="checkbox_label">
<input id="cc_group_models" type="checkbox" />
<span data-i18n="Group by vendors">Group by vendors</span>
</label>
<div class="toggle-description justifyLeft wide100p">
<span data-i18n="Group by vendors Description">
Put OpenAI models in one group, Anthropic models in other group, etc. Can be combined with sorting.
</span>
</div>
</div>
</div>
</div>
</div>
<div id="prompt_post_processing_form">
<h4>
<span data-i18n="Prompt Post-Processing">
@@ -4015,7 +4079,7 @@
<div class="api_loading menu_button menu_button_icon" data-i18n="Cancel">Cancel</div>
<div data-source="custom" id="customize_additional_parameters" class="menu_button menu_button_icon" data-i18n="Additional Parameters">Additional Parameters</div>
<div data-source="openrouter" class="menu_button menu_button_icon openrouter_authorize" title="Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai" data-i18n="Authorize;[title]Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai">Authorize</div>
<div id="test_api_button" class="menu_button menu_button_icon" title="Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!" data-i18n="Test Message;[title]Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!">Test Message</div>
<div id="test_api_button" class="menu_button menu_button_icon" title="Verifies your API connection by sending a short test message. This may incur usage charges." data-i18n="Test Message;[title]Verifies your API connection by sending a short test message. This may incur usage charges.">Test Message</div>
</div>
<div class="online_status">
<div class="online_status_indicator"></div>
@@ -4365,7 +4429,7 @@
<small data-i18n="First User Prefix">First User Prefix</small>
<textarea id="instruct_first_input_sequence" data-macros class="text_pole textarea_compact autoSetHeight"></textarea>
</div>
<div class="flexAuto" title="Inserted before the last User's message." data-i18n="[title]instruct_last_input_sequence">
<div class="flexAuto" title="Inserted before the last User's message or as a last prompt line when generating an impersonation." data-i18n="[title]instruct_last_input_sequence">
<small data-i18n="Last User Prefix">Last User Prefix</small>
<textarea id="instruct_last_input_sequence" data-macros class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
</div>
@@ -4775,7 +4839,7 @@
<input type="file" id="world_import_file" accept=".json,.lorebook,.png" name="avatar" hidden>
<div id="world_create_button" class="menu_button menu_button_icon">
<i class="fa-solid fa-globe"></i>
<span data-i18n="New">New</span>
<span data-i18n="Create">Create</span>
</div>
<small data-i18n="or">or</small>
<select id="world_editor_select">
@@ -6733,7 +6797,7 @@
<small class="chat_file_size select_chat_block_filename_item"></small>
<small class="chat_messages_num select_chat_block_filename_item"></small>
</div>
<div class="flex-container gap10px">
<div class="select_chat_actions flex-container gap10px">
<div title="Export JSONL chat file" data-format="jsonl" class="exportRawChatButton opacity50p hoverglow fa-solid fa-file-export" data-i18n="[title]Export JSONL chat file"></div>
<div title="Download chat as plain text document" data-format="txt" class="exportChatButton opacity50p hoverglow fa-solid fa-file-lines" data-i18n="[title]Download chat as plain text document"></div>
<div title="Delete chat file" file_name="" class="PastChat_cross opacity50p hoverglow fa-solid fa-skull" data-i18n="[title]Delete chat file"></div>
+3
View File
@@ -24,6 +24,7 @@ import chalk from 'chalk';
import yaml from 'yaml';
import * as chevrotain from 'chevrotain';
import { gzipSync, gzip } from 'fflate';
import { sha256 } from 'js-sha256';
/**
* Expose the libraries to the 'window' object.
@@ -105,6 +106,7 @@ export default {
chevrotain,
gzipSync,
gzip,
sha256,
};
export {
@@ -132,4 +134,5 @@ export {
chevrotain,
gzipSync,
gzip,
sha256,
};
+1 -1
View File
@@ -396,7 +396,7 @@
"Available Models": "النماذج المتاحة",
"Prompt Post-Processing": "موجه بعد المعالجة",
"Applies additional processing to the prompt before sending it to the API.": "يطبق معالجة إضافية على الموجه قبل إرساله إلى واجهة برمجة التطبيقات.",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "تتحقق من اتصالك بواجهة برمجة التطبيقات من خلال إرسال رسالة اختبار قصيرة. كن على علم بأنك ستحصل على الفضل في ذلك!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "يتحقق من اتصال API الخاص بك عن طريق إرسال رسالة اختبار قصيرة. قد يؤدي ذلك إلى فرض رسوم استخدام.",
"Test Message": "رسالة اختبار",
"Auto-connect to Last Server": "الاتصال التلقائي بآخر خادم",
"Missing key": "❌المفتاح مفقود",
+1 -1
View File
@@ -396,7 +396,7 @@
"Available Models": "Verfügbare Modelle",
"Prompt Post-Processing": "Zeitnahe Nachbearbeitung",
"Applies additional processing to the prompt before sending it to the API.": "Wendet zusätzliche Verarbeitungsvorgänge auf die Eingabeaufforderung an, bevor sie an die API gesendet wird.",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Überprüft deine API-Verbindung durch Senden einer kurzen Testnachricht. Sei dir bewusst, dass du dafür gutgeschrieben wirst!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "Überprüft deine API-Verbindung durch Senden einer kurzen Testnachricht. Dabei können Nutzungsgebühren anfallen.",
"Test Message": "Testnachricht",
"Auto-connect to Last Server": "Automatisch mit dem letzten Server verbinden",
"Missing key": "❌ Fehlender Schlüssel",
+1 -1
View File
@@ -396,7 +396,7 @@
"Available Models": "Modelos disponibles",
"Prompt Post-Processing": "Postprocesamiento rápido",
"Applies additional processing to the prompt before sending it to the API.": "Aplica procesamiento adicional al mensaje antes de enviarlo a la API.",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Verifica su conexión de API enviando un breve mensaje de prueba. ¡Tenga en cuenta que se le cobrará por ello!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "Verifica su conexión API enviando un breve mensaje de prueba. Esto puede generar cargos de uso.",
"Test Message": "Mensaje de prueba",
"Auto-connect to Last Server": "Conexión automática al último servidor",
"Missing key": "❌ Llave faltante",
+2 -2
View File
@@ -376,7 +376,7 @@
"Available Models": "Modèles disponibles",
"Prompt Post-Processing": "Post-traitement de prompt",
"Applies additional processing to the prompt before sending it to the API.": "Applique un traitement supplémentaire au prompt avant de l'envoyer à l'API.",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Vérifie votre connexion API en envoyant un court message de test. Soyez conscient que vous serez crédité pour cela !",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "Vérifie votre connexion API en envoyant un court message de test. Cela peut entraîner des frais d'utilisation.",
"Test Message": "Message de test",
"Auto-connect to Last Server": "Connexion automatique au dernier serveur",
"Missing key": "❌ Clé manquante",
@@ -717,7 +717,7 @@
"Click to set a new User Name": "Cliquez pour définir un nouveau nom d'utilisateur",
"Click to lock your selected persona to the current chat. Click again to remove the lock.": "Cliquez pour verrouiller votre persona sélectionnée sur la discussion actuelle. Cliquez à nouveau pour supprimer le verrou.",
"Click to set user name for all messages": "Cliquez pour définir le nom d'utilisateur pour tous les messages",
"Persona Description": "Description de la persona",
"Persona Description": "Description du persona",
"Example: [{{user}} is a 28-year-old Romanian cat girl.]": "Exemple : [{{user}} est une fille chat roumaine de 28 ans.]",
"Tokens persona description": "Description des tokens",
"Position:": "Position :",
+1 -1
View File
@@ -394,7 +394,7 @@
"Available Models": "Módel í boði",
"Prompt Post-Processing": "Skjót eftirvinnsla",
"Applies additional processing to the prompt before sending it to the API.": "Beitir viðbótarvinnslu á boðunina áður en hún er send í API.",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Sannreynir API tengingu þína með því að senda stutt skilaboð til að prófa. Vertu meðvituð(ur/ur) um að þú færð fyrir það!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "Staðfestir API tenginguna þína með því að senda stutt prufuskilaboð. Þetta gæti haft afnotagjöld í för með sér.",
"Test Message": "Prufu skilaboð",
"Auto-connect to Last Server": "Tengjast sjálfkrafa við síðustu framendurnar",
"Missing key": "❌ Vantar lykil",
+1 -1
View File
@@ -396,7 +396,7 @@
"Available Models": "Modelli disponibili",
"Prompt Post-Processing": "Post-elaborazione rapida",
"Applies additional processing to the prompt before sending it to the API.": "Applica un'ulteriore elaborazione al prompt prima di inviarlo all'API.",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Verifica la tua connessione API inviando un breve messaggio di prova. Tieni presente che verrai accreditato per questo!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "Verifica la tua connessione API inviando un breve messaggio di prova. Ciò potrebbe comportare costi di utilizzo.",
"Test Message": "Messaggio di prova",
"Auto-connect to Last Server": "Connetti automaticamente all'ultimo server",
"Missing key": "❌ Chiave mancante",
+1 -1
View File
@@ -396,7 +396,7 @@
"Available Models": "利用可能なモデル",
"Prompt Post-Processing": "迅速な後処理",
"Applies additional processing to the prompt before sending it to the API.": "プロンプトを API に送信する前に追加の処理を適用します。",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "短いテストメッセージを送信してAPI接続を検証します。それに対してクレジットが与えられることに注意してください!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "短いテストメッセージを送信してAPI接続を検証します。これにより利用料金が発生する場合があります。",
"Test Message": "テストメッセージ",
"Auto-connect to Last Server": "前回のサーバーに自動接続",
"Missing key": "❌ キーがありません",
+1 -1
View File
@@ -404,7 +404,7 @@
"Prompt Post-Processing": "신속한 후처리",
"api_no_connection": "연결이 되지 않았습니다...",
"Applies additional processing to the prompt before sending it to the API.": "API로 보내기 전에 프롬프트에 추가 처리를 적용합니다.",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "짧은 테스트 메시지를 보내어 API 연결을 확인합니다. 이에 대해 유료 크레딧이 지불될 수 있음을 인식하세요!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "짧은 테스트 메시지를 보내 API 연결을 확인합니다. 이로 인해 사용 요금이 부과될 수 있습니다.",
"Test Message": "테스트 메시지",
"Auto-connect to Last Server": "마지막 서버에 자동으로 연결",
"Missing key": "❌ 현재 저장된 키가 존재하지 않습니다.",
+1 -1
View File
@@ -392,7 +392,7 @@
"Available Models": "Beschikbare modellen",
"Prompt Post-Processing": "Snelle naverwerking",
"Applies additional processing to the prompt before sending it to the API.": "Past extra verwerking toe op de prompt voordat deze naar de API wordt verzonden.",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Verifieert uw API-verbinding door een kort testbericht te verzenden. Wees ervan bewust dat u hiervoor wordt gecrediteerd!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "Verifieert uw API-verbinding door een kort testbericht te verzenden. Hiervoor kunnen gebruikskosten in rekening worden gebracht.",
"Test Message": "Testbericht",
"Auto-connect to Last Server": "Automatisch verbinden met de laatste server",
"Missing key": "❌ Ontbrekende sleutel",
+1 -1
View File
@@ -394,7 +394,7 @@
"Available Models": "Modelos Disponíveis",
"Prompt Post-Processing": "Pós-processamento imediato",
"Applies additional processing to the prompt before sending it to the API.": "Aplica processamento adicional ao prompt antes de enviá-lo para a API.",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Verifica sua conexão com a API enviando uma mensagem de teste curta. Esteja ciente de que você será creditado por isso!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "Verifica a ligação à API ao enviar uma mensagem de teste curta. Isto pode implicar custos de utilização.",
"Test Message": "Mensagem de Teste",
"Auto-connect to Last Server": "Conectar-se automaticamente ao último servidor",
"Missing key": "❌ Chave faltando",
+1 -1
View File
@@ -514,7 +514,7 @@
"Clear your API key": "Стереть ключ от API",
"Refresh models": "Обновить модели",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "Получите свой OpenRouter API токен используя OAuth. У вас будет открыта вкладка openrouter.ai",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Проверка работоспособности вашего соединения с API путём отправки короткого тестового сообщения. Внимание: оно будет отправлено от вашего имени.",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "Проверяет соединение с API, отправляя короткое тестовое сообщение. Это может повлечь плату за использование.",
"Edit": "Редактировать",
"Locked = World Editor will stay open": "Закреплено = Редактор мира останется открытым",
"Entries can activate other entries by mentioning their keywords": "Записи могут активировать другие записи, если в них содержатся ключевые слова",
+1 -1
View File
@@ -401,7 +401,7 @@
"Available Models": "โมเดลที่สามารถใช้ได้",
"Prompt Post-Processing": "การประมวลผลพรอมต์หลังการส่ง",
"Applies additional processing to the prompt before sending it to the API.": "ใช้การประมวลผลเพิ่มเติมกับพรอมต์ก่อนส่งไปยัง API",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "ตรวจสอบการเชื่อมต่อ API โดยส่งข้อความทดสอบสั้นๆ โปรดทราบว่าคุณจะถูกเรียกเก็บเงินสำหรับการทดสอบนี้!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "ตรวจสอบการเชื่อมต่อ API โดยส่งข้อความทดสอบสั้นๆ ซึ่งอาจมีค่าใช้จ่ายในการใช้งาน",
"Test Message": "ทดสอบการส่งข้อความ",
"Auto-connect to Last Server": "เชื่อมต่อเซิฟเวอร์อัตโนมัติ",
"Missing key": "โปรดใส่ API Key",
+1 -1
View File
@@ -394,7 +394,7 @@
"Available Models": "Доступні моделі",
"Prompt Post-Processing": "Швидка постобробка",
"Applies additional processing to the prompt before sending it to the API.": "Застосовує додаткову обробку запиту перед надсиланням його в API.",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Підтверджує ваше підключення до API, надсилаючи коротке тестове повідомлення. Пам'ятайте, що ви будете платити за це!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "Перевіряє підключення до API, надсилаючи коротке тестове повідомлення. За це може стягуватися плата за використання.",
"Test Message": "Тестове повідомлення",
"Auto-connect to Last Server": "Автоматичне підключення до останнього сервера",
"Missing key": "❌ Відсутній ключ",
+1 -1
View File
@@ -394,7 +394,7 @@
"Available Models": "Các Model hiện có",
"Prompt Post-Processing": "Xử lý hậu kỳ Prompt",
"Applies additional processing to the prompt before sending it to the API.": "Áp dụng xử lý bổ sung cho Prompt trước khi gửi nó tới API.",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Xác minh kết nối API của bạn bằng cách gửi một tin nhắn kiểm tra ngắn. Hãy nhớ rằng bạn sẽ được ghi nhận về điều đó!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "Xác minh kết nối API của bạn bằng cách gửi tin nhắn kiểm tra ngắn. Việc này có thể phát sinh phí sử dụng.",
"Test Message": "Test tin nhắn",
"Auto-connect to Last Server": "Tự động kết nối với link trước đó",
"Missing key": "❌ Thiếu Key",
+1 -1
View File
@@ -556,7 +556,7 @@
"prompt_post_processing_single": "单一用户消息(无工具)",
"Additional Parameters": "附加参数",
"Test Message": "发送测试消息",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "通过发送简短的测试消息验证您的API连接。请注意,您将因此消耗额度!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "通过发送简短的测试消息验证您的 API 连接。这可能会产生使用费用。",
"Auto-connect to Last Server": "自动连接到上次的服务器",
"Missing key": "❌ 缺少密钥",
"Key saved": "密钥已保存",
+1 -1
View File
@@ -393,7 +393,7 @@
"Available Models": "可用模型",
"Prompt Post-Processing": "提示詞後處理",
"Applies additional processing to the prompt before sending it to the API.": "這個選項會在將提示詞送往 API 之前,對它進行額外的處理。",
"Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "透過傳送簡短的測試訊息來驗證您的 API 連線。請注意,您將因此獲得榮譽!",
"Verifies your API connection by sending a short test message. This may incur usage charges.": "透過傳送簡短的測試訊息來驗證您的 API 連線。這可能會產生使用費用。",
"Test Message": "測試訊息",
"Auto-connect to Last Server": "自動連線至上次使用的伺服器",
"Missing key": "❌ 鑰匙遺失",
+171 -53
View File
@@ -213,7 +213,7 @@ import {
tag_import_setting,
applyCharacterTagsToMessageDivs,
} from './scripts/tags.js';
import { initSecrets, readSecretState } from './scripts/secrets.js';
import { checkOpenRouterAuth, initSecrets, readSecretState } from './scripts/secrets.js';
import { markdownExclusionExt } from './scripts/showdown-exclusion.js';
import { markdownUnderscoreExt } from './scripts/showdown-underscore.js';
import { NOTE_MODULE_NAME, initAuthorsNote, metadata_keys, setFloatingPrompt, shouldWIAddPrompt } from './scripts/authors-note.js';
@@ -282,6 +282,7 @@ import { initDomHandlers } from './scripts/dom-handlers.js';
import { SimpleMutex } from './scripts/util/SimpleMutex.js';
import { AudioPlayer } from './scripts/audio-player.js';
import { MacroEnvBuilder } from './scripts/macros/engine/MacroEnvBuilder.js';
import { MessageFormatter } from './scripts/message-formatter.js';
import { MacroEngine } from './scripts/macros/engine/MacroEngine.js';
import { addChatBackupsBrowser } from './scripts/chat-backups.js';
import { onboardingExperimentalMacroEngine } from './scripts/macros/engine/MacroDiagnostics.js';
@@ -603,6 +604,7 @@ export let is_send_press = false; //Send generation
export const isGenerating = () => (is_send_press || is_group_generating);
let this_del_mes = -1;
let deleteToolCallsInDeleteMode = true;
/** @type {string} */
let this_edit_mes_chname = '';
@@ -717,6 +719,7 @@ async function firstLoadInit() {
initLoaderOverlay.appendChild(splashMessage);
const initLoaderHandle = loader.show({
slug: 'app-init',
toastMode: loader.ToastMode.NONE,
overlayContent: initLoaderOverlay,
});
@@ -741,12 +744,13 @@ async function firstLoadInit() {
initKoboldSettings();
initNovelAISettings();
initSystemPrompts();
initExtensions();
await initExtensions();
initExtensionSlashCommands();
ToolManager.initToolSlashCommands();
await initPresetManager();
await initSystemMessages();
await getSettings(initLoaderHandle);
await checkOpenRouterAuth();
initKeyboard();
initDynamicStyles();
initTags();
@@ -1607,13 +1611,32 @@ export async function deleteLastMessage() {
await eventSource.emit(event_types.MESSAGE_DELETED, chat.length);
}
function getMessageDeletionStartId(id, deleteToolCalls = true) {
const message = chat[id];
if (!deleteToolCalls || message?.is_user || message?.is_system) {
return id;
}
let startId = id;
while (startId > 0) {
const previousMessage = chat[startId - 1];
if (!previousMessage?.is_system || !Array.isArray(previousMessage.extra?.tool_invocations)) {
break;
}
startId--;
}
return startId;
}
/**
* Deletes a message from the chat by its ID, optionally asking for confirmation.
* @param {number} id The ID of the message to delete.
* @param {number} [swipeDeletionIndex] Deletes the swipe with that index.
* @param {boolean} [askConfirmation=false] Whether to ask for confirmation before deleting.
* @param {boolean} [deleteToolCalls=true] Whether to delete preceding tool-call messages.
*/
export async function deleteMessage(id, swipeDeletionIndex = undefined, askConfirmation = false) {
export async function deleteMessage(id, swipeDeletionIndex = undefined, askConfirmation = false, deleteToolCalls = true) {
const canDeleteSwipe = swipeDeletionIndex !== undefined && swipeDeletionIndex !== null;
if (canDeleteSwipe) {
if (swipeDeletionIndex < 0) {
@@ -1651,13 +1674,19 @@ export async function deleteMessage(id, swipeDeletionIndex = undefined, askConfi
return;
}
chat.splice(id, 1);
messageElement.remove();
const firstMessageId = getMessageDeletionStartId(id, deleteToolCalls);
const messageIds = Array.from({ length: id - firstMessageId + 1 }, (_, index) => id - index);
// Delete from the end so earlier indices remain stable.
for (const messageId of messageIds) {
chat.splice(messageId, 1);
chatElement.find(`.mes[mesid="${messageId}"]`).remove();
deleteItemizedPromptForMessage(messageId);
}
chat_metadata.tainted = true;
const startIndex = [0, minId].includes(id) ? id : null;
deleteItemizedPromptForMessage(id);
const startIndex = firstMessageId <= minId ? firstMessageId : null;
updateViewMessageIds(startIndex);
saveChatDebounced();
@@ -1738,15 +1767,35 @@ export async function sendTextareaMessage() {
}
/**
* Formats the message text into an HTML string using Markdown and other formatting.
* @param {string} mes Message text
* @param {string} ch_name Character name
* @param {boolean} isSystem If the message was sent by the system
* @param {boolean} isUser If the message was sent by the user
* @param {number} messageId Message index in chat array
* @param {Partial<DOMPurify.Config>} [sanitizerOverrides] DOMPurify sanitizer option overrides
* @param {boolean} [isReasoning] If the message is reasoning output
* @returns {string} HTML string
* Formats raw message text into an HTML string ready for DOM insertion.
*
* The pipeline is, in order:
* 1. Prompt-bias stripping (message 0 only)
* 2. Comment / hidden-message normalisation
* 3. `beforeRegex` extension hooks (see {@link MessageFormatter})
* 4. Custom regex rules (`getRegexedString`)
* 5. `afterRegex` extension hooks
* 6. Markdown auto-fix (`fixMarkdown`)
* 7. HTML tag encoding (`encode_tags`)
* 8. Showdown Markdown → HTML conversion
* 9. `afterMarkdown` extension hooks
* 10. Name-prefix stripping (`allow_name2_display`)
* 11. DOMPurify sanitization
*
* All extension hooks run **before** DOMPurify (steps 3, 5, 9) so their
* output is always sanitised.
*
* @param {string} mes - Raw message text.
* @param {string} ch_name - Character name associated with the message.
* @param {boolean} isSystem - Whether the message is a system message.
* @param {boolean} isUser - Whether the message was sent by the user.
* @param {number} messageId - Index of the message in the chat array, or -1
* for transient messages (e.g. streaming previews).
* @param {Partial<DOMPurify.Config>} [sanitizerOverrides] - DOMPurify option
* overrides. Merged on top of the default config.
* @param {boolean} [isReasoning=false] - Whether the message is reasoning/thinking
* output (affects regex placement and some display rules).
* @returns {string} Sanitized HTML string ready to assign to `innerHTML`.
*/
export function messageFormatting(mes, ch_name, isSystem, isUser, messageId, sanitizerOverrides = {}, isReasoning = false) {
if (!mes) {
@@ -1803,12 +1852,20 @@ export function messageFormatting(mes, ch_name, isSystem, isUser, messageId, san
const indexOf = usableMessages.findIndex(x => x.index === Number(messageId));
const depth = messageId >= 0 && indexOf !== -1 ? (usableMessages.length - indexOf - 1) : undefined;
mes = MessageFormatter.runStage(MessageFormatter.stage.BEFORE_REGEX, mes,
{ ch_name, isSystem, isUser, messageId, isReasoning },
);
// Always override the character name
mes = getRegexedString(mes, regexPlacement, {
characterOverride: ch_name,
isMarkdown: true,
depth: depth,
});
mes = MessageFormatter.runStage(MessageFormatter.stage.AFTER_REGEX, mes,
{ ch_name, isSystem, isUser, messageId, isReasoning },
);
}
if (power_user.auto_fix_generated_markdown) {
@@ -1887,6 +1944,10 @@ export function messageFormatting(mes, ch_name, isSystem, isUser, messageId, san
mes = mes.replace(/<code(.*)>[\s\S]*?<\/code>/g, function (match) {
return match.replace(/&amp;/g, '&');
});
mes = MessageFormatter.runStage(MessageFormatter.stage.AFTER_MARKDOWN, mes,
{ ch_name, isSystem, isUser, messageId, isReasoning },
);
}
if (!power_user.allow_name2_display && ch_name && !isUser && !isSystem) {
@@ -1909,6 +1970,23 @@ export function messageFormatting(mes, ch_name, isSystem, isUser, messageId, san
return mes;
}
/**
* Creates an Image element for the given API/model icon.
* The image references the matching SVG file from `/img/` and includes a tooltip with API and model info.
* The caller is responsible for appending the image to the DOM and optionally calling `SVGInject` on it.
*
* @param {string} apiName - API identifier matching an SVG file in /img/ (e.g. 'openai', 'openrouter', 'claude')
* @param {string} [modelName=''] - Model name shown in the tooltip
* @returns {HTMLImageElement} The image element (not yet in the DOM)
*/
export function createModelIcon(apiName, modelName = '') {
const image = new Image();
image.classList.add('icon-svg');
image.src = `/img/${apiName}.svg`;
image.title = modelName ? `${apiName} - ${modelName}` : apiName;
return image;
}
/**
* Inserts or replaces an SVG icon adjacent to the provided message's timestamp.
*
@@ -1916,11 +1994,9 @@ export function messageFormatting(mes, ch_name, isSystem, isUser, messageId, san
* @param {ChatMessageExtra} extra - Contains the API and model details.
*/
function insertSVGIcon(mes, extra) {
// Determine the SVG filename
let modelName = extra?.api || '';
const apiName = extra?.api || '';
// If there's no API information, we can't determine which SVG to use
if (!modelName) {
if (!apiName) {
return;
}
@@ -1937,16 +2013,14 @@ function insertSVGIcon(mes, extra) {
};
};
const createModelImage = (className, targetSelector, insertBefore) => {
const image = new Image();
image.classList.add('icon-svg', className);
image.src = `/img/${modelName}.svg`;
image.title = `${extra?.api ? extra.api + ' - ' : ''}${extra?.model ?? ''}`;
const insertIcon = (className, targetSelector, insertBefore) => {
const image = createModelIcon(apiName, extra?.model);
image.classList.add(className);
insertOrReplaceSVG(image, className, targetSelector, insertBefore);
};
createModelImage('timestamp-icon', '.timestamp');
createModelImage('thinking-icon', '.mes_reasoning_header_title', true);
insertIcon('timestamp-icon', '.timestamp');
insertIcon('thinking-icon', '.mes_reasoning_header_title', true);
}
/**
@@ -2907,6 +2981,11 @@ export function substituteParamsLegacy(content, _name1, _name2, _original, _grou
export function substituteParams(content, options = {}) {
if (!content) return '';
if (typeof content !== 'string') {
console.warn('substituteParams: content will be coerced to string', content);
content = String(content);
}
// Handle legacy signature calls to substituteParams
// We'll simply re-route them to a temporary legacy function. In the future, we'll remove this and cleanly build the options object ourselves.
const isOptionsObject = options && typeof options === 'object' && !Array.isArray(options);
@@ -3847,9 +3926,7 @@ export function createRawPrompt(prompt, api, instructOverride, quietToLoud, syst
// If the prompt was given as a string, convert to a message-style object assuming user role
if (typeof prompt === 'string') {
const message = api === 'openai'
? { role: 'user', content: prompt.trim() }
: { role: 'system', content: prompt };
const message = { role: 'user', content: prompt.trim() };
prompt = [message];
} else { // checks for message-style object
if (prompt.length === 0 && !systemPrompt) throw Error('No messages provided');
@@ -3876,7 +3953,12 @@ export function createRawPrompt(prompt, api, instructOverride, quietToLoud, syst
// prepend system prompt, if provided
if (systemPrompt) {
systemPrompt = substituteParams(systemPrompt);
systemPrompt = isInstruct ? (formatInstructModeStoryString(systemPrompt) + '\n') : systemPrompt.trim();
systemPrompt = isInstruct ? formatInstructModeStoryString(systemPrompt) : systemPrompt.trim();
if (isInstruct && systemPrompt.length > 0 && !systemPrompt.endsWith('\n')) {
if (power_user.instruct.wrap && !power_user.instruct.story_string_suffix) {
systemPrompt += '\n';
}
}
prompt.unshift({ role: 'system', content: systemPrompt });
}
@@ -3906,7 +3988,7 @@ export function createRawPrompt(prompt, api, instructOverride, quietToLoud, syst
* @prop {number} [responseLength] Maximum response length. If unset, the global default value is used.
* @prop {boolean} [trimNames] Whether to allow trimming "{{user}}:" and "{{char}}:" from the response.
* @prop {string} [prefill] An optional prefill for the prompt.
* @prop {object} [jsonSchema] JSON schema to use for the structured generation. Usually requires a special instruction.
* @prop {JsonSchema} [jsonSchema] JSON schema to use for the structured generation. Usually requires a special instruction.
*/
/**
@@ -4018,7 +4100,7 @@ export async function generateRawData({ prompt = '', api = null, instructOverrid
}
if (jsonSchema) {
return extractJsonFromData(data, { mainApi: api });
return extractJsonFromData(data, { mainApi: api, returnInvalidJson: jsonSchema.returnInvalid });
}
return data;
@@ -4181,6 +4263,7 @@ function removeLastMessage() {
* @property {object} value JSON schema value.
* @property {string} [description] Description of the schema.
* @property {boolean} [strict] If true, the schema will be used in strict mode, meaning that only the fields defined in the schema will be allowed.
* @property {boolean} [returnInvalid] If true, a string that can't be parsed as a JSON will be returned as is, instead of an empty object.
*
* @typedef {object} GenerateOptions
* @property {boolean} [automatic_trigger] If the generation was triggered automatically (e.g. group auto mode).
@@ -4267,7 +4350,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
if (selected_group && !is_group_generating) {
if (!dryRun) {
// Returns the promise that generateGroupWrapper returns; resolves when generation is done
return generateGroupWrapper(false, type, { quiet_prompt, force_chid, signal: abortController.signal, quietImage });
return generateGroupWrapper(false, type, { quiet_prompt, force_chid, signal: abortController.signal, quietImage, jsonSchema });
}
const characterIndexMap = new Map(characters.map((char, index) => [char.avatar, index]));
@@ -4449,18 +4532,24 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
for (let i = coreChat.length - 1; i >= 0; i--) {
const depth = coreChat.length - i - (isContinue ? 2 : 1);
const isPrefix = isContinue && i === coreChat.length - 1;
// In group chats, only include reasoning from the currently generating character
const isOtherGroupMember = selected_group && coreChat[i].name !== name2;
coreChat[i] = {
...coreChat[i],
mes: promptReasoning.addToMessage(
coreChat[i].mes,
getRegexedString(
String(coreChat[i].extra?.reasoning ?? ''),
regex_placement.REASONING,
{ isPrompt: true, depth: depth },
mes: isOtherGroupMember
? coreChat[i].mes
: promptReasoning.addToMessage(
coreChat[i].mes,
getRegexedString(
String(coreChat[i].extra?.reasoning ?? ''),
regex_placement.REASONING,
{ isPrompt: true, depth: depth },
),
isPrefix,
coreChat[i].extra?.reasoning_duration,
),
isPrefix,
coreChat[i].extra?.reasoning_duration,
),
};
if (promptReasoning.isLimitReached()) {
break;
@@ -4697,7 +4786,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
chat2[i] = formatMessageHistoryItem(coreChat[j], isInstruct, force_output_sequence.FIRST);
}
if (lastUserMessageIndex >= 0 && j === lastUserMessageIndex && isInstruct) {
if (lastUserMessageIndex >= 0 && j === lastUserMessageIndex && isInstruct && !isImpersonate) {
// Reformat with the last input sequence (if any)
chat2[i] = formatMessageHistoryItem(coreChat[j], isInstruct, force_output_sequence.LAST);
}
@@ -5301,7 +5390,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
streamingProcessor.firstMessageText = '';
}
streamingProcessor.generator = await sendStreamingRequest(type, generate_data);
streamingProcessor.generator = await sendStreamingRequest(type, generate_data, { jsonSchema });
hideSwipeButtons();
let getMessage = await streamingProcessor.generate();
@@ -5390,7 +5479,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
if (jsonSchema) {
unblockGeneration(type);
return extractJsonFromData(data);
return extractJsonFromData(data, { returnInvalidJson: jsonSchema.returnInvalid ?? false });
}
//const getData = await response.json();
@@ -5823,11 +5912,11 @@ export async function sendMessageAsUser(messageText, messageBias, insertAt = nul
await eventSource.emit(event_types.USER_MESSAGE_RENDERED, insertAt);
} else {
chat.push(message);
await saveChatConditional();
const chat_id = (chat.length - 1);
await eventSource.emit(event_types.MESSAGE_SENT, chat_id);
addOneMessage(message);
await eventSource.emit(event_types.USER_MESSAGE_RENDERED, chat_id);
await saveChatConditional();
}
return message;
@@ -6003,7 +6092,7 @@ function setInContextMessages(msgInContextCount, type) {
if (lastMessageBlock.length === 0) {
const firstMessageId = getFirstDisplayedMessageId();
chatElement.find(`.mes[mesid="${firstMessageId}"`).addClass('lastInContext');
chatElement.find(`.mes[mesid="${firstMessageId}"]`).addClass('lastInContext');
}
// Update last id to chat. No metadata save on purpose, gets hopefully saved via another call
@@ -6213,9 +6302,13 @@ export function extractMessageFromData(data, activeApi = null) {
/**
* Extracts JSON from the response data.
* @param {object} data Response data
* @param {object} [options] Extraction options
* @param {string} [options.mainApi] Main API to use
* @param {string} [options.chatCompletionSource] Chat completion source
* @param {boolean} [options.returnInvalidJson=false] Whether to return the raw JSON string even if it fails to parse
* @returns {string} Extracted JSON string from the response data
*/
export function extractJsonFromData(data, { mainApi = null, chatCompletionSource = null } = {}) {
export function extractJsonFromData(data, { mainApi = null, chatCompletionSource = null, returnInvalidJson = false } = {}) {
mainApi = mainApi ?? main_api;
chatCompletionSource = chatCompletionSource ?? oai_settings.chat_completion_source;
@@ -6238,6 +6331,9 @@ export function extractJsonFromData(data, { mainApi = null, chatCompletionSource
break;
case chat_completion_sources.PERPLEXITY:
result = tryParse(removeReasoningFromString(text));
if (!result && returnInvalidJson) {
return text;
}
break;
case chat_completion_sources.VERTEXAI:
case chat_completion_sources.MAKERSUITE:
@@ -6258,6 +6354,9 @@ export function extractJsonFromData(data, { mainApi = null, chatCompletionSource
case chat_completion_sources.ZAI:
default:
result = tryParse(text);
if (!result && returnInvalidJson) {
return text;
}
break;
}
} break;
@@ -7924,6 +8023,15 @@ export async function getSettings(initLoaderHandle = null) {
const isVersionChanged = settings.currentVersion !== currentVersion;
await loadExtensionSettings(settings, isVersionChanged, enableAutoUpdate);
await eventSource.emit(event_types.EXTENSION_SETTINGS_LOADED);
} else {
Object.assign(extension_settings, (settings.extension_settings ?? {}));
$('#third_party_extension_button').addClass('disabled');
$('#extensions_details').addClass('disabled');
$('#extensions_connect').addClass('disabled');
$('#extensions_notify_updates').attr('disabled', 'disabled');
$('#extensions_autoconnect').attr('disabled', 'disabled');
$('#extensions_url').attr('disabled', 'disabled');
$('#extensions_api_key').attr('disabled', 'disabled');
}
firstRun = !!settings.firstRun;
@@ -8084,7 +8192,7 @@ function updateMessage(div) {
return { mesBlock, text, mes, bias };
}
function openMessageDelete(fromSlashCommand) {
function openMessageDelete(fromSlashCommand, deleteToolCalls = true) {
closeMessageEditor();
hideSwipeButtons();
if (fromSlashCommand || (!is_send_press) || (selected_group && !is_group_generating)) {
@@ -8103,6 +8211,7 @@ function openMessageDelete(fromSlashCommand) {
is_group_generating: ${is_group_generating}`);
}
this_del_mes = -1;
deleteToolCallsInDeleteMode = deleteToolCalls;
is_delete_mode = true;
}
@@ -9665,7 +9774,7 @@ export async function createOrEditCharacter(e) {
return;
}
try {
//if the character name text area isn't empty (only posible when creating a new character)
//if the character name text area isn't empty (only possible when creating a new character)
let url = '/api/characters/create';
if (crop_data != undefined) {
@@ -10565,6 +10674,7 @@ export async function renameGroupOrCharacterChat({ characterId, groupId, oldFile
}
const loaderHandle = showLoader ? loader.show({
slug: 'chat-rename',
title: t`Rename Chat`,
message: t`Renaming chat…`,
toastMode: loader.ToastMode.STATIC,
@@ -10602,6 +10712,9 @@ export async function renameGroupOrCharacterChat({ characterId, groupId, oldFile
if (currentChatId) {
await reloadCurrentChat();
}
const eventData = { avatarId: body.avatar_url, groupId, oldFileName: body.original_file, newFileName: body.renamed_file };
await eventSource.emit(event_types.CHAT_RENAMED, eventData);
} catch {
await delay(500);
await callGenericPopup('An error has occurred. Chat was not renamed.', POPUP_TYPE.TEXT);
@@ -11143,6 +11256,7 @@ jQuery(async function () {
});
$(this).addClass('selected'); //sets the bg of the mes selected for deletion
var i = Number($(this).attr('mesid')); //checks the message ID in the chat
i = getMessageDeletionStartId(i, deleteToolCallsInDeleteMode);
this_del_mes = i;
//as long as the current message ID is less than the total chat length
while (i < chat.length) {
@@ -11166,6 +11280,7 @@ jQuery(async function () {
$('#select_chat_cross').trigger('click');
const loaderHandle = loader.show({
slug: 'chat-delete',
title: t`Delete Chat`,
message: t`Deleting chat…`,
toastMode: loader.ToastMode.STATIC,
@@ -11466,6 +11581,7 @@ jQuery(async function () {
///////////// OPTIMIZED LISTENERS FOR LEFT SIDE OPTIONS POPUP MENU //////////////////////
$('#options [id]').on('click', async function (event, customData) {
const fromSlashCommand = customData?.fromSlashCommand || false;
const deleteToolCalls = customData?.deleteToolCalls ?? true;
var id = $(this).attr('id');
// Check whether a custom prompt was provided via custom data (for example through a slash command)
@@ -11544,7 +11660,7 @@ jQuery(async function () {
Generate('continue', buildOrFillAdditionalArgs());
}
} else if (id == 'option_delete_mes') {
setTimeout(() => openMessageDelete(fromSlashCommand), animation_duration);
setTimeout(() => openMessageDelete(fromSlashCommand, deleteToolCalls), animation_duration);
} else if (id == 'option_close_chat') {
await closeCurrentChat();
} else if (id === 'option_settings') {
@@ -12460,7 +12576,9 @@ jQuery(async function () {
$('#avatar-and-name-block').slideToggle();
});
$(document).on('mouseup touchend', '#show_more_messages', async function () {
$(document).on('click', '#show_more_messages', async function (event) {
event.stopPropagation();
event.preventDefault();
await showMoreMessages();
});
+1
View File
@@ -848,6 +848,7 @@ class BulkEditOverlay {
const deleteChats = checkbox.prop('checked') ?? false;
const loaderHandle = loader.show({
slug: 'bulk-delete',
title: t`Bulk Delete`,
message: t`Deleting ${characterIds.length} character(s)…`,
toastMode: loader.ToastMode.STATIC,
+4 -2
View File
@@ -34,7 +34,7 @@ import {
secret_state,
} from './secrets.js';
import { debounce, getStringHash, isValidUrl } from './utils.js';
import { chat_completion_sources, oai_settings } from './openai.js';
import { chat_completion_sources, oai_settings, POLLINATIONS_ENDPOINT } from './openai.js';
import { getTokenCountAsync } from './tokenizers.js';
import { textgen_types, textgenerationwebui_settings as textgen_settings, getTextGenServer } from './textgen-settings.js';
import { debounce_timeout, SWIPE_SOURCE } from './constants.js';
@@ -406,7 +406,9 @@ function RA_autoconnect(PrevApi) {
|| (secret_state[SECRET_KEYS.FIREWORKS] && oai_settings.chat_completion_source == chat_completion_sources.FIREWORKS)
|| (secret_state[SECRET_KEYS.COMETAPI] && oai_settings.chat_completion_source == chat_completion_sources.COMETAPI)
|| (secret_state[SECRET_KEYS.ZAI] && oai_settings.chat_completion_source == chat_completion_sources.ZAI)
|| (secret_state[SECRET_KEYS.POLLINATIONS] && oai_settings.chat_completion_source === chat_completion_sources.POLLINATIONS)
|| ((secret_state[SECRET_KEYS.POLLINATIONS] || oai_settings.pollinations_endpoint === POLLINATIONS_ENDPOINT.ANONYMOUS) && oai_settings.chat_completion_source === chat_completion_sources.POLLINATIONS)
|| (secret_state[SECRET_KEYS.WORKERS_AI] && oai_settings.chat_completion_source == chat_completion_sources.WORKERS_AI)
|| (secret_state[SECRET_KEYS.MINIMAX] && oai_settings.chat_completion_source == chat_completion_sources.MINIMAX)
|| (isValidUrl(oai_settings.custom_url) && oai_settings.chat_completion_source == chat_completion_sources.CUSTOM)
|| (secret_state[SECRET_KEYS.AZURE_OPENAI] && oai_settings.chat_completion_source == chat_completion_sources.AZURE_OPENAI)
) {
+1
View File
@@ -16,6 +16,7 @@ const buttonSelectors = [
'.jg-menu .jg-button',
'.bg_example .mobile-only-menu-toggle',
'.paginationjs-pages li a',
'#show_more_messages',
].join(', ');
const listSelectors = [
+22 -7
View File
@@ -1,4 +1,4 @@
import { ActionLoaderToastMode, getActiveLoaderHandles, getLoaderHandleById, hideActionLoader, showActionLoader } from './action-loader.js';
import { ActionLoaderToastMode, getActiveLoaderHandles, getLoaderHandleById, loader } from './action-loader.js';
import { t } from './i18n.js';
import { SlashCommand } from './slash-commands/SlashCommand.js';
import { SlashCommandNamedArgument, ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashCommandArgument.js';
@@ -7,6 +7,7 @@ import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCom
import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
import { isFalseBoolean } from './utils.js';
import { DOMPurify } from '../lib.js';
/**
* Registers slash commands for the action loader module.
@@ -115,6 +116,12 @@ export function registerActionLoaderSlashCommands() {
description: 'Optional title for the toast notification',
typeList: [ARGUMENT_TYPE.STRING],
}),
SlashCommandNamedArgument.fromProps({
name: 'slug',
description: 'Unique slug for the loader (to identify it easily via code or CSS)',
typeList: [ARGUMENT_TYPE.STRING],
defaultValue: 'slash-wrap',
}),
SlashCommandNamedArgument.fromProps({
name: 'stopTooltip',
description: 'Tooltip text for the stop button (only used when toast=stoppable)',
@@ -148,7 +155,8 @@ export function registerActionLoaderSlashCommands() {
const title = args.title ? String(args.title) : '';
const stopTooltip = String(args.stopTooltip ?? t`Stop`);
const loader = showActionLoader({
const actionLoader = loader.show({
slug: typeof args.slug === 'string' ? String(args.slug) : 'slash-wrap',
blocking,
toastMode,
message,
@@ -162,7 +170,7 @@ export function registerActionLoaderSlashCommands() {
const result = await closureCopy.execute();
return result.pipe;
} finally {
await loader.hide();
await actionLoader.hide();
}
},
}));
@@ -231,6 +239,12 @@ export function registerActionLoaderSlashCommands() {
description: 'Optional title for the toast notification',
typeList: [ARGUMENT_TYPE.STRING],
}),
SlashCommandNamedArgument.fromProps({
name: 'slug',
description: 'Unique slug for the loader (to identify it easily via code or CSS)',
typeList: [ARGUMENT_TYPE.STRING],
defaultValue: 'slash-show',
}),
SlashCommandNamedArgument.fromProps({
name: 'stopTooltip',
description: 'Tooltip text for the stop button (only used when toast=stoppable)',
@@ -258,11 +272,12 @@ export function registerActionLoaderSlashCommands() {
const title = args.title ? String(args.title) : '';
const stopTooltip = String(args.stopTooltip ?? t`Stop`);
const handle = showActionLoader({
const handle = loader.show({
slug: typeof args.slug === 'string' ? String(args.slug) : 'slash-show',
blocking,
toastMode,
message,
title,
message: DOMPurify.sanitize(message),
title: DOMPurify.sanitize(title),
stopTooltip,
onStop: createClosureHandler(args.onStop),
onHide: createClosureHandler(args.onHide, { argName: 'onHide' }),
@@ -307,7 +322,7 @@ export function registerActionLoaderSlashCommands() {
}
// No handle provided - hide all active loaders
const result = await hideActionLoader();
const result = await loader.hide();
return result ? 'true' : 'false';
},
}));
+47 -2
View File
@@ -33,6 +33,7 @@ export const ActionLoaderToastMode = {
* @typedef {object} ActionLoaderOptions
* @property {boolean} [blocking=true] - Whether to show the blocking overlay. Set to false for non-blocking toast-only loaders.
* @property {ActionLoaderToastMode} [toastMode='stoppable'] - Toast display mode
* @property {string} [slug=null] - Unique slug for the loader to identify it easily via code or CSS
* @property {string} [message='Generating...'] - The message to display in the toast
* @property {string} [title] - Optional title for the toast notification
* @property {string} [stopTooltip='Stop'] - Tooltip text for the stop button
@@ -73,8 +74,20 @@ function hasBlockingLoaders() {
* Manages its own toast, stop handler, and lifecycle.
*/
export class ActionLoaderHandle {
/**
* A special empty handle that is already disposed. Useful as a default value to avoid null checks.
* Does not generate any id, toast, or overlay, and all its methods are no-ops.
* @type {ActionLoaderHandle}
*/
static get EMPTY() {
return new ActionLoaderHandle({ predisposed: true });
}
/** @type {string} Unique identifier for this handle */
id;
#id;
/** @type {string|null} Unique slug for the loader */
#slug = null;
/** @type {JQuery<HTMLElement>|null} The toast element for this loader */
#toast = null;
@@ -96,9 +109,11 @@ export class ActionLoaderHandle {
* @param {object} options - Configuration options
* @param {boolean} [options.blocking=true] - Whether to show blocking overlay
* @param {ActionLoaderToastMode} [options.toastMode] - Toast display mode
* @param {string|null} [options.slug] - Unique slug for the loader (to identify it easily via code or CSS)
* @param {string} [options.message='Generating...'] - Message to display in the toast
* @param {string} [options.title] - Title for the toast notification
* @param {string} [options.stopTooltip='Stop'] - Tooltip for the stop button
* @param {boolean} [options.predisposed=false] - Whether this handle is already disposed (for special use)
* @param {HTMLElement|string|null} [options.overlayContent] - Custom content for the overlay (replaces default spinner)
* @param {(() => void)|null} [options.onStop] - Custom stop handler
* @param {(() => void)|null} [options.onHide] - Custom hide handler
@@ -106,14 +121,22 @@ export class ActionLoaderHandle {
constructor({
blocking = true,
toastMode = ActionLoaderToastMode.STOPPABLE,
slug = null,
message = t`Generating...`,
title = '',
stopTooltip = t`Stop`,
overlayContent = null,
onStop = null,
onHide = null,
predisposed = false,
} = {}) {
this.id = generateLoaderId();
if (predisposed) {
this.#disposed = true;
return;
}
this.#id = generateLoaderId();
this.#slug = slug;
this.#blocking = blocking;
this.#onStop = onStop;
this.#onHide = onHide;
@@ -148,6 +171,12 @@ export class ActionLoaderHandle {
const toastContent = document.createElement('div');
toastContent.className = 'action-loader-toast';
if (this.#slug) {
toastContent.dataset.slug = this.#slug;
}
toastContent.dataset.loaderId = this.#id;
toastContent.dataset.blocking = this.#blocking.toString();
const messageSpan = document.createElement('span');
messageSpan.className = 'action-loader-message';
messageSpan.textContent = message;
@@ -201,6 +230,22 @@ export class ActionLoaderHandle {
}
}
/**
* The unique identifier for this loader handle.
* @returns {string}
*/
get id() {
return this.#id;
}
/**
* The unique slug for this loader handle, used to identify it easily via code or CSS.
* @returns {string|null}
*/
get slug() {
return this.#slug;
}
/**
* Whether this handle is still active (not disposed).
* @returns {boolean}
+1 -1
View File
@@ -96,7 +96,7 @@ function setNotePositionCommand(_, text) {
return;
}
$(`input[name="extension_floating_position"][value="${position}"]`).prop('checked', true).trigger('input');
$(`input[name="extension_floating_position"][value="${position}"]`).prop('checked', true).trigger('input').trigger('change');
toastr.info(t`Author's Note position updated`);
}
return Object.keys(validPositions).find(key => validPositions[key] == chat_metadata[metadata_keys.position]);
+13 -3
View File
@@ -126,9 +126,17 @@ export class AutoComplete {
});
textarea.addEventListener('blur', () => this.hide());
if (isFloating) {
textarea.addEventListener('scroll', () => this.updateFloatingPositionDebounced());
textarea.addEventListener('scroll', () => {
if (this.isActive) {
this.updateFloatingPositionDebounced();
}
});
}
window.addEventListener('resize', () => this.updatePositionDebounced());
window.addEventListener('resize', () => {
if (this.isActive) {
this.updatePositionDebounced();
}
});
}
/**
@@ -666,7 +674,9 @@ export class AutoComplete {
this.clone.remove();
}
});
mo.observe(this.textarea.parentElement, { childList: true });
if (this.textarea.parentElement) {
mo.observe(this.textarea.parentElement, { childList: true });
}
}
this.clone.style.height = `${inputRect.height}px`;
this.clone.style.left = `${inputRect.left}px`;
+8 -4
View File
@@ -41,6 +41,7 @@ import { t } from './i18n.js';
import {
getUniqueName,
isTrueBoolean,
uuidv4,
} from './utils.js';
const bookmarkNameToken = 'Checkpoint #';
@@ -94,7 +95,7 @@ async function getBookmarkName({ isReplace = false, forceName = null } = {}) {
return `${cleanName} - ${bookmarkNameToken}${i}`;
}
const existingChats = await getExistingChatNames();
const suggestedName = getUniqueName(mainChatName, (x) => existingChats.includes(x), { nameBuilder: buildCheckpointName });
const suggestedName = getUniqueName(mainChatName, (x) => existingChats.includes(x), { nameBuilder: buildCheckpointName, startIndex: 1 });
const body = await renderTemplateAsync('createCheckpoint', { isReplace: isReplace, suggestedName: suggestedName });
let name = forceName ?? await Popup.show.input('Create Checkpoint', body, suggestedName);
@@ -196,7 +197,8 @@ export async function createBranch(mesId, { swipeId = null } = {}) {
const lastMes = chat[mesId];
const mainChatName = (getCurrentChatDetails()).sessionName;
const newMetadata = { main_chat: mainChatName };
// Mint a fresh integrity slug so the branch is distinguishable from its parent (#5942)
const newMetadata = { main_chat: mainChatName, integrity: uuidv4() };
const selectedSwipeId = swipeId === null ? null : Number(swipeId);
if (selectedSwipeId !== null && (!Number.isInteger(selectedSwipeId) || selectedSwipeId < 0 || selectedSwipeId >= (lastMes?.swipes?.length ?? 0))) {
@@ -212,7 +214,7 @@ export async function createBranch(mesId, { swipeId = null } = {}) {
return `${cleanName} - Branch #${i}`;
}
const existingChats = await getExistingChatNames();
const name = getUniqueName(mainChatName, (x) => existingChats.includes(x), { nameBuilder: buildBranchName });
const name = getUniqueName(mainChatName, (x) => existingChats.includes(x), { nameBuilder: buildBranchName, startIndex: 1 });
if (!name) {
console.error('Could not generate a unique branch name.');
toastr.error('Could not generate a unique branch name.', 'Branch creation failed');
@@ -278,7 +280,8 @@ export async function createNewBookmark(mesId, { forceName = null } = {}) {
}
const mainChat = selected_group ? groups?.find(x => x.id == selected_group)?.chat_id : characters[this_chid].chat;
const newMetadata = { main_chat: mainChat };
// Mint a fresh integrity slug so the checkpoint is distinguishable from its parent (#5942)
const newMetadata = { main_chat: mainChat, integrity: uuidv4() };
await saveItemizedPrompts(name);
if (selected_group) {
@@ -700,6 +703,7 @@ export function initBookmarks() {
}
const loaderHandle = loader.show({
slug: 'chat-load',
title: t`Chat History`,
message: t`Loading chat…`,
toastMode: loader.ToastMode.STATIC,
+8
View File
@@ -72,6 +72,14 @@ function applyBrowserFixes() {
if (isMobile()) {
const fixFunkyPositioning = () => {
if (isFirefox()) {
const active = document.activeElement;
if (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement) {
// The positioning hack below breaks GBoard candidate replacement
// in Firefox Mobile on Android.
return;
}
}
console.debug('[Mobile] Device viewport change detected.');
document.documentElement.style.position = 'fixed';
requestAnimationFrame(() => document.documentElement.style.position = '');
+6 -6
View File
@@ -33,12 +33,12 @@
* @property {number} role - The specific function or purpose of the extension.
* @property {boolean} vectorized - Indicates if the extension is optimized for vectorized processing.
* @property {number} display_index - The order in which the extension should be displayed for user interfaces.
* @property {boolean} match_persona_description - Wether to match against the persona description.
* @property {boolean} match_character_description - Wether to match against the persona description.
* @property {boolean} match_character_personality - Wether to match against the character personality.
* @property {boolean} match_character_depth_prompt - Wether to match against the character depth prompt.
* @property {boolean} match_scenario - Wether to match against the character scenario.
* @property {boolean} match_creator_notes - Wether to match against the character creator notes.
* @property {boolean} match_persona_description - Whether to match against the persona description.
* @property {boolean} match_character_description - Whether to match against the character description.
* @property {boolean} match_character_personality - Whether to match against the character personality.
* @property {boolean} match_character_depth_prompt - Whether to match against the character depth prompt.
* @property {boolean} match_scenario - Whether to match against the character scenario.
* @property {boolean} match_creator_notes - Whether to match against the character creator notes.
*/
/**
+4 -1
View File
@@ -2288,11 +2288,14 @@ export function initChatUtilities() {
await callGenericPopup(wrapper, POPUP_TYPE.TEXT, '', { wide: true, large: true });
});
$(document).on('click', 'body .mes .mes_text', function () {
$(document).on('click', 'body .mes .mes_text, body .mes .mes_reasoning', function (event) {
if (!power_user.click_to_edit) return;
if (window.getSelection().toString()) return;
if ($('.edit_textarea').length) return;
$(this).closest('.mes').find('.mes_edit').trigger('click');
if ($(event.target).closest('.mes_reasoning').length) {
$('.reasoning_edit_textarea').trigger('focus');
}
});
$(document).on('click', '.open_media_overrides', openExternalMediaOverridesDialog);
+3 -2
View File
@@ -51,6 +51,7 @@ import EventSourceStream from './sse-stream.js';
* @property {string} [reverse_proxy] - Optional reverse proxy URL
* @property {string} [proxy_password] - Optional proxy password
* @property {string} [custom_prompt_post_processing] - Optional custom prompt post-processing
* @property {import('../script.js').JsonSchema} [json_schema] - Optional JSON schema for structured generation
*/
/** @typedef {Record<string, any> & ChatCompletionPayloadBase} ChatCompletionPayload */
@@ -505,7 +506,7 @@ export class ChatCompletionService {
return async function* streamData() {
let text = '';
const swipes = [];
const state = { reasoning: '', image: '' };
const state = { reasoning: '', images: [], signature: '', toolSignatures: {} };
while (true) {
const { done, value } = await reader.read();
if (done) return;
@@ -591,7 +592,7 @@ export class ChatCompletionService {
}
// Ensure api-url is properly applied for all sources that accept it
['custom_url', 'vertexai_region', 'zai_endpoint', 'siliconflow_endpoint'].forEach(field => {
['custom_url', 'vertexai_region', 'zai_endpoint', 'siliconflow_endpoint', 'minimax_endpoint', 'pollinations_endpoint'].forEach(field => {
// The order is: connection profile => CC preset => CC settings
overridePayload[field] = overridePayload[field] || settings[field] || oai_settings[field];
});
+6
View File
@@ -126,6 +126,12 @@ function applyDynamicFocusStyles(styleSheet, { fromExtension = false } = {}) {
// If something like :focus-within or a more specific selector like `.blah:has(:focus-visible)` for elements inside,
// it should be manually defined in CSS.
const focusSelector = rule.selectorText.replace(/:hover/g, ':focus-visible');
// Skip pseudo-elements (::before, ::after, ::-webkit-scrollbar, etc.)
// as they cannot have :focus-visible appended (invalid CSS syntax)
if (focusSelector.includes('::')) {
return;
}
let focusRule = `${focusSelector} { ${rule.style.cssText} }`;
// Wrap the generated rule into the same @media/@supports/@container chain (if any)
+8
View File
@@ -50,6 +50,7 @@ export const event_types = {
FORCE_SET_BACKGROUND: 'force_set_background',
CHAT_DELETED: 'chat_deleted',
CHAT_CREATED: 'chat_created',
CHAT_RENAMED: 'chat_renamed',
GROUP_CHAT_DELETED: 'group_chat_deleted',
GROUP_CHAT_CREATED: 'group_chat_created',
GENERATE_BEFORE_COMBINE_PROMPTS: 'generate_before_combine_prompts',
@@ -97,9 +98,16 @@ export const event_types = {
WORLDINFO_SCAN_DONE: 'worldinfo_scan_done',
MEDIA_ATTACHMENT_DELETED: 'media_attachment_deleted',
PERSONA_CHANGED: 'persona_changed',
PERSONA_CREATED: 'persona_created',
PERSONA_UPDATED: 'persona_updated',
PERSONA_RENAMED: 'persona_renamed',
PERSONA_DELETED: 'persona_deleted',
TTS_JOB_STARTED: 'tts_job_started',
TTS_AUDIO_READY: 'tts_audio_ready',
TTS_JOB_COMPLETE: 'tts_job_complete',
ITEMIZED_PROMPTS_LOADED: 'itemized_prompts_loaded',
ITEMIZED_PROMPTS_SAVED: 'itemized_prompts_saved',
ITEMIZED_PROMPTS_DELETED: 'itemized_prompts_deleted',
};
export const eventSource = new EventEmitter([event_types.APP_READY, event_types.APP_INITIALIZED]);
+564 -117
View File
@@ -1,9 +1,9 @@
import { DOMPurify, Popper } from '../lib.js';
import { Popper } from '../lib.js';
import { eventSource, event_types, saveSettings, saveSettingsDebounced, getRequestHeaders, animation_duration, CLIENT_VERSION } from '../script.js';
import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup } from './popup.js';
import { POPUP_RESULT, POPUP_TYPE, Popup } from './popup.js';
import { renderTemplate, renderTemplateAsync } from './templates.js';
import { delay, equalsIgnoreCaseAndAccents, isSubsetOf, sanitizeSelector, setValueByPath, versionCompare } from './utils.js';
import { delay, deleteValueByPath, equalsIgnoreCaseAndAccents, escapeHtml, isSubsetOf, sanitizeSelector, setValueByPath, versionCompare } from './utils.js';
import { getContext } from './st-context.js';
import { isAdmin } from './user.js';
import { addLocaleData, getCurrentLocale, t } from './i18n.js';
@@ -61,6 +61,19 @@ let manifests = {};
*/
const defaultUrl = 'http://localhost:5100';
/**
* Checks if the extension is officially supported by its URL pattern.
* @param {string} url URL to check
* @returns {boolean} True if the URL matches the pattern, false otherwise (or not a valid URL)
*/
export const isOfficialExtension = (url) => {
try {
return /^https:\/\/github\.com\/SillyTavern\/(.+)$/i.test(new URL(url).href);
} catch (e) {
return false;
}
};
let requiresReload = false;
let stateChanged = false;
let saveMetadataTimeout = null;
@@ -266,6 +279,18 @@ export async function doExtrasFetch(endpoint, args = {}) {
return await fetch(endpoint, args);
}
/**
* Generates a CSS selector for an extension based on its name, allowing omission of a common prefix.
* @param {string} name Name of the extension, with or without the "third-party" prefix
* @param {object} [options] Optional parameters
* @param {string} [options.prefix] Optional prefix to ignore when generating the selector (e.g. "third-party")
* @returns {string} CSS selector for the extension, with the prefix removed if it was present and specified in options
*/
function getNameSelector(name, { prefix = 'third-party' } = {}) {
const nameWithoutPrefix = prefix && name.startsWith(prefix) ? name.slice(prefix.length) : name;
return CSS.escape(nameWithoutPrefix);
}
/**
* Discovers extensions from the API.
* @returns {Promise<{name: string, type: string}[]>}
@@ -343,7 +368,7 @@ function onToggleAllExtensions(extensionsToToggle, toggleContainer) {
}
toggleContainer
.find(`.extension_block[data-name="${name.replace('third-party', '')}"] .extension_toggle input`)
.find(`.extension_block[data-name="${getNameSelector(name)}"] .extension_toggle input`)
.prop('checked', enable)
.toggleClass('toggle_enable', !enable)
.toggleClass('toggle_disable', enable)
@@ -354,12 +379,28 @@ function onToggleAllExtensions(extensionsToToggle, toggleContainer) {
return extensionsToToggle;
}
/**
* Checks whether an extension has a specific hook defined in its manifest.
* @param {string} name Extension name (with or without 'third-party' prefix)
* @param {'install' | 'update' | 'delete' | 'clean' | 'enable' | 'disable' | 'activate'} hookName The hook to check
* @returns {boolean}
*/
function hasExtensionHook(name, hookName) {
const fullName = name.startsWith('third-party') ? name : `third-party${name}`;
const manifest = manifests[fullName];
if (!manifest || !manifest.hooks || typeof manifest.hooks !== 'object') {
return false;
}
const hookFunctionName = manifest.hooks[hookName];
return typeof hookFunctionName === 'string' && hookFunctionName.length > 0;
}
/**
* Calls a manifest hook for an extension.
* Hooks are optional function names exported from the extension's JS entry point module.
* The hook function can optionally return a Promise that will be awaited.
* @param {string} name Extension name
* @param {'install' | 'update' | 'delete' | 'enable' | 'disable' | 'activate'} hookName The hook to call
* @param {'install' | 'update' | 'delete' | 'clean' | 'enable' | 'disable' | 'activate'} hookName The hook to call
* @returns {Promise<void>}
*/
async function callExtensionHook(name, hookName) {
@@ -473,6 +514,21 @@ export function findExtension(name) {
return { name: internalExtensionName, enabled: isEnabled };
}
/**
* Returns a deep clone of the manifest for the given extension name.
* Accepts either the short name (e.g. `SillyTavern-MyExtension`) or the full internal key
* (e.g. `third-party/SillyTavern-MyExtension`). Returns null if the extension is not found.
* @param {string} name - Extension name or internal key
* @returns {object|null} Cloned manifest object, or null if not found
*/
export function getExtensionManifest(name) {
const found = extensionNames.find(extName =>
equalsIgnoreCaseAndAccents(extName, name) || equalsIgnoreCaseAndAccents(extName, `third-party/${name}`),
);
const manifest = found ? manifests[found] : null;
return manifest ? structuredClone(manifest) : null;
}
/**
* Loads manifest.json files for extensions.
* @param {string[]} names Array of extension names
@@ -821,7 +877,7 @@ function addExtensionLocale(name, manifest) {
}
/**
* Generates HTML string for displaying an extension in the UI.
* Generates an element for displaying an extension in the UI.
*
* @param {string} name - The name of the extension.
* @param {object} manifest - The manifest of the extension.
@@ -829,95 +885,180 @@ function addExtensionLocale(name, manifest) {
* @param {boolean} isDisabled - Whether the extension is disabled or not.
* @param {boolean} isExternal - Whether the extension is external or not.
* @param {string} checkboxClass - The class for the checkbox HTML element.
* @return {string} - The HTML string that represents the extension.
* @return {HTMLElement} - The element that represents the extension.
*/
function generateExtensionHtml(name, manifest, isActive, isDisabled, isExternal, checkboxClass) {
function generateExtensionElement(name, manifest, isActive, isDisabled, isExternal, checkboxClass) {
function getExtensionIcon() {
const type = getExtensionType(name);
const icon = document.createElement('i');
icon.classList.add('fa-sm', 'fa-fw', 'fa-solid');
switch (type) {
case 'global':
return '<i class="fa-sm fa-fw fa-solid fa-server" data-i18n="[title]ext_type_global" title="This is a global extension, available for all users."></i>';
icon.classList.add('fa-server');
icon.title = t`This is a global extension, available for all users.`;
break;
case 'local':
return '<i class="fa-sm fa-fw fa-solid fa-user" data-i18n="[title]ext_type_local" title="This is a local extension, available only for you."></i>';
icon.classList.add('fa-user');
icon.title = t`This is a local extension, available only for you.`;
break;
case 'system':
return '<i class="fa-sm fa-fw fa-solid fa-cog" data-i18n="[title]ext_type_system" title="This is a built-in extension. It cannot be deleted and updates with the app."></i>';
icon.classList.add('fa-cog');
icon.title = t`This is a built-in extension. It cannot be deleted and updates with the app.`;
break;
default:
return '<i class="fa-sm fa-fw fa-solid fa-question" title="Unknown extension type."></i>';
icon.classList.add('fa-question');
icon.title = t`Unknown extension type.`;
break;
}
return icon;
}
const isUserAdmin = isAdmin();
const extensionIcon = getExtensionIcon();
const displayName = manifest.display_name;
const displayVersion = manifest.version || '';
const externalId = name.replace('third-party', '');
let originHtml = '';
if (isExternal) {
originHtml = '<a>';
// Root block
const block = document.createElement('div');
block.classList.add('extension_block');
block.dataset.name = externalId;
// Toggle
const toggleDiv = document.createElement('div');
toggleDiv.classList.add('extension_toggle');
const toggle = document.createElement('input');
toggle.type = 'checkbox';
toggle.dataset.name = name;
if (isActive || isDisabled) {
toggle.title = t`Click to toggle`;
toggle.classList.add(isActive ? 'toggle_disable' : 'toggle_enable');
if (checkboxClass) toggle.classList.add(checkboxClass);
toggle.checked = isActive;
} else {
toggle.title = t`Cannot enable extension`;
toggle.classList.add('extension_missing');
if (checkboxClass) toggle.classList.add(checkboxClass);
toggle.disabled = true;
}
toggleDiv.appendChild(toggle);
block.appendChild(toggleDiv);
let toggleElement = isActive || isDisabled ?
'<input type="checkbox" title="' + t`Click to toggle` + `" data-name="${name}" class="${isActive ? 'toggle_disable' : 'toggle_enable'} ${checkboxClass}" ${isActive ? 'checked' : ''}>` :
`<input type="checkbox" title="Cannot enable extension" data-name="${name}" class="extension_missing ${checkboxClass}" disabled>`;
// Icon
const iconDiv = document.createElement('div');
iconDiv.classList.add('extension_icon');
iconDiv.appendChild(getExtensionIcon());
block.appendChild(iconDiv);
let deleteButton = isExternal ? `<button class="btn_delete menu_button" data-name="${externalId}" data-i18n="[title]Delete" title="Delete"><i class="fa-fw fa-solid fa-trash-can"></i></button>` : '';
let updateButton = isExternal ? `<button class="btn_update menu_button displayNone" data-name="${externalId}" title="Update available"><i class="fa-solid fa-download fa-fw"></i></button>` : '';
let moveButton = isExternal && isUserAdmin ? `<button class="btn_move menu_button" data-name="${externalId}" data-i18n="[title]Move" title="Move"><i class="fa-solid fa-folder-tree fa-fw"></i></button>` : '';
let branchButton = isExternal && isUserAdmin ? `<button class="btn_branch menu_button" data-name="${externalId}" data-i18n="[title]Switch branch" title="Switch branch"><i class="fa-solid fa-code-branch fa-fw"></i></button>` : '';
let modulesInfo = '';
// Text block
const textBlock = document.createElement('div');
textBlock.classList.add('flexGrow', 'extension_text_block');
const statusSpan = document.createElement('span');
statusSpan.className = isActive ? 'extension_enabled' : isDisabled ? 'extension_disabled' : 'extension_missing';
const nameSpan = document.createElement('span');
nameSpan.classList.add('extension_name');
nameSpan.textContent = displayName;
const authorSpan = document.createElement('span');
authorSpan.classList.add('extension_author');
const versionSpan = document.createElement('span');
versionSpan.classList.add('extension_version');
versionSpan.textContent = displayVersion;
statusSpan.append(nameSpan, authorSpan, versionSpan);
if (isActive && Array.isArray(manifest.optional)) {
const optional = new Set(manifest.optional);
modules.forEach(x => optional.delete(x));
if (optional.size > 0) {
const optionalString = DOMPurify.sanitize([...optional].join(', '));
modulesInfo = '<div class="extension_modules">' + t`Optional modules:` + ` <span class="optional">${optionalString}</span></div>`;
const modulesDiv = document.createElement('div');
modulesDiv.classList.add('extension_modules');
const optionalSpan = document.createElement('span');
optionalSpan.classList.add('optional');
optionalSpan.textContent = [...optional].join(', ');
modulesDiv.append(t`Optional modules:`, ' ', optionalSpan);
statusSpan.appendChild(modulesDiv);
}
} else if (!isDisabled) { // Neither active nor disabled
} else if (!isDisabled) {
// Neither active nor disabled
const requirements = new Set(manifest.requires);
modules.forEach(x => requirements.delete(x));
if (requirements.size > 0) {
const requirementsString = DOMPurify.sanitize([...requirements].join(', '));
modulesInfo = `<div class="extension_modules">Missing modules: <span class="failure">${requirementsString}</span></div>`;
const modulesDiv = document.createElement('div');
modulesDiv.classList.add('extension_modules');
const failureSpan = document.createElement('span');
failureSpan.classList.add('failure');
failureSpan.textContent = [...requirements].join(', ');
modulesDiv.append(t`Missing modules:`, ' ', failureSpan);
statusSpan.appendChild(modulesDiv);
}
}
// if external, wrap the name in a link to the repo
if (isExternal) {
const originLink = document.createElement('a');
originLink.appendChild(statusSpan);
textBlock.appendChild(originLink);
} else {
textBlock.appendChild(statusSpan);
}
let extensionHtml = `
<div class="extension_block" data-name="${externalId}">
<div class="extension_toggle">
${toggleElement}
</div>
<div class="extension_icon">
${extensionIcon}
</div>
<div class="flexGrow extension_text_block">
${originHtml}
<span class="${isActive ? 'extension_enabled' : isDisabled ? 'extension_disabled' : 'extension_missing'}">
<span class="extension_name">${DOMPurify.sanitize(displayName)}</span>
<span class="extension_version">${DOMPurify.sanitize(displayVersion)}</span>
${modulesInfo}
</span>
${isExternal ? '</a>' : ''}
</div>
block.appendChild(textBlock);
<div class="extension_actions flex-container alignItemsCenter">
${updateButton}
${branchButton}
${moveButton}
${deleteButton}
</div>
</div>`;
// Actions
const actionsDiv = document.createElement('div');
actionsDiv.classList.add('extension_actions', 'flex-container', 'alignItemsCenter');
return extensionHtml;
/**
* Helper function to create an action button for an extension.
* @param {string} cls Class name
* @param {string} dataName Name of the extension
* @param {string} title Title of the button
* @param {string} iconClasses Classes for the icon
* @returns {HTMLButtonElement} The created button element
*/
function makeActionButton(cls, dataName, title, iconClasses) {
const btn = document.createElement('button');
btn.classList.add(cls, 'menu_button');
btn.dataset.name = dataName;
btn.title = title;
const icon = document.createElement('i');
icon.classList.add(...iconClasses.split(' '));
btn.appendChild(icon);
return btn;
}
if (isExternal) {
const updateBtn = makeActionButton('btn_update', externalId, t`Update available`, 'fa-solid fa-download fa-fw');
updateBtn.classList.add('displayNone');
actionsDiv.appendChild(updateBtn);
}
if (isExternal && hasExtensionHook(externalId, 'clean')) {
actionsDiv.appendChild(makeActionButton('btn_clean', externalId, t`Clean extension data`, 'fa-fw fa-solid fa-broom'));
}
if (isExternal && isUserAdmin) {
actionsDiv.appendChild(makeActionButton('btn_branch', externalId, t`Switch branch`, 'fa-solid fa-code-branch fa-fw'));
actionsDiv.appendChild(makeActionButton('btn_move', externalId, t`Move`, 'fa-solid fa-folder-tree fa-fw'));
}
if (isExternal) {
actionsDiv.appendChild(makeActionButton('btn_delete', externalId, t`Delete`, 'fa-fw fa-solid fa-trash-can'));
}
block.appendChild(actionsDiv);
return block;
}
/**
* Gets extension data and generates the corresponding HTML for displaying the extension.
* Gets extension data and generates the corresponding element for displaying the extension.
*
* @param {Array} extension - An array where the first element is the extension name and the second element is the extension manifest.
* @return {object} - An object with 'isExternal' indicating whether the extension is external, and 'extensionHtml' for the extension's HTML string.
* @return {{isExternal: boolean, extensionElement: HTMLElement}} - An object with 'isExternal' indicating whether the extension is external, and 'extensionElement' for the extension's HTML element.
*/
function getExtensionData(extension) {
const name = extension[0];
@@ -927,33 +1068,43 @@ function getExtensionData(extension) {
const isExternal = name.startsWith('third-party');
const checkboxClass = isDisabled ? 'checkbox_disabled' : '';
const extensionElement = generateExtensionElement(name, manifest, isActive, isDisabled, isExternal, checkboxClass);
const extensionHtml = generateExtensionHtml(name, manifest, isActive, isDisabled, isExternal, checkboxClass);
return { isExternal, extensionHtml };
return { isExternal, extensionElement };
}
/**
* Gets the module information to be displayed.
*
* @return {string} - The HTML string for the module information.
* @return {HTMLElement} - The element containing the module information.
*/
function getModuleInformation() {
let moduleInfo = modules.length ? `<p>${DOMPurify.sanitize(modules.join(', '))}</p>` : '<p class="failure">' + t`Not connected to the API!` + '</p>';
return `
<h3>` + t`Modules provided by your Extras API:` + `</h3>
${moduleInfo}
`;
const container = document.createElement('div');
const heading = document.createElement('h3');
heading.textContent = t`Modules provided by your Extras API:`;
container.appendChild(heading);
const moduleInfo = document.createElement('p');
if (modules.length) {
moduleInfo.textContent = modules.join(', ');
} else {
moduleInfo.classList.add('failure');
moduleInfo.textContent = t`Not connected to the API!`;
}
container.appendChild(moduleInfo);
return container;
}
/**
* Generates HTML for the extension load errors.
* @returns {string} HTML string containing the errors that occurred while loading extensions.
* Generates HTMLElement for the extension load errors.
* @returns {HTMLElement} - The element containing the extension load errors.
*/
function getExtensionLoadErrorsHtml() {
function getExtensionLoadErrors() {
if (extensionLoadErrors.size === 0) {
return '';
return document.createElement('div');
}
const container = document.createElement('div');
@@ -965,7 +1116,7 @@ function getExtensionLoadErrorsHtml() {
container.appendChild(errorElement);
}
return container.outerHTML;
return container;
}
/**
@@ -982,22 +1133,35 @@ async function showExtensionsDetails() {
initialScrollTop = oldPopup.content.scrollTop;
await oldPopup.completeCancelled();
}
const htmlErrors = getExtensionLoadErrorsHtml();
const htmlDefault = $('<div class="marginBot10"><h3>' + t`Built-in Extensions:` + '</h3></div>');
const errors = getExtensionLoadErrors();
const htmlExternal = $(`<div class="marginBot10">
<div class="flex-container alignitemscenter spaceBetween flexnowrap marginBot10">
<h3 class="margin0">${t`Installed Extensions:`}</h3>
<div class="flex-container third_party_toolbar"></div>
</div>
</div>`);
const defaultContainer = document.createElement('div');
defaultContainer.classList.add('marginBot10');
const defaultHeading = document.createElement('h3');
defaultHeading.textContent = t`Built-in Extensions:`;
defaultContainer.appendChild(defaultHeading);
const htmlLoading = $(`<div class="flex-container alignItemsCenter justifyCenter marginTop10 marginBot5">
<i class="fa-solid fa-spinner fa-spin"></i>
<span>` + t`Loading third-party extensions... Please wait...` + `</span>
</div>`);
const externalContainer = document.createElement('div');
externalContainer.classList.add('marginBot10');
const externalHeader = document.createElement('div');
externalHeader.classList.add('flex-container', 'alignitemscenter', 'spaceBetween', 'flexnowrap', 'marginBot10');
const externalHeading = document.createElement('h3');
externalHeading.classList.add('margin0');
externalHeading.textContent = t`Installed Extensions:`;
const thirdPartyToolbar = document.createElement('div');
thirdPartyToolbar.classList.add('flex-container', 'third_party_toolbar');
externalHeader.append(externalHeading, thirdPartyToolbar);
externalContainer.appendChild(externalHeader);
htmlExternal.append(htmlLoading);
const loadingEl = document.createElement('div');
loadingEl.classList.add('flex-container', 'alignItemsCenter', 'justifyCenter', 'marginTop10', 'marginBot5');
const loadingIcon = document.createElement('i');
loadingIcon.classList.add('fa-solid', 'fa-spinner', 'fa-spin');
const loadingSpan = document.createElement('span');
loadingSpan.textContent = t`Loading third-party extensions... Please wait...`;
loadingEl.append(loadingIcon, loadingSpan);
externalContainer.appendChild(loadingEl);
const sortOrderKey = 'extensions_sortByName';
const sortByName = accountStorage.getItem(sortOrderKey) === 'true';
@@ -1006,16 +1170,16 @@ async function showExtensionsDetails() {
let extensionsToToggle = [];
extensions.forEach(value => {
const { isExternal, extensionHtml } = value;
const container = isExternal ? htmlExternal : htmlDefault;
container.append(extensionHtml);
const { isExternal, extensionElement } = value;
const container = isExternal ? externalContainer : defaultContainer;
container.appendChild(extensionElement);
});
const html = $('<div></div>')
const extensionsMenu = $('<div></div>')
.addClass('extensions_info')
.append(htmlErrors)
.append(htmlDefault)
.append(htmlExternal)
.append(errors)
.append(defaultContainer)
.append(externalContainer)
.append(getModuleInformation());
{
@@ -1041,23 +1205,24 @@ async function showExtensionsDetails() {
const toggleAllExtensionsButton = document.createElement('div');
toggleAllExtensionsButton.classList.add('menu_button', 'menu_button_icon');
toggleAllExtensionsButton.title = t`Bulk toggle third-party extensions.`;
toggleAllExtensionsButton.innerHTML = `
<span>${t`Toggle extensions`}</span>
<div class="fa-solid fa-circle-info opacity50p"></div>
`;
const toggleAllLabel = document.createElement('span');
toggleAllLabel.textContent = t`Toggle extensions`;
const toggleAllIcon = document.createElement('div');
toggleAllIcon.classList.add('fa-solid', 'fa-circle-info', 'opacity50p');
toggleAllExtensionsButton.append(toggleAllLabel, toggleAllIcon);
const restoreBulkToggledExtensionsButton = document.createElement('div');
restoreBulkToggledExtensionsButton.classList.add('menu_button', 'menu_button_icon', 'fa-solid', 'fa-arrow-right-rotate', 'displayNone');
restoreBulkToggledExtensionsButton.title = t`Restore toggled extensions.\n\nIt does not restore extensions toggled individually.`;
toggleAllExtensionsButton.addEventListener('click', () => {
extensionsToToggle = onToggleAllExtensions(extensionsToToggle, htmlExternal);
extensionsToToggle = onToggleAllExtensions(extensionsToToggle, $(externalContainer));
for (const extension of extensionsToToggle) {
const { name } = extension;
htmlExternal
.find(`.extension_block[data-name="${name.replace('third-party', '')}"] .extension_toggle input`)
$(externalContainer)
.find(`.extension_block[data-name="${getNameSelector(name)}"] .extension_toggle input`)
.off('click')
.one('click', () => {
extensionsToToggle = extensionsToToggle.filter(ext => ext.name !== name);
@@ -1074,8 +1239,8 @@ async function showExtensionsDetails() {
const { name } = extension;
const isDisabled = extension_settings.disabledExtensions.includes(name);
htmlExternal
.find(`.extension_block[data-name="${name.replace('third-party', '')}"] .extension_toggle input`)
$(externalContainer)
.find(`.extension_block[data-name="${getNameSelector(name)}"] .extension_toggle input`)
.prop('checked', !isDisabled)
.toggleClass('toggle_enable', isDisabled)
.toggleClass('toggle_disable', !isDisabled)
@@ -1099,13 +1264,13 @@ async function showExtensionsDetails() {
});
toolbar.append(updateAllButton, updateEnabledOnlyButton, flexExpander, sortOrderButton);
htmlExternal.find('.third_party_toolbar').append(restoreBulkToggledExtensionsButton, toggleAllExtensionsButton);
html.prepend(toolbar);
thirdPartyToolbar.append(restoreBulkToggledExtensionsButton, toggleAllExtensionsButton);
extensionsMenu.prepend(toolbar);
}
let waitingForSave = false;
const popup = new Popup(html, POPUP_TYPE.TEXT, '', {
const popup = new Popup(extensionsMenu, POPUP_TYPE.TEXT, '', {
okButton: t`Close`,
wide: true,
large: true,
@@ -1147,7 +1312,7 @@ async function showExtensionsDetails() {
});
popupPromise = popup.show();
popup.content.scrollTop = initialScrollTop;
checkForUpdatesManual(sortFn, abortController.signal).finally(() => htmlLoading.remove());
checkForUpdatesManual(sortFn, abortController.signal).finally(() => loadingEl.remove());
} catch (error) {
toastr.error(t`Error loading extensions. See browser console for details.`);
console.error(error);
@@ -1234,6 +1399,7 @@ async function updateExtension(extensionName, quiet, timeout = null) {
* This function makes a POST request to '/api/extensions/delete' with the extension's name.
* If the extension is deleted, it displays a success message.
* Creates a popup for the user to confirm before delete.
* If the extension has a 'clean' hook, an optional checkbox to also run the cleanup is shown.
*/
async function onDeleteClick() {
const extensionName = $(this).data('name');
@@ -1244,13 +1410,50 @@ async function onDeleteClick() {
return;
}
// use callPopup to create a popup for the user to confirm before delete
const confirmation = await callGenericPopup(t`Are you sure you want to delete ${extensionName}?`, POPUP_TYPE.CONFIRM, '', {});
const hasCleanHook = hasExtensionHook(extensionName, 'clean');
/** @type {import('./popup.js').CustomPopupInput[]} */
const customInputs = hasCleanHook ? [{ id: 'extension_delete_cleanup', label: t`Also clean up extension data`, defaultState: false }] : null;
const popup = new Popup(t`Are you sure you want to delete ${escapeHtml(extensionName)}?`, POPUP_TYPE.CONFIRM, '', { customInputs });
const confirmation = await popup.show();
if (confirmation === POPUP_RESULT.AFFIRMATIVE) {
await deleteExtension(extensionName);
const shouldClean = hasCleanHook && Boolean(popup.inputResults?.get('extension_delete_cleanup'));
await deleteExtension(extensionName, shouldClean);
}
}
/**
* Handles the click event for the clean button of an extension.
* Runs the extension's 'clean' hook after user confirmation, then reloads the page.
*/
async function onCleanClick() {
const extensionName = $(this).data('name');
const confirmation = await Popup.show.confirm(t`Clean extension data`, t`Are you sure you want to clean up data for ${escapeHtml(extensionName)}? This action cannot be undone.`);
if (!confirmation) {
return;
}
await cleanExtension(extensionName);
}
/**
* Runs the 'clean' hook for an extension and reloads the page.
* @param {string} extensionName Extension name (without 'third-party' prefix)
* @returns {Promise<void>}
*/
async function cleanExtension(extensionName) {
const fullExtensionName = extensionName.startsWith('third-party') ? extensionName : `third-party${extensionName}`;
await callExtensionHook(fullExtensionName, 'clean');
// Clean might have updated settings, which could race with the page reload, so we'll force save here
await saveSettings();
toastr.success(t`Extension ${extensionName} data cleaned`);
delay(1000).then(() => location.reload());
}
async function onBranchClick() {
const extensionName = $(this).data('name');
const isCurrentUserAdmin = isAdmin();
@@ -1303,8 +1506,8 @@ async function onMoveClick() {
const confirmationHeader = t`Move extension`;
const confirmationText = source == 'global'
? t`Are you sure you want to move ${extensionName} to your local extensions? This will make it available only for you.`
: t`Are you sure you want to move ${extensionName} to the global extensions? This will make it available for all users.`;
? t`Are you sure you want to move ${escapeHtml(extensionName)} to your local extensions? This will make it available only for you.`
: t`Are you sure you want to move ${escapeHtml(extensionName)} to the global extensions? This will make it available for all users.`;
const confirmation = await Popup.show.confirm(confirmationHeader, confirmationText);
@@ -1353,9 +1556,16 @@ async function moveExtension(extensionName, source, destination) {
/**
* Deletes an extension via the API.
* @param {string} extensionName Extension name to delete
* @param {boolean} [shouldClean=false] Whether to also run the 'clean' hook before deleting
*/
export async function deleteExtension(extensionName) {
await callExtensionHook(extensionName, 'delete');
export async function deleteExtension(extensionName, shouldClean = false) {
const fullExtensionName = extensionName.startsWith('third-party') ? extensionName : `third-party${extensionName}`;
if (shouldClean) {
await callExtensionHook(fullExtensionName, 'clean');
}
await callExtensionHook(fullExtensionName, 'delete');
try {
await fetch('/api/extensions/delete', {
@@ -1370,6 +1580,9 @@ export async function deleteExtension(extensionName) {
console.error('Error:', error);
}
// Delete or clean might have updated settings, which could race with the page reload, so we'll force save here
await saveSettings();
toastr.success(t`Extension ${extensionName} deleted`);
delay(1000).then(() => location.reload());
}
@@ -1398,6 +1611,9 @@ async function getExtensionVersion(extensionName, abortSignal) {
const data = await response.json();
return data;
} catch (error) {
if (error instanceof Error && error.name === 'AbortError') {
return;
}
console.error('Error:', error);
}
}
@@ -1476,9 +1692,53 @@ async function switchExtensionBranch(extensionName, isGlobal, branch) {
* Installs a third-party extension via the API.
* @param {string} url Extension repository URL
* @param {boolean} global Is the extension global?
* @returns {Promise<void>}
* @param {string} [branch] Optional branch to install, if not provided the default branch will be used
* @returns {Promise<boolean>} True if the extension was installed successfully, false otherwise
*/
export async function installExtension(url, global, branch = '') {
try {
const parsedUrl = new URL(url);
if (!['http:', 'https:'].includes(parsedUrl.protocol)) {
throw new Error('Invalid URL protocol');
}
// Normalize the URL (resolve relative paths, remove redundant segments, etc.)
url = parsedUrl.href;
} catch (error) {
console.error('Invalid URL:', error);
toastr.error(t`Only valid HTTP and HTTPS URLs are allowed.`, t`Invalid URL`);
return false;
}
if (!isOfficialExtension(url)) {
const extensionInstallationWarningKey = 'extensionInstallationWarningShown';
if (accountStorage.getItem(extensionInstallationWarningKey)) {
console.debug('Bypassed URL check for third-party extension (account preference).', url);
} else {
let dismissWarning = false;
const confirmation = await Popup.show.confirm(
t`Install a third-party extension?`,
await renderTemplateAsync('thirdPartyExtensionWarning'),
{
customInputs: [{ id: 'dontAskAgain', type: 'checkbox', label: t`Don't show this warning again`, defaultState: false }],
onClose: (popup) => {
if (!popup.result) {
return;
}
dismissWarning = Boolean(popup.inputResults?.get('dontAskAgain') ?? false);
},
okButton: t`Yes, install it`,
cancelButton: t`No, cancel`,
});
if (!confirmation) {
return false;
}
if (dismissWarning) {
accountStorage.setItem(extensionInstallationWarningKey, '1');
}
}
}
console.debug('Extension installation started', url);
toastr.info(t`Please wait...`, t`Installing extension`);
@@ -1497,11 +1757,11 @@ export async function installExtension(url, global, branch = '') {
const text = await request.text();
toastr.warning(text || request.statusText, t`Extension installation failed`, { timeOut: 5000 });
console.error('Extension installation failed', request.status, request.statusText, text);
return;
return false;
}
const response = await request.json();
toastr.success(t`Extension '${response.display_name}' by ${response.author} (version ${response.version}) has been installed successfully!`, t`Extension installation successful`);
toastr.success(t`Extension '${response.display_name}' has been installed successfully!`, t`Extension installation successful`);
console.debug(`Extension "${response.display_name}" has been installed successfully at ${response.extensionPath}`);
await loadExtensionSettings({}, false, false);
await eventSource.emit(event_types.EXTENSION_SETTINGS_LOADED, response);
@@ -1510,6 +1770,8 @@ export async function installExtension(url, global, branch = '') {
const extensionName = `third-party/${response.folderName}`;
await callExtensionHook(extensionName, 'install');
}
return true;
}
/**
@@ -1535,6 +1797,15 @@ export async function loadExtensionSettings(settings, versionChanged, enableAuto
extensionTypes = Object.fromEntries(extensions.map(x => [x.name, x.type]));
manifests = await getManifests(extensionNames);
// An extension without a loadable manifest cannot be used: drop it so state queries
// and the extensions list do not report a ghost entry (e.g. leftover folder on disk)
const namesWithoutManifest = extensionNames.filter(name => !Object.hasOwn(manifests, name));
if (namesWithoutManifest.length) {
console.warn('Ignoring extensions without a loadable manifest.json:', namesWithoutManifest);
extensionNames = extensionNames.filter(name => Object.hasOwn(manifests, name));
namesWithoutManifest.forEach(name => delete extensionTypes[name]);
}
if (versionChanged && enableAutoUpdate) {
await autoUpdateExtensions(false);
}
@@ -1589,7 +1860,11 @@ async function checkForUpdatesManual(sortFn, abortSignal) {
const promise = enqueueVersionCheck(async () => {
try {
const data = await getExtensionVersion(externalId, abortSignal);
const extensionBlock = document.querySelector(`.extension_block[data-name="${externalId}"]`);
if (!data) {
return;
}
const selector = getNameSelector(externalId, { prefix: '' });
const extensionBlock = document.querySelector(`.extension_block[data-name="${selector}"]`);
if (extensionBlock && data) {
if (data.isUpToDate === false) {
const buttonElement = extensionBlock.querySelector('.btn_update');
@@ -1620,6 +1895,18 @@ async function checkForUpdatesManual(sortFn, abortSignal) {
}
}
const authorElement = extensionBlock.querySelector('.extension_author');
if (authorElement) {
const author = getAuthorFromUrl(origin) || EMPTY_AUTHOR;
if (author.name) {
const icon = document.createElement('i');
icon.classList.add('fa-solid', 'fa-at', 'fa-xs');
const name = document.createElement('span');
name.textContent = author.name;
authorElement.append(icon, name);
}
}
const versionElement = extensionBlock.querySelector('.extension_version');
if (versionElement) {
versionElement.textContent += ` (${branch}-${commitHash.substring(0, 7)})`;
@@ -1672,6 +1959,9 @@ async function checkForExtensionUpdates(force) {
const promise = enqueueVersionCheck(async () => {
try {
const data = await getExtensionVersion(id.replace('third-party', ''));
if (!data) {
return;
}
if (!data.isUpToDate) {
updatesAvailable.push(manifest.display_name);
}
@@ -1758,6 +2048,18 @@ export async function runGenerationInterceptors(chat, contextSize, type) {
return aborted;
}
/**
* Sentinel value that signals a field should be completely removed (unset)
* from the character card rather than being set to any value. Pass this as
* the `value` argument to {@link writeExtensionField} or
* {@link writeExtensionFieldBulk} to delete the key entirely.
*
* Using `null` as a value will set the field to `null` (the key remains).
* Using this sentinel will delete the key from the character card.
* @type {string}
*/
export const UNSET_VALUE = '__@@UNSET@@__';
/**
* Writes a field to the character's data extensions object.
* @param {number|string} characterId Index in the character array
@@ -1772,13 +2074,23 @@ export async function writeExtensionField(characterId, key, value) {
console.warn('Character not found', characterId);
return;
}
const path = `data.extensions.${key}`;
setValueByPath(character, path, value);
const extensionPath = `data.extensions.${key}`;
const isUnset = value === UNSET_VALUE;
if (isUnset) {
deleteValueByPath(character, extensionPath);
} else {
setValueByPath(character, extensionPath, value);
}
// Process JSON data
if (character.json_data) {
const jsonData = JSON.parse(character.json_data);
setValueByPath(jsonData, path, value);
if (isUnset) {
deleteValueByPath(jsonData, extensionPath);
} else {
setValueByPath(jsonData, extensionPath, value);
}
character.json_data = JSON.stringify(jsonData);
// Make sure the data doesn't get lost when saving the current character
@@ -1807,6 +2119,107 @@ export async function writeExtensionField(characterId, key, value) {
}
}
/**
* @typedef {object} BulkExtensionFieldResult
* @property {string[]} updated Avatar filenames that were successfully updated
* @property {string[]} skipped Avatar filenames skipped (filter didn't match or unreadable)
* @property {string[]} failed Avatar filenames where the update failed
*/
/**
* Writes (or deletes) an extension field for multiple characters in a single
* bulk request. Unlike {@link writeExtensionField}, this sends one API call
* for all characters, and the server processes them in parallel.
*
* When `value` is {@link UNSET_VALUE} the extension key is **deleted** from
* each matching character card. Passing `null` sets the field to `null`
* (the key is preserved).
*
* @param {string[]|null} avatars Avatar filenames to update. Pass `null` or an
* empty array to target **all** characters in the user's character directory.
* @param {string} key Extension field name (e.g. "greeting_tools")
* @param {any} value Field value, `null` to set null, or
* {@link UNSET_VALUE} to delete the key entirely
* @param {object} [options={}] Optional settings
* @param {string} [options.filterPath] Dot-path filter — the server will only
* update characters where this path is present and not `undefined`;
* `null` still counts as a match. Useful when the frontend has shallow
* character data and cannot pre-filter.
* Defaults to `data.extensions.<key>` when unsetting, so deletion requests
* automatically skip characters where the field is missing/`undefined`.
* @returns {Promise<BulkExtensionFieldResult>} Summary of the bulk operation
*/
export async function writeExtensionFieldBulk(avatars, key, value, { filterPath } = {}) {
const context = getContext();
const extensionPath = `data.extensions.${key}`;
const isUnset = value === UNSET_VALUE;
// Build the server request
const requestBody = {
avatars: Array.isArray(avatars) && avatars.length > 0 ? avatars : [],
data: {
data: {
extensions: {
[key]: value,
},
},
},
};
// Default filter: when unsetting, only touch characters that have the field
const resolvedFilterPath = filterPath ?? (isUnset ? extensionPath : undefined);
if (resolvedFilterPath) {
requestBody.filter = { path: resolvedFilterPath };
}
const mergeResponse = await fetch('/api/characters/merge-attributes', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify(requestBody),
});
if (!mergeResponse.ok) {
console.error('Bulk extension field update failed', mergeResponse.statusText);
return { updated: [], skipped: [], failed: [] };
}
/** @type {BulkExtensionFieldResult} */
const result = await mergeResponse.json();
// Sync in-memory character objects for successfully updated characters
const updatedSet = new Set(result.updated);
for (const character of context.characters) {
if (!character || !updatedSet.has(character.avatar)) continue;
if (isUnset) {
deleteValueByPath(character, extensionPath);
} else {
setValueByPath(character, extensionPath, value);
}
// Keep json_data in sync
if (character.json_data) {
const jsonData = JSON.parse(character.json_data);
if (isUnset) {
deleteValueByPath(jsonData, extensionPath);
} else {
setValueByPath(jsonData, extensionPath, value);
}
character.json_data = JSON.stringify(jsonData);
}
}
// If the currently active character was updated, sync the hidden input
if (context.characterId !== undefined) {
const activeChar = context.characters[context.characterId];
if (activeChar && updatedSet.has(activeChar.avatar) && activeChar.json_data) {
$('#character_json_data').val(activeChar.json_data);
}
}
return result;
}
/**
* Prompts the user to enter the Git URL of the extension to import.
* After obtaining the Git URL, makes a POST request to '/api/extensions/install' to import the extension.
@@ -1853,6 +2266,39 @@ export async function openThirdPartyExtensionMenu(suggestUrl = '') {
await installExtension(url, global, branchName);
}
/**
* Sentinel value representing an empty author, used when author information cannot be extracted from a URL.
* @type {{name: string, url: string}}
*/
export const EMPTY_AUTHOR = Object.freeze({
name: '',
url: '',
});
/**
* Extracts the repository author from a given URL.
* @param {string} url - The URL of the repository.
* @returns {{name: string, url: string}} Object containing the author's name and URL, or empty strings if not found.
*/
export function getAuthorFromUrl(url) {
const result = structuredClone(EMPTY_AUTHOR);
try {
const parsedUrl = new URL(url);
const pathSegments = parsedUrl.pathname.split('/').filter(s => s.length > 0);
// TODO: Handle non-GitHub URLs if needed
if (parsedUrl.host === 'github.com' && pathSegments.length >= 2) {
result.name = pathSegments[0];
result.url = `${parsedUrl.protocol}//${parsedUrl.hostname}/${result.name}`;
}
} catch (error) {
console.debug('Error parsing URL:', error);
}
return result;
}
export async function initExtensions() {
await addExtensionsButtonAndMenu();
$('#extensionsMenuButton').css('display', 'flex');
@@ -1865,6 +2311,7 @@ export async function initExtensions() {
$(document).on('click', '.extensions_info .extension_block .toggle_enable', onEnableExtensionClick);
$(document).on('click', '.extensions_info .extension_block .btn_update', onUpdateClick);
$(document).on('click', '.extensions_info .extension_block .btn_delete', onDeleteClick);
$(document).on('click', '.extensions_info .extension_block .btn_clean', onCleanClick);
$(document).on('click', '.extensions_info .extension_block .btn_move', onMoveClick);
$(document).on('click', '.extensions_info .extension_block .btn_branch', onBranchClick);
+312 -213
View File
@@ -5,12 +5,12 @@ TODO:
import { DOMPurify } from '../../../lib.js';
import { getRequestHeaders, processDroppedFiles, eventSource, event_types } from '../../../script.js';
import { deleteExtension, extensionNames, getContext, installExtension, renderExtensionTemplateAsync } from '../../extensions.js';
import { deleteExtension, EMPTY_AUTHOR, extensionNames, getAuthorFromUrl, getContext, installExtension, renderExtensionTemplateAsync, isOfficialExtension } from '../../extensions.js';
import { POPUP_TYPE, Popup, callGenericPopup } from '../../popup.js';
import { executeSlashCommandsWithOptions } from '../../slash-commands.js';
import { accountStorage } from '../../util/AccountStorage.js';
import { flashHighlight, getStringHash, isValidUrl } from '../../utils.js';
import { escapeHtml, flashHighlight, getStringHash, isValidUrl } from '../../utils.js';
import { t, translate } from '../../i18n.js';
import { SlashCommandParser } from '/scripts/slash-commands/SlashCommandParser.js';
export { MODULE_NAME };
const MODULE_NAME = 'assets';
@@ -60,219 +60,262 @@ const KNOWN_TYPES = {
'blip': t`Blip sounds`,
};
const EMPTY_AUTHOR = {
name: '',
url: '',
};
/**
* Extracts the repository author from a given URL.
* @param {string} url - The URL of the repository.
* @returns {{name: string, url: string}} Object containing the author's name and URL, or empty strings if not found.
* Creates the download/delete button element for a single asset, with all interaction handlers attached.
* @param {object} asset The asset data object, containing at least id, name, description and url fields
* @param {string} assetType Asset type, e.g. 'extension', 'character', 'ambient', 'bgm', 'blip'
* @param {number} index Index of the asset in the list of available assets of the same type, used to create a unique element ID
* @returns {JQuery} The button element
*/
function getAuthorFromUrl(url) {
const result = structuredClone(EMPTY_AUTHOR);
function createAssetButton(asset, assetType, index) {
const elemId = `assets_install_${assetType}_${index}`;
const element = $('<div />', { id: elemId, class: 'asset-download-button right_menu_button' });
const label = $('<i class="fa-fw fa-solid fa-download fa-lg"></i>');
element.append(label);
try {
const parsedUrl = new URL(url);
const pathSegments = parsedUrl.pathname.split('/').filter(s => s.length > 0);
console.debug(DEBUG_PREFIX, 'Checking asset', asset.id, asset.url);
// TODO: Handle non-GitHub URLs if needed
if (parsedUrl.host === 'github.com' && pathSegments.length >= 2) {
result.name = pathSegments[0];
result.url = `${parsedUrl.protocol}//${parsedUrl.hostname}/${result.name}`;
const assetInstall = async function () {
element.off('click');
label.removeClass('fa-download');
this.classList.add('asset-download-button-loading');
const result = await installAsset(asset.url, assetType, asset.id);
if (!result) {
this.classList.remove('asset-download-button-loading');
label.addClass('fa-download');
label.removeClass('fa-spinner');
label.removeClass('fa-spin');
element.on('click', assetInstall);
return;
}
} catch (error) {
console.debug(DEBUG_PREFIX, 'Error parsing URL:', error);
label.addClass('fa-check');
this.classList.remove('asset-download-button-loading');
element.on('click', assetDelete);
element.on('mouseenter', function () {
label.removeClass('fa-check');
label.addClass('fa-trash');
label.addClass('redOverlayGlow');
}).on('mouseleave', function () {
label.addClass('fa-check');
label.removeClass('fa-trash');
label.removeClass('redOverlayGlow');
});
};
const assetDelete = async function () {
if (assetType === 'character') {
toastr.error('Go to the characters menu to delete a character.', 'Character deletion not supported');
await SlashCommandParser.commands.go.callback(null, asset.id);
return;
}
element.off('click');
await deleteAsset(assetType, asset.id);
label.removeClass('fa-check');
label.removeClass('redOverlayGlow');
label.removeClass('fa-trash');
label.addClass('fa-download');
element.off('mouseenter').off('mouseleave');
element.on('click', assetInstall);
};
if (isAssetInstalled(assetType, asset.id)) {
console.debug(DEBUG_PREFIX, 'installed, checked');
label.toggleClass('fa-download');
label.toggleClass('fa-check');
element.on('click', assetDelete);
element.on('mouseenter', function () {
label.removeClass('fa-check');
label.addClass('fa-trash');
label.addClass('redOverlayGlow');
}).on('mouseleave', function () {
label.addClass('fa-check');
label.removeClass('fa-trash');
label.removeClass('redOverlayGlow');
});
} else {
console.debug(DEBUG_PREFIX, 'not installed, unchecked');
element.prop('checked', false);
element.on('click', assetInstall);
}
return result;
return element;
}
async function downloadAssetsList(url) {
updateCurrentAssets().then(async function () {
fetch(url, { cache: 'no-cache' })
.then(response => response.json())
.then(async function (json) {
availableAssets = {};
$('#assets_menu').empty();
/**
* Creates the full visual block element for a single asset.
* @param {object} asset The asset data object, containing at least id, name, description and url fields
* @param {string} assetType Asset type, e.g. 'extension', 'character', 'ambient', 'bgm', 'blip'
* @param {JQuery} element The button element from createAssetButton
* @returns {JQuery} The asset block element
*/
function createAssetBlock(asset, assetType, element) {
console.debug(DEBUG_PREFIX, 'Created element for ', asset.id);
console.debug(DEBUG_PREFIX, 'Received assets dictionary', json);
const displayName = DOMPurify.sanitize(asset.name || asset.id);
const description = DOMPurify.sanitize(asset.description || '');
const url = isValidUrl(asset.url) ? asset.url : '';
const title = assetType === 'extension' ? t`Extension repo/guide:` + ` ${url}` : t`Preview in browser`;
const previewIcon = (assetType === 'extension' || assetType === 'character') ? 'fa-arrow-up-right-from-square' : 'fa-headphones-simple';
const toolTag = assetType === 'extension' && asset.tool;
const author = url && assetType === 'extension' ? getAuthorFromUrl(url) : EMPTY_AUTHOR;
for (const i of json) {
//console.log(DEBUG_PREFIX,i)
if (availableAssets[i.type] === undefined)
availableAssets[i.type] = [];
const nameSpan = $('<span>', { class: 'asset-name flex-container alignitemscenter' })
.append($('<b>').text(displayName))
.append($('<a>', { class: 'asset_preview', href: url, target: '_blank', title: title })
.append($('<i>', { class: `fa-solid fa-sm ${previewIcon}` })));
availableAssets[i.type].push(i);
}
if (toolTag) {
const tagSpan = $('<span>', { class: 'tag', title: t`Adds a function tool` })
.append($('<i>', { class: 'fa-solid fa-sm fa-wrench' }))
.append(document.createTextNode(` ${t`Tool`}`));
nameSpan.append(tagSpan);
}
console.debug(DEBUG_PREFIX, 'Updated available assets to', availableAssets);
// First extensions, then everything else
const assetTypes = Object.keys(availableAssets).sort((a, b) => (a === 'extension') ? -1 : (b === 'extension') ? 1 : 0);
nameSpan.append($('<span>', { class: 'expander' }));
$('#assets_type_select').empty();
$('#assets_search').val('');
$('#assets_type_select').append($('<option />', { value: '', text: t`All` }));
if (author.name) {
nameSpan.append($('<a>', { href: author.url, target: '_blank', class: 'asset-author-info' })
.append($('<i>', { class: 'fa-solid fa-at fa-xs' }))
.append($('<span>').text(author.name)));
}
for (const type of assetTypes) {
const text = translate(KNOWN_TYPES[type] || type);
const option = $('<option />', { value: type, text: text });
$('#assets_type_select').append(option);
}
const infoDiv = $('<div>', { class: 'flex-container flexFlowColumn flexNoGap wide100p overflowHidden' })
.append(nameSpan)
.append($('<small>', { class: 'asset-description' }).text(description));
if (assetTypes.includes('extension')) {
$('#assets_type_select').val('extension');
}
const assetBlock = $('<i></i>').append(element).append(infoDiv);
$('#assets_type_select').off('change').on('change', filterAssets);
$('#assets_search').off('input').on('input', filterAssets);
for (const assetType of assetTypes) {
let assetTypeMenu = $('<div />', { id: 'assets_audio_ambient_div', class: 'assets-list-div' });
assetTypeMenu.attr('data-type', assetType);
assetTypeMenu.append(`<h3>${KNOWN_TYPES[assetType] || assetType}</h3>`).hide();
if (assetType == 'extension') {
assetTypeMenu.append(await renderExtensionTemplateAsync('assets', 'installation'));
}
for (const asset of availableAssets[assetType].sort((a, b) => a?.name && b?.name && a.name.localeCompare(b.name))) {
const i = availableAssets[assetType].indexOf(asset);
const elemId = `assets_install_${assetType}_${i}`;
let element = $('<div />', { id: elemId, class: 'asset-download-button right_menu_button' });
const label = $('<i class="fa-fw fa-solid fa-download fa-lg"></i>');
element.append(label);
//if (DEBUG_TONY_SAMA_FORK_MODE)
// asset["url"] = asset["url"].replace("https://github.com/SillyTavern/","https://github.com/Tony-sama/"); // DBG
console.debug(DEBUG_PREFIX, 'Checking asset', asset.id, asset.url);
const assetInstall = async function () {
element.off('click');
label.removeClass('fa-download');
this.classList.add('asset-download-button-loading');
await installAsset(asset.url, assetType, asset.id);
label.addClass('fa-check');
this.classList.remove('asset-download-button-loading');
element.on('click', assetDelete);
element.on('mouseenter', function () {
label.removeClass('fa-check');
label.addClass('fa-trash');
label.addClass('redOverlayGlow');
}).on('mouseleave', function () {
label.addClass('fa-check');
label.removeClass('fa-trash');
label.removeClass('redOverlayGlow');
});
};
const assetDelete = async function () {
if (assetType === 'character') {
toastr.error('Go to the characters menu to delete a character.', 'Character deletion not supported');
await executeSlashCommandsWithOptions(`/go ${asset.id}`);
return;
}
element.off('click');
await deleteAsset(assetType, asset.id);
label.removeClass('fa-check');
label.removeClass('redOverlayGlow');
label.removeClass('fa-trash');
label.addClass('fa-download');
element.off('mouseenter').off('mouseleave');
element.on('click', assetInstall);
};
if (isAssetInstalled(assetType, asset.id)) {
console.debug(DEBUG_PREFIX, 'installed, checked');
label.toggleClass('fa-download');
label.toggleClass('fa-check');
element.on('click', assetDelete);
element.on('mouseenter', function () {
label.removeClass('fa-check');
label.addClass('fa-trash');
label.addClass('redOverlayGlow');
}).on('mouseleave', function () {
label.addClass('fa-check');
label.removeClass('fa-trash');
label.removeClass('redOverlayGlow');
});
} else {
console.debug(DEBUG_PREFIX, 'not installed, unchecked');
element.prop('checked', false);
element.on('click', assetInstall);
}
console.debug(DEBUG_PREFIX, 'Created element for ', asset.id);
const displayName = DOMPurify.sanitize(asset.name || asset.id);
const description = DOMPurify.sanitize(asset.description || '');
const url = isValidUrl(asset.url) ? asset.url : '';
const title = assetType === 'extension' ? t`Extension repo/guide:` + ` ${url}` : t`Preview in browser`;
const previewIcon = (assetType === 'extension' || assetType === 'character') ? 'fa-arrow-up-right-from-square' : 'fa-headphones-simple';
const toolTag = assetType === 'extension' && asset.tool;
const author = url && assetType === 'extension' ? getAuthorFromUrl(url) : EMPTY_AUTHOR;
const assetBlock = $('<i></i>')
.append(element)
.append(`<div class="flex-container flexFlowColumn flexNoGap wide100p overflowHidden">
<span class="asset-name flex-container alignitemscenter">
<b>${displayName}</b>
<a class="asset_preview" href="${url}" target="_blank" title="${title}">
<i class="fa-solid fa-sm ${previewIcon}"></i>
</a>` +
(toolTag ? '<span class="tag" title="' + t`Adds a function tool` + '"><i class="fa-solid fa-sm fa-wrench"></i> ' +
t`Tool` + '</span>' : '') +
'<span class="expander"></span>' +
(author.name ? `<a href="${author.url}" target="_blank" class="asset-author-info"><i class="fa-solid fa-at fa-xs"></i><span>${author.name}</span></a>` : '') +
`</span>
<small class="asset-description">
${description}
</small>
</div>`);
assetBlock.find('.tag').on('click', function (e) {
const a = document.createElement('a');
a.href = 'https://docs.sillytavern.app/for-contributors/function-calling/';
a.target = '_blank';
a.click();
});
if (assetType === 'character') {
if (asset.highlight) {
assetBlock.find('.asset-name').append('<i class="fa-solid fa-sm fa-trophy"></i>');
}
assetBlock.find('.asset-name').prepend(`<div class="avatar"><img src="${asset.url}" alt="${displayName}"></div>`);
}
assetBlock.addClass('asset-block');
assetTypeMenu.append(assetBlock);
}
assetTypeMenu.appendTo('#assets_menu');
assetTypeMenu.on('click', 'a.asset_preview', previewAsset);
}
filterAssets();
$('#assets_filters').show();
$('#assets_menu').show();
})
.catch((error) => {
// Info hint if the user maybe... likely accidently was trying to install an extension and we wanna help guide them? uwu :3
const installButton = $('#third_party_extension_button');
flashHighlight(installButton, 10_000);
toastr.info('Click the flashing button at the top right corner of the menu.', 'Trying to install a custom extension?', { timeOut: 10_000 });
// Error logged after, to appear on top
console.error(error);
toastr.error('Problem with assets URL', DEBUG_PREFIX + 'Cannot get assets list');
$('#assets-connect-button').addClass('fa-plug-circle-exclamation');
$('#assets-connect-button').addClass('redOverlayGlow');
});
assetBlock.find('.tag').on('click', function (e) {
const a = document.createElement('a');
a.href = 'https://docs.sillytavern.app/for-contributors/function-calling/';
a.target = '_blank';
a.click();
});
if (assetType === 'character') {
if (asset.highlight) {
nameSpan.append($('<i>', { class: 'fa-solid fa-sm fa-trophy' }));
}
nameSpan.prepend($('<div>', { class: 'avatar' }).append($('<img>', { src: asset.url, alt: displayName })));
}
assetBlock.addClass('asset-block');
return assetBlock;
}
/**
* Builds and appends the menu section for a single asset type.
* @param {string} assetType Asset type, e.g. 'extension', 'character', 'ambient', 'bgm', 'blip'
* @returns {Promise<void>}
*/
async function buildAssetTypeSection(assetType) {
const assetTypeMenu = $('<div />', { id: `assets_${assetType}_div`, class: 'assets-list-div' });
assetTypeMenu.attr('data-type', assetType);
assetTypeMenu.append($('<h3>').text(KNOWN_TYPES[assetType] || assetType)).hide();
if (assetType == 'extension') {
assetTypeMenu.append(await renderExtensionTemplateAsync('assets', 'installation'));
}
for (const asset of availableAssets[assetType].sort((a, b) => a?.name && b?.name && a.name.localeCompare(b.name))) {
const i = availableAssets[assetType].indexOf(asset);
const element = createAssetButton(asset, assetType, i);
const assetBlock = createAssetBlock(asset, assetType, element);
if (assetType === 'extension') {
const extensionBlockList = isOfficialExtension(asset.url)
? assetTypeMenu.find('.assets-list-extensions-official .assets-list-extensions')
: assetTypeMenu.find('.assets-list-extensions-community .assets-list-extensions');
extensionBlockList.append(assetBlock);
} else {
assetTypeMenu.append(assetBlock);
}
}
assetTypeMenu.appendTo('#assets_menu');
assetTypeMenu.on('click', 'a.asset_preview', previewAsset);
}
/**
* Parses the fetched assets JSON and renders the full assets menu.
* @param {object[]} json Array of asset objects, each containing at least id, name, description, url and type fields
*/
async function populateAssetsMenu(json) {
availableAssets = {};
$('#assets_menu').empty();
console.debug(DEBUG_PREFIX, 'Received assets dictionary', json);
for (const i of json) {
if (availableAssets[i.type] === undefined)
availableAssets[i.type] = [];
availableAssets[i.type].push(i);
}
console.debug(DEBUG_PREFIX, 'Updated available assets to', availableAssets);
// First extensions, then everything else
const assetTypes = Object.keys(availableAssets).sort((a, b) => (a === 'extension') ? -1 : (b === 'extension') ? 1 : 0);
$('#assets_type_select').empty();
$('#assets_search').val('');
$('#assets_type_select').append($('<option />', { value: '', text: t`All` }));
for (const type of assetTypes) {
const text = translate(KNOWN_TYPES[type] || type);
const option = $('<option />', { value: type, text: text });
$('#assets_type_select').append(option);
}
if (assetTypes.includes('extension')) {
$('#assets_type_select').val('extension');
}
$('#assets_type_select').off('change').on('change', filterAssets);
$('#assets_search').off('input').on('input', filterAssets);
for (const assetType of assetTypes) {
await buildAssetTypeSection(assetType);
}
filterAssets();
$('#assets_filters').show();
$('#assets_menu').show();
}
/**
* Downloads the assets list from the given URL and populates the menu. Shows error message if something goes wrong.
* @param {URL} url URL to fetch from
*/
async function downloadAssetsList(url) {
await updateCurrentAssets();
try {
const response = await fetch(url, { cache: 'no-cache' });
if (!response.ok) {
throw new Error('Cannot download the assets list.');
}
const json = await response.json();
if (!Array.isArray(json)) {
throw new Error('Assets list is not an array');
}
await populateAssetsMenu(json);
} catch (error) {
// Info hint if the user maybe... likely accidentally was trying to install an extension and we wanna help guide them? uwu :3
const installButton = $('#third_party_extension_button');
flashHighlight(installButton, 10_000);
toastr.info('Click the flashing button at the top right corner of the menu.', 'Trying to install a custom extension?', { timeOut: 10_000 });
// Error logged after, to appear on top
console.error(error);
toastr.error('Problem with assets URL', 'Cannot get assets list');
$('#assets-connect-button').addClass('fa-plug-circle-exclamation');
$('#assets-connect-button').addClass('redOverlayGlow');
}
}
/**
* Previews the asset by opening its URL. If it's an audio asset, it plays a preview sound. Otherwise, it opens the URL in a new tab.
* @param {JQuery.Event} e Click event
*/
function previewAsset(e) {
const href = $(this).attr('href');
const audioExtensions = ['.mp3', '.ogg', '.wav'];
@@ -295,6 +338,15 @@ function previewAsset(e) {
}
}
/**
* Checks if the asset is already installed.
* For extensions, it checks if the extension name is in the list of installed extensions.
* For characters, it checks if any character has the same avatar URL.
* For other asset types, it checks if any installed asset of the same type has a URL that includes the filename.
* @param {string} assetType Type of the asset, e.g. 'extension', 'character', 'ambient', 'bgm', 'blip'
* @param {string} filename Name or ID of the asset
* @returns {boolean} True if the asset is installed, false otherwise
*/
function isAssetInstalled(assetType, filename) {
let assetList = currentAssets[assetType];
@@ -316,15 +368,22 @@ function isAssetInstalled(assetType, filename) {
return false;
}
/**
* Installs the asset by sending a request to the server to download it. If it's an extension, it uses the existing installExtension function.
* @param {string} url URL of the asset to download
* @param {string} assetType Type of the asset, e.g. 'extension', 'character', 'ambient', 'bgm', 'blip'
* @param {string} filename Name or ID of the asset
* @returns {Promise<boolean>} True if the asset was successfully installed, false otherwise
*/
async function installAsset(url, assetType, filename) {
console.debug(DEBUG_PREFIX, 'Downloading ', url);
const category = assetType;
try {
if (category === 'extension') {
console.debug(DEBUG_PREFIX, 'Installing extension ', url);
await installExtension(url, false);
const result = await installExtension(url, false);
console.debug(DEBUG_PREFIX, 'Extension installed.');
return;
return result;
}
const body = { url, category, filename };
@@ -340,16 +399,25 @@ async function installAsset(url, assetType, filename) {
console.debug(DEBUG_PREFIX, 'Importing character ', filename);
const blob = await result.blob();
const file = new File([blob], filename, { type: blob.type });
await processDroppedFiles([file]);
const fileNameMap = new Map([[file, filename]]);
await processDroppedFiles([file], fileNameMap);
console.debug(DEBUG_PREFIX, 'Character downloaded.');
}
return true;
}
return false;
} catch (err) {
console.log(err);
return [];
return false;
}
}
/**
* Deletes the asset by sending a request to the server to delete it. If it's an extension, it uses the existing deleteExtension function.
* @param {string} assetType Type of the asset, e.g. 'extension', 'character', 'ambient', 'bgm', 'blip'
* @param {string} filename Name or ID of the asset
* @returns {Promise<boolean>} True if the asset was successfully deleted, false otherwise
*/
async function deleteAsset(assetType, filename) {
console.debug(DEBUG_PREFIX, 'Deleting ', assetType, filename);
const category = assetType;
@@ -358,6 +426,7 @@ async function deleteAsset(assetType, filename) {
console.debug(DEBUG_PREFIX, 'Deleting extension ', filename);
await deleteExtension(filename);
console.debug(DEBUG_PREFIX, 'Extension deleted.');
return true;
}
const body = { category, filename };
@@ -369,19 +438,37 @@ async function deleteAsset(assetType, filename) {
});
if (result.ok) {
console.debug(DEBUG_PREFIX, 'Deletion success.');
return true;
}
return false;
} catch (err) {
console.log(err);
return [];
return false;
}
}
/**
* Opens the character browser popup, which shows all available characters and allows downloading them.
* @param {boolean} forceDefault If true, it uses the default ASSETS_JSON_URL instead of the one from the input field.
* @returns {Promise<void>}
*/
async function openCharacterBrowser(forceDefault) {
const url = forceDefault ? ASSETS_JSON_URL : String($('#assets-json-url-field').val());
if (!isValidUrl(url)) {
toastr.error('Please enter a valid URL');
return;
}
const fetchResult = await fetch(url, { cache: 'no-cache' });
if (!fetchResult.ok) {
toastr.error('Cannot download the assets list.');
return;
}
const json = await fetchResult.json();
const characters = json.filter(x => x.type === 'character');
if (!Array.isArray(json)) {
toastr.error('Assets list is not an array');
return;
}
const characters = json.filter(x => x && x.type === 'character');
if (!characters.length) {
toastr.error('No characters found in the assets list', 'Character browser');
return;
@@ -398,12 +485,19 @@ async function openCharacterBrowser(forceDefault) {
downloadButton.toggle(!isInstalled).on('click', async () => {
downloadButton.toggleClass('fa-download fa-spinner fa-spin');
await installAsset(character.url, 'character', character.id);
downloadButton.hide();
checkMark.show();
const result = await installAsset(character.url, 'character', character.id);
if (result) {
downloadButton.hide();
checkMark.show();
} else {
downloadButton.toggleClass('fa-download fa-spinner fa-spin');
}
});
checkMark.toggle(isInstalled);
checkMark.toggle(isInstalled).on('click', async () => {
toastr.error('Go to the characters menu to delete a character.', 'Character deletion not supported');
await SlashCommandParser.commands.go.callback(null, character.id);
});
listElement.append(characterElement);
}
@@ -435,7 +529,7 @@ async function updateCurrentAssets() {
//#############################//
// This function is called when the extension is loaded
jQuery(async () => {
export async function init() {
// This is an example of loading HTML from a file
const windowTemplate = await renderExtensionTemplateAsync(MODULE_NAME, 'window', {});
const windowHtml = $(windowTemplate);
@@ -457,11 +551,16 @@ jQuery(async () => {
const connectButton = windowHtml.find('#assets-connect-button');
connectButton.on('click', async function () {
const url = DOMPurify.sanitize(String(assetsJsonUrl.val()));
const rememberKey = `Assets_SkipConfirm_${getStringHash(url)}`;
const urlString = String(assetsJsonUrl.val()).trim();
if (!isValidUrl(urlString)) {
toastr.error('Please enter a valid URL');
return;
}
const url = new URL(urlString);
const rememberKey = `Assets_SkipConfirm_${getStringHash(url.href)}`;
const skipConfirm = accountStorage.getItem(rememberKey) === 'true';
const confirmation = skipConfirm || await Popup.show.confirm(t`Loading Asset List`, '<span>' + t`Are you sure you want to connect to the following url?` + `</span><var>${url}</var>`, {
const confirmation = skipConfirm || await Popup.show.confirm(t`Loading Asset List`, '<span>' + t`Are you sure you want to connect to the following url?` + `</span><var>${escapeHtml(url.href)}</var>`, {
customInputs: [{ id: 'assets-remember', label: 'Don\'t ask again for this URL' }],
onClose: popup => {
if (popup.result) {
@@ -480,7 +579,7 @@ jQuery(async () => {
connectButton.addClass('fa-plug-circle-check');
} catch (error) {
console.error('Error:', error);
toastr.error(`Cannot get assets list from ${url}`);
toastr.error(`Cannot get assets list from ${url.href}`);
connectButton.removeClass('fa-plug-circle-check');
connectButton.addClass('fa-plug-circle-exclamation');
connectButton.removeClass('redOverlayGlow');
@@ -496,4 +595,4 @@ jQuery(async () => {
eventSource.on(event_types.OPEN_CHARACTER_LIBRARY, async (forceDefault) => {
openCharacterBrowser(forceDefault);
});
});
}
@@ -1,4 +1,22 @@
<div class="assets-list-git">
<span data-i18n="extension_install_1">To download extensions from this page, you need to have </span><a href="https://git-scm.com/downloads" target="_blank">Git</a><span data-i18n="extension_install_2"> installed.</span><br>
<span data-i18n="extension_install_3">Click the </span><i class="fa-solid fa-sm fa-arrow-up-right-from-square"></i><span data-i18n="extension_install_4"> icon to visit the Extension's repo for tips on how to use it.</span>
</div>
</div>
<div class="assets-list-extensions-official">
<h2 data-i18n="Official Extensions">Official Extensions</h2>
<div class="info-block hint">
<small class="assets-list-description" data-i18n="These extensions are maintained by the SillyTavern team.">
These extensions are maintained by the SillyTavern team.
</small>
</div>
<div class="assets-list-extensions"></div>
</div>
<div class="assets-list-extensions-community">
<h2 data-i18n="Community Extensions">Community Extensions</h2>
<div class="info-block warning">
<small data-i18n="Community extensions are not reviewed or verified by the SillyTavern team. Please exercise caution when installing.">
Community extensions are not reviewed or verified by the SillyTavern team. Please exercise caution when installing.
</small>
</div>
<div class="assets-list-extensions"></div>
</div>
@@ -7,5 +7,8 @@
"css": "style.css",
"author": "Keij#6799",
"version": "0.1.0",
"homePage": "https://github.com/SillyTavern/SillyTavern"
"homePage": "https://github.com/SillyTavern/SillyTavern",
"hooks": {
"activate": "init"
}
}
+16 -3
View File
@@ -27,15 +27,20 @@
margin-bottom: 0.25em;
}
.assets-list-div h2 {
margin: 0;
font-size: 1.1em;
}
.assets-list-div h3 {
text-transform: capitalize;
}
.assets-list-div i a {
.assets-list-div .asset-block a {
color: inherit;
}
.assets-list-div>i {
.assets-list-div .asset-block {
display: flex;
flex-direction: row;
align-items: center;
@@ -46,7 +51,7 @@
border-bottom: 1px solid var(--SmartThemeBorderColor);
}
.assets-list-div i span:first-of-type {
.assets-list-div .asset-block span:first-of-type {
font-weight: bold;
}
@@ -198,3 +203,11 @@
.asset-name>b {
font-weight: 600;
}
div:is(.assets-list-extensions-official, .assets-list-extensions-community):has(.assets-list-extensions:empty) {
display: none;
}
div:is(.assets-list-extensions-official, .assets-list-extensions-community) {
margin-top: 10px;
}
@@ -243,7 +243,7 @@ function handleCharacterRename(oldAvatar, newAvatar) {
}
}
jQuery(async () => {
export async function init() {
eventSource.on(event_types.APP_READY, cleanUpAttachments);
eventSource.on(event_types.CHARACTER_DELETED, cleanUpCharacterAttachments);
eventSource.on(event_types.CHARACTER_RENAMED, handleCharacterRename);
@@ -407,4 +407,4 @@ jQuery(async () => {
}),
],
}));
});
}
@@ -7,5 +7,8 @@
"css": "style.css",
"author": "Cohee1207",
"version": "1.0.0",
"homePage": "https://github.com/SillyTavern/SillyTavern"
"homePage": "https://github.com/SillyTavern/SillyTavern",
"hooks": {
"activate": "init"
}
}
+26 -10
View File
@@ -1,8 +1,9 @@
import { ensureImageFormatSupported, getBase64Async, getFileExtension, isTrueBoolean, saveBase64AsFile } from '../../utils.js';
import { getContext, getApiUrl, doExtrasFetch, extension_settings, modules, renderExtensionTemplateAsync } from '../../extensions.js';
import { appendMediaToMessage, chat_metadata, eventSource, event_types, getRequestHeaders, saveChatConditional, saveSettingsDebounced, substituteParamsExtended } from '../../../script.js';
import { appendMediaToMessage, chat_metadata, eventSource, event_types, getRequestHeaders, saveChatConditional, saveSettingsDebounced, substituteParams } from '../../../script.js';
import { getMessageTimeStamp } from '../../RossAscends-mods.js';
import { SECRET_KEYS, secret_state } from '../../secrets.js';
import { oai_settings, POLLINATIONS_ENDPOINT } from '../../openai.js';
import { getMultimodalCaption } from '../shared.js';
import { textgen_types, textgenerationwebui_settings } from '../../textgen-settings.js';
import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js';
@@ -17,6 +18,11 @@ const MODULE_NAME = 'caption';
const PROMPT_DEFAULT = 'What\'s in this image?';
const TEMPLATE_DEFAULT = '[{{user}} sends {{char}} a picture that contains: {{caption}}]';
const GOOGLE_MODEL_MIGRATIONS = new Map([
['gemini-3.1-flash-lite-preview', 'gemini-3.1-flash-lite'],
['gemini-3.1-flash-image-preview', 'gemini-3.1-flash-image'],
['gemini-3-pro-image-preview', 'gemini-3-pro-image'],
]);
/**
* Migrates old extension settings to the new format.
@@ -36,7 +42,12 @@ function migrateSettings() {
if (extension_settings.caption.source === 'openai') {
extension_settings.caption.source = 'multimodal';
extension_settings.caption.multimodal_api = 'openai';
extension_settings.caption.multimodal_model = 'gpt-4-turbo';
extension_settings.caption.multimodal_model = 'gpt-5.6-luna';
}
if (['google', 'vertexai'].includes(extension_settings.caption.multimodal_api)) {
extension_settings.caption.multimodal_model = GOOGLE_MODEL_MIGRATIONS.get(extension_settings.caption.multimodal_model)
?? extension_settings.caption.multimodal_model;
}
if (!extension_settings.caption.multimodal_api) {
@@ -44,7 +55,7 @@ function migrateSettings() {
}
if (!extension_settings.caption.multimodal_model) {
extension_settings.caption.multimodal_model = 'gpt-4-turbo';
extension_settings.caption.multimodal_model = 'gpt-6-luna';
}
if (!extension_settings.caption.prompt) {
@@ -99,7 +110,7 @@ async function wrapCaptionTemplate(caption) {
template += ' {{caption}}';
}
let messageText = substituteParamsExtended(template, { caption: caption });
let messageText = substituteParams(template, { dynamicMacros: { caption: caption } });
if (extension_settings.caption.refine_mode) {
messageText = await Popup.show.input(
@@ -321,6 +332,8 @@ async function captionMultimodal(base64Img, externalPrompt) {
prompt = String(customPrompt).trim();
}
prompt = substituteParams(prompt);
const caption = await getMultimodalCaption(base64Img, prompt);
return { caption };
}
@@ -454,7 +467,7 @@ function isVideoCaptioningAvailable() {
return ['google', 'vertexai', 'zai'].includes(extension_settings.caption.multimodal_api);
}
jQuery(async function () {
export async function init() {
function addSendPictureButton() {
const sendButton = $(`
<div id="send_picture" class="list-group-item flex-container flexGap5">
@@ -504,6 +517,7 @@ jQuery(async function () {
'chutes': SECRET_KEYS.CHUTES,
'electronhub': SECRET_KEYS.ELECTRONHUB,
'pollinations': SECRET_KEYS.POLLINATIONS,
'workers_ai': SECRET_KEYS.WORKERS_AI,
};
if (chatCompletionApis[api] && secret_state[chatCompletionApis[api]]) {
@@ -526,8 +540,8 @@ jQuery(async function () {
return true;
}
// Custom API doesn't need additional checks
if (api === 'custom') {
// Custom API and anonymous Pollinations don't need additional checks
if (api === 'custom' || (api === 'pollinations' && oai_settings.pollinations_endpoint === POLLINATIONS_ENDPOINT.ANONYMOUS)) {
return true;
}
}
@@ -580,7 +594,7 @@ jQuery(async function () {
}
async function addRemoteEndpointModels() {
async function processEndpoint(api, url) {
async function processEndpoint(api, url, additionalParams = {}) {
const dropdown = document.getElementById('caption_multimodal_model');
if (!(dropdown instanceof HTMLSelectElement)) {
return;
@@ -591,7 +605,8 @@ jQuery(async function () {
const options = Array.from(dropdown.options);
const response = await fetch(url, {
method: 'POST',
headers: getRequestHeaders({ omitContentType: true }),
headers: getRequestHeaders(),
body: JSON.stringify(additionalParams),
});
if (!response.ok) {
return;
@@ -620,6 +635,7 @@ jQuery(async function () {
await processEndpoint('mistral', '/api/backends/chat-completions/multimodal-models/mistral');
await processEndpoint('xai', '/api/backends/chat-completions/multimodal-models/xai');
await processEndpoint('moonshot', '/api/backends/chat-completions/multimodal-models/moonshot');
await processEndpoint('workers_ai', '/api/backends/chat-completions/multimodal-models/workers_ai', { workers_ai_account_id: oai_settings.workers_ai_account_id });
}
await addSettings();
@@ -804,4 +820,4 @@ jQuery(async function () {
}));
document.body.classList.add('caption');
});
}
@@ -9,5 +9,8 @@
"css": "style.css",
"author": "Cohee#1207",
"version": "1.0.0",
"homePage": "https://github.com/SillyTavern/SillyTavern"
"homePage": "https://github.com/SillyTavern/SillyTavern",
"hooks": {
"activate": "init"
}
}
+49 -47
View File
@@ -20,6 +20,7 @@
<option value="aimlapi">AI/ML API</option>
<option value="chutes">Chutes</option>
<option value="anthropic">Claude</option>
<option value="workers_ai">Cloudflare Workers AI</option>
<option value="cohere">Cohere</option>
<option value="custom" data-i18n="Custom (OpenAI-compatible)">Custom (OpenAI-compatible)</option>
<option value="electronhub">Electron Hub</option>
@@ -53,7 +54,21 @@
<option data-type="cohere" value="c4ai-aya-vision-8b">c4ai-aya-vision-8b</option>
<option data-type="cohere" value="c4ai-aya-vision-32b">c4ai-aya-vision-32b</option>
<option data-type="cohere" value="command-a-vision-07-2025">command-a-vision-07-2025</option>
<option data-type="openai" value="gpt-6-astra">gpt-6-astra</option>
<option data-type="openai" value="gpt-6-sol">gpt-6-sol</option>
<option data-type="openai" value="gpt-6-luna">gpt-6-luna</option>
<option data-type="openai" value="gpt-5.6">gpt-5.6</option>
<option data-type="openai" value="gpt-5.6-sol">gpt-5.6-sol</option>
<option data-type="openai" value="gpt-5.6-terra">gpt-5.6-terra</option>
<option data-type="openai" value="gpt-5.6-luna">gpt-5.6-luna</option>
<option data-type="openai" value="gpt-5.5">gpt-5.5</option>
<option data-type="openai" value="gpt-5.5-2026-04-23">gpt-5.5-2026-04-23</option>
<option data-type="openai" value="gpt-5.4">gpt-5.4</option>
<option data-type="openai" value="gpt-5.4-2026-03-05">gpt-5.4-2026-03-05</option>
<option data-type="openai" value="gpt-5.4-mini">gpt-5.4-mini</option>
<option data-type="openai" value="gpt-5.4-mini-2026-03-17">gpt-5.4-mini-2026-03-17</option>
<option data-type="openai" value="gpt-5.4-nano">gpt-5.4-nano</option>
<option data-type="openai" value="gpt-5.4-nano-2026-03-17">gpt-5.4-nano-2026-03-17</option>
<option data-type="openai" value="gpt-5.3-chat-latest">gpt-5.3-chat-latest</option>
<option data-type="openai" value="gpt-5.2">gpt-5.2</option>
<option data-type="openai" value="gpt-5.2-2025-12-11">gpt-5.2-2025-12-11</option>
@@ -74,20 +89,23 @@
<option data-type="openai" value="gpt-4.1-mini-2025-04-14">gpt-4.1-mini-2025-04-14</option>
<option data-type="openai" value="gpt-4.1-nano">gpt-4.1-nano</option>
<option data-type="openai" value="gpt-4.1-nano-2025-04-14">gpt-4.1-nano-2025-04-14</option>
<option data-type="openai" value="gpt-4-vision-preview">gpt-4-vision-preview</option>
<option data-type="openai" value="gpt-4-turbo">gpt-4-turbo</option>
<option data-type="openai" value="gpt-4o">gpt-4o</option>
<option data-type="openai" value="gpt-4o-mini">gpt-4o-mini</option>
<option data-type="openai" value="gpt-4o-mini-2024-07-18">gpt-4o-mini-2024-07-18</option>
<option data-type="openai" value="chatgpt-4o-latest">chatgpt-4o-latest</option>
<option data-type="openai" value="o1">o1</option>
<option data-type="openai" value="o1-2024-12-17">o1-2024-12-17</option>
<option data-type="openai" value="o3">o3</option>
<option data-type="openai" value="o3-2025-04-16">o3-2025-04-16</option>
<option data-type="openai" value="o4-mini">o4-mini</option>
<option data-type="openai" value="o4-mini-2025-04-16">o4-mini-2025-04-16</option>
<option data-type="openai" value="gpt-4.5-preview">gpt-4.5-preview</option>
<option data-type="openai" value="gpt-4.5-preview-2025-02-27">gpt-4.5-preview-2025-02-27</option>
<option data-type="anthropic" value="claude-fable-5-1">claude-fable-5-1</option>
<option data-type="anthropic" value="claude-fable-5">claude-fable-5</option>
<option data-type="anthropic" value="claude-opus-5-5">claude-opus-5-5</option>
<option data-type="anthropic" value="claude-opus-5">claude-opus-5</option>
<option data-type="anthropic" value="claude-sonnet-5">claude-sonnet-5</option>
<option data-type="anthropic" value="claude-opus-4-8">claude-opus-4-8</option>
<option data-type="anthropic" value="claude-opus-4-7">claude-opus-4-7</option>
<option data-type="anthropic" value="claude-opus-4-6">claude-opus-4-6</option>
<option data-type="anthropic" value="claude-opus-4-5">claude-opus-4-5</option>
<option data-type="anthropic" value="claude-opus-4-5-20251101">claude-opus-4-5-20251101</option>
@@ -96,67 +114,50 @@
<option data-type="anthropic" value="claude-sonnet-4-5-20250929">claude-sonnet-4-5-20250929</option>
<option data-type="anthropic" value="claude-haiku-4-5">claude-haiku-4-5</option>
<option data-type="anthropic" value="claude-haiku-4-5-20251001">claude-haiku-4-5-20251001</option>
<option data-type="anthropic" value="claude-opus-4-1">claude-opus-4-1</option>
<option data-type="anthropic" value="claude-opus-4-1-20250805">claude-opus-4-1-20250805</option>
<option data-type="anthropic" value="claude-opus-4-0">claude-opus-4-0</option>
<option data-type="anthropic" value="claude-opus-4-20250514">claude-opus-4-20250514</option>
<option data-type="anthropic" value="claude-sonnet-4-0">claude-sonnet-4-0</option>
<option data-type="anthropic" value="claude-sonnet-4-20250514">claude-sonnet-4-20250514</option>
<option data-type="anthropic" value="claude-3-7-sonnet-latest">claude-3-7-sonnet-latest</option>
<option data-type="anthropic" value="claude-3-7-sonnet-20250219">claude-3-7-sonnet-20250219</option>
<option data-type="anthropic" value="claude-3-5-sonnet-latest">claude-3-5-sonnet-latest</option>
<option data-type="anthropic" value="claude-3-5-sonnet-20241022">claude-3-5-sonnet-20241022</option>
<option data-type="anthropic" value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option>
<option data-type="anthropic" value="claude-3-5-haiku-latest">claude-3-5-haiku-latest</option>
<option data-type="anthropic" value="claude-3-5-haiku-20241022">claude-3-5-haiku-20241022</option>
<option data-type="anthropic" value="claude-3-opus-20240229">claude-3-opus-20240229</option>
<option data-type="anthropic" value="claude-3-haiku-20240307">claude-3-haiku-20240307</option>
<option data-type="google" value="gemini-3.8-flash">gemini-3.8-flash</option>
<option data-type="google" value="gemini-3.7-flash">gemini-3.7-flash</option>
<option data-type="google" value="gemini-3.6-flash">gemini-3.6-flash</option>
<option data-type="google" value="gemini-3.5-flash">gemini-3.5-flash</option>
<option data-type="google" value="gemini-3.5-flash-lite">gemini-3.5-flash-lite</option>
<option data-type="google" value="gemini-3.1-pro-preview">gemini-3.1-pro-preview</option>
<option data-type="google" value="gemini-3.1-flash-lite-preview">gemini-3.1-flash-lite-preview</option>
<option data-type="google" value="gemini-3.1-flash-image-preview">gemini-3.1-flash-image-preview</option>
<option data-type="google" value="gemini-3-pro-preview">gemini-3-pro-preview</option>
<option data-type="google" value="gemini-3-pro-image-preview">gemini-3-pro-image-preview</option>
<option data-type="google" value="gemini-3.1-flash-lite">gemini-3.1-flash-lite</option>
<option data-type="google" value="gemini-3.1-flash-image">gemini-3.1-flash-image</option>
<option data-type="google" value="gemini-3-pro-image">gemini-3-pro-image</option>
<option data-type="google" value="gemini-3-flash-preview">gemini-3-flash-preview</option>
<option data-type="google" value="gemini-2.5-pro">gemini-2.5-pro</option>
<option data-type="google" value="gemini-2.5-pro-preview-06-05">gemini-2.5-pro-preview-06-05</option>
<option data-type="google" value="gemini-2.5-pro-preview-05-06">gemini-2.5-pro-preview-05-06</option>
<option data-type="google" value="gemini-2.5-pro-preview-03-25">gemini-2.5-pro-preview-03-25</option>
<option data-type="google" value="gemini-2.5-flash">gemini-2.5-flash</option>
<option data-type="google" value="gemini-2.5-flash-preview-09-2025">gemini-2.5-flash-preview-09-2025</option>
<option data-type="google" value="gemini-2.5-flash-preview-05-20">gemini-2.5-flash-preview-05-20</option>
<option data-type="google" value="gemini-2.5-flash-lite">gemini-2.5-flash-lite</option>
<option data-type="google" value="gemini-2.5-flash-lite-preview-09-2025">gemini-2.5-flash-lite-preview-09-2025</option>
<option data-type="google" value="gemini-2.5-flash-lite-preview-06-17">gemini-2.5-flash-lite-preview-06-17</option>
<option data-type="google" value="gemini-2.5-flash-image">gemini-2.5-flash-image</option>
<option data-type="google" value="gemini-2.5-flash-image-preview">gemini-2.5-flash-image-preview</option>
<option data-type="google" value="gemini-2.0-pro-exp-02-05">gemini-2.0-pro-exp-02-05 → 2.5-exp-03-25</option>
<option data-type="google" value="gemini-2.0-pro-exp">gemini-2.0-pro-exp → 2.5-exp-03-25</option>
<option data-type="google" value="gemini-exp-1206">gemini-exp-1206 → 2.5-exp-03-25</option>
<option data-type="google" value="gemini-2.0-flash-001">gemini-2.0-flash-001</option>
<option data-type="google" value="gemini-2.0-flash-exp-image-generation">gemini-2.0-flash-exp-image-generation</option>
<option data-type="google" value="gemini-2.0-flash-exp">gemini-2.0-flash-exp</option>
<option data-type="google" value="gemini-2.0-flash">gemini-2.0-flash</option>
<option data-type="google" value="gemini-2.0-flash-thinking-exp-01-21">gemini-2.0-flash-thinking-exp-01-21 → 2.5-flash-preview-5-20</option>
<option data-type="google" value="gemini-2.0-flash-thinking-exp-1219">gemini-2.0-flash-thinking-exp-1219 → 2.5-flash-preview-05-20</option>
<option data-type="google" value="gemini-2.0-flash-thinking-exp">gemini-2.0-flash-thinking-exp → 2.5-flash-preview-05-20</option>
<option data-type="google" value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001</option>
<option data-type="google" value="gemini-2.0-flash-lite-preview-02-05">gemini-2.0-flash-lite-preview-02-05</option>
<option data-type="google" value="gemini-2.0-flash-lite-preview">gemini-2.0-flash-lite-preview</option>
<option data-type="google" value="gemini-2.0-flash-001">gemini-2.0-flash-001 (deprecated)</option>
<option data-type="google" value="gemini-2.0-flash">gemini-2.0-flash (deprecated)</option>
<option data-type="google" value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001 (deprecated)</option>
<option data-type="google" value="learnlm-2.0-flash-experimental">learnlm-2.0-flash-experimental</option>
<option data-type="google" value="gemini-robotics-er-1.5-preview">gemini-robotics-er-1.5-preview</option>
<option data-type="google" value="gemma-4-31b-it">gemma-4-31b-it</option>
<option data-type="google" value="gemma-4-26b-a4b-it">gemma-4-26b-a4b-it</option>
<option data-type="google" value="gemma-3-27b-it">gemma-3-27b-it</option>
<option data-type="google" value="gemma-3-12b-it">gemma-3-12b-it</option>
<option data-type="google" value="gemma-3-4b-it">gemma-3-4b-it</option>
<option data-type="vertexai" value="gemini-3.8-flash">gemini-3.8-flash</option>
<option data-type="vertexai" value="gemini-3.7-flash">gemini-3.7-flash</option>
<option data-type="vertexai" value="gemini-3.6-flash">gemini-3.6-flash</option>
<option data-type="vertexai" value="gemini-3.5-flash">gemini-3.5-flash</option>
<option data-type="vertexai" value="gemini-3.5-flash-lite">gemini-3.5-flash-lite</option>
<option data-type="vertexai" value="gemini-3.1-pro-preview">gemini-3.1-pro-preview</option>
<option data-type="vertexai" value="gemini-3.1-flash-lite-preview">gemini-3.1-flash-lite-preview</option>
<option data-type="vertexai" value="gemini-3.1-flash-image-preview">gemini-3.1-flash-image-preview</option>
<option data-type="vertexai" value="gemini-3-pro-preview">gemini-3-pro-preview</option>
<option data-type="vertexai" value="gemini-3-pro-image-preview">gemini-3-pro-image-preview</option>
<option data-type="vertexai" value="gemini-3.1-flash-lite">gemini-3.1-flash-lite</option>
<option data-type="vertexai" value="gemini-3.1-flash-image">gemini-3.1-flash-image</option>
<option data-type="vertexai" value="gemini-3-pro-image">gemini-3-pro-image</option>
<option data-type="vertexai" value="gemini-3-flash-preview">gemini-3-flash-preview</option>
<option data-type="vertexai" value="gemini-2.5-pro">gemini-2.5-pro</option>
<option data-type="vertexai" value="gemini-2.5-flash">gemini-2.5-flash</option>
<option data-type="vertexai" value="gemini-2.5-flash-lite">gemini-2.5-flash-lite</option>
<option data-type="vertexai" value="gemini-2.5-flash-image">gemini-2.5-flash-image</option>
<option data-type="vertexai" value="gemini-2.5-flash-image-preview">gemini-2.5-flash-image-preview</option>
<option data-type="vertexai" value="gemini-2.0-flash-001">gemini-2.0-flash-001</option>
<option data-type="vertexai" value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001</option>
<option data-type="vertexai" value="gemini-2.0-flash-001">gemini-2.0-flash-001 (deprecated)</option>
<option data-type="vertexai" value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001 (deprecated)</option>
<option data-type="groq" value="meta-llama/llama-4-scout-17b-16e-instruct">meta-llama/llama-4-scout-17b-16e-instruct</option>
<option data-type="groq" value="meta-llama/llama-4-maverick-17b-128e-instruct">meta-llama/llama-4-maverick-17b-128e-instruct</option>
<option data-type="ollama" value="ollama_current" data-i18n="currently_selected">[Currently selected]</option>
@@ -174,6 +175,7 @@
<option data-type="ollama" value="mistral-small3.2">mistral-small3.2</option>
<option data-type="ollama" value="llama3.2-vision">llama3.2-vision</option>
<option data-type="ollama" value="llama4">llama4</option>
<option data-type="zai" value="glm-5v-turbo">glm-5v-turbo</option>
<option data-type="zai" value="glm-4.6v">glm-4.6v</option>
<option data-type="zai" value="glm-4.6v-flashx">glm-4.6v-flashx</option>
<option data-type="zai" value="glm-4.6v-flash">glm-4.6v-flash</option>
@@ -1,7 +1,7 @@
import { DOMPurify, Fuse } from '../../../lib.js';
import { event_types, eventSource, main_api, online_status, saveSettingsDebounced } from '../../../script.js';
import { extension_settings, renderExtensionTemplateAsync } from '../../extensions.js';
import { activateSendButtons, deactivateSendButtons, event_types, eventSource, main_api, online_status, saveSettingsDebounced } from '../../../script.js';
import { extension_settings, getContext, renderExtensionTemplateAsync } from '../../extensions.js';
import { callGenericPopup, Popup, POPUP_RESULT, POPUP_TYPE } from '../../popup.js';
import { SlashCommand } from '../../slash-commands/SlashCommand.js';
import { SlashCommandAbortController } from '../../slash-commands/SlashCommandAbortController.js';
@@ -9,11 +9,16 @@ import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '
import { commonEnumProviders, enumIcons } from '../../slash-commands/SlashCommandCommonEnumsProvider.js';
import { SlashCommandDebugController } from '../../slash-commands/SlashCommandDebugController.js';
import { enumTypes, SlashCommandEnumValue } from '../../slash-commands/SlashCommandEnumValue.js';
import { SlashCommandClosure } from '../../slash-commands/SlashCommandClosure.js';
import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js';
import { SlashCommandScope } from '../../slash-commands/SlashCommandScope.js';
import { collapseSpaces, getUniqueName, isFalseBoolean, uuidv4, waitUntilCondition } from '../../utils.js';
import { collapseSpaces, getUniqueName, isFalseBoolean, isTrueBoolean, uuidv4, waitUntilCondition } from '../../utils.js';
import { t } from '../../i18n.js';
import { getSecretLabelById } from '../../secrets.js';
import { performFuzzySearch } from '/scripts/power-user.js';
import { StreamingDisplay } from '/scripts/streaming-display.js';
import { ConnectionManagerRequestService } from '../shared.js';
import { formatReasoning } from '/scripts/reasoning.js';
const MODULE_NAME = 'connection-manager';
const NONE = '<None>';
@@ -474,7 +479,223 @@ async function renderDetailsContent(detailsContent) {
}
}
(async function () {
/**
* Callback for the /profile-genstream command
* Generates text using Connection Manager with streaming display support.
* @param {object} args Named arguments
* @param {string} value Unnamed argument (the prompt)
* @returns {Promise<string>} The generated text, optionally with formatted reasoning
*/
async function generateStreamCallback(args, value) {
if (!value) {
console.warn('WARN: No argument provided for /profile-genstream command');
return '';
}
// Check if Connection Manager is available
const context = getContext();
if (context.extensionSettings.disabledExtensions.includes('connection-manager')) {
toastr.error(t`Connection Manager is required for /profile-genstream. Use /gen or /genraw instead.`);
return '';
}
const profileIdOrName = args?.profile;
const includeReasoning = isTrueBoolean(args?.reasoning);
const systemPrompt = typeof args?.system == 'string' ? args.system : '';
const maxTokens = Number(args?.length ?? 2048) || 2048;
const lock = isTrueBoolean(args?.lock);
const generatingLabel = typeof args?.generating === 'string' ? args.generating : 'Generating...';
const completedLabel = typeof args?.completed === 'string' ? args.completed : 'Generated';
const enableStop = !isFalseBoolean(args?.stop);
const onStopClosure = args?.onStop instanceof SlashCommandClosure ? args.onStop : null;
const onCompleteClosure = args?.onComplete instanceof SlashCommandClosure ? args.onComplete : null;
// Parse delay: 'infinite' or negative = null (stay open), number = delay in ms
let completeDelay = 3000; // Default 3 seconds
if (args?.delay !== undefined) {
if (typeof args.delay === 'string' && args.delay.toLowerCase() === 'infinite') {
completeDelay = null; // Stay until user closes
} else {
const parsed = Number(args.delay);
if (!isNaN(parsed) && parsed >= 0) {
completeDelay = parsed;
} else if (!isNaN(parsed) && parsed < 0) {
completeDelay = null; // Negative = infinite
}
}
}
// Create abort controller for stop functionality (when stop is enabled)
const abortController = enableStop ? new AbortController() : null;
// Compose the stop handler: abort the request + optionally invoke user closure
const onStopHandler = enableStop ? async () => {
abortController.abort();
if (onStopClosure) {
try {
const localClosure = onStopClosure.getCopy();
localClosure.onProgress = () => { };
await localClosure.execute();
} catch (e) {
console.error('[GenStream] Error executing onStop closure', e);
}
}
} : null;
try {
if (lock) {
deactivateSendButtons();
}
// Determine which profile to use
// Use the currently selected profile if no profile specified
let effectiveProfileId = context.extensionSettings.connectionManager.selectedProfile;
const profiles = context.extensionSettings.connectionManager.profiles;
if (profileIdOrName) {
// Use try to find profile by id first, then fuse search
const profile = profiles.find(p => p.id === profileIdOrName);
if (profile) {
effectiveProfileId = profile.id;
} else {
const keys = [
{ name: 'name', weight: 10 },
];
const fuseResults = performFuzzySearch('profile', profiles, keys, profileIdOrName);
if (fuseResults.length > 0) {
effectiveProfileId = fuseResults[0].item.id;
} else {
toastr.warning(t`Connection profile not found: ${profileIdOrName}`);
return '';
}
}
}
if (!effectiveProfileId) {
toastr.error(t`No connection profile specified or selected. Use profile= argument or select a profile in Connection Manager.`);
return '';
}
// Create streaming display
const display = new StreamingDisplay();
display.show({
label: generatingLabel,
icon: ConnectionManagerRequestService.getProfileIcon(effectiveProfileId),
onStop: onStopHandler,
});
const messages = [
...(systemPrompt ? [{ role: 'system', content: systemPrompt }] : []),
{ role: 'user', content: value },
];
let finalText = '';
let finalReasoning = '';
/** Gets the final (if requested, formatted) text to return for this command @returns {string} */
function buildResultText() {
// Format output with reasoning if requested
if (includeReasoning && finalReasoning) {
const { formatted } = formatReasoning(finalReasoning, finalText);
return formatted;
}
return finalText;
}
try {
// Attempt streaming first
const streamResponse = await ConnectionManagerRequestService.sendRequest(
effectiveProfileId,
messages,
maxTokens,
{ extractData: true, includePreset: true, stream: true, signal: abortController?.signal ?? undefined },
);
if (typeof streamResponse === 'function') {
const generator = streamResponse();
for await (const chunk of generator) {
finalText = chunk.text;
finalReasoning = chunk.state?.reasoning || '';
display.updateReasoning(finalReasoning);
display.updateContent(finalText);
}
} else {
// Non-streaming fallback within the try block
const extracted = streamResponse;
finalText = extracted?.content || '';
finalReasoning = extracted?.reasoning || '';
if (finalReasoning) {
display.updateReasoning(finalReasoning);
}
display.updateContent(finalText);
}
} catch (error) {
// If the user clicked stop, don't retry — show stopped state and return empty
if (abortController?.signal?.aborted) {
display.markStopped({ label: `${generatingLabel} [Stopped]` });
return buildResultText();
}
console.warn('[Slash Commands] Streaming failed, falling back to non-streaming:', error);
display.hide({ instant: true });
// Retry with non-streaming
const response = await ConnectionManagerRequestService.sendRequest(
effectiveProfileId,
messages,
maxTokens,
{ extractData: true, includePreset: true, stream: false },
);
const extracted = /** @type {import('../../custom-request.js').ExtractedData} */ (response);
finalText = extracted?.content || '';
finalReasoning = extracted?.reasoning || '';
// Show quick non-streaming display
display.show({
label: generatingLabel,
icon: ConnectionManagerRequestService.getProfileIcon(effectiveProfileId),
});
if (finalReasoning) {
display.updateReasoning(finalReasoning);
}
display.updateContent(finalText);
}
// Mark as complete with delay (null = stay open until user closes)
display.complete({ label: completedLabel, delay: completeDelay });
// Invoke onComplete closure if provided
if (onCompleteClosure) {
try {
const localClosure = onCompleteClosure.getCopy();
localClosure.onProgress = () => { };
await localClosure.execute();
} catch (e) {
console.error('[GenStream] Error executing onComplete closure', e);
}
}
if (!finalText) {
toastr.warning(t`Generation returned empty result`);
return '';
}
return buildResultText();
} catch (err) {
console.error('Error on /genstream generation', err);
toastr.error(err.message, t`API Error`, { preventDuplicates: true });
return '';
} finally {
if (lock) {
activateSendButtons();
}
}
}
export async function init() {
extension_settings.connectionManager = extension_settings.connectionManager || structuredClone(DEFAULT_SETTINGS);
for (const key of Object.keys(DEFAULT_SETTINGS)) {
@@ -824,4 +1045,114 @@ async function renderDetailsContent(detailsContent) {
return JSON.stringify(profile);
},
}));
})();
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'profile-genstream',
callback: generateStreamCallback,
returns: t`generated text`,
namedArgumentList: [
new SlashCommandNamedArgument(
'lock', t`lock user input during generation`, [ARGUMENT_TYPE.BOOLEAN], false, false, 'off', commonEnumProviders.boolean('onOff')(),
),
SlashCommandNamedArgument.fromProps({
name: 'profile',
description: t`connection profile ID to use for generation`,
typeList: [ARGUMENT_TYPE.STRING],
enumProvider: commonEnumProviders.connectionProfiles(),
}),
SlashCommandNamedArgument.fromProps({
name: 'reasoning',
description: t`include formatted reasoning in the output`,
typeList: [ARGUMENT_TYPE.BOOLEAN],
defaultValue: 'false',
enumProvider: commonEnumProviders.boolean('trueFalse'),
}),
SlashCommandNamedArgument.fromProps({
name: 'system',
description: t`system prompt at the start`,
typeList: [ARGUMENT_TYPE.STRING],
}),
SlashCommandNamedArgument.fromProps({
name: 'length',
description: t`API response length in tokens`,
typeList: [ARGUMENT_TYPE.NUMBER],
defaultValue: '2048',
}),
SlashCommandNamedArgument.fromProps({
name: 'generating',
description: t`label/title for the generation display`,
typeList: [ARGUMENT_TYPE.STRING],
defaultValue: 'Generating...',
}),
SlashCommandNamedArgument.fromProps({
name: 'completed',
description: t`updated label/title for when generation completes`,
typeList: [ARGUMENT_TYPE.STRING],
defaultValue: 'Generated',
}),
SlashCommandNamedArgument.fromProps({
name: 'delay',
description: t`auto-hide delay in ms after generation completes. Use "infinite" or negative to keep until manually closed`,
typeList: [ARGUMENT_TYPE.NUMBER],
defaultValue: '3000',
enumList: [
new SlashCommandEnumValue('infinite', 'Keep the streaming display open until manually closed', 'command', '♾️'),
new SlashCommandEnumValue('any delay in seconds', null, 'number', '⌚', () => true, input => input),
],
}),
SlashCommandNamedArgument.fromProps({
name: 'stop',
description: t`show a stop button on the streaming display that aborts generation when clicked`,
typeList: [ARGUMENT_TYPE.BOOLEAN],
defaultValue: 'true',
enumProvider: commonEnumProviders.boolean('trueFalse'),
}),
SlashCommandNamedArgument.fromProps({
name: 'onStop',
description: t`closure to execute when the stop button is clicked (in addition to aborting the request)`,
typeList: [ARGUMENT_TYPE.CLOSURE],
}),
SlashCommandNamedArgument.fromProps({
name: 'onComplete',
description: t`closure to execute after generation completes successfully`,
typeList: [ARGUMENT_TYPE.CLOSURE],
}),
],
unnamedArgumentList: [
SlashCommandArgument.fromProps({
description: 'prompt',
typeList: [ARGUMENT_TYPE.STRING],
isRequired: true,
}),
],
helpString: `
<div>
${t`Generates text using Connection Manager with streaming display. Shows live generation progress including reasoning (thinking) and content.`}
</div>
<div>
${t`Requires Connection Manager extension. Uses the currently selected profile or the specified profile= argument.`}
</div>
<div>
${t`Use reasoning=true to include formatted reasoning in the output (using the defined reasoning template). This can be parsed later with /reasoning-parse.`}
</div>
<div>
${t`Use delay to control auto-hide behavior: number (ms), "infinite", or negative to keep the display open until manually closed. The display shows a green LED when complete.`}
</div>
<div>
${t`A stop button is shown by default (stop=true). Click it to abort generation and return whatever was streamed so far. Use stop=false to hide the stop button.`}
</div>
<div>
${t`Use onStop and onComplete closures for custom behavior when generation is stopped or completes.`}
</div>
<div>
${t`Example: <pre><code>/profile-genstream profile=my-profile-id reasoning=true Summarize the following text</code></pre>`}
</div>
<div>
${t`Example with infinite display: <pre><code>/profile-genstream delay=infinite Tell me a story</code></pre>`}
</div>
<div>
${t`Example with custom stop handler: <pre><code>/profile-genstream onStop={: /echo "Generation stopped!" :} Tell me a story</code></pre>`}
</div>
`,
}));
}
@@ -7,5 +7,8 @@
"css": "style.css",
"author": "Cohee1207",
"version": "1.0.0",
"homePage": "https://github.com/SillyTavern/SillyTavern"
"homePage": "https://github.com/SillyTavern/SillyTavern",
"hooks": {
"activate": "init"
}
}
+241 -34
View File
@@ -4,7 +4,7 @@ import { characters, eventSource, event_types, generateQuietPrompt, generateRaw,
import { dragElement, isMobile } from '../../RossAscends-mods.js';
import { getContext, getApiUrl, modules, extension_settings, ModuleWorkerWrapper, doExtrasFetch, renderExtensionTemplateAsync } from '../../extensions.js';
import { loadMovingUIState, performFuzzySearch, power_user } from '../../power-user.js';
import { onlyUnique, debounce, getCharaFilename, trimToEndSentence, trimToStartSentence, waitUntilCondition, findChar, isFalseBoolean } from '../../utils.js';
import { onlyUnique, debounce, getCharaFilename, trimToEndSentence, trimToStartSentence, waitUntilCondition, findChar, isFalseBoolean, includesIgnoreCaseAndAccents } from '../../utils.js';
import { hideMutedSprites, selected_group } from '../../group-chats.js';
import { isJsonSchemaSupported } from '../../textgen-settings.js';
import { debounce_timeout } from '../../constants.js';
@@ -18,6 +18,8 @@ import { generateWebLlmChatPrompt, isWebLlmSupported } from '../shared.js';
import { Popup, POPUP_RESULT } from '../../popup.js';
import { t } from '../../i18n.js';
import { removeReasoningFromString } from '../../reasoning.js';
import { macros } from '../../macros/macro-system.js';
import { MacrosParser } from '/scripts/macros.js';
export { MODULE_NAME };
/**
@@ -103,6 +105,19 @@ let lastServerResponseTime = 0;
/** @type {{[characterName: string]: string}} */
export let lastExpression = {};
/**
* Gets the current fallback expression, including the labels for when it is not set
* @returns {string|null}
*/
function getCurrentFallbackExpression() {
const expression = extension_settings?.expressions.fallback_expression;
const showEmojis = extension_settings?.expressions?.showDefault;
if (!expression && showEmojis) return OPTION_EMOJI_FALLBACK;
if (!expression) return OPTION_NO_FALLBACK;
return expression;
}
/**
* Returns a placeholder image object for a given expression
* @param {string} expression - The expression label
@@ -786,6 +801,67 @@ async function setSpriteSlashCommand({ type }, searchTerm) {
return label;
}
/**
* Get all the currently set expression labels.
* @param {Object} args
* @param {'true'|'false'|'only'} [args.custom] - Whether to filter out or return only custom expressions
* @param {'true'|'false'} [args.filter] - Filter the list to only include expressions that have available sprites for the current character
* @param {import('../../slash-commands/SlashCommandReturnHelper.js').SlashCommandReturnType} [args.return] - In which format must the expressions be returned
* @param {string} characterName
* @returns {Promise<string>}
*/
async function getExpressionListSlashCommand(args, characterName) {
const { custom, filter = 'true', return: returnType = 'pipe' } = args;
const expressions = await getExpressionsList({ filterAvailable: !isFalseBoolean(filter) });
const customExpressions = extension_settings?.expressions?.custom || [];
const expressionsMap = {
default: expressions.filter(expression => !customExpressions.includes(expression)),
custom: customExpressions,
all: expressions,
};
let expressionIndex = 'all';
if (custom === 'false') expressionIndex = 'default';
if (custom === 'only') expressionIndex = 'custom';
try {
return await slashCommandReturnHelper.doReturn(returnType, expressionsMap[expressionIndex], {
objectToStringFunc: list => list.join(', '),
});
} catch (err) {
console.error(err);
return '';
}
}
/**
* @param {string} expressionName - Label of the expression to set as fallback
*/
function setFallBackExpressionSlashCommand(args, expressionName) {
expressionName = expressionName.trim().toLowerCase();
if (!expressionName) return getCurrentFallbackExpression();
const select = /** @type {HTMLSelectElement} */(document.getElementById('expression_fallback'));
const fallbackExpressions = Array
.from(select?.options || [])
.map(option => option.value)
.filter(expression => expression?.length > 0);
const expressionMatch = fallbackExpressions.find(expression => includesIgnoreCaseAndAccents(expression, expressionName));
if (!expressionMatch) {
toastr.warning(t`No expression found for search term ${expressionName}`, t`Set Fallback Expression`);
return '';
}
$(select).val(expressionMatch).trigger('change');
return expressionMatch;
}
/**
* Returns the sprite folder name (including override) for a character.
* @param {object} char Character object
@@ -1125,15 +1201,24 @@ export async function getExpressionLabel(text, expressionsApi = extension_settin
}
}
function getLastCharacterMessage() {
/**
* @param {Object} [options]
* @param {string} [options.characterName] Filters last message to the one of the target character
*/
function getLastCharacterMessage({ characterName = '' } = {}) {
const context = getContext();
const reversedChat = context.chat.slice().reverse();
const ignoreCharName = !characterName;
for (let mes of reversedChat) {
if (mes.is_user || mes.is_system || mes.extra?.type === system_message_types.NARRATOR) {
continue;
}
if (!ignoreCharName && mes.name !== characterName) {
continue;
}
return { mes: mes.mes, name: mes.name, original_avatar: mes.original_avatar, force_avatar: mes.force_avatar };
}
@@ -1437,6 +1522,30 @@ export async function getExpressionsList({ filterAvailable = false } = {}) {
}
}
/**
* Gets the last expression used in the chat by the active character.
* @param {Object} [options]
* @param {string} [options.characterName] Filters last expression to the one of the target character instead
* @returns {string}
*/
function getLastExpression({ characterName = '' } = {}) {
if (typeof characterName !== 'string') throw new Error('Character name must be a string');
if (!characterName) {
characterName = characters[this_chid]?.avatar || '';
}
const char = findChar({ name: characterName, quiet: true });
const currentLastMessage = getLastCharacterMessage({ characterName });
const finalCharacterName = currentLastMessage?.name ?? char?.name ?? characterName;
const spriteFolderName = getSpriteFolderName(currentLastMessage, finalCharacterName);
const sprite = lastExpression[spriteFolderName.split('/')[0]] ?? '';
return sprite;
}
/**
* Selects a sprite from the given sprite folder for the given expression.
*
@@ -1608,8 +1717,10 @@ async function setExpression(spriteFolderName, expression, { force = false, over
* @param {string} expression - The expression label to use for the default image
*/
function setDefaultEmojiForImage(img, expression) {
if (extension_settings.expressions.custom?.includes(expression)) {
console.debug(`Can't set default emoji for a custom expression (${expression}). setting to ${DEFAULT_FALLBACK_EXPRESSION} instead.`);
// Classifiers can return a falsy, literal "null"/"undefined", or otherwise unknown label,
// and custom expressions have no default assets; only known labels have an image (#5863).
if (!DEFAULT_EXPRESSIONS.includes(expression)) {
console.debug(`Can't set default emoji for expression (${expression}). setting to ${DEFAULT_FALLBACK_EXPRESSION} instead.`);
expression = DEFAULT_FALLBACK_EXPRESSION;
}
@@ -2140,7 +2251,7 @@ function migrateSettings() {
}
}
(async function () {
export async function init() {
function addExpressionImage() {
const html = `
<div id="expression-wrapper">
@@ -2316,6 +2427,42 @@ function migrateSettings() {
helpString: 'Force sets the expression for the current character.',
returns: 'The currently set expression label after setting it.',
}));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'expression-fallback',
callback: setFallBackExpressionSlashCommand,
unnamedArgumentList: [
SlashCommandArgument.fromProps({
description: 'expression label to set',
typeList: [ARGUMENT_TYPE.STRING],
isRequired: false,
enumProvider: () => [
new SlashCommandEnumValue(OPTION_NO_FALLBACK, 'Sets the fallback expression to no image'),
new SlashCommandEnumValue(OPTION_EMOJI_FALLBACK, 'Sets the fallback expression to emojis'),
...localEnumProviders.expressions(),
],
}),
],
helpString: `
<div>
Gets the currently selected global fallback expression.<br />
If a valid expression label is sent, it will be set as the new fallback.
</div>
<div>
<strong>Example:</strong>
<ul>
<li>
<pre><code>/expression-fallback | /echo</code></pre>
<small>Returns the currently selected fallback.</small>
</li>
<li>
<pre><code>/expression-fallback admiration</code></pre>
<small>Sets a new expression as fallback.</small>
</li>
</ul>
</div>
`,
returns: 'The currently set expression label after setting it.',
}));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'expression-folder-override',
aliases: ['spriteoverride', 'costume'],
@@ -2348,23 +2495,8 @@ function migrateSettings() {
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'expression-last',
aliases: ['lastsprite'],
/** @type {(args: object, name: string) => Promise<string>} */
callback: async (_, name) => {
if (typeof name !== 'string') throw new Error('name must be a string');
if (!name) {
if (selected_group) {
toastr.error(t`In group chats, you must specify a character name.`, t`No character name specified`);
return '';
}
name = characters[this_chid]?.avatar;
}
const char = findChar({ name: name });
if (!char) toastr.warning(t`Couldn't find character ${name}.`, t`Character not found`);
const sprite = lastExpression[char?.name ?? name] ?? '';
return sprite;
},
/** @type {(args: object, name: string) => string} */
callback: (_, name) => getLastExpression({ characterName: (name || '') }),
returns: 'the last set expression for the named character.',
unnamedArgumentList: [
SlashCommandArgument.fromProps({
@@ -2378,23 +2510,14 @@ function migrateSettings() {
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'expression-list',
aliases: ['expressions'],
/** @type {(args: {return: string, filter: string}) => Promise<string>} */
callback: async (args) => {
let returnType =
/** @type {import('../../slash-commands/SlashCommandReturnHelper.js').SlashCommandReturnType} */
(args.return);
const list = await getExpressionsList({ filterAvailable: !isFalseBoolean(args.filter) });
return await slashCommandReturnHelper.doReturn(returnType ?? 'pipe', list, { objectToStringFunc: list => list.join(', ') });
},
callback: getExpressionListSlashCommand,
namedArgumentList: [
SlashCommandNamedArgument.fromProps({
name: 'return',
description: 'The way how you want the return value to be provided',
typeList: [ARGUMENT_TYPE.STRING],
defaultValue: 'pipe',
enumList: slashCommandReturnHelper.enumList({ allowObject: true }),
enumList: slashCommandReturnHelper.enumList({ allowObject: true, allowPopup: true }),
forceEnum: true,
}),
SlashCommandNamedArgument.fromProps({
@@ -2404,6 +2527,21 @@ function migrateSettings() {
enumList: commonEnumProviders.boolean('trueFalse')(),
defaultValue: 'true',
}),
SlashCommandNamedArgument.fromProps({
name: 'custom',
description: t`Whether to include, filter out or return only custom expressions`,
typeList: [
ARGUMENT_TYPE.STRING,
ARGUMENT_TYPE.BOOLEAN,
],
isRequired: false,
defaultValue: 'true',
enumList: [
new SlashCommandEnumValue('true', '(default) Custom expressions will be included in the result'),
new SlashCommandEnumValue('false', 'Custom expressions will not be included in the result'),
new SlashCommandEnumValue('only', 'Only custom expressions will be included in the result'),
],
}),
],
returns: 'The comma-separated list of available expressions, including custom expressions.',
helpString: 'Returns a list of available expressions, including custom expressions.',
@@ -2511,4 +2649,73 @@ function migrateSettings() {
</div>
`,
}));
})();
if (power_user.experimental_macro_engine) {
macros.register('defaultExpression', {
handler: getCurrentFallbackExpression,
category: macros.category.MISC,
description: 'Returns the global fallback expression.',
returns: 'Expression label',
exampleUsage: '{{defaultExpression}}',
});
macros.register('lastExpression', {
handler: function ({ args: [name = '{{char}}'], resolve }) {
try {
return getLastExpression({ characterName: resolve(name || '') });
} catch (error) {
console.error(error);
return '';
}
},
unnamedArgs: [{
name: 'name',
description: 'The name of the target character',
defaultValue: '{{char}}',
optional: true,
type: macros.valueType.STRING,
}],
delayArgResolution: true,
category: macros.category.MISC,
description: 'Returns the last expression used by the selected character. The currently active character is used if no character name is provided.',
returns: 'Expression label',
exampleUsage: [
'{{lastExpression}}',
'{{lastExpression::John}}',
'{{lastExpression::{{char}}}}',
],
});
macros.register('availableExpressions', {
handler: function () {
return getCachedExpressions().join(', ');
},
category: macros.category.MISC,
description: 'Returns a list with all the available expressions provided by the Classifier API.',
returns: 'Expression label list',
exampleUsage: '{{availableExpressions}}',
});
} else {
MacrosParser.registerMacro('defaultExpression',
getCurrentFallbackExpression,
t`Returns the global fallback expression.`,
);
MacrosParser.registerMacro('lastExpression',
() => {
try {
return getLastExpression();
} catch (error) {
console.error(error);
return '';
}
},
t`Returns the last expression used.`,
);
MacrosParser.registerMacro('availableExpressions',
() => getCachedExpressions().join(', '),
t`Returns a list with all the available expressions provided by the Classifier API.`,
);
}
}
@@ -9,5 +9,8 @@
"css": "style.css",
"author": "Cohee#1207",
"version": "1.0.0",
"homePage": "https://github.com/SillyTavern/SillyTavern"
"homePage": "https://github.com/SillyTavern/SillyTavern",
"hooks": {
"activate": "init"
}
}
+2 -2
View File
@@ -818,7 +818,7 @@ function addGalleryWandButton() {
}
// On extension load, ensure the settings are initialized
(function () {
export async function init() {
initSettings();
eventSource.on(event_types.CHARACTER_RENAMED, (oldAvatar, newAvatar) => {
const context = SillyTavern.getContext();
@@ -850,4 +850,4 @@ function addGalleryWandButton() {
}),
);
addGalleryWandButton();
})();
}
@@ -8,5 +8,8 @@
"css": "style.css",
"author": "City-Unit",
"version": "1.5.0",
"homePage": "https://github.com/SillyTavern/SillyTavern"
"homePage": "https://github.com/SillyTavern/SillyTavern",
"hooks": {
"activate": "init"
}
}
+2 -2
View File
@@ -1063,7 +1063,7 @@ function setupListeners() {
});
}
jQuery(async function () {
export async function init() {
async function addExtensionControls() {
const settingsHtml = await renderExtensionTemplateAsync('memory', 'settings', { defaultSettings });
$('#summarize_container').append(settingsHtml);
@@ -1128,4 +1128,4 @@ jQuery(async function () {
() => summaryMacroHandler(),
'Returns the latest memory/summary from the current chat.');
}
});
}
@@ -9,5 +9,8 @@
"css": "style.css",
"author": "Cohee#1207",
"version": "1.0.0",
"homePage": "https://github.com/SillyTavern/SillyTavern"
"homePage": "https://github.com/SillyTavern/SillyTavern",
"hooks": {
"activate": "init"
}
}

Some files were not shown because too many files have changed in this diff Show More