Enhance Planning Exercise Suggestion with LLM-Rerank and Client Overrides
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 47s
Test Suite / playwright-tests (push) Successful in 1m14s
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 47s
Test Suite / playwright-tests (push) Successful in 1m14s
- Implemented optional LLM-Rerank functionality in the planning exercise suggestion process, allowing for improved exercise ranking based on user-defined criteria. - Updated the `suggestPlanningExercises` API to accept `planned_exercise_ids` for client-side overrides, enhancing flexibility in exercise selection. - Enhanced the `ExercisePickerModal` to reflect LLM ranking status and support new planning context features. - Incremented application version to 0.8.170 and updated changelog to document the new features and improvements in the planning AI capabilities.
This commit is contained in:
1 parent
128a9d752e
commit
207817376d
12 files changed
+463
-14
No files matched your search
@@ -76,7 +76,7 @@ export async function quickCreateTrainingUnit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
/** Planungs-KI P0: kontextgebundene Übungssuche (Hybrid-Retrieval). */
|
||||
/** Planungs-KI: kontextgebundene Übungssuche (Hybrid + Profil + optional LLM-Rerank). */
|
||||
export async function suggestPlanningExercises(body = {}) {
|
||||
return request('/api/planning/exercise-suggest', {
|
||||
method: 'POST',
|
||||
|
||||
@@ -68,6 +68,7 @@ export default function ExercisePickerModal({
|
||||
const [quickCreateDraft, setQuickCreateDraft] = useState(null)
|
||||
const [planningContextSummary, setPlanningContextSummary] = useState(null)
|
||||
const [planningTargetProfileSummary, setPlanningTargetProfileSummary] = useState(null)
|
||||
const [planningLlmRankApplied, setPlanningLlmRankApplied] = useState(false)
|
||||
const [planningIntentResolved, setPlanningIntentResolved] = useState(null)
|
||||
const pickerScrollRef = useRef(null)
|
||||
|
||||
@@ -155,6 +156,7 @@ export default function ExercisePickerModal({
|
||||
setQuickCreateDraft(null)
|
||||
setPlanningContextSummary(null)
|
||||
setPlanningTargetProfileSummary(null)
|
||||
setPlanningLlmRankApplied(false)
|
||||
setPlanningIntentResolved(null)
|
||||
return
|
||||
}
|
||||
@@ -271,6 +273,11 @@ export default function ExercisePickerModal({
|
||||
planningContext.anchorExerciseId != null ? Number(planningContext.anchorExerciseId) : null,
|
||||
progression_graph_id:
|
||||
planningContext.progressionGraphId != null ? Number(planningContext.progressionGraphId) : null,
|
||||
planned_exercise_ids:
|
||||
Array.isArray(planningContext.plannedExerciseIds) && planningContext.plannedExerciseIds.length > 0
|
||||
? planningContext.plannedExerciseIds.map((x) => Number(x)).filter((x) => Number.isFinite(x) && x > 0)
|
||||
: undefined,
|
||||
include_llm_rank: true,
|
||||
query,
|
||||
intent_hint: planningContext.intentHint || null,
|
||||
limit: PAGE_SIZE,
|
||||
@@ -279,6 +286,7 @@ export default function ExercisePickerModal({
|
||||
})
|
||||
setPlanningContextSummary(res?.context_summary || null)
|
||||
setPlanningTargetProfileSummary(res?.target_profile_summary || null)
|
||||
setPlanningLlmRankApplied(Boolean(res?.llm_rank_applied))
|
||||
setPlanningIntentResolved(res?.intent_resolved || null)
|
||||
const hits = (Array.isArray(res?.hits) ? res.hits : []).map((h) => ({
|
||||
id: h.id,
|
||||
@@ -294,6 +302,7 @@ export default function ExercisePickerModal({
|
||||
} else {
|
||||
setPlanningContextSummary(null)
|
||||
setPlanningTargetProfileSummary(null)
|
||||
setPlanningLlmRankApplied(false)
|
||||
setPlanningIntentResolved(null)
|
||||
const batch = await api.listExercises({
|
||||
...queryBase,
|
||||
@@ -312,6 +321,7 @@ export default function ExercisePickerModal({
|
||||
setHasMore(false)
|
||||
setPlanningContextSummary(null)
|
||||
setPlanningTargetProfileSummary(null)
|
||||
setPlanningLlmRankApplied(false)
|
||||
setPlanningIntentResolved(null)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
@@ -538,6 +548,7 @@ export default function ExercisePickerModal({
|
||||
{planningIntentResolved ? (
|
||||
<p style={{ margin: '6px 0 0', fontSize: '11px', color: 'var(--text3)' }}>
|
||||
Modus: {planningIntentResolved.replace(/_/g, ' ')}
|
||||
{planningLlmRankApplied ? ' · KI-Ranking aktiv' : null}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
@@ -152,11 +152,23 @@ export default function TrainingUnitEditPage() {
|
||||
}
|
||||
}
|
||||
}
|
||||
const plannedExerciseIds = []
|
||||
const seenPlan = new Set()
|
||||
for (const sec of secs) {
|
||||
for (const it of sec?.items || []) {
|
||||
if (String(it?.item_type || '').toLowerCase() === 'note') continue
|
||||
const eid = Number(it?.exercise_id)
|
||||
if (!Number.isFinite(eid) || eid < 1 || seenPlan.has(eid)) continue
|
||||
seenPlan.add(eid)
|
||||
plannedExerciseIds.push(eid)
|
||||
}
|
||||
}
|
||||
return {
|
||||
unitId: Number(editingUnit.id),
|
||||
sectionOrderIndex: sIdx,
|
||||
anchorExerciseId: Number.isFinite(anchorExerciseId) && anchorExerciseId > 0 ? anchorExerciseId : null,
|
||||
progressionGraphId: null,
|
||||
plannedExerciseIds,
|
||||
}
|
||||
}, [editingUnit?.id, exercisePickerTarget, formData.sections])
|
||||
|
||||
|
||||
Reference in new issue
Block a user