mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Deprecated forced instruct on OpenRouter for Chat Completion
This commit is contained in:
@ -5,7 +5,6 @@
|
||||
"windowai_model": "",
|
||||
"openrouter_model": "OR_Website",
|
||||
"openrouter_use_fallback": false,
|
||||
"openrouter_force_instruct": false,
|
||||
"openrouter_group_models": false,
|
||||
"openrouter_sort_models": "alphabetically",
|
||||
"ai21_model": "jamba-1.5-large",
|
||||
|
@ -2765,22 +2765,10 @@
|
||||
<span data-i18n="Allow fallback providers">Allow fallback providers</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="marginTopBot5">
|
||||
<label for="openrouter_force_instruct" class="checkbox_label">
|
||||
<input id="openrouter_force_instruct" type="checkbox" />
|
||||
<span class="flex-container alignItemsBaseline" title="This option is outdated and will be removed in the future. To use instruct formatting, please switch to OpenRouter under Text Completion API instead." data-i18n="[title]openrouter_force_instruct">
|
||||
<i class="fa-solid fa-circle-exclamation neutral_warning"></i>
|
||||
<b data-i18n="LEGACY">LEGACY</b>
|
||||
</span>
|
||||
<span data-i18n="Force Instruct Mode formatting">Force Instruct Mode formatting</span>
|
||||
</label>
|
||||
<div class="toggle-description justifyLeft wide100p">
|
||||
<span data-i18n="Force_Instruct_Mode_formatting_Description">
|
||||
If both Instruct Mode and this are enabled, the prompt will be formatted by SillyTavern using the current
|
||||
advanced formatting settings (except instruct System Prompt). If disabled, the prompt will be formatted by OpenRouter.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<small class="marginTopBot5">
|
||||
<i class="fa-solid fa-lightbulb"></i>
|
||||
<span>To use instruct formatting, switch to OpenRouter under Text Completion API.</span>
|
||||
</small>
|
||||
</form>
|
||||
<form id="scale_form" data-source="scale" action="javascript:void(null);" method="post" enctype="multipart/form-data">
|
||||
<div id="normal_scale_form">
|
||||
|
@ -381,10 +381,6 @@
|
||||
"Group by vendors Description": "ضع نماذج OpenAI في مجموعة واحدة، والنماذج الإنسانية في مجموعة أخرى، وما إلى ذلك. ويمكن دمجها مع الفرز.",
|
||||
"Allow fallback routes": "السماح بمسارات الاحتياط",
|
||||
"Allow fallback routes Description": "يختار النموذج البديل تلقائيًا إذا كان النموذج المحدد غير قادر على تلبية طلبك.",
|
||||
"openrouter_force_instruct": "هذا الخيار قديم وسيتم إزالته في المستقبل. لاستخدام تنسيق التعليمات، يرجى التبديل إلى OpenRouter ضمن Text Completion API بدلاً من ذلك.",
|
||||
"LEGACY": "إرث",
|
||||
"Force Instruct Mode formatting": "فرض تنسيق وضع التعليمات",
|
||||
"Force_Instruct_Mode_formatting_Description": "إذا تم تمكين وضع التعليمات وهذا، فسيتم تنسيق المطالبة بواسطة SillyTavern باستخدام التيار\n إعدادات التنسيق المتقدمة (باستثناء توجيه موجه النظام). إذا تم تعطيله، فسيتم تنسيق المطالبة بواسطة OpenRouter.",
|
||||
"Scale API Key": "مفتاح API لـ Scale",
|
||||
"Clear your cookie": "امسح ملف تعريف الارتباط الخاص بك",
|
||||
"Alt Method": "طريقة بديلة",
|
||||
|
@ -381,10 +381,6 @@
|
||||
"Group by vendors Description": "Platzieren Sie OpenAI-Modelle in einer Gruppe, anthropogene Modelle in einer anderen Gruppe usw. Kann mit Sortierung kombiniert werden.",
|
||||
"Allow fallback routes": "Fallback-Routen zulassen",
|
||||
"Allow fallback routes Description": "Das alternative Modell wird automatisch ausgewählt, wenn das ausgewählte Modell Ihre Anfrage nicht erfüllen kann.",
|
||||
"openrouter_force_instruct": "Diese Option ist veraltet und wird in Zukunft entfernt. Um die Formatierung mit Anweisungen zu verwenden, wechseln Sie stattdessen zu OpenRouter unter Text Completion API.",
|
||||
"LEGACY": "VERMÄCHTNIS",
|
||||
"Force Instruct Mode formatting": "Formatierung im Force Instruct Mode",
|
||||
"Force_Instruct_Mode_formatting_Description": "Wenn sowohl der Anweisungsmodus als auch dieser aktiviert sind, wird die Eingabeaufforderung von SillyTavern mit den aktuellen erweiterten Formatierungseinstellungen formatiert (außer „Anweisungssystem-Eingabeaufforderung“). Wenn deaktiviert, wird die Eingabeaufforderung von OpenRouter formatiert.",
|
||||
"Scale API Key": "Scale API-Schlüssel",
|
||||
"Clear your cookie": "Löschen Sie Ihre Cookies",
|
||||
"Alt Method": "Alternative Methode",
|
||||
|
@ -381,10 +381,6 @@
|
||||
"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.",
|
||||
"Allow fallback routes": "Permitir rutas de respaldo",
|
||||
"Allow fallback routes Description": "El modelo alternativo se elige automáticamente si el modelo seleccionado no puede cumplir con tu solicitud.",
|
||||
"openrouter_force_instruct": "Esta opción está desactualizada y se eliminará en el futuro. Para utilizar el formato de instrucciones, cambie a OpenRouter en API de finalización de texto.",
|
||||
"LEGACY": "LEGADO",
|
||||
"Force Instruct Mode formatting": "Forzar formato en modo de instrucción",
|
||||
"Force_Instruct_Mode_formatting_Description": "Si tanto el modo de instrucción como este están habilitados, SillyTavern formateará el mensaje usando el formato actual.\n configuraciones de formato avanzadas (excepto instrucciones del mensaje del sistema). Si está deshabilitado, OpenRouter formateará el mensaje.",
|
||||
"Scale API Key": "Clave API de Scale",
|
||||
"Clear your cookie": "Limpia tu cookie",
|
||||
"Alt Method": "Método alternativo",
|
||||
|
@ -381,10 +381,6 @@
|
||||
"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.",
|
||||
"Allow fallback routes": "Autoriser les itinéraires de secours",
|
||||
"Allow fallback routes Description": "Le modèle alternatif est automatiquement sélectionné si le modèle choisi ne peut pas répondre à votre demande.",
|
||||
"openrouter_force_instruct": "Cette option est obsolète et sera supprimée à l'avenir. Pour utiliser le formatage des instructions, veuillez plutôt passer à OpenRouter sous API de saisie semi-automatique de texte.",
|
||||
"LEGACY": "HÉRITAGE",
|
||||
"Force Instruct Mode formatting": "Forcer le formatage du mode instruction",
|
||||
"Force_Instruct_Mode_formatting_Description": "Si le mode Instruct et celui-ci sont activés, l'invite sera formatée par SillyTavern en utilisant le mode actuel.\n paramètres de formatage avancés (à l'exception de l'invite système). Si elle est désactivée, l'invite sera formatée par OpenRouter.",
|
||||
"Scale API Key": "Clé API Scale",
|
||||
"Clear your cookie": "Effacer vos cookies",
|
||||
"Alt Method": "Méthode alternative",
|
||||
|
@ -381,10 +381,6 @@
|
||||
"Group by vendors Description": "Setjið OpenAI módel í einn hóp, Anthropic módel í annan hóp osfrv. Hægt að sameina við flokkun.",
|
||||
"Allow fallback routes": "Leyfa bakfallssvæði",
|
||||
"Allow fallback routes Description": "Veldur hlutleysa vélbúnaðarinn við val þinn ef valið módel getur ekki uppfyllt beiðni þína.",
|
||||
"openrouter_force_instruct": "Þessi valkostur er úreltur og verður fjarlægður í framtíðinni. Til að nota leiðbeiningarsnið skaltu skipta yfir í OpenRouter undir Text Completion API í staðinn.",
|
||||
"LEGACY": "ARFIÐ",
|
||||
"Force Instruct Mode formatting": "Force Instruct Mode formatting",
|
||||
"Force_Instruct_Mode_formatting_Description": "Ef bæði leiðbeiningarhamur og þessi eru virkjuð, verður kvaðningurinn sniðinn af SillyTavern með því að nota núverandi\n háþróaðar sniðstillingar (nema leiðbeiningar um System Prompt). Ef slökkt er á henni verður hvetjan sniðin af OpenRouter.",
|
||||
"Scale API Key": "Lykill API fyrir Scale",
|
||||
"Clear your cookie": "Hreinsaðu kökuna þína",
|
||||
"Alt Method": "Aðferð Bakmenn",
|
||||
|
@ -381,10 +381,6 @@
|
||||
"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.",
|
||||
"Allow fallback routes": "Consenti percorsi alternativi",
|
||||
"Allow fallback routes Description": "Il modello alternativo viene automaticamente scelto se il modello selezionato non può soddisfare la tua richiesta.",
|
||||
"openrouter_force_instruct": "Questa opzione è obsoleta e verrà rimossa in futuro. Per usare la formattazione instruct, passa a OpenRouter in Text Completion API.",
|
||||
"LEGACY": "EREDITÀ",
|
||||
"Force Instruct Mode formatting": "Forza la formattazione della modalità istruzione",
|
||||
"Force_Instruct_Mode_formatting_Description": "Se sia la modalità Instruct che questa sono abilitate, il prompt verrà formattato da SillyTavern utilizzando il file current\n impostazioni di formattazione avanzate (ad eccezione del prompt di sistema). Se disabilitato, il prompt verrà formattato da OpenRouter.",
|
||||
"Scale API Key": "Chiave API di Scale",
|
||||
"Clear your cookie": "Cancella il tuo cookie",
|
||||
"Alt Method": "Metodo alternativo",
|
||||
|
@ -381,10 +381,6 @@
|
||||
"Group by vendors Description": "OpenAI モデルを 1 つのグループに、Anthropic モデルを別のグループに配置するなどします。ソートと組み合わせることができます。",
|
||||
"Allow fallback routes": "フォールバックルートを許可",
|
||||
"Allow fallback routes Description": "選択したモデルが要求を満たせない場合、代替モデルが自動的に選択されます。",
|
||||
"openrouter_force_instruct": "このオプションは古く、将来削除される予定です。指示されたフォーマットを使用するには、代わりにテキスト補完 API の OpenRouter に切り替えてください。",
|
||||
"LEGACY": "遺産",
|
||||
"Force Instruct Mode formatting": "強制指示モードのフォーマット",
|
||||
"Force_Instruct_Mode_formatting_Description": "Instruct Mode とこれが両方とも有効になっている場合、プロンプトは SillyTavern によって現在の高度なフォーマット設定 (instruct System Prompt を除く) を使用してフォーマットされます。無効になっている場合、プロンプトは OpenRouter によってフォーマットされます。",
|
||||
"Scale API Key": "ScaleのAPIキー",
|
||||
"Clear your cookie": "クッキーを消去する",
|
||||
"Alt Method": "代替手法",
|
||||
|
@ -381,10 +381,6 @@
|
||||
"Group by vendors Description": "OpenAI 모델을 한 그룹에 넣고, Anthropic 모델을 다른 그룹에 두는 등 정렬을 통해 결합할 수 있습니다.",
|
||||
"Allow fallback routes": "대체 경로 허용",
|
||||
"Allow fallback routes Description": "선택한 모델이 요청을 처리할 수 없는 경우 대체 모델이 자동으로 선택됩니다.",
|
||||
"openrouter_force_instruct": "이 옵션은 오래되었으며 향후 제거될 예정입니다. 지시 형식을 사용하려면 대신 Text Completion API에서 OpenRouter로 전환하세요.",
|
||||
"LEGACY": "유산",
|
||||
"Force Instruct Mode formatting": "강제 지시 모드 포맷",
|
||||
"Force_Instruct_Mode_formatting_Description": "Instruct Mode와 이 모드가 모두 활성화된 경우 프롬프트는 SillyTavern에 의해 현재 형식을 사용하여 형식화됩니다.\n 고급 형식 설정(시스템 프롬프트 지시 제외) 비활성화된 경우 프롬프트는 OpenRouter에 의해 형식화됩니다.",
|
||||
"Scale API Key": "Scale API 키",
|
||||
"Clear your cookie": "쿠키 지우기",
|
||||
"Alt Method": "대체 방법",
|
||||
|
@ -381,10 +381,6 @@
|
||||
"Group by vendors Description": "Plaats OpenAI-modellen in één groep, antropische modellen in een andere groep, enz. Kan worden gecombineerd met sorteren.",
|
||||
"Allow fallback routes": "Fallback-routes toestaan",
|
||||
"Allow fallback routes Description": "Het alternatieve model wordt automatisch gekozen als het geselecteerde model niet aan uw verzoek kan voldoen.",
|
||||
"openrouter_force_instruct": "Deze optie is verouderd en zal in de toekomst worden verwijderd. Om instructie-opmaak te gebruiken, schakelt u in plaats daarvan over naar OpenRouter onder Text Completion API.",
|
||||
"LEGACY": "NALATENSCHAP",
|
||||
"Force Instruct Mode formatting": "Forceer de opmaak van de instructiemodus",
|
||||
"Force_Instruct_Mode_formatting_Description": "Als zowel de Instruct-modus als deze zijn ingeschakeld, wordt de prompt door SillyTavern geformatteerd met behulp van de current\n geavanceerde opmaakinstellingen (behalve de opdracht Systeemprompt). Indien uitgeschakeld, wordt de prompt geformatteerd door OpenRouter.",
|
||||
"Scale API Key": "Scale API-sleutel",
|
||||
"Clear your cookie": "Wis uw cookie",
|
||||
"Alt Method": "Alternatieve methode",
|
||||
|
@ -381,10 +381,6 @@
|
||||
"Group by vendors Description": "Coloque os modelos OpenAI em um grupo, os modelos antrópicos em outro grupo, etc.",
|
||||
"Allow fallback routes": "Permitir rotas de fallback",
|
||||
"Allow fallback routes Description": "O modelo alternativo será escolhido automaticamente se o modelo selecionado não puder atender à sua solicitação.",
|
||||
"openrouter_force_instruct": "Esta opção está desatualizada e será removida no futuro. Para usar a formatação de instruções, mude para OpenRouter em Text Completion API.",
|
||||
"LEGACY": "LEGADO",
|
||||
"Force Instruct Mode formatting": "Forçar formatação do modo de instrução",
|
||||
"Force_Instruct_Mode_formatting_Description": "Se o Modo Instruir e este estiverem habilitados, o prompt será formatado pelo SillyTavern usando o atual\n configurações avançadas de formatação (exceto instruir o prompt do sistema). Se desativado, o prompt será formatado pelo OpenRouter.",
|
||||
"Scale API Key": "Chave da API Scale",
|
||||
"Clear your cookie": "Limpe seu cookie",
|
||||
"Alt Method": "Método Alternativo",
|
||||
|
@ -732,8 +732,6 @@
|
||||
"Context Size": "По размеру контекста",
|
||||
"Group by vendors": "Сгруппировать по владельцу",
|
||||
"Group by vendors Description": "Модели от OpenAI попадут в одну группу, от Anthropic - в другую, и т.д. Можно комбинировать с сортировкой.",
|
||||
"LEGACY": "УСТАР.",
|
||||
"Force Instruct Mode formatting": "Включить форматирование для Instruct-режима",
|
||||
"Allow Jailbreak": "Разрешить джейлбрейк",
|
||||
"System Prompt Wrapping": "Обрамление для системного промпта",
|
||||
"System Prompt Prefix": "Префикс системного промпта",
|
||||
@ -1270,8 +1268,6 @@
|
||||
"vLLM Model": "Модель vLLM",
|
||||
"Aphrodite Model": "Модель Aphrodite",
|
||||
"Peek a password": "Посмотреть пароль",
|
||||
"openrouter_force_instruct": "This option is outdated and will be removed in the future. To use instruct formatting, please switch to OpenRouter under Text Completion API instead.",
|
||||
"Force_Instruct_Mode_formatting_Description": "If both Instruct Mode and this are enabled, the prompt will be formatted by SillyTavern using the current\n advanced formatting settings (except instruct System Prompt). If disabled, the prompt will be formatted by OpenRouter.",
|
||||
"Clear your cookie": "Clear your cookie",
|
||||
"Add Chat Start and Example Separator to a list of stopping strings.": "Использовать Начало чата и Разделитель примеров сообщений в качестве стоп-строк.",
|
||||
"context_allow_jailbreak": "Если в карточке есть джейлбрейк И ПРИ ЭТОМ включена опция \"Приоритет джейлбрейку из карточки персонажа\", то этот джейлбрейк добавляется в конец промпта.\nНЕ РЕКОМЕНДУЕТСЯ ДЛЯ МОДЕЛЕЙ TEXT COMPLETION, МОЖЕТ ПОРТИТЬ ВЫХОДНОЙ ТЕКСТ.",
|
||||
|
@ -381,10 +381,6 @@
|
||||
"Group by vendors Description": "Помістіть моделі OpenAI в одну групу, моделі Anthropic в іншу групу тощо. Можна поєднати з сортуванням.",
|
||||
"Allow fallback routes": "Дозволити резервні маршрути",
|
||||
"Allow fallback routes Description": "Автоматично вибирає альтернативну модель, якщо вибрана модель не може задовольнити ваш запит.",
|
||||
"openrouter_force_instruct": "Цей параметр застарів і буде видалено в майбутньому. Щоб використовувати форматування інструкцій, перейдіть натомість до OpenRouter у розділі Text Completion API.",
|
||||
"LEGACY": "СПАДОК",
|
||||
"Force Instruct Mode formatting": "Примусове форматування в режимі вказівок",
|
||||
"Force_Instruct_Mode_formatting_Description": "Якщо ввімкнути обидва режими Instruction і цей режим, підказка буде відформатована SillyTavern за допомогою поточного\n розширені параметри форматування (крім системного запиту). Якщо вимкнено, запит буде відформатовано OpenRouter.",
|
||||
"Scale API Key": "Ключ API для Scale",
|
||||
"Clear your cookie": "Очистіть файл cookie",
|
||||
"Alt Method": "Альтернативний метод",
|
||||
|
@ -381,10 +381,6 @@
|
||||
"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.",
|
||||
"Allow fallback routes": "Cho phép các tuyến đường phụ",
|
||||
"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.",
|
||||
"openrouter_force_instruct": "Tùy chọn này đã lỗi thời và sẽ bị xóa trong tương lai. Để sử dụng định dạng hướng dẫn, vui lòng chuyển sang OpenRouter trong API hoàn thành văn bản.",
|
||||
"LEGACY": "Cũ",
|
||||
"Force Instruct Mode formatting": "Buộc định dạng Instruct Mode",
|
||||
"Force_Instruct_Mode_formatting_Description": "Nếu cả Instruct Mode và chế độ này được bật, Prompt sẽ được SillyTavern định dạng bằng cách sử dụng\n cài đặt định dạng nâng cao (ngoại trừ hướng dẫn System Nhắc). Nếu bị tắt, Prompt sẽ được OpenRouter định dạng.",
|
||||
"Scale API Key": "Scale API Key",
|
||||
"Clear your cookie": "Xóa cookie",
|
||||
"Alt Method": "Phương pháp thay thế",
|
||||
|
@ -397,10 +397,6 @@
|
||||
"Context Size": "上下文大小",
|
||||
"Group by vendors": "按供应商分组",
|
||||
"Group by vendors Description": "将 OpenAI 模型放在一组,将 Anthropic 模型放在另一组,等等。可以与排序结合。",
|
||||
"openrouter_force_instruct": "此选项已过时,将来会被删除。要使用指令格式,请改用文本完成 API 下的 OpenRouter。",
|
||||
"LEGACY": "旧版",
|
||||
"Force Instruct Mode formatting": "强制指令模式格式化",
|
||||
"Force_Instruct_Mode_formatting_Description": "如果同时启用了“指示模式”和“系统提示词”,则 SillyTavern 将使用当前\n高级格式设置(指示系统提示词除外)对提示词进行格式化。如果禁用,则 OpenRouter 将对提示词进行格式化。",
|
||||
"Scale API Key": "Scale API密钥",
|
||||
"Clear your cookie": "清除你的 Cookie",
|
||||
"Alt Method": "备用方法",
|
||||
|
@ -382,10 +382,6 @@
|
||||
"Group by vendors Description": "將 OpenAI 、 Anthropic 等等的模型放各自供應商的群組中。可以與排序功能結合使用。",
|
||||
"Allow fallback routes": "允許備援路徑",
|
||||
"Allow fallback routes Description": "如果選擇的模型無法滿足要求,會自動選擇替代模型。",
|
||||
"openrouter_force_instruct": "這個選項已經過時,將來會被移除。如果要使用指令格式,請改在 Text Completion API 中選擇 OpenRouter。",
|
||||
"LEGACY": "遺留",
|
||||
"Force Instruct Mode formatting": "強制指示模式格式化",
|
||||
"Force_Instruct_Mode_formatting_Description": "如果同時啟用「指令模式」和這個選項,\nSillyTavern 會根據目前的進階格式化設定(不包括指令系統提示)來格式化提示詞。\n如果停用這個選項,提示詞將由 OpenRouter 來進行格式化。",
|
||||
"Scale API Key": "Scale API 金鑰",
|
||||
"Clear your cookie": "清除您的 Cookie",
|
||||
"Alt Method": "替代方法",
|
||||
|
@ -96,7 +96,6 @@ import {
|
||||
openai_messages_count,
|
||||
chat_completion_sources,
|
||||
getChatCompletionModel,
|
||||
isOpenRouterWithInstruct,
|
||||
proxies,
|
||||
loadProxyPresets,
|
||||
selected_proxy,
|
||||
@ -3927,8 +3926,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
||||
|
||||
if (isContinue) {
|
||||
// Coping mechanism for OAI spacing
|
||||
const isForceInstruct = isOpenRouterWithInstruct();
|
||||
if (main_api === 'openai' && !isForceInstruct && !cyclePrompt.endsWith(' ')) {
|
||||
if (main_api === 'openai' && !cyclePrompt.endsWith(' ')) {
|
||||
cyclePrompt += oai_settings.continue_postfix;
|
||||
continue_mag += oai_settings.continue_postfix;
|
||||
}
|
||||
|
@ -61,12 +61,6 @@ import {
|
||||
stringFormat,
|
||||
} from './utils.js';
|
||||
import { countTokensOpenAI, getTokenizerModel } from './tokenizers.js';
|
||||
import {
|
||||
formatInstructModeChat,
|
||||
formatInstructModeExamples,
|
||||
formatInstructModePrompt,
|
||||
formatInstructModeSystemPrompt,
|
||||
} from './instruct-mode.js';
|
||||
import { isMobile } from './RossAscends-mods.js';
|
||||
import { saveLogprobsForActiveMessage } from './logprobs.js';
|
||||
import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
|
||||
@ -263,7 +257,6 @@ const default_settings = {
|
||||
windowai_model: '',
|
||||
openrouter_model: openrouter_website_model,
|
||||
openrouter_use_fallback: false,
|
||||
openrouter_force_instruct: false,
|
||||
openrouter_group_models: false,
|
||||
openrouter_sort_models: 'alphabetically',
|
||||
openrouter_providers: [],
|
||||
@ -341,7 +334,6 @@ const oai_settings = {
|
||||
windowai_model: '',
|
||||
openrouter_model: openrouter_website_model,
|
||||
openrouter_use_fallback: false,
|
||||
openrouter_force_instruct: false,
|
||||
openrouter_group_models: false,
|
||||
openrouter_sort_models: 'alphabetically',
|
||||
openrouter_providers: [],
|
||||
@ -416,108 +408,6 @@ async function validateReverseProxy() {
|
||||
localStorage.setItem(rememberKey, String(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the Chat Completion object to an Instruct Mode prompt string.
|
||||
* @param {object[]} messages Array of messages
|
||||
* @param {string} type Generation type
|
||||
* @returns {string} Text completion prompt
|
||||
*/
|
||||
function convertChatCompletionToInstruct(messages, type) {
|
||||
const newChatPrompts = [
|
||||
substituteParams(oai_settings.new_chat_prompt),
|
||||
substituteParams(oai_settings.new_example_chat_prompt),
|
||||
substituteParams(oai_settings.new_group_chat_prompt),
|
||||
];
|
||||
messages = messages.filter(x => !newChatPrompts.includes(x.content));
|
||||
|
||||
let chatMessagesText = '';
|
||||
let systemPromptText = '';
|
||||
let examplesText = '';
|
||||
|
||||
function getPrefix(message) {
|
||||
let prefix;
|
||||
|
||||
if (message.role === 'user' || message.name === 'example_user') {
|
||||
if (selected_group) {
|
||||
prefix = '';
|
||||
} else if (message.name === 'example_user') {
|
||||
prefix = name1;
|
||||
} else {
|
||||
prefix = message.name ?? name1;
|
||||
}
|
||||
}
|
||||
|
||||
if (message.role === 'assistant' || message.name === 'example_assistant') {
|
||||
if (selected_group) {
|
||||
prefix = '';
|
||||
}
|
||||
else if (message.name === 'example_assistant') {
|
||||
prefix = name2;
|
||||
} else {
|
||||
prefix = message.name ?? name2;
|
||||
}
|
||||
}
|
||||
|
||||
return prefix;
|
||||
}
|
||||
|
||||
function toString(message) {
|
||||
if (message.role === 'system' && !message.name) {
|
||||
return message.content;
|
||||
}
|
||||
|
||||
const prefix = getPrefix(message);
|
||||
return prefix ? `${prefix}: ${message.content}` : message.content;
|
||||
}
|
||||
|
||||
const firstChatMessage = messages.findIndex(message => message.role === 'assistant' || message.role === 'user');
|
||||
const systemPromptMessages = messages.slice(0, firstChatMessage).filter(message => message.role === 'system' && !message.name);
|
||||
|
||||
if (systemPromptMessages.length) {
|
||||
systemPromptText = systemPromptMessages.map(message => message.content).join('\n');
|
||||
systemPromptText = formatInstructModeSystemPrompt(systemPromptText);
|
||||
}
|
||||
|
||||
const exampleMessages = messages.filter(x => x.role === 'system' && (x.name === 'example_user' || x.name === 'example_assistant'));
|
||||
|
||||
if (exampleMessages.length) {
|
||||
const blockHeading = power_user.context.example_separator ? (substituteParams(power_user.context.example_separator) + '\n') : '';
|
||||
const examplesArray = exampleMessages.map(m => '<START>\n' + toString(m));
|
||||
examplesText = blockHeading + formatInstructModeExamples(examplesArray, name1, name2).join('');
|
||||
}
|
||||
|
||||
const chatMessages = messages.slice(firstChatMessage);
|
||||
|
||||
if (chatMessages.length) {
|
||||
chatMessagesText = substituteParams(power_user.context.chat_start) + '\n';
|
||||
|
||||
for (const message of chatMessages) {
|
||||
const name = getPrefix(message);
|
||||
const isUser = message.role === 'user';
|
||||
const isNarrator = message.role === 'system';
|
||||
chatMessagesText += formatInstructModeChat(name, message.content, isUser, isNarrator, '', name1, name2, false);
|
||||
}
|
||||
}
|
||||
|
||||
const isImpersonate = type === 'impersonate';
|
||||
const isContinue = type === 'continue';
|
||||
const isQuiet = type === 'quiet';
|
||||
const isQuietToLoud = false; // Quiet to loud not implemented for Chat Completion
|
||||
const promptName = isImpersonate ? name1 : name2;
|
||||
const promptLine = isContinue ? '' : formatInstructModePrompt(promptName, isImpersonate, '', name1, name2, isQuiet, isQuietToLoud).trimStart();
|
||||
|
||||
let prompt = [systemPromptText, examplesText, chatMessagesText, promptLine]
|
||||
.filter(x => x)
|
||||
.map(x => x.endsWith('\n') ? x : `${x}\n`)
|
||||
.join('');
|
||||
|
||||
if (isContinue) {
|
||||
prompt = prompt.replace(/\n$/, '');
|
||||
}
|
||||
|
||||
return prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats chat messages into chat completion messages.
|
||||
* @param {object[]} chat - Array containing all messages.
|
||||
@ -761,10 +651,6 @@ function populationInjectionPrompts(prompts, messages) {
|
||||
return messages;
|
||||
}
|
||||
|
||||
export function isOpenRouterWithInstruct() {
|
||||
return oai_settings.chat_completion_source === chat_completion_sources.OPENROUTER && oai_settings.openrouter_force_instruct && power_user.instruct.enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the chat history of the conversation.
|
||||
* @param {object[]} messages - Array containing all messages.
|
||||
@ -795,8 +681,7 @@ async function populateChatHistory(messages, prompts, chatCompletion, type = nul
|
||||
|
||||
// Reserve budget for continue nudge
|
||||
let continueMessage = null;
|
||||
const instruct = isOpenRouterWithInstruct();
|
||||
if (type === 'continue' && cyclePrompt && !instruct && !oai_settings.continue_prefill) {
|
||||
if (type === 'continue' && cyclePrompt && !oai_settings.continue_prefill) {
|
||||
const promptObject = {
|
||||
identifier: 'continueNudge',
|
||||
role: 'system',
|
||||
@ -1793,7 +1678,7 @@ async function sendOpenAIRequest(type, messages, signal) {
|
||||
const isPerplexity = oai_settings.chat_completion_source == chat_completion_sources.PERPLEXITY;
|
||||
const isGroq = oai_settings.chat_completion_source == chat_completion_sources.GROQ;
|
||||
const is01AI = oai_settings.chat_completion_source == chat_completion_sources.ZEROONEAI;
|
||||
const isTextCompletion = (isOAI && textCompletionModels.includes(oai_settings.openai_model)) || (isOpenRouter && oai_settings.openrouter_force_instruct && power_user.instruct.enabled);
|
||||
const isTextCompletion = isOAI && textCompletionModels.includes(oai_settings.openai_model);
|
||||
const isQuiet = type === 'quiet';
|
||||
const isImpersonate = type === 'impersonate';
|
||||
const isContinue = type === 'continue';
|
||||
@ -1801,11 +1686,6 @@ async function sendOpenAIRequest(type, messages, signal) {
|
||||
const useLogprobs = !!power_user.request_token_probabilities;
|
||||
const canMultiSwipe = oai_settings.n > 1 && !isContinue && !isImpersonate && !isQuiet && (isOAI || isCustom);
|
||||
|
||||
if (isTextCompletion && isOpenRouter) {
|
||||
messages = convertChatCompletionToInstruct(messages, type);
|
||||
replaceItemizedPromptText(messageId, messages);
|
||||
}
|
||||
|
||||
// If we're using the window.ai extension, use that instead
|
||||
// Doesn't support logit bias yet
|
||||
if (oai_settings.chat_completion_source == chat_completion_sources.WINDOWAI) {
|
||||
@ -3045,7 +2925,6 @@ function loadOpenAISettings(data, settings) {
|
||||
oai_settings.openrouter_group_models = settings.openrouter_group_models ?? default_settings.openrouter_group_models;
|
||||
oai_settings.openrouter_sort_models = settings.openrouter_sort_models ?? default_settings.openrouter_sort_models;
|
||||
oai_settings.openrouter_use_fallback = settings.openrouter_use_fallback ?? default_settings.openrouter_use_fallback;
|
||||
oai_settings.openrouter_force_instruct = settings.openrouter_force_instruct ?? default_settings.openrouter_force_instruct;
|
||||
oai_settings.openrouter_allow_fallbacks = settings.openrouter_allow_fallbacks ?? default_settings.openrouter_allow_fallbacks;
|
||||
oai_settings.ai21_model = settings.ai21_model ?? default_settings.ai21_model;
|
||||
oai_settings.mistralai_model = settings.mistralai_model ?? default_settings.mistralai_model;
|
||||
@ -3152,7 +3031,6 @@ function loadOpenAISettings(data, settings) {
|
||||
$('#use_makersuite_sysprompt').prop('checked', oai_settings.use_makersuite_sysprompt);
|
||||
$('#scale-alt').prop('checked', oai_settings.use_alt_scale);
|
||||
$('#openrouter_use_fallback').prop('checked', oai_settings.openrouter_use_fallback);
|
||||
$('#openrouter_force_instruct').prop('checked', oai_settings.openrouter_force_instruct);
|
||||
$('#openrouter_group_models').prop('checked', oai_settings.openrouter_group_models);
|
||||
$('#openrouter_allow_fallbacks').prop('checked', oai_settings.openrouter_allow_fallbacks);
|
||||
$('#openrouter_providers_chat').val(oai_settings.openrouter_providers).trigger('change');
|
||||
@ -3380,7 +3258,6 @@ async function saveOpenAIPreset(name, settings, triggerUi = true) {
|
||||
windowai_model: settings.windowai_model,
|
||||
openrouter_model: settings.openrouter_model,
|
||||
openrouter_use_fallback: settings.openrouter_use_fallback,
|
||||
openrouter_force_instruct: settings.openrouter_force_instruct,
|
||||
openrouter_group_models: settings.openrouter_group_models,
|
||||
openrouter_sort_models: settings.openrouter_sort_models,
|
||||
openrouter_providers: settings.openrouter_providers,
|
||||
@ -3817,7 +3694,6 @@ function onSettingsPresetChange() {
|
||||
windowai_model: ['#model_windowai_select', 'windowai_model', false],
|
||||
openrouter_model: ['#model_openrouter_select', 'openrouter_model', false],
|
||||
openrouter_use_fallback: ['#openrouter_use_fallback', 'openrouter_use_fallback', true],
|
||||
openrouter_force_instruct: ['#openrouter_force_instruct', 'openrouter_force_instruct', true],
|
||||
openrouter_group_models: ['#openrouter_group_models', 'openrouter_group_models', false],
|
||||
openrouter_sort_models: ['#openrouter_sort_models', 'openrouter_sort_models', false],
|
||||
openrouter_providers: ['#openrouter_providers_chat', 'openrouter_providers', false],
|
||||
@ -4780,7 +4656,7 @@ export function isImageInliningSupported() {
|
||||
case chat_completion_sources.CLAUDE:
|
||||
return visionSupportedModels.some(model => oai_settings.claude_model.includes(model));
|
||||
case chat_completion_sources.OPENROUTER:
|
||||
return !oai_settings.openrouter_force_instruct;
|
||||
return true;
|
||||
case chat_completion_sources.CUSTOM:
|
||||
return true;
|
||||
case chat_completion_sources.ZEROONEAI:
|
||||
@ -5202,11 +5078,6 @@ $(document).ready(async function () {
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#openrouter_force_instruct').on('input', function () {
|
||||
oai_settings.openrouter_force_instruct = !!$(this).prop('checked');
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#openrouter_group_models').on('input', function () {
|
||||
oai_settings.openrouter_group_models = !!$(this).prop('checked');
|
||||
saveSettingsDebounced();
|
||||
|
Reference in New Issue
Block a user