Tuchuanhuhuhu commited on
Commit
94adb4f
1 Parent(s): c87ba04

增加API Key设置的提示

Browse files
Files changed (2) hide show
  1. ChuanhuChatbot.py +1 -1
  2. utils.py +1 -0
ChuanhuChatbot.py CHANGED
@@ -160,7 +160,7 @@ with gr.Blocks(
160
  value=hide_middle_chars(my_api_key),
161
  type="password",
162
  visible=not HIDE_MY_KEY,
163
- label="API-Key",
164
  )
165
  model_select_dropdown = gr.Dropdown(
166
  label="选择模型", choices=MODELS, multiselect=False, value=MODELS[0]
 
160
  value=hide_middle_chars(my_api_key),
161
  type="password",
162
  visible=not HIDE_MY_KEY,
163
+ label="API-Key(按Enter提交)",
164
  )
165
  model_select_dropdown = gr.Dropdown(
166
  label="选择模型", choices=MODELS, multiselect=False, value=MODELS[0]
utils.py CHANGED
@@ -267,6 +267,7 @@ def hide_middle_chars(s):
267
 
268
 
269
  def submit_key(key):
 
270
  msg = f"API密钥更改为了{hide_middle_chars(key)}"
271
  logging.info(msg)
272
  return key, msg
 
267
 
268
 
269
  def submit_key(key):
270
+ key = key.strip()
271
  msg = f"API密钥更改为了{hide_middle_chars(key)}"
272
  logging.info(msg)
273
  return key, msg