parent
ba135d1a48
commit
44c98e503d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -11,10 +11,20 @@ class TranslatorsTranslator(BaseTranslator):
|
|||
|
||||
def translate(self, text):
|
||||
region = self.api_config.get('region', 'CN')
|
||||
host = self.api_config.get('host', '')
|
||||
os.environ['translators_default_region'] = region
|
||||
from scripts.physton_prompt.translators.server import translate_text, tss, AlibabaV1
|
||||
tss.server_region = region
|
||||
tss._bing.server_region = region
|
||||
tss._google.server_region = region
|
||||
|
||||
return translate_text(text, from_language=self.from_lang, to_language=self.to_lang, translator=self.translator, timeout=30)
|
||||
params = {
|
||||
'from_language': self.from_lang,
|
||||
'to_language': self.to_lang,
|
||||
'translator': self.translator,
|
||||
'reset_host_url': host,
|
||||
'if_check_reset_host_url': False,
|
||||
'timeout': 30
|
||||
}
|
||||
return translate_text(text, **params)
|
||||
# return translate_text(text, from_language=self.from_lang, to_language=self.to_lang, translator=self.translator, timeout=30)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
<select v-if="config.type == 'select'" v-model="config.value">
|
||||
<option v-for="option in config.options" :value="option">{{ option }}</option>
|
||||
</select>
|
||||
<div v-if="config.desc" v-html="config.desc"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body-line">
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
<select v-if="config.type == 'select'" v-model="config.value">
|
||||
<option v-for="option in config.options" :value="option">{{ option }}</option>
|
||||
</select>
|
||||
<div v-if="config.desc" v-html="config.desc"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="setting-line" v-if="apiItem.key === 'mbart50'">
|
||||
|
|
|
|||
|
|
@ -348,6 +348,13 @@
|
|||
"IW",
|
||||
"FA"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "host",
|
||||
"title": "Host",
|
||||
"desc": "<ul><li>https://translate.google.com</li><li>https://translate.amz.wang</li><li>...</li></ul>",
|
||||
"type": "input",
|
||||
"default": "https://translate.google.com"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -1856,6 +1863,7 @@
|
|||
{
|
||||
"key": "api_base",
|
||||
"title": "API Base",
|
||||
"desc": "<ul><li>https://api.openai.com/v1</li><li>https://api.openai-proxy.com/v1</li><li>https://chatai.1rmb.tk/v1</li><li>...</li></ul>",
|
||||
"type": "input",
|
||||
"default": "https://api.openai.com/v1"
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue