Tuchuanhuhuhu commited on
Commit
4ff35e1
1 Parent(s): 6334085

加入了隐藏密钥输入框的选项

Browse files
Files changed (1) hide show
  1. ChuanhuChatbot.py +3 -1
ChuanhuChatbot.py CHANGED
@@ -9,6 +9,8 @@ import requests
9
  import csv
10
 
11
  my_api_key = "" # 在这里输入你的 API 密钥
 
 
12
  initial_prompt = "You are a helpful assistant."
13
  API_URL = "https://api.openai.com/v1/chat/completions"
14
  HISTORY_DIR = "history"
@@ -236,7 +238,7 @@ description = """<div align=center>
236
  with gr.Blocks() as demo:
237
  gr.HTML(title)
238
  keyTxt = gr.Textbox(show_label=True, placeholder=f"在这里输入你的OpenAI API-key...",
239
- value=my_api_key, label="API Key", type="password").style(container=True)
240
  chatbot = gr.Chatbot() # .style(color_map=("#1D51EE", "#585A5B"))
241
  history = gr.State([])
242
  promptTemplates = gr.State({})
 
9
  import csv
10
 
11
  my_api_key = "" # 在这里输入你的 API 密钥
12
+ HIDE_MY_KEY = False # 如果你想在UI中隐藏你的 API 密钥,将此值设置为 True
13
+
14
  initial_prompt = "You are a helpful assistant."
15
  API_URL = "https://api.openai.com/v1/chat/completions"
16
  HISTORY_DIR = "history"
 
238
  with gr.Blocks() as demo:
239
  gr.HTML(title)
240
  keyTxt = gr.Textbox(show_label=True, placeholder=f"在这里输入你的OpenAI API-key...",
241
+ value=my_api_key, label="API Key", type="password", visible=HIDE_MY_KEY).style(container=True)
242
  chatbot = gr.Chatbot() # .style(color_map=("#1D51EE", "#585A5B"))
243
  history = gr.State([])
244
  promptTemplates = gr.State({})