mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into parser-v2
This commit is contained in:
@@ -30,7 +30,7 @@ function migrateSettings() {
|
||||
if (extension_settings.caption.source === 'openai') {
|
||||
extension_settings.caption.source = 'multimodal';
|
||||
extension_settings.caption.multimodal_api = 'openai';
|
||||
extension_settings.caption.multimodal_model = 'gpt-4-vision-preview';
|
||||
extension_settings.caption.multimodal_model = 'gpt-4-turbo';
|
||||
}
|
||||
|
||||
if (!extension_settings.caption.multimodal_api) {
|
||||
@@ -38,7 +38,7 @@ function migrateSettings() {
|
||||
}
|
||||
|
||||
if (!extension_settings.caption.multimodal_model) {
|
||||
extension_settings.caption.multimodal_model = 'gpt-4-vision-preview';
|
||||
extension_settings.caption.multimodal_model = 'gpt-4-turbo';
|
||||
}
|
||||
|
||||
if (!extension_settings.caption.prompt) {
|
||||
@@ -369,6 +369,7 @@ jQuery(function () {
|
||||
<label for="caption_multimodal_model">Model</label>
|
||||
<select id="caption_multimodal_model" class="flex1 text_pole">
|
||||
<option data-type="openai" value="gpt-4-vision-preview">gpt-4-vision-preview</option>
|
||||
<option data-type="openai" value="gpt-4-turbo">gpt-4-turbo</option>
|
||||
<option data-type="anthropic" value="claude-3-opus-20240229">claude-3-opus-20240229</option>
|
||||
<option data-type="anthropic" value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option>
|
||||
<option data-type="anthropic" value="claude-3-haiku-20240307">claude-3-haiku-20240307</option>
|
||||
|
@@ -56,7 +56,7 @@ export async function getMultimodalCaption(base64Img, prompt) {
|
||||
|
||||
if (!isGoogle) {
|
||||
requestBody.api = extension_settings.caption.multimodal_api || 'openai';
|
||||
requestBody.model = extension_settings.caption.multimodal_model || 'gpt-4-vision-preview';
|
||||
requestBody.model = extension_settings.caption.multimodal_model || 'gpt-4-turbo';
|
||||
requestBody.reverse_proxy = proxyUrl;
|
||||
requestBody.proxy_password = proxyPassword;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ export async function getMultimodalCaption(base64Img, prompt) {
|
||||
|
||||
if (isCustom) {
|
||||
requestBody.server_url = oai_settings.custom_url;
|
||||
requestBody.model = oai_settings.custom_model || 'gpt-4-vision-preview';
|
||||
requestBody.model = oai_settings.custom_model || 'gpt-4-turbo';
|
||||
requestBody.custom_include_headers = oai_settings.custom_include_headers;
|
||||
requestBody.custom_include_body = oai_settings.custom_include_body;
|
||||
requestBody.custom_exclude_body = oai_settings.custom_exclude_body;
|
||||
|
@@ -48,6 +48,7 @@ const sources = {
|
||||
comfy: 'comfy',
|
||||
togetherai: 'togetherai',
|
||||
drawthings: 'drawthings',
|
||||
pollinations: 'pollinations',
|
||||
};
|
||||
|
||||
const generationMode = {
|
||||
@@ -254,6 +255,10 @@ const defaultSettings = {
|
||||
// ComyUI settings
|
||||
comfy_url: 'http://127.0.0.1:8188',
|
||||
comfy_workflow: 'Default_Comfy_Workflow.json',
|
||||
|
||||
// Pollinations settings
|
||||
pollinations_enhance: false,
|
||||
pollinations_refine: false,
|
||||
};
|
||||
|
||||
function processTriggers(chat, _, abort) {
|
||||
@@ -383,6 +388,8 @@ async function loadSettings() {
|
||||
$('#sd_novel_sm').prop('checked', extension_settings.sd.novel_sm);
|
||||
$('#sd_novel_sm_dyn').prop('checked', extension_settings.sd.novel_sm_dyn);
|
||||
$('#sd_novel_sm_dyn').prop('disabled', !extension_settings.sd.novel_sm);
|
||||
$('#sd_pollinations_enhance').prop('checked', extension_settings.sd.pollinations_enhance);
|
||||
$('#sd_pollinations_refine').prop('checked', extension_settings.sd.pollinations_refine);
|
||||
$('#sd_horde').prop('checked', extension_settings.sd.horde);
|
||||
$('#sd_horde_nsfw').prop('checked', extension_settings.sd.horde_nsfw);
|
||||
$('#sd_horde_karras').prop('checked', extension_settings.sd.horde_karras);
|
||||
@@ -828,6 +835,16 @@ function onNovelSmDynInput() {
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
function onPollinationsEnhanceInput() {
|
||||
extension_settings.sd.pollinations_enhance = !!$('#sd_pollinations_enhance').prop('checked');
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
function onPollinationsRefineInput() {
|
||||
extension_settings.sd.pollinations_refine = !!$('#sd_pollinations_refine').prop('checked');
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
function onHordeNsfwInput() {
|
||||
extension_settings.sd.horde_nsfw = !!$(this).prop('checked');
|
||||
saveSettingsDebounced();
|
||||
@@ -1023,7 +1040,7 @@ async function onModelChange() {
|
||||
extension_settings.sd.model = $('#sd_model').find(':selected').val();
|
||||
saveSettingsDebounced();
|
||||
|
||||
const cloudSources = [sources.horde, sources.novel, sources.openai, sources.togetherai];
|
||||
const cloudSources = [sources.horde, sources.novel, sources.openai, sources.togetherai, sources.pollinations];
|
||||
|
||||
if (cloudSources.includes(extension_settings.sd.source)) {
|
||||
return;
|
||||
@@ -1188,6 +1205,9 @@ async function loadSamplers() {
|
||||
case sources.togetherai:
|
||||
samplers = ['N/A'];
|
||||
break;
|
||||
case sources.pollinations:
|
||||
samplers = ['N/A'];
|
||||
break;
|
||||
}
|
||||
|
||||
for (const sampler of samplers) {
|
||||
@@ -1368,6 +1388,9 @@ async function loadModels() {
|
||||
case sources.togetherai:
|
||||
models = await loadTogetherAIModels();
|
||||
break;
|
||||
case sources.pollinations:
|
||||
models = await loadPollinationsModels();
|
||||
break;
|
||||
}
|
||||
|
||||
for (const model of models) {
|
||||
@@ -1384,6 +1407,55 @@ async function loadModels() {
|
||||
}
|
||||
}
|
||||
|
||||
async function loadPollinationsModels() {
|
||||
return [
|
||||
{
|
||||
value: 'pixart',
|
||||
text: 'PixArt-αlpha',
|
||||
},
|
||||
{
|
||||
value: 'playground',
|
||||
text: 'Playground v2',
|
||||
},
|
||||
{
|
||||
value: 'dalle3xl',
|
||||
text: 'DALL•E 3 XL',
|
||||
},
|
||||
{
|
||||
value: 'formulaxl',
|
||||
text: 'FormulaXL',
|
||||
},
|
||||
{
|
||||
value: 'dreamshaper',
|
||||
text: 'DreamShaper',
|
||||
},
|
||||
{
|
||||
value: 'deliberate',
|
||||
text: 'Deliberate',
|
||||
},
|
||||
{
|
||||
value: 'dpo',
|
||||
text: 'SDXL-DPO',
|
||||
},
|
||||
{
|
||||
value: 'swizz8',
|
||||
text: 'Swizz8',
|
||||
},
|
||||
{
|
||||
value: 'juggernaut',
|
||||
text: 'Juggernaut',
|
||||
},
|
||||
{
|
||||
value: 'turbo',
|
||||
text: 'SDXL Turbo',
|
||||
},
|
||||
{
|
||||
value: 'realvis',
|
||||
text: 'Realistic Vision',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
async function loadTogetherAIModels() {
|
||||
if (!secret_state[SECRET_KEYS.TOGETHERAI]) {
|
||||
console.debug('TogetherAI API key is not set.');
|
||||
@@ -1641,6 +1713,9 @@ async function loadSchedulers() {
|
||||
case sources.togetherai:
|
||||
schedulers = ['N/A'];
|
||||
break;
|
||||
case sources.pollinations:
|
||||
schedulers = ['N/A'];
|
||||
break;
|
||||
case sources.comfy:
|
||||
schedulers = await loadComfySchedulers();
|
||||
break;
|
||||
@@ -1706,6 +1781,9 @@ async function loadVaes() {
|
||||
case sources.togetherai:
|
||||
vaes = ['N/A'];
|
||||
break;
|
||||
case sources.pollinations:
|
||||
vaes = ['N/A'];
|
||||
break;
|
||||
case sources.comfy:
|
||||
vaes = await loadComfyVaes();
|
||||
break;
|
||||
@@ -2135,6 +2213,9 @@ async function sendGenerationRequest(generationType, prompt, characterName = nul
|
||||
case sources.togetherai:
|
||||
result = await generateTogetherAIImage(prefixedPrompt, negativePrompt);
|
||||
break;
|
||||
case sources.pollinations:
|
||||
result = await generatePollinationsImage(prefixedPrompt, negativePrompt);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!result.data) {
|
||||
@@ -2181,6 +2262,30 @@ async function generateTogetherAIImage(prompt, negativePrompt) {
|
||||
}
|
||||
}
|
||||
|
||||
async function generatePollinationsImage(prompt, negativePrompt) {
|
||||
const result = await fetch('/api/sd/pollinations/generate', {
|
||||
method: 'POST',
|
||||
headers: getRequestHeaders(),
|
||||
body: JSON.stringify({
|
||||
prompt: prompt,
|
||||
negative_prompt: negativePrompt,
|
||||
model: extension_settings.sd.model,
|
||||
width: extension_settings.sd.width,
|
||||
height: extension_settings.sd.height,
|
||||
enhance: extension_settings.sd.pollinations_enhance,
|
||||
refine: extension_settings.sd.pollinations_refine,
|
||||
}),
|
||||
});
|
||||
|
||||
if (result.ok) {
|
||||
const data = await result.json();
|
||||
return { format: 'jpg', data: data?.image };
|
||||
} else {
|
||||
const text = await result.text();
|
||||
throw new Error(text);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an "extras" image using a provided prompt and other settings.
|
||||
*
|
||||
@@ -2775,6 +2880,8 @@ function isValidState() {
|
||||
return true;
|
||||
case sources.togetherai:
|
||||
return secret_state[SECRET_KEYS.TOGETHERAI];
|
||||
case sources.pollinations:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2922,6 +3029,8 @@ jQuery(async () => {
|
||||
$('#sd_novel_view_anlas').on('click', onViewAnlasClick);
|
||||
$('#sd_novel_sm').on('input', onNovelSmInput);
|
||||
$('#sd_novel_sm_dyn').on('input', onNovelSmDynInput);
|
||||
$('#sd_pollinations_enhance').on('input', onPollinationsEnhanceInput);
|
||||
$('#sd_pollinations_refine').on('input', onPollinationsRefineInput);
|
||||
$('#sd_comfy_validate').on('click', validateComfyUrl);
|
||||
$('#sd_comfy_url').on('input', onComfyUrlInput);
|
||||
$('#sd_comfy_workflow').on('change', onComfyWorkflowChange);
|
||||
|
@@ -32,14 +32,15 @@
|
||||
</label>
|
||||
<label for="sd_source">Source</label>
|
||||
<select id="sd_source">
|
||||
<option value="extras">Extras API (local / remote)</option>
|
||||
<option value="horde">Stable Horde</option>
|
||||
<option value="auto">Stable Diffusion Web UI (AUTOMATIC1111)</option>
|
||||
<option value="vlad">SD.Next (vladmandic)</option>
|
||||
<option value="comfy">ComfyUI</option>
|
||||
<option value="drawthings">DrawThings HTTP API</option>
|
||||
<option value="extras">Extras API (local / remote)</option>
|
||||
<option value="novel">NovelAI Diffusion</option>
|
||||
<option value="openai">OpenAI (DALL-E)</option>
|
||||
<option value="comfy">ComfyUI</option>
|
||||
<option value="pollinations">Pollinations</option>
|
||||
<option value="vlad">SD.Next (vladmandic)</option>
|
||||
<option value="auto">Stable Diffusion Web UI (AUTOMATIC1111)</option>
|
||||
<option value="horde">Stable Horde</option>
|
||||
<option value="togetherai">TogetherAI</option>
|
||||
</select>
|
||||
<div data-sd-source="auto">
|
||||
@@ -158,6 +159,25 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-sd-source="pollinations">
|
||||
<p>
|
||||
<a href="https://pollinations.ai">Pollinations.ai</a>
|
||||
</p>
|
||||
<div class="flex-container">
|
||||
<label class="flex1 checkbox_label" for="sd_pollinations_enhance">
|
||||
<input id="sd_pollinations_enhance" type="checkbox" />
|
||||
<span data-i18n="Enhance">
|
||||
Enhance
|
||||
</span>
|
||||
</label>
|
||||
<label class="flex1 checkbox_label" for="sd_pollinations_refine">
|
||||
<input id="sd_pollinations_refine" type="checkbox" />
|
||||
<span data-i18n="Refine">
|
||||
Refine
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label for="sd_scale">CFG Scale (<span id="sd_scale_value"></span>)</label>
|
||||
<input id="sd_scale" type="range" min="{{scale_min}}" max="{{scale_max}}" step="{{scale_step}}" value="{{scale}}" />
|
||||
<label for="sd_steps">Sampling steps (<span id="sd_steps_value"></span>)</label>
|
||||
|
Reference in New Issue
Block a user