You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In many prompts the context is JSON data. By using single curly brackets notation for template parameters means that I need to escape all the { and } in the input JSON data.
I propose to introduce a flow setting to switch from single curly brackets to double curly brackets notation. By setting the property on the flow would guarantee backward compatibility with the current notation and would apply to all nodes (text, prompts) etc in the flow. Alternatively, the option could be enabled on each node separately (more flexible but could be source of errors) or as a global setting (simpler, but might generate errors or unexpected results if a flow with the other notation is loaded and executed).
The double curly brackets notation is used by the widely adopted Mustache
The text was updated successfully, but these errors were encountered:
@ianarawjo I have a working implementation for the double curly bracket notation, but would like to have your input on the best way to enable this feature.
Sounds worthwhile. Indeed I have thought of letting users selectively turn it off in TextFields Nodes. However, this is a system-wide issue and best handled as a global setting (in global settings modal) that persists across user sessions and is also stored on a flow-specific basis.
The simplest way to implement that is to add a settings tab called "Flow Settings" (settings specific to just this flow) that let the user customize global properties. It would contain one setting for template format, as a drop-down (NativeSelect). If the user imports a flow, it will try to auto-detect the correct setting and change it. If the user clicks New Flow, it will look at the current setting and carry that over.
In the backend, this change would affect how templates are parsed, which is quite low-level code. I implemented these functions for brace parsing in (template.ts) as a linear O(n) parse because RegEx was hard to read and lookaheads/behinds weren't supported everywhere. In particular, you may also need to modify cleanEscapedBraces and esp escapeBraces, since you won't want ti to escape all braces anymore but rather only double-braces. The easiest way is to set a global variable in StorageCache and read the setting from it in functions outside of React components.
In many prompts the context is JSON data. By using single curly brackets notation for template parameters means that I need to escape all the
{
and}
in the input JSON data.I propose to introduce a flow setting to switch from single curly brackets to double curly brackets notation. By setting the property on the flow would guarantee backward compatibility with the current notation and would apply to all nodes (text, prompts) etc in the flow. Alternatively, the option could be enabled on each node separately (more flexible but could be source of errors) or as a global setting (simpler, but might generate errors or unexpected results if a flow with the other notation is loaded and executed).
The double curly brackets notation is used by the widely adopted Mustache
The text was updated successfully, but these errors were encountered: