From 37774d3abe7adda25ebdc4cc7a371fa5b7503575 Mon Sep 17 00:00:00 2001 From: Postcount CI Date: Wed, 15 Mar 2023 16:29:06 +0700 Subject: [PATCH] fix: Add commit message functionality to user input and simplify the conditional statement in the code. --- main.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index 214ed42..26beabc 100644 --- a/main.go +++ b/main.go @@ -77,6 +77,10 @@ func main() { printNormal("Assistant: I don't know what to say about this diff, please give me a hint") } else { printNormal("Assistant: " + commitMessage) + messages = append(messages, &Message{ + Role: "assistant", + Content: commitMessage, + }) } // Loop until the user response @@ -110,15 +114,10 @@ func main() { break } - if commitMessage != "" { - messages = append(messages, &Message{ - Role: "assistant", - Content: commitMessage, - }) - } else { - // replace the last message - messages[len(messages)-1].Content = userRequest - } + messages = append(messages, &Message{ + Role: "user", + Content: userRequest, + }) } prefix := askForPrefix()