Spaces:
Sleeping
Sleeping
JohnSmith9982
commited on
Commit
•
9a9f703
1
Parent(s):
011d683
Upload 3 files
Browse files
app.py
CHANGED
@@ -51,10 +51,9 @@ with gr.Blocks(css=customCSS,) as demo:
|
|
51 |
FALSECONSTANT = gr.State(False)
|
52 |
topic = gr.State("未命名对话历史记录")
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
gr.HTML(title)
|
58 |
|
59 |
with gr.Row(scale=1).style(equal_height=True):
|
60 |
|
@@ -76,46 +75,47 @@ with gr.Blocks(css=customCSS,) as demo:
|
|
76 |
|
77 |
|
78 |
with gr.Column():
|
79 |
-
with gr.
|
|
|
80 |
status_display = gr.Markdown("status: ready")
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
|
120 |
|
121 |
|
|
|
51 |
FALSECONSTANT = gr.State(False)
|
52 |
topic = gr.State("未命名对话历史记录")
|
53 |
|
54 |
+
gr.HTML("""
|
55 |
+
<div style="text-align: center; margin-top: 20px;">
|
56 |
+
""")
|
|
|
57 |
|
58 |
with gr.Row(scale=1).style(equal_height=True):
|
59 |
|
|
|
75 |
|
76 |
|
77 |
with gr.Column():
|
78 |
+
with gr.Row(min_width=50,scale=1):
|
79 |
+
gr.HTML(title)
|
80 |
status_display = gr.Markdown("status: ready")
|
81 |
+
keyTxt = gr.Textbox(show_label=True, placeholder=f"OpenAI API-key...",value=my_api_key, type="password", visible=not HIDE_MY_KEY, label="API-Key")
|
82 |
+
model_select_dropdown = gr.Dropdown(label="选择模型", choices=MODELS, multiselect=False, value=MODELS[0])
|
83 |
+
systemPromptTxt = gr.Textbox(show_label=True, placeholder=f"在这里输入System Prompt...", label="System prompt", value=initial_prompt).style(container=True)
|
84 |
+
|
85 |
+
|
86 |
+
with gr.Accordion(label="加载Prompt模板", open=False):
|
87 |
+
with gr.Column():
|
88 |
+
with gr.Row():
|
89 |
+
with gr.Column(scale=6):
|
90 |
+
templateFileSelectDropdown = gr.Dropdown(label="选择Prompt模板集合文件", choices=get_template_names(plain=True), multiselect=False, value=get_template_names(plain=True)[0])
|
91 |
+
with gr.Column(scale=1):
|
92 |
+
templateRefreshBtn = gr.Button("🔄 刷新")
|
93 |
+
with gr.Row():
|
94 |
+
with gr.Column():
|
95 |
+
templateSelectDropdown = gr.Dropdown(label="从Prompt模板中加载", choices=load_template(get_template_names(plain=True)[0], mode=1), multiselect=False, value=load_template(get_template_names(plain=True)[0], mode=1)[0])
|
96 |
+
with gr.Accordion(label="保存/加载对话历史记录", open=False):
|
97 |
+
with gr.Column():
|
98 |
+
with gr.Row():
|
99 |
+
with gr.Column(scale=6):
|
100 |
+
saveFileName = gr.Textbox(
|
101 |
+
show_label=True, placeholder=f"在这里输入保存的文件名...", label="设置保存文件名", value="对话历史记录").style(container=True)
|
102 |
+
with gr.Column(scale=1):
|
103 |
+
saveHistoryBtn = gr.Button("💾 保存对话")
|
104 |
+
with gr.Row():
|
105 |
+
with gr.Column(scale=6):
|
106 |
+
historyFileSelectDropdown = gr.Dropdown(label="从列表中加载对话", choices=get_history_names(plain=True), multiselect=False, value=get_history_names(plain=True)[0])
|
107 |
+
with gr.Column(scale=1):
|
108 |
+
historyRefreshBtn = gr.Button("🔄 刷新")
|
109 |
+
|
110 |
+
use_streaming_checkbox = gr.Checkbox(label="实时传输回答", value=True, visible=enable_streaming_option)
|
111 |
+
use_websearch_checkbox = gr.Checkbox(label="使用在线搜索", value=False)
|
112 |
+
|
113 |
+
|
114 |
+
with gr.Accordion("参数", open=False):
|
115 |
+
top_p = gr.Slider(minimum=-0, maximum=1.0, value=1.0, step=0.05,
|
116 |
+
interactive=True, label="Top-p (nucleus sampling)",)
|
117 |
+
temperature = gr.Slider(minimum=-0, maximum=5.0, value=1.0,
|
118 |
+
step=0.1, interactive=True, label="Temperature",)
|
119 |
|
120 |
|
121 |
|