Added warning for ingestion progress on onboarding

This commit is contained in:
Viswamedha Nalabotu 2026-03-22 18:04:29 +00:00
parent bfeb4f40fa
commit a6fe130307

View file

@ -44,17 +44,24 @@ const roleId = computed(() => route.params.roleId as string)
const flowDetails = ref<OnboardingFlow | null>(null)
const trainingFileWarning = ref<string | null>(null)
const hasIngestingFiles = ref(false)
const generationBlocked = ref(false)
const isManager = computed(() => Boolean(userStore.isGeneralManager))
const fetchTrainingFileWarning = async () => {
try {
const res = await apiClient.get<{ status: string }[]>(API.knowledge.trainingFiles.list(), {
params: { role_uuid: roleId.value },
})
const files: { status: string }[] = Array.isArray(res.data)
const allFiles: { status: string; scope?: string }[] = Array.isArray(res.data)
? res.data
: (res.data as { results?: { status: string }[] }).results ?? []
: (res.data as { results?: { status: string; scope?: string }[] }).results ?? []
// Only consider role-scoped files org-wide files apply to all roles
// and their ingestion state shouldn't block a specific role's onboarding
const files = allFiles.filter((f) => f.scope === 'role')
const ingesting = files.filter((f) => f.status === 'ingesting').length
const failed = files.filter((f) => f.status === 'failed').length
hasIngestingFiles.value = ingesting > 0
if (ingesting === 0 && failed === 0) {
trainingFileWarning.value = null
return
@ -66,6 +73,7 @@ const fetchTrainingFileWarning = async () => {
parts.join(' and ') + '. Generated content may not reflect all uploaded documents.'
} catch {
trainingFileWarning.value = null
hasIngestingFiles.value = false
}
}
const session = ref<OnboardingSession | null>(null)
@ -329,7 +337,12 @@ const initOnboarding = async () => {
await loadFlow(matchingFlow.uuid)
} else {
if (!generationHandled.value) {
await startAgenticGeneration()
await fetchTrainingFileWarning()
if (hasIngestingFiles.value) {
generationBlocked.value = true
} else {
await startAgenticGeneration()
}
}
}
} catch {
@ -340,10 +353,10 @@ const initOnboarding = async () => {
}
const startAgenticGeneration = async () => {
generationBlocked.value = false
isAutoGenerating.value = true
generationHandled.value = false
agentStore.clearLog()
await fetchTrainingFileWarning()
agentStore.connect(roleId.value)
const checkInterval = setInterval(() => {
@ -647,6 +660,29 @@ watch(
<template>
<div class="page-container">
<Spin :spinning="loading" tip="Loading...">
<Card v-if="generationBlocked && !isAutoGenerating" class="dark-panel pipeline-card">
<template #title>
<span class="white-text">Training Files Not Ready</span>
</template>
<Alert
:message="trainingFileWarning"
type="warning"
show-icon
style="margin-bottom: 16px"
/>
<Typography.Paragraph v-if="!isManager" type="secondary" style="color: rgba(255,255,255,0.65)">
Onboarding generation will start once all files have been processed.
Please wait a few minutes and then refresh the page.
</Typography.Paragraph>
<template v-else>
<Typography.Paragraph type="secondary" style="color: rgba(255,255,255,0.65)">
You can wait for ingestion to complete, or generate now using whatever
content has already been indexed.
</Typography.Paragraph>
<Button type="primary" @click="startAgenticGeneration">Generate Anyway</Button>
</template>
</Card>
<Card v-if="isAutoGenerating" class="dark-panel pipeline-card">
<template #title>
<div class="pipeline-header">