Skip to content

Commit 75c0bf2

Browse files
authored
Improve jf how AI assistant command interface UI (#2705)
1 parent 75a66e0 commit 75c0bf2

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

general/ai/cli.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,20 @@ func HowCmd(c *cli.Context) error {
7171
if err != nil {
7272
return err
7373
}
74+
validResponse := strings.HasPrefix(llmAnswer, "jf")
7475
// Print the generated command within a styled table frame.
75-
coreutils.PrintMessageInsideFrame(coreutils.PrintBoldTitle(llmAnswer), " ")
76+
if validResponse {
77+
coreutils.PrintMessageInsideFrame(coreutils.PrintBoldTitle(llmAnswer), " ")
78+
} else {
79+
log.Output(" " + coreutils.PrintYellow(llmAnswer))
80+
}
7681

77-
log.Output()
78-
if err = sendFeedback(); err != nil {
79-
return err
82+
// If the response is a valid JFrog CLI command, ask the user for feedback.
83+
if validResponse {
84+
log.Output()
85+
if err = sendFeedback(); err != nil {
86+
return err
87+
}
8088
}
8189

8290
log.Output("\n" + coreutils.PrintComment("-------------------") + "\n")

0 commit comments

Comments
 (0)