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:
@@ -23,20 +23,37 @@ pub async fn get_background_tasks(
|
||||
State(pool): State<PgPool>,
|
||||
) -> Result<Json<Vec<BackgroundTask>>, (StatusCode, String)> {
|
||||
let query = r#"
|
||||
SELECT
|
||||
l.id,
|
||||
l.title,
|
||||
c.title as course_title,
|
||||
'lesson_transcription' as task_type,
|
||||
l.transcription_status as status,
|
||||
0 as progress,
|
||||
l.updated_at
|
||||
FROM lessons l
|
||||
JOIN modules m ON l.module_id = m.id
|
||||
JOIN courses c ON m.course_id = c.id
|
||||
WHERE l.transcription_status IN ('queued', 'processing', 'failed')
|
||||
|
||||
SELECT id, title, course_title, task_type, status, progress, updated_at
|
||||
FROM (
|
||||
SELECT
|
||||
l.id,
|
||||
l.title,
|
||||
c.title as course_title,
|
||||
'lesson_transcription' as task_type,
|
||||
l.transcription_status as status,
|
||||
0 as progress,
|
||||
l.updated_at
|
||||
FROM lessons l
|
||||
JOIN modules m ON l.module_id = m.id
|
||||
JOIN courses c ON m.course_id = c.id
|
||||
WHERE l.transcription_status IN ('queued', 'processing', 'failed')
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
t.id,
|
||||
t.title,
|
||||
t.course_title,
|
||||
t.task_type,
|
||||
t.status,
|
||||
t.progress,
|
||||
t.updated_at
|
||||
FROM background_tasks t
|
||||
WHERE t.task_type = 'zip_rag_import'
|
||||
AND t.status IN ('queued', 'processing', 'failed', 'completed')
|
||||
) merged
|
||||
ORDER BY updated_at DESC
|
||||
LIMIT 200
|
||||
"#;
|
||||
|
||||
let tasks = sqlx::query_as::<_, BackgroundTask>(query)
|
||||
|
||||
Reference in New Issue
Block a user