Spaces:
Sleeping
Sleeping
Keldos
commited on
Commit
·
f6180c8
1
Parent(s):
52fd957
WIP: 弹出窗口后禁用body的滚动,增加弹出窗口超出Window超出部分滚动
Browse files- ChuanhuChatbot.py +173 -172
- web_assets/javascript/ChuanhuChat.js +8 -5
- web_assets/javascript/webui.js +6 -1
- web_assets/stylesheet/ChuanhuChat.css +19 -11
ChuanhuChatbot.py
CHANGED
@@ -165,183 +165,184 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
165 |
updateChuanhuBtn = gr.Button(visible=False, elem_classes="invisible-btn", elem_id="update-chuanhu-btn")
|
166 |
historySelectBtn = gr.Button(visible=False, elem_classes="invisible-btn", elem_id="history-select-btn")
|
167 |
|
168 |
-
with gr.
|
169 |
-
with gr.Box(elem_id="chuanhu-
|
170 |
-
with gr.
|
171 |
-
gr.
|
172 |
-
|
173 |
-
|
174 |
-
with gr.
|
175 |
-
|
176 |
-
|
177 |
-
placeholder=f"Your API-key...",
|
178 |
-
value=hide_middle_chars(user_api_key.value),
|
179 |
-
type="password",
|
180 |
-
visible=not HIDE_MY_KEY,
|
181 |
-
label="API-Key",
|
182 |
-
)
|
183 |
-
if multi_api_key:
|
184 |
-
usageTxt = gr.Markdown(i18n("多账号模式已开启,无需输入key,可直接开始对话"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
|
185 |
-
else:
|
186 |
-
usageTxt = gr.Markdown(i18n("**发送消息** 或 **提交key** 以显示额度"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
|
187 |
-
model_select_dropdown = gr.Dropdown(
|
188 |
-
label=i18n("选择模型"), choices=MODELS, multiselect=False, value=MODELS[DEFAULT_MODEL], interactive=True
|
189 |
-
)
|
190 |
-
lora_select_dropdown = gr.Dropdown(
|
191 |
-
label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False
|
192 |
-
)
|
193 |
-
with gr.Row():
|
194 |
-
single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False, elem_classes="switch-checkbox")
|
195 |
-
use_websearch_checkbox = gr.Checkbox(label=i18n("使用在线搜索"), value=False, elem_classes="switch-checkbox")
|
196 |
-
language_select_dropdown = gr.Dropdown(
|
197 |
-
label=i18n("选择回复语言(针对搜索&索引功能)"),
|
198 |
-
choices=REPLY_LANGUAGES,
|
199 |
-
multiselect=False,
|
200 |
-
value=REPLY_LANGUAGES[0],
|
201 |
-
)
|
202 |
-
index_files = gr.Files(label=i18n("上传"), type="file", elem_id="upload-index-file")
|
203 |
-
two_column = gr.Checkbox(label=i18n("双栏pdf"), value=advance_docs["pdf"].get("two_column", False))
|
204 |
-
summarize_btn = gr.Button(i18n("总结"))
|
205 |
-
# TODO: 公式ocr
|
206 |
-
# formula_ocr = gr.Checkbox(label=i18n("识别公式"), value=advance_docs["pdf"].get("formula_ocr", False))
|
207 |
-
|
208 |
-
with gr.Tab(label=i18n("高级")):
|
209 |
-
gr.HTML(get_html("appearance_switcher.html").format(label=i18n("切换亮暗色主题")), elem_classes="insert-block")
|
210 |
-
use_streaming_checkbox = gr.Checkbox(
|
211 |
-
label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION, elem_classes="switch-checkbox"
|
212 |
-
)
|
213 |
-
checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."), visible=check_update)
|
214 |
-
gr.Markdown(i18n("# ⚠️ 务必谨慎更改 ⚠️"), elem_id="advanced-warning")
|
215 |
-
with gr.Accordion(i18n("参数"), open=False):
|
216 |
-
temperature_slider = gr.Slider(
|
217 |
-
minimum=-0,
|
218 |
-
maximum=2.0,
|
219 |
-
value=1.0,
|
220 |
-
step=0.1,
|
221 |
-
interactive=True,
|
222 |
-
label="temperature",
|
223 |
-
)
|
224 |
-
top_p_slider = gr.Slider(
|
225 |
-
minimum=-0,
|
226 |
-
maximum=1.0,
|
227 |
-
value=1.0,
|
228 |
-
step=0.05,
|
229 |
-
interactive=True,
|
230 |
-
label="top-p",
|
231 |
-
)
|
232 |
-
n_choices_slider = gr.Slider(
|
233 |
-
minimum=1,
|
234 |
-
maximum=10,
|
235 |
-
value=1,
|
236 |
-
step=1,
|
237 |
-
interactive=True,
|
238 |
-
label="n choices",
|
239 |
-
)
|
240 |
-
stop_sequence_txt = gr.Textbox(
|
241 |
-
show_label=True,
|
242 |
-
placeholder=i18n("停止符,用英文逗号隔开..."),
|
243 |
-
label="stop",
|
244 |
-
value="",
|
245 |
-
lines=1,
|
246 |
-
)
|
247 |
-
max_context_length_slider = gr.Slider(
|
248 |
-
minimum=1,
|
249 |
-
maximum=32768,
|
250 |
-
value=2000,
|
251 |
-
step=1,
|
252 |
-
interactive=True,
|
253 |
-
label="max context",
|
254 |
-
)
|
255 |
-
max_generation_slider = gr.Slider(
|
256 |
-
minimum=1,
|
257 |
-
maximum=32768,
|
258 |
-
value=1000,
|
259 |
-
step=1,
|
260 |
-
interactive=True,
|
261 |
-
label="max generations",
|
262 |
-
)
|
263 |
-
presence_penalty_slider = gr.Slider(
|
264 |
-
minimum=-2.0,
|
265 |
-
maximum=2.0,
|
266 |
-
value=0.0,
|
267 |
-
step=0.01,
|
268 |
-
interactive=True,
|
269 |
-
label="presence penalty",
|
270 |
-
)
|
271 |
-
frequency_penalty_slider = gr.Slider(
|
272 |
-
minimum=-2.0,
|
273 |
-
maximum=2.0,
|
274 |
-
value=0.0,
|
275 |
-
step=0.01,
|
276 |
-
interactive=True,
|
277 |
-
label="frequency penalty",
|
278 |
-
)
|
279 |
-
logit_bias_txt = gr.Textbox(
|
280 |
show_label=True,
|
281 |
-
placeholder=f"
|
282 |
-
|
283 |
-
|
284 |
-
|
|
|
285 |
)
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
)
|
293 |
-
|
294 |
-
|
295 |
-
gr.Markdown(i18n("---\n⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置"), elem_id="netsetting-warning")
|
296 |
-
default_btn = gr.Button(i18n("🔙 恢复默认网络设置"))
|
297 |
-
# 网络代理
|
298 |
-
proxyTxt = gr.Textbox(
|
299 |
-
show_label=True,
|
300 |
-
placeholder=i18n("未设置代理..."),
|
301 |
-
label=i18n("代理地址"),
|
302 |
-
value=config.http_proxy,
|
303 |
-
lines=1,
|
304 |
-
interactive=False,
|
305 |
-
# container=False,
|
306 |
-
elem_classes="view-only-textbox no-container",
|
307 |
)
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
value=
|
316 |
-
lines=1,
|
317 |
-
interactive=False,
|
318 |
-
# container=False,
|
319 |
-
elem_classes="view-only-textbox no-container",
|
320 |
)
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
|
346 |
|
347 |
gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
|
|
|
165 |
updateChuanhuBtn = gr.Button(visible=False, elem_classes="invisible-btn", elem_id="update-chuanhu-btn")
|
166 |
historySelectBtn = gr.Button(visible=False, elem_classes="invisible-btn", elem_id="history-select-btn")
|
167 |
|
168 |
+
with gr.Row(elem_id="popup-wrapper"):
|
169 |
+
with gr.Box(elem_id="chuanhu-popup"):
|
170 |
+
with gr.Box(elem_id="chuanhu-setting"):
|
171 |
+
with gr.Row():
|
172 |
+
gr.Markdown("## Settings")
|
173 |
+
gr.HTML(get_html("close_box_btn.html"),elem_classes="close-box-btn")
|
174 |
+
with gr.Tabs(elem_id="chuanhu-setting-tabs"):
|
175 |
+
with gr.Tab(label=i18n("模型")):
|
176 |
+
keyTxt = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
show_label=True,
|
178 |
+
placeholder=f"Your API-key...",
|
179 |
+
value=hide_middle_chars(user_api_key.value),
|
180 |
+
type="password",
|
181 |
+
visible=not HIDE_MY_KEY,
|
182 |
+
label="API-Key",
|
183 |
)
|
184 |
+
if multi_api_key:
|
185 |
+
usageTxt = gr.Markdown(i18n("多账号模式已开启,无需输入key,可直接开始对话"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
|
186 |
+
else:
|
187 |
+
usageTxt = gr.Markdown(i18n("**发送消息** 或 **提交key** 以显示额度"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
|
188 |
+
model_select_dropdown = gr.Dropdown(
|
189 |
+
label=i18n("选择模型"), choices=MODELS, multiselect=False, value=MODELS[DEFAULT_MODEL], interactive=True
|
190 |
)
|
191 |
+
lora_select_dropdown = gr.Dropdown(
|
192 |
+
label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
)
|
194 |
+
with gr.Row():
|
195 |
+
single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False, elem_classes="switch-checkbox")
|
196 |
+
use_websearch_checkbox = gr.Checkbox(label=i18n("使用在线搜索"), value=False, elem_classes="switch-checkbox")
|
197 |
+
language_select_dropdown = gr.Dropdown(
|
198 |
+
label=i18n("选择回复语言(针对搜索&索引功能)"),
|
199 |
+
choices=REPLY_LANGUAGES,
|
200 |
+
multiselect=False,
|
201 |
+
value=REPLY_LANGUAGES[0],
|
|
|
|
|
|
|
|
|
202 |
)
|
203 |
+
index_files = gr.Files(label=i18n("上传"), type="file", elem_id="upload-index-file")
|
204 |
+
two_column = gr.Checkbox(label=i18n("双栏pdf"), value=advance_docs["pdf"].get("two_column", False))
|
205 |
+
summarize_btn = gr.Button(i18n("总结"))
|
206 |
+
# TODO: 公式ocr
|
207 |
+
# formula_ocr = gr.Checkbox(label=i18n("识别公式"), value=advance_docs["pdf"].get("formula_ocr", False))
|
208 |
+
|
209 |
+
with gr.Tab(label=i18n("高级")):
|
210 |
+
gr.HTML(get_html("appearance_switcher.html").format(label=i18n("切换亮暗色主题")), elem_classes="insert-block")
|
211 |
+
use_streaming_checkbox = gr.Checkbox(
|
212 |
+
label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION, elem_classes="switch-checkbox"
|
213 |
+
)
|
214 |
+
checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."), visible=check_update)
|
215 |
+
gr.Markdown(i18n("# ⚠️ 务必谨慎更改 ⚠️"), elem_id="advanced-warning")
|
216 |
+
with gr.Accordion(i18n("参数"), open=False):
|
217 |
+
temperature_slider = gr.Slider(
|
218 |
+
minimum=-0,
|
219 |
+
maximum=2.0,
|
220 |
+
value=1.0,
|
221 |
+
step=0.1,
|
222 |
+
interactive=True,
|
223 |
+
label="temperature",
|
224 |
+
)
|
225 |
+
top_p_slider = gr.Slider(
|
226 |
+
minimum=-0,
|
227 |
+
maximum=1.0,
|
228 |
+
value=1.0,
|
229 |
+
step=0.05,
|
230 |
+
interactive=True,
|
231 |
+
label="top-p",
|
232 |
+
)
|
233 |
+
n_choices_slider = gr.Slider(
|
234 |
+
minimum=1,
|
235 |
+
maximum=10,
|
236 |
+
value=1,
|
237 |
+
step=1,
|
238 |
+
interactive=True,
|
239 |
+
label="n choices",
|
240 |
+
)
|
241 |
+
stop_sequence_txt = gr.Textbox(
|
242 |
+
show_label=True,
|
243 |
+
placeholder=i18n("停止符,用英文逗号隔开..."),
|
244 |
+
label="stop",
|
245 |
+
value="",
|
246 |
+
lines=1,
|
247 |
+
)
|
248 |
+
max_context_length_slider = gr.Slider(
|
249 |
+
minimum=1,
|
250 |
+
maximum=32768,
|
251 |
+
value=2000,
|
252 |
+
step=1,
|
253 |
+
interactive=True,
|
254 |
+
label="max context",
|
255 |
+
)
|
256 |
+
max_generation_slider = gr.Slider(
|
257 |
+
minimum=1,
|
258 |
+
maximum=32768,
|
259 |
+
value=1000,
|
260 |
+
step=1,
|
261 |
+
interactive=True,
|
262 |
+
label="max generations",
|
263 |
+
)
|
264 |
+
presence_penalty_slider = gr.Slider(
|
265 |
+
minimum=-2.0,
|
266 |
+
maximum=2.0,
|
267 |
+
value=0.0,
|
268 |
+
step=0.01,
|
269 |
+
interactive=True,
|
270 |
+
label="presence penalty",
|
271 |
+
)
|
272 |
+
frequency_penalty_slider = gr.Slider(
|
273 |
+
minimum=-2.0,
|
274 |
+
maximum=2.0,
|
275 |
+
value=0.0,
|
276 |
+
step=0.01,
|
277 |
+
interactive=True,
|
278 |
+
label="frequency penalty",
|
279 |
+
)
|
280 |
+
logit_bias_txt = gr.Textbox(
|
281 |
+
show_label=True,
|
282 |
+
placeholder=f"word:likelihood",
|
283 |
+
label="logit bias",
|
284 |
+
value="",
|
285 |
+
lines=1,
|
286 |
+
)
|
287 |
+
user_identifier_txt = gr.Textbox(
|
288 |
+
show_label=True,
|
289 |
+
placeholder=i18n("用于定位滥用行为"),
|
290 |
+
label=i18n("用户名"),
|
291 |
+
value=user_name.value,
|
292 |
+
lines=1,
|
293 |
+
)
|
294 |
+
|
295 |
+
with gr.Accordion(i18n("网络参数"), open=False):
|
296 |
+
gr.Markdown(i18n("---\n⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置"), elem_id="netsetting-warning")
|
297 |
+
default_btn = gr.Button(i18n("🔙 恢复默认网络设置"))
|
298 |
+
# 网络代理
|
299 |
+
proxyTxt = gr.Textbox(
|
300 |
+
show_label=True,
|
301 |
+
placeholder=i18n("未设置代理..."),
|
302 |
+
label=i18n("代理地址"),
|
303 |
+
value=config.http_proxy,
|
304 |
+
lines=1,
|
305 |
+
interactive=False,
|
306 |
+
# container=False,
|
307 |
+
elem_classes="view-only-textbox no-container",
|
308 |
+
)
|
309 |
+
# changeProxyBtn = gr.Button(i18n("🔄 设置代理地址"))
|
310 |
+
|
311 |
+
# 优先展示自定义的api_host
|
312 |
+
apihostTxt = gr.Textbox(
|
313 |
+
show_label=True,
|
314 |
+
placeholder="api.openai.com",
|
315 |
+
label="OpenAI API-Host",
|
316 |
+
value=config.api_host or shared.API_HOST,
|
317 |
+
lines=1,
|
318 |
+
interactive=False,
|
319 |
+
# container=False,
|
320 |
+
elem_classes="view-only-textbox no-container",
|
321 |
+
)
|
322 |
+
|
323 |
+
with gr.Box(elem_id="chuanhu-training"):
|
324 |
+
with gr.Row():
|
325 |
+
gr.Markdown("## Training")
|
326 |
+
gr.HTML(get_html("close_box_btn.html"),elem_classes="close-box-btn")
|
327 |
+
with gr.Tabs(elem_id="chuanhu-training-tabs"):
|
328 |
+
with gr.Tab(label=i18n("OpenAI 微调")):
|
329 |
+
openai_train_status = gr.Markdown(label=i18n("训练状态"), value=i18n("在这里[查看使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/%E4%BD%BF%E7%94%A8%E6%95%99%E7%A8%8B#%E5%BE%AE%E8%B0%83-gpt-35)"))
|
330 |
+
|
331 |
+
with gr.Tab(label=i18n("准备数据集")):
|
332 |
+
dataset_preview_json = gr.JSON(label=i18n("数据集预览"), readonly=True)
|
333 |
+
dataset_selection = gr.Files(label = i18n("选择数据集"), file_types=[".xlsx", ".jsonl"], file_count="single")
|
334 |
+
upload_to_openai_btn = gr.Button(i18n("上传到OpenAI"), variant="primary", interactive=False)
|
335 |
+
|
336 |
+
with gr.Tab(label=i18n("训练")):
|
337 |
+
openai_ft_file_id = gr.Textbox(label=i18n("文件ID"), value="", lines=1, placeholder=i18n("上传到 OpenAI 后自动填充"))
|
338 |
+
openai_ft_suffix = gr.Textbox(label=i18n("模型名称后缀"), value="", lines=1, placeholder=i18n("可选,用于区分不同的模型"))
|
339 |
+
openai_train_epoch_slider = gr.Slider(label=i18n("训练轮数(Epochs)"), minimum=1, maximum=100, value=3, step=1, interactive=True)
|
340 |
+
openai_start_train_btn = gr.Button(i18n("开始训练"), variant="primary", interactive=False)
|
341 |
+
|
342 |
+
with gr.Tab(label=i18n("状态")):
|
343 |
+
openai_status_refresh_btn = gr.Button(i18n("刷新状态"))
|
344 |
+
openai_cancel_all_jobs_btn = gr.Button(i18n("取消所有任务"))
|
345 |
+
add_to_models_btn = gr.Button(i18n("添加训练好的模型到模型列表"), interactive=False)
|
346 |
|
347 |
|
348 |
gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
|
web_assets/javascript/ChuanhuChat.js
CHANGED
@@ -29,6 +29,7 @@ var historySelector = null;
|
|
29 |
var chuanhuPopup = null;
|
30 |
var settingBox = null;
|
31 |
var trainingBox = null;
|
|
|
32 |
|
33 |
var isInIframe = (window.self !== window.top);
|
34 |
var currentTime = new Date().getTime();
|
@@ -71,6 +72,7 @@ function initialize() {
|
|
71 |
chuanhuPopup = gradioApp().querySelector('#chuanhu-popup');
|
72 |
settingBox = gradioApp().querySelector('#chuanhu-setting');
|
73 |
trainingBox = gradioApp().querySelector('#chuanhu-training');
|
|
|
74 |
|
75 |
|
76 |
if (loginUserForm) {
|
@@ -220,11 +222,12 @@ function setChatAreaWidth() {
|
|
220 |
function setPopupBoxPosition() {
|
221 |
const screenWidth = window.innerWidth;
|
222 |
const screenHeight = window.innerHeight;
|
223 |
-
|
224 |
-
|
225 |
-
const
|
226 |
-
|
227 |
-
chuanhuPopup.style.
|
|
|
228 |
}
|
229 |
|
230 |
function setChatbotHeight() {
|
|
|
29 |
var chuanhuPopup = null;
|
30 |
var settingBox = null;
|
31 |
var trainingBox = null;
|
32 |
+
var popupWrapper = null;
|
33 |
|
34 |
var isInIframe = (window.self !== window.top);
|
35 |
var currentTime = new Date().getTime();
|
|
|
72 |
chuanhuPopup = gradioApp().querySelector('#chuanhu-popup');
|
73 |
settingBox = gradioApp().querySelector('#chuanhu-setting');
|
74 |
trainingBox = gradioApp().querySelector('#chuanhu-training');
|
75 |
+
popupWrapper = gradioApp().querySelector('#popup-wrapper');
|
76 |
|
77 |
|
78 |
if (loginUserForm) {
|
|
|
222 |
function setPopupBoxPosition() {
|
223 |
const screenWidth = window.innerWidth;
|
224 |
const screenHeight = window.innerHeight;
|
225 |
+
popupWrapper.style.height = `${screenHeight}px`;
|
226 |
+
popupWrapper.style.width = `${screenWidth}px`;
|
227 |
+
// const popupBoxWidth = 680;
|
228 |
+
// const popupBoxHeight = 400;
|
229 |
+
// chuanhuPopup.style.left = `${(screenWidth - popupBoxWidth) / 2}px`;
|
230 |
+
// chuanhuPopup.style.top = `${(screenHeight - popupBoxHeight) / 2}px`;
|
231 |
}
|
232 |
|
233 |
function setChatbotHeight() {
|
web_assets/javascript/webui.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
function openSettingBox() {
|
2 |
chuanhuPopup.classList.add('showBox');
|
|
|
3 |
settingBox.classList.remove('hideBox');
|
4 |
showMask();
|
5 |
|
@@ -7,6 +8,7 @@ function openSettingBox() {
|
|
7 |
|
8 |
function openTrainingBox() {
|
9 |
chuanhuPopup.classList.add('showBox');
|
|
|
10 |
trainingBox.classList.remove('hideBox');
|
11 |
showMask();
|
12 |
}
|
@@ -14,7 +16,8 @@ function openTrainingBox() {
|
|
14 |
function showMask() {
|
15 |
const mask = document.createElement('div');
|
16 |
mask.classList.add('chuanhu-mask');
|
17 |
-
|
|
|
18 |
mask.addEventListener('click', () => {
|
19 |
closeBox();
|
20 |
});
|
@@ -22,9 +25,11 @@ function showMask() {
|
|
22 |
|
23 |
function closeBox() {
|
24 |
chuanhuPopup.classList.remove('showBox');
|
|
|
25 |
trainingBox.classList.add('hideBox');
|
26 |
settingBox.classList.add('hideBox');
|
27 |
document.querySelector('.chuanhu-mask')?.remove();
|
|
|
28 |
}
|
29 |
|
30 |
function menuClick() {
|
|
|
1 |
function openSettingBox() {
|
2 |
chuanhuPopup.classList.add('showBox');
|
3 |
+
popupWrapper.classList.add('showBox');
|
4 |
settingBox.classList.remove('hideBox');
|
5 |
showMask();
|
6 |
|
|
|
8 |
|
9 |
function openTrainingBox() {
|
10 |
chuanhuPopup.classList.add('showBox');
|
11 |
+
popupWrapper.classList.add('showBox');
|
12 |
trainingBox.classList.remove('hideBox');
|
13 |
showMask();
|
14 |
}
|
|
|
16 |
function showMask() {
|
17 |
const mask = document.createElement('div');
|
18 |
mask.classList.add('chuanhu-mask');
|
19 |
+
popupWrapper.appendChild(mask);
|
20 |
+
document.body.classList.add('popup-open');
|
21 |
mask.addEventListener('click', () => {
|
22 |
closeBox();
|
23 |
});
|
|
|
25 |
|
26 |
function closeBox() {
|
27 |
chuanhuPopup.classList.remove('showBox');
|
28 |
+
popupWrapper.classList.remove('showBox');
|
29 |
trainingBox.classList.add('hideBox');
|
30 |
settingBox.classList.add('hideBox');
|
31 |
document.querySelector('.chuanhu-mask')?.remove();
|
32 |
+
document.body.classList.remove('popup-open');
|
33 |
}
|
34 |
|
35 |
function menuClick() {
|
web_assets/stylesheet/ChuanhuChat.css
CHANGED
@@ -11,6 +11,10 @@
|
|
11 |
--switch-checkbox-color-dark: #515151;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
|
|
14 |
.hideK {
|
15 |
display: none;
|
16 |
}
|
@@ -122,25 +126,29 @@
|
|
122 |
width: 100%;
|
123 |
height: 100%;
|
124 |
z-index: 214748368;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
|
|
126 |
#chuanhu-popup {
|
127 |
display: none;
|
128 |
z-index: 2147483689;
|
129 |
-
position: fixed;
|
130 |
-
top: 20px;
|
131 |
-
left: 20px;
|
132 |
-
/*
|
133 |
-
top: 50%;
|
134 |
-
left: 50%;
|
135 |
-
transform: translate(-50%, -50%);
|
136 |
-
*/
|
137 |
width: 680px;
|
138 |
height: 400px;
|
139 |
-
/* overflow: hidden!important; */
|
140 |
-
/* overflow-x: hidden !important; */
|
141 |
padding: 0;
|
142 |
}
|
143 |
-
|
144 |
#chuanhu-popup.showBox {
|
145 |
display: block;
|
146 |
}
|
|
|
11 |
--switch-checkbox-color-dark: #515151;
|
12 |
}
|
13 |
|
14 |
+
body.popup-open {
|
15 |
+
overflow: hidden;
|
16 |
+
}
|
17 |
+
|
18 |
.hideK {
|
19 |
display: none;
|
20 |
}
|
|
|
126 |
width: 100%;
|
127 |
height: 100%;
|
128 |
z-index: 214748368;
|
129 |
+
/* background-color: transparent; */
|
130 |
+
}
|
131 |
+
|
132 |
+
#popup-wrapper {
|
133 |
+
display: none;
|
134 |
+
position: fixed;
|
135 |
+
overflow: auto;
|
136 |
+
top: 0;
|
137 |
+
left: 0;
|
138 |
+
z-index: 2147483689;
|
139 |
+
}
|
140 |
+
#popup-wrapper.showBox {
|
141 |
+
display: grid;
|
142 |
+
place-items: center;
|
143 |
}
|
144 |
+
|
145 |
#chuanhu-popup {
|
146 |
display: none;
|
147 |
z-index: 2147483689;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
width: 680px;
|
149 |
height: 400px;
|
|
|
|
|
150 |
padding: 0;
|
151 |
}
|
|
|
152 |
#chuanhu-popup.showBox {
|
153 |
display: block;
|
154 |
}
|