mirror of
https://github.com/Direct-Dev-Ru/go-lcg.git
synced 2025-11-16 01:29:55 +00:00
release v1.0.4
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v1.0.3
|
v1.0.4
|
||||||
|
|||||||
14
main.go
14
main.go
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user