File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 2323
2424from chatdev .chat_chain import ChatChain
2525
26-
2726def get_config (company ):
2827 """
2928 return configuration json files for ChatChain
@@ -132,6 +131,28 @@ def get_config(company):
132131# Parse the arguments
133132args = parser .parse_args ()
134133
134+ # Detect if API key is set in the environment and if not, print a warning and exit
135+ if 'OPENAI_API_KEY' not in os .environ :
136+ #Color print Blue
137+ print ("\033 [94m \n " )
138+ print ("""Warning: OPENAI_API_KEY environment variable is not set.
139+ \033 [0m
140+ Please set the key before launching Startr.Team.
141+
142+ To set the API key, run the following command in your terminal:
143+
144+ export OPENAI_API_KEY="your-api-key-here"
145+
146+ To make the change permanent, add the command to your shell profile file (e.g. ~/.bashrc).
147+ Or to you loacl .env file.
148+
149+ If you don't have an API key, you can get one at https://platform.openai.com/signup
150+
151+ \033 [94m \n
152+ TODO: Alternatively use GROQ API key.
153+ \033 [0m \n
154+ """ )
155+ sys .exit (1 )
135156
136157# Start ChatDev
137158
You can’t perform that action at this time.
0 commit comments