failes reason show
This commit is contained in:
@@ -23,6 +23,7 @@ const isGenerating = ref(false)
|
||||
const generationStatus = ref('')
|
||||
const generationProgress = ref(0)
|
||||
const generationSuccess = ref(false)
|
||||
const generationError = ref(null)
|
||||
const generatedResult = ref(null)
|
||||
|
||||
// History State
|
||||
@@ -193,6 +194,7 @@ const handleGenerate = async () => {
|
||||
|
||||
isGenerating.value = true
|
||||
generationSuccess.value = false
|
||||
generationError.value = null
|
||||
generationStatus.value = 'starting'
|
||||
generationProgress.value = 0
|
||||
generatedResult.value = null
|
||||
@@ -262,7 +264,8 @@ const pollStatus = async (id) => {
|
||||
|
||||
} else if (response.status === 'failed') {
|
||||
completed = true
|
||||
throw new Error('Generation failed on server')
|
||||
generationError.value = response.failed_reason || 'Generation failed on server'
|
||||
throw new Error(generationError.value)
|
||||
} else {
|
||||
await new Promise(resolve => setTimeout(resolve, 2000))
|
||||
}
|
||||
@@ -546,7 +549,22 @@ onMounted(() => {
|
||||
<span class="text-[10px] text-slate-500 font-mono mt-1">{{ generationProgress }}%</span>
|
||||
</div>
|
||||
|
||||
<div v-if="generatedResult && !isGenerating" class="flex-1 min-h-0 flex flex-col">
|
||||
<div v-if="generationError && !isGenerating"
|
||||
class="flex-1 flex flex-col items-center justify-center p-6 text-center animate-in fade-in zoom-in duration-300">
|
||||
<div
|
||||
class="w-16 h-16 rounded-full bg-red-500/10 flex items-center justify-center mb-4 border border-red-500/20">
|
||||
<i class="pi pi-times text-red-400 text-2xl"></i>
|
||||
</div>
|
||||
<h3 class="text-lg font-bold text-slate-200 mb-2">Generation Failed</h3>
|
||||
<p class="text-sm text-red-400 bg-red-500/5 px-4 py-2 rounded-lg border border-red-500/10">
|
||||
{{ generationError }}
|
||||
</p>
|
||||
<Button label="Try Again" icon="pi pi-refresh" class="mt-6" @click="handleGenerate"
|
||||
severity="secondary" />
|
||||
</div>
|
||||
|
||||
<div v-if="generatedResult && !isGenerating && !generationError"
|
||||
class="flex-1 min-h-0 flex flex-col">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-lg font-bold">Result</h2>
|
||||
</div>
|
||||
@@ -601,7 +619,7 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="!isGenerating && !generatedResult"
|
||||
<div v-else-if="!isGenerating && !generatedResult && !generationError"
|
||||
class="flex-1 flex flex-col items-center justify-center text-slate-500 gap-4 opacity-50">
|
||||
<i class="pi pi-image text-4xl"></i>
|
||||
<p class="text-sm">Ready to generate</p>
|
||||
@@ -651,7 +669,7 @@ onMounted(() => {
|
||||
gen.api_execution_time_seconds.toFixed(1) }}s</span>
|
||||
<span v-if="gen.token_usage" title="Tokens"><i class="pi pi-bolt mr-0.5"></i>{{
|
||||
gen.token_usage
|
||||
}}</span>
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user