Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad29cbda62 | ||
|
|
bc81b9f7e3 | ||
|
|
8901f28b01 | ||
|
|
9758a6cd5e | ||
|
|
ca7330f1af | ||
|
|
a1c7f19bac | ||
|
|
e9860754ad | ||
|
|
7c39941963 | ||
|
|
06bde939fb | ||
|
|
7e8663cd9c | ||
|
|
61139aa9b6 | ||
|
|
5e8d463ed4 | ||
|
|
c0a417b240 | ||
|
|
cc053e8356 | ||
|
|
d6b244cd25 | ||
|
|
e7c4f8ee98 | ||
|
|
a8f7e0d900 | ||
|
|
4613abc26e | ||
|
|
dd326d244f | ||
|
|
ccd8287833 | ||
|
|
30eaf26a43 | ||
|
|
98af17a8a4 | ||
|
|
0a9ba91852 | ||
|
|
814734d4af | ||
|
|
8992872765 | ||
|
|
558d72dde2 | ||
|
|
4ad7af3c06 | ||
|
|
bcc42de2e9 | ||
|
|
b4e162324b | ||
|
|
2c61f3be1e | ||
|
|
48e7d605df | ||
|
|
12b4fc50aa | ||
|
|
742d5601be | ||
|
|
4ed1372411 | ||
|
|
86b55c8696 | ||
|
|
1a7f88861d | ||
|
|
800caeb9e0 | ||
|
|
f91050136c | ||
|
|
f199580102 | ||
|
|
eaf2858e43 | ||
|
|
1cfdcd82e1 | ||
|
|
7228502f0b | ||
|
|
4f6977b779 | ||
|
|
6fea520309 | ||
|
|
aca0684c0b | ||
|
|
54aedc8797 | ||
|
|
b5cc683074 | ||
|
|
cd2c65c9d4 | ||
|
|
ed563cb7d8 | ||
|
|
32e1966757 | ||
|
|
380e31e8c5 | ||
|
|
46bd341ec1 | ||
|
|
aaf12b4925 | ||
|
|
c4672e953e | ||
|
|
4259eb7220 | ||
|
|
0168803f41 | ||
|
|
2463e83966 | ||
|
|
0a1a746bfd | ||
|
|
902bd10382 | ||
|
|
29ed34939c | ||
|
|
37943ea4b1 | ||
|
|
29e0df4886 | ||
|
|
6b49e9e7d0 | ||
|
|
bba96c6fbe | ||
|
|
8172dcd0ee | ||
|
|
10ae84fb62 | ||
|
|
bf6f0b0c46 | ||
|
|
3594fe224a | ||
|
|
1ca70787f9 | ||
|
|
691f0ce604 | ||
|
|
fe048f6bdc | ||
|
|
93bd9e217e | ||
|
|
fd582be5ca | ||
|
|
3a453d4cfa | ||
|
|
40ca51f4f1 | ||
|
|
060f224f28 | ||
|
|
aec9754b31 | ||
|
|
9f8c3e156a | ||
|
|
355598bb30 | ||
|
|
45d166ff6a | ||
|
|
69cf5571ba | ||
|
|
81be2c51a2 | ||
|
|
a900958bef | ||
|
|
56061f793c | ||
|
|
77ba2c21a5 | ||
|
|
597517730b | ||
|
|
44af6bc169 | ||
|
|
3913dfffb9 | ||
|
|
d08bbb1096 | ||
|
|
b1f5c29921 | ||
|
|
bfff81bbf9 | ||
|
|
d5b6b7924b | ||
|
|
e0c1dbad8f | ||
|
|
37b3e9e461 | ||
|
|
29a18ce0c6 | ||
|
|
51ad27fb86 | ||
|
|
982dfec022 | ||
|
|
95ca4315bd | ||
|
|
97392a4ca0 | ||
|
|
e5ae782705 | ||
|
|
9d61bbc3ed | ||
|
|
3eb3861596 | ||
|
|
c325c6d8e9 | ||
|
|
91c40280ed | ||
|
|
b2fa6a0afb | ||
|
|
4ca9863f38 | ||
|
|
3a9c10d680 | ||
|
|
338e35fc8a | ||
|
|
5512473b29 | ||
|
|
45f2951854 | ||
|
|
44f433d10b | ||
|
|
08e1ce8ec5 | ||
|
|
aa50edcf45 | ||
|
|
2e4ca3dabf | ||
|
|
bd9479fef8 | ||
|
|
940b3722cf | ||
|
|
338119ab77 | ||
|
|
1bb2a5ea19 | ||
|
|
7201d87f2e | ||
|
|
d327412e29 | ||
|
|
97dba399e4 | ||
|
|
25fb4ceb50 | ||
|
|
c249e5384c | ||
|
|
09d72828cb | ||
|
|
09bb7622ed | ||
|
|
7948886c1d | ||
|
|
0a493cad89 | ||
|
|
29e3136473 | ||
|
|
b1ef254f78 | ||
|
|
77cbcd8774 | ||
|
|
aecbb9a2ee | ||
|
|
a028bec87b | ||
|
|
752ae243b9 | ||
|
|
efbff34342 | ||
|
|
6d2165149b | ||
|
|
ff31ca6692 | ||
|
|
4df18ccb0b | ||
|
|
e5d4ff5fae | ||
|
|
8aeda4a101 | ||
|
|
15a3e3f072 | ||
|
|
53f251c52a | ||
|
|
d8b3d36a84 | ||
|
|
b8f2b1cfa6 | ||
|
|
b44b12b527 | ||
|
|
d720605be8 | ||
|
|
b436971a09 | ||
|
|
a678299700 | ||
|
|
552936a0d8 | ||
|
|
d1e719eb48 | ||
|
|
4003251c2f | ||
|
|
767746beb2 | ||
|
|
277285d30c | ||
|
|
0ac31c8fcd | ||
|
|
3f72d3df80 | ||
|
|
051346c517 | ||
|
|
af7bd65f42 | ||
|
|
78628f7dbb | ||
|
|
64c96e895c | ||
|
|
4d67a6986b | ||
|
|
d72f4b6fcb | ||
|
|
737cb95adb | ||
|
|
1a561f3bb0 | ||
|
|
f4f390f325 | ||
|
|
6a325d2b22 | ||
|
|
a7f144f28b | ||
|
|
7d3d1231a9 | ||
|
|
24379db88d | ||
|
|
ff10249ab5 | ||
|
|
64e8c8d964 | ||
|
|
f3521e7007 | ||
|
|
fb915b4321 | ||
|
|
fa9a28c6f3 | ||
|
|
ff4c6fa1bb | ||
|
|
81c85f8049 | ||
|
|
67eba1b472 | ||
|
|
df27574247 | ||
|
|
a9c377c3c8 | ||
|
|
94a5773412 | ||
|
|
5e68410d4e | ||
|
|
5ec635aa40 | ||
|
|
700fc05411 | ||
|
|
c9c652eece | ||
|
|
d96d1451ab | ||
|
|
a45ec30cf0 | ||
|
|
8d8e3833f6 | ||
|
|
760263b78a | ||
|
|
128888f605 | ||
|
|
8e8f501279 | ||
|
|
9e0ecefd64 | ||
|
|
0f4a0147fd | ||
|
|
21e8cf9060 | ||
|
|
e2d8c0200f | ||
|
|
04ef0632ee | ||
|
|
d2b2b1b4a6 | ||
|
|
a8021ee6e1 | ||
|
|
63feac9423 | ||
|
|
c918f4f36d | ||
|
|
b89293418d | ||
|
|
ff1ca1412a | ||
|
|
6bd766f857 | ||
|
|
004f1336e6 | ||
|
|
b4c721d7bc |
@@ -70,6 +70,7 @@ module.exports = {
|
||||
'**/dist/**',
|
||||
'**/.git/**',
|
||||
'public/lib/**',
|
||||
'public/scripts/extensions/third-party/**',
|
||||
'backups/**',
|
||||
'data/**',
|
||||
'cache/**',
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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ガイド
|
||||
|
||||
@@ -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) 提供
|
||||
|
||||
@@ -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) 編寫
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -34,6 +34,7 @@ whitelist.txt
|
||||
.vscode/**
|
||||
!.vscode/extensions.json
|
||||
.idea/
|
||||
.windsurf/
|
||||
secrets.json
|
||||
/dist
|
||||
/backups/
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"js/ts.tsdk.promptToUseWorkspaceVersion": true,
|
||||
"js/ts.tsdk.path": "./node_modules/typescript/lib"
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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": "",
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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`);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,6 +500,11 @@
|
||||
.horde_multiple_hint {
|
||||
display: none;
|
||||
}
|
||||
|
||||
select[multiple] {
|
||||
max-height: 50px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/*landscape mode phones and ipads*/
|
||||
|
||||
@@ -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: '';
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
.welcomePanel.recentHidden .welcomeRecent,
|
||||
.welcomePanel.recentHidden .recentChatsTitle,
|
||||
.welcomePanel.recentHidden .hideRecentChats,
|
||||
.welcomePanel.recentHidden .recentChatsSettings,
|
||||
.welcomePanel:not(.recentHidden) .showRecentChats {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -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 |
@@ -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 |
@@ -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 |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 2.5 KiB |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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="—" 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="—" 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="—" 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. 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). 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. 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>
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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": "❌المفتاح مفقود",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 :",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": "❌ キーがありません",
|
||||
|
||||
@@ -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": "❌ 현재 저장된 키가 존재하지 않습니다.",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": "Записи могут активировать другие записи, если в них содержатся ключевые слова",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": "❌ Відсутній ключ",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": "密钥已保存",
|
||||
|
||||
@@ -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": "❌ 鑰匙遺失",
|
||||
|
||||
@@ -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(/&/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();
|
||||
});
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
) {
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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';
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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`;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 = '');
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
});
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||