Refactor Catalog Prompt Slot Management and Enhance Fallback Logic
Deploy Development / deploy (push) Successful in 40s
Test Suite / pytest-backend (push) Failing after 2s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m22s

- Introduced a new function `_resolve_entry_slot_values` to streamline the merging of stored slot values with fallbacks, improving code clarity and maintainability.
- Updated `get_catalog_entry_slots` and `resolve_catalog_prompt_variables` functions to utilize the new fallback logic, enhancing the handling of catalog entries.
- Enhanced the `CatalogPromptSlotsEditor` component to display fallback information for slots, improving user experience in managing catalog prompts.
- Incremented version numbers and updated changelog to reflect the new features and improvements.
This commit is contained in:
Lars committed 2026-06-15 15:18:00 +02:00
1 parent 53f2b027cc
commit 7e5ef4561a
7 files changed
+546 -23

No files matched your search

@@ -18,6 +18,7 @@ export default function CatalogPromptSlotsEditor({ catalogKind, catalogId, entry
const [saving, setSaving] = useState(false)
const [error, setError] = useState('')
const [loaded, setLoaded] = useState(false)
const [storedSlots, setStoredSlots] = useState({})
const applicableTypes = useMemo(() => {
const kind = (catalogKind || '').trim()
@@ -38,6 +39,9 @@ export default function CatalogPromptSlotsEditor({ catalogKind, catalogId, entry
])
setSlotTypes(Array.isArray(typesRes?.slot_types) ? typesRes.slot_types : [])
setSlots(slotsRes?.slots && typeof slotsRes.slots === 'object' ? { ...slotsRes.slots } : {})
setStoredSlots(
slotsRes?.stored_slots && typeof slotsRes.stored_slots === 'object' ? { ...slotsRes.stored_slots } : {}
)
setLoaded(true)
} catch (e) {
setError(e.message || String(e))
@@ -109,10 +113,17 @@ export default function CatalogPromptSlotsEditor({ catalogKind, catalogId, entry
const key = st.slot_key
const ph = `{{${catalogKind}_${key}}}`
const isCodeOnly = st.for_code && !st.for_llm
const fromFallback =
!(storedSlots[key] || '').trim() && (slots[key] || '').trim() && key !== 'description'
return (
<div key={key} className="form-row">
<label className="form-label">
{st.display_name || key}
{fromFallback ? (
<span style={{ marginLeft: '6px', fontSize: '12px', color: 'var(--accent)' }}>
(Standard-Vorlage)
</span>
) : null}
{isCodeOnly ? (
<span style={{ marginLeft: '6px', fontSize: '12px', color: 'var(--text3)' }}>
(primär Code)