Enhance Exercise Enrichment Admin Functionality and Update Documentation
Deploy Development / deploy (push) Successful in 51s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m16s
Test Suite / pytest-backend (pull_request) Successful in 36s
Test Suite / lint-backend (pull_request) Successful in 0s
Test Suite / build-frontend (pull_request) Successful in 13s
Test Suite / k6 /health Baseline (pull_request) Successful in 33s
Test Suite / playwright-tests (pull_request) Successful in 1m23s
Deploy Development / deploy (push) Successful in 51s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m16s
Test Suite / pytest-backend (pull_request) Successful in 36s
Test Suite / lint-backend (pull_request) Successful in 0s
Test Suite / build-frontend (pull_request) Successful in 13s
Test Suite / k6 /health Baseline (pull_request) Successful in 33s
Test Suite / playwright-tests (pull_request) Successful in 1m23s
- Implemented a maximum of 3 exercises per preview request to prevent Gateway-504 errors, improving the stability of the exercise enrichment process. - Adjusted batch sizes for applying exercises and previewing to optimize performance and resource management. - Updated the frontend to reflect changes in preview handling, including user notifications about chunk sizes and potential timeouts. - Incremented version to 0.8.180 and updated changelog to document these enhancements and fixes.
This commit is contained in:
1 parent
f4196c3580
commit
46fae3da33
5 files changed
+114
-41
No files matched your search
@@ -43,7 +43,9 @@ const INSTRUCTION_LABELS = {
|
||||
trainer_notes: 'Trainer-Hinweise',
|
||||
}
|
||||
|
||||
const CHUNK_SIZE = 25
|
||||
/** Preview: kleine Pakete — Gateway (Fritz!Box o.ä.) timeout oft ~60s bei LLM-Ketten. */
|
||||
const PREVIEW_CHUNK_SIZE = 3
|
||||
const APPLY_CHUNK_SIZE = 25
|
||||
|
||||
function skillLabel(sk) {
|
||||
if (!sk) return '—'
|
||||
@@ -177,9 +179,15 @@ function RunDialog({
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{exerciseCount >= 10 && (
|
||||
<p style={{ margin: '10px 0 0', color: 'var(--text2)', fontSize: '0.88rem' }}>
|
||||
Die Vorschau läuft in Paketen à 3 Übungen (Gateway-Timeout vermeiden). Fenster offen lassen —
|
||||
bei {exerciseCount} Übungen ca. {Math.ceil(exerciseCount / 3)} Pakete.
|
||||
</p>
|
||||
)}
|
||||
{exerciseCount >= 25 && (
|
||||
<p style={{ margin: '10px 0 0', color: 'var(--danger)', fontSize: '0.88rem' }}>
|
||||
Großer Batch — OpenRouter-Kosten und Laufzeit beachten. Der Lauf kann mehrere Minuten dauern.
|
||||
<p style={{ margin: '6px 0 0', color: 'var(--danger)', fontSize: '0.88rem' }}>
|
||||
Großer Batch — OpenRouter-Kosten und Gesamtlaufzeit (mehrere Minuten) beachten.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
@@ -432,6 +440,24 @@ export default function AdminExerciseEnrichmentPage() {
|
||||
setDialogOpen(true)
|
||||
}
|
||||
|
||||
async function previewChunkWithRetry(chunk, attempt = 0) {
|
||||
try {
|
||||
return await api.previewExerciseEnrichment({
|
||||
exercise_ids: chunk,
|
||||
modes,
|
||||
merge_mode: mergeMode,
|
||||
})
|
||||
} catch (e) {
|
||||
const msg = e.message || String(e)
|
||||
const isTimeout = /504|502|timeout/i.test(msg)
|
||||
if (isTimeout && attempt < 2) {
|
||||
await new Promise((r) => setTimeout(r, 2500))
|
||||
return previewChunkWithRetry(chunk, attempt + 1)
|
||||
}
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
async function runPreviewFromDialog() {
|
||||
setDialogOpen(false)
|
||||
setError('')
|
||||
@@ -440,18 +466,21 @@ export default function AdminExerciseEnrichmentPage() {
|
||||
const allResults = []
|
||||
const allErrors = []
|
||||
let estTotal = 0
|
||||
const totalChunks = Math.ceil(selectedIds.length / PREVIEW_CHUNK_SIZE)
|
||||
|
||||
setJobProgress({ done: 0, total: selectedIds.length, phase: 'Vorschau' })
|
||||
|
||||
try {
|
||||
for (let i = 0; i < selectedIds.length; i += CHUNK_SIZE) {
|
||||
for (let i = 0; i < selectedIds.length; i += PREVIEW_CHUNK_SIZE) {
|
||||
if (abortRef.current) break
|
||||
const chunk = selectedIds.slice(i, i + CHUNK_SIZE)
|
||||
const resp = await api.previewExerciseEnrichment({
|
||||
exercise_ids: chunk,
|
||||
modes,
|
||||
merge_mode: mergeMode,
|
||||
const chunk = selectedIds.slice(i, i + PREVIEW_CHUNK_SIZE)
|
||||
const chunkNo = Math.floor(i / PREVIEW_CHUNK_SIZE) + 1
|
||||
setJobProgress({
|
||||
done: i,
|
||||
total: selectedIds.length,
|
||||
phase: `Vorschau Paket ${chunkNo}/${totalChunks}`,
|
||||
})
|
||||
const resp = await previewChunkWithRetry(chunk)
|
||||
allResults.push(...(resp.results || []))
|
||||
allErrors.push(...(resp.errors || []))
|
||||
const est = resp.estimated_llm_calls
|
||||
@@ -459,7 +488,7 @@ export default function AdminExerciseEnrichmentPage() {
|
||||
setJobProgress({
|
||||
done: Math.min(i + chunk.length, selectedIds.length),
|
||||
total: selectedIds.length,
|
||||
phase: 'Vorschau',
|
||||
phase: `Vorschau Paket ${chunkNo}/${totalChunks}`,
|
||||
})
|
||||
}
|
||||
setPreviewRows(allResults)
|
||||
@@ -517,9 +546,9 @@ export default function AdminExerciseEnrichmentPage() {
|
||||
setJobProgress({ done: 0, total: applyItems.length, phase: 'Anwenden' })
|
||||
|
||||
try {
|
||||
for (let i = 0; i < applyItems.length; i += CHUNK_SIZE) {
|
||||
for (let i = 0; i < applyItems.length; i += APPLY_CHUNK_SIZE) {
|
||||
if (abortRef.current) break
|
||||
const chunk = applyItems.slice(i, i + CHUNK_SIZE)
|
||||
const chunk = applyItems.slice(i, i + APPLY_CHUNK_SIZE)
|
||||
const resp = await api.applyExerciseEnrichment({
|
||||
items: chunk,
|
||||
modes: previewMeta?.modes || modes,
|
||||
|
||||
Reference in new issue
Block a user