feat(question-bank): extend source options to include 'rag-ai' for AI-generated questions

This commit is contained in:
2026-04-09 17:20:43 -04:00
parent f2f9cef0e7
commit f74f94d005
4 changed files with 4 additions and 3 deletions
@@ -456,7 +456,7 @@ pub async fn list_questions(
"ai" => {
sqlx::query_as::<_, QuestionBank>(
&format!(
"SELECT {} FROM question_bank WHERE organization_id = $1 AND is_archived = false AND source = 'ai-generated' ORDER BY created_at DESC",
"SELECT {} FROM question_bank WHERE organization_id = $1 AND is_archived = false AND source IN ('ai-generated', 'rag-ai') ORDER BY created_at DESC",
QUESTION_BANK_SELECT_COLUMNS
)
)
+1 -1
View File
@@ -12,7 +12,7 @@ import MySQLImportModal from '@/components/QuestionBank/MySQLImportModal';
const isMySqlOrigin = (source?: string) => source === 'imported-mysql' || source === 'sam-diagnostico';
const isMaterialsOrigin = (source?: string) => source === 'imported-material';
const isAiOrigin = (source?: string) => source === 'ai-generated';
const isAiOrigin = (source?: string) => source === 'ai-generated' || source === 'rag-ai';
const toSafeText = (value: unknown): string => {
if (value === null || value === undefined) return '';
@@ -82,6 +82,7 @@ export default function QuestionBankCard({ question, onEdit, onDelete }: Questio
</span>
);
case 'ai-generated':
case 'rag-ai':
return (
<span className="flex items-center gap-1 text-xs text-purple-600 dark:text-purple-400">
<Sparkles className="w-3 h-3" /> IA
+1 -1
View File
@@ -1272,7 +1272,7 @@ export interface QuestionBank {
difficulty?: 'easy' | 'medium' | 'hard';
tags?: string[];
skill_assessed?: 'reading' | 'listening' | 'speaking' | 'writing';
source?: 'manual' | 'ai-generated' | 'imported-mysql' | 'imported-csv';
source?: 'manual' | 'ai-generated' | 'rag-ai' | 'imported-mysql' | 'imported-material' | 'imported-csv' | 'sam-diagnostico';
source_metadata?: unknown;
usage_count?: number;
last_used_at?: string;