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