Enhance Gap Fill Offer with Context Preview and Update Version
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 1s
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 43s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 1s
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 `context_preview` to the `build_gap_fill_offer` function, providing a structured overview of the roadmap snapshot. - Introduced `gapOfferContextDisplayLines` utility to format context information for UI display, improving clarity for users. - Updated `ExerciseProgressionPathBuilder` and related components to utilize the new context preview, enhancing the user experience. - Incremented application version to 0.8.213 to reflect these changes.
This commit is contained in:
1 parent
f2650dac57
commit
d4b1780193
6 files changed
+136
-12
No files matched your search
@@ -21,6 +21,7 @@ export default function ExerciseAiSuggestPreviewModal({
|
||||
applyLabel = 'Übung anlegen',
|
||||
applyDisabled = false,
|
||||
zIndex = 2000,
|
||||
planningContextLines = [],
|
||||
}) {
|
||||
useEffect(() => {
|
||||
if (!draft) return undefined
|
||||
@@ -86,6 +87,31 @@ export default function ExerciseAiSuggestPreviewModal({
|
||||
<h3 style={{ marginTop: 0, fontSize: '1.1rem', marginBottom: '6px' }}>{dialogTitle}</h3>
|
||||
<p style={{ fontSize: '13px', color: 'var(--text3)', marginTop: 0, marginBottom: '16px' }}>{hint}</p>
|
||||
|
||||
{Array.isArray(planningContextLines) && planningContextLines.length > 0 ? (
|
||||
<div
|
||||
style={{
|
||||
marginBottom: '16px',
|
||||
padding: '10px 12px',
|
||||
borderRadius: '8px',
|
||||
border: '1px solid color-mix(in srgb, var(--accent) 35%, var(--border))',
|
||||
background: 'color-mix(in srgb, var(--accent) 6%, var(--surface))',
|
||||
fontSize: '12px',
|
||||
}}
|
||||
>
|
||||
<strong style={{ display: 'block', marginBottom: '6px', fontSize: '13px' }}>
|
||||
Planungskontext (an KI übergeben)
|
||||
</strong>
|
||||
<dl style={{ margin: 0, display: 'grid', gap: '6px' }}>
|
||||
{planningContextLines.map(({ label, value }) => (
|
||||
<div key={label}>
|
||||
<dt style={{ margin: 0, fontSize: '11px', color: 'var(--text3)' }}>{label}</dt>
|
||||
<dd style={{ margin: '2px 0 0', lineHeight: 1.45, color: 'var(--text2)' }}>{value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div style={{ display: 'grid', gap: '12px', marginBottom: '18px' }}>
|
||||
<div>
|
||||
<label className="form-label" htmlFor="ai-draft-title">
|
||||
|
||||
@@ -10,7 +10,10 @@ import {
|
||||
buildQuickCreateAiPreview,
|
||||
buildQuickCreateExercisePayloadFromDraft,
|
||||
} from '../utils/exerciseAiQuickCreate'
|
||||
import { buildPathGapPlanningContextForAi } from '../utils/planningContextForExerciseAi'
|
||||
import {
|
||||
buildPathGapPlanningContextForAi,
|
||||
gapOfferContextDisplayLines,
|
||||
} from '../utils/planningContextForExerciseAi'
|
||||
|
||||
function applyResolvedStructuredFromRoadmap(progressionRoadmap, setters) {
|
||||
const rs = progressionRoadmap?.resolved_structured
|
||||
@@ -20,6 +23,37 @@ function applyResolvedStructuredFromRoadmap(progressionRoadmap, setters) {
|
||||
if (rs.roadmap_notes) setters.setRoadmapNotes(String(rs.roadmap_notes))
|
||||
}
|
||||
|
||||
function GapOfferContextPreview({ lines }) {
|
||||
if (!Array.isArray(lines) || lines.length === 0) return null
|
||||
return (
|
||||
<details
|
||||
style={{
|
||||
marginTop: '8px',
|
||||
fontSize: '12px',
|
||||
color: 'var(--text2)',
|
||||
borderTop: '1px dashed var(--border)',
|
||||
paddingTop: '8px',
|
||||
}}
|
||||
>
|
||||
<summary style={{ cursor: 'pointer', color: 'var(--accent-dark)', fontWeight: 600 }}>
|
||||
KI-Kontext für diese Übung ({lines.length} Punkte)
|
||||
</summary>
|
||||
<dl style={{ margin: '8px 0 0', display: 'grid', gap: '6px' }}>
|
||||
{lines.map(({ label, value }) => (
|
||||
<div key={label}>
|
||||
<dt style={{ margin: 0, fontSize: '11px', color: 'var(--text3)' }}>{label}</dt>
|
||||
<dd style={{ margin: '2px 0 0', lineHeight: 1.45 }}>{value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
<p style={{ margin: '8px 0 0', fontSize: '11px', color: 'var(--text3)', lineHeight: 1.4 }}>
|
||||
Dieser Kontext wird an die Übungs-KI übergeben (Ziel, Fähigkeiten, Anleitung) — nicht nur das
|
||||
Stufen-Lernziel oben.
|
||||
</p>
|
||||
</details>
|
||||
)
|
||||
}
|
||||
|
||||
function sourceLabel(source) {
|
||||
const map = {
|
||||
user: 'manuell',
|
||||
@@ -217,6 +251,7 @@ export default function ExerciseProgressionPathBuilder({
|
||||
const [quickCreateDraft, setQuickCreateDraft] = useState(null)
|
||||
const [quickSaving, setQuickSaving] = useState(false)
|
||||
const [quickAiError, setQuickAiError] = useState('')
|
||||
const [activePlanningContextLines, setActivePlanningContextLines] = useState([])
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
@@ -363,6 +398,18 @@ export default function ExerciseProgressionPathBuilder({
|
||||
await runGapFillAiSuggest(offer)
|
||||
}
|
||||
|
||||
const gapContextFallbackParams = {
|
||||
goalQuery,
|
||||
semanticBrief,
|
||||
graphId,
|
||||
pathSteps,
|
||||
editableMajorSteps,
|
||||
progressionRoadmap,
|
||||
startSituation,
|
||||
targetState,
|
||||
roadmapNotes,
|
||||
}
|
||||
|
||||
const runGapFillAiSuggest = async (offer) => {
|
||||
const title = (offer?.title_hint || '').trim()
|
||||
if (title.length < 3) {
|
||||
@@ -391,17 +438,11 @@ export default function ExerciseProgressionPathBuilder({
|
||||
setQuickCreateDraft(null)
|
||||
setQuickSaving(true)
|
||||
setGeneratingOfferId(offer?.offer_id || null)
|
||||
const contextLines = gapOfferContextDisplayLines(offer, gapContextFallbackParams)
|
||||
setActivePlanningContextLines(contextLines)
|
||||
const planningContext = buildPathGapPlanningContextForAi({
|
||||
goalQuery,
|
||||
semanticBrief,
|
||||
offer,
|
||||
graphId,
|
||||
pathSteps,
|
||||
editableMajorSteps,
|
||||
progressionRoadmap,
|
||||
startSituation,
|
||||
targetState,
|
||||
roadmapNotes,
|
||||
...gapContextFallbackParams,
|
||||
})
|
||||
try {
|
||||
const aiRes = await api.suggestExerciseAi({
|
||||
@@ -1193,6 +1234,9 @@ export default function ExerciseProgressionPathBuilder({
|
||||
{offer.replace_step_index != null ? ' (ersetzt themenfremden Schritt)' : ''}
|
||||
</p>
|
||||
) : null}
|
||||
<GapOfferContextPreview
|
||||
lines={gapOfferContextDisplayLines(offer, gapContextFallbackParams)}
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
@@ -1384,8 +1428,10 @@ export default function ExerciseProgressionPathBuilder({
|
||||
onDraftChange={setQuickCreateDraft}
|
||||
onDiscard={() => {
|
||||
setQuickCreateDraft(null)
|
||||
setActivePlanningContextLines([])
|
||||
if (activeOffer) setQuickCreateOpen(true)
|
||||
}}
|
||||
planningContextLines={activePlanningContextLines}
|
||||
onApply={applyQuickCreateDraft}
|
||||
focusAreas={focusAreas}
|
||||
skillsCatalog={skillsCatalog}
|
||||
|
||||
Reference in new issue
Block a user