Remove Scale Spellbook from CC sources (#4293)
Signed| @@ -16,7 +16,7 @@ | ||
| 16 | 16 | |
| 17 | 17 | --- |
| 18 | 18 | |
| 19 | 19 | モバイルデバイスにも適したレイアウト・マルチAPI(KoboldAI/CPP、Horde、NovelAI、Ooba、OpenAI、OpenRouter、Claude、Scale)、VN ライクな Waifu モード、Stable Diffusion、TTS、WorldInfo(伝承本)、カスタマイズ可能なUI、自動翻訳、大量のプロンプトオプション+サードパーティの拡張機能をインストールする機能 |
| 20 | 20 | |
| 21 | 21 | [TavernAI](https://github.com/TavernAI/TavernAI) v.1.2.8 のフォークに基づいています。 |
| 22 | 22 | |
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | |
| 19 | 19 | --- |
| 20 | 20 | |
| 21 | 21 | Мобайл-френдли интерфейс, поддержка множества API (KoboldAI/CPP, Horde, NovelAI, Ooba, OpenAI, OpenRouter, Claude, Scale), ВН-образный режим Вайфу, Stable Diffusion, TTS, поддержка миров (лорбуков), кастомизируемый UI, автоперевод, тончайшая настройка промптов + возможность устанавливать расширения. |
| 22 | 22 | |
| 23 | 23 | Основано на форке [TavernAI](https://github.com/TavernAI/TavernAI) версии 1.2.8 |
| 24 | 24 | |
| @@ -225,12 +225,10 @@ | ||
| 225 | 225 | ] |
| 226 | 226 | } |
| 227 | 227 | ], |
| 228 | - "api_url_scale": "", | |
| 229 | 228 | "show_external_models": false, |
| 230 | 229 | "assistant_prefill": "", |
| 231 | 230 | "assistant_impersonation": "", |
| 232 | 231 | "claude_use_sysprompt": false, |
| 233 | - "use_alt_scale": false, | |
| 234 | 232 | "squash_system_messages": false, |
| 235 | 233 | "image_inlining": false, |
| 236 | 234 | "bypass_status_check": false, |
| @@ -691,7 +691,7 @@ | ||
| 691 | 691 | </span> |
| 692 | 692 | </div> |
| 693 | 693 | </div> |
| 694 | 694 | <div class="range-block" data-source="openai,claude,aimlapi,openrouter,ai21,scale,makersuite,vertexai,mistralai,custom,cohere,perplexity,groq,01ai,nanogpt,deepseek,xai,pollinations"> |
| 695 | 695 | <div class="range-block-title" data-i18n="Temperature"> |
| 696 | 696 | Temperature |
| 697 | 697 | </div> |
| @@ -743,7 +743,7 @@ | ||
| 743 | 743 | </div> |
| 744 | 744 | </div> |
| 745 | 745 | </div> |
| 746 | 746 | <div class="range-block" data-source="openai,claude,aimlapi,openrouter,ai21,scale,makersuite,vertexai,mistralai,custom,cohere,perplexity,groq,01ai,nanogpt,deepseek,xai,pollinations"> |
| 747 | 747 | <div class="range-block-title" data-i18n="Top P"> |
| 748 | 748 | Top P |
| 749 | 749 | </div> |
| @@ -2132,7 +2132,7 @@ | ||
| 2132 | 2132 | </div> |
| 2133 | 2133 | </div> |
| 2134 | 2134 | </div> |
| 2135 | 2135 | <div class="range-block m-t-1" data-source="openai,aimlapi,openrouter,scale,custom"> |
| 2136 | 2136 | <div id="logit_bias_openai" class="range-block-title openai_restorable" data-i18n="Logit Bias"> |
| 2137 | 2137 | Logit Bias |
| 2138 | 2138 | </div> |
| @@ -2802,7 +2802,6 @@ | ||
| 2802 | 2802 | <option value="openrouter">OpenRouter</option> |
| 2803 | 2803 | <option value="perplexity">Perplexity</option> |
| 2804 | 2804 | <option value="pollinations">Pollinations</option> |
| 2805 | - <option value="scale">Scale</option> | |
| 2806 | 2805 | <option value="xai">xAI (Grok)</option> |
| 2807 | 2806 | </optgroup> |
| 2808 | 2807 | </select> |
| @@ -3099,36 +3098,6 @@ | ||
| 3099 | 3098 | <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> |
| 3100 | 3099 | </small> |
| 3101 | 3100 | </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> | |
| 3132 | 3101 | <form id="ai21_form" data-source="ai21" action="javascript:void(null);" method="post" enctype="multipart/form-data"> |
| 3133 | 3102 | <h4 data-i18n="AI21 API Key">AI21 API Key</h4> |
| 3134 | 3103 | <div class="flex-container"> |
| @@ -375,9 +375,6 @@ | ||
| 375 | 375 | "Group by vendors Description": "ضع نماذج OpenAI في مجموعة واحدة، والنماذج الإنسانية في مجموعة أخرى، وما إلى ذلك. ويمكن دمجها مع الفرز.", |
| 376 | 376 | "Allow fallback routes": "السماح بمسارات الاحتياط", |
| 377 | 377 | "Allow fallback routes Description": "يختار النموذج البديل تلقائيًا إذا كان النموذج المحدد غير قادر على تلبية طلبك.", |
| 378 | - "Scale API Key": "مفتاح API لـ Scale", | |
| 379 | - "Clear your cookie": "امسح ملف تعريف الارتباط الخاص بك", | |
| 380 | - "Alt Method": "طريقة بديلة", | |
| 381 | 378 | "AI21 API Key": "مفتاح API لـ AI21", |
| 382 | 379 | "AI21 Model": "نموذج AI21", |
| 383 | 380 | "Google AI Studio API Key": "مفتاح واجهة برمجة تطبيقات Google AI Studio", |
| @@ -375,9 +375,6 @@ | ||
| 375 | 375 | "Group by vendors Description": "Platzieren Sie OpenAI-Modelle in einer Gruppe, anthropogene Modelle in einer anderen Gruppe usw. Kann mit Sortierung kombiniert werden.", |
| 376 | 376 | "Allow fallback routes": "Fallback-Routen zulassen", |
| 377 | 377 | "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", | |
| 381 | 378 | "AI21 API Key": "AI21 API-Schlüssel", |
| 382 | 379 | "AI21 Model": "AI21-Modell", |
| 383 | 380 | "Google AI Studio API Key": "Google AI Studio API-Schlüssel", |
| @@ -375,9 +375,6 @@ | ||
| 375 | 375 | "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.", |
| 376 | 376 | "Allow fallback routes": "Permitir rutas de respaldo", |
| 377 | 377 | "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", | |
| 381 | 378 | "AI21 API Key": "Clave API de AI21", |
| 382 | 379 | "AI21 Model": "Modelo de AI21", |
| 383 | 380 | "Google AI Studio API Key": "Clave API de Google AI Studio", |
| @@ -355,9 +355,6 @@ | ||
| 355 | 355 | "Group by vendors": "Regrouper par fournisseurs", |
| 356 | 356 | "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.", |
| 357 | 357 | "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", | |
| 361 | 358 | "AI21 API Key": "Clé API AI21", |
| 362 | 359 | "AI21 Model": "Modèle AI21", |
| 363 | 360 | "Google AI Studio API Key": "Clé API Google AI Studio", |
| @@ -375,9 +375,6 @@ | ||
| 375 | 375 | "Group by vendors Description": "Setjið OpenAI módel í einn hóp, Anthropic módel í annan hóp osfrv. Hægt að sameina við flokkun.", |
| 376 | 376 | "Allow fallback routes": "Leyfa bakfallssvæði", |
| 377 | 377 | "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", | |
| 381 | 378 | "AI21 API Key": "Lykill API fyrir AI21", |
| 382 | 379 | "AI21 Model": "AI21 Módel", |
| 383 | 380 | "Google AI Studio API Key": "Google AI Studio API lykill", |
| @@ -375,9 +375,6 @@ | ||
| 375 | 375 | "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.", |
| 376 | 376 | "Allow fallback routes": "Consenti percorsi alternativi", |
| 377 | 377 | "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", | |
| 381 | 378 | "AI21 API Key": "Chiave API di AI21", |
| 382 | 379 | "AI21 Model": "Modello AI21", |
| 383 | 380 | "Google AI Studio API Key": "Chiave API Google AI Studio", |
| @@ -375,9 +375,6 @@ | ||
| 375 | 375 | "Group by vendors Description": "OpenAI モデルを 1 つのグループに、Anthropic モデルを別のグループに配置するなどします。ソートと組み合わせることができます。", |
| 376 | 376 | "Allow fallback routes": "フォールバックルートを許可", |
| 377 | 377 | "Allow fallback routes Description": "選択したモデルが要求を満たせない場合、代替モデルが自動的に選択されます。", |
| 378 | - "Scale API Key": "ScaleのAPIキー", | |
| 379 | - "Clear your cookie": "クッキーを消去する", | |
| 380 | - "Alt Method": "代替手法", | |
| 381 | 378 | "AI21 API Key": "AI21のAPIキー", |
| 382 | 379 | "AI21 Model": "AI21モデル", |
| 383 | 380 | "Google AI Studio API Key": "Google AI Studio APIキー", |
| @@ -384,9 +384,6 @@ | ||
| 384 | 384 | "LEGACY": "유산", |
| 385 | 385 | "Force Instruct Mode formatting": "강제 지시 모드 형식", |
| 386 | 386 | "Force_Instruct_Mode_formatting_Description": "Instruct Mode와 이 모드가 모두 활성화된 경우 프롬프트는 SillyTavern에 의해 현재 형식을 사용하여 형식화됩니다.\n 고급 형식 설정(시스템 프롬프트 지시 제외) 비활성화된 경우 프롬프트는 OpenRouter에 의해 형식화됩니다.", |
| 387 | - "Scale API Key": "Scale API 키", | |
| 388 | - "Clear your cookie": "쿠키 지우기", | |
| 389 | - "Alt Method": "대체 방법", | |
| 390 | 387 | "AI21 API Key": "AI21 API 키", |
| 391 | 388 | "AI21 Model": "AI21 모델", |
| 392 | 389 | "Google AI Studio API Key": "Google AI Studio API 키", |
| @@ -375,9 +375,6 @@ | ||
| 375 | 375 | "Group by vendors Description": "Plaats OpenAI-modellen in één groep, antropische modellen in een andere groep, enz. Kan worden gecombineerd met sorteren.", |
| 376 | 376 | "Allow fallback routes": "Fallback-routes toestaan", |
| 377 | 377 | "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", | |
| 381 | 378 | "AI21 API Key": "AI21 API-sleutel", |
| 382 | 379 | "AI21 Model": "AI21-model", |
| 383 | 380 | "MakerSuite API Key": "MakerSuite API-sleutel", |
| @@ -375,9 +375,6 @@ | ||
| 375 | 375 | "Group by vendors Description": "Coloque os modelos OpenAI em um grupo, os modelos antrópicos em outro grupo, etc.", |
| 376 | 376 | "Allow fallback routes": "Permitir rotas de fallback", |
| 377 | 377 | "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", | |
| 381 | 378 | "AI21 API Key": "Chave da API AI21", |
| 382 | 379 | "AI21 Model": "Modelo AI21", |
| 383 | 380 | "Google AI Studio API Key": "Chave API Google AI Studio", |
| @@ -142,8 +142,6 @@ | ||
| 142 | 142 | "Get your key from": "Получите ключ в", |
| 143 | 143 | "Anthropic's developer console": "консоли разработчика Anthropic", |
| 144 | 144 | "Claude Model": "Модель Claude", |
| 145 | - "Scale API Key": "Ключ от Scale API", | |
| 146 | - "Alt Method": "Альтернативный метод", | |
| 147 | 145 | "AI21 API Key": "Ключ от API AI21", |
| 148 | 146 | "AI21 Model": "Модель AI21", |
| 149 | 147 | "View API Usage Metrics": "Посмотреть статистику использования API", |
| @@ -1255,7 +1253,6 @@ | ||
| 1255 | 1253 | "vLLM Model": "Модель vLLM", |
| 1256 | 1254 | "Aphrodite Model": "Модель Aphrodite", |
| 1257 | 1255 | "Peek a password": "Посмотреть пароль", |
| 1258 | - "Clear your cookie": "Clear your cookie", | |
| 1259 | 1256 | "Add Chat Start and Example Separator to a list of stopping strings.": "Использовать Начало чата и Разделитель примеров сообщений в качестве стоп-строк.", |
| 1260 | 1257 | "Context Order": "Context Order", |
| 1261 | 1258 | "Summary": "Summary", |
| @@ -375,9 +375,6 @@ | ||
| 375 | 375 | "Group by vendors Description": "Помістіть моделі OpenAI в одну групу, моделі Anthropic в іншу групу тощо. Можна поєднати з сортуванням.", |
| 376 | 376 | "Allow fallback routes": "Дозволити резервні маршрути", |
| 377 | 377 | "Allow fallback routes Description": "Автоматично вибирає альтернативну модель, якщо вибрана модель не може задовольнити ваш запит.", |
| 378 | - "Scale API Key": "Ключ API для Scale", | |
| 379 | - "Clear your cookie": "Очистіть файл cookie", | |
| 380 | - "Alt Method": "Альтернативний метод", | |
| 381 | 378 | "AI21 API Key": "Ключ API для AI21", |
| 382 | 379 | "AI21 Model": "Модель AI21", |
| 383 | 380 | "Google AI Studio API Key": "Ключ API Google AI Studio", |
| @@ -375,9 +375,6 @@ | ||
| 375 | 375 | "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.", |
| 376 | 376 | "Allow fallback routes": "Cho phép các tuyến đường phụ", |
| 377 | 377 | "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ế", | |
| 381 | 378 | "AI21 API Key": "AI21 API Key", |
| 382 | 379 | "AI21 Model": "Model của AI21", |
| 383 | 380 | "Google AI Studio API Key": "Google AI Studio API Key", |
| @@ -429,9 +429,6 @@ | ||
| 429 | 429 | "Group by vendors": "按厂商分组", |
| 430 | 430 | "Group by vendors Description": "将 OpenAI 模型放在一组,将 Anthropic 模型放在另一组,等等。可以与排序结合。", |
| 431 | 431 | "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": "备用方法", | |
| 435 | 432 | "AI21 API Key": "AI21 API 密钥", |
| 436 | 433 | "AI21 Model": "AI21 模型", |
| 437 | 434 | "Google AI Studio API Key": "Google AI Studio API 密钥", |
| @@ -376,9 +376,6 @@ | ||
| 376 | 376 | "Group by vendors Description": "將 OpenAI、Anthropic 等模型放各自供應商的群組中。可以與排序功能結合使用。", |
| 377 | 377 | "Allow fallback routes": "允許備援路徑", |
| 378 | 378 | "Allow fallback routes Description": "如果選擇的模型無法滿足要求,會自動選擇替代模型。", |
| 379 | - "Scale API Key": "Scale API 金鑰", | |
| 380 | - "Clear your cookie": "清除您的 Cookie", | |
| 381 | - "Alt Method": "替代方法", | |
| 382 | 379 | "AI21 API Key": "AI21 API 金鑰", |
| 383 | 380 | "AI21 Model": "AI21 模型", |
| 384 | 381 | "Google AI Studio API Key": "Google AI Studio API 金鑰", |
| @@ -2689,11 +2689,9 @@ export function parseMesExamples(examplesStr, isInstruct) { | ||
| 2689 | 2689 | } |
| 2690 | 2690 | |
| 2691 | 2691 | export function isStreamingEnabled() { |
| 2692 | - const noStreamSources = [chat_completion_sources.SCALE]; | |
| 2693 | 2692 | return ( |
| 2694 | 2693 | (main_api == 'openai' && |
| 2695 | 2694 | oai_settings.stream_openai && |
| 2696 | - !noStreamSources.includes(oai_settings.chat_completion_source) && | |
| 2697 | 2695 | !(oai_settings.chat_completion_source == chat_completion_sources.OPENAI && ['o1-2024-12-17', 'o1'].includes(oai_settings.openai_model)) |
| 2698 | 2696 | ) |
| 2699 | 2697 | || (main_api == 'kobold' && kai_settings.streaming_kobold && kai_flags.can_use_streaming) |
| @@ -397,7 +397,6 @@ function RA_autoconnect(PrevApi) { | ||
| 397 | 397 | case 'openai': |
| 398 | 398 | if (((secret_state[SECRET_KEYS.OPENAI] || oai_settings.reverse_proxy) && oai_settings.chat_completion_source == chat_completion_sources.OPENAI) |
| 399 | 399 | || ((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) | |
| 401 | 400 | || (secret_state[SECRET_KEYS.OPENROUTER] && oai_settings.chat_completion_source == chat_completion_sources.OPENROUTER) |
| 402 | 401 | || (secret_state[SECRET_KEYS.AI21] && oai_settings.chat_completion_source == chat_completion_sources.AI21) |
| 403 | 402 | || (secret_state[SECRET_KEYS.MAKERSUITE] && oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE) |
| @@ -15,14 +15,12 @@ import { | ||
| 15 | 15 | Generate, |
| 16 | 16 | getExtensionPrompt, |
| 17 | 17 | getExtensionPromptMaxDepth, |
| 18 | - getNextMessageId, | |
| 19 | 18 | getRequestHeaders, |
| 20 | 19 | getStoppingStrings, |
| 21 | 20 | is_send_press, |
| 22 | 21 | main_api, |
| 23 | 22 | name1, |
| 24 | 23 | name2, |
| 25 | - replaceItemizedPromptText, | |
| 26 | 24 | resultCheckStatus, |
| 27 | 25 | saveSettingsDebounced, |
| 28 | 26 | setOnlineStatus, |
| @@ -129,7 +127,6 @@ const max_200k = 200 * 1000; | ||
| 129 | 127 | const max_256k = 256 * 1000; |
| 130 | 128 | const max_1mil = 1000 * 1000; |
| 131 | 129 | const max_2mil = 2000 * 1000; |
| 132 | -const scale_max = 8191; | |
| 133 | 130 | const claude_max = 9000; // We have a proper tokenizer, so theoretically could be larger (up to 9k) |
| 134 | 131 | const claude_100k_max = 99000; |
| 135 | 132 | const unlocked_max = max_2mil; |
| @@ -172,7 +169,6 @@ export let model_list = []; | ||
| 172 | 169 | export const chat_completion_sources = { |
| 173 | 170 | OPENAI: 'openai', |
| 174 | 171 | CLAUDE: 'claude', |
| 175 | - SCALE: 'scale', | |
| 176 | 172 | OPENROUTER: 'openrouter', |
| 177 | 173 | AI21: 'ai21', |
| 178 | 174 | MAKERSUITE: 'makersuite', |
| @@ -305,7 +301,6 @@ export const settingsToUpdate = { | ||
| 305 | 301 | stream_openai: ['#stream_toggle', 'stream_openai', true, false], |
| 306 | 302 | prompts: ['', 'prompts', false, false], |
| 307 | 303 | prompt_order: ['', 'prompt_order', false, false], |
| 308 | - api_url_scale: ['#api_url_scale', 'api_url_scale', false, true], | |
| 309 | 304 | show_external_models: ['#openai_show_external_models', 'show_external_models', true, true], |
| 310 | 305 | proxy_password: ['#openai_proxy_password', 'proxy_password', false, true], |
| 311 | 306 | assistant_prefill: ['#claude_assistant_prefill', 'assistant_prefill', false, false], |
| @@ -315,7 +310,6 @@ export const settingsToUpdate = { | ||
| 315 | 310 | vertexai_auth_mode: ['#vertexai_auth_mode', 'vertexai_auth_mode', false, true], |
| 316 | 311 | vertexai_region: ['#vertexai_region', 'vertexai_region', false, true], |
| 317 | 312 | 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], | |
| 319 | 313 | squash_system_messages: ['#squash_system_messages', 'squash_system_messages', true, false], |
| 320 | 314 | image_inlining: ['#openai_image_inlining', 'image_inlining', true, false], |
| 321 | 315 | inline_image_quality: ['#openai_inline_image_quality', 'inline_image_quality', false, false], |
| @@ -391,7 +385,6 @@ const default_settings = { | ||
| 391 | 385 | reverse_proxy: '', |
| 392 | 386 | chat_completion_source: chat_completion_sources.OPENAI, |
| 393 | 387 | max_context_unlocked: false, |
| 394 | - api_url_scale: '', | |
| 395 | 388 | show_external_models: false, |
| 396 | 389 | proxy_password: '', |
| 397 | 390 | assistant_prefill: '', |
| @@ -401,7 +394,6 @@ const default_settings = { | ||
| 401 | 394 | vertexai_auth_mode: 'express', |
| 402 | 395 | vertexai_region: 'us-central1', |
| 403 | 396 | vertexai_express_project_id: '', |
| 404 | - use_alt_scale: false, | |
| 405 | 397 | squash_system_messages: false, |
| 406 | 398 | image_inlining: false, |
| 407 | 399 | inline_image_quality: 'low', |
| @@ -480,7 +472,6 @@ const oai_settings = { | ||
| 480 | 472 | reverse_proxy: '', |
| 481 | 473 | chat_completion_source: chat_completion_sources.OPENAI, |
| 482 | 474 | max_context_unlocked: false, |
| 483 | - api_url_scale: '', | |
| 484 | 475 | show_external_models: false, |
| 485 | 476 | proxy_password: '', |
| 486 | 477 | assistant_prefill: '', |
| @@ -490,7 +481,6 @@ const oai_settings = { | ||
| 490 | 481 | vertexai_auth_mode: 'express', |
| 491 | 482 | vertexai_region: 'us-central1', |
| 492 | 483 | vertexai_express_project_id: '', |
| 493 | - use_alt_scale: false, | |
| 494 | 484 | squash_system_messages: false, |
| 495 | 485 | image_inlining: false, |
| 496 | 486 | inline_image_quality: 'low', |
| @@ -1599,8 +1589,6 @@ export function getChatCompletionModel(source = null) { | ||
| 1599 | 1589 | return oai_settings.claude_model; |
| 1600 | 1590 | case chat_completion_sources.OPENAI: |
| 1601 | 1591 | return oai_settings.openai_model; |
| 1602 | - case chat_completion_sources.SCALE: | |
| 1603 | - return ''; | |
| 1604 | 1592 | case chat_completion_sources.MAKERSUITE: |
| 1605 | 1593 | return oai_settings.google_model; |
| 1606 | 1594 | case chat_completion_sources.VERTEXAI: |
| @@ -2007,54 +1995,6 @@ function getAimlapiModelTemplate(option) { | ||
| 2007 | 1995 | `)); |
| 2008 | 1996 | } |
| 2009 | 1997 | |
| 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 | - | |
| 2058 | 1998 | function getReasoningEffort() { |
| 2059 | 1999 | // These sources expect the effort as string. |
| 2060 | 2000 | const reasoningEffortSources = [ |
| @@ -2109,7 +2049,6 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } = | ||
| 2109 | 2049 | let logit_bias = {}; |
| 2110 | 2050 | const isClaude = oai_settings.chat_completion_source == chat_completion_sources.CLAUDE; |
| 2111 | 2051 | const isOpenRouter = oai_settings.chat_completion_source == chat_completion_sources.OPENROUTER; |
| 2112 | - const isScale = oai_settings.chat_completion_source == chat_completion_sources.SCALE; | |
| 2113 | 2052 | const isGoogle = oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE; |
| 2114 | 2053 | const isVertexAI = oai_settings.chat_completion_source == chat_completion_sources.VERTEXAI; |
| 2115 | 2054 | const isOAI = oai_settings.chat_completion_source == chat_completion_sources.OPENAI; |
| @@ -2128,11 +2067,11 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } = | ||
| 2128 | 2067 | const isQuiet = type === 'quiet'; |
| 2129 | 2068 | const isImpersonate = type === 'impersonate'; |
| 2130 | 2069 | const isContinue = type === 'continue'; |
| 2131 | 2070 | const stream = oai_settings.stream_openai && !isQuiet && !isScale && !(isOAI && ['o1-2024-12-17', 'o1'].includes(oai_settings.openai_model)); |
| 2132 | 2071 | const useLogprobs = !!power_user.request_token_probabilities; |
| 2133 | 2072 | const canMultiSwipe = oai_settings.n > 1 && !isContinue && !isImpersonate && !isQuiet && (isOAI || isCustom || isXAI || isAimlapi); |
| 2134 | 2073 | |
| 2135 | 2074 | const logitBiasSources = [chat_completion_sources.OPENAI, chat_completion_sources.OPENROUTER, chat_completion_sources.SCALE, chat_completion_sources.CUSTOM]; |
| 2136 | 2075 | if (oai_settings.bias_preset_selected |
| 2137 | 2076 | && logitBiasSources.includes(oai_settings.chat_completion_source) |
| 2138 | 2077 | && Array.isArray(oai_settings.bias_presets[oai_settings.bias_preset_selected]) |
| @@ -2145,10 +2084,6 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } = | ||
| 2145 | 2084 | logit_bias = undefined; |
| 2146 | 2085 | } |
| 2147 | 2086 | |
| 2148 | - if (isScale && oai_settings.use_alt_scale) { | |
| 2149 | - return sendAltScaleRequest(messages, logit_bias, signal, type); | |
| 2150 | - } | |
| 2151 | - | |
| 2152 | 2087 | const model = getChatCompletionModel(); |
| 2153 | 2088 | const generate_data = { |
| 2154 | 2089 | 'messages': messages, |
| @@ -2230,10 +2165,6 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } = | ||
| 2230 | 2165 | } |
| 2231 | 2166 | } |
| 2232 | 2167 | |
| 2233 | - if (isScale) { | |
| 2234 | - generate_data['api_url_scale'] = oai_settings.api_url_scale; | |
| 2235 | - } | |
| 2236 | - | |
| 2237 | 2168 | if (isGoogle || isVertexAI) { |
| 2238 | 2169 | const stopStringsLimit = 5; |
| 2239 | 2170 | generate_data['top_k'] = Number(oai_settings.top_k_openai); |
| @@ -3446,7 +3377,6 @@ function loadOpenAISettings(data, settings) { | ||
| 3446 | 3377 | oai_settings.google_model = settings.google_model ?? default_settings.google_model; |
| 3447 | 3378 | oai_settings.vertexai_model = settings.vertexai_model ?? default_settings.vertexai_model; |
| 3448 | 3379 | 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; | |
| 3450 | 3380 | oai_settings.show_external_models = settings.show_external_models ?? default_settings.show_external_models; |
| 3451 | 3381 | oai_settings.proxy_password = settings.proxy_password ?? default_settings.proxy_password; |
| 3452 | 3382 | oai_settings.assistant_prefill = settings.assistant_prefill ?? default_settings.assistant_prefill; |
| @@ -3495,9 +3425,7 @@ function loadOpenAISettings(data, settings) { | ||
| 3495 | 3425 | if (settings.vertexai_auth_mode !== undefined) oai_settings.vertexai_auth_mode = settings.vertexai_auth_mode; |
| 3496 | 3426 | if (settings.vertexai_region !== undefined) oai_settings.vertexai_region = settings.vertexai_region; |
| 3497 | 3427 | 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(); } | |
| 3499 | 3428 | $('#stream_toggle').prop('checked', oai_settings.stream_openai); |
| 3500 | - $('#api_url_scale').val(oai_settings.api_url_scale); | |
| 3501 | 3429 | $('#openai_proxy_password').val(oai_settings.proxy_password); |
| 3502 | 3430 | $('#claude_assistant_prefill').val(oai_settings.assistant_prefill); |
| 3503 | 3431 | $('#claude_assistant_impersonation').val(oai_settings.assistant_impersonation); |
| @@ -3558,7 +3486,6 @@ function loadOpenAISettings(data, settings) { | ||
| 3558 | 3486 | // Don't display Service Account JSON in textarea - it's stored in backend secrets |
| 3559 | 3487 | $('#vertexai_service_account_json').val(''); |
| 3560 | 3488 | updateVertexAIServiceAccountStatus(); |
| 3561 | - $('#scale-alt').prop('checked', oai_settings.use_alt_scale); | |
| 3562 | 3489 | $('#openrouter_use_fallback').prop('checked', oai_settings.openrouter_use_fallback); |
| 3563 | 3490 | $('#openrouter_group_models').prop('checked', oai_settings.openrouter_group_models); |
| 3564 | 3491 | $('#openrouter_allow_fallbacks').prop('checked', oai_settings.openrouter_allow_fallbacks); |
| @@ -3701,7 +3628,6 @@ function setContinuePostfixControls() { | ||
| 3701 | 3628 | |
| 3702 | 3629 | async function getStatusOpen() { |
| 3703 | 3630 | const noValidateSources = [ |
| 3704 | - chat_completion_sources.SCALE, | |
| 3705 | 3631 | chat_completion_sources.CLAUDE, |
| 3706 | 3632 | chat_completion_sources.AI21, |
| 3707 | 3633 | chat_completion_sources.VERTEXAI, |
| @@ -3851,7 +3777,6 @@ async function saveOpenAIPreset(name, settings, triggerUi = true) { | ||
| 3851 | 3777 | stream_openai: settings.stream_openai, |
| 3852 | 3778 | prompts: settings.prompts, |
| 3853 | 3779 | prompt_order: settings.prompt_order, |
| 3854 | - api_url_scale: settings.api_url_scale, | |
| 3855 | 3780 | show_external_models: settings.show_external_models, |
| 3856 | 3781 | assistant_prefill: settings.assistant_prefill, |
| 3857 | 3782 | assistant_impersonation: settings.assistant_impersonation, |
| @@ -3860,7 +3785,6 @@ async function saveOpenAIPreset(name, settings, triggerUi = true) { | ||
| 3860 | 3785 | vertexai_auth_mode: settings.vertexai_auth_mode, |
| 3861 | 3786 | vertexai_region: settings.vertexai_region, |
| 3862 | 3787 | vertexai_express_project_id: settings.vertexai_express_project_id, |
| 3863 | - use_alt_scale: settings.use_alt_scale, | |
| 3864 | 3788 | squash_system_messages: settings.squash_system_messages, |
| 3865 | 3789 | image_inlining: settings.image_inlining, |
| 3866 | 3790 | inline_image_quality: settings.inline_image_quality, |
| @@ -4663,17 +4587,6 @@ async function onModelChange() { | ||
| 4663 | 4587 | oai_settings.xai_model = value; |
| 4664 | 4588 | } |
| 4665 | 4589 | |
| 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 | - | |
| 4677 | 4590 | if ([chat_completion_sources.MAKERSUITE, chat_completion_sources.VERTEXAI].includes(oai_settings.chat_completion_source)) { |
| 4678 | 4591 | if (oai_settings.max_context_unlocked) { |
| 4679 | 4592 | $('#openai_max_context').attr('max', max_2mil); |
| @@ -5003,34 +4916,6 @@ async function onConnectButtonClick(e) { | ||
| 5003 | 4916 | } |
| 5004 | 4917 | } |
| 5005 | 4918 | |
| 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 | - | |
| 5034 | 4919 | if (oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE) { |
| 5035 | 4920 | const api_key_makersuite = String($('#api_key_makersuite').val()).trim(); |
| 5036 | 4921 | |
| @@ -5250,9 +5135,6 @@ function toggleChatCompletionForms() { | ||
| 5250 | 5135 | $('#model_openai_select').trigger('change'); |
| 5251 | 5136 | } |
| 5252 | 5137 | } |
| 5253 | - else if (oai_settings.chat_completion_source == chat_completion_sources.SCALE) { | |
| 5254 | - $('#model_scale_select').trigger('change'); | |
| 5255 | - } | |
| 5256 | 5138 | else if (oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE) { |
| 5257 | 5139 | $('#model_google_select').trigger('change'); |
| 5258 | 5140 | } |
| @@ -5338,16 +5220,6 @@ function onProxyPasswordShowClick() { | ||
| 5338 | 5220 | $(this).toggleClass('fa-eye-slash fa-eye'); |
| 5339 | 5221 | } |
| 5340 | 5222 | |
| 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 | - | |
| 5351 | 5223 | async function onCustomizeParametersClick() { |
| 5352 | 5224 | const template = $(await renderTemplateAsync('customEndpointAdditionalParameters')); |
| 5353 | 5225 | |
| @@ -5762,12 +5634,6 @@ export function initOpenAI() { | ||
| 5762 | 5634 | |
| 5763 | 5635 | $('#test_api_button').on('click', testApiConnection); |
| 5764 | 5636 | |
| 5765 | - $('#scale-alt').on('change', function () { | |
| 5766 | - oai_settings.use_alt_scale = !!$('#scale-alt').prop('checked'); | |
| 5767 | - saveSettingsDebounced(); | |
| 5768 | - updateScaleForm(); | |
| 5769 | - }); | |
| 5770 | - | |
| 5771 | 5637 | $('#temp_openai').on('input', function () { |
| 5772 | 5638 | oai_settings.temp_openai = Number($(this).val()); |
| 5773 | 5639 | $('#temp_counter_openai').val(Number($(this).val()).toFixed(2)); |
| @@ -5982,11 +5848,6 @@ export function initOpenAI() { | ||
| 5982 | 5848 | saveSettingsDebounced(); |
| 5983 | 5849 | }); |
| 5984 | 5850 | |
| 5985 | - $('#api_url_scale').on('input', function () { | |
| 5986 | - oai_settings.api_url_scale = String($(this).val()); | |
| 5987 | - saveSettingsDebounced(); | |
| 5988 | - }); | |
| 5989 | - | |
| 5990 | 5851 | $('#openai_show_external_models').on('input', function () { |
| 5991 | 5852 | oai_settings.show_external_models = !!$(this).prop('checked'); |
| 5992 | 5853 | $('#openai_external_category').toggle(oai_settings.show_external_models); |
| @@ -6220,7 +6081,6 @@ export function initOpenAI() { | ||
| 6220 | 6081 | $('#openai_reverse_proxy').on('input', onReverseProxyInput); |
| 6221 | 6082 | $('#model_openai_select').on('change', onModelChange); |
| 6222 | 6083 | $('#model_claude_select').on('change', onModelChange); |
| 6223 | - $('#model_scale_select').on('change', onModelChange); | |
| 6224 | 6084 | $('#model_google_select').on('change', onModelChange); |
| 6225 | 6085 | $('#model_vertexai_select').on('change', onModelChange); |
| 6226 | 6086 | $('#vertexai_auth_mode').on('change', onVertexAIAuthModeChange); |
| @@ -28,9 +28,7 @@ export const SECRET_KEYS = { | ||
| 28 | 28 | LIBRE_URL: 'libre_url', |
| 29 | 29 | LINGVA_URL: 'lingva_url', |
| 30 | 30 | OPENROUTER: 'api_key_openrouter', |
| 31 | - SCALE: 'api_key_scale', | |
| 32 | 31 | AI21: 'api_key_ai21', |
| 33 | - SCALE_COOKIE: 'scale_cookie', | |
| 34 | 32 | ONERING_URL: 'oneringtranslator_url', |
| 35 | 33 | DEEPLX_URL: 'deeplx_url', |
| 36 | 34 | MAKERSUITE: 'api_key_makersuite', |
| @@ -73,9 +71,7 @@ const FRIENDLY_NAMES = { | ||
| 73 | 71 | [SECRET_KEYS.NOVEL]: 'NovelAI', |
| 74 | 72 | [SECRET_KEYS.CLAUDE]: 'Claude', |
| 75 | 73 | [SECRET_KEYS.OPENROUTER]: 'OpenRouter', |
| 76 | - [SECRET_KEYS.SCALE]: 'Scale', | |
| 77 | 74 | [SECRET_KEYS.AI21]: 'AI21', |
| 78 | - [SECRET_KEYS.SCALE_COOKIE]: 'Scale (Cookie)', | |
| 79 | 75 | [SECRET_KEYS.MAKERSUITE]: 'Google AI Studio', |
| 80 | 76 | [SECRET_KEYS.VERTEXAI]: 'Google Vertex AI (Express Mode)', |
| 81 | 77 | [SECRET_KEYS.VLLM]: 'vLLM', |
| @@ -125,9 +121,7 @@ const INPUT_MAP = { | ||
| 125 | 121 | [SECRET_KEYS.NOVEL]: '#api_key_novel', |
| 126 | 122 | [SECRET_KEYS.CLAUDE]: '#api_key_claude', |
| 127 | 123 | [SECRET_KEYS.OPENROUTER]: '.api_key_openrouter', |
| 128 | - [SECRET_KEYS.SCALE]: '#api_key_scale', | |
| 129 | 124 | [SECRET_KEYS.AI21]: '#api_key_ai21', |
| 130 | - [SECRET_KEYS.SCALE_COOKIE]: '#scale_cookie', | |
| 131 | 125 | [SECRET_KEYS.MAKERSUITE]: '#api_key_makersuite', |
| 132 | 126 | [SECRET_KEYS.VERTEXAI]: '#api_key_vertexai', |
| 133 | 127 | [SECRET_KEYS.VLLM]: '#api_key_vllm', |
| @@ -191,12 +185,6 @@ export function resolveSecretKey() { | ||
| 191 | 185 | } |
| 192 | 186 | } |
| 193 | 187 | |
| 194 | - if (chatCompletionSource === chat_completion_sources.SCALE) { | |
| 195 | - return chatCompletionSettings.use_alt_scale | |
| 196 | - ? SECRET_KEYS.SCALE_COOKIE | |
| 197 | - : SECRET_KEYS.SCALE; | |
| 198 | - } | |
| 199 | - | |
| 200 | 188 | const [key] = Object.entries(chat_completion_sources).find(([, value]) => value === chatCompletionSource) ?? [null]; |
| 201 | 189 | if (key && SECRET_KEYS[key]) { |
| 202 | 190 | return SECRET_KEYS[key]; |
| @@ -586,11 +586,6 @@ export function getTokenizerModel() { | ||
| 586 | 586 | const nemoTokenizer = 'nemo'; |
| 587 | 587 | const deepseekTokenizer = 'deepseek'; |
| 588 | 588 | |
| 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 | - | |
| 594 | 589 | if (oai_settings.chat_completion_source == chat_completion_sources.DEEPSEEK) { |
| 595 | 590 | return deepseekTokenizer; |
| 596 | 591 | } |
| @@ -164,7 +164,6 @@ export const GEMINI_SAFETY = [ | ||
| 164 | 164 | export const CHAT_COMPLETION_SOURCES = { |
| 165 | 165 | OPENAI: 'openai', |
| 166 | 166 | CLAUDE: 'claude', |
| 167 | - SCALE: 'scale', | |
| 168 | 167 | OPENROUTER: 'openrouter', |
| 169 | 168 | AI21: 'ai21', |
| 170 | 169 | MAKERSUITE: 'makersuite', |
| @@ -276,58 +276,6 @@ async function sendClaudeRequest(request, response) { | ||
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | /** |
| 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 | -/** | |
| 331 | 279 | * Sends a request to Google AI API. |
| 332 | 280 | * @param {express.Request} request Express request |
| 333 | 281 | * @param {express.Response} response Express response |
| @@ -1492,7 +1440,6 @@ router.post('/generate', function (request, response) { | ||
| 1492 | 1440 | |
| 1493 | 1441 | switch (request.body.chat_completion_source) { |
| 1494 | 1442 | case CHAT_COMPLETION_SOURCES.CLAUDE: return sendClaudeRequest(request, response); |
| 1495 | - case CHAT_COMPLETION_SOURCES.SCALE: return sendScaleRequest(request, response); | |
| 1496 | 1443 | case CHAT_COMPLETION_SOURCES.AI21: return sendAI21Request(request, response); |
| 1497 | 1444 | case CHAT_COMPLETION_SOURCES.MAKERSUITE: return sendMakerSuiteRequest(request, response); |
| 1498 | 1445 | case CHAT_COMPLETION_SOURCES.VERTEXAI: return sendMakerSuiteRequest(request, response); |
| @@ -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 | -}); | |
| @@ -21,9 +21,7 @@ export const SECRET_KEYS = { | ||
| 21 | 21 | LIBRE_URL: 'libre_url', |
| 22 | 22 | LINGVA_URL: 'lingva_url', |
| 23 | 23 | OPENROUTER: 'api_key_openrouter', |
| 24 | - SCALE: 'api_key_scale', | |
| 25 | 24 | AI21: 'api_key_ai21', |
| 26 | - SCALE_COOKIE: 'scale_cookie', | |
| 27 | 25 | ONERING_URL: 'oneringtranslator_url', |
| 28 | 26 | DEEPLX_URL: 'deeplx_url', |
| 29 | 27 | MAKERSUITE: 'api_key_makersuite', |
| @@ -43,7 +43,6 @@ import { router as openRouterRouter } from './endpoints/openrouter.js'; | ||
| 43 | 43 | import { router as chatCompletionsRouter } from './endpoints/backends/chat-completions.js'; |
| 44 | 44 | import { router as koboldRouter } from './endpoints/backends/kobold.js'; |
| 45 | 45 | import { router as textCompletionsRouter } from './endpoints/backends/text-completions.js'; |
| 46 | -import { router as scaleAltRouter } from './endpoints/backends/scale-alt.js'; | |
| 47 | 46 | import { router as speechRouter } from './endpoints/speech.js'; |
| 48 | 47 | import { router as azureRouter } from './endpoints/azure.js'; |
| 49 | 48 | import { router as dataMaidRouter } from './endpoints/data-maid.js'; |
| @@ -171,7 +170,6 @@ export function setupPrivateEndpoints(app) { | ||
| 171 | 170 | app.use('/api/openrouter', openRouterRouter); |
| 172 | 171 | app.use('/api/backends/kobold', koboldRouter); |
| 173 | 172 | app.use('/api/backends/chat-completions', chatCompletionsRouter); |
| 174 | - app.use('/api/backends/scale-alt', scaleAltRouter); | |
| 175 | 173 | app.use('/api/speech', speechRouter); |
| 176 | 174 | app.use('/api/azure', azureRouter); |
| 177 | 175 | app.use('/api/data-maid', dataMaidRouter); |