Merge pull request #3773 from equal-l2/remove-block-entropy Remove Block Entropy references
Signed| @@ -2745,7 +2745,6 @@ | |||
| 2745 | <optgroup> | 2745 | <optgroup> |
| 2746 | <option value="01ai">01.AI (Yi)</option> | 2746 | <option value="01ai">01.AI (Yi)</option> |
| 2747 | <option value="ai21">AI21</option> | 2747 | <option value="ai21">AI21</option> |
| 2748 | <option value="blockentropy">Block Entropy</option> | ||
| 2749 | <option value="claude">Claude</option> | 2748 | <option value="claude">Claude</option> |
| 2750 | <option value="cohere">Cohere</option> | 2749 | <option value="cohere">Cohere</option> |
| 2751 | <option value="deepseek">DeepSeek</option> | 2750 | <option value="deepseek">DeepSeek</option> |
| @@ -3375,20 +3374,6 @@ | |||
| 3375 | </select> | 3374 | </select> |
| 3376 | </div> | 3375 | </div> |
| 3377 | </form> | 3376 | </form> |
| 3378 | <form id="blockentropy_form" data-source="blockentropy"> | ||
| 3379 | <h4 data-i18n="Block Entropy API Key">Block Entropy API Key</h4> | ||
| 3380 | <div class="flex-container"> | ||
| 3381 | <input id="api_key_blockentropy" name="api_key_blockentropy" class="text_pole flex1" value="" type="text" autocomplete="off"> | ||
| 3382 | <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> | ||
| 3383 | </div> | ||
| 3384 | <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."> | ||
| 3385 | For privacy reasons, your API key will be hidden after you reload the page. | ||
| 3386 | </div> | ||
| 3387 | <h4 data-i18n="Select a Model">Select a Model</h4> | ||
| 3388 | <div class="flex-container"> | ||
| 3389 | <select id="model_blockentropy_select" class="text_pole"></select> | ||
| 3390 | </div> | ||
| 3391 | </form> | ||
| 3392 | <form id="custom_form" data-source="custom"> | 3377 | <form id="custom_form" data-source="custom"> |
| 3393 | <h4 data-i18n="Custom Endpoint (Base URL)">Custom Endpoint (Base URL)</h4> | 3378 | <h4 data-i18n="Custom Endpoint (Base URL)">Custom Endpoint (Base URL)</h4> |
| 3394 | <div class="flex-container"> | 3379 | <div class="flex-container"> |
| @@ -407,7 +407,6 @@ function RA_autoconnect(PrevApi) { | |||
| 407 | || (secret_state[SECRET_KEYS.PERPLEXITY] && oai_settings.chat_completion_source == chat_completion_sources.PERPLEXITY) | 407 | || (secret_state[SECRET_KEYS.PERPLEXITY] && oai_settings.chat_completion_source == chat_completion_sources.PERPLEXITY) |
| 408 | || (secret_state[SECRET_KEYS.GROQ] && oai_settings.chat_completion_source == chat_completion_sources.GROQ) | 408 | || (secret_state[SECRET_KEYS.GROQ] && oai_settings.chat_completion_source == chat_completion_sources.GROQ) |
| 409 | || (secret_state[SECRET_KEYS.ZEROONEAI] && oai_settings.chat_completion_source == chat_completion_sources.ZEROONEAI) | 409 | || (secret_state[SECRET_KEYS.ZEROONEAI] && oai_settings.chat_completion_source == chat_completion_sources.ZEROONEAI) |
| 410 | || (secret_state[SECRET_KEYS.BLOCKENTROPY] && oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) | ||
| 411 | || (secret_state[SECRET_KEYS.NANOGPT] && oai_settings.chat_completion_source == chat_completion_sources.NANOGPT) | 410 | || (secret_state[SECRET_KEYS.NANOGPT] && oai_settings.chat_completion_source == chat_completion_sources.NANOGPT) |
| 412 | || (secret_state[SECRET_KEYS.DEEPSEEK] && oai_settings.chat_completion_source == chat_completion_sources.DEEPSEEK) | 411 | || (secret_state[SECRET_KEYS.DEEPSEEK] && oai_settings.chat_completion_source == chat_completion_sources.DEEPSEEK) |
| 413 | || (isValidUrl(oai_settings.custom_url) && oai_settings.chat_completion_source == chat_completion_sources.CUSTOM) | 412 | || (isValidUrl(oai_settings.custom_url) && oai_settings.chat_completion_source == chat_completion_sources.CUSTOM) |
| @@ -77,7 +77,6 @@ const sources = { | |||
| 77 | drawthings: 'drawthings', | 77 | drawthings: 'drawthings', |
| 78 | pollinations: 'pollinations', | 78 | pollinations: 'pollinations', |
| 79 | stability: 'stability', | 79 | stability: 'stability', |
| 80 | blockentropy: 'blockentropy', | ||
| 81 | huggingface: 'huggingface', | 80 | huggingface: 'huggingface', |
| 82 | nanogpt: 'nanogpt', | 81 | nanogpt: 'nanogpt', |
| 83 | bfl: 'bfl', | 82 | bfl: 'bfl', |
| @@ -1300,7 +1299,6 @@ async function onModelChange() { | |||
| 1300 | sources.togetherai, | 1299 | sources.togetherai, |
| 1301 | sources.pollinations, | 1300 | sources.pollinations, |
| 1302 | sources.stability, | 1301 | sources.stability, |
| 1303 | sources.blockentropy, | ||
| 1304 | sources.huggingface, | 1302 | sources.huggingface, |
| 1305 | sources.nanogpt, | 1303 | sources.nanogpt, |
| 1306 | sources.bfl, | 1304 | sources.bfl, |
| @@ -1511,9 +1509,6 @@ async function loadSamplers() { | |||
| 1511 | case sources.stability: | 1509 | case sources.stability: |
| 1512 | samplers = ['N/A']; | 1510 | samplers = ['N/A']; |
| 1513 | break; | 1511 | break; |
| 1514 | case sources.blockentropy: | ||
| 1515 | samplers = ['N/A']; | ||
| 1516 | break; | ||
| 1517 | case sources.huggingface: | 1512 | case sources.huggingface: |
| 1518 | samplers = ['N/A']; | 1513 | samplers = ['N/A']; |
| 1519 | break; | 1514 | break; |
| @@ -1701,9 +1696,6 @@ async function loadModels() { | |||
| 1701 | case sources.stability: | 1696 | case sources.stability: |
| 1702 | models = await loadStabilityModels(); | 1697 | models = await loadStabilityModels(); |
| 1703 | break; | 1698 | break; |
| 1704 | case sources.blockentropy: | ||
| 1705 | models = await loadBlockEntropyModels(); | ||
| 1706 | break; | ||
| 1707 | case sources.huggingface: | 1699 | case sources.huggingface: |
| 1708 | models = [{ value: '', text: '<Enter Model ID above>' }]; | 1700 | models = [{ value: '', text: '<Enter Model ID above>' }]; |
| 1709 | break; | 1701 | break; |
| @@ -1799,26 +1791,6 @@ async function loadTogetherAIModels() { | |||
| 1799 | return []; | 1791 | return []; |
| 1800 | } | 1792 | } |
| 1801 | 1793 | ||
| 1802 | async function loadBlockEntropyModels() { | ||
| 1803 | if (!secret_state[SECRET_KEYS.BLOCKENTROPY]) { | ||
| 1804 | console.debug('Block Entropy API key is not set.'); | ||
| 1805 | return []; | ||
| 1806 | } | ||
| 1807 | |||
| 1808 | const result = await fetch('/api/sd/blockentropy/models', { | ||
| 1809 | method: 'POST', | ||
| 1810 | headers: getRequestHeaders(), | ||
| 1811 | }); | ||
| 1812 | console.log(result); | ||
| 1813 | if (result.ok) { | ||
| 1814 | const data = await result.json(); | ||
| 1815 | console.log(data); | ||
| 1816 | return data; | ||
| 1817 | } | ||
| 1818 | |||
| 1819 | return []; | ||
| 1820 | } | ||
| 1821 | |||
| 1822 | async function loadNanoGPTModels() { | 1794 | async function loadNanoGPTModels() { |
| 1823 | if (!secret_state[SECRET_KEYS.NANOGPT]) { | 1795 | if (!secret_state[SECRET_KEYS.NANOGPT]) { |
| 1824 | console.debug('NanoGPT API key is not set.'); | 1796 | console.debug('NanoGPT API key is not set.'); |
| @@ -2097,9 +2069,6 @@ async function loadSchedulers() { | |||
| 2097 | case sources.stability: | 2069 | case sources.stability: |
| 2098 | schedulers = ['N/A']; | 2070 | schedulers = ['N/A']; |
| 2099 | break; | 2071 | break; |
| 2100 | case sources.blockentropy: | ||
| 2101 | schedulers = ['N/A']; | ||
| 2102 | break; | ||
| 2103 | case sources.huggingface: | 2072 | case sources.huggingface: |
| 2104 | schedulers = ['N/A']; | 2073 | schedulers = ['N/A']; |
| 2105 | break; | 2074 | break; |
| @@ -2188,9 +2157,6 @@ async function loadVaes() { | |||
| 2188 | case sources.stability: | 2157 | case sources.stability: |
| 2189 | vaes = ['N/A']; | 2158 | vaes = ['N/A']; |
| 2190 | break; | 2159 | break; |
| 2191 | case sources.blockentropy: | ||
| 2192 | vaes = ['N/A']; | ||
| 2193 | break; | ||
| 2194 | case sources.huggingface: | 2160 | case sources.huggingface: |
| 2195 | vaes = ['N/A']; | 2161 | vaes = ['N/A']; |
| 2196 | break; | 2162 | break; |
| @@ -2757,9 +2723,6 @@ async function sendGenerationRequest(generationType, prompt, additionalNegativeP | |||
| 2757 | case sources.stability: | 2723 | case sources.stability: |
| 2758 | result = await generateStabilityImage(prefixedPrompt, negativePrompt, signal); | 2724 | result = await generateStabilityImage(prefixedPrompt, negativePrompt, signal); |
| 2759 | break; | 2725 | break; |
| 2760 | case sources.blockentropy: | ||
| 2761 | result = await generateBlockEntropyImage(prefixedPrompt, negativePrompt, signal); | ||
| 2762 | break; | ||
| 2763 | case sources.huggingface: | 2726 | case sources.huggingface: |
| 2764 | result = await generateHuggingFaceImage(prefixedPrompt, signal); | 2727 | result = await generateHuggingFaceImage(prefixedPrompt, signal); |
| 2765 | break; | 2728 | break; |
| @@ -2828,40 +2791,6 @@ async function generateTogetherAIImage(prompt, negativePrompt, signal) { | |||
| 2828 | } | 2791 | } |
| 2829 | } | 2792 | } |
| 2830 | 2793 | ||
| 2831 | async function generateBlockEntropyImage(prompt, negativePrompt, signal) { | ||
| 2832 | const result = await fetch('/api/sd/blockentropy/generate', { | ||
| 2833 | method: 'POST', | ||
| 2834 | headers: getRequestHeaders(), | ||
| 2835 | signal: signal, | ||
| 2836 | body: JSON.stringify({ | ||
| 2837 | prompt: prompt, | ||
| 2838 | negative_prompt: negativePrompt, | ||
| 2839 | model: extension_settings.sd.model, | ||
| 2840 | steps: extension_settings.sd.steps, | ||
| 2841 | width: extension_settings.sd.width, | ||
| 2842 | height: extension_settings.sd.height, | ||
| 2843 | seed: extension_settings.sd.seed >= 0 ? extension_settings.sd.seed : undefined, | ||
| 2844 | }), | ||
| 2845 | }); | ||
| 2846 | |||
| 2847 | if (result.ok) { | ||
| 2848 | const data = await result.json(); | ||
| 2849 | |||
| 2850 | // Default format is 'jpg' | ||
| 2851 | let format = 'jpg'; | ||
| 2852 | |||
| 2853 | // Check if a format is specified in the result | ||
| 2854 | if (data.format) { | ||
| 2855 | format = data.format.toLowerCase(); | ||
| 2856 | } | ||
| 2857 | |||
| 2858 | return { format: format, data: data.images[0] }; | ||
| 2859 | } else { | ||
| 2860 | const text = await result.text(); | ||
| 2861 | throw new Error(text); | ||
| 2862 | } | ||
| 2863 | } | ||
| 2864 | |||
| 2865 | /** | 2794 | /** |
| 2866 | * Generates an image using the Pollinations API. | 2795 | * Generates an image using the Pollinations API. |
| 2867 | * @param {string} prompt - The main instruction used to guide the image generation. | 2796 | * @param {string} prompt - The main instruction used to guide the image generation. |
| @@ -3845,8 +3774,6 @@ function isValidState() { | |||
| 3845 | return true; | 3774 | return true; |
| 3846 | case sources.stability: | 3775 | case sources.stability: |
| 3847 | return secret_state[SECRET_KEYS.STABILITY]; | 3776 | return secret_state[SECRET_KEYS.STABILITY]; |
| 3848 | case sources.blockentropy: | ||
| 3849 | return secret_state[SECRET_KEYS.BLOCKENTROPY]; | ||
| 3850 | case sources.huggingface: | 3777 | case sources.huggingface: |
| 3851 | return secret_state[SECRET_KEYS.HUGGINGFACE]; | 3778 | return secret_state[SECRET_KEYS.HUGGINGFACE]; |
| 3852 | case sources.nanogpt: | 3779 | case sources.nanogpt: |
| @@ -38,7 +38,6 @@ | |||
| 38 | <label for="sd_source" data-i18n="Source">Source</label> | 38 | <label for="sd_source" data-i18n="Source">Source</label> |
| 39 | <select id="sd_source"> | 39 | <select id="sd_source"> |
| 40 | <option value="bfl">BFL (Black Forest Labs)</option> | 40 | <option value="bfl">BFL (Black Forest Labs)</option> |
| 41 | <option value="blockentropy">Block Entropy</option> | ||
| 42 | <option value="comfy">ComfyUI</option> | 41 | <option value="comfy">ComfyUI</option> |
| 43 | <option value="drawthings">DrawThings HTTP API</option> | 42 | <option value="drawthings">DrawThings HTTP API</option> |
| 44 | <option value="extras">Extras API (deprecated)</option> | 43 | <option value="extras">Extras API (deprecated)</option> |
| @@ -422,7 +421,7 @@ | |||
| 422 | </label> | 421 | </label> |
| 423 | </div> | 422 | </div> |
| 424 | 423 | ||
| 425 | <div data-sd-source="novel,togetherai,pollinations,comfy,drawthings,vlad,auto,horde,extras,stability,blockentropy,bfl" class="marginTop5"> | 424 | <div data-sd-source="novel,togetherai,pollinations,comfy,drawthings,vlad,auto,horde,extras,stability,bfl" class="marginTop5"> |
| 426 | <label for="sd_seed"> | 425 | <label for="sd_seed"> |
| 427 | <span data-i18n="Seed">Seed</span> | 426 | <span data-i18n="Seed">Seed</span> |
| 428 | <small data-i18n="(-1 for random)">(-1 for random)</small> | 427 | <small data-i18n="(-1 for random)">(-1 for random)</small> |
| @@ -182,7 +182,6 @@ export const chat_completion_sources = { | |||
| 182 | PERPLEXITY: 'perplexity', | 182 | PERPLEXITY: 'perplexity', |
| 183 | GROQ: 'groq', | 183 | GROQ: 'groq', |
| 184 | ZEROONEAI: '01ai', | 184 | ZEROONEAI: '01ai', |
| 185 | BLOCKENTROPY: 'blockentropy', | ||
| 186 | NANOGPT: 'nanogpt', | 185 | NANOGPT: 'nanogpt', |
| 187 | DEEPSEEK: 'deepseek', | 186 | DEEPSEEK: 'deepseek', |
| 188 | }; | 187 | }; |
| @@ -258,7 +257,6 @@ export const settingsToUpdate = { | |||
| 258 | nanogpt_model: ['#model_nanogpt_select', 'nanogpt_model', false], | 257 | nanogpt_model: ['#model_nanogpt_select', 'nanogpt_model', false], |
| 259 | deepseek_model: ['#model_deepseek_select', 'deepseek_model', false], | 258 | deepseek_model: ['#model_deepseek_select', 'deepseek_model', false], |
| 260 | zerooneai_model: ['#model_01ai_select', 'zerooneai_model', false], | 259 | zerooneai_model: ['#model_01ai_select', 'zerooneai_model', false], |
| 261 | blockentropy_model: ['#model_blockentropy_select', 'blockentropy_model', false], | ||
| 262 | custom_model: ['#custom_model_id', 'custom_model', false], | 260 | custom_model: ['#custom_model_id', 'custom_model', false], |
| 263 | custom_url: ['#custom_api_url_text', 'custom_url', false], | 261 | custom_url: ['#custom_api_url_text', 'custom_url', false], |
| 264 | custom_include_body: ['#custom_include_body', 'custom_include_body', false], | 262 | custom_include_body: ['#custom_include_body', 'custom_include_body', false], |
| @@ -346,7 +344,6 @@ const default_settings = { | |||
| 346 | groq_model: 'llama-3.3-70b-versatile', | 344 | groq_model: 'llama-3.3-70b-versatile', |
| 347 | nanogpt_model: 'gpt-4o-mini', | 345 | nanogpt_model: 'gpt-4o-mini', |
| 348 | zerooneai_model: 'yi-large', | 346 | zerooneai_model: 'yi-large', |
| 349 | blockentropy_model: 'be-70b-base-llama3.1', | ||
| 350 | deepseek_model: 'deepseek-chat', | 347 | deepseek_model: 'deepseek-chat', |
| 351 | custom_model: '', | 348 | custom_model: '', |
| 352 | custom_url: '', | 349 | custom_url: '', |
| @@ -427,7 +424,6 @@ const oai_settings = { | |||
| 427 | groq_model: 'llama-3.1-70b-versatile', | 424 | groq_model: 'llama-3.1-70b-versatile', |
| 428 | nanogpt_model: 'gpt-4o-mini', | 425 | nanogpt_model: 'gpt-4o-mini', |
| 429 | zerooneai_model: 'yi-large', | 426 | zerooneai_model: 'yi-large', |
| 430 | blockentropy_model: 'be-70b-base-llama3.1', | ||
| 431 | deepseek_model: 'deepseek-chat', | 427 | deepseek_model: 'deepseek-chat', |
| 432 | custom_model: '', | 428 | custom_model: '', |
| 433 | custom_url: '', | 429 | custom_url: '', |
| @@ -1637,8 +1633,6 @@ export function getChatCompletionModel(source = null) { | |||
| 1637 | return oai_settings.groq_model; | 1633 | return oai_settings.groq_model; |
| 1638 | case chat_completion_sources.ZEROONEAI: | 1634 | case chat_completion_sources.ZEROONEAI: |
| 1639 | return oai_settings.zerooneai_model; | 1635 | return oai_settings.zerooneai_model; |
| 1640 | case chat_completion_sources.BLOCKENTROPY: | ||
| 1641 | return oai_settings.blockentropy_model; | ||
| 1642 | case chat_completion_sources.NANOGPT: | 1636 | case chat_completion_sources.NANOGPT: |
| 1643 | return oai_settings.nanogpt_model; | 1637 | return oai_settings.nanogpt_model; |
| 1644 | case chat_completion_sources.DEEPSEEK: | 1638 | case chat_completion_sources.DEEPSEEK: |
| @@ -1757,23 +1751,6 @@ function saveModelList(data) { | |||
| 1757 | $('#model_01ai_select').val(oai_settings.zerooneai_model).trigger('change'); | 1751 | $('#model_01ai_select').val(oai_settings.zerooneai_model).trigger('change'); |
| 1758 | } | 1752 | } |
| 1759 | 1753 | ||
| 1760 | if (oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) { | ||
| 1761 | $('#model_blockentropy_select').empty(); | ||
| 1762 | model_list.forEach((model) => { | ||
| 1763 | $('#model_blockentropy_select').append( | ||
| 1764 | $('<option>', { | ||
| 1765 | value: model.id, | ||
| 1766 | text: model.id, | ||
| 1767 | })); | ||
| 1768 | }); | ||
| 1769 | |||
| 1770 | if (!oai_settings.blockentropy_model && model_list.length > 0) { | ||
| 1771 | oai_settings.blockentropy_model = model_list[0].id; | ||
| 1772 | } | ||
| 1773 | |||
| 1774 | $('#model_blockentropy_select').val(oai_settings.blockentropy_model).trigger('change'); | ||
| 1775 | } | ||
| 1776 | |||
| 1777 | if (oai_settings.chat_completion_source == chat_completion_sources.MISTRALAI) { | 1754 | if (oai_settings.chat_completion_source == chat_completion_sources.MISTRALAI) { |
| 1778 | /** @type {HTMLSelectElement} */ | 1755 | /** @type {HTMLSelectElement} */ |
| 1779 | const mistralModelSelect = document.querySelector('#model_mistralai_select'); | 1756 | const mistralModelSelect = document.querySelector('#model_mistralai_select'); |
| @@ -3246,7 +3223,6 @@ function loadOpenAISettings(data, settings) { | |||
| 3246 | oai_settings.groq_model = settings.groq_model ?? default_settings.groq_model; | 3223 | oai_settings.groq_model = settings.groq_model ?? default_settings.groq_model; |
| 3247 | oai_settings.nanogpt_model = settings.nanogpt_model ?? default_settings.nanogpt_model; | 3224 | oai_settings.nanogpt_model = settings.nanogpt_model ?? default_settings.nanogpt_model; |
| 3248 | oai_settings.deepseek_model = settings.deepseek_model ?? default_settings.deepseek_model; | 3225 | oai_settings.deepseek_model = settings.deepseek_model ?? default_settings.deepseek_model; |
| 3249 | oai_settings.blockentropy_model = settings.blockentropy_model ?? default_settings.blockentropy_model; | ||
| 3250 | oai_settings.zerooneai_model = settings.zerooneai_model ?? default_settings.zerooneai_model; | 3226 | oai_settings.zerooneai_model = settings.zerooneai_model ?? default_settings.zerooneai_model; |
| 3251 | oai_settings.custom_model = settings.custom_model ?? default_settings.custom_model; | 3227 | oai_settings.custom_model = settings.custom_model ?? default_settings.custom_model; |
| 3252 | oai_settings.custom_url = settings.custom_url ?? default_settings.custom_url; | 3228 | oai_settings.custom_url = settings.custom_url ?? default_settings.custom_url; |
| @@ -3333,7 +3309,6 @@ function loadOpenAISettings(data, settings) { | |||
| 3333 | $('#model_deepseek_select').val(oai_settings.deepseek_model); | 3309 | $('#model_deepseek_select').val(oai_settings.deepseek_model); |
| 3334 | $(`#model_deepseek_select option[value="${oai_settings.deepseek_model}"`).prop('selected', true); | 3310 | $(`#model_deepseek_select option[value="${oai_settings.deepseek_model}"`).prop('selected', true); |
| 3335 | $('#model_01ai_select').val(oai_settings.zerooneai_model); | 3311 | $('#model_01ai_select').val(oai_settings.zerooneai_model); |
| 3336 | $('#model_blockentropy_select').val(oai_settings.blockentropy_model); | ||
| 3337 | $('#custom_model_id').val(oai_settings.custom_model); | 3312 | $('#custom_model_id').val(oai_settings.custom_model); |
| 3338 | $('#custom_api_url_text').val(oai_settings.custom_url); | 3313 | $('#custom_api_url_text').val(oai_settings.custom_url); |
| 3339 | $('#openai_max_context').val(oai_settings.openai_max_context); | 3314 | $('#openai_max_context').val(oai_settings.openai_max_context); |
| @@ -3613,7 +3588,6 @@ async function saveOpenAIPreset(name, settings, triggerUi = true) { | |||
| 3613 | perplexity_model: settings.perplexity_model, | 3588 | perplexity_model: settings.perplexity_model, |
| 3614 | groq_model: settings.groq_model, | 3589 | groq_model: settings.groq_model, |
| 3615 | zerooneai_model: settings.zerooneai_model, | 3590 | zerooneai_model: settings.zerooneai_model, |
| 3616 | blockentropy_model: settings.blockentropy_model, | ||
| 3617 | custom_model: settings.custom_model, | 3591 | custom_model: settings.custom_model, |
| 3618 | custom_url: settings.custom_url, | 3592 | custom_url: settings.custom_url, |
| 3619 | custom_include_body: settings.custom_include_body, | 3593 | custom_include_body: settings.custom_include_body, |
| @@ -4322,12 +4296,6 @@ async function onModelChange() { | |||
| 4322 | oai_settings.zerooneai_model = value; | 4296 | oai_settings.zerooneai_model = value; |
| 4323 | } | 4297 | } |
| 4324 | 4298 | ||
| 4325 | if (value && $(this).is('#model_blockentropy_select')) { | ||
| 4326 | console.log('Block Entropy model changed to', value); | ||
| 4327 | oai_settings.blockentropy_model = value; | ||
| 4328 | $('#blockentropy_model_id').val(value).trigger('input'); | ||
| 4329 | } | ||
| 4330 | |||
| 4331 | if (value && $(this).is('#model_custom_select')) { | 4299 | if (value && $(this).is('#model_custom_select')) { |
| 4332 | console.log('Custom model changed to', value); | 4300 | console.log('Custom model changed to', value); |
| 4333 | oai_settings.custom_model = value; | 4301 | oai_settings.custom_model = value; |
| @@ -4577,29 +4545,6 @@ async function onModelChange() { | |||
| 4577 | oai_settings.temp_openai = Math.min(oai_max_temp, oai_settings.temp_openai); | 4545 | oai_settings.temp_openai = Math.min(oai_max_temp, oai_settings.temp_openai); |
| 4578 | $('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input'); | 4546 | $('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input'); |
| 4579 | } | 4547 | } |
| 4580 | if (oai_settings.chat_completion_source === chat_completion_sources.BLOCKENTROPY) { | ||
| 4581 | if (oai_settings.max_context_unlocked) { | ||
| 4582 | $('#openai_max_context').attr('max', unlocked_max); | ||
| 4583 | } | ||
| 4584 | else if (oai_settings.blockentropy_model.includes('llama3.1')) { | ||
| 4585 | $('#openai_max_context').attr('max', max_16k); | ||
| 4586 | } | ||
| 4587 | else if (oai_settings.blockentropy_model.includes('72b')) { | ||
| 4588 | $('#openai_max_context').attr('max', max_16k); | ||
| 4589 | } | ||
| 4590 | else if (oai_settings.blockentropy_model.includes('120b')) { | ||
| 4591 | $('#openai_max_context').attr('max', max_12k); | ||
| 4592 | } | ||
| 4593 | else { | ||
| 4594 | $('#openai_max_context').attr('max', max_8k); | ||
| 4595 | } | ||
| 4596 | |||
| 4597 | oai_settings.openai_max_context = Math.min(oai_settings.openai_max_context, Number($('#openai_max_context').attr('max'))); | ||
| 4598 | $('#openai_max_context').val(oai_settings.openai_max_context).trigger('input'); | ||
| 4599 | |||
| 4600 | oai_settings.temp_openai = Math.min(oai_max_temp, oai_settings.temp_openai); | ||
| 4601 | $('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input'); | ||
| 4602 | } | ||
| 4603 | 4548 | ||
| 4604 | if (oai_settings.chat_completion_source === chat_completion_sources.NANOGPT) { | 4549 | if (oai_settings.chat_completion_source === chat_completion_sources.NANOGPT) { |
| 4605 | if (oai_settings.max_context_unlocked) { | 4550 | if (oai_settings.max_context_unlocked) { |
| @@ -4866,18 +4811,6 @@ async function onConnectButtonClick(e) { | |||
| 4866 | return; | 4811 | return; |
| 4867 | } | 4812 | } |
| 4868 | } | 4813 | } |
| 4869 | if (oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) { | ||
| 4870 | const api_key_blockentropy = String($('#api_key_blockentropy').val()).trim(); | ||
| 4871 | |||
| 4872 | if (api_key_blockentropy.length) { | ||
| 4873 | await writeSecret(SECRET_KEYS.BLOCKENTROPY, api_key_blockentropy); | ||
| 4874 | } | ||
| 4875 | |||
| 4876 | if (!secret_state[SECRET_KEYS.BLOCKENTROPY]) { | ||
| 4877 | console.log('No secret key saved for Block Entropy'); | ||
| 4878 | return; | ||
| 4879 | } | ||
| 4880 | } | ||
| 4881 | 4814 | ||
| 4882 | startStatusLoading(); | 4815 | startStatusLoading(); |
| 4883 | saveSettingsDebounced(); | 4816 | saveSettingsDebounced(); |
| @@ -4932,9 +4865,6 @@ function toggleChatCompletionForms() { | |||
| 4932 | else if (oai_settings.chat_completion_source == chat_completion_sources.CUSTOM) { | 4865 | else if (oai_settings.chat_completion_source == chat_completion_sources.CUSTOM) { |
| 4933 | $('#model_custom_select').trigger('change'); | 4866 | $('#model_custom_select').trigger('change'); |
| 4934 | } | 4867 | } |
| 4935 | else if (oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) { | ||
| 4936 | $('#model_blockentropy_select').trigger('change'); | ||
| 4937 | } | ||
| 4938 | else if (oai_settings.chat_completion_source == chat_completion_sources.DEEPSEEK) { | 4868 | else if (oai_settings.chat_completion_source == chat_completion_sources.DEEPSEEK) { |
| 4939 | $('#model_deepseek_select').trigger('change'); | 4869 | $('#model_deepseek_select').trigger('change'); |
| 4940 | } | 4870 | } |
| @@ -5687,7 +5617,6 @@ export function initOpenAI() { | |||
| 5687 | $('#model_nanogpt_select').on('change', onModelChange); | 5617 | $('#model_nanogpt_select').on('change', onModelChange); |
| 5688 | $('#model_deepseek_select').on('change', onModelChange); | 5618 | $('#model_deepseek_select').on('change', onModelChange); |
| 5689 | $('#model_01ai_select').on('change', onModelChange); | 5619 | $('#model_01ai_select').on('change', onModelChange); |
| 5690 | $('#model_blockentropy_select').on('change', onModelChange); | ||
| 5691 | $('#model_custom_select').on('change', onModelChange); | 5620 | $('#model_custom_select').on('change', onModelChange); |
| 5692 | $('#settings_preset_openai').on('change', onSettingsPresetChange); | 5621 | $('#settings_preset_openai').on('change', onSettingsPresetChange); |
| 5693 | $('#new_oai_preset').on('click', onNewPresetClick); | 5622 | $('#new_oai_preset').on('click', onNewPresetClick); |
| @@ -34,7 +34,6 @@ export const SECRET_KEYS = { | |||
| 34 | ZEROONEAI: 'api_key_01ai', | 34 | ZEROONEAI: 'api_key_01ai', |
| 35 | HUGGINGFACE: 'api_key_huggingface', | 35 | HUGGINGFACE: 'api_key_huggingface', |
| 36 | STABILITY: 'api_key_stability', | 36 | STABILITY: 'api_key_stability', |
| 37 | BLOCKENTROPY: 'api_key_blockentropy', | ||
| 38 | CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts', | 37 | CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts', |
| 39 | NANOGPT: 'api_key_nanogpt', | 38 | NANOGPT: 'api_key_nanogpt', |
| 40 | TAVILY: 'api_key_tavily', | 39 | TAVILY: 'api_key_tavily', |
| @@ -74,7 +73,6 @@ const INPUT_MAP = { | |||
| 74 | [SECRET_KEYS.FEATHERLESS]: '#api_key_featherless', | 73 | [SECRET_KEYS.FEATHERLESS]: '#api_key_featherless', |
| 75 | [SECRET_KEYS.ZEROONEAI]: '#api_key_01ai', | 74 | [SECRET_KEYS.ZEROONEAI]: '#api_key_01ai', |
| 76 | [SECRET_KEYS.HUGGINGFACE]: '#api_key_huggingface', | 75 | [SECRET_KEYS.HUGGINGFACE]: '#api_key_huggingface', |
| 77 | [SECRET_KEYS.BLOCKENTROPY]: '#api_key_blockentropy', | ||
| 78 | [SECRET_KEYS.NANOGPT]: '#api_key_nanogpt', | 76 | [SECRET_KEYS.NANOGPT]: '#api_key_nanogpt', |
| 79 | [SECRET_KEYS.GENERIC]: '#api_key_generic', | 77 | [SECRET_KEYS.GENERIC]: '#api_key_generic', |
| 80 | [SECRET_KEYS.DEEPSEEK]: '#api_key_deepseek', | 78 | [SECRET_KEYS.DEEPSEEK]: '#api_key_deepseek', |
| @@ -3936,7 +3936,6 @@ function getModelOptions(quiet) { | |||
| 3936 | { id: 'model_groq_select', api: 'openai', type: chat_completion_sources.GROQ }, | 3936 | { id: 'model_groq_select', api: 'openai', type: chat_completion_sources.GROQ }, |
| 3937 | { id: 'model_nanogpt_select', api: 'openai', type: chat_completion_sources.NANOGPT }, | 3937 | { id: 'model_nanogpt_select', api: 'openai', type: chat_completion_sources.NANOGPT }, |
| 3938 | { id: 'model_01ai_select', api: 'openai', type: chat_completion_sources.ZEROONEAI }, | 3938 | { id: 'model_01ai_select', api: 'openai', type: chat_completion_sources.ZEROONEAI }, |
| 3939 | { id: 'model_blockentropy_select', api: 'openai', type: chat_completion_sources.BLOCKENTROPY }, | ||
| 3940 | { id: 'model_deepseek_select', api: 'openai', type: chat_completion_sources.DEEPSEEK }, | 3939 | { id: 'model_deepseek_select', api: 'openai', type: chat_completion_sources.DEEPSEEK }, |
| 3941 | { id: 'model_novel_select', api: 'novel', type: null }, | 3940 | { id: 'model_novel_select', api: 'novel', type: null }, |
| 3942 | { id: 'horde_model', api: 'koboldhorde', type: null }, | 3941 | { id: 'horde_model', api: 'koboldhorde', type: null }, |
| @@ -729,15 +729,6 @@ export function getTokenizerModel() { | |||
| 729 | return yiTokenizer; | 729 | return yiTokenizer; |
| 730 | } | 730 | } |
| 731 | 731 | ||
| 732 | if (oai_settings.chat_completion_source === chat_completion_sources.BLOCKENTROPY) { | ||
| 733 | if (oai_settings.blockentropy_model.includes('llama3')) { | ||
| 734 | return llama3Tokenizer; | ||
| 735 | } | ||
| 736 | if (oai_settings.blockentropy_model.includes('miqu') || oai_settings.blockentropy_model.includes('mixtral')) { | ||
| 737 | return mistralTokenizer; | ||
| 738 | } | ||
| 739 | } | ||
| 740 | |||
| 741 | // Default to Turbo 3.5 | 732 | // Default to Turbo 3.5 |
| 742 | return turboTokenizer; | 733 | return turboTokenizer; |
| 743 | } | 734 | } |
| @@ -174,7 +174,6 @@ export const CHAT_COMPLETION_SOURCES = { | |||
| 174 | PERPLEXITY: 'perplexity', | 174 | PERPLEXITY: 'perplexity', |
| 175 | GROQ: 'groq', | 175 | GROQ: 'groq', |
| 176 | ZEROONEAI: '01ai', | 176 | ZEROONEAI: '01ai', |
| 177 | BLOCKENTROPY: 'blockentropy', | ||
| 178 | NANOGPT: 'nanogpt', | 177 | NANOGPT: 'nanogpt', |
| 179 | DEEPSEEK: 'deepseek', | 178 | DEEPSEEK: 'deepseek', |
| 180 | }; | 179 | }; |
| @@ -50,7 +50,6 @@ const API_PERPLEXITY = 'https://api.perplexity.ai'; | |||
| 50 | const API_GROQ = 'https://api.groq.com/openai/v1'; | 50 | const API_GROQ = 'https://api.groq.com/openai/v1'; |
| 51 | const API_MAKERSUITE = 'https://generativelanguage.googleapis.com'; | 51 | const API_MAKERSUITE = 'https://generativelanguage.googleapis.com'; |
| 52 | const API_01AI = 'https://api.lingyiwanwu.com/v1'; | 52 | const API_01AI = 'https://api.lingyiwanwu.com/v1'; |
| 53 | const API_BLOCKENTROPY = 'https://api.blockentropy.ai/v1'; | ||
| 54 | const API_AI21 = 'https://api.ai21.com/studio/v1'; | 53 | const API_AI21 = 'https://api.ai21.com/studio/v1'; |
| 55 | const API_NANOGPT = 'https://nano-gpt.com/api/v1'; | 54 | const API_NANOGPT = 'https://nano-gpt.com/api/v1'; |
| 56 | const API_DEEPSEEK = 'https://api.deepseek.com/beta'; | 55 | const API_DEEPSEEK = 'https://api.deepseek.com/beta'; |
| @@ -865,10 +864,6 @@ router.post('/status', async function (request, response_getstatus_openai) { | |||
| 865 | api_url = API_01AI; | 864 | api_url = API_01AI; |
| 866 | api_key_openai = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI); | 865 | api_key_openai = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI); |
| 867 | headers = {}; | 866 | headers = {}; |
| 868 | } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.BLOCKENTROPY) { | ||
| 869 | api_url = API_BLOCKENTROPY; | ||
| 870 | api_key_openai = readSecret(request.user.directories, SECRET_KEYS.BLOCKENTROPY); | ||
| 871 | headers = {}; | ||
| 872 | } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.NANOGPT) { | 867 | } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.NANOGPT) { |
| 873 | api_url = API_NANOGPT; | 868 | api_url = API_NANOGPT; |
| 874 | api_key_openai = readSecret(request.user.directories, SECRET_KEYS.NANOGPT); | 869 | api_key_openai = readSecret(request.user.directories, SECRET_KEYS.NANOGPT); |
| @@ -1155,11 +1150,6 @@ router.post('/generate', function (request, response) { | |||
| 1155 | apiKey = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI); | 1150 | apiKey = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI); |
| 1156 | headers = {}; | 1151 | headers = {}; |
| 1157 | bodyParams = {}; | 1152 | bodyParams = {}; |
| 1158 | } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.BLOCKENTROPY) { | ||
| 1159 | apiUrl = API_BLOCKENTROPY; | ||
| 1160 | apiKey = readSecret(request.user.directories, SECRET_KEYS.BLOCKENTROPY); | ||
| 1161 | headers = {}; | ||
| 1162 | bodyParams = {}; | ||
| 1163 | } else { | 1153 | } else { |
| 1164 | console.warn('This chat completion source is not supported yet.'); | 1154 | console.warn('This chat completion source is not supported yet.'); |
| 1165 | return response.status(400).send({ error: true }); | 1155 | return response.status(400).send({ error: true }); |
| @@ -44,7 +44,6 @@ export const SECRET_KEYS = { | |||
| 44 | ZEROONEAI: 'api_key_01ai', | 44 | ZEROONEAI: 'api_key_01ai', |
| 45 | HUGGINGFACE: 'api_key_huggingface', | 45 | HUGGINGFACE: 'api_key_huggingface', |
| 46 | STABILITY: 'api_key_stability', | 46 | STABILITY: 'api_key_stability', |
| 47 | BLOCKENTROPY: 'api_key_blockentropy', | ||
| 48 | CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts', | 47 | CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts', |
| 49 | TAVILY: 'api_key_tavily', | 48 | TAVILY: 'api_key_tavily', |
| 50 | NANOGPT: 'api_key_nanogpt', | 49 | NANOGPT: 'api_key_nanogpt', |
| @@ -907,89 +907,6 @@ stability.post('/generate', async (request, response) => { | |||
| 907 | } | 907 | } |
| 908 | }); | 908 | }); |
| 909 | 909 | ||
| 910 | const blockentropy = express.Router(); | ||
| 911 | |||
| 912 | blockentropy.post('/models', async (request, response) => { | ||
| 913 | try { | ||
| 914 | const key = readSecret(request.user.directories, SECRET_KEYS.BLOCKENTROPY); | ||
| 915 | |||
| 916 | if (!key) { | ||
| 917 | console.warn('Block Entropy key not found.'); | ||
| 918 | return response.sendStatus(400); | ||
| 919 | } | ||
| 920 | |||
| 921 | const modelsResponse = await fetch('https://api.blockentropy.ai/sdapi/v1/sd-models', { | ||
| 922 | method: 'GET', | ||
| 923 | headers: { | ||
| 924 | 'Authorization': `Bearer ${key}`, | ||
| 925 | }, | ||
| 926 | }); | ||
| 927 | |||
| 928 | if (!modelsResponse.ok) { | ||
| 929 | console.warn('Block Entropy returned an error.'); | ||
| 930 | return response.sendStatus(500); | ||
| 931 | } | ||
| 932 | |||
| 933 | const data = await modelsResponse.json(); | ||
| 934 | |||
| 935 | if (!Array.isArray(data)) { | ||
| 936 | console.warn('Block Entropy returned invalid data.'); | ||
| 937 | return response.sendStatus(500); | ||
| 938 | } | ||
| 939 | const models = data.map(x => ({ value: x.name, text: x.name })); | ||
| 940 | return response.send(models); | ||
| 941 | |||
| 942 | } catch (error) { | ||
| 943 | console.error(error); | ||
| 944 | return response.sendStatus(500); | ||
| 945 | } | ||
| 946 | }); | ||
| 947 | |||
| 948 | blockentropy.post('/generate', async (request, response) => { | ||
| 949 | try { | ||
| 950 | const key = readSecret(request.user.directories, SECRET_KEYS.BLOCKENTROPY); | ||
| 951 | |||
| 952 | if (!key) { | ||
| 953 | console.warn('Block Entropy key not found.'); | ||
| 954 | return response.sendStatus(400); | ||
| 955 | } | ||
| 956 | |||
| 957 | console.debug('Block Entropy request:', request.body); | ||
| 958 | |||
| 959 | const result = await fetch('https://api.blockentropy.ai/sdapi/v1/txt2img', { | ||
| 960 | method: 'POST', | ||
| 961 | body: JSON.stringify({ | ||
| 962 | prompt: request.body.prompt, | ||
| 963 | negative_prompt: request.body.negative_prompt, | ||
| 964 | model: request.body.model, | ||
| 965 | steps: request.body.steps, | ||
| 966 | width: request.body.width, | ||
| 967 | height: request.body.height, | ||
| 968 | // Random seed if negative. | ||
| 969 | seed: request.body.seed >= 0 ? request.body.seed : Math.floor(Math.random() * 10_000_000), | ||
| 970 | }), | ||
| 971 | headers: { | ||
| 972 | 'Content-Type': 'application/json', | ||
| 973 | 'Authorization': `Bearer ${key}`, | ||
| 974 | }, | ||
| 975 | }); | ||
| 976 | |||
| 977 | if (!result.ok) { | ||
| 978 | console.warn('Block Entropy returned an error.'); | ||
| 979 | return response.sendStatus(500); | ||
| 980 | } | ||
| 981 | |||
| 982 | const data = await result.json(); | ||
| 983 | console.debug('Block Entropy response:', data); | ||
| 984 | |||
| 985 | return response.send(data); | ||
| 986 | } catch (error) { | ||
| 987 | console.error(error); | ||
| 988 | return response.sendStatus(500); | ||
| 989 | } | ||
| 990 | }); | ||
| 991 | |||
| 992 | |||
| 993 | const huggingface = express.Router(); | 910 | const huggingface = express.Router(); |
| 994 | 911 | ||
| 995 | huggingface.post('/generate', async (request, response) => { | 912 | huggingface.post('/generate', async (request, response) => { |
| @@ -1358,7 +1275,6 @@ router.use('/together', together); | |||
| 1358 | router.use('/drawthings', drawthings); | 1275 | router.use('/drawthings', drawthings); |
| 1359 | router.use('/pollinations', pollinations); | 1276 | router.use('/pollinations', pollinations); |
| 1360 | router.use('/stability', stability); | 1277 | router.use('/stability', stability); |
| 1361 | router.use('/blockentropy', blockentropy); | ||
| 1362 | router.use('/huggingface', huggingface); | 1278 | router.use('/huggingface', huggingface); |
| 1363 | router.use('/nanogpt', nanogpt); | 1279 | router.use('/nanogpt', nanogpt); |
| 1364 | router.use('/bfl', bfl); | 1280 | router.use('/bfl', bfl); |