Added check for training file upload

This commit is contained in:
Viswamedha Nalabotu 2026-03-22 17:38:01 +00:00
parent c1d362665c
commit e3ff66653c

View file

@ -2,6 +2,7 @@
import { ref, computed, onMounted, onUnmounted, watch, reactive } from 'vue' import { ref, computed, onMounted, onUnmounted, watch, reactive } from 'vue'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { import {
Alert,
Card, Card,
Typography, Typography,
Button, Button,
@ -41,6 +42,32 @@ const userStore = useUserStore()
const roleId = computed(() => route.params.roleId as string) 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 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)
? res.data
: (res.data as { results?: { status: string }[] }).results ?? []
const ingesting = files.filter((f) => f.status === 'ingesting').length
const failed = files.filter((f) => f.status === 'failed').length
if (ingesting === 0 && failed === 0) {
trainingFileWarning.value = null
return
}
const parts: string[] = []
if (ingesting > 0) parts.push(`${ingesting} file${ingesting > 1 ? 's are' : ' is'} still being processed`)
if (failed > 0) parts.push(`${failed} file${failed > 1 ? 's' : ''} failed to ingest`)
trainingFileWarning.value =
parts.join(' and ') + '. Generated content may not reflect all uploaded documents.'
} catch {
trainingFileWarning.value = null
}
}
const session = ref<OnboardingSession | null>(null) const session = ref<OnboardingSession | null>(null)
const currentPageIndex = ref(0) const currentPageIndex = ref(0)
const loading = ref(false) const loading = ref(false)
@ -96,7 +123,7 @@ const pageHelpByPage = computed<
const currentPageHelp = computed(() => { const currentPageHelp = computed(() => {
if (!currentPage.value) return [] if (!currentPage.value) return []
return pageHelpByPage.value[currentPage.value.uuid] || [] return [...(pageHelpByPage.value[currentPage.value.uuid] || [])].reverse()
}) })
const currentPageBody = computed(() => { const currentPageBody = computed(() => {
@ -316,6 +343,7 @@ const startAgenticGeneration = async () => {
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(() => {
@ -627,6 +655,14 @@ watch(
</div> </div>
</template> </template>
<Alert
v-if="trainingFileWarning"
:message="trainingFileWarning"
type="warning"
show-icon
style="margin-bottom: 12px"
/>
<div class="orchestrator-logs"> <div class="orchestrator-logs">
<div v-for="(log, i) in agentStore.eventLog" :key="i" class="log-entry"> <div v-for="(log, i) in agentStore.eventLog" :key="i" class="log-entry">
<Tag :color="log.type.includes('tool') ? 'green' : 'blue'" class="log-tag"> <Tag :color="log.type.includes('tool') ? 'green' : 'blue'" class="log-tag">
@ -754,7 +790,7 @@ watch(
</div> </div>
<div <div
class="markdown-body" class="markdown-body"
v-html="kaStore.isAsking && kaStore.streamBuffer v-html="kaStore.isAsking && kaStore.streamBuffer && kaMode === 'update_page'
? DOMPurify.sanitize(marked.parse(kaStore.streamBuffer) as string) ? DOMPurify.sanitize(marked.parse(kaStore.streamBuffer) as string)
: renderedBody" : renderedBody"
></div> ></div>
@ -910,6 +946,18 @@ watch(
</Button> </Button>
</div> </div>
<div
v-if="kaStore.isAsking && kaStore.streamBuffer && kaMode === 'separate'"
class="ka-thread-item"
style="margin-bottom: 0.75rem"
>
<Typography.Text class="white-text" strong>KA:</Typography.Text>
<div
class="markdown-body"
v-html="DOMPurify.sanitize(marked.parse(kaStore.streamBuffer) as string)"
></div>
</div>
<div v-if="currentPageHelp.length" class="ka-thread"> <div v-if="currentPageHelp.length" class="ka-thread">
<div <div
v-for="(entry, idx) in currentPageHelp" v-for="(entry, idx) in currentPageHelp"