Add translation wait time
This commit is contained in:
@@ -554,4 +554,5 @@ export const languageEnglish = {
|
|||||||
additionalParams: "Additional Parameters",
|
additionalParams: "Additional Parameters",
|
||||||
heightMode: "Height Mode",
|
heightMode: "Height Mode",
|
||||||
useAdvancedEditor: "Use Advanced Editor",
|
useAdvancedEditor: "Use Advanced Editor",
|
||||||
|
noWaitForTranslate: "No Wait for Translate",
|
||||||
}
|
}
|
||||||
@@ -613,6 +613,7 @@ export interface Database{
|
|||||||
additionalParams:[string, string][]
|
additionalParams:[string, string][]
|
||||||
heightMode:string
|
heightMode:string
|
||||||
useAdvancedEditor:boolean
|
useAdvancedEditor:boolean
|
||||||
|
noWaitForTranslate:boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface customscript{
|
export interface customscript{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { doingChat } from "../process"
|
|||||||
import type { simpleCharacterArgument } from "../parser"
|
import type { simpleCharacterArgument } from "../parser"
|
||||||
import { selectedCharID } from "../stores"
|
import { selectedCharID } from "../stores"
|
||||||
import { getModuleRegexScripts } from "../process/modules"
|
import { getModuleRegexScripts } from "../process/modules"
|
||||||
|
import { sleep } from "../util"
|
||||||
|
|
||||||
let cache={
|
let cache={
|
||||||
origin: [''],
|
origin: [''],
|
||||||
@@ -128,6 +129,14 @@ async function translateMain(text:string, arg:{from:string, to:string, host:stri
|
|||||||
|
|
||||||
}
|
}
|
||||||
if(db.translatorType === 'deeplX'){
|
if(db.translatorType === 'deeplX'){
|
||||||
|
if(!db.noWaitForTranslate){
|
||||||
|
if(waitTrans - Date.now() > 0){
|
||||||
|
const waitTime = waitTrans - Date.now()
|
||||||
|
waitTrans = Date.now() + 3000
|
||||||
|
await sleep(waitTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let url = db.deeplXOptions.url;
|
let url = db.deeplXOptions.url;
|
||||||
|
|
||||||
if(url.endsWith('/')){
|
if(url.endsWith('/')){
|
||||||
|
|||||||
Reference in New Issue
Block a user