Added warning for ingestion progress on onboarding
This commit is contained in:
parent
bfeb4f40fa
commit
a6fe130307
1 changed files with 40 additions and 4 deletions
|
|
@ -44,17 +44,24 @@ const roleId = computed(() => route.params.roleId as string)
|
||||||
const flowDetails = ref<OnboardingFlow | null>(null)
|
const flowDetails = ref<OnboardingFlow | null>(null)
|
||||||
|
|
||||||
const trainingFileWarning = ref<string | 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 () => {
|
const fetchTrainingFileWarning = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await apiClient.get<{ status: string }[]>(API.knowledge.trainingFiles.list(), {
|
const res = await apiClient.get<{ status: string }[]>(API.knowledge.trainingFiles.list(), {
|
||||||
params: { role_uuid: roleId.value },
|
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
|
||||||
: (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 ingesting = files.filter((f) => f.status === 'ingesting').length
|
||||||
const failed = files.filter((f) => f.status === 'failed').length
|
const failed = files.filter((f) => f.status === 'failed').length
|
||||||
|
hasIngestingFiles.value = ingesting > 0
|
||||||
if (ingesting === 0 && failed === 0) {
|
if (ingesting === 0 && failed === 0) {
|
||||||
trainingFileWarning.value = null
|
trainingFileWarning.value = null
|
||||||
return
|
return
|
||||||
|
|
@ -66,6 +73,7 @@ const fetchTrainingFileWarning = async () => {
|
||||||
parts.join(' and ') + '. Generated content may not reflect all uploaded documents.'
|
parts.join(' and ') + '. Generated content may not reflect all uploaded documents.'
|
||||||
} catch {
|
} catch {
|
||||||
trainingFileWarning.value = null
|
trainingFileWarning.value = null
|
||||||
|
hasIngestingFiles.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const session = ref<OnboardingSession | null>(null)
|
const session = ref<OnboardingSession | null>(null)
|
||||||
|
|
@ -329,9 +337,14 @@ const initOnboarding = async () => {
|
||||||
await loadFlow(matchingFlow.uuid)
|
await loadFlow(matchingFlow.uuid)
|
||||||
} else {
|
} else {
|
||||||
if (!generationHandled.value) {
|
if (!generationHandled.value) {
|
||||||
|
await fetchTrainingFileWarning()
|
||||||
|
if (hasIngestingFiles.value) {
|
||||||
|
generationBlocked.value = true
|
||||||
|
} else {
|
||||||
await startAgenticGeneration()
|
await startAgenticGeneration()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
message.error('Could not load onboarding context')
|
message.error('Could not load onboarding context')
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -340,10 +353,10 @@ const initOnboarding = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const startAgenticGeneration = async () => {
|
const startAgenticGeneration = async () => {
|
||||||
|
generationBlocked.value = false
|
||||||
isAutoGenerating.value = true
|
isAutoGenerating.value = true
|
||||||
generationHandled.value = false
|
generationHandled.value = false
|
||||||
agentStore.clearLog()
|
agentStore.clearLog()
|
||||||
await fetchTrainingFileWarning()
|
|
||||||
agentStore.connect(roleId.value)
|
agentStore.connect(roleId.value)
|
||||||
|
|
||||||
const checkInterval = setInterval(() => {
|
const checkInterval = setInterval(() => {
|
||||||
|
|
@ -647,6 +660,29 @@ watch(
|
||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<Spin :spinning="loading" tip="Loading...">
|
<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">
|
<Card v-if="isAutoGenerating" class="dark-panel pipeline-card">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="pipeline-header">
|
<div class="pipeline-header">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue