This commit is contained in:
kwaroran
2023-11-27 18:28:31 +09:00
12 changed files with 366 additions and 10 deletions

View File

@@ -2,12 +2,16 @@
import Check from "src/lib/UI/GUI/CheckInput.svelte";
import { language } from "src/lang";
import Help from "src/lib/Others/Help.svelte";
import { selectSingleFile } from "src/ts/util";
import { DataBase } from "src/ts/storage/database";
import { isTauri } from "src/ts/storage/globalApi";
import NumberInput from "src/lib/UI/GUI/NumberInput.svelte";
import TextInput from "src/lib/UI/GUI/TextInput.svelte";
import SelectInput from "src/lib/UI/GUI/SelectInput.svelte";
import OptionInput from "src/lib/UI/GUI/OptionInput.svelte";
import SliderInput from "src/lib/UI/GUI/SliderInput.svelte";
import Button from "src/lib/UI/GUI/Button.svelte";
import { convertToBase64 } from "src/ts/process/uinttobase64";
</script>
<h2 class="mb-2 text-2xl font-bold mt-2">{language.otherBots}</h2>
@@ -18,6 +22,7 @@
<SelectInput className="mt-2 mb-4" bind:value={$DataBase.sdProvider}>
<OptionInput value="" >None</OptionInput>
<OptionInput value="webui" >Stable Diffusion WebUI</OptionInput>
<OptionInput value="novelai" >Novel AI</OptionInput>
<!-- TODO -->
<!-- <OptionInput value="runpod" >Runpod Serverless</OptionInput> -->
</SelectInput>
@@ -56,6 +61,65 @@
{/if}
{/if}
{#if $DataBase.sdProvider === 'novelai'}
<span class="text-textcolor mt-2">Novel AI {language.providerURL}</span>
<TextInput size="sm" marginBottom placeholder="https://api.novelai.net" bind:value={$DataBase.NAIImgUrl}/>
<span class="text-textcolor">API Key</span>
<TextInput size="sm" marginBottom placeholder="pst-..." bind:value={$DataBase.NAIApiKey}/>
<span class="text-textcolor">Model</span>
<TextInput size="sm" marginBottom placeholder="nai-diffusion-3" bind:value={$DataBase.NAIImgModel}/>
<span class="text-textcolor">Enable I2I</span>
<Check bind:check={$DataBase.NAII2I}/>
{#if $DataBase.NAII2I}
<span class="text-textcolor">strength</span>
<SliderInput min={0} max={0.99} step={0.01} bind:value={$DataBase.NAIImgConfig.strength}/>
<span class="text-textcolor2 mb-6 text-sm">{$DataBase.NAIImgConfig.strength}</span>
<span class="text-textcolor">noise</span>
<SliderInput min={0} max={0.99} step={0.01} bind:value={$DataBase.NAIImgConfig.noise}/>
<span class="text-textcolor2 mb-6 text-sm">{$DataBase.NAIImgConfig.noise}</span>
<span class="text-textcolor">base image</span>
<TextInput size="sm" marginBottom placeholder="If empty, a profile picture is sent." bind:value={$DataBase.NAIImgConfig.image}/>
<span class="text-textcolor">If empty, a profile picture is sent.</span>
<Button on:click={async () => {
const img = await selectSingleFile([
'jpg',
'jpeg',
'png',
'webp'
])
if(!img){
return null
}
const base64 = await convertToBase64(img.data)
$DataBase.NAIImgConfig.image = base64
}}>Select Image</Button>
{/if}
<span class="text-textcolor">Width</span>
<NumberInput size="sm" marginBottom min={0} max={2048} bind:value={$DataBase.NAIImgConfig.width}/>
<span class="text-textcolor">Height</span>
<NumberInput size="sm" marginBottom min={0} max={2048} bind:value={$DataBase.NAIImgConfig.height}/>
<span class="text-textcolor">Sampler</span>
<TextInput size="sm" marginBottom bind:value={$DataBase.NAIImgConfig.sampler}/>
<span class="text-textcolor">steps</span>
<NumberInput size="sm" marginBottom min={0} max={2048} bind:value={$DataBase.NAIImgConfig.steps}/>
<span class="text-textcolor">CFG scale</span>
<NumberInput size="sm" marginBottom min={0} max={2048} bind:value={$DataBase.NAIImgConfig.scale}/>
{#if !$DataBase.NAII2I}
<span class="text-textcolor">Use SMEA</span>
<Check bind:check={$DataBase.NAIImgConfig.sm}/>
<span class="text-textcolor">Use DYN</span>
<Check bind:check={$DataBase.NAIImgConfig.sm_dyn}/>
{/if}
{/if}
<span class="text-textcolor mt-4 text-lg font-bold">TTS</span>
<span class="text-textcolor mt-2">ElevenLabs API key</span>
@@ -64,6 +128,9 @@
<span class="text-textcolor mt-2">VOICEVOX URL</span>
<TextInput size="sm" marginBottom bind:value={$DataBase.voicevoxUrl}/>
<span class="text-textcolor mt-2">NovelAI API key</span>
<TextInput size="sm" marginBottom placeholder="pst-..." bind:value={$DataBase.NAIApiKey}/>
<span class="text-textcolor mt-4 text-lg font-bold">{language.emotionImage}</span>
<span class="text-textcolor mt-2">{language.emotionMethod}</span>

View File

@@ -15,7 +15,7 @@
import Help from "../Others/Help.svelte";
import RegexData from "./Scripts/RegexData.svelte";
import { exportChar, shareRisuHub } from "src/ts/characterCards";
import { getElevenTTSVoices, getWebSpeechTTSVoices, getVOICEVOXVoices, oaiVoices } from "src/ts/process/tts";
import { getElevenTTSVoices, getWebSpeechTTSVoices, getVOICEVOXVoices, oaiVoices, getNovelAIVoices, FixNAITTS } from "src/ts/process/tts";
import { checkCharOrder, getFileSrc } from "src/ts/storage/globalApi";
import { addGroupChar, rmCharFromGroup } from "src/ts/process/group";
import RealmUpload from "../UI/Realm/RealmUpload.svelte";
@@ -27,6 +27,7 @@
import OptionInput from "../UI/GUI/OptionInput.svelte";
import RegexList from "./Scripts/RegexList.svelte";
import TriggerList from "./Scripts/TriggerList.svelte";
let subMenu = 0
let openHubUpload = false
@@ -130,12 +131,20 @@
}
}
}
}
onDestroy(unsub);
$:licensed = (currentChar.type === 'character') ? currentChar.data.license : ''
$: if (currentChar.data.ttsMode === 'novelai' && (currentChar.data as character).naittsConfig === undefined) {
(currentChar.data as character).naittsConfig = {
customvoice: false,
voice: 'Aini',
version: 'v2'
};
}
</script>
{#if licensed !== 'private'}
@@ -542,6 +551,7 @@
<OptionInput value="webspeech">Web Speech</OptionInput>
<OptionInput value="VOICEVOX">VOICEVOX</OptionInput>
<OptionInput value="openai">OpenAI</OptionInput>
<OptionInput value="novelai">NovelAI</OptionInput>
</SelectInput>
@@ -600,6 +610,31 @@
<span class="text-textcolor">Intonation scale</span>
<NumberInput size={"sm"} marginBottom bind:value={currentChar.data.voicevoxConfig.INTONATION_SCALE}/>
<span class="text-sm mb-2 text-textcolor2">To use VOICEVOX, you need to run a colab and put the localtunnel URL in "Settings → Other Bots". https://colab.research.google.com/drive/1tyeXJSklNfjW-aZJAib1JfgOMFarAwze</span>
{:else if currentChar.data.ttsMode === 'novelai'}
<span class="text-textcolor">Custom Voice Seed</span>
<Check bind:check={currentChar.data.naittsConfig.customvoice}/>
{#if !currentChar.data.naittsConfig.customvoice}
<span class="text-textcolor">Voice</span>
<SelectInput className="mb-4 mt-2" bind:value={currentChar.data.naittsConfig.voice}>
{#await getNovelAIVoices() then voices}
{#each voices as voiceGroup}
<optgroup label={voiceGroup.gender} class="bg-darkbg appearance-none">
{#each voiceGroup.voices as voice}
<OptionInput value={voice} selected={currentChar.data.naittsConfig.voice === voice}>{voice}</OptionInput>
{/each}
</optgroup>
{/each}
{/await}
</SelectInput>
{:else}
<span class="text-textcolor">Voice</span>
<TextInput size={"sm"} bind:value={currentChar.data.naittsConfig.voice}/>
{/if}
<span class="text-textcolor">Version</span>
<SelectInput className="mb-4 mt-2" bind:value={currentChar.data.naittsConfig.version}>
<OptionInput value="v1">v1</OptionInput>
<OptionInput value="v2">v2</OptionInput>
</SelectInput>
{/if}
{#if currentChar.data.ttsMode === 'openai'}
<span class="text-textcolor">OpenAI TTS uses your OpenAI key on the chat model section</span>
@@ -610,7 +645,7 @@
{/each}
</SelectInput>
{/if}
{#if currentChar.data.ttsMode === 'webspeech' || currentChar.data.ttsMode === 'elevenlab' || currentChar.data.ttsMode === 'VOICEVOX'}
{#if currentChar.data.ttsMode === 'webspeech' || currentChar.data.ttsMode === 'elevenlab' || currentChar.data.ttsMode === 'VOICEVOX' || currentChar.data.ttsMode === 'novelai'}
<div class="flex items-center mt-2">
<Check bind:check={currentChar.data.ttsReadOnlyQuoted} name={language.ttsReadOnlyQuoted}/>
</div>