File size: 1,151 Bytes
8d3c645
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
top_p, temperature
top_p, api_key, temperature

top_p=top_p, api_key=api_key, temperature=temperature
top_p=top_p, api_key=api_key, temperature=temperature


with gr.Column(scale=1):
    with gr.Row():
        api_key = gr.Textbox(show_label=False, placeholder="输入API_KEY,输入后自动生效.").style(container=False)
    with gr.Row():
        txt = gr.Textbox(show_label=False, placeholder="输入问题.").style(container=False)


    # 在读取API_KEY时,检查一下是不是忘了改config
    # if arg=='API_KEY':
    #     # 正确的 API_KEY 是 "sk-" + 48 位大小写字母数字的组合
    #     API_MATCH = re.match(r"sk-[a-zA-Z0-9]{48}$", r)
    #     if API_MATCH:
    #         print(f"[API_KEY] 您的 API_KEY 是: {r[:15]}*** API_KEY 导入成功")
    #     else:
    #         assert False, "正确的 API_KEY 是 'sk-' + '48 位大小写字母数字' 的组合,请在config文件中修改API密钥, 添加海外代理之后再运行。" + \
    #                     "(如果您刚更新过代码,请确保旧版config_private文件中没有遗留任何新增键值)"


f"Bearer {api_key}"
f"Bearer {api_key}"