@@ -45,12 +45,15 @@ func HowCmd(c *cli.Context) error {
45
45
}
46
46
log .Output (coreutils .PrintLink ("This AI-powered interface converts natural language inputs into AI-generated JFrog CLI commands.\n " +
47
47
"For more information about this interface, see https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli/cli-ai\n " +
48
- "NOTE: This is an experimental version and it supports mostly Artifactory and Xray commands.\n " ))
48
+ "Note: JFrog AI Assistant is in beta and currently supports primarily Artifactory and Xray commands.\n " ))
49
49
50
50
// Ask the user to agree to the terms and conditions. If the user does not agree, the command will not proceed.
51
51
// Ask this only once per JFrog CLI installation, unless the terms are updated.
52
- if agreed , err := handleAiTermsAgreement (); err != nil || ! agreed {
52
+ if agreed , err := handleAiTermsAgreement (); err != nil {
53
53
return err
54
+ } else if ! agreed {
55
+ // If the user does not agree to the terms, the command will not proceed.
56
+ return reportTermsDisagreement ()
54
57
}
55
58
56
59
for {
@@ -82,7 +85,7 @@ func HowCmd(c *cli.Context) error {
82
85
// If the response is a valid JFrog CLI command, ask the user for feedback.
83
86
if validResponse {
84
87
log .Output ()
85
- if err = sendFeedback (); err != nil {
88
+ if err = handleResponseFeedback (); err != nil {
86
89
return err
87
90
}
88
91
}
@@ -100,16 +103,22 @@ func askQuestion(question string) (response string, err error) {
100
103
}
101
104
102
105
type feedbackBody struct {
103
- IsGoodResponse bool `json:"is_good_response"`
106
+ IsGoodResponse bool `json:"is_good_response,omitempty"`
107
+ IsAgreedTerms bool `json:"is_agreed_terms,omitempty"`
104
108
}
105
109
106
- func sendFeedback () (err error ) {
110
+ func handleResponseFeedback () (err error ) {
107
111
isGoodResponse , err := getUserFeedback ()
108
112
if err != nil {
109
- return err
113
+ return
110
114
}
111
115
_ , err = sendRestAPI (feedback , feedbackBody {IsGoodResponse : isGoodResponse })
112
- return err
116
+ return
117
+ }
118
+
119
+ func reportTermsDisagreement () (err error ) {
120
+ _ , err = sendRestAPI (feedback , feedbackBody {IsAgreedTerms : false })
121
+ return
113
122
}
114
123
115
124
func getUserFeedback () (bool , error ) {
0 commit comments