Skip to content

Commit

Permalink
Only require Open AI's API key when querying Open AI.
Browse files Browse the repository at this point in the history
  • Loading branch information
kechigon committed Jul 29, 2024
1 parent 9fa6127 commit b449f46
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func main() {
)
flag.Parse()

if *repo == "" || *owner == "" || *issueNumber == 0 || *gh_token == "" || *oai_key == "" || *command == "" || *configFile == "" {
if *repo == "" || *owner == "" || *issueNumber == 0 || *gh_token == "" || *command == "" || *configFile == "" {
flag.PrintDefaults()
os.Exit(1)
}
Expand Down Expand Up @@ -106,6 +106,11 @@ func main() {
// Get response from OpenAI or VertexAI
var aic ai.Ai
if cfg.Ai.Provider == "openai" {
if *oai_key == "" {
logger.Println("Error: Please provide your Open AI API key.")
flag.PrintDefaults()
os.Exit(1)
}
aic = ai.NewOpenAIClient(*oai_key, cfg.Ai.OpenAI.Model)
logger.Println("Using OpenAI API")
logger.Println("OpenAI model:", cfg.Ai.OpenAI.Model)
Expand Down

0 comments on commit b449f46

Please sign in to comment.