Skip to content

Commit 39c2c7a

Browse files
committed
fix(artifacts): add a worked edit example to reduce empty update blocks
An N=70 eval (GLM-5.2) found ~11% of edits emit a bare <artifact type="update"></artifact> with no pairs. The prompt only showed the placeholder schema. Add a concrete old_str/new_str example and an explicit rule that an update block must contain at least one pair (else re-emit the full artifact with the same identifier).
1 parent 57c2fb0 commit 39c2c7a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/lib/server/textGeneration/artifacts.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ Editing an artifact you created earlier in the conversation:
3636
<new_str>replacement text</new_str>
3737
</artifact>
3838
39+
For example, to recolor a button in an existing "signup-form" artifact, emit exactly:
40+
41+
<artifact identifier="signup-form" type="update">
42+
<old_str>background: #16a34a;</old_str>
43+
<new_str>background: #2563eb;</new_str>
44+
</artifact>
45+
3946
- Each old_str must match the latest version EXACTLY (including whitespace/indentation) and must be unique within it. Copy it verbatim from the latest version; do not retype, reformat, or re-indent it.
47+
- Every update block must contain at least one complete old_str/new_str pair — never emit an empty type="update" block. If you can't produce exact old_str text, re-emit the full artifact instead (same identifier).
4048
- Emit at most ONE update block per reply, with all the pairs (up to 4) inside that single block — never one block per pair.
4149
- For larger changes, re-emit the full artifact with the SAME identifier (this creates a new version).
4250
- Keep the identifier BYTE-IDENTICAL across every version, even when the title or content changes (renaming a green button to blue keeps the same identifier). Use a new identifier only for a genuinely different artifact.

0 commit comments

Comments
 (0)