Skip to content

Commit

Permalink
Fix error in generation dialog not always displayed (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoGresse authored Jul 24, 2024
1 parent 8bcf0e9 commit 220df84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const useSessionsGenerationGeneric = <
): Promise<{
success: boolean
results: any[]
message?: string
}> => {
const sessionsCount = sessions.length

Expand All @@ -82,6 +83,9 @@ export const useSessionsGenerationGeneric = <
return {
success: false,
results: [],
message:
answer.message ||
'Unknown error while generating the video/image, you may want to switch the ShortVid server',
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const GenerateSessionsVideoDialog = ({
...shortVidSetting,
updateSession: updateDoc,
})
.then(({ success, results }: GeneratedSessionVideoAnswer) => {
.then(({ success, results, message }: GeneratedSessionVideoAnswer) => {
if (success && results.length) {
const text = onSuccess ? 'Video generation done!' : 'Video generation done, sessions updated!'
if (onSuccess) {
Expand All @@ -76,7 +76,7 @@ export const GenerateSessionsVideoDialog = ({
onClose()
} else {
createNotification(
'Error while generating the video/image, you may want to switch the ShortVid server',
message || 'Error while generating the video/image, you may want to switch the ShortVid server',
{ type: 'error' }
)
}
Expand Down Expand Up @@ -145,6 +145,9 @@ export const GenerateSessionsVideoDialog = ({
{generatingState.generationState === GenerationStates.ERROR && (
<Typography color="error">{generatingState.message}</Typography>
)}
{finalGeneration.generatingState.generationState === GenerationStates.ERROR && (
<Typography color="error">{finalGeneration.generatingState.message}</Typography>
)}

{generatingState.generationState === GenerationStates.SUCCESS && (
<>
Expand Down

0 comments on commit 220df84

Please sign in to comment.