Add translate sound

This commit is contained in:
kwaroran
2025-03-13 20:21:05 +09:00
parent 20087a09b2
commit fef10c1e56
4 changed files with 14 additions and 1 deletions

View File

@@ -929,6 +929,7 @@ export interface Database{
chatCompression: boolean
claudeRetrivalCaching: boolean
outputImageModal: boolean
playMessageOnTranslateEnd:boolean
}

View File

@@ -11,6 +11,7 @@ import { getModuleRegexScripts } from "../process/modules"
import { getNodetextToSentence, sleep } from "../util"
import { processScriptFull } from "../process/scripts"
import localforage from "localforage"
import sendSound from '../../etc/send.mp3'
let cache={
origin: [''],
@@ -265,7 +266,13 @@ export async function translateHTML(html: string, reverse:boolean, charArg:simpl
if(db.translatorType === 'llm'){
const tr = db.translator || 'en'
const from = db.translatorInputLanguage
return translateLLM(html, {to: tr, from: from, regenerate})
const r = translateLLM(html, {to: tr, from: from, regenerate})
if(db.playMessageOnTranslateEnd){
const audio = new Audio(sendSound);
audio.play();
}
return r
}
const dom = new DOMParser().parseFromString(html, 'text/html');
console.log(html)