Skip to content

Question about incremental editing configuration & merge logic for OpenUI Lang #619

@yyt520

Description

@yyt520

I'm referring to the incremental editing section in the documentation: https://www.openui.com/docs/openui-lang/incremental-editing.

Could you please clarify if enabling editMode: true and inlineMode: true is sufficient to use incremental editing? Or do I still need to implement custom merge logic? Cursor generated a large amount of extra code for me, so I'd like to confirm the actual requirements.

Here is the related implementation guidance I got from Cursor:
Create a file named mergeOpenUiPatch.ts with around 20 lines of code, which simply calls mergeStatements internally.

We need to pass existing_lang to the orchestrator. Since the /api/vis/render endpoint (Approach 2) is stateless and runs in a single round, the LLM cannot access previous code. We have to inject the existing code into the user message; otherwise, editMode will not work for patching.

The minimal integration consists of three key points:

  1. Enable editMode and inlineMode in the prompt (already done).
  2. Pass the previous lang content as existing_lang to the LLM when available.
  3. Call mergeStatements after receiving the patch, then perform rendering.

Please let me know if any additional logic is required. Thank you!

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions