Keldos commited on
Commit
0b100e6
1 Parent(s): d7487c3

WIP: 调整menu中history list样式

Browse files
ChuanhuChatbot.py CHANGED
@@ -59,11 +59,19 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
59
  with gr.Row(equal_height=True, elem_id="chuanhu-body"):
60
 
61
  with gr.Column(elem_id="menu-area"):
62
- with gr.Row(elem_id="chuanhu-history"):
63
- with gr.Column():
64
- historySearchTextbox = gr.Textbox(show_label=False, placeholder=i18n(
65
- "搜索(支持正则)..."), lines=1, elem_id="history-search-tb")
66
- with gr.Row():
 
 
 
 
 
 
 
 
67
  with gr.Column(scale=6, elem_id="history-select-wrap"):
68
  historySelectList = gr.Radio(
69
  label=i18n("从列表中加载对话"),
@@ -73,9 +81,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
73
  container=False,
74
  elem_id="history-select-dropdown"
75
  )
76
- with gr.Row():
77
- with gr.Column(min_width=42, scale=1):
78
- historyRefreshBtn = gr.Button(i18n("🔄"))
79
  with gr.Column(min_width=42, scale=1):
80
  historyDeleteBtn = gr.Button(
81
  i18n("🗑️"), elem_id="gr-history-delete-btn")
@@ -85,7 +91,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
85
  with gr.Column(min_width=42, scale=1):
86
  historyMarkdownDownloadBtn = gr.Button(
87
  i18n("⤵️"), elem_id="gr-history-mardown-download-btn")
88
- with gr.Row():
89
  with gr.Column(scale=6):
90
  saveFileName = gr.Textbox(
91
  show_label=True,
@@ -100,10 +106,6 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
100
  i18n("💾 Rename Chat"), elem_id="gr-history-save-btn")
101
  exportMarkdownBtn = gr.Button(
102
  i18n("📝 Export as Markdown"), elem_id="gr-markdown-export-btn")
103
- with gr.Row():
104
- with gr.Column():
105
- uploadFileBtn = gr.UploadButton(
106
- interactive=True, label=i18n("Upload Chat History (.json)"), file_types=[".json"])
107
 
108
  with gr.Column(elem_id="chuanhu-menu-footer"):
109
  with gr.Row(elem_id="chuanhu-func-nav"):
 
59
  with gr.Row(equal_height=True, elem_id="chuanhu-body"):
60
 
61
  with gr.Column(elem_id="menu-area"):
62
+ with gr.Column(elem_id="chuanhu-history"):
63
+ with gr.Box():
64
+ with gr.Row(elem_id="chuanhu-history-header"):
65
+ with gr.Column(min_width=150, scale=2):
66
+ historySearchTextbox = gr.Textbox(show_label=False, container=False, placeholder=i18n(
67
+ "搜索(支持正则)..."), lines=1, elem_id="history-search-tb")
68
+ with gr.Column(min_width=42, scale=1, elem_classes="gr-squared-btn-col"):
69
+ uploadFileBtn = gr.UploadButton(
70
+ interactive=True, label=i18n("⏏️"), file_types=[".json"])
71
+ with gr.Column(min_width=42, scale=1, elem_classes="gr-squared-btn-col"):
72
+ historyRefreshBtn = gr.Button(i18n("🔄"))
73
+
74
+ with gr.Row(elem_id="chuanhu-history-body"):
75
  with gr.Column(scale=6, elem_id="history-select-wrap"):
76
  historySelectList = gr.Radio(
77
  label=i18n("从列表中加载对话"),
 
81
  container=False,
82
  elem_id="history-select-dropdown"
83
  )
84
+ with gr.Row(visible=False):
 
 
85
  with gr.Column(min_width=42, scale=1):
86
  historyDeleteBtn = gr.Button(
87
  i18n("🗑️"), elem_id="gr-history-delete-btn")
 
91
  with gr.Column(min_width=42, scale=1):
92
  historyMarkdownDownloadBtn = gr.Button(
93
  i18n("⤵️"), elem_id="gr-history-mardown-download-btn")
94
+ with gr.Row(visible=False):
95
  with gr.Column(scale=6):
96
  saveFileName = gr.Textbox(
97
  show_label=True,
 
106
  i18n("💾 Rename Chat"), elem_id="gr-history-save-btn")
107
  exportMarkdownBtn = gr.Button(
108
  i18n("📝 Export as Markdown"), elem_id="gr-markdown-export-btn")
 
 
 
 
109
 
110
  with gr.Column(elem_id="chuanhu-menu-footer"):
111
  with gr.Row(elem_id="chuanhu-func-nav"):
web_assets/stylesheet/ChuanhuChat.css CHANGED
@@ -663,11 +663,11 @@ input:checked + .chatbot-input-more-span {
663
  box-shadow: unset;
664
  overflow: hidden;
665
  } */
666
- .chuanhu-history-panel {
667
  height: 500px;
668
  overflow: auto;
669
  box-shadow: var(--shadow-drop-lg);
670
- }
671
 
672
  #chuanhu-popup > .gradio-box {
673
  height: 100%;
@@ -933,15 +933,33 @@ input:checked + .chatbot-input-more-span {
933
  } */
934
 
935
  #chuanhu-history {
936
- height: calc(100*var(--vh) - 65px - 61px);
937
- height: calc(100*var(--vh) - 65px - calc(36px + 12px + max(12px, env(safe-area-inset-bottom)) + 1px ));
938
- overflow-y: auto;
939
  }
940
  #chuanhu-history > div {
941
  border-radius: 0;
942
  background: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
943
  }
944
-
945
  #chuanhu-menu-footer {
946
  position: absolute;
947
  bottom: 0;
@@ -1036,11 +1054,11 @@ input:checked + .chatbot-input-more-span {
1036
  }
1037
 
1038
 
1039
- #history-select-wrap {
1040
  height: 600px;
1041
  overflow: auto;
1042
  overflow-x: hidden;
1043
- }
1044
 
1045
  .chat-selected-btns {
1046
  height: 18px;
 
663
  box-shadow: unset;
664
  overflow: hidden;
665
  } */
666
+ /* .chuanhu-history-panel {
667
  height: 500px;
668
  overflow: auto;
669
  box-shadow: var(--shadow-drop-lg);
670
+ } */
671
 
672
  #chuanhu-popup > .gradio-box {
673
  height: 100%;
 
933
  } */
934
 
935
  #chuanhu-history {
936
+ max-height: calc(100*var(--vh) - 65px - 61px);
937
+ max-height: calc(100*var(--vh) - 65px - calc(36px + 12px + max(12px, env(safe-area-inset-bottom)) + 1px ));
938
+ /* overflow-y: auto; */
939
  }
940
  #chuanhu-history > div {
941
  border-radius: 0;
942
  background: none;
943
+ height: 100%;
944
+ padding: 0;
945
+ }
946
+ #chuanhu-history > div > div {
947
+ padding-inline: 12px;
948
+ }
949
+ #chuanhu-history-header {
950
+ margin-top: 12px;
951
+ height: 42px;
952
+ margin-bottom: 6px;
953
+ }
954
+ #chuanhu-history-body {
955
+ height: calc(100% - 60px);
956
+ overflow-y: auto;
957
+ overflow-x: hidden;
958
+ padding-bottom: 6px;
959
+ }
960
+ .gr-squared-btn-col {
961
+ max-width: 39px;
962
  }
 
963
  #chuanhu-menu-footer {
964
  position: absolute;
965
  bottom: 0;
 
1054
  }
1055
 
1056
 
1057
+ /* #history-select-wrap {
1058
  height: 600px;
1059
  overflow: auto;
1060
  overflow-x: hidden;
1061
+ } */
1062
 
1063
  .chat-selected-btns {
1064
  height: 18px;