From 480099ee970726bffc65a384b2107f8d3a00ea11 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 8 Nov 2023 18:16:47 +0200 Subject: [PATCH] Mancer will work in legacy API mode. Remove Soft Prompt mentions. --- public/i18n.json | 26 +++++++------------------- public/index.html | 6 +++--- public/script.js | 4 ++-- public/scripts/textgen-settings.js | 9 +++++++-- public/scripts/tokenizers.js | 4 ++-- server.js | 2 +- 6 files changed, 22 insertions(+), 29 deletions(-) diff --git a/public/i18n.json b/public/i18n.json index 561181c51..daf05eaa7 100644 --- a/public/i18n.json +++ b/public/i18n.json @@ -172,8 +172,6 @@ "Token Budget": "Token 预算", "budget": "预算", "Recursive scanning": "递归扫描", - "Soft Prompt": "软提示", - "About soft prompts": "关于软提示", "None": "没有", "User Settings": "聊天窗口设置", "UI Customization": "聊天窗口定制", @@ -469,7 +467,7 @@ "Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "通过发送一个短测试消息验证您的API连接。请注意您会获得相应的积分!", "Create New": "创建新的", "Edit": "编辑", - "World Info & Soft Prompts": "世界背景 & 软提示", + "World Info": "世界背景", "Locked = World Editor will stay open": "锁定=世界编辑器将保持打开状态", "Entries can activate other entries by mentioning their keywords": "条目可以通过提及其关键字来激活其他条目", "Lookup for the entry keys in the context will respect the case": "在上下文中查找条目键将遵守大小写", @@ -724,8 +722,6 @@ "Token Budget": "トークン予算", "budget": "予算", "Recursive scanning": "再帰的スキャン", - "Soft Prompt": "ソフトプロンプト", - "About soft prompts": "ソフトプロンプトについて", "None": "なし", "User Settings": "ユーザー設定", "UI Customization": "UIカスタマイズ", @@ -1023,7 +1019,7 @@ "Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "NEEDS TRANSLATION", "Create New": "NEEDS TRANSLATION", "Edit": "NEEDS TRANSLATION", - "World Info & Soft Prompts": "NEEDS TRANSLATION", + "World Info": "NEEDS TRANSLATION", "Locked = World Editor will stay open": "NEEDS TRANSLATION", "Entries can activate other entries by mentioning their keywords": "NEEDS TRANSLATION", "Lookup for the entry keys in the context will respect the case": "NEEDS TRANSLATION", @@ -1278,8 +1274,6 @@ "Token Budget": "토큰 예산", "budget": "예산", "Recursive scanning": "되풀이 검색", - "Soft Prompt": "Soft Prompt", - "About soft prompts": "Soft prompt란?", "None": "없음", "User Settings": "사용자 설정", "UI Customization": "UI 꾸미기", @@ -1581,7 +1575,7 @@ "Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "짧은 시험 메시지를 보내서 API 접속 상태를 확인합니다. 서비스 사용으로 취급됩니다!", "Create New": "새로 만들기", "Edit": "수정하기", - "World Info & Soft Prompts": "세계관 & 소프트 프롬프트", + "World Info": "세계관", "Locked = World Editor will stay open": "세계관 설정 패널 열림을 고정합니다", "Entries can activate other entries by mentioning their keywords": "설정 내용에 다른 설정의 키워드가 있다면 연속으로 발동하게 합니다", "Lookup for the entry keys in the context will respect the case": "설정 발동 키워드가 대소문자를 구분합니다", @@ -1890,8 +1884,6 @@ "Token Budget": "Объем токенов", "budget": "объем", "Recursive scanning": "Рекурсивное сканирование", - "Soft Prompt": "Мягкая инструкция", - "About soft prompts": "О мягких инструкциях", "None": "Отсутствует", "User Settings": "Настройки пользователя", "UI Mode": "Режим интерфейса", @@ -2207,7 +2199,7 @@ "Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Подверждает ваше соединение к API. Знайте, что за это снимут деньги с вашего счета.", "Create New": "Создать новое", "Edit": "Изменить", - "World Info & Soft Prompts": "Информация о Мире & Мягкий Промт", + "World Info": "Информация о Мире", "Locked = World Editor will stay open": "Закреплено = Редактирование Мира останется открытым", "Entries can activate other entries by mentioning their keywords": "Записи могут активировать другие записи если в них содержаться ключевые слова", "Lookup for the entry keys in the context will respect the case": "Большая буква имеет значение при активации ключевого слова", @@ -2469,8 +2461,6 @@ "Token Budget": "Budget per i Token", "budget": "budget", "Recursive scanning": "Analisi ricorsiva", - "Soft Prompt": "Prompt leggero", - "About soft prompts": "Riguardo i prompt leggeri", "None": "None", "User Settings": "Settaggi utente", "UI Customization": "Personalizzazione UI", @@ -2767,7 +2757,7 @@ "Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Verifica la connessione all'API inviando un breve messaggio. Devi comprendere che il messaggio verrà addebitato come tutti gli altri!", "Create New": "Crea nuovo", "Edit": "Edita", - "World Info & Soft Prompts": "'Info Mondo' & Soft Prompt", + "World Info": "'Info Mondo'", "Locked = World Editor will stay open": "Se clicchi il lucchetto, l'editor del mondo rimarrà aperto", "Entries can activate other entries by mentioning their keywords": "Le voci possono attivare altre voci menzionando le loro parole chiave", "Lookup for the entry keys in the context will respect the case": "Fai attenzione alle parole chiave usate, esse rispetteranno le maiuscole", @@ -2963,7 +2953,7 @@ "Show tags in responses": "Mostra i tag nelle risposte", "Story String": "Stringa narrativa", "Text Adventure": "Avventura testuale", - "Text Gen WebUI (ooba/Mancer) presets": "Preset Text Gen WebUI (ooba/Mancer)", + "Text Gen WebUI presets": "Preset Text Gen WebUI", "Toggle Panels": "Interruttore pannelli", "Top A Sampling": "Top A Sampling", "Top K Sampling": "Top K Sampling", @@ -3226,8 +3216,6 @@ "Token Budget": "Token-budget", "budget": "budget", "Recursive scanning": "Recursieve scanning", - "Soft Prompt": "Zachte prompt", - "About soft prompts": "Over zachte prompts", "None": "Geen", "User Settings": "Gebruikersinstellingen", "UI Customization": "UI-aanpassing", @@ -3523,7 +3511,7 @@ "Verifies your API connection by sending a short test message. Be aware that you'll be credited for it!": "Verifieert je API-verbinding door een kort testbericht te sturen. Wees je ervan bewust dat je hiervoor wordt gecrediteerd!", "Create New": "Nieuw aanmaken", "Edit": "Bewerken", - "World Info & Soft Prompts": "Wereldinformatie & Zachte Prompts", + "World Info": "Wereldinformatie", "Locked = World Editor will stay open": "Vergrendeld = Wereld Editor blijft open", "Entries can activate other entries by mentioning their keywords": "Invoeren kunnen andere invoeren activeren door hun trefwoorden te noemen", "Lookup for the entry keys in the context will respect the case": "Zoeken naar de toetsen van de invoer in de context zal de hoofdlettergevoeligheid respecteren", diff --git a/public/index.html b/public/index.html index f6713dd18..10670b88c 100644 --- a/public/index.html +++ b/public/index.html @@ -193,7 +193,7 @@
-

Text Gen WebUI (ooba/Mancer) presets

+

Text Gen WebUI presets

@@ -1513,7 +1513,7 @@ @@ -2396,7 +2396,7 @@
-
+
diff --git a/public/script.js b/public/script.js index 3a9973372..824f8b89e 100644 --- a/public/script.js +++ b/public/script.js @@ -886,7 +886,7 @@ async function getStatus() { use_mancer: main_api == "textgenerationwebui" ? isMancer() : false, use_aphrodite: main_api == "textgenerationwebui" ? isAphrodite() : false, use_ooba: main_api == "textgenerationwebui" ? isOoba() : false, - legacy_api: main_api == "textgenerationwebui" ? textgenerationwebui_settings.legacy_api : false, + legacy_api: main_api == "textgenerationwebui" ? textgenerationwebui_settings.legacy_api && !isMancer() : false, }), signal: abortStatusCheck.signal, }); @@ -2596,7 +2596,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, return; } - if (main_api === 'textgenerationwebui' && textgenerationwebui_settings.streaming && textgenerationwebui_settings.legacy_api) { + if (main_api === 'textgenerationwebui' && textgenerationwebui_settings.streaming && textgenerationwebui_settings.legacy_api && !isMancer()) { toastr.error('Streaming is not supported for the Legacy API. Update Ooba and use --extensions openai to enable streaming.', undefined, { timeOut: 10000, preventDuplicates: true, }); unblockGeneration(); return; diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index dbcebdb34..4c9f0a5bf 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -149,13 +149,18 @@ async function selectPreset(name) { function formatTextGenURL(value) { try { + // Mancer doesn't need any formatting (it's hardcoded) + if (isMancer()) { + return value; + } + const url = new URL(value); if (url.pathname === '/api' && !textgenerationwebui_settings.legacy_api) { toastr.info(`Enable Legacy API or start Ooba with the OpenAI extension enabled.`, 'Legacy API URL detected. Generation may fail.', { preventDuplicates: true, timeOut: 10000, extendedTimeOut: 20000 }); url.pathname = ''; } - if (!power_user.relaxed_api_urls && textgenerationwebui_settings.legacy_api && !isMancer()) { + if (!power_user.relaxed_api_urls && textgenerationwebui_settings.legacy_api) { url.pathname = '/api'; } return url.toString(); @@ -522,7 +527,7 @@ export function getTextGenGenerationData(finalPrompt, this_amount_gen, isImperso 'use_aphrodite': isAphrodite(), 'use_ooba': isOoba(), 'api_server': isMancer() ? MANCER_SERVER : api_server_textgenerationwebui, - 'legacy_api': textgenerationwebui_settings.legacy_api, + 'legacy_api': textgenerationwebui_settings.legacy_api && !isMancer(), //'n': textgenerationwebui_settings.n_aphrodite, //'best_of': textgenerationwebui_settings.n_aphrodite, //n must always == best_of and vice versa //'ignore_eos': textgenerationwebui_settings.ignore_eos_token_aphrodite, diff --git a/public/scripts/tokenizers.js b/public/scripts/tokenizers.js index 93e618047..994c45630 100644 --- a/public/scripts/tokenizers.js +++ b/public/scripts/tokenizers.js @@ -4,7 +4,7 @@ import { chat_completion_sources, model_list, oai_settings } from "./openai.js"; import { groups, selected_group } from "./group-chats.js"; import { getStringHash } from "./utils.js"; import { kai_flags } from "./kai-settings.js"; -import { textgenerationwebui_settings } from "./textgen-settings.js"; +import { isMancer, textgenerationwebui_settings } from "./textgen-settings.js"; export const CHARACTERS_PER_TOKEN_RATIO = 3.35; const TOKENIZER_WARNING_KEY = 'tokenizationWarningShown'; @@ -381,7 +381,7 @@ function countTokensRemote(endpoint, str, padding) { text: str, api: main_api, url: getAPIServerUrl(), - legacy_api: main_api === 'textgenerationwebui' && textgenerationwebui_settings.legacy_api, + legacy_api: main_api === 'textgenerationwebui' && textgenerationwebui_settings.legacy_api && !isMancer() , }), dataType: "json", contentType: "application/json", diff --git a/server.js b/server.js index 676731425..e08e52827 100644 --- a/server.js +++ b/server.js @@ -691,7 +691,7 @@ app.post("/getchat", jsonParser, function (request, response) { } }); -// Only called for kobold and ooba/mancer +// Only called for kobold app.post("/getstatus", jsonParser, async function (request, response) { if (!request.body) return response.sendStatus(400); api_server = request.body.api_server;