File tree 1 file changed +22
-1
lines changed
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 23
23
24
24
from chatdev .chat_chain import ChatChain
25
25
26
-
27
26
def get_config (company ):
28
27
"""
29
28
return configuration json files for ChatChain
@@ -132,6 +131,28 @@ def get_config(company):
132
131
# Parse the arguments
133
132
args = parser .parse_args ()
134
133
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 )
135
156
136
157
# Start ChatDev
137
158
You can’t perform that action at this time.
0 commit comments