Keldos commited on
Commit
ec40641
·
1 Parent(s): 1265181

WIP: 一些界面调整与样式调整

Browse files
ChuanhuChatbot.py CHANGED
@@ -125,7 +125,11 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
125
  with gr.Row(elem_id="chatbot-footer"):
126
  with gr.Box(elem_id="chatbot-input-box"):
127
  with gr.Row(elem_id="chatbot-input-row"):
128
- gr.HTML(get_html("chatbot_more.html"))
 
 
 
 
129
  with gr.Row(elem_id="chatbot-input-tb-row"):
130
  with gr.Column(min_width=225, scale=12):
131
  user_input = gr.Textbox(
@@ -162,38 +166,47 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
162
  gr.Markdown("## Toolbox")
163
  gr.HTML(get_html("close_btn.html").format(obj="toolbox"), elem_classes="close-btn")
164
  with gr.Tabs(elem_id="chuanhu-toolbox-tabs"):
165
- with gr.Tab(label=i18n("Prompt")):
166
- # with gr.Accordion(label="Prompt", open=True):
167
- systemPromptTxt = gr.Textbox(
168
- show_label=True,
169
- placeholder=i18n("在这里输入System Prompt..."),
170
- label="System prompt",
171
- value=INITIAL_SYSTEM_PROMPT,
172
- lines=10
173
- )
174
- with gr.Accordion(label=i18n("加载Prompt模板"), open=True):
175
- with gr.Column():
176
- with gr.Row():
177
- with gr.Column(scale=6):
178
- templateFileSelectDropdown = gr.Dropdown(
179
- label=i18n("选择Prompt模板集合文件"),
180
- choices=get_template_names(),
181
- multiselect=False,
182
- value=get_template_names()[0],
183
- container=False,
184
- )
185
- with gr.Column(scale=1):
186
- templateRefreshBtn = gr.Button(i18n("🔄 刷新"))
187
- with gr.Row():
188
- with gr.Column():
189
- templateSelectDropdown = gr.Dropdown(
190
- label=i18n("从Prompt模板中加载"),
191
- choices=load_template(
192
- get_template_names()[0], mode=1
193
- ),
194
- multiselect=False,
195
- container=False,
196
- )
 
 
 
 
 
 
 
 
 
197
  with gr.Tab(label=i18n("Parameters")):
198
  gr.Markdown(i18n("# ⚠️ 务必谨慎更改 ⚠️"), elem_id="advanced-warning")
199
  with gr.Accordion(i18n("参数"), open=True):
@@ -275,7 +288,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
275
  lines=1,
276
  )
277
  with gr.Tab(label=i18n("Extensions")):
278
- gr.Markdown("Will be here soon...\n(We hope)\nAnd we hope you can help us to make more extensions!")
279
 
280
  # changeAPIURLBtn = gr.Button(i18n("🔄 切换API地址"))
281
 
@@ -306,28 +319,23 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
306
  # label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False
307
  # )
308
  # with gr.Row():
309
- single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False, elem_classes="switch-checkbox", elem_id="gr-single-session-cb")
310
- use_websearch_checkbox = gr.Checkbox(label=i18n("使用在线搜索"), value=False, elem_classes="switch-checkbox", elem_id="gr-websearch-cb")
311
  language_select_dropdown = gr.Dropdown(
312
  label=i18n("选择回复语言(针对搜索&索引功能)"),
313
  choices=REPLY_LANGUAGES,
314
  multiselect=False,
315
  value=REPLY_LANGUAGES[0],
316
- )
317
- index_files = gr.Files(label=i18n("上传"), type="file", elem_id="upload-index-file")
318
- two_column = gr.Checkbox(label=i18n("双栏pdf"), value=advance_docs["pdf"].get("two_column", False))
319
- summarize_btn = gr.Button(i18n("总结"))
320
- # TODO: 公式ocr
321
- # formula_ocr = gr.Checkbox(label=i18n("识别公式"), value=advance_docs["pdf"].get("formula_ocr", False))
322
 
323
  with gr.Tab(label=i18n("高级")):
324
  gr.HTML(get_html("appearance_switcher.html").format(label=i18n("切换亮暗色主题")), elem_classes="insert-block", visible=False)
325
  use_streaming_checkbox = gr.Checkbox(
326
  label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION, elem_classes="switch-checkbox"
327
  )
 
328
  # checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."), visible=check_update)
329
 
330
- with gr.Tab(i18n("网络参数")):
331
  gr.Markdown(i18n("⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置"), elem_id="netsetting-warning")
332
  default_btn = gr.Button(i18n("🔙 恢复默认网络设置"))
333
  # 网络代理
 
125
  with gr.Row(elem_id="chatbot-footer"):
126
  with gr.Box(elem_id="chatbot-input-box"):
127
  with gr.Row(elem_id="chatbot-input-row"):
128
+ gr.HTML(get_html("chatbot_more.html").format(
129
+ single_turn_label=i18n("单轮对话"),
130
+ websearch_label=i18n("在线搜索"),
131
+ upload_file_label=i18n("上传文件"),
132
+ ))
133
  with gr.Row(elem_id="chatbot-input-tb-row"):
134
  with gr.Column(min_width=225, scale=12):
135
  user_input = gr.Textbox(
 
166
  gr.Markdown("## Toolbox")
167
  gr.HTML(get_html("close_btn.html").format(obj="toolbox"), elem_classes="close-btn")
168
  with gr.Tabs(elem_id="chuanhu-toolbox-tabs"):
169
+ with gr.Tab(label=i18n("对话")):
170
+ with gr.Accordion(label="Prompt", open=True):
171
+ systemPromptTxt = gr.Textbox(
172
+ show_label=True,
173
+ placeholder=i18n("在这里输入System Prompt..."),
174
+ label="System prompt",
175
+ value=INITIAL_SYSTEM_PROMPT,
176
+ lines=10
177
+ )
178
+ with gr.Accordion(label=i18n("加载Prompt模板"), open=True):
179
+ with gr.Column():
180
+ with gr.Row():
181
+ with gr.Column(scale=6):
182
+ templateFileSelectDropdown = gr.Dropdown(
183
+ label=i18n("选择Prompt模板集合文件"),
184
+ choices=get_template_names(),
185
+ multiselect=False,
186
+ value=get_template_names()[0],
187
+ container=False,
188
+ )
189
+ with gr.Column(scale=1):
190
+ templateRefreshBtn = gr.Button(i18n("🔄 刷新"))
191
+ with gr.Row():
192
+ with gr.Column():
193
+ templateSelectDropdown = gr.Dropdown(
194
+ label=i18n("从Prompt模板中加载"),
195
+ choices=load_template(
196
+ get_template_names()[0], mode=1
197
+ ),
198
+ multiselect=False,
199
+ container=False,
200
+ )
201
+ gr.Markdown("---", elem_classes="hr-line")
202
+ with gr.Accordion(label=i18n("索引"), open=True):
203
+ use_websearch_checkbox = gr.Checkbox(label=i18n("使用在线搜索"), value=False, elem_classes="switch-checkbox", elem_id="gr-websearch-cb", visible=False)
204
+ index_files = gr.Files(label=i18n("上传"), type="file", elem_id="upload-index-file")
205
+ two_column = gr.Checkbox(label=i18n("双栏pdf"), value=advance_docs["pdf"].get("two_column", False))
206
+ summarize_btn = gr.Button(i18n("总结"))
207
+ # TODO: 公式ocr
208
+ # formula_ocr = gr.Checkbox(label=i18n("识别公式"), value=advance_docs["pdf"].get("formula_ocr", False))
209
+
210
  with gr.Tab(label=i18n("Parameters")):
211
  gr.Markdown(i18n("# ⚠️ 务必谨慎更改 ⚠️"), elem_id="advanced-warning")
212
  with gr.Accordion(i18n("参数"), open=True):
 
288
  lines=1,
289
  )
290
  with gr.Tab(label=i18n("Extensions")):
291
+ gr.Markdown("Will be here soon...\n(We hope)\n\nAnd we hope you can help us to make more extensions!")
292
 
293
  # changeAPIURLBtn = gr.Button(i18n("🔄 切换API地址"))
294
 
 
319
  # label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False
320
  # )
321
  # with gr.Row():
322
+
 
323
  language_select_dropdown = gr.Dropdown(
324
  label=i18n("选择回复语言(针对搜索&索引功能)"),
325
  choices=REPLY_LANGUAGES,
326
  multiselect=False,
327
  value=REPLY_LANGUAGES[0],
328
+ )
 
 
 
 
 
329
 
330
  with gr.Tab(label=i18n("高级")):
331
  gr.HTML(get_html("appearance_switcher.html").format(label=i18n("切换亮暗色主题")), elem_classes="insert-block", visible=False)
332
  use_streaming_checkbox = gr.Checkbox(
333
  label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION, elem_classes="switch-checkbox"
334
  )
335
+ single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False, elem_classes="switch-checkbox", elem_id="gr-single-session-cb")
336
  # checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."), visible=check_update)
337
 
338
+ with gr.Tab(i18n("网络")):
339
  gr.Markdown(i18n("⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置"), elem_id="netsetting-warning")
340
  default_btn = gr.Button(i18n("🔙 恢复默认网络设置"))
341
  # 网络代理
web_assets/html/chatbot_more.html CHANGED
@@ -4,14 +4,14 @@
4
  <div class="switch-checkbox">
5
  <label>
6
  <input type="checkbox" name="single-session-cb" data-testid="checkbox" style="transform: scale(0.8); margin: 0;">
7
- <span class="chatbot-input-more-span">单轮对话</span>
8
  </label>
9
  </div>
10
 
11
  <div class="switch-checkbox">
12
  <label>
13
  <input type="checkbox" name="online-search-cb" data-testid="checkbox" style="transform: scale(0.8); margin: 0;">
14
- <span class="chatbot-input-more-span">在线搜索</span>
15
  </label>
16
  </div>
17
  </span>
@@ -20,7 +20,7 @@
20
  <div class="chatbot-input-more-btn last-btn">
21
  <label>
22
  <button id="upload-files-btn">
23
- <span class="chatbot-input-more-span">上传文件</span>
24
  <span class="chatbot-input-more-icon">
25
  <svg width="17.6625708px" height="22px" viewBox="0 0 17.6625708 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
26
  <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
 
4
  <div class="switch-checkbox">
5
  <label>
6
  <input type="checkbox" name="single-session-cb" data-testid="checkbox" style="transform: scale(0.8); margin: 0;">
7
+ <span class="chatbot-input-more-span">{single_turn_label}</span>
8
  </label>
9
  </div>
10
 
11
  <div class="switch-checkbox">
12
  <label>
13
  <input type="checkbox" name="online-search-cb" data-testid="checkbox" style="transform: scale(0.8); margin: 0;">
14
+ <span class="chatbot-input-more-span">{websearch_label}</span>
15
  </label>
16
  </div>
17
  </span>
 
20
  <div class="chatbot-input-more-btn last-btn">
21
  <label>
22
  <button id="upload-files-btn">
23
+ <span class="chatbot-input-more-span">{upload_file_label}</span>
24
  <span class="chatbot-input-more-icon">
25
  <svg width="17.6625708px" height="22px" viewBox="0 0 17.6625708 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
26
  <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
web_assets/stylesheet/ChuanhuChat.css CHANGED
@@ -13,7 +13,7 @@
13
  --switch-checkbox-color-dark: #515151;
14
 
15
  --chatbot-blur-background-color: #F3F3F366;
16
- --chatbot-input-background-color: rgba(255, 255, 255, 0.32);
17
  --chatbot-input-more-background-color: #FFFFFF;
18
  --chatbot-input-more-background-fullwidth-hover: #FFFFFF88;
19
  --chatbot-input-more-background-mobilewidth-hover: #F6F6F6;
@@ -544,7 +544,7 @@ button.chatbot-input-more-btn:active .sm-round-bg {
544
  visibility: visible;
545
  /* margin-right: 16px; */
546
  border-right: 0.5px solid var(--border-color-primary);
547
- box-shadow: -1px 0 4px 0 rgba(0, 0, 0, 0.1) inset;
548
  }
549
 
550
  #toolbox-area > div {
@@ -850,10 +850,17 @@ button.chatbot-input-more-btn:active .sm-round-bg {
850
  理论上不该是0,但这里考虑内部gradio有好多container有padding了
851
  }
852
  */
853
- #toolbox-area > .gradio-box > .gradio-tabs > div.tabitem > div > .gradio-markdown {
854
  padding: 12px;
855
  }
856
 
 
 
 
 
 
 
 
857
  /* #chuanhu-popup ul.options {
858
  transform: translate(-50%, -50%);
859
  } */
 
13
  --switch-checkbox-color-dark: #515151;
14
 
15
  --chatbot-blur-background-color: #F3F3F366;
16
+ --chatbot-input-background-color: rgba(255, 255, 255, 0.64);
17
  --chatbot-input-more-background-color: #FFFFFF;
18
  --chatbot-input-more-background-fullwidth-hover: #FFFFFF88;
19
  --chatbot-input-more-background-mobilewidth-hover: #F6F6F6;
 
544
  visibility: visible;
545
  /* margin-right: 16px; */
546
  border-right: 0.5px solid var(--border-color-primary);
547
+ /* box-shadow: -1px 0 4px 0 rgba(0, 0, 0, 0.1) inset; */
548
  }
549
 
550
  #toolbox-area > div {
 
850
  理论上不该是0,但这里考虑内部gradio有好多container有padding了
851
  }
852
  */
853
+ #toolbox-area .tabitem > div > .gradio-markdown {
854
  padding: 12px;
855
  }
856
 
857
+ #toolbox-area .tabitem > div > .gradio-accordion > .label-wrap > span {
858
+ font-weight: bold;
859
+ }
860
+ #toolbox-area .tabitem > div {
861
+ gap: 0 !important;
862
+ }
863
+
864
  /* #chuanhu-popup ul.options {
865
  transform: translate(-50%, -50%);
866
  } */
web_assets/stylesheet/custom-components.css CHANGED
@@ -261,3 +261,8 @@ input:checked + .apSlider::before {
261
  box-shadow: -6px 0 10px rgba(0, 0, 0, 0.36);
262
  z-index: 1;
263
  } */
 
 
 
 
 
 
261
  box-shadow: -6px 0 10px rgba(0, 0, 0, 0.36);
262
  z-index: 1;
263
  } */
264
+
265
+
266
+ .hr-line hr{
267
+ margin: 0 !important;
268
+ }