Fix ooba tokenization via API. Fix requiring streaming URL to generate

This commit is contained in:
Cohee
2023-11-08 03:38:04 +02:00
parent b2629d9718
commit 865256f5c0
4 changed files with 61 additions and 37 deletions

View File

@ -869,15 +869,7 @@ async function getStatus() {
const url = main_api == "textgenerationwebui" ? '/api/textgenerationwebui/status' : '/getstatus';
let endpoint = api_server;
if (main_api == "textgenerationwebui") {
endpoint = api_server_textgenerationwebui;
}
if (main_api == "textgenerationwebui" && isMancer()) {
endpoint = MANCER_SERVER;
}
let endpoint = getAPIServerUrl();
if (!endpoint) {
console.warn("No endpoint for status check");
@ -946,6 +938,22 @@ export function resultCheckStatus() {
stopStatusLoading();
}
export function getAPIServerUrl() {
if (main_api == "textgenerationwebui") {
if (isMancer()) {
return MANCER_SERVER;
}
return api_server_textgenerationwebui;
}
if (main_api == "kobold") {
return api_server;
}
return "";
}
export async function selectCharacterById(id) {
if (characters[id] == undefined) {
return;
@ -2534,16 +2542,6 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
return;
}
if (
main_api == 'textgenerationwebui' &&
textgenerationwebui_settings.streaming &&
textgenerationwebui_settings.type === textgen_types.OOBA &&
!textgenerationwebui_settings.streaming_url) {
toastr.error('Streaming URL is not set. Look it up in the console window when starting TextGen Web UI');
unblockGeneration();
return;
}
if (main_api == 'kobold' && kai_settings.streaming_kobold && !kai_flags.can_use_streaming) {
toastr.error('Streaming is enabled, but the version of Kobold used does not support token streaming.', undefined, { timeOut: 10000, preventDuplicates: true, });
unblockGeneration();