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:
- Enable
editMode and inlineMode in the prompt (already done).
- Pass the previous lang content as
existing_lang to the LLM when available.
- Call
mergeStatements after receiving the patch, then perform rendering.
Please let me know if any additional logic is required. Thank you!
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: trueandinlineMode: trueis 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.tswith around 20 lines of code, which simply callsmergeStatementsinternally.We need to pass
existing_langto the orchestrator. Since the/api/vis/renderendpoint (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,editModewill not work for patching.The minimal integration consists of three key points:
editModeandinlineModein the prompt (already done).existing_langto the LLM when available.mergeStatementsafter receiving the patch, then perform rendering.Please let me know if any additional logic is required. Thank you!