@@ -26,6 +26,7 @@ const formData = ref({
2626 soundType: ' soundTts' ,
2727 soundTtsId: 0 ,
2828 soundCloneId: 0 ,
29+ soundCustomFile: ' ' ,
2930 param: {},
3031});
3132const formDataParam = ref ([])
@@ -81,6 +82,7 @@ const doSubmit = async () => {
8182 }
8283 let soundTtsRecord: SoundTtsRecord | null = null
8384 let soundCloneRecord: SoundCloneRecord | null = null
85+ let soundCustomFile: string | null = null
8486 if (formData .value .soundType === ' soundTts' ) {
8587 if (! formData .value .soundTtsId ) {
8688 Dialog .tipError (t (' 请选择声音' ))
@@ -101,6 +103,16 @@ const doSubmit = async () => {
101103 Dialog .tipError (t (' 请选择声音' ))
102104 return
103105 }
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+ })
104116 }
105117 if (! formData .value .videoTemplateId ) {
106118 Dialog .tipError (t (' 请选择视频' ))
@@ -131,6 +143,7 @@ const doSubmit = async () => {
131143 soundTtsText: soundTtsRecord ? soundTtsRecord .text : ' ' ,
132144 soundCloneId: formData .value .soundCloneId ,
133145 soundCloneText: soundCloneRecord ? soundCloneRecord .text : ' ' ,
146+ soundCustomFile: soundCustomFile || ' ' ,
134147 param: formData .value .param ,
135148 }
136149 if (! await PermissionService .checkForTask (' VideoGen' , record )) {
@@ -147,6 +160,22 @@ const refresh = async (type: 'videoTemplate') => {
147160 }
148161}
149162
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+
150179const emit = defineEmits ({
151180 submitted : () => true
152181})
@@ -187,13 +216,12 @@ defineExpose({
187216 <i class =" iconfont icon-sound-clone" ></i >
188217 {{ $t('声音克隆') }}
189218 </a-radio >
219+ <a-radio value =" soundCustom" >
220+ <icon-file />
221+ {{ $t('本地文件') }}
222+ </a-radio >
190223 </a-radio-group >
191224 </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 >
197225 <div class =" mr-3 w-56 flex-shrink-0" v-if =" formData.soundType==='soundTts'" >
198226 <a-select v-model =" formData.soundTtsId" >
199227 <a-option :value =" 0" >{{ $t('请选择') }}</a-option >
@@ -204,11 +232,6 @@ defineExpose({
204232 </a-option >
205233 </a-select >
206234 </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 >
212235 <div class =" mr-3 w-56 flex-shrink-0" v-if =" formData.soundType==='soundClone'" >
213236 <a-select v-model =" formData.soundCloneId" >
214237 <a-option :value =" 0" >{{ $t('请选择') }}</a-option >
@@ -219,6 +242,14 @@ defineExpose({
219242 </a-option >
220243 </a-select >
221244 </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 >
222253 </div >
223254 <div class =" flex items-center h-12" >
224255 <div class =" mr-1" >
@@ -245,7 +276,7 @@ defineExpose({
245276 <a-button class =" mr-2" type =" primary" @click =" doSubmit" >
246277 {{ $t('开始生成视频') }}
247278 </a-button >
248- <ServerContentInfoAction :config =" modelConfig as any" func =" videoGen" />
279+ <ServerContentInfoAction :config =" modelConfig as any" func =" videoGen" />
249280 </div >
250281 </div >
251282</template >
0 commit comments