mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-07 13:59:28 +08:00
fix(video): handle undefined video case in VideoPanel
Add conditional check to handle undefined video case and show toast for unimplemented remix video feature.
This commit is contained in:
parent
7bde37680e
commit
ae54d5d9b9
@ -48,6 +48,7 @@ export const VideoPanel = ({ provider, video, params, updateParams }: VideoPanel
|
|||||||
if (!couldCreateVideo) return
|
if (!couldCreateVideo) return
|
||||||
setIsProcessing(true)
|
setIsProcessing(true)
|
||||||
try {
|
try {
|
||||||
|
if (video === undefined) {
|
||||||
const result = await createVideo(params)
|
const result = await createVideo(params)
|
||||||
const video = result.video
|
const video = result.video
|
||||||
switch (result.type) {
|
switch (result.type) {
|
||||||
@ -57,12 +58,16 @@ export const VideoPanel = ({ provider, video, params, updateParams }: VideoPanel
|
|||||||
default:
|
default:
|
||||||
logger.error(`Invalid video type ${result.type}.`)
|
logger.error(`Invalid video type ${result.type}.`)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// TODO: remix video
|
||||||
|
window.toast.info('Remix video is not implemented.')
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
window.toast.error({ title: t('video.error.create'), description: getErrorMessage(e), timeout: 5000 })
|
window.toast.error({ title: t('video.error.create'), description: getErrorMessage(e), timeout: 5000 })
|
||||||
} finally {
|
} finally {
|
||||||
setIsProcessing(false)
|
setIsProcessing(false)
|
||||||
}
|
}
|
||||||
}, [addOpenAIVideo, couldCreateVideo, params, t])
|
}, [addOpenAIVideo, couldCreateVideo, params, t, video])
|
||||||
|
|
||||||
const handleUploadFile = useCallback(() => {
|
const handleUploadFile = useCallback(() => {
|
||||||
fileInputRef.current?.click()
|
fileInputRef.current?.click()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user