Spaces:
Sleeping
Sleeping
Keldos
commited on
Commit
•
762e19e
1
Parent(s):
964aa99
WIP: make chatbot header
Browse files
ChuanhuChatbot.py
CHANGED
@@ -97,8 +97,25 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
97 |
|
98 |
with gr.Column(elem_id="chuanhu-area", scale=5):
|
99 |
with gr.Column(elem_id="chatbot-area"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
with gr.Row():
|
101 |
-
chatbot = gr.Chatbot(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
with gr.Row():
|
103 |
with gr.Column(min_width=225, scale=12):
|
104 |
user_input = gr.Textbox(
|
@@ -195,12 +212,12 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
195 |
usageTxt = gr.Markdown(i18n("多账号模式已开启,无需输入key,可直接开始对话"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
|
196 |
else:
|
197 |
usageTxt = gr.Markdown(i18n("**发送消息** 或 **提交key** 以显示额度"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
|
198 |
-
model_select_dropdown = gr.Dropdown(
|
199 |
-
|
200 |
-
)
|
201 |
-
lora_select_dropdown = gr.Dropdown(
|
202 |
-
|
203 |
-
)
|
204 |
with gr.Row():
|
205 |
single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False, elem_classes="switch-checkbox")
|
206 |
use_websearch_checkbox = gr.Checkbox(label=i18n("使用在线搜索"), value=False, elem_classes="switch-checkbox")
|
|
|
97 |
|
98 |
with gr.Column(elem_id="chuanhu-area", scale=5):
|
99 |
with gr.Column(elem_id="chatbot-area"):
|
100 |
+
with gr.Row(elem_id="chatbot-header"):
|
101 |
+
model_select_dropdown = gr.Dropdown(
|
102 |
+
label=i18n("选择模型"), choices=MODELS, multiselect=False, value=MODELS[DEFAULT_MODEL], interactive=True,
|
103 |
+
show_label=False, container=False, elem_id="model-select-dropdown"
|
104 |
+
)
|
105 |
+
lora_select_dropdown = gr.Dropdown(
|
106 |
+
label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False
|
107 |
+
)
|
108 |
+
gr.HTML(get_html("chatbot_header_btn.html"),elem_id="chatbot-header-btn-bar")
|
109 |
with gr.Row():
|
110 |
+
chatbot = gr.Chatbot(
|
111 |
+
label="Chuanhu Chat",
|
112 |
+
elem_id="chuanhu-chatbot",
|
113 |
+
latex_delimiters=latex_delimiters_set,
|
114 |
+
height=700,
|
115 |
+
show_label=False,
|
116 |
+
avatar_images=[config.user_avatar, config.bot_avatar],
|
117 |
+
show_share_button=False
|
118 |
+
)
|
119 |
with gr.Row():
|
120 |
with gr.Column(min_width=225, scale=12):
|
121 |
user_input = gr.Textbox(
|
|
|
212 |
usageTxt = gr.Markdown(i18n("多账号模式已开启,无需输入key,可直接开始对话"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
|
213 |
else:
|
214 |
usageTxt = gr.Markdown(i18n("**发送消息** 或 **提交key** 以显示额度"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
|
215 |
+
# model_select_dropdown = gr.Dropdown(
|
216 |
+
# label=i18n("选择模型"), choices=MODELS, multiselect=False, value=MODELS[DEFAULT_MODEL], interactive=True
|
217 |
+
# )
|
218 |
+
# lora_select_dropdown = gr.Dropdown(
|
219 |
+
# label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False
|
220 |
+
# )
|
221 |
with gr.Row():
|
222 |
single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False, elem_classes="switch-checkbox")
|
223 |
use_websearch_checkbox = gr.Checkbox(label=i18n("使用在线搜索"), value=False, elem_classes="switch-checkbox")
|
web_assets/html/chatbot_header_btn.html
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
<button id="open-toolbox-btn" onclick="toolboxClick()" style="width: 60px; height: 60px;">
|
2 |
+
工具栏
|
3 |
+
</button>
|
web_assets/stylesheet/ChuanhuChat.css
CHANGED
@@ -231,7 +231,7 @@ body.popup-open {
|
|
231 |
justify-content: center;
|
232 |
overflow: hidden;
|
233 |
flex-direction: row;
|
234 |
-
padding-inline: 24px;
|
235 |
/* margin: 16px; */
|
236 |
/* border-radius: 24px; */
|
237 |
background: var(--chatbot-background-color-light);
|
@@ -240,7 +240,31 @@ body.popup-open {
|
|
240 |
background: var(--chatbot-background-color-dark);
|
241 |
}
|
242 |
#chatbot-area {
|
243 |
-
max-width: 1024px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
}
|
245 |
/* default invisible */
|
246 |
#menu-area, #toolbox-area {
|
|
|
231 |
justify-content: center;
|
232 |
overflow: hidden;
|
233 |
flex-direction: row;
|
234 |
+
/* padding-inline: 24px; */
|
235 |
/* margin: 16px; */
|
236 |
/* border-radius: 24px; */
|
237 |
background: var(--chatbot-background-color-light);
|
|
|
240 |
background: var(--chatbot-background-color-dark);
|
241 |
}
|
242 |
#chatbot-area {
|
243 |
+
/* max-width: 1024px; */
|
244 |
+
/* gap: 0; */
|
245 |
+
}
|
246 |
+
#chatbot-header {
|
247 |
+
justify-content: space-between;
|
248 |
+
border-bottom: 1px solid var(--border-color-primary);
|
249 |
+
height: 60px;
|
250 |
+
position: absolute;
|
251 |
+
top: 0;
|
252 |
+
z-index: 50;
|
253 |
+
/* background: var(--header); */
|
254 |
+
/* !!!!!!!!!!!!!!!!!!!!!!!!这里颜色还要再写!!!!!!!!!!!!!!!!!!!!!! */
|
255 |
+
backdrop-filter: blur(24px);
|
256 |
+
-webkit-backdrop-filter: blur(24px);
|
257 |
+
}
|
258 |
+
#model-select-dropdown {
|
259 |
+
max-width: 0;
|
260 |
+
background: none;
|
261 |
+
}
|
262 |
+
#model-select-dropdown > label > .wrap {
|
263 |
+
background: none;
|
264 |
+
}
|
265 |
+
#chatbot-header-btn-bar {
|
266 |
+
justify-content: flex-end;
|
267 |
+
display: flex;
|
268 |
}
|
269 |
/* default invisible */
|
270 |
#menu-area, #toolbox-area {
|
web_assets/stylesheet/chatbot.css
CHANGED
@@ -138,6 +138,16 @@ hr.append-display {
|
|
138 |
|
139 |
#chuanhu-chatbot>.wrapper>.wrap {
|
140 |
overflow-x: hidden;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
.message.user p {
|
|
|
138 |
|
139 |
#chuanhu-chatbot>.wrapper>.wrap {
|
140 |
overflow-x: hidden;
|
141 |
+
display: flex;
|
142 |
+
width: 100%;
|
143 |
+
flex-direction: column;
|
144 |
+
padding-inline: 20px;
|
145 |
+
padding-top: 72px;
|
146 |
+
}
|
147 |
+
#chuanhu-chatbot>.wrapper>.wrap .message-wrap {
|
148 |
+
align-self: center;
|
149 |
+
width: 100%;
|
150 |
+
max-width: 1024px;
|
151 |
}
|
152 |
|
153 |
.message.user p {
|