feat: Implement ZIP RAG import functionality with background processing

- Added support for ZIP RAG import in the asset management system.
- Introduced a new background task type for ZIP RAG imports.
- Enhanced the asset import process to allow for optional development processing.
- Updated the UI to reflect the new RAG processing status and options.
- Created database migration for background tasks related to ZIP RAG imports.
- Refactored asset handling to support FLV normalization and improved error handling.
- Added new API endpoints and updated existing ones to accommodate changes.
This commit is contained in:
2026-04-17 12:51:50 -04:00
parent ccea101a5e
commit a3467d22d3
9 changed files with 821 additions and 153 deletions
+7 -1
View File
@@ -755,6 +755,8 @@ export interface AssetZipImportResult {
rag_ingested_assets: number;
rag_chunks_ingested: number;
failed_entries: string[];
rag_background_started?: boolean;
rag_background_items?: number;
}
export interface Cohort {
@@ -1130,6 +1132,7 @@ export const cmsApi = {
splitToRegular = false,
samCourseIdR1?: number,
samCourseIdR2?: number,
useDevProcessing = false,
): Promise<AssetZipImportResult> => {
return new Promise((resolve, reject) => {
const maxNetworkRetries = 2;
@@ -1147,6 +1150,9 @@ export const cmsApi = {
if (samCourseIdR1) formData.append('sam_course_id_r1', String(samCourseIdR1));
if (samCourseIdR2) formData.append('sam_course_id_r2', String(samCourseIdR2));
}
if (useDevProcessing) {
formData.append('use_dev_processing', 'true');
}
const xhr = new XMLHttpRequest();
xhr.open('POST', `${API_BASE_URL}/api/assets/import-zip`);
@@ -1819,7 +1825,7 @@ export interface BackgroundTask {
id: string;
title: string;
course_title?: string;
task_type: 'lesson_transcription' | 'lesson_image' | 'course_image';
task_type: 'lesson_transcription' | 'lesson_image' | 'course_image' | 'zip_rag_import';
status: 'idle' | 'queued' | 'processing' | 'failed' | 'completed' | 'error';
progress: number;
updated_at: string;