Enhance Progression Path Suggestion with Planning Catalog Context Integration
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m16s
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m16s
- Introduced `planning_catalog_context` to `ProgressionPathSuggestRequest` for improved handling of catalog-related data during path suggestions. - Implemented `_resolve_planning_catalog_context` to retrieve and validate the planning catalog context, enhancing the robustness of the suggestion process. - Updated `_build_path_target_profile` to incorporate catalog context, enriching target profiles with relevant planning data. - Enhanced frontend components in `ProgressionGraphEditor` to manage and display planning catalog context, including new selection options for focus areas, style directions, training types, and target groups. - Added utility functions for parsing and transforming planning catalog context data for API interactions. - Bumped version to 0.8.233 to reflect the new features and improvements.
This commit is contained in:
1 parent
a4e73c830f
commit
6ab2f20f08
8 files changed
+441
-8
No files matched your search
@@ -45,6 +45,10 @@ import {
|
||||
slotsToSlotAssignments,
|
||||
syncProgressionRoadmapFromSlots,
|
||||
syncSlotPhasesFromRoadmap,
|
||||
EMPTY_PLANNING_CATALOG_CONTEXT,
|
||||
getCatalogSelectId,
|
||||
planningCatalogContextToApi,
|
||||
setCatalogSelectItems,
|
||||
} from '../utils/progressionGraphDraft'
|
||||
|
||||
function roadmapStructuredPayload(startSituation, targetState, roadmapNotes) {
|
||||
@@ -86,6 +90,9 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
const [semanticBrief, setSemanticBrief] = useState(null)
|
||||
const [targetSummary, setTargetSummary] = useState(null)
|
||||
const [focusAreas, setFocusAreas] = useState([])
|
||||
const [styleDirections, setStyleDirections] = useState([])
|
||||
const [trainingTypes, setTrainingTypes] = useState([])
|
||||
const [targetGroups, setTargetGroups] = useState([])
|
||||
const [skillsCatalog, setSkillsCatalog] = useState([])
|
||||
|
||||
const [activeOffer, setActiveOffer] = useState(null)
|
||||
@@ -144,16 +151,25 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
let cancelled = false
|
||||
Promise.all([
|
||||
api.listFocusAreas({ status: 'active' }),
|
||||
api.listStyleDirections({ status: 'active' }),
|
||||
api.listTrainingTypes({ status: 'active' }),
|
||||
api.listTargetGroups({ status: 'active' }),
|
||||
api.listSkillsCatalog({ status: 'active' }),
|
||||
])
|
||||
.then(([fa, sk]) => {
|
||||
.then(([fa, sd, tt, tg, sk]) => {
|
||||
if (cancelled) return
|
||||
setFocusAreas(Array.isArray(fa) ? fa : [])
|
||||
setStyleDirections(Array.isArray(sd) ? sd : [])
|
||||
setTrainingTypes(Array.isArray(tt) ? tt : [])
|
||||
setTargetGroups(Array.isArray(tg) ? tg : [])
|
||||
setSkillsCatalog(Array.isArray(sk) ? sk : [])
|
||||
})
|
||||
.catch(() => {
|
||||
if (!cancelled) {
|
||||
setFocusAreas([])
|
||||
setStyleDirections([])
|
||||
setTrainingTypes([])
|
||||
setTargetGroups([])
|
||||
setSkillsCatalog([])
|
||||
}
|
||||
})
|
||||
@@ -280,6 +296,24 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
return draft.slots.filter((s) => (s.learning_goal || '').trim().length >= 3)
|
||||
}, [draft?.slots])
|
||||
|
||||
const catalogCtx = draft?.planningCatalogContext || EMPTY_PLANNING_CATALOG_CONTEXT
|
||||
|
||||
const patchCatalogDimension = (key, value) => {
|
||||
patchDraft((d) => ({
|
||||
...d,
|
||||
dirty: true,
|
||||
planningCatalogContext: {
|
||||
...(d.planningCatalogContext || EMPTY_PLANNING_CATALOG_CONTEXT),
|
||||
[key]: setCatalogSelectItems(d.planningCatalogContext?.[key], value),
|
||||
},
|
||||
}))
|
||||
}
|
||||
|
||||
const catalogApiPayload = useMemo(
|
||||
() => planningCatalogContextToApi(catalogCtx),
|
||||
[catalogCtx],
|
||||
)
|
||||
|
||||
const runAnalyzeStartTarget = async () => {
|
||||
const q = (draft?.goalQuery || '').trim()
|
||||
if (q.length < 3) {
|
||||
@@ -303,6 +337,7 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
start_target_only: true,
|
||||
progression_graph_id: Number(graphId),
|
||||
...roadmapStructuredPayload(draft.startSituation, draft.targetState, draft.roadmapNotes),
|
||||
...catalogApiPayload,
|
||||
})
|
||||
const roadmap = res?.progression_roadmap
|
||||
if (!roadmap) throw new Error('Keine Start/Ziel-Analyse in der Antwort')
|
||||
@@ -346,6 +381,7 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
roadmap_only: true,
|
||||
progression_graph_id: Number(graphId),
|
||||
...roadmapStructuredPayload(draft.startSituation, draft.targetState, draft.roadmapNotes),
|
||||
...catalogApiPayload,
|
||||
})
|
||||
const roadmap = res?.progression_roadmap
|
||||
if (!roadmap) throw new Error('Keine Roadmap in der Antwort')
|
||||
@@ -420,6 +456,7 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
retrieval_boost_exercise_ids: draftRetrievalBoostExerciseIds(synced),
|
||||
progression_graph_id: Number(graphId),
|
||||
...roadmapStructuredPayload(draft.startSituation, draft.targetState, draft.roadmapNotes),
|
||||
...catalogApiPayload,
|
||||
})
|
||||
const { draft: matched, remainingOffers } = applyMatchResponseToDraft(
|
||||
{
|
||||
@@ -493,6 +530,7 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
roadmap_override: override,
|
||||
progression_graph_id: Number(graphId),
|
||||
...roadmapStructuredPayload(draft.startSituation, draft.targetState, draft.roadmapNotes),
|
||||
...catalogApiPayload,
|
||||
})
|
||||
setSemanticBrief(res?.semantic_brief_summary || null)
|
||||
setPathQa(res?.path_qa || null)
|
||||
@@ -871,6 +909,83 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))',
|
||||
gap: '10px',
|
||||
marginTop: '10px',
|
||||
}}
|
||||
>
|
||||
<div className="form-row" style={{ marginBottom: 0 }}>
|
||||
<label className="form-label">Primärfokus</label>
|
||||
<select
|
||||
className="form-input"
|
||||
disabled={busy}
|
||||
value={getCatalogSelectId(catalogCtx.focusAreas)}
|
||||
onChange={(e) => patchCatalogDimension('focusAreas', e.target.value)}
|
||||
>
|
||||
<option value="">— optional —</option>
|
||||
{(focusAreas || []).map((fa) => (
|
||||
<option key={fa.id} value={String(fa.id)}>
|
||||
{fa.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="form-row" style={{ marginBottom: 0 }}>
|
||||
<label className="form-label">Stilrichtung</label>
|
||||
<select
|
||||
className="form-input"
|
||||
disabled={busy}
|
||||
value={getCatalogSelectId(catalogCtx.styleDirections)}
|
||||
onChange={(e) => patchCatalogDimension('styleDirections', e.target.value)}
|
||||
>
|
||||
<option value="">— optional —</option>
|
||||
{(styleDirections || []).map((row) => (
|
||||
<option key={row.id} value={String(row.id)}>
|
||||
{row.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="form-row" style={{ marginBottom: 0 }}>
|
||||
<label className="form-label">Trainingsstil</label>
|
||||
<select
|
||||
className="form-input"
|
||||
disabled={busy}
|
||||
value={getCatalogSelectId(catalogCtx.trainingTypes)}
|
||||
onChange={(e) => patchCatalogDimension('trainingTypes', e.target.value)}
|
||||
>
|
||||
<option value="">— optional —</option>
|
||||
{(trainingTypes || []).map((row) => (
|
||||
<option key={row.id} value={String(row.id)}>
|
||||
{row.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="form-row" style={{ marginBottom: 0 }}>
|
||||
<label className="form-label">Zielgruppe</label>
|
||||
<select
|
||||
className="form-input"
|
||||
disabled={busy}
|
||||
value={getCatalogSelectId(catalogCtx.targetGroups)}
|
||||
onChange={(e) => patchCatalogDimension('targetGroups', e.target.value)}
|
||||
>
|
||||
<option value="">— optional —</option>
|
||||
{(targetGroups || []).map((row) => (
|
||||
<option key={row.id} value={String(row.id)}>
|
||||
{row.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<p style={{ fontSize: '11px', color: 'var(--text3)', margin: '8px 0 0', lineHeight: 1.4 }}>
|
||||
Planungskontext steuert Bibliotheks-Matching (Fokusbereich, Stil, Trainingsstil, Zielgruppe) — unabhängig
|
||||
von Technik-Pfaden wie Mae Geri. Wird mit dem Graph gespeichert.
|
||||
</p>
|
||||
<p style={{ fontSize: '11px', color: 'var(--text3)', margin: '8px 0 0', lineHeight: 1.4 }}>
|
||||
Optional zuerst „Start/Ziel analysieren“, anpassen, dann Roadmap-Stufen. Sind Start und Ziel leer,
|
||||
geschieht die Analyse beim Roadmap-Vorschlag automatisch. Manuelle Eingaben haben Vorrang.
|
||||
|
||||
Reference in new issue
Block a user