Skip to content

Commit 5379555

Browse files
committed
新增:Mac模型导入时支持自动修复模型文件签名
1 parent 4acbb31 commit 5379555

File tree

6 files changed

+159
-11
lines changed

6 files changed

+159
-11
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## v0.13.0
22

3+
- 新增:Mac模型导入时支持自动修复模型文件签名
34
- 优化:视频播放组件概率性不能动态刷新问题
45
- 优化:Logo打包脚本和Logo样式
56
- 修复:云端模型网络异常情况下结果丢失问题

src/components/Server/ServerAddDialog.vue

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import {computed, ref} from "vue";
33
import {Dialog} from "../../lib/dialog";
44
import {t} from "../../lang";
55
import {functionToLabels} from "../../lib/aigcpanel";
6-
import {mapError} from "../../lib/error";
76
import {EnumServerType, ServerRecord} from "../../types/Server";
87
import {useServerStore} from "../../store/modules/server";
98
import {VersionUtil} from "../../lib/util";
109
import {AppConfig} from "../../config";
10+
import ServerAddResolvePanel from "./ServerAddResolvePanel.vue";
1111
12-
const cloudDialog = ref<InstanceType<typeof ServerCloudDialog>>()
12+
const resolvePanel = ref<InstanceType<typeof ServerAddResolvePanel> | null>(null)
1313
1414
const serverStore = useServerStore()
1515
const visible = ref(false)
@@ -68,6 +68,7 @@ const emptyModelInfo = () => {
6868
modelInfo.value.settings = []
6969
modelInfo.value.setting = {}
7070
modelInfo.value.isSupport = false
71+
resolvePanel.value?.reset()
7172
}
7273
7374
const doSubmitLocalDir = async () => {
@@ -209,7 +210,7 @@ const emit = defineEmits({
209210
{{ $t('添加模型服务') }}
210211
</template>
211212
<div>
212-
<div class="select-none">
213+
<div class="select-none" style="max-height:70vh;">
213214
<div v-if="!modelInfo.name">
214215
<div class="px-3">
215216
<div>
@@ -251,11 +252,10 @@ const emit = defineEmits({
251252
<div class="border rounded-lg py-4 leading-10">
252253
<div class="flex">
253254
<div class="pr-3 text-right w-20">{{ t('名称') }}</div>
254-
<div>{{ modelInfo.title }}</div>
255-
</div>
256-
<div class="flex">
257-
<div class="pr-3 text-right w-20">{{ t('版本') }}</div>
258-
<div>{{ modelInfo.version }}</div>
255+
<div>
256+
{{ modelInfo.title }}
257+
v{{ modelInfo.version }}
258+
</div>
259259
</div>
260260
<div class="flex">
261261
<div class="pr-3 text-right w-20">{{ t('标识') }}</div>
@@ -286,10 +286,13 @@ const emit = defineEmits({
286286
<div>{{ modelInfo.serverRequire === '*' ? t('无') : modelInfo.serverRequire }}</div>
287287
</div>
288288
</div>
289+
<div>
290+
<ServerAddResolvePanel ref="resolvePanel" :root="modelInfo.path"/>
291+
</div>
289292
<div class="pt-4 flex items-center">
290293
<div>
291294
<a-button class="mr-2" type="primary"
292-
:disabled="!modelInfo.isSupport"
295+
:disabled="(!modelInfo.isSupport||!resolvePanel?.isSuccess().value) as boolean"
293296
:loading="isImporting"
294297
@click="doSubmit">
295298
<template #icon>
@@ -312,6 +315,7 @@ const emit = defineEmits({
312315
</div>
313316
</div>
314317
</div>
318+
<div class="h-5"></div>
315319
</div>
316320
</div>
317321
</a-modal>
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<script setup lang="ts">
2+
import {computed, ref} from "vue";
3+
import {useServerStore} from "../../store/modules/server";
4+
import {doCopy} from "../common/util";
5+
import {Dialog} from "../../lib/dialog";
6+
7+
const serverStore = useServerStore()
8+
const props = defineProps<{
9+
root: string,
10+
}>()
11+
12+
const running = ref(false)
13+
14+
const passed = ref({
15+
commands: false,
16+
})
17+
18+
const commands = computed(() => {
19+
const commands: string[] = []
20+
if (window.$mapi.app.isPlatform('osx')) {
21+
commands.push('sudo spctl --master-disable')
22+
commands.push(`sudo xattr -r -d com.apple.quarantine ${props.root}`)
23+
}
24+
return commands
25+
})
26+
27+
const shouldShow = computed(() => {
28+
if (commands.value.length > 0) {
29+
return true
30+
}
31+
return false
32+
})
33+
34+
const doRun = async (type: 'commands') => {
35+
running.value = true
36+
const commandString = commands.value.join('; ')
37+
try {
38+
await window.$mapi.app.shell(`osascript -e 'do shell script "${commandString}" with administrator privileges'`)
39+
passed.value.commands = true
40+
} catch (e) {
41+
running.value = false
42+
Dialog.alertError('ERROR:' + e).then()
43+
return
44+
}
45+
running.value = false
46+
}
47+
const doRunManual = (type: 'commands') => {
48+
passed.value[type] = true
49+
}
50+
51+
const emit = defineEmits({
52+
update: (status: 'success' | 'fail') => true
53+
})
54+
55+
const reset = () => {
56+
running.value = false
57+
passed.value.commands = false
58+
}
59+
60+
const isSuccess = () => {
61+
return computed(() => {
62+
if (shouldShow.value) {
63+
for (const p of Object.values(passed.value)) {
64+
if (!p) {
65+
return false
66+
}
67+
}
68+
}
69+
return true
70+
})
71+
}
72+
73+
defineExpose({
74+
reset,
75+
isSuccess,
76+
})
77+
</script>
78+
79+
<template>
80+
<div v-if="shouldShow">
81+
<div class="border rounded-lg py-3 mt-3">
82+
<div class="flex mb-4">
83+
<div class="w-20 flex-shrink-0 text-right pr-3">{{ $t('修复命令') }}</div>
84+
<div class="">
85+
<div v-if="passed.commands">
86+
<div class="mr-2 mb-1">
87+
<a-alert type="success">
88+
{{ $t('模型文件签名') }}
89+
</a-alert>
90+
</div>
91+
</div>
92+
<div v-else>
93+
<div class="mr-2 mb-1">
94+
<a-alert>
95+
{{ $t('由于模型文件未完全签名,请运行以下命令完成签名后运行') }}
96+
</a-alert>
97+
</div>
98+
<div v-for="c in commands"
99+
class="mr-2 mb-1 bg-gray-100 p-2 rounded text-sm overflow-auto flex items-start">
100+
<div class="flex-grow">{{ c }}</div>
101+
<div class="w-10 text-right flex-shrink-0">
102+
<a href="javascript:;" @click="doCopy(c)" class="mr-1">
103+
<icon-copy/>
104+
</a>
105+
</div>
106+
</div>
107+
<div class="mb-1">
108+
<a-button @click="doRun('commands')" :loading="running" class="mr-2">
109+
{{ $t('一键运行') }}
110+
</a-button>
111+
<a-button @click="doRunManual('commands')" class="mr-2">
112+
{{ $t('已手动完成') }}
113+
</a-button>
114+
</div>
115+
<div class="mb-1">
116+
<div class="text-xs text-gray-500">
117+
{{ $t('运行过程可能需要输入密码') }}
118+
</div>
119+
</div>
120+
</div>
121+
</div>
122+
</div>
123+
</div>
124+
</div>
125+
</template>

src/lang/en-US.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
"078b0016": "Sound model not started",
123123
"07c24da0": "Tokens",
124124
"07f6f37e": "Loading...",
125+
"086c8a44": "The process may require you to enter a password",
125126
"08a62bfe": "Please select video",
126127
"08ab5a4a": "Please select template",
127128
"08ac1686": "Please select sound",
@@ -162,7 +163,9 @@
162163
"25a0c8e1": "Download Successful",
163164
"25aba9c4": "View Code",
164165
"25ada448": "4. You should not remain silent throughout the recording; you can speak naturally and cycle through phrases like \"one, two, three, four, five, six, seven, eight, nine,\" and so on.",
166+
"25ae5526": "Command",
165167
"25af82b6": "Quick Gen",
168+
"25b6e62a": "Run",
166169
"25d99435": "Theme",
167170
"25e596a4": "Feedback",
168171
"2615bdd6": "How to add a model?",
@@ -236,6 +239,7 @@
236239
"31450307": "Check for Updates",
237240
"31870025": "Model ID",
238241
"3188fe53": "New version available",
242+
"3190fde9": "Model file fix",
239243
"319103b8": "Model Info",
240244
"3191703b": "Models",
241245
"31919e8d": "Model Name",
@@ -306,6 +310,7 @@
306310
"417081ff": "Save successfully",
307311
"41dff64a": "Extracting {name}",
308312
"41e0472e": "TTS",
313+
"41e732bc": "The model file is not fully signed. Please run the following command to complete the signature before proceeding",
309314
"427faa86": "Input text",
310315
"42c281d4": "Auto",
311316
"42ed4ed0": "Connect Device",
@@ -338,6 +343,7 @@
338343
"5659f5e9": "3. The recording duration should be controlled between 6 to 12 seconds, with a maximum of 14 seconds",
339344
"5777e18f": "Prompt audio should be longer than 3 seconds and shorter than 30 seconds, ensuring the audio is clear and audible.",
340345
"58055d93": "Some models require special handling when performing cross-language cloning, so it’s necessary to indicate whether it is a cross-language cloning operation.",
346+
"59cc4b73": "Mark resolved",
341347
"5a4d7704": "Platform not match",
342348
"5affe2ba": "When clicking Close",
343349
"5b0c1880": "A model with the same version already exists.",

src/lang/source.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"Pro": "00013a8d",
1818
"shou": "0035dafb",
1919
"一键合成": "25af82b6",
20+
"一键运行": "25b6e62a",
2021
"上传": "0009c256",
2122
"下载": "000a02d2",
2223
"下载失败": "259ff066",
@@ -41,6 +42,7 @@
4142
"供应商名称": "71ee09b0",
4243
"保存": "000a071b",
4344
"信息": "000a0cae",
45+
"修复命令": "25ae5526",
4446
"值": "0000503c",
4547
"停止中": "013af867",
4648
"停止失败": "2625f71a",
@@ -116,6 +118,7 @@
116118
"已停止": "016acff8",
117119
"已启动 {time}": "09e64baa",
118120
"已复制 {text} 剪切板": "070935fc",
121+
"已手动完成": "59cc4b73",
119122
"已经是最新版本": "26aa0dba",
120123
"已连接": "017278f9",
121124
"平台不匹配": "5a4d7704",
@@ -197,6 +200,7 @@
197200
"模型不存在": "00884fd3",
198201
"模型不支持": "00898cb5",
199202
"模型信息": "319103b8",
203+
"模型修复": "3190fde9",
200204
"模型列表": "3191703b",
201205
"模型名称": "31919e8d",
202206
"模型已存在,请先删除": "4ba41237",
@@ -253,6 +257,7 @@
253257
"用户知识": "36c15ad0",
254258
"用户评论": "36c3c2c5",
255259
"用户进入": "36c40739",
260+
"由于模型文件未完全签名,请运行以下命令完成签名后运行": "41e732bc",
256261
"留空会检测使用随机端口": "2ba171ec",
257262
"留空使用默认启动命令": "2bf347f6",
258263
"目录": "000ec627",
@@ -331,6 +336,7 @@
331336
"输入语音内容开始合成": "39602b3f",
332337
"输入语音内容开始生成视频": "711e5293",
333338
"运行中": "022cab31",
339+
"运行过程可能需要输入密码": "086c8a44",
334340
"连接中": "02286f86",
335341
"连接网络设备": "37ce23fb",
336342
"连接设备": "42ed4ed0",
@@ -365,4 +371,4 @@
365371
"音速": "0012f68c",
366372
"首页": "0013319f",
367373
"默认端口 {port}": "3d329aff"
368-
}
374+
}

src/lang/zh-CN.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
"078b0016": "声音模型未启动",
123123
"07c24da0": "可用Token",
124124
"07f6f37e": "加载中...",
125+
"086c8a44": "运行过程可能需要输入密码",
125126
"08a62bfe": "请选择视频",
126127
"08ab5a4a": "请选择形象",
127128
"08ac1686": "请选择声音",
@@ -160,7 +161,9 @@
160161
"25a0c8e1": "下载成功",
161162
"25aba9c4": "代码查看",
162163
"25ada448": "4. 不能全程闭嘴,可以正常语气循环说 一二三四五六七八九 等文字",
164+
"25ae5526": "修复命令",
163165
"25af82b6": "一键合成",
166+
"25b6e62a": "一键运行",
164167
"25d99435": "主题样式",
165168
"25e596a4": "使用反馈",
166169
"2615bdd6": "如何添加模型?",
@@ -233,6 +236,7 @@
233236
"31450307": "检测更新",
234237
"31870025": "模型ID",
235238
"3188fe53": "新版本可用",
239+
"3190fde9": "模型修复",
236240
"319103b8": "模型信息",
237241
"3191703b": "模型列表",
238242
"31919e8d": "模型名称",
@@ -301,6 +305,7 @@
301305
"417081ff": "设置成功",
302306
"41dff64a": "正在解压 {name}",
303307
"41e0472e": "语音合成",
308+
"41e732bc": "由于模型文件未完全签名,请运行以下命令完成签名后运行",
304309
"427faa86": "输入内容",
305310
"42c281d4": "跟随系统",
306311
"42ed4ed0": "连接设备",
@@ -333,6 +338,7 @@
333338
"5659f5e9": "3. 录音时长控制在 6~12秒 最佳,最多不超过14秒",
334339
"5777e18f": "参考声音需要大于 3s 小于 30s,保证声音清晰可见",
335340
"58055d93": "部分模型在跨语种克隆时需要特殊处理,因此需要标记是否为跨语种克隆",
341+
"59cc4b73": "已手动完成",
336342
"5a4d7704": "平台不匹配",
337343
"5affe2ba": "点击关闭时",
338344
"5b0c1880": "模型相同版本已存在",
@@ -370,4 +376,4 @@
370376
"7bf1ff1a": "选择视频文件",
371377
"7dd7dec9": "请先开通会员",
372378
"7fca1c6b": "解压模型压缩包,选择目录中的config.json文件"
373-
}
379+
}

0 commit comments

Comments
 (0)