From 724b6effc59c658d099f300e2896d4463814fe70 Mon Sep 17 00:00:00 2001 From: sixlive Date: Wed, 13 Mar 2024 11:35:20 -0400 Subject: [PATCH] Rename CHAT_GPT_API_KEY to OPENAI_API_KEY This is really pretty standard across most OpenAI apps. Since this is common its nice to only have set it once and use it for multiple apps. --- README.md | 4 ++-- main.go | 6 +++--- sessions/message-stream.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 68d4430..69ca9ef 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ My first ever terminal UI! Everything is stored locally on sqlite and written in ## Installation -Please make sure that you expose a `CHAT_GPT_API_KEY` inside of your environment; we require it to make api calls! +Please make sure that you expose a `OPENAI_API_KEY` inside of your environment; we require it to make api calls! Set up your [api key](https://platform.openai.com/api-keys) ```bash -export CHAT_GPT_API_KEY="some-key" # you would want to export this in your .zshrc +export OPENAI_API_KEY="some-key" # you would want to export this in your .zshrc brew tap tearingitup786/tearingitup786 brew install chatgpt-tui chatgpt-tui diff --git a/main.go b/main.go index c3e77ae..43a6d71 100644 --- a/main.go +++ b/main.go @@ -379,10 +379,10 @@ func main() { } defer f.Close() - apiKey := os.Getenv("CHAT_GPT_API_KEY") + apiKey := os.Getenv("OPENAI_API_KEY") if "" == apiKey { - fmt.Println("CHAT_GPT_API_KEY not set; set it in your profile") - fmt.Printf("export CHAT_GPT_API_KEY=your_key in the config for :%v \n", os.Getenv("SHELL")) + fmt.Println("OPENAI_API_KEY not set; set it in your profile") + fmt.Printf("export OPENAI_API_KEY=your_key in the config for :%v \n", os.Getenv("SHELL")) fmt.Println("Exiting...") os.Exit(1) } diff --git a/sessions/message-stream.go b/sessions/message-stream.go index 802466f..4fdc14f 100644 --- a/sessions/message-stream.go +++ b/sessions/message-stream.go @@ -84,7 +84,7 @@ func (m Model) constructJsonBody() ([]byte, error) { } func (m *Model) CallChatGpt(resultChan chan ProcessResult) tea.Cmd { - apiKey := os.Getenv("CHAT_GPT_API_KEY") + apiKey := os.Getenv("OPENAI_API_KEY") processResultID := 0 // Initialize a counter for ProcessResult IDs return func() tea.Msg {