@@ -26,6 +26,7 @@ const formData = ref({
26
26
soundType: ' soundTts' ,
27
27
soundTtsId: 0 ,
28
28
soundCloneId: 0 ,
29
+ soundCustomFile: ' ' ,
29
30
param: {},
30
31
});
31
32
const formDataParam = ref ([])
@@ -81,6 +82,7 @@ const doSubmit = async () => {
81
82
}
82
83
let soundTtsRecord: SoundTtsRecord | null = null
83
84
let soundCloneRecord: SoundCloneRecord | null = null
85
+ let soundCustomFile: string | null = null
84
86
if (formData .value .soundType === ' soundTts' ) {
85
87
if (! formData .value .soundTtsId ) {
86
88
Dialog .tipError (t (' 请选择声音' ))
@@ -101,6 +103,16 @@ const doSubmit = async () => {
101
103
Dialog .tipError (t (' 请选择声音' ))
102
104
return
103
105
}
106
+ } else if (formData .value .soundType === ' soundCustom' ) {
107
+ soundCustomFile = formData .value .soundCustomFile
108
+ if (! soundCustomFile ) {
109
+ Dialog .tipError (t (' 请选择声音' ))
110
+ return
111
+ }
112
+ soundCustomFile = await window .$mapi .file .hubSave (soundCustomFile , {
113
+ isFullPath: true ,
114
+ returnFullPath: true ,
115
+ })
104
116
}
105
117
if (! formData .value .videoTemplateId ) {
106
118
Dialog .tipError (t (' 请选择视频' ))
@@ -131,6 +143,7 @@ const doSubmit = async () => {
131
143
soundTtsText: soundTtsRecord ? soundTtsRecord .text : ' ' ,
132
144
soundCloneId: formData .value .soundCloneId ,
133
145
soundCloneText: soundCloneRecord ? soundCloneRecord .text : ' ' ,
146
+ soundCustomFile: soundCustomFile || ' ' ,
134
147
param: formData .value .param ,
135
148
}
136
149
if (! await PermissionService .checkForTask (' VideoGen' , record )) {
@@ -147,6 +160,22 @@ const refresh = async (type: 'videoTemplate') => {
147
160
}
148
161
}
149
162
163
+ const doSoundCustomSelect = async () => {
164
+ const path = await window .$mapi .file .openFile ({
165
+ filters: [
166
+ {name: ' *.wav' , extensions: [' wav' ]},
167
+ ],
168
+ })
169
+ if (! path ) {
170
+ return
171
+ }
172
+ formData .value .soundCustomFile = path
173
+ }
174
+
175
+ const fileName = (fullPath : string ) => {
176
+ return fullPath .replace (/ \\ / g , ' /' ).split (' /' ).pop () || ' '
177
+ }
178
+
150
179
const emit = defineEmits ({
151
180
submitted : () => true
152
181
})
@@ -187,13 +216,12 @@ defineExpose({
187
216
<i class =" iconfont icon-sound-clone" ></i >
188
217
{{ $t('声音克隆') }}
189
218
</a-radio >
219
+ <a-radio value =" soundCustom" >
220
+ <icon-file />
221
+ {{ $t('本地文件') }}
222
+ </a-radio >
190
223
</a-radio-group >
191
224
</div >
192
- <div class =" mr-1" v-if =" formData.soundType==='soundTts'" >
193
- <a-tooltip :content =" $t('声音合成')" >
194
- <i class =" iconfont icon-sound-generate" ></i >
195
- </a-tooltip >
196
- </div >
197
225
<div class =" mr-3 w-56 flex-shrink-0" v-if =" formData.soundType==='soundTts'" >
198
226
<a-select v-model =" formData.soundTtsId" >
199
227
<a-option :value =" 0" >{{ $t('请选择') }}</a-option >
@@ -204,11 +232,6 @@ defineExpose({
204
232
</a-option >
205
233
</a-select >
206
234
</div >
207
- <div class =" mr-1" v-if =" formData.soundType==='soundClone'" >
208
- <a-tooltip :content =" $t('声音克隆')" >
209
- <i class =" iconfont icon-sound-clone" ></i >
210
- </a-tooltip >
211
- </div >
212
235
<div class =" mr-3 w-56 flex-shrink-0" v-if =" formData.soundType==='soundClone'" >
213
236
<a-select v-model =" formData.soundCloneId" >
214
237
<a-option :value =" 0" >{{ $t('请选择') }}</a-option >
@@ -219,6 +242,14 @@ defineExpose({
219
242
</a-option >
220
243
</a-select >
221
244
</div >
245
+ <div class =" mr-3 w-56 flex-shrink-0" v-if =" formData.soundType==='soundCustom'" >
246
+ <a-button @click =" doSoundCustomSelect" >
247
+ <div v-if =" formData.soundCustomFile" >
248
+ {{ fileName(formData.soundCustomFile) }}
249
+ </div >
250
+ <div v-else >{{ $t('选择本地文件') }}</div >
251
+ </a-button >
252
+ </div >
222
253
</div >
223
254
<div class =" flex items-center h-12" >
224
255
<div class =" mr-1" >
@@ -245,7 +276,7 @@ defineExpose({
245
276
<a-button class =" mr-2" type =" primary" @click =" doSubmit" >
246
277
{{ $t('开始生成视频') }}
247
278
</a-button >
248
- <ServerContentInfoAction :config =" modelConfig as any" func =" videoGen" />
279
+ <ServerContentInfoAction :config =" modelConfig as any" func =" videoGen" />
249
280
</div >
250
281
</div >
251
282
</template >
0 commit comments