Enhance Progression Path Features with LLM Start/Target Extraction
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 43s
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 1m14s
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 43s
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 1m14s
- Added `include_llm_start_target` option to `ProgressionPathSuggestRequest` for improved roadmap suggestions. - Introduced new classes `StartTargetExtractArtifact` and `StartTargetResolveMeta` to handle LLM extraction results and metadata. - Implemented `try_llm_start_target_extract` function to extract start and target states from goal queries using LLM. - Updated `resolve_roadmap_structured_input` to prioritize user inputs, LLM extractions, and regex parsing for start/target resolution. - Enhanced `ExerciseProgressionPathBuilder` to utilize new structured inputs and display extraction sources. - Incremented application version to 0.8.211 to reflect these changes.
This commit is contained in:
1 parent
9dd44ce3ca
commit
fad1058d54
7 files changed
+343
-36
No files matched your search
@@ -12,18 +12,24 @@ import {
|
||||
} from '../utils/exerciseAiQuickCreate'
|
||||
import { buildPathGapPlanningContextForAi } from '../utils/planningContextForExerciseAi'
|
||||
|
||||
/** „von … bis …“ aus Freitext (z. B. Kumite Beinarbeit von X bis Y). */
|
||||
function parseStartTargetFromGoalQuery(q) {
|
||||
const text = String(q || '').trim()
|
||||
if (!text) return { start: '', target: '' }
|
||||
const m = text.match(
|
||||
/\bvon\s+((?:(?:der|die|dem|das|einer?|einem)\s+)?.+?)\s+bis\s+(?:zur?|zum|zu der|zu einem)?\s*(.+)$/is,
|
||||
)
|
||||
if (!m) return { start: '', target: '' }
|
||||
const start = m[1].trim().replace(/[.,;]+$/, '')
|
||||
const target = m[2].trim().replace(/[.,;]+$/, '')
|
||||
if (start.length < 4 || target.length < 4) return { start: '', target: '' }
|
||||
return { start, target }
|
||||
function applyResolvedStructuredFromRoadmap(progressionRoadmap, setters) {
|
||||
const rs = progressionRoadmap?.resolved_structured
|
||||
if (!rs) return
|
||||
if (rs.start_situation) setters.setStartSituation(String(rs.start_situation))
|
||||
if (rs.target_state) setters.setTargetState(String(rs.target_state))
|
||||
if (rs.roadmap_notes) setters.setRoadmapNotes(String(rs.roadmap_notes))
|
||||
}
|
||||
|
||||
function sourceLabel(source) {
|
||||
const map = {
|
||||
user: 'manuell',
|
||||
llm: 'KI-Extraktion',
|
||||
regex: 'Muster (von … bis …)',
|
||||
merged: 'manuell + KI',
|
||||
heuristic: 'heuristisch',
|
||||
none: '—',
|
||||
}
|
||||
return map[source] || source || '—'
|
||||
}
|
||||
|
||||
function roadmapStructuredPayload(startSituation, targetState, roadmapNotes) {
|
||||
@@ -535,19 +541,6 @@ export default function ExerciseProgressionPathBuilder({
|
||||
alert('Zuerst einen Graphen wählen.')
|
||||
return
|
||||
}
|
||||
let start = startSituation.trim()
|
||||
let target = targetState.trim()
|
||||
if (!start || !target) {
|
||||
const parsed = parseStartTargetFromGoalQuery(q)
|
||||
if (parsed.start && !start) {
|
||||
start = parsed.start
|
||||
setStartSituation(parsed.start)
|
||||
}
|
||||
if (parsed.target && !target) {
|
||||
target = parsed.target
|
||||
setTargetState(parsed.target)
|
||||
}
|
||||
}
|
||||
setLoadingRoadmap(true)
|
||||
setError('')
|
||||
try {
|
||||
@@ -561,9 +554,10 @@ export default function ExerciseProgressionPathBuilder({
|
||||
include_ai_gap_fill: false,
|
||||
include_roadmap_preview: true,
|
||||
include_llm_roadmap: true,
|
||||
include_llm_start_target: true,
|
||||
roadmap_only: true,
|
||||
progression_graph_id: Number(graphId),
|
||||
...roadmapStructuredPayload(start, target, roadmapNotes),
|
||||
...roadmapStructuredPayload(startSituation, targetState, roadmapNotes),
|
||||
})
|
||||
const majors = mapMajorStepsFromApi(res?.progression_roadmap)
|
||||
if (majors.length < 2) {
|
||||
@@ -571,7 +565,13 @@ export default function ExerciseProgressionPathBuilder({
|
||||
}
|
||||
setEditableMajorSteps(majors)
|
||||
setMaxSteps(majors.length)
|
||||
setProgressionRoadmap(res?.progression_roadmap || null)
|
||||
const roadmap = res?.progression_roadmap || null
|
||||
setProgressionRoadmap(roadmap)
|
||||
applyResolvedStructuredFromRoadmap(roadmap, {
|
||||
setStartSituation,
|
||||
setTargetState,
|
||||
setRoadmapNotes,
|
||||
})
|
||||
setSemanticBrief(res?.semantic_brief_summary || null)
|
||||
setPathSteps([])
|
||||
setTargetSummary(null)
|
||||
@@ -767,7 +767,8 @@ export default function ExerciseProgressionPathBuilder({
|
||||
</div>
|
||||
</div>
|
||||
<p style={{ fontSize: '11px', color: 'var(--text3)', margin: '6px 0 0', lineHeight: 1.4 }}>
|
||||
Bei „von … bis …“ im Ziel werden Start und Ziel automatisch vorausgefüllt, wenn die Felder leer sind.
|
||||
Leer gelassen: Start/Ziel werden per KI aus dem Zieltext verstanden und formuliert (Fallback: Muster
|
||||
„von … bis …“). Manuelle Eingaben haben Vorrang.
|
||||
</p>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '10px', alignItems: 'flex-end', marginTop: '10px' }}>
|
||||
<button
|
||||
@@ -819,6 +820,11 @@ export default function ExerciseProgressionPathBuilder({
|
||||
>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '8px', alignItems: 'center', marginBottom: '8px' }}>
|
||||
<strong style={{ fontSize: '13px' }}>Zielanalyse</strong>
|
||||
{progressionRoadmap.llm_start_target_applied ? (
|
||||
<span className="exercise-tag" style={{ borderColor: 'var(--accent)' }}>
|
||||
KI Start/Ziel
|
||||
</span>
|
||||
) : null}
|
||||
{progressionRoadmap.llm_goal_analysis_applied ? (
|
||||
<span className="exercise-tag" style={{ borderColor: 'var(--accent)' }}>
|
||||
KI-Zielanalyse
|
||||
@@ -826,6 +832,12 @@ export default function ExerciseProgressionPathBuilder({
|
||||
) : (
|
||||
<span className="exercise-tag">heuristisch</span>
|
||||
)}
|
||||
{progressionRoadmap.start_target_sources ? (
|
||||
<span className="exercise-tag" style={{ fontSize: '11px' }}>
|
||||
Start: {sourceLabel(progressionRoadmap.start_target_sources.start)} · Ziel:{' '}
|
||||
{sourceLabel(progressionRoadmap.start_target_sources.target)}
|
||||
</span>
|
||||
) : null}
|
||||
{progressionRoadmap.goal_analysis.primary_topic ? (
|
||||
<span className="exercise-tag">Thema: {progressionRoadmap.goal_analysis.primary_topic}</span>
|
||||
) : null}
|
||||
@@ -847,6 +859,11 @@ export default function ExerciseProgressionPathBuilder({
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
{progressionRoadmap.start_target_extract?.extraction_notes ? (
|
||||
<p style={{ margin: '8px 0 0', fontSize: '11px', color: 'var(--text3)' }}>
|
||||
{progressionRoadmap.start_target_extract.extraction_notes}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
Reference in new issue
Block a user