Conditions allow switching steps ON and OFF based on user input and parameter values. Any step may declare a condition property.
To add a Condition to a Command Step, click the diamond-shaped button at the top of the Step:
And the following ones are supported:
Both X and Y may be parameters:
Multiple conditions can be set at once. For example, the SAY step below will run if English is set as the {{language}}, and the "translate" option was previously chosen as the {{option}} parameter value.
Operators must be surrounded with spaces, for example:
Incorrect: {{x}}=1 Correct: {{x}} = 1
ChatML engine computes the left and the right part of condition before performing a step. If x or y is a parameter name, it is substituted with the parameter value.
When comparing strings with = and != commands, strings are compared case-insensitively.
Let's explore how to write a custom command that utilizes jumps and conditions to check grammar of a selected text.
Prompt:
Please ignore all previous instructions.
I want you to only respond in {{language}}.
Act as a professional editor, specializing in grammar and syntax
correction. Your task is to examine the given text and fix any grammatical
or syntactical errors without altering the original style and tone. Change
as little as possible to make it correct, and ensure it's well written.
[TEXT TO CORRECT]:
{{selection}}
Corrected Text:
Since this prompt only works when text is selected on the page, it makes sense to add the condition to check if {{selection}} is not empty: {{selection}}
- label: ⛔️ STOP
value: stop
- label: ⬆️ EXPAND
value: expand
- label: ⬇️ SHORTEN
value: shorten
- label: ♻️ NEW TEXT
NOTE: There is no need to create a fourth STEP, since we did not specify a value for the button with "♻️ NEW TEXT", which means that nothing will be sent to the chat, and the command will proceed to the next step.
For this, you need to add a LABEL for the first step of the command, for example, "START".
After all actions on one selected text, a JUMP will occur to the very first GPT step of the custom command. For example, there could be scenarios like:
In the proposed scenario, remember to highlight some new text on the page before clicking the new menu button, otherwise, after the JUMP step, the previously selected text will be processed again.
All rights reserved © HARPA AI TECHNOLOGIES LLC, 2021 — 2024
Designed and engineered in Finland 🇫🇮