mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-01-18 06:00:28 +00:00
feat: use Opus-MT-StarCitizen-zh-en model
This commit is contained in:
parent
af15d106f0
commit
77c1b4f51a
@ -1,7 +1,7 @@
|
||||
class ConstConf {
|
||||
static const String appVersion = "2.15.1 Beta";
|
||||
static const String appVersion = "2.15.1 Beta2";
|
||||
static const int appVersionCode = 71;
|
||||
static const String appVersionDate = "2025-11-15";
|
||||
static const String appVersionDate = "2025-11-16";
|
||||
static const _gameChannels = [
|
||||
"LIVE",
|
||||
"4.0_PREVIEW",
|
||||
|
||||
@ -77,7 +77,7 @@ class MultiWindowManager {
|
||||
),
|
||||
);
|
||||
await Future.delayed(Duration(milliseconds: 500)).then((_) async {
|
||||
await controller.setFrame(const Rect.fromLTWH(0, 0, 800, 1200));
|
||||
await controller.setFrame(const Rect.fromLTWH(0, 0, 720, 800));
|
||||
await controller.setTitle(title);
|
||||
await controller.center();
|
||||
await controller.show();
|
||||
|
||||
@ -29,7 +29,10 @@ class InputMethodDialogUI extends HookConsumerWidget {
|
||||
}, const []);
|
||||
|
||||
return ContentDialog(
|
||||
constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width * .8),
|
||||
constraints: BoxConstraints(maxWidth: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width * .8),
|
||||
title: makeTitle(context, state, model, destTextCtrl),
|
||||
content: state.keyMaps == null
|
||||
? makeLoading(context)
|
||||
@ -62,7 +65,8 @@ class InputMethodDialogUI extends HookConsumerWidget {
|
||||
SizedBox(height: 12),
|
||||
TextFormBox(
|
||||
placeholder: state.isEnableAutoTranslate
|
||||
? "${S.current.input_method_input_placeholder}\n\n本地翻译模型对中英混合处理能力较差,如有需要,建议分开发送。"
|
||||
? "${S.current
|
||||
.input_method_input_placeholder}\n\n本地翻译模型对中英混合处理能力较差,如有需要,建议分开发送。"
|
||||
: S.current.input_method_input_placeholder,
|
||||
controller: srcTextCtrl,
|
||||
maxLines: 5,
|
||||
@ -150,12 +154,10 @@ class InputMethodDialogUI extends HookConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget makeTitle(
|
||||
BuildContext context,
|
||||
Widget makeTitle(BuildContext context,
|
||||
InputMethodDialogUIState state,
|
||||
InputMethodDialogUIModel model,
|
||||
TextEditingController destTextCtrl,
|
||||
) {
|
||||
TextEditingController destTextCtrl,) {
|
||||
return Row(
|
||||
children: [
|
||||
IconButton(
|
||||
@ -224,7 +226,7 @@ class InputMethodDialogUI extends HookConsumerWidget {
|
||||
Text(
|
||||
"大约需要 200MB 的本地空间。"
|
||||
"\n\n我们使用本地模型进行翻译,您的翻译数据不会发送给任何第三方。"
|
||||
"\n\n模型未对游戏术语优化,请自行判断使用。",
|
||||
"\n\nOpus-MT-StarCitizen-zh-en 是汉化盒子团队基于 Opus-MT 模型微调得到的模型,对游戏术语进行了优化。",
|
||||
),
|
||||
);
|
||||
if (userOK) {
|
||||
|
||||
@ -195,7 +195,7 @@ class InputMethodDialogUIModel extends _$InputMethodDialogUIModel {
|
||||
}
|
||||
}
|
||||
|
||||
String get _localTranslateModelName => "opus-mt-zh-en_onnx";
|
||||
String get _localTranslateModelName => "Opus-MT-StarCitizen-zh-en";
|
||||
|
||||
String get _localTranslateModelDir => "${appGlobalState.applicationSupportDir}/onnx_models";
|
||||
|
||||
|
||||
@ -393,11 +393,11 @@ mod tests {
|
||||
#[test]
|
||||
fn test_translation() {
|
||||
let model = OpusMtModel::new(
|
||||
"C:\\Users\\xkeyc\\Downloads\\onnx_models\\opus-mt-zh-en",
|
||||
"E:\\Project\\StarCtizen\\Opus-MT-StarCitizen\\results\\final_model",
|
||||
"_q4f16",
|
||||
)
|
||||
.unwrap();
|
||||
let result = model.translate("你好世界").unwrap();
|
||||
let result = model.translate("北极星要炸了,快撤!").unwrap();
|
||||
println!("Translation: {}", result);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user