Enhance import preview functionality with editable fields and overlay logic for payload updates
This commit is contained in:
@@ -950,6 +950,20 @@ def import_llm_confirm(request):
|
||||
except Exception:
|
||||
errors.append({"index": idx, "errors": ["Missing candidate"]})
|
||||
continue
|
||||
# Overlay any edited fields posted from the preview form (names like payload_<idx>_stem)
|
||||
overlay = {}
|
||||
prefix = f"payload_{idx}_"
|
||||
for k, v in request.POST.items():
|
||||
if k.startswith(prefix):
|
||||
field = k[len(prefix):]
|
||||
overlay[field] = v
|
||||
if overlay:
|
||||
# apply overlay onto a shallow copy
|
||||
new_payload = dict(payload)
|
||||
for fk, fv in overlay.items():
|
||||
# convert list-like fields and numeric conversions are not performed here; keep simple strings/lists
|
||||
new_payload[fk] = fv
|
||||
payload = new_payload
|
||||
# Strip numeric bracket references here as well, before confirm import
|
||||
payload, stripped = _strip_numeric_refs_in_payload(payload)
|
||||
if stripped:
|
||||
|
||||
Reference in New Issue
Block a user