2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,7 +6,7 @@ yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
package-lock.json
|
||||
node_modules
|
||||
dist/
|
||||
save/
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
import VisualNovelMain from "../VisualNovel/VisualNovelMain.svelte";
|
||||
let openChatList = false
|
||||
|
||||
$:{
|
||||
|
||||
if ($DataBase.translatorType === 'submodel'){
|
||||
$DataBase.useStreaming = false
|
||||
}
|
||||
}
|
||||
|
||||
const wallPaper = `background: url(${defaultWallpaper})`
|
||||
const externalStyles =
|
||||
("background: " + ($DataBase.textScreenColor ? ($DataBase.textScreenColor + '80') : "rgba(0,0,0,0.8)") + ';\n')
|
||||
|
||||
@@ -141,15 +141,16 @@ export async function sayTTS(character:character,text:string) {
|
||||
}
|
||||
case 'novelai': {
|
||||
const audioContext = new AudioContext();
|
||||
const response = await fetch(`https://api.novelai.net/ai/generate-voice?text=${text}&voice=-1&seed=${character.naittsConfig.voice}&opus=false&version=${character.naittsConfig.version}`, {
|
||||
const response = await globalFetch(`https://api.novelai.net/ai/generate-voice?text=${text}&voice=-1&seed=${character.naittsConfig.voice}&opus=false&version=${character.naittsConfig.version}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Authorization": "Bearer " + db.NAIApiKey,
|
||||
}
|
||||
},
|
||||
rawResponse: true
|
||||
});
|
||||
|
||||
if (response.status === 200 && response.headers.get('content-type') === 'audio/mpeg') {
|
||||
const audioBuffer = await response.arrayBuffer();
|
||||
if (response.ok) {
|
||||
const audioBuffer = response.data.buffer;
|
||||
audioContext.decodeAudioData(audioBuffer, (decodedData) => {
|
||||
const sourceNode = audioContext.createBufferSource();
|
||||
sourceNode.buffer = decodedData;
|
||||
@@ -158,6 +159,7 @@ export async function sayTTS(character:character,text:string) {
|
||||
});
|
||||
} else {
|
||||
alertError("Error fetching or decoding audio data");
|
||||
console.log(response);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user