Implement a feature that corrects the scenarios generated by the GPT according to the rules in environment variables.
Design
A Correct Rule includes two fields: Match Rule and Action.
match_rule is a three elements tuple like ('*', '--image', 'UbuntuLTS').
action is a class __init__ call like ReplaceArg('~', 'Ubuntu2204').
The system will compare the Match Rule and every parameter key and value. If matched, an Action will be taken to modify the command.
Currently we have 3 different Actions: ReplaceSig, ReplaceArg and AddArg.
* in MatchRule means matching everything.
~ in ReplaceAction means no change on current field.
To use this feature, you can add the following field in local settings.
"CORRECT_RULE_SET": "[{\"match_rule\": \"('*', '--image', 'UbuntuLTS')\", \"action\": \"ReplaceArg('~', 'Ubuntu2204')\"}]"
Description
Implement a feature that corrects the scenarios generated by the GPT according to the rules in environment variables.
Design
A Correct Rule includes two fields: Match Rule and Action.
match_rule
is a three elements tuple like('*', '--image', 'UbuntuLTS')
.action
is a class__init__
call likeReplaceArg('~', 'Ubuntu2204')
. The system will compare the Match Rule and every parameter key and value. If matched, an Action will be taken to modify the command.Currently we have 3 different
Actions
:ReplaceSig
,ReplaceArg
andAddArg
.*
inMatchRule
means matching everything.~
inReplaceAction
means no change on current field.To use this feature, you can add the following field in local settings.
"CORRECT_RULE_SET": "[{\"match_rule\": \"('*', '--image', 'UbuntuLTS')\", \"action\": \"ReplaceArg('~', 'Ubuntu2204')\"}]"