hackathon-cli-recommendation / cli-recommendation

4 stars 5 forks source link

Support Scenario Correct to fix out-of-date issues manully #53

Closed ReaNAiveD closed 1 year ago

ReaNAiveD commented 1 year ago

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 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')\"}]"

zhoxing-ms commented 1 year ago

@ReaNAiveD In order to merge and release this PR as soon as possible, could we make it based on the master branch?