Remove Scale Spellbook from CC sources (#4293)

d641cbecc4ffeff3f0f76137dbc72647c117cec4

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
29 files changed, +7 -400Ignore whitespace
.github/readme-ja_jp.md+1 -1
@@ -16,7 +16,7 @@
1616
1717---
1818
1919モバイルデバイスにも適したレイアウト・マルチAPI(KoboldAI/CPP、Horde、NovelAI、Ooba、OpenAI、OpenRouter、Claude、Scale)、VN ライクな Waifu モード、Stable Diffusion、TTS、WorldInfo(伝承本)、カスタマイズ可能なUI、自動翻訳、大量のプロンプトオプション+サードパーティの拡張機能をインストールする機能
2020
2121[TavernAI](https://github.com/TavernAI/TavernAI) v.1.2.8 のフォークに基づいています。
2222
.github/readme-ru_ru.md+1 -1
@@ -18,7 +18,7 @@
1818
1919---
2020
2121Мобайл-френдли интерфейс, поддержка множества API (KoboldAI/CPP, Horde, NovelAI, Ooba, OpenAI, OpenRouter, Claude, Scale), ВН-образный режим Вайфу, Stable Diffusion, TTS, поддержка миров (лорбуков), кастомизируемый UI, автоперевод, тончайшая настройка промптов + возможность устанавливать расширения.
2222
2323Основано на форке [TavernAI](https://github.com/TavernAI/TavernAI) версии 1.2.8
2424
default/content/presets/openai/Default.json+0 -2
@@ -225,12 +225,10 @@
225225 ]
226226 }
227227 ],
228- "api_url_scale": "",
229228 "show_external_models": false,
230229 "assistant_prefill": "",
231230 "assistant_impersonation": "",
232231 "claude_use_sysprompt": false,
233- "use_alt_scale": false,
234232 "squash_system_messages": false,
235233 "image_inlining": false,
236234 "bypass_status_check": false,
public/index.html+3 -34
@@ -691,7 +691,7 @@
691691 </span>
692692 </div>
693693 </div>
694694 <div class="range-block" data-source="openai,claude,aimlapi,openrouter,ai21,scale,makersuite,vertexai,mistralai,custom,cohere,perplexity,groq,01ai,nanogpt,deepseek,xai,pollinations">
695695 <div class="range-block-title" data-i18n="Temperature">
696696 Temperature
697697 </div>
@@ -743,7 +743,7 @@
743743 </div>
744744 </div>
745745 </div>
746746 <div class="range-block" data-source="openai,claude,aimlapi,openrouter,ai21,scale,makersuite,vertexai,mistralai,custom,cohere,perplexity,groq,01ai,nanogpt,deepseek,xai,pollinations">
747747 <div class="range-block-title" data-i18n="Top P">
748748 Top P
749749 </div>
@@ -2132,7 +2132,7 @@
21322132 </div>
21332133 </div>
21342134 </div>
21352135 <div class="range-block m-t-1" data-source="openai,aimlapi,openrouter,scale,custom">
21362136 <div id="logit_bias_openai" class="range-block-title openai_restorable" data-i18n="Logit Bias">
21372137 Logit Bias
21382138 </div>
@@ -2802,7 +2802,6 @@
28022802 <option value="openrouter">OpenRouter</option>
28032803 <option value="perplexity">Perplexity</option>
28042804 <option value="pollinations">Pollinations</option>
2805- <option value="scale">Scale</option>
28062805 <option value="xai">xAI (Grok)</option>
28072806 </optgroup>
28082807 </select>
@@ -3099,36 +3098,6 @@
30993098 <span data-i18n="To use instruct formatting, switch to OpenRouter under Text Completion API.">To use instruct formatting, switch to OpenRouter under Text Completion API.</span>
31003099 </small>
31013100 </form>
3102- <form id="scale_form" data-source="scale" action="javascript:void(null);" method="post" enctype="multipart/form-data">
3103- <div id="normal_scale_form">
3104- <h4 data-i18n="Scale API Key">Scale API Key</h4>
3105- <div class="flex-container">
3106- <input id="api_key_scale" name="api_key_scale" class="text_pole flex1" value="" autocomplete="off">
3107- <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_scale"></div>
3108- </div>
3109- <div data-for="api_key_scale" class="neutral_warning" data-i18n="For privacy reasons, your API key will be hidden after you click 'Connect'.">
3110- For privacy reasons, your API key will be hidden after you click 'Connect'.
3111- </div>
3112- <h4>Scale API URL</h4>
3113- <input id="api_url_scale" name="api_url_scale" class="text_pole" value="" autocomplete="off" placeholder="https://dashboard.scale.com/spellbook/api/v2/deploy/xxxxxxx">
3114- </div>
3115- <div id="alt_scale_form">
3116- <h4>Scale Cookie (_jwt)</h4>
3117- <div class="flex-container">
3118- <input id="scale_cookie" name="scale_cookie" class="text_pole flex1" value="" autocomplete="off">
3119- <div title="Clear your cookie" data-i18n="[title]Clear your cookie" class="menu_button fa-solid fa-key fa-fw manage-api-keys" data-key="scale_cookie"></div>
3120- </div>
3121- <div data-for="scale_cookie" class="neutral_warning">
3122- For privacy reasons, your cookie will be hidden after you click 'Connect'.
3123- </div>
3124- </div>
3125- <!-- Its only purpose is to trigger max context size check -->
3126- <select id="model_scale_select" class="displayNone"></select>
3127- <label for="scale-alt" class="checkbox_label">
3128- <input id="scale-alt" type="checkbox" checked>
3129- <span data-i18n="Alt Method">Alt Method</span>
3130- </label>
3131- </form>
31323101 <form id="ai21_form" data-source="ai21" action="javascript:void(null);" method="post" enctype="multipart/form-data">
31333102 <h4 data-i18n="AI21 API Key">AI21 API Key</h4>
31343103 <div class="flex-container">
public/locales/ar-sa.json+0 -3
@@ -375,9 +375,6 @@
375375 "Group by vendors Description": "ضع نماذج OpenAI في مجموعة واحدة، والنماذج الإنسانية في مجموعة أخرى، وما إلى ذلك. ويمكن دمجها مع الفرز.",
376376 "Allow fallback routes": "السماح بمسارات الاحتياط",
377377 "Allow fallback routes Description": "يختار النموذج البديل تلقائيًا إذا كان النموذج المحدد غير قادر على تلبية طلبك.",
378- "Scale API Key": "مفتاح API لـ Scale",
379- "Clear your cookie": "امسح ملف تعريف الارتباط الخاص بك",
380- "Alt Method": "طريقة بديلة",
381378 "AI21 API Key": "مفتاح API لـ AI21",
382379 "AI21 Model": "نموذج AI21",
383380 "Google AI Studio API Key": "مفتاح واجهة برمجة تطبيقات Google AI Studio",
public/locales/de-de.json+0 -3
@@ -375,9 +375,6 @@
375375 "Group by vendors Description": "Platzieren Sie OpenAI-Modelle in einer Gruppe, anthropogene Modelle in einer anderen Gruppe usw. Kann mit Sortierung kombiniert werden.",
376376 "Allow fallback routes": "Fallback-Routen zulassen",
377377 "Allow fallback routes Description": "Das alternative Modell wird automatisch ausgewählt, wenn das ausgewählte Modell Ihre Anfrage nicht erfüllen kann.",
378- "Scale API Key": "Scale API-Schlüssel",
379- "Clear your cookie": "Löschen Sie Ihre Cookies",
380- "Alt Method": "Alternative Methode",
381378 "AI21 API Key": "AI21 API-Schlüssel",
382379 "AI21 Model": "AI21-Modell",
383380 "Google AI Studio API Key": "Google AI Studio API-Schlüssel",
public/locales/es-es.json+0 -3
@@ -375,9 +375,6 @@
375375 "Group by vendors Description": "Coloque los modelos OpenAI en un grupo, los modelos antrópicos en otro grupo, etc. Se puede combinar con la clasificación.",
376376 "Allow fallback routes": "Permitir rutas de respaldo",
377377 "Allow fallback routes Description": "El modelo alternativo se elige automáticamente si el modelo seleccionado no puede cumplir con tu solicitud.",
378- "Scale API Key": "Clave API de Scale",
379- "Clear your cookie": "Limpia tu cookie",
380- "Alt Method": "Método alternativo",
381378 "AI21 API Key": "Clave API de AI21",
382379 "AI21 Model": "Modelo de AI21",
383380 "Google AI Studio API Key": "Clave API de Google AI Studio",
public/locales/fr-fr.json+0 -3
@@ -355,9 +355,6 @@
355355 "Group by vendors": "Regrouper par fournisseurs",
356356 "Group by vendors Description": "Placez les modèles OpenAI dans un groupe, les modèles Anthropic dans un autre groupe, etc. Peut être combiné avec le tri.",
357357 "Allow fallback routes Description": "Le modèle alternatif est automatiquement sélectionné si le modèle choisi ne peut pas répondre à votre demande.",
358- "Scale API Key": "Clé API Scale",
359- "Clear your cookie": "Effacer vos cookies",
360- "Alt Method": "Méthode alternative",
361358 "AI21 API Key": "Clé API AI21",
362359 "AI21 Model": "Modèle AI21",
363360 "Google AI Studio API Key": "Clé API Google AI Studio",
public/locales/is-is.json+0 -3
@@ -375,9 +375,6 @@
375375 "Group by vendors Description": "Setjið OpenAI módel í einn hóp, Anthropic módel í annan hóp osfrv. Hægt að sameina við flokkun.",
376376 "Allow fallback routes": "Leyfa bakfallssvæði",
377377 "Allow fallback routes Description": "Veldur hlutleysa vélbúnaðarinn við val þinn ef valið módel getur ekki uppfyllt beiðni þína.",
378- "Scale API Key": "Lykill API fyrir Scale",
379- "Clear your cookie": "Hreinsaðu kökuna þína",
380- "Alt Method": "Aðferð Bakmenn",
381378 "AI21 API Key": "Lykill API fyrir AI21",
382379 "AI21 Model": "AI21 Módel",
383380 "Google AI Studio API Key": "Google AI Studio API lykill",
public/locales/it-it.json+0 -3
@@ -375,9 +375,6 @@
375375 "Group by vendors Description": "Metti i modelli OpenAI in un gruppo, i modelli antropici in un altro gruppo, ecc. Può essere combinato con l'ordinamento.",
376376 "Allow fallback routes": "Consenti percorsi alternativi",
377377 "Allow fallback routes Description": "Il modello alternativo viene automaticamente scelto se il modello selezionato non può soddisfare la tua richiesta.",
378- "Scale API Key": "Chiave API di Scale",
379- "Clear your cookie": "Cancella il tuo cookie",
380- "Alt Method": "Metodo alternativo",
381378 "AI21 API Key": "Chiave API di AI21",
382379 "AI21 Model": "Modello AI21",
383380 "Google AI Studio API Key": "Chiave API Google AI Studio",
public/locales/ja-jp.json+0 -3
@@ -375,9 +375,6 @@
375375 "Group by vendors Description": "OpenAI モデルを 1 つのグループに、Anthropic モデルを別のグループに配置するなどします。ソートと組み合わせることができます。",
376376 "Allow fallback routes": "フォールバックルートを許可",
377377 "Allow fallback routes Description": "選択したモデルが要求を満たせない場合、代替モデルが自動的に選択されます。",
378- "Scale API Key": "ScaleのAPIキー",
379- "Clear your cookie": "クッキーを消去する",
380- "Alt Method": "代替手法",
381378 "AI21 API Key": "AI21のAPIキー",
382379 "AI21 Model": "AI21モデル",
383380 "Google AI Studio API Key": "Google AI Studio APIキー",
public/locales/ko-kr.json+0 -3
@@ -384,9 +384,6 @@
384384 "LEGACY": "유산",
385385 "Force Instruct Mode formatting": "강제 지시 모드 형식",
386386 "Force_Instruct_Mode_formatting_Description": "Instruct Mode와 이 모드가 모두 활성화된 경우 프롬프트는 SillyTavern에 의해 현재 형식을 사용하여 형식화됩니다.\n 고급 형식 설정(시스템 프롬프트 지시 제외) 비활성화된 경우 프롬프트는 OpenRouter에 의해 형식화됩니다.",
387- "Scale API Key": "Scale API 키",
388- "Clear your cookie": "쿠키 지우기",
389- "Alt Method": "대체 방법",
390387 "AI21 API Key": "AI21 API 키",
391388 "AI21 Model": "AI21 모델",
392389 "Google AI Studio API Key": "Google AI Studio API 키",
public/locales/nl-nl.json+0 -3
@@ -375,9 +375,6 @@
375375 "Group by vendors Description": "Plaats OpenAI-modellen in één groep, antropische modellen in een andere groep, enz. Kan worden gecombineerd met sorteren.",
376376 "Allow fallback routes": "Fallback-routes toestaan",
377377 "Allow fallback routes Description": "Het alternatieve model wordt automatisch gekozen als het geselecteerde model niet aan uw verzoek kan voldoen.",
378- "Scale API Key": "Scale API-sleutel",
379- "Clear your cookie": "Wis uw cookie",
380- "Alt Method": "Alternatieve methode",
381378 "AI21 API Key": "AI21 API-sleutel",
382379 "AI21 Model": "AI21-model",
383380 "MakerSuite API Key": "MakerSuite API-sleutel",
public/locales/pt-pt.json+0 -3
@@ -375,9 +375,6 @@
375375 "Group by vendors Description": "Coloque os modelos OpenAI em um grupo, os modelos antrópicos em outro grupo, etc.",
376376 "Allow fallback routes": "Permitir rotas de fallback",
377377 "Allow fallback routes Description": "O modelo alternativo será escolhido automaticamente se o modelo selecionado não puder atender à sua solicitação.",
378- "Scale API Key": "Chave da API Scale",
379- "Clear your cookie": "Limpe seu cookie",
380- "Alt Method": "Método Alternativo",
381378 "AI21 API Key": "Chave da API AI21",
382379 "AI21 Model": "Modelo AI21",
383380 "Google AI Studio API Key": "Chave API Google AI Studio",
public/locales/ru-ru.json+0 -3
@@ -142,8 +142,6 @@
142142 "Get your key from": "Получите ключ в",
143143 "Anthropic's developer console": "консоли разработчика Anthropic",
144144 "Claude Model": "Модель Claude",
145- "Scale API Key": "Ключ от Scale API",
146- "Alt Method": "Альтернативный метод",
147145 "AI21 API Key": "Ключ от API AI21",
148146 "AI21 Model": "Модель AI21",
149147 "View API Usage Metrics": "Посмотреть статистику использования API",
@@ -1255,7 +1253,6 @@
12551253 "vLLM Model": "Модель vLLM",
12561254 "Aphrodite Model": "Модель Aphrodite",
12571255 "Peek a password": "Посмотреть пароль",
1258- "Clear your cookie": "Clear your cookie",
12591256 "Add Chat Start and Example Separator to a list of stopping strings.": "Использовать Начало чата и Разделитель примеров сообщений в качестве стоп-строк.",
12601257 "Context Order": "Context Order",
12611258 "Summary": "Summary",
public/locales/uk-ua.json+0 -3
@@ -375,9 +375,6 @@
375375 "Group by vendors Description": "Помістіть моделі OpenAI в одну групу, моделі Anthropic в іншу групу тощо. Можна поєднати з сортуванням.",
376376 "Allow fallback routes": "Дозволити резервні маршрути",
377377 "Allow fallback routes Description": "Автоматично вибирає альтернативну модель, якщо вибрана модель не може задовольнити ваш запит.",
378- "Scale API Key": "Ключ API для Scale",
379- "Clear your cookie": "Очистіть файл cookie",
380- "Alt Method": "Альтернативний метод",
381378 "AI21 API Key": "Ключ API для AI21",
382379 "AI21 Model": "Модель AI21",
383380 "Google AI Studio API Key": "Ключ API Google AI Studio",
public/locales/vi-vn.json+0 -3
@@ -375,9 +375,6 @@
375375 "Group by vendors Description": "Xếp các mô hình OpenAI vào một nhóm, các mô hình Anthropic vào một nhóm khác, v.v. Có thể kết hợp với việc sắp xếp.",
376376 "Allow fallback routes": "Cho phép các tuyến đường phụ",
377377 "Allow fallback routes Description": "Bot thay thế tự động nếu mô hình được chọn không thể đáp ứng yêu cầu của bạn.",
378- "Scale API Key": "Scale API Key",
379- "Clear your cookie": "Xóa cookie",
380- "Alt Method": "Phương pháp thay thế",
381378 "AI21 API Key": "AI21 API Key",
382379 "AI21 Model": "Model của AI21",
383380 "Google AI Studio API Key": "Google AI Studio API Key",
public/locales/zh-cn.json+0 -3
@@ -429,9 +429,6 @@
429429 "Group by vendors": "按厂商分组",
430430 "Group by vendors Description": "将 OpenAI 模型放在一组,将 Anthropic 模型放在另一组,等等。可以与排序结合。",
431431 "To use instruct formatting, switch to OpenRouter under Text Completion API.": "To use instruct formatting, switch to OpenRouter under Text Completion API.",
432- "Scale API Key": "Scale API密钥",
433- "Clear your cookie": "清除你的 Cookie",
434- "Alt Method": "备用方法",
435432 "AI21 API Key": "AI21 API 密钥",
436433 "AI21 Model": "AI21 模型",
437434 "Google AI Studio API Key": "Google AI Studio API 密钥",
public/locales/zh-tw.json+0 -3
@@ -376,9 +376,6 @@
376376 "Group by vendors Description": "將 OpenAI、Anthropic 等模型放各自供應商的群組中。可以與排序功能結合使用。",
377377 "Allow fallback routes": "允許備援路徑",
378378 "Allow fallback routes Description": "如果選擇的模型無法滿足要求,會自動選擇替代模型。",
379- "Scale API Key": "Scale API 金鑰",
380- "Clear your cookie": "清除您的 Cookie",
381- "Alt Method": "替代方法",
382379 "AI21 API Key": "AI21 API 金鑰",
383380 "AI21 Model": "AI21 模型",
384381 "Google AI Studio API Key": "Google AI Studio API 金鑰",
public/script.js+0 -2
@@ -2689,11 +2689,9 @@ export function parseMesExamples(examplesStr, isInstruct) {
26892689}
26902690
26912691export function isStreamingEnabled() {
2692- const noStreamSources = [chat_completion_sources.SCALE];
26932692 return (
26942693 (main_api == 'openai' &&
26952694 oai_settings.stream_openai &&
2696- !noStreamSources.includes(oai_settings.chat_completion_source) &&
26972695 !(oai_settings.chat_completion_source == chat_completion_sources.OPENAI && ['o1-2024-12-17', 'o1'].includes(oai_settings.openai_model))
26982696 )
26992697 || (main_api == 'kobold' && kai_settings.streaming_kobold && kai_flags.can_use_streaming)
public/scripts/RossAscends-mods.js+0 -1
@@ -397,7 +397,6 @@ function RA_autoconnect(PrevApi) {
397397 case 'openai':
398398 if (((secret_state[SECRET_KEYS.OPENAI] || oai_settings.reverse_proxy) && oai_settings.chat_completion_source == chat_completion_sources.OPENAI)
399399 || ((secret_state[SECRET_KEYS.CLAUDE] || oai_settings.reverse_proxy) && oai_settings.chat_completion_source == chat_completion_sources.CLAUDE)
400- || ((secret_state[SECRET_KEYS.SCALE] || secret_state[SECRET_KEYS.SCALE_COOKIE]) && oai_settings.chat_completion_source == chat_completion_sources.SCALE)
401400 || (secret_state[SECRET_KEYS.OPENROUTER] && oai_settings.chat_completion_source == chat_completion_sources.OPENROUTER)
402401 || (secret_state[SECRET_KEYS.AI21] && oai_settings.chat_completion_source == chat_completion_sources.AI21)
403402 || (secret_state[SECRET_KEYS.MAKERSUITE] && oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE)
public/scripts/openai.js+2 -142
@@ -15,14 +15,12 @@ import {
1515 Generate,
1616 getExtensionPrompt,
1717 getExtensionPromptMaxDepth,
18- getNextMessageId,
1918 getRequestHeaders,
2019 getStoppingStrings,
2120 is_send_press,
2221 main_api,
2322 name1,
2423 name2,
25- replaceItemizedPromptText,
2624 resultCheckStatus,
2725 saveSettingsDebounced,
2826 setOnlineStatus,
@@ -129,7 +127,6 @@ const max_200k = 200 * 1000;
129127const max_256k = 256 * 1000;
130128const max_1mil = 1000 * 1000;
131129const max_2mil = 2000 * 1000;
132-const scale_max = 8191;
133130const claude_max = 9000; // We have a proper tokenizer, so theoretically could be larger (up to 9k)
134131const claude_100k_max = 99000;
135132const unlocked_max = max_2mil;
@@ -172,7 +169,6 @@ export let model_list = [];
172169export const chat_completion_sources = {
173170 OPENAI: 'openai',
174171 CLAUDE: 'claude',
175- SCALE: 'scale',
176172 OPENROUTER: 'openrouter',
177173 AI21: 'ai21',
178174 MAKERSUITE: 'makersuite',
@@ -305,7 +301,6 @@ export const settingsToUpdate = {
305301 stream_openai: ['#stream_toggle', 'stream_openai', true, false],
306302 prompts: ['', 'prompts', false, false],
307303 prompt_order: ['', 'prompt_order', false, false],
308- api_url_scale: ['#api_url_scale', 'api_url_scale', false, true],
309304 show_external_models: ['#openai_show_external_models', 'show_external_models', true, true],
310305 proxy_password: ['#openai_proxy_password', 'proxy_password', false, true],
311306 assistant_prefill: ['#claude_assistant_prefill', 'assistant_prefill', false, false],
@@ -315,7 +310,6 @@ export const settingsToUpdate = {
315310 vertexai_auth_mode: ['#vertexai_auth_mode', 'vertexai_auth_mode', false, true],
316311 vertexai_region: ['#vertexai_region', 'vertexai_region', false, true],
317312 vertexai_express_project_id: ['#vertexai_express_project_id', 'vertexai_express_project_id', false, true],
318- use_alt_scale: ['#use_alt_scale', 'use_alt_scale', true, true],
319313 squash_system_messages: ['#squash_system_messages', 'squash_system_messages', true, false],
320314 image_inlining: ['#openai_image_inlining', 'image_inlining', true, false],
321315 inline_image_quality: ['#openai_inline_image_quality', 'inline_image_quality', false, false],
@@ -391,7 +385,6 @@ const default_settings = {
391385 reverse_proxy: '',
392386 chat_completion_source: chat_completion_sources.OPENAI,
393387 max_context_unlocked: false,
394- api_url_scale: '',
395388 show_external_models: false,
396389 proxy_password: '',
397390 assistant_prefill: '',
@@ -401,7 +394,6 @@ const default_settings = {
401394 vertexai_auth_mode: 'express',
402395 vertexai_region: 'us-central1',
403396 vertexai_express_project_id: '',
404- use_alt_scale: false,
405397 squash_system_messages: false,
406398 image_inlining: false,
407399 inline_image_quality: 'low',
@@ -480,7 +472,6 @@ const oai_settings = {
480472 reverse_proxy: '',
481473 chat_completion_source: chat_completion_sources.OPENAI,
482474 max_context_unlocked: false,
483- api_url_scale: '',
484475 show_external_models: false,
485476 proxy_password: '',
486477 assistant_prefill: '',
@@ -490,7 +481,6 @@ const oai_settings = {
490481 vertexai_auth_mode: 'express',
491482 vertexai_region: 'us-central1',
492483 vertexai_express_project_id: '',
493- use_alt_scale: false,
494484 squash_system_messages: false,
495485 image_inlining: false,
496486 inline_image_quality: 'low',
@@ -1599,8 +1589,6 @@ export function getChatCompletionModel(source = null) {
15991589 return oai_settings.claude_model;
16001590 case chat_completion_sources.OPENAI:
16011591 return oai_settings.openai_model;
1602- case chat_completion_sources.SCALE:
1603- return '';
16041592 case chat_completion_sources.MAKERSUITE:
16051593 return oai_settings.google_model;
16061594 case chat_completion_sources.VERTEXAI:
@@ -2007,54 +1995,6 @@ function getAimlapiModelTemplate(option) {
20071995 `));
20081996}
20091997
2010-async function sendAltScaleRequest(messages, logit_bias, signal, type) {
2011- const generate_url = '/api/backends/scale-alt/generate';
2012-
2013- let firstSysMsgs = [];
2014- for (let msg of messages) {
2015- if (msg.role === 'system') {
2016- firstSysMsgs.push(substituteParams(msg.name ? msg.name + ': ' + msg.content : msg.content));
2017- } else {
2018- break;
2019- }
2020- }
2021-
2022- let subsequentMsgs = messages.slice(firstSysMsgs.length);
2023-
2024- const joinedSysMsgs = substituteParams(firstSysMsgs.join('\n'));
2025- const joinedSubsequentMsgs = subsequentMsgs.reduce((acc, obj) => {
2026- return acc + obj.role + ': ' + obj.content + '\n';
2027- }, '');
2028-
2029- messages = substituteParams(joinedSubsequentMsgs);
2030- const messageId = getNextMessageId(type);
2031- replaceItemizedPromptText(messageId, messages);
2032-
2033- const generate_data = {
2034- sysprompt: joinedSysMsgs,
2035- prompt: messages,
2036- temp: Number(oai_settings.temp_openai),
2037- top_p: Number(oai_settings.top_p_openai),
2038- max_tokens: Number(oai_settings.openai_max_tokens),
2039- logit_bias: logit_bias,
2040- };
2041-
2042- const response = await fetch(generate_url, {
2043- method: 'POST',
2044- body: JSON.stringify(generate_data),
2045- headers: getRequestHeaders(),
2046- signal: signal,
2047- });
2048-
2049- if (!response.ok) {
2050- tryParseStreamingError(response, await response.text());
2051- throw new Error('Scale response does not indicate success.');
2052- }
2053-
2054- const data = await response.json();
2055- return data.output;
2056-}
2057-
20581998function getReasoningEffort() {
20591999 // These sources expect the effort as string.
20602000 const reasoningEffortSources = [
@@ -2109,7 +2049,6 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } =
21092049 let logit_bias = {};
21102050 const isClaude = oai_settings.chat_completion_source == chat_completion_sources.CLAUDE;
21112051 const isOpenRouter = oai_settings.chat_completion_source == chat_completion_sources.OPENROUTER;
2112- const isScale = oai_settings.chat_completion_source == chat_completion_sources.SCALE;
21132052 const isGoogle = oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE;
21142053 const isVertexAI = oai_settings.chat_completion_source == chat_completion_sources.VERTEXAI;
21152054 const isOAI = oai_settings.chat_completion_source == chat_completion_sources.OPENAI;
@@ -2128,11 +2067,11 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } =
21282067 const isQuiet = type === 'quiet';
21292068 const isImpersonate = type === 'impersonate';
21302069 const isContinue = type === 'continue';
21312070 const stream = oai_settings.stream_openai && !isQuiet && !isScale && !(isOAI && ['o1-2024-12-17', 'o1'].includes(oai_settings.openai_model));
21322071 const useLogprobs = !!power_user.request_token_probabilities;
21332072 const canMultiSwipe = oai_settings.n > 1 && !isContinue && !isImpersonate && !isQuiet && (isOAI || isCustom || isXAI || isAimlapi);
21342073
21352074 const logitBiasSources = [chat_completion_sources.OPENAI, chat_completion_sources.OPENROUTER, chat_completion_sources.SCALE, chat_completion_sources.CUSTOM];
21362075 if (oai_settings.bias_preset_selected
21372076 && logitBiasSources.includes(oai_settings.chat_completion_source)
21382077 && Array.isArray(oai_settings.bias_presets[oai_settings.bias_preset_selected])
@@ -2145,10 +2084,6 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } =
21452084 logit_bias = undefined;
21462085 }
21472086
2148- if (isScale && oai_settings.use_alt_scale) {
2149- return sendAltScaleRequest(messages, logit_bias, signal, type);
2150- }
2151-
21522087 const model = getChatCompletionModel();
21532088 const generate_data = {
21542089 'messages': messages,
@@ -2230,10 +2165,6 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } =
22302165 }
22312166 }
22322167
2233- if (isScale) {
2234- generate_data['api_url_scale'] = oai_settings.api_url_scale;
2235- }
2236-
22372168 if (isGoogle || isVertexAI) {
22382169 const stopStringsLimit = 5;
22392170 generate_data['top_k'] = Number(oai_settings.top_k_openai);
@@ -3446,7 +3377,6 @@ function loadOpenAISettings(data, settings) {
34463377 oai_settings.google_model = settings.google_model ?? default_settings.google_model;
34473378 oai_settings.vertexai_model = settings.vertexai_model ?? default_settings.vertexai_model;
34483379 oai_settings.chat_completion_source = settings.chat_completion_source ?? default_settings.chat_completion_source;
3449- oai_settings.api_url_scale = settings.api_url_scale ?? default_settings.api_url_scale;
34503380 oai_settings.show_external_models = settings.show_external_models ?? default_settings.show_external_models;
34513381 oai_settings.proxy_password = settings.proxy_password ?? default_settings.proxy_password;
34523382 oai_settings.assistant_prefill = settings.assistant_prefill ?? default_settings.assistant_prefill;
@@ -3495,9 +3425,7 @@ function loadOpenAISettings(data, settings) {
34953425 if (settings.vertexai_auth_mode !== undefined) oai_settings.vertexai_auth_mode = settings.vertexai_auth_mode;
34963426 if (settings.vertexai_region !== undefined) oai_settings.vertexai_region = settings.vertexai_region;
34973427 if (settings.vertexai_express_project_id !== undefined) oai_settings.vertexai_express_project_id = settings.vertexai_express_project_id;
3498- if (settings.use_alt_scale !== undefined) { oai_settings.use_alt_scale = !!settings.use_alt_scale; updateScaleForm(); }
34993428 $('#stream_toggle').prop('checked', oai_settings.stream_openai);
3500- $('#api_url_scale').val(oai_settings.api_url_scale);
35013429 $('#openai_proxy_password').val(oai_settings.proxy_password);
35023430 $('#claude_assistant_prefill').val(oai_settings.assistant_prefill);
35033431 $('#claude_assistant_impersonation').val(oai_settings.assistant_impersonation);
@@ -3558,7 +3486,6 @@ function loadOpenAISettings(data, settings) {
35583486 // Don't display Service Account JSON in textarea - it's stored in backend secrets
35593487 $('#vertexai_service_account_json').val('');
35603488 updateVertexAIServiceAccountStatus();
3561- $('#scale-alt').prop('checked', oai_settings.use_alt_scale);
35623489 $('#openrouter_use_fallback').prop('checked', oai_settings.openrouter_use_fallback);
35633490 $('#openrouter_group_models').prop('checked', oai_settings.openrouter_group_models);
35643491 $('#openrouter_allow_fallbacks').prop('checked', oai_settings.openrouter_allow_fallbacks);
@@ -3701,7 +3628,6 @@ function setContinuePostfixControls() {
37013628
37023629async function getStatusOpen() {
37033630 const noValidateSources = [
3704- chat_completion_sources.SCALE,
37053631 chat_completion_sources.CLAUDE,
37063632 chat_completion_sources.AI21,
37073633 chat_completion_sources.VERTEXAI,
@@ -3851,7 +3777,6 @@ async function saveOpenAIPreset(name, settings, triggerUi = true) {
38513777 stream_openai: settings.stream_openai,
38523778 prompts: settings.prompts,
38533779 prompt_order: settings.prompt_order,
3854- api_url_scale: settings.api_url_scale,
38553780 show_external_models: settings.show_external_models,
38563781 assistant_prefill: settings.assistant_prefill,
38573782 assistant_impersonation: settings.assistant_impersonation,
@@ -3860,7 +3785,6 @@ async function saveOpenAIPreset(name, settings, triggerUi = true) {
38603785 vertexai_auth_mode: settings.vertexai_auth_mode,
38613786 vertexai_region: settings.vertexai_region,
38623787 vertexai_express_project_id: settings.vertexai_express_project_id,
3863- use_alt_scale: settings.use_alt_scale,
38643788 squash_system_messages: settings.squash_system_messages,
38653789 image_inlining: settings.image_inlining,
38663790 inline_image_quality: settings.inline_image_quality,
@@ -4663,17 +4587,6 @@ async function onModelChange() {
46634587 oai_settings.xai_model = value;
46644588 }
46654589
4666- if (oai_settings.chat_completion_source == chat_completion_sources.SCALE) {
4667- if (oai_settings.max_context_unlocked) {
4668- $('#openai_max_context').attr('max', unlocked_max);
4669- } else {
4670- $('#openai_max_context').attr('max', scale_max);
4671- }
4672- oai_settings.openai_max_context = Math.min(Number($('#openai_max_context').attr('max')), oai_settings.openai_max_context);
4673- $('#openai_max_context').val(oai_settings.openai_max_context).trigger('input');
4674- $('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input');
4675- }
4676-
46774590 if ([chat_completion_sources.MAKERSUITE, chat_completion_sources.VERTEXAI].includes(oai_settings.chat_completion_source)) {
46784591 if (oai_settings.max_context_unlocked) {
46794592 $('#openai_max_context').attr('max', max_2mil);
@@ -5003,34 +4916,6 @@ async function onConnectButtonClick(e) {
50034916 }
50044917 }
50054918
5006- if (oai_settings.chat_completion_source == chat_completion_sources.SCALE) {
5007- const api_key_scale = String($('#api_key_scale').val()).trim();
5008- const scale_cookie = String($('#scale_cookie').val()).trim();
5009-
5010- if (api_key_scale.length) {
5011- await writeSecret(SECRET_KEYS.SCALE, api_key_scale);
5012- }
5013-
5014- if (scale_cookie.length) {
5015- await writeSecret(SECRET_KEYS.SCALE_COOKIE, scale_cookie);
5016- }
5017-
5018- if (!oai_settings.api_url_scale && !oai_settings.use_alt_scale) {
5019- console.log('No API URL saved for Scale');
5020- return;
5021- }
5022-
5023- if (!secret_state[SECRET_KEYS.SCALE] && !oai_settings.use_alt_scale) {
5024- console.log('No secret key saved for Scale');
5025- return;
5026- }
5027-
5028- if (!secret_state[SECRET_KEYS.SCALE_COOKIE] && oai_settings.use_alt_scale) {
5029- console.log('No cookie set for Scale');
5030- return;
5031- }
5032- }
5033-
50344919 if (oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE) {
50354920 const api_key_makersuite = String($('#api_key_makersuite').val()).trim();
50364921
@@ -5250,9 +5135,6 @@ function toggleChatCompletionForms() {
52505135 $('#model_openai_select').trigger('change');
52515136 }
52525137 }
5253- else if (oai_settings.chat_completion_source == chat_completion_sources.SCALE) {
5254- $('#model_scale_select').trigger('change');
5255- }
52565138 else if (oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE) {
52575139 $('#model_google_select').trigger('change');
52585140 }
@@ -5338,16 +5220,6 @@ function onProxyPasswordShowClick() {
53385220 $(this).toggleClass('fa-eye-slash fa-eye');
53395221}
53405222
5341-function updateScaleForm() {
5342- if (oai_settings.use_alt_scale) {
5343- $('#normal_scale_form').css('display', 'none');
5344- $('#alt_scale_form').css('display', '');
5345- } else {
5346- $('#normal_scale_form').css('display', '');
5347- $('#alt_scale_form').css('display', 'none');
5348- }
5349-}
5350-
53515223async function onCustomizeParametersClick() {
53525224 const template = $(await renderTemplateAsync('customEndpointAdditionalParameters'));
53535225
@@ -5762,12 +5634,6 @@ export function initOpenAI() {
57625634
57635635 $('#test_api_button').on('click', testApiConnection);
57645636
5765- $('#scale-alt').on('change', function () {
5766- oai_settings.use_alt_scale = !!$('#scale-alt').prop('checked');
5767- saveSettingsDebounced();
5768- updateScaleForm();
5769- });
5770-
57715637 $('#temp_openai').on('input', function () {
57725638 oai_settings.temp_openai = Number($(this).val());
57735639 $('#temp_counter_openai').val(Number($(this).val()).toFixed(2));
@@ -5982,11 +5848,6 @@ export function initOpenAI() {
59825848 saveSettingsDebounced();
59835849 });
59845850
5985- $('#api_url_scale').on('input', function () {
5986- oai_settings.api_url_scale = String($(this).val());
5987- saveSettingsDebounced();
5988- });
5989-
59905851 $('#openai_show_external_models').on('input', function () {
59915852 oai_settings.show_external_models = !!$(this).prop('checked');
59925853 $('#openai_external_category').toggle(oai_settings.show_external_models);
@@ -6220,7 +6081,6 @@ export function initOpenAI() {
62206081 $('#openai_reverse_proxy').on('input', onReverseProxyInput);
62216082 $('#model_openai_select').on('change', onModelChange);
62226083 $('#model_claude_select').on('change', onModelChange);
6223- $('#model_scale_select').on('change', onModelChange);
62246084 $('#model_google_select').on('change', onModelChange);
62256085 $('#model_vertexai_select').on('change', onModelChange);
62266086 $('#vertexai_auth_mode').on('change', onVertexAIAuthModeChange);
public/scripts/secrets.js+0 -12
@@ -28,9 +28,7 @@ export const SECRET_KEYS = {
2828 LIBRE_URL: 'libre_url',
2929 LINGVA_URL: 'lingva_url',
3030 OPENROUTER: 'api_key_openrouter',
31- SCALE: 'api_key_scale',
3231 AI21: 'api_key_ai21',
33- SCALE_COOKIE: 'scale_cookie',
3432 ONERING_URL: 'oneringtranslator_url',
3533 DEEPLX_URL: 'deeplx_url',
3634 MAKERSUITE: 'api_key_makersuite',
@@ -73,9 +71,7 @@ const FRIENDLY_NAMES = {
7371 [SECRET_KEYS.NOVEL]: 'NovelAI',
7472 [SECRET_KEYS.CLAUDE]: 'Claude',
7573 [SECRET_KEYS.OPENROUTER]: 'OpenRouter',
76- [SECRET_KEYS.SCALE]: 'Scale',
7774 [SECRET_KEYS.AI21]: 'AI21',
78- [SECRET_KEYS.SCALE_COOKIE]: 'Scale (Cookie)',
7975 [SECRET_KEYS.MAKERSUITE]: 'Google AI Studio',
8076 [SECRET_KEYS.VERTEXAI]: 'Google Vertex AI (Express Mode)',
8177 [SECRET_KEYS.VLLM]: 'vLLM',
@@ -125,9 +121,7 @@ const INPUT_MAP = {
125121 [SECRET_KEYS.NOVEL]: '#api_key_novel',
126122 [SECRET_KEYS.CLAUDE]: '#api_key_claude',
127123 [SECRET_KEYS.OPENROUTER]: '.api_key_openrouter',
128- [SECRET_KEYS.SCALE]: '#api_key_scale',
129124 [SECRET_KEYS.AI21]: '#api_key_ai21',
130- [SECRET_KEYS.SCALE_COOKIE]: '#scale_cookie',
131125 [SECRET_KEYS.MAKERSUITE]: '#api_key_makersuite',
132126 [SECRET_KEYS.VERTEXAI]: '#api_key_vertexai',
133127 [SECRET_KEYS.VLLM]: '#api_key_vllm',
@@ -191,12 +185,6 @@ export function resolveSecretKey() {
191185 }
192186 }
193187
194- if (chatCompletionSource === chat_completion_sources.SCALE) {
195- return chatCompletionSettings.use_alt_scale
196- ? SECRET_KEYS.SCALE_COOKIE
197- : SECRET_KEYS.SCALE;
198- }
199-
200188 const [key] = Object.entries(chat_completion_sources).find(([, value]) => value === chatCompletionSource) ?? [null];
201189 if (key && SECRET_KEYS[key]) {
202190 return SECRET_KEYS[key];
public/scripts/tokenizers.js+0 -5
@@ -586,11 +586,6 @@ export function getTokenizerModel() {
586586 const nemoTokenizer = 'nemo';
587587 const deepseekTokenizer = 'deepseek';
588588
589- // Assuming no one would use it for different models.. right?
590- if (oai_settings.chat_completion_source == chat_completion_sources.SCALE) {
591- return gpt4Tokenizer;
592- }
593-
594589 if (oai_settings.chat_completion_source == chat_completion_sources.DEEPSEEK) {
595590 return deepseekTokenizer;
596591 }
src/constants.js+0 -1
@@ -164,7 +164,6 @@ export const GEMINI_SAFETY = [
164164export const CHAT_COMPLETION_SOURCES = {
165165 OPENAI: 'openai',
166166 CLAUDE: 'claude',
167- SCALE: 'scale',
168167 OPENROUTER: 'openrouter',
169168 AI21: 'ai21',
170169 MAKERSUITE: 'makersuite',
src/endpoints/backends/chat-completions.js+0 -53
@@ -276,58 +276,6 @@ async function sendClaudeRequest(request, response) {
276276}
277277
278278/**
279- * Sends a request to Scale Spellbook API.
280- * @param {import("express").Request} request Express request
281- * @param {import("express").Response} response Express response
282- */
283-async function sendScaleRequest(request, response) {
284- const apiUrl = new URL(request.body.api_url_scale).toString();
285- const apiKey = readSecret(request.user.directories, SECRET_KEYS.SCALE);
286-
287- if (!apiKey) {
288- console.warn('Scale API key is missing.');
289- return response.status(400).send({ error: true });
290- }
291-
292- const requestPrompt = convertTextCompletionPrompt(request.body.messages);
293- console.debug('Scale request:', requestPrompt);
294-
295- try {
296- const controller = new AbortController();
297- request.socket.removeAllListeners('close');
298- request.socket.on('close', function () {
299- controller.abort();
300- });
301-
302- const generateResponse = await fetch(apiUrl, {
303- method: 'POST',
304- body: JSON.stringify({ input: { input: requestPrompt } }),
305- headers: {
306- 'Content-Type': 'application/json',
307- 'Authorization': `Basic ${apiKey}`,
308- },
309- });
310-
311- if (!generateResponse.ok) {
312- console.warn(`Scale API returned error: ${generateResponse.status} ${generateResponse.statusText} ${await generateResponse.text()}`);
313- return response.status(500).send({ error: true });
314- }
315-
316- /** @type {any} */
317- const generateResponseJson = await generateResponse.json();
318- console.debug('Scale response:', generateResponseJson);
319-
320- const reply = { choices: [{ 'message': { 'content': generateResponseJson.output } }] };
321- return response.send(reply);
322- } catch (error) {
323- console.error(error);
324- if (!response.headersSent) {
325- return response.status(500).send({ error: true });
326- }
327- }
328-}
329-
330-/**
331279 * Sends a request to Google AI API.
332280 * @param {express.Request} request Express request
333281 * @param {express.Response} response Express response
@@ -1492,7 +1440,6 @@ router.post('/generate', function (request, response) {
14921440
14931441 switch (request.body.chat_completion_source) {
14941442 case CHAT_COMPLETION_SOURCES.CLAUDE: return sendClaudeRequest(request, response);
1495- case CHAT_COMPLETION_SOURCES.SCALE: return sendScaleRequest(request, response);
14961443 case CHAT_COMPLETION_SOURCES.AI21: return sendAI21Request(request, response);
14971444 case CHAT_COMPLETION_SOURCES.MAKERSUITE: return sendMakerSuiteRequest(request, response);
14981445 case CHAT_COMPLETION_SOURCES.VERTEXAI: return sendMakerSuiteRequest(request, response);
src/endpoints/backends/scale-alt.js+0 -97
@@ -1,97 +0,0 @@
1-import express from 'express';
2-import fetch from 'node-fetch';
3-
4-import { readSecret, SECRET_KEYS } from '../secrets.js';
5-
6-export const router = express.Router();
7-
8-router.post('/generate', async function (request, response) {
9- if (!request.body) return response.sendStatus(400);
10-
11- try {
12- const cookie = readSecret(request.user.directories, SECRET_KEYS.SCALE_COOKIE);
13-
14- if (!cookie) {
15- console.error('No Scale cookie found');
16- return response.sendStatus(400);
17- }
18-
19- const body = {
20- json: {
21- variant: {
22- name: 'New Variant',
23- appId: '',
24- taxonomy: null,
25- },
26- prompt: {
27- id: '',
28- template: '{{input}}\n',
29- exampleVariables: {},
30- variablesSourceDataId: null,
31- systemMessage: request.body.sysprompt,
32- },
33- modelParameters: {
34- id: '',
35- modelId: 'GPT4',
36- modelType: 'OpenAi',
37- maxTokens: request.body.max_tokens,
38- temperature: request.body.temp,
39- stop: 'user:',
40- suffix: null,
41- topP: request.body.top_p,
42- logprobs: null,
43- logitBias: request.body.logit_bias,
44- },
45- inputs: [
46- {
47- index: '-1',
48- valueByName: {
49- input: request.body.prompt,
50- },
51- },
52- ],
53- },
54- meta: {
55- values: {
56- 'variant.taxonomy': ['undefined'],
57- 'prompt.variablesSourceDataId': ['undefined'],
58- 'modelParameters.suffix': ['undefined'],
59- 'modelParameters.logprobs': ['undefined'],
60- },
61- },
62- };
63-
64- console.debug('Scale request:', body);
65-
66- const result = await fetch('https://dashboard.scale.com/spellbook/api/trpc/v2.variant.run', {
67- method: 'POST',
68- headers: {
69- 'Content-Type': 'application/json',
70- 'cookie': `_jwt=${cookie}`,
71- },
72- body: JSON.stringify(body),
73- });
74-
75- if (!result.ok) {
76- const text = await result.text();
77- console.error('Scale request failed', result.statusText, text);
78- return response.status(500).send({ error: { message: result.statusText } });
79- }
80-
81- /** @type {any} */
82- const data = await result.json();
83- const output = data?.result?.data?.json?.outputs?.[0] || '';
84-
85- console.debug('Scale response:', data);
86-
87- if (!output) {
88- console.warn('Scale response is empty');
89- return response.sendStatus(500).send({ error: { message: 'Empty response' } });
90- }
91-
92- return response.json({ output });
93- } catch (error) {
94- console.error(error);
95- return response.sendStatus(500);
96- }
97-});
src/endpoints/secrets.js+0 -2
@@ -21,9 +21,7 @@ export const SECRET_KEYS = {
2121 LIBRE_URL: 'libre_url',
2222 LINGVA_URL: 'lingva_url',
2323 OPENROUTER: 'api_key_openrouter',
24- SCALE: 'api_key_scale',
2524 AI21: 'api_key_ai21',
26- SCALE_COOKIE: 'scale_cookie',
2725 ONERING_URL: 'oneringtranslator_url',
2826 DEEPLX_URL: 'deeplx_url',
2927 MAKERSUITE: 'api_key_makersuite',
src/server-startup.js+0 -2
@@ -43,7 +43,6 @@ import { router as openRouterRouter } from './endpoints/openrouter.js';
4343import { router as chatCompletionsRouter } from './endpoints/backends/chat-completions.js';
4444import { router as koboldRouter } from './endpoints/backends/kobold.js';
4545import { router as textCompletionsRouter } from './endpoints/backends/text-completions.js';
46-import { router as scaleAltRouter } from './endpoints/backends/scale-alt.js';
4746import { router as speechRouter } from './endpoints/speech.js';
4847import { router as azureRouter } from './endpoints/azure.js';
4948import { router as dataMaidRouter } from './endpoints/data-maid.js';
@@ -171,7 +170,6 @@ export function setupPrivateEndpoints(app) {
171170 app.use('/api/openrouter', openRouterRouter);
172171 app.use('/api/backends/kobold', koboldRouter);
173172 app.use('/api/backends/chat-completions', chatCompletionsRouter);
174- app.use('/api/backends/scale-alt', scaleAltRouter);
175173 app.use('/api/speech', speechRouter);
176174 app.use('/api/azure', azureRouter);
177175 app.use('/api/data-maid', dataMaidRouter);