Merge branch 'staging' into no_updates_for_disabled_ext

This commit is contained in:
Cohee
2025-03-27 20:59:49 +02:00
16 changed files with 38 additions and 275 deletions

View File

@@ -2745,7 +2745,6 @@
<optgroup> <optgroup>
<option value="01ai">01.AI (Yi)</option> <option value="01ai">01.AI (Yi)</option>
<option value="ai21">AI21</option> <option value="ai21">AI21</option>
<option value="blockentropy">Block Entropy</option>
<option value="claude">Claude</option> <option value="claude">Claude</option>
<option value="cohere">Cohere</option> <option value="cohere">Cohere</option>
<option value="deepseek">DeepSeek</option> <option value="deepseek">DeepSeek</option>
@@ -3375,20 +3374,6 @@
</select> </select>
</div> </div>
</form> </form>
<form id="blockentropy_form" data-source="blockentropy">
<h4 data-i18n="Block Entropy API Key">Block Entropy API Key</h4>
<div class="flex-container">
<input id="api_key_blockentropy" name="api_key_blockentropy" class="text_pole flex1" value="" type="text" autocomplete="off">
<div title="Clear your API key" data-i18n="[title]Clear your API key" class="menu_button fa-solid fa-circle-xmark clear-api-key" data-key="api_key_blockentropy"></div>
</div>
<div data-for="api_key_blockentropy" class="neutral_warning" data-i18n="For privacy reasons, your API key will be hidden after you reload the page.">
For privacy reasons, your API key will be hidden after you reload the page.
</div>
<h4 data-i18n="Select a Model">Select a Model</h4>
<div class="flex-container">
<select id="model_blockentropy_select" class="text_pole"></select>
</div>
</form>
<form id="custom_form" data-source="custom"> <form id="custom_form" data-source="custom">
<h4 data-i18n="Custom Endpoint (Base URL)">Custom Endpoint (Base URL)</h4> <h4 data-i18n="Custom Endpoint (Base URL)">Custom Endpoint (Base URL)</h4>
<div class="flex-container"> <div class="flex-container">
@@ -6101,9 +6086,12 @@
<label for="content "> <label for="content ">
<small> <small>
<span class="alignitemscenter flex-container flexnowrap wide100p justifySpaceBetween"> <span class="alignitemscenter flex-container flexnowrap wide100p justifySpaceBetween">
<span data-i18n="Content" class="alignitemscenter flex-container flexNoGap mdhotkey_location"> <span class="alignitemscenter flex-container">
<span data-i18n="Content" class="mdhotkey_location">
Content Content
</span> </span>
<i class="editor_maximize fa-solid fa-maximize right_menu_button" title="Expand the editor" data-i18n="[title]Expand the editor"></i>
</span>
<span> <span>
(<span data-i18n="extension_token_counter">Tokens:</span>&nbsp; <span class="world_entry_form_token_counter" data-first-run="true">counting...</span>)&nbsp; (<span data-i18n="extension_token_counter">Tokens:</span>&nbsp; <span class="world_entry_form_token_counter" data-first-run="true">counting...</span>)&nbsp;
<span class="world_entry_form_uid_value" data-first-run="true"></span> <span class="world_entry_form_uid_value" data-first-run="true"></span>

View File

@@ -174,7 +174,7 @@ import {
saveBase64AsFile, saveBase64AsFile,
uuidv4, uuidv4,
} from './scripts/utils.js'; } from './scripts/utils.js';
import { debounce_timeout } from './scripts/constants.js'; import { debounce_timeout, IGNORE_SYMBOL } from './scripts/constants.js';
import { doDailyExtensionUpdatesCheck, extension_settings, initExtensions, loadExtensionSettings, runGenerationInterceptors, saveMetadataDebounced } from './scripts/extensions.js'; import { doDailyExtensionUpdatesCheck, extension_settings, initExtensions, loadExtensionSettings, runGenerationInterceptors, saveMetadataDebounced } from './scripts/extensions.js';
import { COMMENT_NAME_DEFAULT, executeSlashCommandsOnChatInput, getSlashCommandsHelp, initDefaultSlashCommands, isExecutingCommandsFromChatInput, pauseScriptExecution, processChatSlashCommands, stopScriptExecution } from './scripts/slash-commands.js'; import { COMMENT_NAME_DEFAULT, executeSlashCommandsOnChatInput, getSlashCommandsHelp, initDefaultSlashCommands, isExecutingCommandsFromChatInput, pauseScriptExecution, processChatSlashCommands, stopScriptExecution } from './scripts/slash-commands.js';
@@ -5301,6 +5301,12 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) {
const itemName = chatItem.is_user ? chatItem['name'] : characterName; const itemName = chatItem.is_user ? chatItem['name'] : characterName;
const shouldPrependName = !isNarratorType; const shouldPrependName = !isNarratorType;
// If this symbol flag is set, completely ignore the message.
// This can be used to hide messages without affecting the number of messages in the chat.
if (chatItem.extra?.[IGNORE_SYMBOL]) {
return '';
}
// Don't include a name if it's empty // Don't include a name if it's empty
let textResult = chatItem?.name && shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`; let textResult = chatItem?.name && shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`;

View File

@@ -407,7 +407,6 @@ function RA_autoconnect(PrevApi) {
|| (secret_state[SECRET_KEYS.PERPLEXITY] && oai_settings.chat_completion_source == chat_completion_sources.PERPLEXITY) || (secret_state[SECRET_KEYS.PERPLEXITY] && oai_settings.chat_completion_source == chat_completion_sources.PERPLEXITY)
|| (secret_state[SECRET_KEYS.GROQ] && oai_settings.chat_completion_source == chat_completion_sources.GROQ) || (secret_state[SECRET_KEYS.GROQ] && oai_settings.chat_completion_source == chat_completion_sources.GROQ)
|| (secret_state[SECRET_KEYS.ZEROONEAI] && oai_settings.chat_completion_source == chat_completion_sources.ZEROONEAI) || (secret_state[SECRET_KEYS.ZEROONEAI] && oai_settings.chat_completion_source == chat_completion_sources.ZEROONEAI)
|| (secret_state[SECRET_KEYS.BLOCKENTROPY] && oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY)
|| (secret_state[SECRET_KEYS.NANOGPT] && oai_settings.chat_completion_source == chat_completion_sources.NANOGPT) || (secret_state[SECRET_KEYS.NANOGPT] && oai_settings.chat_completion_source == chat_completion_sources.NANOGPT)
|| (secret_state[SECRET_KEYS.DEEPSEEK] && oai_settings.chat_completion_source == chat_completion_sources.DEEPSEEK) || (secret_state[SECRET_KEYS.DEEPSEEK] && oai_settings.chat_completion_source == chat_completion_sources.DEEPSEEK)
|| (isValidUrl(oai_settings.custom_url) && oai_settings.chat_completion_source == chat_completion_sources.CUSTOM) || (isValidUrl(oai_settings.custom_url) && oai_settings.chat_completion_source == chat_completion_sources.CUSTOM)

View File

@@ -14,3 +14,11 @@ export const debounce_timeout = {
/** [5 sec] For delayed tasks, like auto-saving or completing batch operations that need a significant pause. */ /** [5 sec] For delayed tasks, like auto-saving or completing batch operations that need a significant pause. */
extended: 5000, extended: 5000,
}; };
/**
* Used as an ephemeral key in message extra metadata.
* When set, the message will be excluded from generation
* prompts without affecting the number of chat messages,
* which is needed to preserve world info timed effects.
*/
export const IGNORE_SYMBOL = Symbol.for('ignore');

View File

@@ -77,7 +77,6 @@ const sources = {
drawthings: 'drawthings', drawthings: 'drawthings',
pollinations: 'pollinations', pollinations: 'pollinations',
stability: 'stability', stability: 'stability',
blockentropy: 'blockentropy',
huggingface: 'huggingface', huggingface: 'huggingface',
nanogpt: 'nanogpt', nanogpt: 'nanogpt',
bfl: 'bfl', bfl: 'bfl',
@@ -1300,7 +1299,6 @@ async function onModelChange() {
sources.togetherai, sources.togetherai,
sources.pollinations, sources.pollinations,
sources.stability, sources.stability,
sources.blockentropy,
sources.huggingface, sources.huggingface,
sources.nanogpt, sources.nanogpt,
sources.bfl, sources.bfl,
@@ -1511,9 +1509,6 @@ async function loadSamplers() {
case sources.stability: case sources.stability:
samplers = ['N/A']; samplers = ['N/A'];
break; break;
case sources.blockentropy:
samplers = ['N/A'];
break;
case sources.huggingface: case sources.huggingface:
samplers = ['N/A']; samplers = ['N/A'];
break; break;
@@ -1701,9 +1696,6 @@ async function loadModels() {
case sources.stability: case sources.stability:
models = await loadStabilityModels(); models = await loadStabilityModels();
break; break;
case sources.blockentropy:
models = await loadBlockEntropyModels();
break;
case sources.huggingface: case sources.huggingface:
models = [{ value: '', text: '<Enter Model ID above>' }]; models = [{ value: '', text: '<Enter Model ID above>' }];
break; break;
@@ -1799,26 +1791,6 @@ async function loadTogetherAIModels() {
return []; return [];
} }
async function loadBlockEntropyModels() {
if (!secret_state[SECRET_KEYS.BLOCKENTROPY]) {
console.debug('Block Entropy API key is not set.');
return [];
}
const result = await fetch('/api/sd/blockentropy/models', {
method: 'POST',
headers: getRequestHeaders(),
});
console.log(result);
if (result.ok) {
const data = await result.json();
console.log(data);
return data;
}
return [];
}
async function loadNanoGPTModels() { async function loadNanoGPTModels() {
if (!secret_state[SECRET_KEYS.NANOGPT]) { if (!secret_state[SECRET_KEYS.NANOGPT]) {
console.debug('NanoGPT API key is not set.'); console.debug('NanoGPT API key is not set.');
@@ -2097,9 +2069,6 @@ async function loadSchedulers() {
case sources.stability: case sources.stability:
schedulers = ['N/A']; schedulers = ['N/A'];
break; break;
case sources.blockentropy:
schedulers = ['N/A'];
break;
case sources.huggingface: case sources.huggingface:
schedulers = ['N/A']; schedulers = ['N/A'];
break; break;
@@ -2188,9 +2157,6 @@ async function loadVaes() {
case sources.stability: case sources.stability:
vaes = ['N/A']; vaes = ['N/A'];
break; break;
case sources.blockentropy:
vaes = ['N/A'];
break;
case sources.huggingface: case sources.huggingface:
vaes = ['N/A']; vaes = ['N/A'];
break; break;
@@ -2757,9 +2723,6 @@ async function sendGenerationRequest(generationType, prompt, additionalNegativeP
case sources.stability: case sources.stability:
result = await generateStabilityImage(prefixedPrompt, negativePrompt, signal); result = await generateStabilityImage(prefixedPrompt, negativePrompt, signal);
break; break;
case sources.blockentropy:
result = await generateBlockEntropyImage(prefixedPrompt, negativePrompt, signal);
break;
case sources.huggingface: case sources.huggingface:
result = await generateHuggingFaceImage(prefixedPrompt, signal); result = await generateHuggingFaceImage(prefixedPrompt, signal);
break; break;
@@ -2828,40 +2791,6 @@ async function generateTogetherAIImage(prompt, negativePrompt, signal) {
} }
} }
async function generateBlockEntropyImage(prompt, negativePrompt, signal) {
const result = await fetch('/api/sd/blockentropy/generate', {
method: 'POST',
headers: getRequestHeaders(),
signal: signal,
body: JSON.stringify({
prompt: prompt,
negative_prompt: negativePrompt,
model: extension_settings.sd.model,
steps: extension_settings.sd.steps,
width: extension_settings.sd.width,
height: extension_settings.sd.height,
seed: extension_settings.sd.seed >= 0 ? extension_settings.sd.seed : undefined,
}),
});
if (result.ok) {
const data = await result.json();
// Default format is 'jpg'
let format = 'jpg';
// Check if a format is specified in the result
if (data.format) {
format = data.format.toLowerCase();
}
return { format: format, data: data.images[0] };
} else {
const text = await result.text();
throw new Error(text);
}
}
/** /**
* Generates an image using the Pollinations API. * Generates an image using the Pollinations API.
* @param {string} prompt - The main instruction used to guide the image generation. * @param {string} prompt - The main instruction used to guide the image generation.
@@ -3845,8 +3774,6 @@ function isValidState() {
return true; return true;
case sources.stability: case sources.stability:
return secret_state[SECRET_KEYS.STABILITY]; return secret_state[SECRET_KEYS.STABILITY];
case sources.blockentropy:
return secret_state[SECRET_KEYS.BLOCKENTROPY];
case sources.huggingface: case sources.huggingface:
return secret_state[SECRET_KEYS.HUGGINGFACE]; return secret_state[SECRET_KEYS.HUGGINGFACE];
case sources.nanogpt: case sources.nanogpt:

View File

@@ -38,7 +38,6 @@
<label for="sd_source" data-i18n="Source">Source</label> <label for="sd_source" data-i18n="Source">Source</label>
<select id="sd_source"> <select id="sd_source">
<option value="bfl">BFL (Black Forest Labs)</option> <option value="bfl">BFL (Black Forest Labs)</option>
<option value="blockentropy">Block Entropy</option>
<option value="comfy">ComfyUI</option> <option value="comfy">ComfyUI</option>
<option value="drawthings">DrawThings HTTP API</option> <option value="drawthings">DrawThings HTTP API</option>
<option value="extras">Extras API (deprecated)</option> <option value="extras">Extras API (deprecated)</option>
@@ -422,7 +421,7 @@
</label> </label>
</div> </div>
<div data-sd-source="novel,togetherai,pollinations,comfy,drawthings,vlad,auto,horde,extras,stability,blockentropy,bfl" class="marginTop5"> <div data-sd-source="novel,togetherai,pollinations,comfy,drawthings,vlad,auto,horde,extras,stability,bfl" class="marginTop5">
<label for="sd_seed"> <label for="sd_seed">
<span data-i18n="Seed">Seed</span> <span data-i18n="Seed">Seed</span>
<small data-i18n="(-1 for random)">(-1 for random)</small> <small data-i18n="(-1 for random)">(-1 for random)</small>

View File

@@ -75,6 +75,7 @@ import { Popup, POPUP_RESULT } from './popup.js';
import { t } from './i18n.js'; import { t } from './i18n.js';
import { ToolManager } from './tool-calling.js'; import { ToolManager } from './tool-calling.js';
import { accountStorage } from './util/AccountStorage.js'; import { accountStorage } from './util/AccountStorage.js';
import { IGNORE_SYMBOL } from './constants.js';
export { export {
openai_messages_count, openai_messages_count,
@@ -119,7 +120,6 @@ const default_bias_presets = {
const max_2k = 2047; const max_2k = 2047;
const max_4k = 4095; const max_4k = 4095;
const max_8k = 8191; const max_8k = 8191;
const max_12k = 12287;
const max_16k = 16383; const max_16k = 16383;
const max_32k = 32767; const max_32k = 32767;
const max_64k = 65535; const max_64k = 65535;
@@ -182,7 +182,6 @@ export const chat_completion_sources = {
PERPLEXITY: 'perplexity', PERPLEXITY: 'perplexity',
GROQ: 'groq', GROQ: 'groq',
ZEROONEAI: '01ai', ZEROONEAI: '01ai',
BLOCKENTROPY: 'blockentropy',
NANOGPT: 'nanogpt', NANOGPT: 'nanogpt',
DEEPSEEK: 'deepseek', DEEPSEEK: 'deepseek',
}; };
@@ -258,7 +257,6 @@ export const settingsToUpdate = {
nanogpt_model: ['#model_nanogpt_select', 'nanogpt_model', false], nanogpt_model: ['#model_nanogpt_select', 'nanogpt_model', false],
deepseek_model: ['#model_deepseek_select', 'deepseek_model', false], deepseek_model: ['#model_deepseek_select', 'deepseek_model', false],
zerooneai_model: ['#model_01ai_select', 'zerooneai_model', false], zerooneai_model: ['#model_01ai_select', 'zerooneai_model', false],
blockentropy_model: ['#model_blockentropy_select', 'blockentropy_model', false],
custom_model: ['#custom_model_id', 'custom_model', false], custom_model: ['#custom_model_id', 'custom_model', false],
custom_url: ['#custom_api_url_text', 'custom_url', false], custom_url: ['#custom_api_url_text', 'custom_url', false],
custom_include_body: ['#custom_include_body', 'custom_include_body', false], custom_include_body: ['#custom_include_body', 'custom_include_body', false],
@@ -346,7 +344,6 @@ const default_settings = {
groq_model: 'llama-3.3-70b-versatile', groq_model: 'llama-3.3-70b-versatile',
nanogpt_model: 'gpt-4o-mini', nanogpt_model: 'gpt-4o-mini',
zerooneai_model: 'yi-large', zerooneai_model: 'yi-large',
blockentropy_model: 'be-70b-base-llama3.1',
deepseek_model: 'deepseek-chat', deepseek_model: 'deepseek-chat',
custom_model: '', custom_model: '',
custom_url: '', custom_url: '',
@@ -427,7 +424,6 @@ const oai_settings = {
groq_model: 'llama-3.1-70b-versatile', groq_model: 'llama-3.1-70b-versatile',
nanogpt_model: 'gpt-4o-mini', nanogpt_model: 'gpt-4o-mini',
zerooneai_model: 'yi-large', zerooneai_model: 'yi-large',
blockentropy_model: 'be-70b-base-llama3.1',
deepseek_model: 'deepseek-chat', deepseek_model: 'deepseek-chat',
custom_model: '', custom_model: '',
custom_url: '', custom_url: '',
@@ -527,6 +523,13 @@ function setOpenAIMessages(chat) {
let role = chat[j]['is_user'] ? 'user' : 'assistant'; let role = chat[j]['is_user'] ? 'user' : 'assistant';
let content = chat[j]['mes']; let content = chat[j]['mes'];
// If this symbol flag is set, completely ignore the message.
// This can be used to hide messages without affecting the number of messages in the chat.
if (chat[j].extra?.[IGNORE_SYMBOL]) {
j++;
continue;
}
// 100% legal way to send a message as system // 100% legal way to send a message as system
if (chat[j].extra?.type === system_message_types.NARRATOR) { if (chat[j].extra?.type === system_message_types.NARRATOR) {
role = 'system'; role = 'system';
@@ -1637,8 +1640,6 @@ export function getChatCompletionModel(source = null) {
return oai_settings.groq_model; return oai_settings.groq_model;
case chat_completion_sources.ZEROONEAI: case chat_completion_sources.ZEROONEAI:
return oai_settings.zerooneai_model; return oai_settings.zerooneai_model;
case chat_completion_sources.BLOCKENTROPY:
return oai_settings.blockentropy_model;
case chat_completion_sources.NANOGPT: case chat_completion_sources.NANOGPT:
return oai_settings.nanogpt_model; return oai_settings.nanogpt_model;
case chat_completion_sources.DEEPSEEK: case chat_completion_sources.DEEPSEEK:
@@ -1757,23 +1758,6 @@ function saveModelList(data) {
$('#model_01ai_select').val(oai_settings.zerooneai_model).trigger('change'); $('#model_01ai_select').val(oai_settings.zerooneai_model).trigger('change');
} }
if (oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) {
$('#model_blockentropy_select').empty();
model_list.forEach((model) => {
$('#model_blockentropy_select').append(
$('<option>', {
value: model.id,
text: model.id,
}));
});
if (!oai_settings.blockentropy_model && model_list.length > 0) {
oai_settings.blockentropy_model = model_list[0].id;
}
$('#model_blockentropy_select').val(oai_settings.blockentropy_model).trigger('change');
}
if (oai_settings.chat_completion_source == chat_completion_sources.MISTRALAI) { if (oai_settings.chat_completion_source == chat_completion_sources.MISTRALAI) {
/** @type {HTMLSelectElement} */ /** @type {HTMLSelectElement} */
const mistralModelSelect = document.querySelector('#model_mistralai_select'); const mistralModelSelect = document.querySelector('#model_mistralai_select');
@@ -3246,7 +3230,6 @@ function loadOpenAISettings(data, settings) {
oai_settings.groq_model = settings.groq_model ?? default_settings.groq_model; oai_settings.groq_model = settings.groq_model ?? default_settings.groq_model;
oai_settings.nanogpt_model = settings.nanogpt_model ?? default_settings.nanogpt_model; oai_settings.nanogpt_model = settings.nanogpt_model ?? default_settings.nanogpt_model;
oai_settings.deepseek_model = settings.deepseek_model ?? default_settings.deepseek_model; oai_settings.deepseek_model = settings.deepseek_model ?? default_settings.deepseek_model;
oai_settings.blockentropy_model = settings.blockentropy_model ?? default_settings.blockentropy_model;
oai_settings.zerooneai_model = settings.zerooneai_model ?? default_settings.zerooneai_model; oai_settings.zerooneai_model = settings.zerooneai_model ?? default_settings.zerooneai_model;
oai_settings.custom_model = settings.custom_model ?? default_settings.custom_model; oai_settings.custom_model = settings.custom_model ?? default_settings.custom_model;
oai_settings.custom_url = settings.custom_url ?? default_settings.custom_url; oai_settings.custom_url = settings.custom_url ?? default_settings.custom_url;
@@ -3333,7 +3316,6 @@ function loadOpenAISettings(data, settings) {
$('#model_deepseek_select').val(oai_settings.deepseek_model); $('#model_deepseek_select').val(oai_settings.deepseek_model);
$(`#model_deepseek_select option[value="${oai_settings.deepseek_model}"`).prop('selected', true); $(`#model_deepseek_select option[value="${oai_settings.deepseek_model}"`).prop('selected', true);
$('#model_01ai_select').val(oai_settings.zerooneai_model); $('#model_01ai_select').val(oai_settings.zerooneai_model);
$('#model_blockentropy_select').val(oai_settings.blockentropy_model);
$('#custom_model_id').val(oai_settings.custom_model); $('#custom_model_id').val(oai_settings.custom_model);
$('#custom_api_url_text').val(oai_settings.custom_url); $('#custom_api_url_text').val(oai_settings.custom_url);
$('#openai_max_context').val(oai_settings.openai_max_context); $('#openai_max_context').val(oai_settings.openai_max_context);
@@ -3613,7 +3595,6 @@ async function saveOpenAIPreset(name, settings, triggerUi = true) {
perplexity_model: settings.perplexity_model, perplexity_model: settings.perplexity_model,
groq_model: settings.groq_model, groq_model: settings.groq_model,
zerooneai_model: settings.zerooneai_model, zerooneai_model: settings.zerooneai_model,
blockentropy_model: settings.blockentropy_model,
custom_model: settings.custom_model, custom_model: settings.custom_model,
custom_url: settings.custom_url, custom_url: settings.custom_url,
custom_include_body: settings.custom_include_body, custom_include_body: settings.custom_include_body,
@@ -4322,12 +4303,6 @@ async function onModelChange() {
oai_settings.zerooneai_model = value; oai_settings.zerooneai_model = value;
} }
if (value && $(this).is('#model_blockentropy_select')) {
console.log('Block Entropy model changed to', value);
oai_settings.blockentropy_model = value;
$('#blockentropy_model_id').val(value).trigger('input');
}
if (value && $(this).is('#model_custom_select')) { if (value && $(this).is('#model_custom_select')) {
console.log('Custom model changed to', value); console.log('Custom model changed to', value);
oai_settings.custom_model = value; oai_settings.custom_model = value;
@@ -4577,29 +4552,6 @@ async function onModelChange() {
oai_settings.temp_openai = Math.min(oai_max_temp, oai_settings.temp_openai); oai_settings.temp_openai = Math.min(oai_max_temp, oai_settings.temp_openai);
$('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input'); $('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input');
} }
if (oai_settings.chat_completion_source === chat_completion_sources.BLOCKENTROPY) {
if (oai_settings.max_context_unlocked) {
$('#openai_max_context').attr('max', unlocked_max);
}
else if (oai_settings.blockentropy_model.includes('llama3.1')) {
$('#openai_max_context').attr('max', max_16k);
}
else if (oai_settings.blockentropy_model.includes('72b')) {
$('#openai_max_context').attr('max', max_16k);
}
else if (oai_settings.blockentropy_model.includes('120b')) {
$('#openai_max_context').attr('max', max_12k);
}
else {
$('#openai_max_context').attr('max', max_8k);
}
oai_settings.openai_max_context = Math.min(oai_settings.openai_max_context, Number($('#openai_max_context').attr('max')));
$('#openai_max_context').val(oai_settings.openai_max_context).trigger('input');
oai_settings.temp_openai = Math.min(oai_max_temp, oai_settings.temp_openai);
$('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input');
}
if (oai_settings.chat_completion_source === chat_completion_sources.NANOGPT) { if (oai_settings.chat_completion_source === chat_completion_sources.NANOGPT) {
if (oai_settings.max_context_unlocked) { if (oai_settings.max_context_unlocked) {
@@ -4866,18 +4818,6 @@ async function onConnectButtonClick(e) {
return; return;
} }
} }
if (oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) {
const api_key_blockentropy = String($('#api_key_blockentropy').val()).trim();
if (api_key_blockentropy.length) {
await writeSecret(SECRET_KEYS.BLOCKENTROPY, api_key_blockentropy);
}
if (!secret_state[SECRET_KEYS.BLOCKENTROPY]) {
console.log('No secret key saved for Block Entropy');
return;
}
}
startStatusLoading(); startStatusLoading();
saveSettingsDebounced(); saveSettingsDebounced();
@@ -4932,9 +4872,6 @@ function toggleChatCompletionForms() {
else if (oai_settings.chat_completion_source == chat_completion_sources.CUSTOM) { else if (oai_settings.chat_completion_source == chat_completion_sources.CUSTOM) {
$('#model_custom_select').trigger('change'); $('#model_custom_select').trigger('change');
} }
else if (oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) {
$('#model_blockentropy_select').trigger('change');
}
else if (oai_settings.chat_completion_source == chat_completion_sources.DEEPSEEK) { else if (oai_settings.chat_completion_source == chat_completion_sources.DEEPSEEK) {
$('#model_deepseek_select').trigger('change'); $('#model_deepseek_select').trigger('change');
} }
@@ -5687,7 +5624,6 @@ export function initOpenAI() {
$('#model_nanogpt_select').on('change', onModelChange); $('#model_nanogpt_select').on('change', onModelChange);
$('#model_deepseek_select').on('change', onModelChange); $('#model_deepseek_select').on('change', onModelChange);
$('#model_01ai_select').on('change', onModelChange); $('#model_01ai_select').on('change', onModelChange);
$('#model_blockentropy_select').on('change', onModelChange);
$('#model_custom_select').on('change', onModelChange); $('#model_custom_select').on('change', onModelChange);
$('#settings_preset_openai').on('change', onSettingsPresetChange); $('#settings_preset_openai').on('change', onSettingsPresetChange);
$('#new_oai_preset').on('click', onNewPresetClick); $('#new_oai_preset').on('click', onNewPresetClick);

View File

@@ -34,7 +34,6 @@ export const SECRET_KEYS = {
ZEROONEAI: 'api_key_01ai', ZEROONEAI: 'api_key_01ai',
HUGGINGFACE: 'api_key_huggingface', HUGGINGFACE: 'api_key_huggingface',
STABILITY: 'api_key_stability', STABILITY: 'api_key_stability',
BLOCKENTROPY: 'api_key_blockentropy',
CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts', CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts',
NANOGPT: 'api_key_nanogpt', NANOGPT: 'api_key_nanogpt',
TAVILY: 'api_key_tavily', TAVILY: 'api_key_tavily',
@@ -74,7 +73,6 @@ const INPUT_MAP = {
[SECRET_KEYS.FEATHERLESS]: '#api_key_featherless', [SECRET_KEYS.FEATHERLESS]: '#api_key_featherless',
[SECRET_KEYS.ZEROONEAI]: '#api_key_01ai', [SECRET_KEYS.ZEROONEAI]: '#api_key_01ai',
[SECRET_KEYS.HUGGINGFACE]: '#api_key_huggingface', [SECRET_KEYS.HUGGINGFACE]: '#api_key_huggingface',
[SECRET_KEYS.BLOCKENTROPY]: '#api_key_blockentropy',
[SECRET_KEYS.NANOGPT]: '#api_key_nanogpt', [SECRET_KEYS.NANOGPT]: '#api_key_nanogpt',
[SECRET_KEYS.GENERIC]: '#api_key_generic', [SECRET_KEYS.GENERIC]: '#api_key_generic',
[SECRET_KEYS.DEEPSEEK]: '#api_key_deepseek', [SECRET_KEYS.DEEPSEEK]: '#api_key_deepseek',

View File

@@ -3936,7 +3936,6 @@ function getModelOptions(quiet) {
{ id: 'model_groq_select', api: 'openai', type: chat_completion_sources.GROQ }, { id: 'model_groq_select', api: 'openai', type: chat_completion_sources.GROQ },
{ id: 'model_nanogpt_select', api: 'openai', type: chat_completion_sources.NANOGPT }, { id: 'model_nanogpt_select', api: 'openai', type: chat_completion_sources.NANOGPT },
{ id: 'model_01ai_select', api: 'openai', type: chat_completion_sources.ZEROONEAI }, { id: 'model_01ai_select', api: 'openai', type: chat_completion_sources.ZEROONEAI },
{ id: 'model_blockentropy_select', api: 'openai', type: chat_completion_sources.BLOCKENTROPY },
{ id: 'model_deepseek_select', api: 'openai', type: chat_completion_sources.DEEPSEEK }, { id: 'model_deepseek_select', api: 'openai', type: chat_completion_sources.DEEPSEEK },
{ id: 'model_novel_select', api: 'novel', type: null }, { id: 'model_novel_select', api: 'novel', type: null },
{ id: 'horde_model', api: 'koboldhorde', type: null }, { id: 'horde_model', api: 'koboldhorde', type: null },

View File

@@ -83,6 +83,7 @@ import { convertCharacterBook, getWorldInfoPrompt, loadWorldInfo, reloadEditor,
import { ChatCompletionService, TextCompletionService } from './custom-request.js'; import { ChatCompletionService, TextCompletionService } from './custom-request.js';
import { ConnectionManagerRequestService } from './extensions/shared.js'; import { ConnectionManagerRequestService } from './extensions/shared.js';
import { updateReasoningUI, parseReasoningFromString } from './reasoning.js'; import { updateReasoningUI, parseReasoningFromString } from './reasoning.js';
import { IGNORE_SYMBOL } from './constants.js';
export function getContext() { export function getContext() {
return { return {
@@ -225,6 +226,9 @@ export function getContext() {
parseReasoningFromString, parseReasoningFromString,
unshallowCharacter, unshallowCharacter,
unshallowGroupMembers, unshallowGroupMembers,
symbols: {
ignore: IGNORE_SYMBOL,
},
}; };
} }

View File

@@ -729,15 +729,6 @@ export function getTokenizerModel() {
return yiTokenizer; return yiTokenizer;
} }
if (oai_settings.chat_completion_source === chat_completion_sources.BLOCKENTROPY) {
if (oai_settings.blockentropy_model.includes('llama3')) {
return llama3Tokenizer;
}
if (oai_settings.blockentropy_model.includes('miqu') || oai_settings.blockentropy_model.includes('mixtral')) {
return mistralTokenizer;
}
}
// Default to Turbo 3.5 // Default to Turbo 3.5
return turboTokenizer; return turboTokenizer;
} }

View File

@@ -2680,8 +2680,10 @@ export async function getWorldEntry(name, data, entry) {
$(counter).text(numberOfTokens); $(counter).text(numberOfTokens);
}, debounce_timeout.relaxed); }, debounce_timeout.relaxed);
const contentInputId = `world_entry_content_${entry.uid}`;
const contentInput = template.find('textarea[name="content"]'); const contentInput = template.find('textarea[name="content"]');
contentInput.data('uid', entry.uid); contentInput.data('uid', entry.uid);
contentInput.attr('id', contentInputId);
contentInput.on('input', async function (_, { skipCount } = {}) { contentInput.on('input', async function (_, { skipCount } = {}) {
const uid = $(this).data('uid'); const uid = $(this).data('uid');
const value = $(this).val(); const value = $(this).val();
@@ -2698,7 +2700,9 @@ export async function getWorldEntry(name, data, entry) {
countTokensDebounced(counter, value); countTokensDebounced(counter, value);
}); });
contentInput.val(entry.content).trigger('input', { skipCount: true }); contentInput.val(entry.content).trigger('input', { skipCount: true });
//initScrollHeight(contentInput);
const contentExpandButton = template.find('.editor_maximize');
contentExpandButton.attr('data-for', contentInputId);
template.find('.inline-drawer-toggle').on('click', function () { template.find('.inline-drawer-toggle').on('click', function () {
if (counter.data('first-run')) { if (counter.data('first-run')) {

View File

@@ -174,7 +174,6 @@ export const CHAT_COMPLETION_SOURCES = {
PERPLEXITY: 'perplexity', PERPLEXITY: 'perplexity',
GROQ: 'groq', GROQ: 'groq',
ZEROONEAI: '01ai', ZEROONEAI: '01ai',
BLOCKENTROPY: 'blockentropy',
NANOGPT: 'nanogpt', NANOGPT: 'nanogpt',
DEEPSEEK: 'deepseek', DEEPSEEK: 'deepseek',
}; };

View File

@@ -50,7 +50,6 @@ const API_PERPLEXITY = 'https://api.perplexity.ai';
const API_GROQ = 'https://api.groq.com/openai/v1'; const API_GROQ = 'https://api.groq.com/openai/v1';
const API_MAKERSUITE = 'https://generativelanguage.googleapis.com'; const API_MAKERSUITE = 'https://generativelanguage.googleapis.com';
const API_01AI = 'https://api.lingyiwanwu.com/v1'; const API_01AI = 'https://api.lingyiwanwu.com/v1';
const API_BLOCKENTROPY = 'https://api.blockentropy.ai/v1';
const API_AI21 = 'https://api.ai21.com/studio/v1'; const API_AI21 = 'https://api.ai21.com/studio/v1';
const API_NANOGPT = 'https://nano-gpt.com/api/v1'; const API_NANOGPT = 'https://nano-gpt.com/api/v1';
const API_DEEPSEEK = 'https://api.deepseek.com/beta'; const API_DEEPSEEK = 'https://api.deepseek.com/beta';
@@ -865,10 +864,6 @@ router.post('/status', async function (request, response_getstatus_openai) {
api_url = API_01AI; api_url = API_01AI;
api_key_openai = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI); api_key_openai = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI);
headers = {}; headers = {};
} else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.BLOCKENTROPY) {
api_url = API_BLOCKENTROPY;
api_key_openai = readSecret(request.user.directories, SECRET_KEYS.BLOCKENTROPY);
headers = {};
} else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.NANOGPT) { } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.NANOGPT) {
api_url = API_NANOGPT; api_url = API_NANOGPT;
api_key_openai = readSecret(request.user.directories, SECRET_KEYS.NANOGPT); api_key_openai = readSecret(request.user.directories, SECRET_KEYS.NANOGPT);
@@ -1155,11 +1150,6 @@ router.post('/generate', function (request, response) {
apiKey = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI); apiKey = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI);
headers = {}; headers = {};
bodyParams = {}; bodyParams = {};
} else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.BLOCKENTROPY) {
apiUrl = API_BLOCKENTROPY;
apiKey = readSecret(request.user.directories, SECRET_KEYS.BLOCKENTROPY);
headers = {};
bodyParams = {};
} else { } else {
console.warn('This chat completion source is not supported yet.'); console.warn('This chat completion source is not supported yet.');
return response.status(400).send({ error: true }); return response.status(400).send({ error: true });

View File

@@ -44,7 +44,6 @@ export const SECRET_KEYS = {
ZEROONEAI: 'api_key_01ai', ZEROONEAI: 'api_key_01ai',
HUGGINGFACE: 'api_key_huggingface', HUGGINGFACE: 'api_key_huggingface',
STABILITY: 'api_key_stability', STABILITY: 'api_key_stability',
BLOCKENTROPY: 'api_key_blockentropy',
CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts', CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts',
TAVILY: 'api_key_tavily', TAVILY: 'api_key_tavily',
NANOGPT: 'api_key_nanogpt', NANOGPT: 'api_key_nanogpt',

View File

@@ -907,89 +907,6 @@ stability.post('/generate', async (request, response) => {
} }
}); });
const blockentropy = express.Router();
blockentropy.post('/models', async (request, response) => {
try {
const key = readSecret(request.user.directories, SECRET_KEYS.BLOCKENTROPY);
if (!key) {
console.warn('Block Entropy key not found.');
return response.sendStatus(400);
}
const modelsResponse = await fetch('https://api.blockentropy.ai/sdapi/v1/sd-models', {
method: 'GET',
headers: {
'Authorization': `Bearer ${key}`,
},
});
if (!modelsResponse.ok) {
console.warn('Block Entropy returned an error.');
return response.sendStatus(500);
}
const data = await modelsResponse.json();
if (!Array.isArray(data)) {
console.warn('Block Entropy returned invalid data.');
return response.sendStatus(500);
}
const models = data.map(x => ({ value: x.name, text: x.name }));
return response.send(models);
} catch (error) {
console.error(error);
return response.sendStatus(500);
}
});
blockentropy.post('/generate', async (request, response) => {
try {
const key = readSecret(request.user.directories, SECRET_KEYS.BLOCKENTROPY);
if (!key) {
console.warn('Block Entropy key not found.');
return response.sendStatus(400);
}
console.debug('Block Entropy request:', request.body);
const result = await fetch('https://api.blockentropy.ai/sdapi/v1/txt2img', {
method: 'POST',
body: JSON.stringify({
prompt: request.body.prompt,
negative_prompt: request.body.negative_prompt,
model: request.body.model,
steps: request.body.steps,
width: request.body.width,
height: request.body.height,
// Random seed if negative.
seed: request.body.seed >= 0 ? request.body.seed : Math.floor(Math.random() * 10_000_000),
}),
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${key}`,
},
});
if (!result.ok) {
console.warn('Block Entropy returned an error.');
return response.sendStatus(500);
}
const data = await result.json();
console.debug('Block Entropy response:', data);
return response.send(data);
} catch (error) {
console.error(error);
return response.sendStatus(500);
}
});
const huggingface = express.Router(); const huggingface = express.Router();
huggingface.post('/generate', async (request, response) => { huggingface.post('/generate', async (request, response) => {
@@ -1358,7 +1275,6 @@ router.use('/together', together);
router.use('/drawthings', drawthings); router.use('/drawthings', drawthings);
router.use('/pollinations', pollinations); router.use('/pollinations', pollinations);
router.use('/stability', stability); router.use('/stability', stability);
router.use('/blockentropy', blockentropy);
router.use('/huggingface', huggingface); router.use('/huggingface', huggingface);
router.use('/nanogpt', nanogpt); router.use('/nanogpt', nanogpt);
router.use('/bfl', bfl); router.use('/bfl', bfl);