Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu commited on
Commit ·
dc61f72
1
Parent(s): 4f8449f
改进 config 写入环境变量的方式
Browse files- modules/config.py +3 -4
modules/config.py
CHANGED
|
@@ -109,10 +109,9 @@ if api_host is not None:
|
|
| 109 |
shared.state.set_api_host(api_host)
|
| 110 |
|
| 111 |
default_chuanhu_assistant_model = config.get("default_chuanhu_assistant_model", "gpt-3.5-turbo")
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
os.environ[
|
| 115 |
-
os.environ["SERPAPI_API_KEY"] = config.get("SERPAPI_API_KEY", "")
|
| 116 |
|
| 117 |
@contextmanager
|
| 118 |
def retrieve_openai_api(api_key = None):
|
|
|
|
| 109 |
shared.state.set_api_host(api_host)
|
| 110 |
|
| 111 |
default_chuanhu_assistant_model = config.get("default_chuanhu_assistant_model", "gpt-3.5-turbo")
|
| 112 |
+
for x in ["GOOGLE_CSE_ID", "GOOGLE_API_KEY", "WOLFRAM_ALPHA_APPID", "SERPAPI_API_KEY"]:
|
| 113 |
+
if config.get(x, None) is not None:
|
| 114 |
+
os.environ[x] = config[x]
|
|
|
|
| 115 |
|
| 116 |
@contextmanager
|
| 117 |
def retrieve_openai_api(api_key = None):
|