Tuchuanhuhuhu commited on
Commit
bbf38ab
·
1 Parent(s): 8c04739

bugfix: 修复从 PaLM 切换到 GPT 模型时 API Key 出错的问题

Browse files
Files changed (1) hide show
  1. modules/models/models.py +2 -1
modules/models/models.py CHANGED
@@ -562,6 +562,7 @@ def get_model(
562
  try:
563
  if model_type == ModelType.OpenAI:
564
  logging.info(f"正在加载OpenAI模型: {model_name}")
 
565
  model = OpenAIClient(
566
  model_name=model_name,
567
  api_key=access_key,
@@ -614,7 +615,7 @@ def get_model(
614
  model = ChuanhuAgent_Client(model_name, access_key, user_name=user_name)
615
  elif model_type == ModelType.GooglePaLM:
616
  from .Google_PaLM import Google_PaLM_Client
617
- access_key = os.environ.get("GOOGLE_PALM_API_KEY")
618
  model = Google_PaLM_Client(model_name, access_key, user_name=user_name)
619
  elif model_type == ModelType.LangchainChat:
620
  from .azure import Azure_OpenAI_Client
 
562
  try:
563
  if model_type == ModelType.OpenAI:
564
  logging.info(f"正在加载OpenAI模型: {model_name}")
565
+ access_key = os.environ.get("OPENAI_API_KEY", access_key)
566
  model = OpenAIClient(
567
  model_name=model_name,
568
  api_key=access_key,
 
615
  model = ChuanhuAgent_Client(model_name, access_key, user_name=user_name)
616
  elif model_type == ModelType.GooglePaLM:
617
  from .Google_PaLM import Google_PaLM_Client
618
+ access_key = os.environ.get("GOOGLE_PALM_API_KEY", access_key)
619
  model = Google_PaLM_Client(model_name, access_key, user_name=user_name)
620
  elif model_type == ModelType.LangchainChat:
621
  from .azure import Azure_OpenAI_Client