Merge branch 'main' of https://github.com/kwaroran/RisuAI
Signed-off-by: hashcoko <hashcoko@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { ArrowLeft, ArrowRight, PencilIcon, LanguagesIcon, RefreshCcwIcon, TrashIcon, CopyIcon } from "lucide-svelte";
|
||||
import { ArrowLeft, ArrowRight, PencilIcon, LanguagesIcon, RefreshCcwIcon, TrashIcon, CopyIcon, Volume2Icon } from "lucide-svelte";
|
||||
import { ParseMarkdown, type simpleCharacterArgument } from "../../ts/parser";
|
||||
import AutoresizeArea from "../UI/GUI/TextAreaResizable.svelte";
|
||||
import { alertConfirm, alertError } from "../../ts/alert";
|
||||
@@ -10,6 +10,7 @@
|
||||
import { risuChatParser } from "src/ts/process/scripts";
|
||||
import { get } from "svelte/store";
|
||||
import { isEqual } from "lodash";
|
||||
import { sayTTS } from "src/ts/process/tts";
|
||||
export let message = ''
|
||||
export let name = ''
|
||||
export let largePortrait = false
|
||||
@@ -145,6 +146,12 @@
|
||||
</button>
|
||||
{/if}
|
||||
{#if idx > -1}
|
||||
<button class="ml-2 hover:text-green-500 transition-colors" on:click={()=>{
|
||||
return sayTTS(null, message)
|
||||
}}>
|
||||
<Volume2Icon size={20}/>
|
||||
</button>
|
||||
|
||||
<button class={"ml-2 hover:text-green-500 transition-colors "+(editMode?'text-green-400':'')} on:click={() => {
|
||||
if(!editMode){
|
||||
editMode = true
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { doingChat, sendChat } from "../../ts/process/index";
|
||||
import { findCharacterbyId, messageForm, sleep } from "../../ts/util";
|
||||
import { language } from "../../lang";
|
||||
import { translate } from "../../ts/translator/translator";
|
||||
import { isExpTranslator, translate } from "../../ts/translator/translator";
|
||||
import { alertError, alertNormal, alertWait } from "../../ts/alert";
|
||||
import sendSound from '../../etc/send.mp3'
|
||||
import {cloneDeep} from 'lodash'
|
||||
@@ -251,7 +251,33 @@
|
||||
|
||||
$: updateInputSizeAll()
|
||||
|
||||
function updateInputTransateMessage(reverse: boolean) {
|
||||
async function updateInputTransateMessage(reverse: boolean) {
|
||||
if(isExpTranslator()){
|
||||
if(!reverse){
|
||||
messageInputTranslate = ''
|
||||
return
|
||||
}
|
||||
if(messageInputTranslate === '') {
|
||||
messageInput = ''
|
||||
return
|
||||
}
|
||||
const lastMessageInputTranslate = messageInputTranslate
|
||||
await sleep(1500)
|
||||
if(lastMessageInputTranslate === messageInputTranslate){
|
||||
console.log(lastMessageInputTranslate === messageInputTranslate)
|
||||
console.log(lastMessageInputTranslate, messageInputTranslate)
|
||||
translate(reverse ? messageInputTranslate : messageInput, reverse).then((translatedMessage) => {
|
||||
if(translatedMessage){
|
||||
if(reverse)
|
||||
messageInput = translatedMessage
|
||||
else
|
||||
messageInputTranslate = translatedMessage
|
||||
}
|
||||
})
|
||||
}
|
||||
return
|
||||
|
||||
}
|
||||
if(reverse && messageInputTranslate === '') {
|
||||
messageInput = ''
|
||||
return
|
||||
|
||||
@@ -149,6 +149,7 @@
|
||||
<OptionInput value="gpt35_0613">GPT-3.5 0613</OptionInput>
|
||||
<OptionInput value="gpt4_0613">GPT-4 0613</OptionInput>
|
||||
<OptionInput value="claude-2.1">claude-2.1</OptionInput>
|
||||
<OptionInput value="claude-2.0">claude-2.0</OptionInput>
|
||||
<OptionInput value="claude-2">claude-2</OptionInput>
|
||||
<OptionInput value="claude-v1.3">claude-v1.3</OptionInput>
|
||||
<OptionInput value="claude-v1.3-100k">claude-v1.3-100k</OptionInput>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import { downloadFile } from "src/ts/storage/globalApi";
|
||||
import { languageEnglish } from "src/lang/en";
|
||||
import TextInput from "src/lib/UI/GUI/TextInput.svelte";
|
||||
import TextAreaInput from "src/lib/UI/GUI/TextAreaInput.svelte";
|
||||
let langChanged = false
|
||||
|
||||
</script>
|
||||
@@ -56,7 +57,7 @@
|
||||
<SelectInput className="mt-2 mb-4" bind:value={$DataBase.translatorType}>
|
||||
<OptionInput value="google" >Google</OptionInput>
|
||||
<OptionInput value="deepl" >DeepL</OptionInput>
|
||||
<OptionInput value="submodel" >Use submodel</OptionInput>
|
||||
<OptionInput value="llm" >Ax. Model</OptionInput>
|
||||
</SelectInput>
|
||||
|
||||
{#if $DataBase.translatorType === 'deepl'}
|
||||
@@ -75,6 +76,11 @@
|
||||
<span class="text-draculared text-xs mb-2">Translation sends a lot of requests at once, so don't use it at reverse proxy.</span>
|
||||
{/if}
|
||||
|
||||
{#if $DataBase.translatorType === 'llm'}
|
||||
<span class="text-textcolor mt-4">{language.translationPrompt}</span>
|
||||
<TextAreaInput bind:value={$DataBase.translatorPrompt} placeholder={"You are a translator. translate the following html or text into {{slot}}. do not output anything other than the translation."}/>
|
||||
{/if}
|
||||
|
||||
|
||||
<div class="flex items-center mt-2">
|
||||
<Check bind:check={$DataBase.autoTranslate} name={language.autoTranslation}/>
|
||||
|
||||
@@ -146,10 +146,15 @@
|
||||
<span class="text-textcolor mt-2">VOICEVOX URL</span>
|
||||
<TextInput size="sm" marginBottom bind:value={$DataBase.voicevoxUrl}/>
|
||||
|
||||
<span class="text-textcolor">OpenAI Key</span>
|
||||
<TextInput size="sm" marginBottom bind:value={$DataBase.openAIKey}/>
|
||||
|
||||
<span class="text-textcolor mt-2">NovelAI API key</span>
|
||||
<TextInput size="sm" marginBottom placeholder="pst-..." bind:value={$DataBase.NAIApiKey}/>
|
||||
|
||||
|
||||
<span class="text-textcolor">Huggingface Key</span>
|
||||
<TextInput size="sm" marginBottom bind:value={$DataBase.huggingfaceKey} placeholder="hf_..."/>
|
||||
|
||||
</Arcodion>
|
||||
|
||||
<Arcodion name={language.emotionImage} styled>
|
||||
|
||||
@@ -519,6 +519,7 @@
|
||||
<OptionInput value="VOICEVOX">VOICEVOX</OptionInput>
|
||||
<OptionInput value="openai">OpenAI</OptionInput>
|
||||
<OptionInput value="novelai">NovelAI</OptionInput>
|
||||
<OptionInput value="huggingface">Huggingface</OptionInput>
|
||||
</SelectInput>
|
||||
|
||||
|
||||
@@ -604,7 +605,6 @@
|
||||
</SelectInput>
|
||||
{/if}
|
||||
{#if currentChar.data.ttsMode === 'openai'}
|
||||
<span class="text-textcolor">OpenAI TTS uses your OpenAI key on the chat model section</span>
|
||||
<SelectInput className="mb-4 mt-2" bind:value={currentChar.data.oaiVoice}>
|
||||
<OptionInput value="">Unset</OptionInput>
|
||||
{#each oaiVoices as voice}
|
||||
@@ -612,7 +612,19 @@
|
||||
{/each}
|
||||
</SelectInput>
|
||||
{/if}
|
||||
{#if currentChar.data.ttsMode === 'webspeech' || currentChar.data.ttsMode === 'elevenlab' || currentChar.data.ttsMode === 'VOICEVOX' || currentChar.data.ttsMode === 'novelai'}
|
||||
{#if currentChar.data.ttsMode === 'huggingface'}
|
||||
<span class="text-textcolor">Model</span>
|
||||
<TextInput additionalClass="mb-4 mt-2" bind:value={currentChar.data.hfTTS.model} />
|
||||
|
||||
<span class="text-textcolor">Language</span>
|
||||
<TextInput additionalClass="mb-4 mt-2" bind:value={currentChar.data.hfTTS.language} placeholder="en" />
|
||||
{/if}
|
||||
{#if currentChar.data.ttsMode === 'webspeech' ||
|
||||
currentChar.data.ttsMode === 'elevenlab' ||
|
||||
currentChar.data.ttsMode === 'VOICEVOX' ||
|
||||
currentChar.data.ttsMode === 'huggingface' ||
|
||||
currentChar.data.ttsMode === 'openai' ||
|
||||
currentChar.data.ttsMode === 'novelai'}
|
||||
<div class="flex items-center mt-2">
|
||||
<Check bind:check={currentChar.data.ttsReadOnlyQuoted} name={language.ttsReadOnlyQuoted}/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user