feat(admin-web): surface generation error message and speed up active polling
Hoists hasActiveGenerationStatus into the shared display helper so all views agree on what counts as in-flight generation, shows the backend generation_error_message inline on the imitation list and detail drawer when status is failed, and drops the workspace/templates/imitation poll interval from 10s to 3s (with a 5s fallback when streaming is enabled) plus explicit query-cache invalidation so failed/completed states show up promptly.
This commit is contained in:
@@ -39,6 +39,7 @@ import {
|
||||
formatDateTime,
|
||||
getGenerateStatusMeta,
|
||||
getPublishStatusMeta,
|
||||
hasActiveGenerationStatus,
|
||||
getTemplateMeta,
|
||||
} from '@/lib/display'
|
||||
import { formatError } from '@/lib/errors'
|
||||
@@ -197,12 +198,6 @@ const displayedArticleTotal = computed(() =>
|
||||
|
||||
let articlePollingTimer: number | null = null
|
||||
|
||||
function hasActiveGenerationStatus(status?: string | null): boolean {
|
||||
return (
|
||||
status === 'queued' || status === 'pending' || status === 'generating' || status === 'running'
|
||||
)
|
||||
}
|
||||
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: (articleId: number) => articlesApi.remove(articleId),
|
||||
onSuccess: async () => {
|
||||
@@ -413,8 +408,10 @@ function startArticlePolling(): void {
|
||||
}
|
||||
|
||||
articlePollingTimer = window.setInterval(() => {
|
||||
void queryClient.invalidateQueries({ queryKey: ['articles'] })
|
||||
void queryClient.invalidateQueries({ queryKey: ['workspace', 'recent-articles'] })
|
||||
void Promise.all([articleListQuery.refetch(), recentArticlesQuery.refetch()])
|
||||
}, 10000)
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
function stopArticlePolling(): void {
|
||||
|
||||
Reference in New Issue
Block a user