Keldos commited on
Commit
eea6f06
1 Parent(s): b9dc38b

feat: 调整user_info显示

Browse files
Files changed (3) hide show
  1. ChuanhuChatbot.py +4 -3
  2. assets/custom.css +7 -8
  3. modules/presets.py +1 -1
ChuanhuChatbot.py CHANGED
@@ -29,8 +29,9 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
29
  topic = gr.State("未命名对话历史记录")
30
 
31
  with gr.Row():
32
- gr.HTML(title)
33
- user_ip = gr.Markdown(value="", elem_id="user_ip")
 
34
  status_display = gr.Markdown(get_geoip(), elem_id="status_display")
35
 
36
  # https://github.com/gradio-app/gradio/pull/3296
@@ -40,7 +41,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
40
  return gr.Markdown.update(value=f"User: {request.username}"), request.username
41
  else:
42
  return gr.Markdown.update(value=f"User: 管理员"), ""
43
- demo.load(create_greeting, inputs=None, outputs=[user_ip, user_name])
44
 
45
  with gr.Row().style(equal_height=True):
46
  with gr.Column(scale=5):
 
29
  topic = gr.State("未命名对话历史记录")
30
 
31
  with gr.Row():
32
+ with gr.Column():
33
+ gr.HTML(title)
34
+ user_info = gr.Markdown(value="", elem_id="user_info")
35
  status_display = gr.Markdown(get_geoip(), elem_id="status_display")
36
 
37
  # https://github.com/gradio-app/gradio/pull/3296
 
41
  return gr.Markdown.update(value=f"User: {request.username}"), request.username
42
  else:
43
  return gr.Markdown.update(value=f"User: 管理员"), ""
44
+ demo.load(create_greeting, inputs=None, outputs=[user_info, user_name])
45
 
46
  with gr.Row().style(equal_height=True):
47
  with gr.Column(scale=5):
assets/custom.css CHANGED
@@ -18,14 +18,13 @@ footer {
18
  opacity: 0.85;
19
  }
20
 
21
- /* user_ip */
22
- #user_ip {
23
- display: flex;
24
- min-height: 2.5em;
25
- align-items: flex-end;
26
- justify-content: flex-end;
27
  }
28
- #user_ip p {
29
  font-size: .85em;
30
  font-family: monospace;
31
  color: var(--body-text-color-subdued);
@@ -34,7 +33,7 @@ footer {
34
  /* status_display */
35
  #status_display {
36
  display: flex;
37
- min-height: 2.5em;
38
  align-items: flex-end;
39
  justify-content: flex-end;
40
  }
 
18
  opacity: 0.85;
19
  }
20
 
21
+ /* user_info */
22
+ #user_info {
23
+ white-space: nowrap;
24
+ margin-top: -1.3em !important;
25
+ padding-left: 112px !important;
 
26
  }
27
+ #user_info p {
28
  font-size: .85em;
29
  font-family: monospace;
30
  color: var(--body-text-color-subdued);
 
33
  /* status_display */
34
  #status_display {
35
  display: flex;
36
+ min-height: 2em;
37
  align-items: flex-end;
38
  justify-content: flex-end;
39
  }
modules/presets.py CHANGED
@@ -30,7 +30,7 @@ CONCURRENT_COUNT = 100 # 允许同时使用的用户数量
30
  SIM_K = 5
31
  INDEX_QUERY_TEMPRATURE = 1.0
32
 
33
- title = """<h1 align="left" style="min-width:200px; margin-top:0;">川虎ChatGPT 🚀</h1>"""
34
  description = """\
35
  <div align="center" style="margin:16px 0">
36
 
 
30
  SIM_K = 5
31
  INDEX_QUERY_TEMPRATURE = 1.0
32
 
33
+ title = """<h1 align="left" style="min-width:200px; margin-top:6px; white-space: nowrap;">川虎ChatGPT 🚀</h1>"""
34
  description = """\
35
  <div align="center" style="margin:16px 0">
36