release v1.0.4

This commit is contained in:
2024-12-05 15:48:53 +06:00
parent 46a0d9e45a
commit ec2486ce3d
2 changed files with 10 additions and 6 deletions

View File

@@ -1 +1 @@
v1.0.3 v1.0.4

14
main.go
View File

@@ -104,7 +104,7 @@ func getCommands() []*cli.Command {
Aliases: []string{"u"}, Aliases: []string{"u"},
Usage: "Update the API key", Usage: "Update the API key",
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
gpt3 := initGPT() gpt3 := initGPT(PROMPT)
gpt3.UpdateKey() gpt3.UpdateKey()
fmt.Println("API key updated.") fmt.Println("API key updated.")
return nil return nil
@@ -115,7 +115,7 @@ func getCommands() []*cli.Command {
Aliases: []string{"d"}, Aliases: []string{"d"},
Usage: "Delete the API key", Usage: "Delete the API key",
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
gpt3 := initGPT() gpt3 := initGPT(PROMPT)
gpt3.DeleteKey() gpt3.DeleteKey()
fmt.Println("API key deleted.") fmt.Println("API key deleted.")
return nil return nil
@@ -138,8 +138,12 @@ func executeMain(file, system, commandInput string) {
os.MkdirAll(RESULT_FOLDER, 0755) os.MkdirAll(RESULT_FOLDER, 0755)
} }
gpt3 := initGPT() gpt3 := initGPT(system)
// if system != PROMPT {
// commandInput += ". " + system
// }
fmt.Println(commandInput)
response, elapsed := getCommand(gpt3, commandInput) response, elapsed := getCommand(gpt3, commandInput)
if response == "" { if response == "" {
fmt.Println("No response received.") fmt.Println("No response received.")
@@ -150,12 +154,12 @@ func executeMain(file, system, commandInput string) {
handlePostResponse(response, gpt3, system, commandInput) handlePostResponse(response, gpt3, system, commandInput)
} }
func initGPT() gpt.Gpt3 { func initGPT(system string) gpt.Gpt3 {
currentUser, _ := user.Current() currentUser, _ := user.Current()
return gpt.Gpt3{ return gpt.Gpt3{
CompletionUrl: HOST + COMPLETIONS, CompletionUrl: HOST + COMPLETIONS,
Model: MODEL, Model: MODEL,
Prompt: PROMPT, Prompt: system,
HomeDir: currentUser.HomeDir, HomeDir: currentUser.HomeDir,
ApiKeyFile: API_KEY_FILE, ApiKeyFile: API_KEY_FILE,
Temperature: 0.01, Temperature: 0.01,