Spaces:
Sleeping
Sleeping
Merge branch 'UI-new' into main (#873)
Browse files- ChuanhuChatbot.py +543 -305
- config_example.json +2 -1
- locale/en_US.json +61 -4
- locale/ja_JP.json +60 -3
- locale/ko_KR.json +58 -3
- locale/ru_RU.json +89 -59
- locale/sv_SE.json +141 -84
- modules/config.py +4 -2
- modules/models/base_model.py +62 -31
- modules/models/models.py +54 -2
- modules/presets.py +17 -0
- modules/utils.py +60 -48
- modules/webui.py +14 -1
- requirements.txt +2 -1
- web_assets/html/chatbot_header_btn.html +65 -0
- web_assets/html/chatbot_more.html +72 -0
- web_assets/html/close_btn.html +5 -0
- web_assets/html/config_info.html +0 -2
- web_assets/html/func_nav.html +78 -0
- web_assets/html/header_title.html +20 -0
- web_assets/html/web_config.html +19 -0
- web_assets/icon/any-icon-512.png +0 -0
- web_assets/icon/mask-icon-512.png +0 -0
- web_assets/javascript/ChuanhuChat.js +171 -29
- web_assets/javascript/chat-history.js +14 -3
- web_assets/javascript/chat-list.js +72 -0
- web_assets/javascript/fake-gradio.js +111 -0
- web_assets/javascript/localization.js +23 -65
- web_assets/javascript/message-button.js +109 -9
- web_assets/javascript/updater.js +19 -9
- web_assets/javascript/user-info.js +24 -21
- web_assets/javascript/utils.js +56 -21
- web_assets/javascript/webui.js +303 -0
- web_assets/manifest.json +22 -0
- web_assets/stylesheet/ChuanhuChat.css +1061 -8
- web_assets/stylesheet/chatbot.css +117 -17
- web_assets/stylesheet/custom-components.css +134 -6
- web_assets/stylesheet/override-gradio.css +90 -1
ChuanhuChatbot.py
CHANGED
@@ -1,22 +1,21 @@
|
|
1 |
# -*- coding:utf-8 -*-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import logging
|
3 |
logging.basicConfig(
|
4 |
level=logging.INFO,
|
5 |
format="%(asctime)s [%(levelname)s] [%(filename)s:%(lineno)d] %(message)s",
|
6 |
)
|
7 |
|
8 |
-
import colorama
|
9 |
-
import gradio as gr
|
10 |
-
|
11 |
-
from modules import config
|
12 |
-
from modules.config import *
|
13 |
-
from modules.utils import *
|
14 |
-
from modules.presets import *
|
15 |
-
from modules.overwrites import *
|
16 |
-
from modules.webui import *
|
17 |
-
from modules.repo import *
|
18 |
-
from modules.train_func import *
|
19 |
-
from modules.models.models import get_model
|
20 |
|
21 |
logging.getLogger("httpx").setLevel(logging.WARNING)
|
22 |
|
@@ -26,25 +25,28 @@ gr.Chatbot.postprocess = postprocess
|
|
26 |
# with open("web_assets/css/ChuanhuChat.css", "r", encoding="utf-8") as f:
|
27 |
# ChuanhuChatCSS = f.read()
|
28 |
|
|
|
29 |
def create_new_model():
|
30 |
-
return get_model(model_name
|
|
|
31 |
|
32 |
with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
33 |
-
user_name = gr.
|
34 |
promptTemplates = gr.State(load_template(get_template_names()[0], mode=2))
|
35 |
user_question = gr.State("")
|
36 |
-
assert type(my_api_key)==str
|
37 |
user_api_key = gr.State(my_api_key)
|
38 |
-
current_model = gr.State(
|
39 |
|
40 |
topic = gr.State(i18n("未命名对话历史记录"))
|
41 |
|
42 |
-
with gr.Row():
|
43 |
-
gr.HTML(
|
|
|
44 |
status_display = gr.Markdown(get_geoip(), elem_id="status-display")
|
45 |
with gr.Row(elem_id="float-display"):
|
46 |
-
user_info = gr.Markdown(
|
47 |
-
|
48 |
update_info = gr.HTML(get_html("update.html").format(
|
49 |
current_version=repo_tag_html(),
|
50 |
version_time=version_time(),
|
@@ -52,248 +54,337 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
52 |
update_btn=i18n("更新"),
|
53 |
seenew_btn=i18n("详情"),
|
54 |
ok_btn=i18n("好"),
|
55 |
-
|
56 |
-
|
57 |
-
with gr.Row(equal_height=True):
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
model_select_dropdown = gr.Dropdown(
|
104 |
-
label=i18n("选择模型"), choices=MODELS, multiselect=False, value=MODELS[DEFAULT_MODEL], interactive=True
|
|
|
105 |
)
|
106 |
lora_select_dropdown = gr.Dropdown(
|
107 |
-
label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False
|
108 |
-
|
109 |
-
with gr.Row():
|
110 |
-
single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False, elem_classes="switch-checkbox")
|
111 |
-
use_websearch_checkbox = gr.Checkbox(label=i18n("使用在线搜索"), value=False, elem_classes="switch-checkbox")
|
112 |
-
language_select_dropdown = gr.Dropdown(
|
113 |
-
label=i18n("选择回复语言(针对搜索&索引功能)"),
|
114 |
-
choices=REPLY_LANGUAGES,
|
115 |
-
multiselect=False,
|
116 |
-
value=REPLY_LANGUAGES[0],
|
117 |
)
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
)
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
)
|
143 |
-
with gr.Column(scale=1):
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
with gr.Column():
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
show_label=True,
|
243 |
-
placeholder=
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
247 |
)
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
)
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
|
|
|
|
|
|
|
|
263 |
)
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
label="presence penalty",
|
271 |
)
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
step=0.01,
|
277 |
interactive=True,
|
278 |
-
|
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.
|
296 |
-
gr.Markdown(
|
|
|
297 |
default_btn = gr.Button(i18n("🔙 恢复默认网络设置"))
|
298 |
# 网络代理
|
299 |
proxyTxt = gr.Textbox(
|
@@ -319,25 +410,97 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
319 |
# container=False,
|
320 |
elem_classes="view-only-textbox no-container",
|
321 |
)
|
322 |
-
# changeAPIURLBtn = gr.Button(i18n("🔄 切换API地址"))
|
323 |
-
updateChuanhuBtn = gr.Button(visible=False, elem_classes="invisible-btn", elem_id="update-chuanhu-btn")
|
324 |
|
325 |
-
|
326 |
-
|
327 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
|
329 |
# https://github.com/gradio-app/gradio/pull/3296
|
|
|
330 |
def create_greeting(request: gr.Request):
|
331 |
-
if hasattr(request, "username") and request.username:
|
332 |
logging.info(f"Get User Name: {request.username}")
|
333 |
-
user_info, user_name = gr.Markdown.update(
|
|
|
334 |
else:
|
335 |
-
user_info, user_name = gr.Markdown.update(
|
336 |
-
|
|
|
|
|
337 |
current_model.set_user_identifier(user_name)
|
338 |
-
|
339 |
-
|
340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
chatgpt_predict_args = dict(
|
342 |
fn=predict,
|
343 |
inputs=[
|
@@ -369,40 +532,56 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
369 |
)
|
370 |
|
371 |
transfer_input_args = dict(
|
372 |
-
fn=transfer_input, inputs=[user_input], outputs=[
|
|
|
373 |
)
|
374 |
|
375 |
get_usage_args = dict(
|
376 |
-
fn=billing_info, inputs=[current_model], outputs=[
|
|
|
377 |
)
|
378 |
|
379 |
load_history_from_file_args = dict(
|
380 |
fn=load_chat_history,
|
381 |
-
inputs=[current_model,
|
382 |
outputs=[saveFileName, systemPromptTxt, chatbot]
|
383 |
)
|
384 |
|
385 |
refresh_history_args = dict(
|
386 |
-
fn=
|
387 |
)
|
388 |
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
|
390 |
# Chatbot
|
391 |
cancelBtn.click(interrupt, [current_model], [])
|
392 |
|
393 |
-
user_input.submit(**transfer_input_args).then(**
|
|
|
394 |
user_input.submit(**get_usage_args)
|
395 |
|
396 |
-
|
|
|
|
|
|
|
397 |
submitBtn.click(**get_usage_args)
|
398 |
|
399 |
-
|
400 |
-
|
|
|
|
|
|
|
|
|
401 |
|
402 |
emptyBtn.click(
|
403 |
reset,
|
404 |
inputs=[current_model],
|
405 |
-
outputs=[chatbot, status_display],
|
406 |
show_progress=True,
|
407 |
_js='clearChatbot',
|
408 |
)
|
@@ -452,16 +631,23 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
452 |
two_column.change(update_doc_config, [two_column], None)
|
453 |
|
454 |
# LLM Models
|
455 |
-
keyTxt.change(set_key, [current_model, keyTxt], [
|
|
|
456 |
keyTxt.submit(**get_usage_args)
|
457 |
-
single_turn_checkbox.change(
|
458 |
-
|
459 |
-
model_select_dropdown.change(
|
460 |
-
|
|
|
|
|
|
|
|
|
461 |
|
462 |
# Template
|
463 |
-
systemPromptTxt.change(set_system_prompt, [
|
464 |
-
|
|
|
|
|
465 |
templateFileSelectDropdown.input(
|
466 |
load_template,
|
467 |
[templateFileSelectDropdown],
|
@@ -476,47 +662,80 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
476 |
)
|
477 |
|
478 |
# S&L
|
479 |
-
|
480 |
-
|
481 |
[current_model, saveFileName, chatbot, user_name],
|
482 |
-
|
483 |
show_progress=True,
|
|
|
484 |
)
|
485 |
-
saveHistoryBtn.click(get_history_dropdown, [user_name], [historyFileSelectDropdown])
|
486 |
exportMarkdownBtn.click(
|
487 |
export_markdown,
|
488 |
[current_model, saveFileName, chatbot, user_name],
|
489 |
-
|
490 |
show_progress=True,
|
491 |
)
|
492 |
historyRefreshBtn.click(**refresh_history_args)
|
493 |
-
historyDeleteBtn.click(delete_chat_history, [current_model,
|
494 |
-
|
495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
|
497 |
# Train
|
498 |
-
dataset_selection.upload(handle_dataset_selection, dataset_selection, [
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
|
509 |
# Advanced
|
510 |
-
max_context_length_slider.change(
|
511 |
-
|
|
|
|
|
512 |
top_p_slider.change(set_top_p, [current_model, top_p_slider], None)
|
513 |
-
n_choices_slider.change(
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
|
521 |
default_btn.click(
|
522 |
reset_default, [], [apihostTxt, proxyTxt, status_display], show_progress=True
|
@@ -533,7 +752,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
533 |
# [status_display],
|
534 |
# show_progress=True,
|
535 |
# )
|
536 |
-
checkUpdateBtn.click(fn=None, _js='manualCheckUpdate')
|
537 |
|
538 |
# Invisible elements
|
539 |
updateChuanhuBtn.click(
|
@@ -542,6 +761,25 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
542 |
[status_display],
|
543 |
show_progress=True,
|
544 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
545 |
|
546 |
logging.info(
|
547 |
colorama.Back.GREEN
|
@@ -560,5 +798,5 @@ if __name__ == "__main__":
|
|
560 |
share=share,
|
561 |
auth=auth_from_conf if authflag else None,
|
562 |
favicon_path="./web_assets/favicon.ico",
|
563 |
-
inbrowser=not dockerflag,
|
564 |
)
|
|
|
1 |
# -*- coding:utf-8 -*-
|
2 |
+
from modules.models.models import get_model
|
3 |
+
from modules.train_func import *
|
4 |
+
from modules.repo import *
|
5 |
+
from modules.webui import *
|
6 |
+
from modules.overwrites import *
|
7 |
+
from modules.presets import *
|
8 |
+
from modules.utils import *
|
9 |
+
from modules.config import *
|
10 |
+
from modules import config
|
11 |
+
import gradio as gr
|
12 |
+
import colorama
|
13 |
import logging
|
14 |
logging.basicConfig(
|
15 |
level=logging.INFO,
|
16 |
format="%(asctime)s [%(levelname)s] [%(filename)s:%(lineno)d] %(message)s",
|
17 |
)
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
logging.getLogger("httpx").setLevel(logging.WARNING)
|
21 |
|
|
|
25 |
# with open("web_assets/css/ChuanhuChat.css", "r", encoding="utf-8") as f:
|
26 |
# ChuanhuChatCSS = f.read()
|
27 |
|
28 |
+
|
29 |
def create_new_model():
|
30 |
+
return get_model(model_name=MODELS[DEFAULT_MODEL], access_key=my_api_key)[0]
|
31 |
+
|
32 |
|
33 |
with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
34 |
+
user_name = gr.Textbox("", visible=False)
|
35 |
promptTemplates = gr.State(load_template(get_template_names()[0], mode=2))
|
36 |
user_question = gr.State("")
|
37 |
+
assert type(my_api_key) == str
|
38 |
user_api_key = gr.State(my_api_key)
|
39 |
+
current_model = gr.State()
|
40 |
|
41 |
topic = gr.State(i18n("未命名对话历史记录"))
|
42 |
|
43 |
+
with gr.Row(elem_id="chuanhu-header"):
|
44 |
+
gr.HTML(get_html("header_title.html").format(
|
45 |
+
app_title=CHUANHU_TITLE), elem_id="app-title")
|
46 |
status_display = gr.Markdown(get_geoip(), elem_id="status-display")
|
47 |
with gr.Row(elem_id="float-display"):
|
48 |
+
user_info = gr.Markdown(
|
49 |
+
value="getting user info...", elem_id="user-info")
|
50 |
update_info = gr.HTML(get_html("update.html").format(
|
51 |
current_version=repo_tag_html(),
|
52 |
version_time=version_time(),
|
|
|
54 |
update_btn=i18n("更新"),
|
55 |
seenew_btn=i18n("详情"),
|
56 |
ok_btn=i18n("好"),
|
57 |
+
), visible=check_update)
|
58 |
+
|
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.Row(elem_id="chuanhu-history-search-row"):
|
66 |
+
with gr.Column(min_width=150, scale=2):
|
67 |
+
historySearchTextbox = gr.Textbox(show_label=False, container=False, placeholder=i18n(
|
68 |
+
"搜索(支持正则)..."), lines=1, elem_id="history-search-tb")
|
69 |
+
with gr.Column(min_width=52, scale=1, elem_id="gr-history-header-btns"):
|
70 |
+
uploadFileBtn = gr.UploadButton(
|
71 |
+
interactive=True, label="", file_types=[".json"], elem_id="gr-history-upload-btn")
|
72 |
+
historyRefreshBtn = gr.Button("", elem_id="gr-history-refresh-btn")
|
73 |
+
|
74 |
+
|
75 |
+
with gr.Row(elem_id="chuanhu-history-body"):
|
76 |
+
with gr.Column(scale=6, elem_id="history-select-wrap"):
|
77 |
+
historySelectList = gr.Radio(
|
78 |
+
label=i18n("从列表中加载对话"),
|
79 |
+
choices=get_history_names(),
|
80 |
+
value=get_first_history_name(),
|
81 |
+
# multiselect=False,
|
82 |
+
container=False,
|
83 |
+
elem_id="history-select-dropdown"
|
84 |
+
)
|
85 |
+
with gr.Row(visible=False):
|
86 |
+
with gr.Column(min_width=42, scale=1):
|
87 |
+
historyDeleteBtn = gr.Button(
|
88 |
+
i18n("🗑️"), elem_id="gr-history-delete-btn")
|
89 |
+
with gr.Column(min_width=42, scale=1):
|
90 |
+
historyDownloadBtn = gr.Button(
|
91 |
+
i18n("⏬"), elem_id="gr-history-download-btn")
|
92 |
+
with gr.Column(min_width=42, scale=1):
|
93 |
+
historyMarkdownDownloadBtn = gr.Button(
|
94 |
+
i18n("⤵️"), elem_id="gr-history-mardown-download-btn")
|
95 |
+
with gr.Row(visible=False):
|
96 |
+
with gr.Column(scale=6):
|
97 |
+
saveFileName = gr.Textbox(
|
98 |
+
show_label=True,
|
99 |
+
placeholder=i18n("设置文件名: 默认为.json,可选为.md"),
|
100 |
+
label=i18n("设置保存文件名"),
|
101 |
+
value=i18n("对话历史记录"),
|
102 |
+
elem_classes="no-container"
|
103 |
+
# container=False,
|
104 |
+
)
|
105 |
+
with gr.Column(scale=1):
|
106 |
+
renameHistoryBtn = gr.Button(
|
107 |
+
i18n("💾 Rename Chat"), elem_id="gr-history-save-btn")
|
108 |
+
exportMarkdownBtn = gr.Button(
|
109 |
+
i18n("📝 Export as Markdown"), elem_id="gr-markdown-export-btn")
|
110 |
+
|
111 |
+
with gr.Column(elem_id="chuanhu-menu-footer"):
|
112 |
+
with gr.Row(elem_id="chuanhu-func-nav"):
|
113 |
+
gr.HTML(get_html("func_nav.html"))
|
114 |
+
# gr.HTML(get_html("footer.html").format(versions=versions_html()), elem_id="footer")
|
115 |
+
# gr.Markdown(CHUANHU_DESCRIPTION, elem_id="chuanhu-author")
|
116 |
+
|
117 |
+
with gr.Column(elem_id="chuanhu-area", scale=5):
|
118 |
+
with gr.Column(elem_id="chatbot-area"):
|
119 |
+
with gr.Row(elem_id="chatbot-header"):
|
120 |
model_select_dropdown = gr.Dropdown(
|
121 |
+
label=i18n("选择模型"), choices=MODELS, multiselect=False, value=MODELS[DEFAULT_MODEL], interactive=True,
|
122 |
+
show_label=False, container=False, elem_id="model-select-dropdown"
|
123 |
)
|
124 |
lora_select_dropdown = gr.Dropdown(
|
125 |
+
label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False,
|
126 |
+
container=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
)
|
128 |
+
gr.HTML(get_html("chatbot_header_btn.html").format(
|
129 |
+
json_label=i18n("历史记录(JSON)"),
|
130 |
+
md_label=i18n("导出为 Markdown")
|
131 |
+
), elem_id="chatbot-header-btn-bar")
|
132 |
+
with gr.Row():
|
133 |
+
chatbot = gr.Chatbot(
|
134 |
+
label="Chuanhu Chat",
|
135 |
+
elem_id="chuanhu-chatbot",
|
136 |
+
latex_delimiters=latex_delimiters_set,
|
137 |
+
# height=700,
|
138 |
+
show_label=False,
|
139 |
+
avatar_images=[config.user_avatar, config.bot_avatar],
|
140 |
+
show_share_button=False,
|
141 |
)
|
142 |
+
with gr.Row(elem_id="chatbot-footer"):
|
143 |
+
with gr.Box(elem_id="chatbot-input-box"):
|
144 |
+
with gr.Row(elem_id="chatbot-input-row"):
|
145 |
+
gr.HTML(get_html("chatbot_more.html").format(
|
146 |
+
single_turn_label=i18n("单轮对话"),
|
147 |
+
websearch_label=i18n("在线搜索"),
|
148 |
+
upload_file_label=i18n("上传文件"),
|
149 |
+
uploaded_files_label=i18n("知识库文件"),
|
150 |
+
uploaded_files_tip=i18n("在工具箱中管理知识库文件")
|
151 |
+
))
|
152 |
+
with gr.Row(elem_id="chatbot-input-tb-row"):
|
153 |
+
with gr.Column(min_width=225, scale=12):
|
154 |
+
user_input = gr.Textbox(
|
155 |
+
elem_id="user-input-tb",
|
156 |
+
show_label=False,
|
157 |
+
placeholder=i18n("在这里输入"),
|
158 |
+
elem_classes="no-container",
|
159 |
+
max_lines=5,
|
160 |
+
# container=False
|
161 |
)
|
162 |
+
with gr.Column(min_width=42, scale=1, elem_id="chatbot-ctrl-btns"):
|
163 |
+
submitBtn = gr.Button(
|
164 |
+
value="", variant="primary", elem_id="submit-btn")
|
165 |
+
cancelBtn = gr.Button(
|
166 |
+
value="", variant="secondary", visible=False, elem_id="cancel-btn")
|
167 |
+
# Note: Buttons below are set invisible in UI. But they are used in JS.
|
168 |
+
with gr.Row(elem_id="chatbot-buttons", visible=False):
|
169 |
+
with gr.Column(min_width=120, scale=1):
|
170 |
+
emptyBtn = gr.Button(
|
171 |
+
i18n("🧹 新的对话"), elem_id="empty-btn"
|
172 |
+
)
|
173 |
+
with gr.Column(min_width=120, scale=1):
|
174 |
+
retryBtn = gr.Button(
|
175 |
+
i18n("🔄 重新生成"), elem_id="gr-retry-btn")
|
176 |
+
with gr.Column(min_width=120, scale=1):
|
177 |
+
delFirstBtn = gr.Button(i18n("🗑️ 删除最旧对话"))
|
178 |
+
with gr.Column(min_width=120, scale=1):
|
179 |
+
delLastBtn = gr.Button(
|
180 |
+
i18n("🗑️ 删除最新对话"), elem_id="gr-dellast-btn")
|
181 |
+
with gr.Row(visible=False) as like_dislike_area:
|
182 |
+
with gr.Column(min_width=20, scale=1):
|
183 |
+
likeBtn = gr.Button(
|
184 |
+
i18n("👍"), elem_id="gr-like-btn")
|
185 |
+
with gr.Column(min_width=20, scale=1):
|
186 |
+
dislikeBtn = gr.Button(
|
187 |
+
i18n("👎"), elem_id="gr-dislike-btn")
|
188 |
+
|
189 |
+
with gr.Column(elem_id="toolbox-area", scale=1):
|
190 |
+
# For CSS setting, there is an extra box. Don't remove it.
|
191 |
+
with gr.Box(elem_id="chuanhu-toolbox"):
|
192 |
+
with gr.Row():
|
193 |
+
gr.Markdown("## "+i18n("工具箱"))
|
194 |
+
gr.HTML(get_html("close_btn.html").format(
|
195 |
+
obj="toolbox"), elem_classes="close-btn")
|
196 |
+
with gr.Tabs(elem_id="chuanhu-toolbox-tabs"):
|
197 |
+
with gr.Tab(label=i18n("对话")):
|
198 |
+
with gr.Accordion(label="Prompt", open=True):
|
199 |
+
systemPromptTxt = gr.Textbox(
|
200 |
+
show_label=True,
|
201 |
+
placeholder=i18n("在这里输入System Prompt..."),
|
202 |
+
label="System prompt",
|
203 |
+
value=INITIAL_SYSTEM_PROMPT,
|
204 |
+
lines=8
|
205 |
+
)
|
206 |
+
with gr.Accordion(label=i18n("加载Prompt模板"), open=False):
|
207 |
with gr.Column():
|
208 |
+
with gr.Row():
|
209 |
+
with gr.Column(scale=6):
|
210 |
+
templateFileSelectDropdown = gr.Dropdown(
|
211 |
+
label=i18n("选择Prompt模板集合文件"),
|
212 |
+
choices=get_template_names(),
|
213 |
+
multiselect=False,
|
214 |
+
value=get_template_names()[0],
|
215 |
+
container=False,
|
216 |
+
)
|
217 |
+
with gr.Column(scale=1):
|
218 |
+
templateRefreshBtn = gr.Button(
|
219 |
+
i18n("🔄 刷新"))
|
220 |
+
with gr.Row():
|
221 |
+
with gr.Column():
|
222 |
+
templateSelectDropdown = gr.Dropdown(
|
223 |
+
label=i18n("从Prompt模板中加载"),
|
224 |
+
choices=load_template(
|
225 |
+
get_template_names()[
|
226 |
+
0], mode=1
|
227 |
+
),
|
228 |
+
multiselect=False,
|
229 |
+
container=False,
|
230 |
+
)
|
231 |
+
gr.Markdown("---", elem_classes="hr-line")
|
232 |
+
with gr.Accordion(label=i18n("知识库"), open=True):
|
233 |
+
use_websearch_checkbox = gr.Checkbox(label=i18n(
|
234 |
+
"使用在线搜索"), value=False, elem_classes="switch-checkbox", elem_id="gr-websearch-cb", visible=False)
|
235 |
+
index_files = gr.Files(label=i18n(
|
236 |
+
"上传"), type="file", elem_id="upload-index-file")
|
237 |
+
two_column = gr.Checkbox(label=i18n(
|
238 |
+
"双栏pdf"), value=advance_docs["pdf"].get("two_column", False))
|
239 |
+
summarize_btn = gr.Button(i18n("总结"))
|
240 |
+
# TODO: 公式ocr
|
241 |
+
# formula_ocr = gr.Checkbox(label=i18n("识别公式"), value=advance_docs["pdf"].get("formula_ocr", False))
|
242 |
+
|
243 |
+
with gr.Tab(label=i18n("参数")):
|
244 |
+
gr.Markdown(i18n("# ⚠️ 务必谨慎更改 ⚠️"),
|
245 |
+
elem_id="advanced-warning")
|
246 |
+
with gr.Accordion(i18n("参数"), open=True):
|
247 |
+
temperature_slider = gr.Slider(
|
248 |
+
minimum=-0,
|
249 |
+
maximum=2.0,
|
250 |
+
value=1.0,
|
251 |
+
step=0.1,
|
252 |
+
interactive=True,
|
253 |
+
label="temperature",
|
254 |
+
)
|
255 |
+
top_p_slider = gr.Slider(
|
256 |
+
minimum=-0,
|
257 |
+
maximum=1.0,
|
258 |
+
value=1.0,
|
259 |
+
step=0.05,
|
260 |
+
interactive=True,
|
261 |
+
label="top-p",
|
262 |
+
)
|
263 |
+
n_choices_slider = gr.Slider(
|
264 |
+
minimum=1,
|
265 |
+
maximum=10,
|
266 |
+
value=1,
|
267 |
+
step=1,
|
268 |
+
interactive=True,
|
269 |
+
label="n choices",
|
270 |
+
)
|
271 |
+
stop_sequence_txt = gr.Textbox(
|
272 |
+
show_label=True,
|
273 |
+
placeholder=i18n("停止符,用英文逗号隔开..."),
|
274 |
+
label="stop",
|
275 |
+
value="",
|
276 |
+
lines=1,
|
277 |
+
)
|
278 |
+
max_context_length_slider = gr.Slider(
|
279 |
+
minimum=1,
|
280 |
+
maximum=32768,
|
281 |
+
value=2000,
|
282 |
+
step=1,
|
283 |
+
interactive=True,
|
284 |
+
label="max context",
|
285 |
+
)
|
286 |
+
max_generation_slider = gr.Slider(
|
287 |
+
minimum=1,
|
288 |
+
maximum=32768,
|
289 |
+
value=1000,
|
290 |
+
step=1,
|
291 |
+
interactive=True,
|
292 |
+
label="max generations",
|
293 |
+
)
|
294 |
+
presence_penalty_slider = gr.Slider(
|
295 |
+
minimum=-2.0,
|
296 |
+
maximum=2.0,
|
297 |
+
value=0.0,
|
298 |
+
step=0.01,
|
299 |
+
interactive=True,
|
300 |
+
label="presence penalty",
|
301 |
+
)
|
302 |
+
frequency_penalty_slider = gr.Slider(
|
303 |
+
minimum=-2.0,
|
304 |
+
maximum=2.0,
|
305 |
+
value=0.0,
|
306 |
+
step=0.01,
|
307 |
+
interactive=True,
|
308 |
+
label="frequency penalty",
|
309 |
+
)
|
310 |
+
logit_bias_txt = gr.Textbox(
|
311 |
+
show_label=True,
|
312 |
+
placeholder=f"word:likelihood",
|
313 |
+
label="logit bias",
|
314 |
+
value="",
|
315 |
+
lines=1,
|
316 |
+
)
|
317 |
+
user_identifier_txt = gr.Textbox(
|
318 |
+
show_label=True,
|
319 |
+
placeholder=i18n("用于定位滥用行为"),
|
320 |
+
label=i18n("用户名"),
|
321 |
+
value=user_name.value,
|
322 |
+
lines=1,
|
323 |
+
)
|
324 |
+
with gr.Tab(label=i18n("拓展")):
|
325 |
+
gr.Markdown(
|
326 |
+
"Will be here soon...\n(We hope)\n\nAnd we hope you can help us to make more extensions!")
|
327 |
+
|
328 |
+
# changeAPIURLBtn = gr.Button(i18n("🔄 切换API地址"))
|
329 |
+
|
330 |
+
with gr.Row(elem_id="popup-wrapper"):
|
331 |
+
with gr.Box(elem_id="chuanhu-popup"):
|
332 |
+
with gr.Box(elem_id="chuanhu-setting"):
|
333 |
+
with gr.Row():
|
334 |
+
gr.Markdown("## "+i18n("设置"))
|
335 |
+
gr.HTML(get_html("close_btn.html").format(
|
336 |
+
obj="box"), elem_classes="close-btn")
|
337 |
+
with gr.Tabs(elem_id="chuanhu-setting-tabs"):
|
338 |
+
with gr.Tab(label=i18n("模型")):
|
339 |
+
keyTxt = gr.Textbox(
|
340 |
show_label=True,
|
341 |
+
placeholder=f"Your API-key...",
|
342 |
+
value=hide_middle_chars(user_api_key.value),
|
343 |
+
type="password",
|
344 |
+
visible=not HIDE_MY_KEY,
|
345 |
+
label="API-Key",
|
346 |
)
|
347 |
+
if multi_api_key:
|
348 |
+
usageTxt = gr.Markdown(i18n(
|
349 |
+
"多账号模式已开启,无需输入key,可直接开始对话"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
|
350 |
+
else:
|
351 |
+
usageTxt = gr.Markdown(i18n(
|
352 |
+
"**发送消息** 或 **提交key** 以显示额度"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
|
353 |
+
# model_select_dropdown = gr.Dropdown(
|
354 |
+
# label=i18n("选择模型"), choices=MODELS, multiselect=False, value=MODELS[DEFAULT_MODEL], interactive=True
|
355 |
+
# )
|
356 |
+
# lora_select_dropdown = gr.Dropdown(
|
357 |
+
# label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False
|
358 |
+
# )
|
359 |
+
# with gr.Row():
|
360 |
+
|
361 |
+
language_select_dropdown = gr.Dropdown(
|
362 |
+
label=i18n("选择回复语言(针对搜索&索引功能)"),
|
363 |
+
choices=REPLY_LANGUAGES,
|
364 |
+
multiselect=False,
|
365 |
+
value=REPLY_LANGUAGES[0],
|
366 |
)
|
367 |
+
|
368 |
+
with gr.Tab(label=i18n("高级")):
|
369 |
+
gr.HTML(get_html("appearance_switcher.html").format(
|
370 |
+
label=i18n("切换亮暗色主题")), elem_classes="insert-block", visible=False)
|
371 |
+
use_streaming_checkbox = gr.Checkbox(
|
372 |
+
label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION, elem_classes="switch-checkbox"
|
|
|
373 |
)
|
374 |
+
name_chat_method = gr.Dropdown(
|
375 |
+
label=i18n("对话命名方式"),
|
376 |
+
choices=HISTORY_NAME_METHODS,
|
377 |
+
multiselect=False,
|
|
|
378 |
interactive=True,
|
379 |
+
value=HISTORY_NAME_METHODS[chat_name_method_index],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
)
|
381 |
+
single_turn_checkbox = gr.Checkbox(label=i18n(
|
382 |
+
"单轮对话"), value=False, elem_classes="switch-checkbox", elem_id="gr-single-session-cb", visible=False)
|
383 |
+
# checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."), visible=check_update)
|
384 |
|
385 |
+
with gr.Tab(i18n("网络")):
|
386 |
+
gr.Markdown(
|
387 |
+
i18n("⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置"), elem_id="netsetting-warning")
|
388 |
default_btn = gr.Button(i18n("🔙 恢复默认网络设置"))
|
389 |
# 网络代理
|
390 |
proxyTxt = gr.Textbox(
|
|
|
410 |
# container=False,
|
411 |
elem_classes="view-only-textbox no-container",
|
412 |
)
|
|
|
|
|
413 |
|
414 |
+
with gr.Tab(label=i18n("关于"), elem_id="about-tab"):
|
415 |
+
gr.Markdown(
|
416 |
+
'<img alt="Chuanhu Chat logo" src="file=web_assets/icon/any-icon-512.png" style="max-width: 144px;">')
|
417 |
+
gr.Markdown("# "+i18n("川虎Chat"))
|
418 |
+
gr.HTML(get_html("footer.html").format(
|
419 |
+
versions=versions_html()), elem_id="footer")
|
420 |
+
gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
|
421 |
+
|
422 |
+
with gr.Box(elem_id="chuanhu-training"):
|
423 |
+
with gr.Row():
|
424 |
+
gr.Markdown("## "+i18n("训练"))
|
425 |
+
gr.HTML(get_html("close_btn.html").format(
|
426 |
+
obj="box"), elem_classes="close-btn")
|
427 |
+
with gr.Tabs(elem_id="chuanhu-training-tabs"):
|
428 |
+
with gr.Tab(label="OpenAI "+i18n("微调")):
|
429 |
+
openai_train_status = gr.Markdown(label=i18n("训练状态"), value=i18n(
|
430 |
+
"查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)"))
|
431 |
+
|
432 |
+
with gr.Tab(label=i18n("准备数据集")):
|
433 |
+
dataset_preview_json = gr.JSON(
|
434 |
+
label=i18n("数据集预览"), readonly=True)
|
435 |
+
dataset_selection = gr.Files(label=i18n("选择数据集"), file_types=[
|
436 |
+
".xlsx", ".jsonl"], file_count="single")
|
437 |
+
upload_to_openai_btn = gr.Button(
|
438 |
+
i18n("上传到OpenAI"), variant="primary", interactive=False)
|
439 |
+
|
440 |
+
with gr.Tab(label=i18n("训练")):
|
441 |
+
openai_ft_file_id = gr.Textbox(label=i18n(
|
442 |
+
"文件ID"), value="", lines=1, placeholder=i18n("上传到 OpenAI 后自动填充"))
|
443 |
+
openai_ft_suffix = gr.Textbox(label=i18n(
|
444 |
+
"模型名称后缀"), value="", lines=1, placeholder=i18n("可选,用于区分不同的模型"))
|
445 |
+
openai_train_epoch_slider = gr.Slider(label=i18n(
|
446 |
+
"训练轮数(Epochs)"), minimum=1, maximum=100, value=3, step=1, interactive=True)
|
447 |
+
openai_start_train_btn = gr.Button(
|
448 |
+
i18n("开始训练"), variant="primary", interactive=False)
|
449 |
+
|
450 |
+
with gr.Tab(label=i18n("状态")):
|
451 |
+
openai_status_refresh_btn = gr.Button(i18n("刷新状态"))
|
452 |
+
openai_cancel_all_jobs_btn = gr.Button(
|
453 |
+
i18n("取消所有任务"))
|
454 |
+
add_to_models_btn = gr.Button(
|
455 |
+
i18n("添加训练好的模型到模型列表"), interactive=False)
|
456 |
+
|
457 |
+
with gr.Box(elem_id="web-config", visible=False):
|
458 |
+
gr.HTML(get_html('web_config.html').format(
|
459 |
+
hideHistoryWhenNotLoggedIn_config=hide_history_when_not_logged_in,
|
460 |
+
forView_i18n=i18n("仅供查看"),
|
461 |
+
deleteConfirm_i18n_pref=i18n("你真的要删除 "),
|
462 |
+
deleteConfirm_i18n_suff=i18n(" 吗?"),
|
463 |
+
usingLatest_i18n=i18n("您使用的就是最新版!"),
|
464 |
+
updatingMsg_i18n=i18n("正在尝试更新..."),
|
465 |
+
updateSuccess_i18n=i18n("更新成功,请重启本程序"),
|
466 |
+
updateFailure_i18n=i18n(
|
467 |
+
'更新失败,请尝试<a href="https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新" target="_blank">手动更新</a>'),
|
468 |
+
regenerate_i18n=i18n("重新生成"),
|
469 |
+
deleteRound_i18n=i18n("删除这轮问答"),
|
470 |
+
renameChat_i18n=i18n("重命名该对话"),
|
471 |
+
))
|
472 |
+
with gr.Box(elem_id="fake-gradio-components", visible=False):
|
473 |
+
updateChuanhuBtn = gr.Button(
|
474 |
+
visible=False, elem_classes="invisible-btn", elem_id="update-chuanhu-btn")
|
475 |
+
changeSingleSessionBtn = gr.Button(
|
476 |
+
visible=False, elem_classes="invisible-btn", elem_id="change-single-session-btn")
|
477 |
+
changeOnlineSearchBtn = gr.Button(
|
478 |
+
visible=False, elem_classes="invisible-btn", elem_id="change-online-search-btn")
|
479 |
+
historySelectBtn = gr.Button(
|
480 |
+
visible=False, elem_classes="invisible-btn", elem_id="history-select-btn") # Not used
|
481 |
|
482 |
# https://github.com/gradio-app/gradio/pull/3296
|
483 |
+
|
484 |
def create_greeting(request: gr.Request):
|
485 |
+
if hasattr(request, "username") and request.username: # is not None or is not ""
|
486 |
logging.info(f"Get User Name: {request.username}")
|
487 |
+
user_info, user_name = gr.Markdown.update(
|
488 |
+
value=f"User: {request.username}"), request.username
|
489 |
else:
|
490 |
+
user_info, user_name = gr.Markdown.update(
|
491 |
+
value=f"", visible=False), ""
|
492 |
+
current_model = get_model(
|
493 |
+
model_name=MODELS[DEFAULT_MODEL], access_key=my_api_key)[0]
|
494 |
current_model.set_user_identifier(user_name)
|
495 |
+
if not hide_history_when_not_logged_in or user_name:
|
496 |
+
filename, system_prompt, chatbot = current_model.auto_load()
|
497 |
+
else:
|
498 |
+
system_prompt = gr.update()
|
499 |
+
filename = gr.update()
|
500 |
+
chatbot = gr.Chatbot.update(label=MODELS[DEFAULT_MODEL])
|
501 |
+
return user_info, user_name, current_model, toggle_like_btn_visibility(DEFAULT_MODEL), filename, system_prompt, chatbot, init_history_list(user_name)
|
502 |
+
demo.load(create_greeting, inputs=None, outputs=[
|
503 |
+
user_info, user_name, current_model, like_dislike_area, saveFileName, systemPromptTxt, chatbot, historySelectList], api_name="load")
|
504 |
chatgpt_predict_args = dict(
|
505 |
fn=predict,
|
506 |
inputs=[
|
|
|
532 |
)
|
533 |
|
534 |
transfer_input_args = dict(
|
535 |
+
fn=transfer_input, inputs=[user_input], outputs=[
|
536 |
+
user_question, user_input, submitBtn, cancelBtn], show_progress=True
|
537 |
)
|
538 |
|
539 |
get_usage_args = dict(
|
540 |
+
fn=billing_info, inputs=[current_model], outputs=[
|
541 |
+
usageTxt], show_progress=False
|
542 |
)
|
543 |
|
544 |
load_history_from_file_args = dict(
|
545 |
fn=load_chat_history,
|
546 |
+
inputs=[current_model, historySelectList, user_name],
|
547 |
outputs=[saveFileName, systemPromptTxt, chatbot]
|
548 |
)
|
549 |
|
550 |
refresh_history_args = dict(
|
551 |
+
fn=get_history_list, inputs=[user_name], outputs=[historySelectList]
|
552 |
)
|
553 |
|
554 |
+
auto_name_chat_history_args = dict(
|
555 |
+
fn=auto_name_chat_history,
|
556 |
+
inputs=[current_model, name_chat_method, user_question, chatbot, user_name, language_select_dropdown],
|
557 |
+
outputs=[historySelectList],
|
558 |
+
show_progress=False,
|
559 |
+
)
|
560 |
|
561 |
# Chatbot
|
562 |
cancelBtn.click(interrupt, [current_model], [])
|
563 |
|
564 |
+
user_input.submit(**transfer_input_args).then(**
|
565 |
+
chatgpt_predict_args).then(**end_outputing_args).then(**auto_name_chat_history_args)
|
566 |
user_input.submit(**get_usage_args)
|
567 |
|
568 |
+
# user_input.submit(auto_name_chat_history, [current_model, user_question, chatbot, user_name], [historySelectList], show_progress=False)
|
569 |
+
|
570 |
+
submitBtn.click(**transfer_input_args).then(**chatgpt_predict_args,
|
571 |
+
api_name="predict").then(**end_outputing_args).then(**auto_name_chat_history_args)
|
572 |
submitBtn.click(**get_usage_args)
|
573 |
|
574 |
+
# submitBtn.click(auto_name_chat_history, [current_model, user_question, chatbot, user_name], [historySelectList], show_progress=False)
|
575 |
+
|
576 |
+
index_files.change(handle_file_upload, [current_model, index_files, chatbot, language_select_dropdown], [
|
577 |
+
index_files, chatbot, status_display])
|
578 |
+
summarize_btn.click(handle_summarize_index, [
|
579 |
+
current_model, index_files, chatbot, language_select_dropdown], [chatbot, status_display])
|
580 |
|
581 |
emptyBtn.click(
|
582 |
reset,
|
583 |
inputs=[current_model],
|
584 |
+
outputs=[chatbot, status_display, historySelectList],
|
585 |
show_progress=True,
|
586 |
_js='clearChatbot',
|
587 |
)
|
|
|
631 |
two_column.change(update_doc_config, [two_column], None)
|
632 |
|
633 |
# LLM Models
|
634 |
+
keyTxt.change(set_key, [current_model, keyTxt], [
|
635 |
+
user_api_key, status_display], api_name="set_key").then(**get_usage_args)
|
636 |
keyTxt.submit(**get_usage_args)
|
637 |
+
single_turn_checkbox.change(
|
638 |
+
set_single_turn, [current_model, single_turn_checkbox], None)
|
639 |
+
model_select_dropdown.change(get_model, [model_select_dropdown, lora_select_dropdown, user_api_key, temperature_slider, top_p_slider, systemPromptTxt, user_name], [
|
640 |
+
current_model, status_display, chatbot, lora_select_dropdown, user_api_key, keyTxt], show_progress=True, api_name="get_model")
|
641 |
+
model_select_dropdown.change(toggle_like_btn_visibility, [model_select_dropdown], [
|
642 |
+
like_dislike_area], show_progress=False)
|
643 |
+
lora_select_dropdown.change(get_model, [model_select_dropdown, lora_select_dropdown, user_api_key, temperature_slider,
|
644 |
+
top_p_slider, systemPromptTxt, user_name], [current_model, status_display, chatbot], show_progress=True)
|
645 |
|
646 |
# Template
|
647 |
+
systemPromptTxt.change(set_system_prompt, [
|
648 |
+
current_model, systemPromptTxt], None)
|
649 |
+
templateRefreshBtn.click(get_template_dropdown, None, [
|
650 |
+
templateFileSelectDropdown])
|
651 |
templateFileSelectDropdown.input(
|
652 |
load_template,
|
653 |
[templateFileSelectDropdown],
|
|
|
662 |
)
|
663 |
|
664 |
# S&L
|
665 |
+
renameHistoryBtn.click(
|
666 |
+
rename_chat_history,
|
667 |
[current_model, saveFileName, chatbot, user_name],
|
668 |
+
[historySelectList],
|
669 |
show_progress=True,
|
670 |
+
_js='(a,b,c,d)=>{return saveChatHistory(a,b,c,d);}'
|
671 |
)
|
|
|
672 |
exportMarkdownBtn.click(
|
673 |
export_markdown,
|
674 |
[current_model, saveFileName, chatbot, user_name],
|
675 |
+
[],
|
676 |
show_progress=True,
|
677 |
)
|
678 |
historyRefreshBtn.click(**refresh_history_args)
|
679 |
+
historyDeleteBtn.click(delete_chat_history, [current_model, historySelectList, user_name], [status_display, historySelectList, chatbot], _js='(a,b,c)=>{return showConfirmationDialog(a, b, c);}').then(
|
680 |
+
reset,
|
681 |
+
inputs=[current_model],
|
682 |
+
outputs=[chatbot, status_display, historySelectList],
|
683 |
+
show_progress=True,
|
684 |
+
_js='clearChatbot',
|
685 |
+
)
|
686 |
+
historySelectList.input(**load_history_from_file_args)
|
687 |
+
uploadFileBtn.upload(upload_chat_history, [current_model, uploadFileBtn, user_name], [
|
688 |
+
saveFileName, systemPromptTxt, chatbot]).then(**refresh_history_args)
|
689 |
+
historyDownloadBtn.click(None, [
|
690 |
+
user_name, historySelectList], None, _js='(a,b)=>{return downloadHistory(a,b,".json");}')
|
691 |
+
historyMarkdownDownloadBtn.click(None, [
|
692 |
+
user_name, historySelectList], None, _js='(a,b)=>{return downloadHistory(a,b,".md");}')
|
693 |
+
historySearchTextbox.input(
|
694 |
+
filter_history,
|
695 |
+
[user_name, historySearchTextbox],
|
696 |
+
[historySelectList]
|
697 |
+
)
|
698 |
|
699 |
# Train
|
700 |
+
dataset_selection.upload(handle_dataset_selection, dataset_selection, [
|
701 |
+
dataset_preview_json, upload_to_openai_btn, openai_train_status])
|
702 |
+
dataset_selection.clear(handle_dataset_clear, [], [
|
703 |
+
dataset_preview_json, upload_to_openai_btn])
|
704 |
+
upload_to_openai_btn.click(upload_to_openai, [dataset_selection], [
|
705 |
+
openai_ft_file_id, openai_train_status], show_progress=True)
|
706 |
+
|
707 |
+
openai_ft_file_id.change(lambda x: gr.update(interactive=True) if len(
|
708 |
+
x) > 0 else gr.update(interactive=False), [openai_ft_file_id], [openai_start_train_btn])
|
709 |
+
openai_start_train_btn.click(start_training, [
|
710 |
+
openai_ft_file_id, openai_ft_suffix, openai_train_epoch_slider], [openai_train_status])
|
711 |
+
|
712 |
+
openai_status_refresh_btn.click(get_training_status, [], [
|
713 |
+
openai_train_status, add_to_models_btn])
|
714 |
+
add_to_models_btn.click(add_to_models, [], [
|
715 |
+
model_select_dropdown, openai_train_status], show_progress=True)
|
716 |
+
openai_cancel_all_jobs_btn.click(
|
717 |
+
cancel_all_jobs, [], [openai_train_status], show_progress=True)
|
718 |
|
719 |
# Advanced
|
720 |
+
max_context_length_slider.change(
|
721 |
+
set_token_upper_limit, [current_model, max_context_length_slider], None)
|
722 |
+
temperature_slider.change(
|
723 |
+
set_temperature, [current_model, temperature_slider], None)
|
724 |
top_p_slider.change(set_top_p, [current_model, top_p_slider], None)
|
725 |
+
n_choices_slider.change(
|
726 |
+
set_n_choices, [current_model, n_choices_slider], None)
|
727 |
+
stop_sequence_txt.change(
|
728 |
+
set_stop_sequence, [current_model, stop_sequence_txt], None)
|
729 |
+
max_generation_slider.change(
|
730 |
+
set_max_tokens, [current_model, max_generation_slider], None)
|
731 |
+
presence_penalty_slider.change(
|
732 |
+
set_presence_penalty, [current_model, presence_penalty_slider], None)
|
733 |
+
frequency_penalty_slider.change(
|
734 |
+
set_frequency_penalty, [current_model, frequency_penalty_slider], None)
|
735 |
+
logit_bias_txt.change(
|
736 |
+
set_logit_bias, [current_model, logit_bias_txt], None)
|
737 |
+
user_identifier_txt.change(set_user_identifier, [
|
738 |
+
current_model, user_identifier_txt], None)
|
739 |
|
740 |
default_btn.click(
|
741 |
reset_default, [], [apihostTxt, proxyTxt, status_display], show_progress=True
|
|
|
752 |
# [status_display],
|
753 |
# show_progress=True,
|
754 |
# )
|
755 |
+
# checkUpdateBtn.click(fn=None, _js='manualCheckUpdate')
|
756 |
|
757 |
# Invisible elements
|
758 |
updateChuanhuBtn.click(
|
|
|
761 |
[status_display],
|
762 |
show_progress=True,
|
763 |
)
|
764 |
+
changeSingleSessionBtn.click(
|
765 |
+
fn=lambda value: gr.Checkbox.update(value=value),
|
766 |
+
inputs=[single_turn_checkbox],
|
767 |
+
outputs=[single_turn_checkbox],
|
768 |
+
_js='(a)=>{return bgChangeSingleSession(a);}'
|
769 |
+
)
|
770 |
+
changeOnlineSearchBtn.click(
|
771 |
+
fn=lambda value: gr.Checkbox.update(value=value),
|
772 |
+
inputs=[use_websearch_checkbox],
|
773 |
+
outputs=[use_websearch_checkbox],
|
774 |
+
_js='(a)=>{return bgChangeOnlineSearch(a);}'
|
775 |
+
)
|
776 |
+
historySelectBtn.click( # This is an experimental feature... Not actually used.
|
777 |
+
fn=load_chat_history,
|
778 |
+
inputs=[current_model, historySelectList],
|
779 |
+
outputs=[saveFileName, systemPromptTxt, chatbot],
|
780 |
+
_js='(a,b)=>{return bgSelectHistory(a,b);}'
|
781 |
+
)
|
782 |
+
|
783 |
|
784 |
logging.info(
|
785 |
colorama.Back.GREEN
|
|
|
798 |
share=share,
|
799 |
auth=auth_from_conf if authflag else None,
|
800 |
favicon_path="./web_assets/favicon.ico",
|
801 |
+
inbrowser=not dockerflag, # 禁止在docker下开启inbrowser
|
802 |
)
|
config_example.json
CHANGED
@@ -26,12 +26,13 @@
|
|
26 |
"azure_embedding_model_name": "text-embedding-ada-002", // 你的 Azure OpenAI Embedding 模型名称
|
27 |
|
28 |
//== 基础配置 ==
|
29 |
-
"language": "auto", // 界面语言,可选"auto", "
|
30 |
"users": [], // 用户列表,[[用户名1, 密码1], [用户名2, 密码2], ...]
|
31 |
"local_embedding": false, //是否在本地编制索引
|
32 |
"hide_history_when_not_logged_in": false, //未登录情况下是否不展示对话历史
|
33 |
"check_update": true, //是否启用检查更新
|
34 |
"default_model": "gpt-3.5-turbo", // 默认模型
|
|
|
35 |
"bot_avatar": "default", // 机器人头像,可填写本地或网络图片链接,或者"none"(不显示头像)
|
36 |
"user_avatar": "default", // 用户头像,可填写本地或网络图片链接,或者"none"(不显示头像)
|
37 |
|
|
|
26 |
"azure_embedding_model_name": "text-embedding-ada-002", // 你的 Azure OpenAI Embedding 模型名称
|
27 |
|
28 |
//== 基础配置 ==
|
29 |
+
"language": "auto", // 界面语言,可选"auto", "zh_CN", "en_US", "ja_JP", "ko_KR", "sv_SE", "ru_RU"
|
30 |
"users": [], // 用户列表,[[用户名1, 密码1], [用户名2, 密码2], ...]
|
31 |
"local_embedding": false, //是否在本地编制索引
|
32 |
"hide_history_when_not_logged_in": false, //未登录情况下是否不展示对话历史
|
33 |
"check_update": true, //是否启用检查更新
|
34 |
"default_model": "gpt-3.5-turbo", // 默认模型
|
35 |
+
"chat_name_method_index": 0, // 选择对话名称的方法。0: 使用日期时间命名;1: 使用第一条提问命名,2: 使用模型自动总结
|
36 |
"bot_avatar": "default", // 机器人头像,可填写本地或网络图片链接,或者"none"(不显示头像)
|
37 |
"user_avatar": "default", // 用户头像,可填写本地或网络图片链接,或者"none"(不显示头像)
|
38 |
|
locale/en_US.json
CHANGED
@@ -1,17 +1,22 @@
|
|
1 |
{
|
|
|
|
|
2 |
"未命名对话历史记录": "Unnamed Dialog History",
|
3 |
"在这里输入": "Type in here",
|
4 |
"🧹 新的对话": "🧹 New Dialogue",
|
5 |
"🔄 重新生成": "🔄 Regeneration",
|
6 |
"🗑️ 删除最旧对话": "🗑️ Delete oldest dialog",
|
7 |
"🗑️ 删除最新对话": "🗑️ Delete latest dialog",
|
|
|
|
|
|
|
8 |
"模型": "Model",
|
9 |
"多账号模式已开启,无需输入key,可直接开始对话": "Multi-account mode is enabled, no need to enter key, you can start the dialogue directly",
|
10 |
"**发送消息** 或 **提交key** 以显示额度": "**Send message** or **Submit key** to display credit",
|
11 |
"选择模型": "Select Model",
|
12 |
"选择LoRA模型": "Select LoRA Model",
|
13 |
"实时传输回答": "Stream output",
|
14 |
-
"单轮对话": "Single-turn
|
15 |
"使用在线搜索": "Use online search",
|
16 |
"选择回复语言(针对搜索&索引功能)": "Select reply language (for search & index)",
|
17 |
"上传索引文件": "Upload",
|
@@ -30,7 +35,10 @@
|
|
30 |
"对话历史记录": "Dialog History",
|
31 |
"💾 保存对话": "💾 Save Dialog",
|
32 |
"📝 导出为Markdown": "📝 Export as Markdown",
|
|
|
|
|
33 |
"默认保存于history文件夹": "Default save in history folder",
|
|
|
34 |
"高级": "Advanced",
|
35 |
"# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Caution: Changes require care. ⚠️",
|
36 |
"参数": "Parameters",
|
@@ -43,14 +51,20 @@
|
|
43 |
"代理地址": "Proxy address",
|
44 |
"🔄 设置代理地址": "🔄 Set Proxy Address",
|
45 |
"🔙 恢复默认网络设置": "🔙 Reset Network Settings",
|
|
|
|
|
|
|
|
|
46 |
"🔄 检查更新...": "🔄 Check for Update...",
|
|
|
|
|
47 |
"取消": "Cancel",
|
48 |
"更新": "Update",
|
49 |
"详情": "Details",
|
50 |
"好": "OK",
|
51 |
"更新成功,请重启本程序": "Updated successfully, please restart this program",
|
52 |
"更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Update failed, please try [manually updating](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)",
|
53 |
-
"
|
54 |
"开始实时传输回答……": "Start streaming output...",
|
55 |
"Token 计数: ": "Token Count: ",
|
56 |
",本次对话累计消耗了 ": ", Total cost for this dialogue is ",
|
@@ -81,7 +95,50 @@
|
|
81 |
"您的IP区域:": "Your IP region: ",
|
82 |
"总结": "Summarize",
|
83 |
"生成内容总结中……": "Generating content summary...",
|
|
|
84 |
"由于下面的原因,Google 拒绝返回 PaLM 的回答:\n\n": "Due to the following reasons, Google refuses to provide an answer to PaLM: \n\n",
|
85 |
-
"
|
86 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
|
|
1 |
{
|
2 |
+
"川虎Chat 🚀": "Chuanhu Chat 🚀",
|
3 |
+
"川虎Chat": "Chuanhu Chat",
|
4 |
"未命名对话历史记录": "Unnamed Dialog History",
|
5 |
"在这里输入": "Type in here",
|
6 |
"🧹 新的对话": "🧹 New Dialogue",
|
7 |
"🔄 重新生成": "🔄 Regeneration",
|
8 |
"🗑️ 删除最旧对话": "🗑️ Delete oldest dialog",
|
9 |
"🗑️ 删除最新对话": "🗑️ Delete latest dialog",
|
10 |
+
"🗑️ 删除": "🗑️ Delete",
|
11 |
+
"重新生成": "Regenerate",
|
12 |
+
"删除这轮问答": "Delete this round of Q&A",
|
13 |
"模型": "Model",
|
14 |
"多账号模式已开启,无需输入key,可直接开始对话": "Multi-account mode is enabled, no need to enter key, you can start the dialogue directly",
|
15 |
"**发送消息** 或 **提交key** 以显示额度": "**Send message** or **Submit key** to display credit",
|
16 |
"选择模型": "Select Model",
|
17 |
"选择LoRA模型": "Select LoRA Model",
|
18 |
"实时传输回答": "Stream output",
|
19 |
+
"单轮对话": "Single-turn",
|
20 |
"使用在线搜索": "Use online search",
|
21 |
"选择回复语言(针对搜索&索引功能)": "Select reply language (for search & index)",
|
22 |
"上传索引文件": "Upload",
|
|
|
35 |
"对话历史记录": "Dialog History",
|
36 |
"💾 保存对话": "💾 Save Dialog",
|
37 |
"📝 导出为Markdown": "📝 Export as Markdown",
|
38 |
+
"历史记录(JSON)": "History file (JSON)",
|
39 |
+
"导出为 Markdown": "Export as Markdown",
|
40 |
"默认保存于history文件夹": "Default save in history folder",
|
41 |
+
"下载/上传历史记录": "Download/Upload History",
|
42 |
"高级": "Advanced",
|
43 |
"# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Caution: Changes require care. ⚠️",
|
44 |
"参数": "Parameters",
|
|
|
51 |
"代理地址": "Proxy address",
|
52 |
"🔄 设置代理地址": "🔄 Set Proxy Address",
|
53 |
"🔙 恢复默认网络设置": "🔙 Reset Network Settings",
|
54 |
+
"仅供查看": "For viewing only",
|
55 |
+
"你真的要删除 ": "Are you sure you want to delete ",
|
56 |
+
" 吗?": " ?",
|
57 |
+
"重命名该对话": "Rename this chat",
|
58 |
"🔄 检查更新...": "🔄 Check for Update...",
|
59 |
+
"您使用的就是最新版!": "You are using the latest version!",
|
60 |
+
"正在尝试更新...": "Trying to update...",
|
61 |
"取消": "Cancel",
|
62 |
"更新": "Update",
|
63 |
"详情": "Details",
|
64 |
"好": "OK",
|
65 |
"更新成功,请重启本程序": "Updated successfully, please restart this program",
|
66 |
"更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Update failed, please try [manually updating](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)",
|
67 |
+
"更新失败,请尝试<a href=\"https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新\" target=\"_blank\">手动更新</a>。": "Update failed, please try <a href=\"https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新\" target=\"_blank\">manually updating</a>.",
|
68 |
"开始实时传输回答……": "Start streaming output...",
|
69 |
"Token 计数: ": "Token Count: ",
|
70 |
",本次对话累计消耗了 ": ", Total cost for this dialogue is ",
|
|
|
95 |
"您的IP区域:": "Your IP region: ",
|
96 |
"总结": "Summarize",
|
97 |
"生成内容总结中……": "Generating content summary...",
|
98 |
+
"上传": "Upload",
|
99 |
"由于下面的原因,Google 拒绝返回 PaLM 的回答:\n\n": "Due to the following reasons, Google refuses to provide an answer to PaLM: \n\n",
|
100 |
+
"⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ To ensure the security of API-Key, please modify the network settings in the configuration file `config.json`.",
|
101 |
+
"网络": "Network",
|
102 |
+
"暂时未知": "Unknown",
|
103 |
+
|
104 |
+
"剩余配额不足,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/常见问题#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)": "Insufficient remaining quota, [learn more](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/常见问题#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)",
|
105 |
+
"你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)": "You do not have permission to access GPT-4, [learn more](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)",
|
106 |
+
"请查看 config_example.json,配置 Azure OpenAI": "Please review config_example.json to configure Azure OpenAI",
|
107 |
+
|
108 |
+
"微调": "Fine-tuning",
|
109 |
+
"训练状态": "Training Status",
|
110 |
+
"查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使��教程#微调-gpt-35)": "View the [usage guide](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) for more details",
|
111 |
+
"准备数据集": "Prepare Dataset",
|
112 |
+
"数据集预览": "Dataset Preview",
|
113 |
+
"选择数据集": "Select Dataset",
|
114 |
+
"上传到OpenAI": "Upload to OpenAI",
|
115 |
+
"文件ID": "File ID",
|
116 |
+
"上传到 OpenAI 后自动填充": "Automatically filled after uploading to OpenAI",
|
117 |
+
"模型名称后缀": "Model Name Suffix",
|
118 |
+
"可选,用于区分不同的模型": "Optional, used to distinguish different models",
|
119 |
+
"训练轮数(Epochs)": "Training Epochs",
|
120 |
+
"开始训练": "Start Training",
|
121 |
+
"状态": "Status",
|
122 |
+
"刷新状态": "Refresh Status",
|
123 |
+
"取消所有任务": "Cancel All Tasks",
|
124 |
+
"添加训练好的模型到模型列表": "Add trained model to the model list",
|
125 |
+
|
126 |
+
"设置": "Settings",
|
127 |
+
"训练": "Training",
|
128 |
+
"工具箱": "Toolbox",
|
129 |
+
"对话": "Dialogue",
|
130 |
+
"拓展": "Extensions",
|
131 |
+
"上传文件": "Upload files",
|
132 |
+
"知识库": "Knowledge base",
|
133 |
+
"知识库文件": "Knowledge base files",
|
134 |
+
"在工具箱中管理知识库文件": "Manage knowledge base files in the toolbox",
|
135 |
+
"在线搜索": "Web search",
|
136 |
+
"关于": "About",
|
137 |
+
"新对话 ": "New Chat ",
|
138 |
+
"搜索(支持正则)...": "Search (supports regex)...",
|
139 |
+
|
140 |
+
"对话命名方式": "History naming method",
|
141 |
+
"根据日期时间": "By date and time",
|
142 |
+
"第一条提问": "By first question",
|
143 |
+
"模型自动总结(消耗tokens)": "Auto summary by LLM (Consume tokens)"
|
144 |
}
|
locale/ja_JP.json
CHANGED
@@ -1,10 +1,15 @@
|
|
1 |
{
|
|
|
|
|
2 |
"未命名对话历史记录": "名無しの会話履歴",
|
3 |
"在这里输入": "ここに入力",
|
4 |
"🧹 新的对话": "🧹 新しい会話",
|
5 |
"🔄 重新生成": "🔄 再生成",
|
6 |
"🗑️ 删除最旧对话": "🗑️ 最古の会話削除",
|
7 |
"🗑️ 删除最新对话": "🗑️ 最新の会話削除",
|
|
|
|
|
|
|
8 |
"模型": "LLMモデル",
|
9 |
"多账号模式已开启,无需输入key,可直接开始对话": "複数アカウントモードがオンになっています。キーを入力する必要はありません。会話を開始できます",
|
10 |
"**发送消息** 或 **提交key** 以显示额度": "**メッセージを送信** または **キーを送信** して、クレジットを表示します",
|
@@ -30,7 +35,10 @@
|
|
30 |
"对话历史记录": "会話履歴",
|
31 |
"💾 保存对话": "💾 会話を保存",
|
32 |
"📝 导出为Markdown": "📝 Markdownでエクスポート",
|
|
|
|
|
33 |
"默认保存于history文件夹": "デフォルトでhistoryフォルダに保存されます",
|
|
|
34 |
"高级": "Advanced",
|
35 |
"# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ 変更には慎重に ⚠️",
|
36 |
"参数": "パラメータ",
|
@@ -43,14 +51,20 @@
|
|
43 |
"代理地址": "プロキシアドレス",
|
44 |
"🔄 设置代理地址": "🔄 プロキシアドレスを設定",
|
45 |
"🔙 恢复默认网络设置": "🔙 ネットワーク設定のリセット",
|
|
|
|
|
|
|
|
|
46 |
"🔄 检查更新...": "🔄 アップデートをチェック...",
|
|
|
|
|
47 |
"取消": "キャンセル",
|
48 |
"更新": "アップデート",
|
49 |
"详情": "詳細",
|
50 |
"好": "はい",
|
51 |
"更新成功,请重启本程序": "更新が成功しました、このプログラムを再起動してください",
|
52 |
"更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "更新に失敗しました、[手動での更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)をお試しください。",
|
53 |
-
"
|
54 |
"开始实时传输回答……": "ストリーム出力開始……",
|
55 |
"Token 计数: ": "Token数: ",
|
56 |
",本次对话累计消耗了 ": ", 今の会話で消費合計 ",
|
@@ -81,7 +95,50 @@
|
|
81 |
"您的IP区域:": "あなたのIPアドレス地域:",
|
82 |
"总结": "要約する",
|
83 |
"生成内容总结中……": "コンテンツ概要を生成しています...",
|
|
|
84 |
"由于下面的原因,Google 拒绝返回 PaLM 的回答:\n\n": "Googleは以下の理由から、PaLMの回答を返すことを拒否しています:\n\n",
|
85 |
-
"
|
86 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
|
|
1 |
{
|
2 |
+
"川虎Chat 🚀": "川虎Chat 🚀",
|
3 |
+
"川虎Chat": "川虎Chat",
|
4 |
"未命名对话历史记录": "名無しの会話履歴",
|
5 |
"在这里输入": "ここに入力",
|
6 |
"🧹 新的对话": "🧹 新しい会話",
|
7 |
"🔄 重新生成": "🔄 再生成",
|
8 |
"🗑️ 删除最旧对话": "🗑️ 最古の会話削除",
|
9 |
"🗑️ 删除最新对话": "🗑️ 最新の会話削除",
|
10 |
+
"🗑️ 删除": "🗑️ 削除",
|
11 |
+
"重新生成": "再生成",
|
12 |
+
"删除这轮问答": "この質疑応答を削除",
|
13 |
"模型": "LLMモデル",
|
14 |
"多账号模式已开启,无需输入key,可直接开始对话": "複数アカウントモードがオンになっています。キーを入力する必要はありません。会話を開始できます",
|
15 |
"**发送消息** 或 **提交key** 以显示额度": "**メッセージを送信** または **キーを送信** して、クレジットを表示します",
|
|
|
35 |
"对话历史记录": "会話履歴",
|
36 |
"💾 保存对话": "💾 会話を保存",
|
37 |
"📝 导出为Markdown": "📝 Markdownでエクスポート",
|
38 |
+
"历史记录(JSON)": "履歴ファイル(JSON)",
|
39 |
+
"导出为 Markdown": "Markdownでエクスポート",
|
40 |
"默认保存于history文件夹": "デフォルトでhistoryフォルダに保存されます",
|
41 |
+
"下载/上传历史记录": "履歴をダウンロード/アップロード",
|
42 |
"高级": "Advanced",
|
43 |
"# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ 変更には慎重に ⚠️",
|
44 |
"参数": "パラメータ",
|
|
|
51 |
"代理地址": "プロキシアドレス",
|
52 |
"🔄 设置代理地址": "🔄 プロキシアドレスを設定",
|
53 |
"🔙 恢复默认网络设置": "🔙 ネットワーク設定のリセット",
|
54 |
+
"仅供查看": "閲覧専用",
|
55 |
+
"你真的要删除 ": "本当に ",
|
56 |
+
" 吗?": " を削除してもよろしいですか?",
|
57 |
+
"重命名该对话": "会話の名前を変更",
|
58 |
"🔄 检查更新...": "🔄 アップデートをチェック...",
|
59 |
+
"您使用的就是最新版!": "最新バージョンを使用しています!",
|
60 |
+
"正在尝试更新...": "更新を試みています...",
|
61 |
"取消": "キャンセル",
|
62 |
"更新": "アップデート",
|
63 |
"详情": "詳細",
|
64 |
"好": "はい",
|
65 |
"更新成功,请重启本程序": "更新が成功しました、このプログラムを再起動してください",
|
66 |
"更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "更新に失敗しました、[手動での更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)をお試しください。",
|
67 |
+
"更新失败,请尝试<a href=\"https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新\" target=\"_blank\">手动更新</a>。": "更新に失敗しました、<a href=\"https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新\" target=\"_blank\">手動での更新</a>をお試しください。",
|
68 |
"开始实时传输回答……": "ストリーム出力開始……",
|
69 |
"Token 计数: ": "Token数: ",
|
70 |
",本次对话累计消耗了 ": ", 今の会話で消費合計 ",
|
|
|
95 |
"您的IP区域:": "あなたのIPアドレス地域:",
|
96 |
"总结": "要約する",
|
97 |
"生成内容总结中……": "コンテンツ概要を生成しています...",
|
98 |
+
"上传": "アップロード",
|
99 |
"由于下面的原因,Google 拒绝返回 PaLM 的回答:\n\n": "Googleは以下の理由から、PaLMの回答を返すことを拒否しています:\n\n",
|
100 |
+
"⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ APIキーの安全性を確保するために、`config.json`ファイルでネットワーク設定を変更してください。",
|
101 |
+
"网络": "ネットワーク",
|
102 |
+
"暂时未知": "しばらく不明である",
|
103 |
+
|
104 |
+
"剩余配额不足,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/常见问题#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)": "残りのクォータが不足しています、[詳細はこちら](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/常见问题#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)",
|
105 |
+
"你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)": "GPT-4にアクセス権がありません、[詳細はこちら](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)",
|
106 |
+
"请查看 config_example.json,配置 Azure OpenAI": "Azure OpenAIの設定については、config_example.jsonをご覧ください",
|
107 |
+
|
108 |
+
"微调": "ファインチューニング",
|
109 |
+
"训练状态": "トレーニングステータス",
|
110 |
+
"查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "[使用ガイド](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)を表示",
|
111 |
+
"准备数据集": "データセットの準備",
|
112 |
+
"数据集预览": "データセットのプレビュー",
|
113 |
+
"选择数据集": "データセットの選択",
|
114 |
+
"上传到OpenAI": "OpenAIへのアップロード",
|
115 |
+
"文件ID": "ファイルID",
|
116 |
+
"上传到 OpenAI 后自动填充": "OpenAIへのアップロード後、自動的に入力されます",
|
117 |
+
"模型名称后缀": "モデル名のサフィックス",
|
118 |
+
"可选,用于区分不同的模型": "オプション、異なるモデルを区別するために使用",
|
119 |
+
"训练轮数(Epochs)": "トレーニングエポック数",
|
120 |
+
"开始训练": "トレーニングを開始",
|
121 |
+
"状态": "ステータス",
|
122 |
+
"刷新状态": "ステータスを更新",
|
123 |
+
"取消所有任务": "すべてのタスクをキャンセル",
|
124 |
+
"添加训练好的模型到模型列表": "トレーニング済みモデルをモデルリストに追加",
|
125 |
+
|
126 |
+
"设置": "設定",
|
127 |
+
"训练": "トレーニング",
|
128 |
+
"工具箱": "ツールボックス",
|
129 |
+
"对话": "会話",
|
130 |
+
"拓展": "拡張",
|
131 |
+
"上传文件": "ファイルをアップロード",
|
132 |
+
"知识库": "ナレッジベース",
|
133 |
+
"知识库文件": "ナレッジベースファイル",
|
134 |
+
"在工具箱中管理知识库文件": "ツールボックスでナレッジベースファイルの管理を行う",
|
135 |
+
"在线搜索": "オンライン検索",
|
136 |
+
"关于": "について",
|
137 |
+
"新对话 ": "新しい会話 ",
|
138 |
+
"搜索(支持正则)...": "検索(正規表現をサポート)...",
|
139 |
+
|
140 |
+
"对话命名方式": "会話の命名方法",
|
141 |
+
"根据日期时间": "日付と時刻に基づいて",
|
142 |
+
"第一条提问": "最初の質問",
|
143 |
+
"模型自动总结(消耗tokens)": "モデルによる自動要約(トークン消費)"
|
144 |
}
|
locale/ko_KR.json
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
{
|
|
|
|
|
2 |
"未命名对话历史记录": "이름없는 대화 기록",
|
3 |
"在这里输入": "여기에 입력하세요",
|
4 |
"🧹 新的对话": "🧹 새로운 대화",
|
@@ -6,6 +8,8 @@
|
|
6 |
"🗑️ 删除最旧对话": "🗑️ 가장 오래된 대화 삭제",
|
7 |
"🗑️ 删除最新对话": "🗑️ 최신 대화 삭제",
|
8 |
"🗑️ 删除": "🗑️ 삭제",
|
|
|
|
|
9 |
"模型": "LLM 모델",
|
10 |
"多账号模式已开启,无需输入key,可直接开始对话": "다중 계정 모드가 활성화되어 있으므로 키를 입력할 필요가 없이 바로 대화를 시작할 수 있습니다",
|
11 |
"**发送消息** 或 **提交key** 以显示额度": "**메세지를 전송** 하거나 **Key를 입력**하여 크레딧 표시",
|
@@ -31,7 +35,10 @@
|
|
31 |
"对话历史记录": "대화 기록",
|
32 |
"💾 保存对话": "💾 대화 저장",
|
33 |
"📝 导出为Markdown": "📝 마크다운으로 내보내기",
|
|
|
|
|
34 |
"默认保存于history文件夹": "히스토리 폴더에 기본 저장",
|
|
|
35 |
"高级": "고급",
|
36 |
"# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ 주의: 변경시 주의하세요. ⚠️",
|
37 |
"参数": "파라미터들",
|
@@ -44,14 +51,20 @@
|
|
44 |
"代理地址": "프록시 주소",
|
45 |
"🔄 设置代理地址": "🔄 프록시 주소 설정",
|
46 |
"🔙 恢复默认网络设置": "🔙 네트워크 설정 초기화",
|
|
|
|
|
|
|
|
|
47 |
"🔄 检查更新...": "🔄 업데이트 확인...",
|
|
|
|
|
48 |
"取消": "취소",
|
49 |
"更新": "업데이트",
|
50 |
"详情": "상세",
|
51 |
"好": "예",
|
52 |
"更新成功,请重启本程序": "업데이트 성공, 이 프로그램을 재시작 해주세요",
|
53 |
"更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "업데이트 실패, [수동 업데이트](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)를 시도하십시오",
|
54 |
-
"
|
55 |
"开始实时传输回答……": "실시간 응답 출력 시작...",
|
56 |
"Token 计数: ": "토큰 수: ",
|
57 |
",本次对话累计消耗了 ": ",이 대화의 전체 비용은 ",
|
@@ -84,6 +97,48 @@
|
|
84 |
"生成内容总结中……": "콘텐츠 요약 생성중...",
|
85 |
"上传": "업로드",
|
86 |
"由于下面的原因,Google 拒绝返回 PaLM 的回答:\n\n": "구글은 다음과 같은 이유로 인해 PaLM의 응답을 거부합니다: \n\n",
|
87 |
-
"
|
88 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
|
|
1 |
{
|
2 |
+
"川虎Chat 🚀": "Chuanhu Chat 🚀",
|
3 |
+
"川虎Chat": "Chuanhu Chat",
|
4 |
"未命名对话历史记录": "이름없는 대화 기록",
|
5 |
"在这里输入": "여기에 입력하세요",
|
6 |
"🧹 新的对话": "🧹 새로운 대화",
|
|
|
8 |
"🗑️ 删除最旧对话": "🗑️ 가장 오래된 대화 삭제",
|
9 |
"🗑️ 删除最新对话": "🗑️ 최신 대화 삭제",
|
10 |
"🗑️ 删除": "🗑️ 삭제",
|
11 |
+
"重新生成": "재생성",
|
12 |
+
"删除这轮问答": "이 라운드의 질문과 답변 삭제",
|
13 |
"模型": "LLM 모델",
|
14 |
"多账号模式已开启,无需输入key,可直接开始对话": "다중 계정 모드가 활성화되어 있으므로 키를 입력할 필요가 없이 바로 대화를 시작할 수 있습니다",
|
15 |
"**发送消息** 或 **提交key** 以显示额度": "**메세지를 전송** 하거나 **Key를 입력**하여 크레딧 표시",
|
|
|
35 |
"对话历史记录": "대화 기록",
|
36 |
"💾 保存对话": "💾 대화 저장",
|
37 |
"📝 导出为Markdown": "📝 마크다운으로 내보내기",
|
38 |
+
"历史记录(JSON)": "기록 파일 (JSON)",
|
39 |
+
"导出为 Markdown": "마크다운으로 내보내기",
|
40 |
"默认保存于history文件夹": "히스토리 폴더에 기본 저장",
|
41 |
+
"下载/上传历史记录": "기록 다운로드/업로드",
|
42 |
"高级": "고급",
|
43 |
"# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ 주의: 변경시 주의하세요. ⚠️",
|
44 |
"参数": "파라미터들",
|
|
|
51 |
"代理地址": "프록시 주소",
|
52 |
"🔄 设置代理地址": "🔄 프록시 주소 설정",
|
53 |
"🔙 恢复默认网络设置": "🔙 네트워크 설정 초기화",
|
54 |
+
"仅供查看": "읽기 전용",
|
55 |
+
"你真的要删除 ": "정말로 ",
|
56 |
+
" 吗?": " 을(를) 삭제하시겠습니까?",
|
57 |
+
"重命名该对话": "대화 이름 변경",
|
58 |
"🔄 检查更新...": "🔄 업데이트 확인...",
|
59 |
+
"您使用的就是最新版!": "최신 버전을 사용하고 있습니다!",
|
60 |
+
"正在尝试更新...": "업데이트를 시도 중...",
|
61 |
"取消": "취소",
|
62 |
"更新": "업데이트",
|
63 |
"详情": "상세",
|
64 |
"好": "예",
|
65 |
"更新成功,请重启本程序": "업데이트 성공, 이 프로그램을 재시작 해주세요",
|
66 |
"更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "업데이트 실패, [수동 업데이트](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)를 시도하십시오",
|
67 |
+
"更新失败,请尝试<a href=\"https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新\" target=\"_blank\">手动更新</a>。": "업데이트 실패, <a href=\"https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新\" target=\"_blank\">수동 업데이트</a>를 시도하십시오.",
|
68 |
"开始实时传输回答……": "실시간 응답 출력 시작...",
|
69 |
"Token 计数: ": "토큰 수: ",
|
70 |
",本次对话累计消耗了 ": ",이 대화의 전체 비용은 ",
|
|
|
97 |
"生成内容总结中……": "콘텐츠 요약 생성중...",
|
98 |
"上传": "업로드",
|
99 |
"由于下面的原因,Google 拒绝返回 PaLM 的回答:\n\n": "구글은 다음과 같은 이유로 인해 PaLM의 응답을 거부합니다: \n\n",
|
100 |
+
"⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ API-Key의 안전을 보장하기 위해 네트워크 설정을 `config.json` 구성 파일에서 수정해주세요.",
|
101 |
+
"网络": "네트워크",
|
102 |
+
"暂时未知": "알 수 없음",
|
103 |
+
|
104 |
+
"剩余配额不足,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/常见问题#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)": "남은 할당량이 부족합니다. [자세히 알아보기](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/常见问题#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)",
|
105 |
+
"你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)": "GPT-4에 접근 권한이 없습니다. [자세히 알아보기](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)",
|
106 |
+
"请查看 config_example.json,配置 Azure OpenAI": "Azure OpenAI 설정을 확인하세요",
|
107 |
+
|
108 |
+
"微调": "미세 조정",
|
109 |
+
"训练状态": "훈련 상태",
|
110 |
+
"查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "[사용 가이드](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) 보기",
|
111 |
+
"准备数据集": "데이터셋 준비",
|
112 |
+
"数据集预览": "데이터셋 미리보기",
|
113 |
+
"选择数据集": "데이터셋 선택",
|
114 |
+
"上传到OpenAI": "OpenAI로 업로드",
|
115 |
+
"文件ID": "파일 ID",
|
116 |
+
"上传到 OpenAI 后自动填充": "OpenAI로 업로드한 후 자동으로 채워집니다",
|
117 |
+
"模型名称后缀": "모델 이름 접미사",
|
118 |
+
"可选,用于区分不同的模型": "선택 사항, 다른 모델을 구분하는 데 사용",
|
119 |
+
"训练轮数(Epochs)": "훈련 라운드(Epochs)",
|
120 |
+
"开始训练": "훈련 시작",
|
121 |
+
"状态": "상태",
|
122 |
+
"刷新状态": "상태 새로 고침",
|
123 |
+
"取消所有任务": "모든 작업 취소",
|
124 |
+
"添加训练好的模型到模型列表": "훈련된 모델을 모델 목록에 추가",
|
125 |
+
|
126 |
+
"设置": "설정",
|
127 |
+
"训练": "훈련",
|
128 |
+
"工具箱": "도구 상자",
|
129 |
+
"对话": "대화",
|
130 |
+
"拓展": "확장",
|
131 |
+
"上传文件": "파일 업로드",
|
132 |
+
"知识库": "지식 라이브러리",
|
133 |
+
"知识库文件": "지식 라이브러리 파일",
|
134 |
+
"在工具箱中管理知识库文件": "지식 라이브러리 파일을 도구 상자에서 관리",
|
135 |
+
"在线搜索": "온라인 검색",
|
136 |
+
"关于": "관련",
|
137 |
+
"新对话 ": "새 대화 ",
|
138 |
+
"搜索(支持正则)...": "검색 (정규식 지원)...",
|
139 |
+
|
140 |
+
"对话命名方式": "대화 이름 설정",
|
141 |
+
"根据日期时间": "날짜 및 시간 기준",
|
142 |
+
"第一条提问": "첫 번째 질문",
|
143 |
+
"模型自动总结(消耗tokens)": "모델에 의한 자동 요약 (토큰 소비)"
|
144 |
}
|
locale/ru_RU.json
CHANGED
@@ -1,27 +1,26 @@
|
|
1 |
{
|
|
|
|
|
2 |
"未命名对话历史记录": "Безымянная история диалога",
|
3 |
-
"取消": "Отмена",
|
4 |
-
"更新": "Обновить",
|
5 |
-
"详情": "Подробности",
|
6 |
-
"好": "Хорошо",
|
7 |
"在这里输入": "Введите здесь",
|
8 |
"🧹 新的对话": "🧹 Новый диалог",
|
9 |
"🔄 重新生成": "🔄 Пересоздать",
|
10 |
"🗑️ 删除最旧对话": "🗑️ Удалить старейший диалог",
|
11 |
"🗑️ 删除最新对话": "🗑️ Удалить последний диалог",
|
12 |
-
"
|
13 |
-
"
|
|
|
14 |
"模型": "Модель",
|
15 |
"多账号模式已开启,无需输入key,可直接开始对话": "Режим множественных аккаунтов включен, не требуется ввод ключа, можно сразу начать диалог",
|
16 |
-
"
|
17 |
"选择模型": "Выберите модель",
|
18 |
"选择LoRA模型": "Выберите модель LoRA",
|
|
|
19 |
"单轮对话": "Одиночный диалог",
|
20 |
"使用在线搜索": "Использовать онлайн-поиск",
|
21 |
"选择回复语言(针对搜索&索引功能)": "Выберите язык ответа (для функций поиска и индексации)",
|
22 |
-
"
|
23 |
"双栏pdf": "Двухколоночный PDF",
|
24 |
-
"总结": "Подведение итога",
|
25 |
"识别公式": "Распознавание формул",
|
26 |
"在这里输入System Prompt...": "Введите здесь системное подсказку...",
|
27 |
"加载Prompt模板": "Загрузить шаблон Prompt",
|
@@ -31,50 +30,53 @@
|
|
31 |
"保存/加载": "Сохранить/загрузить",
|
32 |
"保存/加载对话历史记录": "Сохранить/загрузить историю диалога",
|
33 |
"从列表中加载对话": "Загрузить диалог из списка",
|
34 |
-
"🗑️ 删除": "🗑️ Удалить",
|
35 |
"设置文件名: 默认为.json,可选为.md": "Установить имя файла: по умолчанию .json, можно выбрать .md",
|
36 |
"设置保存文件名": "Установить имя сохраняемого файла",
|
37 |
"对话历史记录": "История диалога",
|
38 |
"💾 保存对话": "💾 Сохранить диалог",
|
39 |
"📝 导出为Markdown": "📝 Экспортировать в Markdown",
|
|
|
|
|
40 |
"默认保存于history文件夹": "По умолчанию сохраняется в папку history",
|
41 |
-
"
|
42 |
-
"训练状态": "Статус обучения",
|
43 |
-
"在这里[查看使用介绍](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)": "[Здесь](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) можно ознакомиться с инструкцией по использованию",
|
44 |
-
"准备数据集": "Подготовка набора данных",
|
45 |
-
"数据集预览": "Предпросмотр набора данных",
|
46 |
-
"选择数据集": "Выберите набор данных",
|
47 |
-
"上传到OpenAI": "Загрузить в OpenAI",
|
48 |
-
"训练": "Обучение",
|
49 |
-
"文件ID": "Идентификатор файла",
|
50 |
-
"Token 计数: ": "Использованно токенов: ",
|
51 |
-
",本次对话累计消耗了 ": ", Общая стоимость этого диалога составляет ",
|
52 |
-
"上传到 OpenAI 后自动填充": "Автоматическое заполнение после загрузки в OpenAI",
|
53 |
-
"模型名称后缀": "Суффикс имени модели",
|
54 |
-
"可选,用于区分不同的模型": "Необязательно, используется для различения разных моделей",
|
55 |
-
"训练轮数(Epochs)": "Количество эпох обучения",
|
56 |
-
"开始训练": "Начать обучение",
|
57 |
-
"状���": "Статус",
|
58 |
-
"刷新状态": "Обновить статус",
|
59 |
-
"取消所有任务": "Отменить все задачи",
|
60 |
-
"添加训练好的模型到模型列表": "Добавить обученную модель в список моделей",
|
61 |
"高级": "Расширенные настройки",
|
62 |
-
"切换亮暗色主题": "Переключить светлую/темную тему",
|
63 |
-
"实时传输回答": "Передача ответа в реальном времени",
|
64 |
-
"🔄 检查更新...": "🔄 Проверить обновления...",
|
65 |
"# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ ВНИМАНИЕ: ИЗМЕНЯЙТЕ ОСТОРОЖНО ⚠️",
|
66 |
"参数": "Параметры",
|
67 |
"停止符,用英文逗号隔开...": "Разделительные символы, разделенные запятой...",
|
68 |
"用于定位滥用行为": "Используется для выявления злоупотреблений",
|
69 |
"用户名": "Имя пользователя",
|
70 |
-
"
|
71 |
-
"
|
72 |
-
"🔙 恢复默认网络设置": "🔙 Восстановить настройки сети по умолчанию",
|
73 |
"未设置代理...": "Прокси не настроен...",
|
74 |
"代理地址": "Адрес прокси",
|
75 |
"🔄 设置代理地址": "🔄 Установить адрес прокси",
|
76 |
-
"
|
77 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
"☹️发生了错误:": "☹️ Произошла ошибка:",
|
79 |
"获取对话时发生错误,请查看后台日志": "Возникла ошибка при получении диалога, пожалуйста, проверьте журналы",
|
80 |
"请检查网络连接,或者API-Key是否有效。": "Проверьте подключение к сети или действительность API-Key.",
|
@@ -85,30 +87,58 @@
|
|
85 |
"API key为空,请检查是否输入正确。": "Пустой API-Key, пожалуйста, проверьте правильность ввода.",
|
86 |
"请输入对话内容。": "Пожалуйста, введите содержание диалога.",
|
87 |
"账单信息不适用": "Информация о счете не применима",
|
88 |
-
"由Bilibili
|
89 |
-
"
|
90 |
"您的IP区域:未知。": "Ваша IP-зона: неизвестно.",
|
91 |
"获取IP地理位置失败。原因:": "Не удалось получить географическое положение IP. Причина:",
|
92 |
"。你仍然可以使用聊天功能。": ". Вы все равно можете использовать функцию чата.",
|
93 |
"您的IP区域:": "Ваша IP-зона:",
|
94 |
-
"
|
95 |
-
"更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Обновление не удалось, пожалуйста, попробуйте обновить вручную",
|
96 |
-
"剩余配额不足,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)": "Недостаточно остаточного квоты, [подробнее](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)",
|
97 |
-
"你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843": "У вас нет доступа к GPT4, подробнее",
|
98 |
-
"请查看 config_example.json,配置 Azure OpenAI": "Пожалуйста, просмотрите config_example.json для настройки Azure OpenAI",
|
99 |
-
"**发送消息** 或 **提交key** 以显示额度": "**Отправить сообщение** или **отправить ключ** для отображения лимита",
|
100 |
-
"**本月使用金额** ": "**Использовано средств в этом месяце**",
|
101 |
-
"**获取API使用情况失败**": "**Не удалось получить информацию об использовании API**",
|
102 |
-
"**获取API使用情况失败**,sensitive_id错误或已过期": "**Не удалось получить информацию об использовании API**, ошибка sensitive_id или истек срок действия",
|
103 |
-
"**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**Не удалось получить информацию об использовании API**, необходимо правильно заполнить sensitive_id в `config.json`",
|
104 |
-
"JSON解析错误,收到的内容: ": "Ошибка анализа JSON, полученный контент:",
|
105 |
-
"由Bilibili [土川虎虎虎](https://space.bilibili.com/29125536)、[明昭MZhao](https://space.bilibili.com/24807452) 和 [Keldos](https://github.com/Keldos-Li) 开发<br />访问川虎Chat的 [GitHub项目](https://github.com/GaiZhenbiao/ChuanhuChatGPT) 下载最新版脚本": "Перевод: 由Bilibili [土川虎虎虎](https://space.bilibili.com/29125536)、[明昭MZhao](https://space.bilibili.com/24807452) и [Keldos](https://github.com/Keldos-Li) 开发<br />访问川虎Chat的 [GitHub项目](https://github.com/GaiZhenbiao/ChuanhuChatGPT) Загрузите последнюю версию программы",
|
106 |
-
"模型设置为了:": "Модель настроена на:",
|
107 |
-
"API密钥更改为了": "Ключ API изменен на",
|
108 |
"生成内容总结中……": "Создание сводки контента...",
|
109 |
-
"
|
110 |
-
"
|
111 |
-
"
|
112 |
-
"
|
113 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
}
|
|
|
1 |
{
|
2 |
+
"川虎Chat 🚀": "Chuanhu Чат 🚀",
|
3 |
+
"川虎Chat": "Chuanhu Чат",
|
4 |
"未命名对话历史记录": "Безымянная история диалога",
|
|
|
|
|
|
|
|
|
5 |
"在这里输入": "Введите здесь",
|
6 |
"🧹 新的对话": "🧹 Новый диалог",
|
7 |
"🔄 重新生成": "🔄 Пересоздать",
|
8 |
"🗑️ 删除最旧对话": "🗑️ Удалить старейший диалог",
|
9 |
"🗑️ 删除最新对话": "🗑️ Удалить последний диалог",
|
10 |
+
"🗑️ 删除": "🗑️ Удалить",
|
11 |
+
"重新生成": "Пересоздать",
|
12 |
+
"删除这轮问答": "Удалить этот раунд вопросов и ответов",
|
13 |
"模型": "Модель",
|
14 |
"多账号模式已开启,无需输入key,可直接开始对话": "Режим множественных аккаунтов включен, не требуется ввод ключа, можно сразу начать диалог",
|
15 |
+
"**发送消息** 或 **提交key** 以显示额度": "**Отправить сообщение** или **отправить ключ** для отображения лимита",
|
16 |
"选择模型": "Выберите модель",
|
17 |
"选择LoRA模型": "Выберите модель LoRA",
|
18 |
+
"实时传输回答": "Передача ответа в реальном времени",
|
19 |
"单轮对话": "Одиночный диалог",
|
20 |
"使用在线搜索": "Использовать онлайн-поиск",
|
21 |
"选择回复语言(针对搜索&索引功能)": "Выберите язык ответа (для функций поиска и индексации)",
|
22 |
+
"上传索引文件": "Загрузить конфиг",
|
23 |
"双栏pdf": "Двухколоночный PDF",
|
|
|
24 |
"识别公式": "Распознавание формул",
|
25 |
"在这里输入System Prompt...": "Введите здесь системное подсказку...",
|
26 |
"加载Prompt模板": "Загрузить шаблон Prompt",
|
|
|
30 |
"保存/加载": "Сохранить/загрузить",
|
31 |
"保存/加载对话历史记录": "Сохранить/загрузить историю диалога",
|
32 |
"从列表中加载对话": "Загрузить диалог из списка",
|
|
|
33 |
"设置文件名: 默认为.json,可选为.md": "Установить имя файла: по умолчанию .json, можно выбрать .md",
|
34 |
"设置保存文件名": "Установить имя сохраняемого файла",
|
35 |
"对话历史记录": "История диалога",
|
36 |
"💾 保存对话": "💾 Сохранить диалог",
|
37 |
"📝 导出为Markdown": "📝 Экспортировать в Markdown",
|
38 |
+
"历史记录(JSON)": "Файл истории (JSON)",
|
39 |
+
"导出为 Markdown": "Экспортировать в Markdown",
|
40 |
"默认保存于history文件夹": "По умолчанию сохраняется в папку history",
|
41 |
+
"下载/上传历史记录": "Загрузить/загрузить историю",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
"高级": "Расширенные настройки",
|
|
|
|
|
|
|
43 |
"# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ ВНИМАНИЕ: ИЗМЕНЯЙТЕ ОСТОРОЖНО ⚠️",
|
44 |
"参数": "Параметры",
|
45 |
"停止符,用英文逗号隔开...": "Разделительные символы, разделенные запятой...",
|
46 |
"用于定位滥用行为": "Используется для выявления злоупотреблений",
|
47 |
"用户名": "Имя пользователя",
|
48 |
+
"在这里输入API-Host...": "Введите API-хост здесь...",
|
49 |
+
"🔄 切换API地址": "🔄 Переключить адрес API",
|
|
|
50 |
"未设置代理...": "Прокси не настроен...",
|
51 |
"代理地址": "Адрес прокси",
|
52 |
"🔄 设置代理地址": "🔄 Установить адрес прокси",
|
53 |
+
"🔙 恢复默认网络设置": "🔙 Восстановить настройки сети по умолчанию",
|
54 |
+
"仅供查看": "Только для просмотра",
|
55 |
+
"你真的要删除 ": "Вы уверены, что хотите удалить ",
|
56 |
+
" 吗?": " ?",
|
57 |
+
"重命名该对话": "Переименовать этот диалог",
|
58 |
+
"🔄 检查更新...": "🔄 Проверить обновления...",
|
59 |
+
"您使用的就是最新版!": "Вы используете последнюю версию!",
|
60 |
+
"正在尝试更新...": "Попытка обновления...",
|
61 |
+
"取消": "Отмена",
|
62 |
+
"更新": "Обновить",
|
63 |
+
"详情": "Подробности",
|
64 |
+
"好": "Хорошо",
|
65 |
+
"更新成功,请重启本程序": "Обновление успешно, пожалуйста, перезапустите программу",
|
66 |
+
"更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Обновление не удалось, пожалуйста, попробуйте обновить вручную",
|
67 |
+
"更新失败,请尝试<a href=\"https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新\" target=\"_blank\">手动更新</a>。": "Обновление не удалось, попробуйте <a href=\"https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新\" target=\"_blank\">обновление вручную</a>.",
|
68 |
+
"开始实时传输回答……": "Начните трансляцию ответов в режиме реального времени...",
|
69 |
+
"Token 计数: ": "Использованно токенов: ",
|
70 |
+
",本次对话累计消耗了 ": ", Общая стоимость этого диалога составляет ",
|
71 |
+
"**获取API使用情况失败**": "**Не удалось получить информацию об использовании API**",
|
72 |
+
"**获取API使用情况失败**,sensitive_id错误或已过期": "**Не удалось получить информацию об использовании API**, ошибка sensitive_id или истек срок действия",
|
73 |
+
"**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**Не удалось получить информацию об использовании API**, необходимо правильно заполнить sensitive_id в `config.json`",
|
74 |
+
"**本月使用金额** ": "**Использовано средств в этом месяце**",
|
75 |
+
"本月使用金额": "Использовано средств в этом месяце",
|
76 |
+
"获取API使用情况失败:": "Не удалось получитьAPIинформацию об использовании:",
|
77 |
+
"API密钥更改为了": "Ключ API изменен на",
|
78 |
+
"JSON解析错误,收到的内容: ": "Ошибка анализа JSON, полученный контент:",
|
79 |
+
"模型设置为了:": "Модель настроена на:",
|
80 |
"☹️发生了错误:": "☹️ Произошла ошибка:",
|
81 |
"获取对话时发生错误,请查看后台日志": "Возникла ошибка при получении диалога, пожалуйста, проверьте журналы",
|
82 |
"请检查网络连接,或者API-Key是否有效。": "Проверьте подключение к сети или действительность API-Key.",
|
|
|
87 |
"API key为空,请检查是否输入正确。": "Пустой API-Key, пожалуйста, проверьте правильность ввода.",
|
88 |
"请输入对话内容。": "Пожалуйста, введите содержание диалога.",
|
89 |
"账单信息不适用": "Информация о счете не применима",
|
90 |
+
"由Bilibili [土川虎虎虎](https://space.bilibili.com/29125536)、[明昭MZhao](https://space.bilibili.com/24807452) 和 [Keldos](https://github.com/Keldos-Li) 开发<br />访问川虎Chat的 [GitHub项目](https://github.com/GaiZhenbiao/ChuanhuChatGPT) 下载最新版脚本": "Разработано [土川虎虎虎](https://space.bilibili.com/29125536), [明昭MZhao](https://space.bilibili.com/24807452) и [Keldos](https://github.com/Keldos-Li).<br />посетите [GitHub Project](https://github.com/GaiZhenbiao/ChuanhuChatGPT) чата Chuanhu, чтобы загрузить последнюю версию скрипта",
|
91 |
+
"切换亮暗色主题": "Переключить светлую/темную тему",
|
92 |
"您的IP区域:未知。": "Ваша IP-зона: неизвестно.",
|
93 |
"获取IP地理位置失败。原因:": "Не удалось получить географическое положение IP. Причина:",
|
94 |
"。你仍然可以使用聊天功能。": ". Вы все равно можете использовать функцию чата.",
|
95 |
"您的IP区域:": "Ваша IP-зона:",
|
96 |
+
"总结": "Подведение итога",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
"生成内容总结中……": "Создание сводки контента...",
|
98 |
+
"上传": "Загрузить",
|
99 |
+
"由于下面的原因,Google 拒绝返回 PaLM 的回答:\n\n": "Google отказался вернуть ответ PaLM по следующим причинам:\n\n",
|
100 |
+
"⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ Для обеспечения безопасности API-Key, измените настройки сети в файле конфигурации `config.json`",
|
101 |
+
"网络": "Параметры сети",
|
102 |
+
"暂时未知": "Временно неизвестно",
|
103 |
+
|
104 |
+
"剩余配额不足,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/常见问题#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)": "Недостаточно остаточного квоты, [подробнее](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/常见问题#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)",
|
105 |
+
"你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)": "У вас нет доступа к GPT4, [подробнее](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)",
|
106 |
+
"请查看 config_example.json,配置 Azure OpenAI": "Пожалуйста, просмотрите config_example.json для настройки Azure OpenAI",
|
107 |
+
|
108 |
+
"微调": "Своя модель",
|
109 |
+
"训练状态": "Статус обучения",
|
110 |
+
"查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "[Здесь](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) можно ознакомиться с инструкцией по использованию",
|
111 |
+
"准备数据集": "Подготовка набора данных",
|
112 |
+
"数据集预览": "Предпросмотр набора данных",
|
113 |
+
"选择数据集": "Выберите набор данных",
|
114 |
+
"上传到OpenAI": "Загрузить в OpenAI",
|
115 |
+
"文件ID": "Идентификатор файла",
|
116 |
+
"上传到 OpenAI 后自动填充": "Автоматическое заполнение после загрузки в OpenAI",
|
117 |
+
"模型名称后缀": "Суффикс имени модели",
|
118 |
+
"可选,用于区分不同的模型": "Необязательно, используется для различения разных моделей",
|
119 |
+
"训练轮数(Epochs)": "Количество эпох обучения",
|
120 |
+
"开始训练": "Начать обучение",
|
121 |
+
"状态": "Статус",
|
122 |
+
"刷新状态": "Обновить статус",
|
123 |
+
"取消所有任务": "Отменить все задачи",
|
124 |
+
"添加训练好的模型到模型列表": "Добавить обученную модель в список моделей",
|
125 |
+
|
126 |
+
"设置": "Настройки",
|
127 |
+
"训练": "Обучение",
|
128 |
+
"工具箱": "Инструменты",
|
129 |
+
"对话": "Диалог",
|
130 |
+
"拓展": "Расширенные настройки",
|
131 |
+
"上传文件": "Загрузить файл",
|
132 |
+
"知识库": "База знаний",
|
133 |
+
"知识库文件": "Файл базы знаний",
|
134 |
+
"在工具箱中管理知识库文件": "Управление файлами базы знаний в инструментах",
|
135 |
+
"在线搜索": "Онлайн-поиск",
|
136 |
+
"关于": "О программе",
|
137 |
+
"新对话 ": "Новый диалог ",
|
138 |
+
"搜索(支持正则)...": "Поиск (поддержка регулярности)...",
|
139 |
+
|
140 |
+
"对话命名方式": "Способ названия диалога",
|
141 |
+
"根据日期时间": "По дате и времени",
|
142 |
+
"第一条提问": "Первый вопрос",
|
143 |
+
"模型自动总结(消耗tokens)": "Автоматическое подведение итогов модели (потребление токенов)"
|
144 |
}
|
locale/sv_SE.json
CHANGED
@@ -1,87 +1,144 @@
|
|
1 |
-
{
|
2 |
-
"
|
3 |
-
"
|
4 |
-
"
|
5 |
-
"
|
6 |
-
"
|
7 |
-
"
|
8 |
-
"
|
9 |
-
"
|
10 |
-
"
|
11 |
-
"
|
12 |
-
"
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"
|
16 |
-
"
|
17 |
-
"
|
18 |
-
"
|
19 |
-
"
|
20 |
-
"
|
21 |
-
"
|
22 |
-
"
|
23 |
-
"
|
24 |
-
"
|
25 |
-
"
|
26 |
-
"
|
27 |
-
"
|
28 |
-
"
|
29 |
-
"
|
30 |
-
"
|
31 |
-
"
|
32 |
-
"
|
33 |
-
"
|
34 |
-
"
|
35 |
-
"
|
36 |
-
"
|
37 |
-
"
|
38 |
-
"
|
39 |
-
"
|
40 |
-
"
|
41 |
-
"
|
42 |
-
"
|
43 |
-
"
|
44 |
-
"
|
45 |
-
"
|
46 |
-
"
|
47 |
-
"
|
48 |
-
"
|
49 |
-
"
|
50 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
"更新成功,请重启本程序": "Uppdaterat framgångsrikt, starta om programmet",
|
52 |
"更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Uppdateringen misslyckades, prova att [uppdatera manuellt](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)",
|
53 |
-
"
|
54 |
-
"开始实时传输回答……": "Börjar strömma utdata...",
|
55 |
-
"Token 计数: ": "Tokenräkning: ",
|
56 |
-
",本次对话累计消耗了 ": ", Total kostnad för denna dialog är ",
|
57 |
-
"**获取API使用情况失败**": "**Misslyckades med att hämta API-användning**",
|
58 |
-
"**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**Misslyckades med att hämta API-användning**, korrekt sensitive_id behövs i `config.json`",
|
59 |
-
"**获取API使用情况失败**,sensitive_id错误或已过期": "**Misslyckades med att hämta API-användning**, felaktig eller utgången sensitive_id",
|
60 |
-
"**本月使用金额** ": "**Månadens användning** ",
|
61 |
-
"本月使用金额": "Månadens användning",
|
62 |
-
"获取API使用情况失败:": "Misslyckades med att hämta API-användning:",
|
63 |
-
"API密钥更改为了": "API-nyckeln har ändrats till",
|
64 |
-
"JSON解析错误,收到的内容: ": "JSON-tolkningsfel, mottaget innehåll: ",
|
65 |
-
"模型设置为了:": "Modellen är inställd på: ",
|
66 |
-
"☹️发生了错误:": "☹️Fel: ",
|
67 |
-
"获取对话时发生错误,请查看后台日志": "Ett fel uppstod när dialogen hämtades, kontrollera bakgrundsloggen",
|
68 |
-
"请检查网络连接,或者API-Key是否有效。": "Kontrollera nätverksanslutningen eller om API-nyckeln är giltig.",
|
69 |
-
"连接超时,无法获取对话。": "Anslutningen tog för lång tid, kunde inte hämta dialogen.",
|
70 |
-
"读取超时,无法获取对话。": "Läsningen tog för lång tid, kunde inte hämta dialogen.",
|
71 |
-
"代理错误,无法获取对话。": "Proxyfel, kunde inte hämta dialogen.",
|
72 |
-
"SSL错误,无法获取对话。": "SSL-fel, kunde inte hämta dialogen.",
|
73 |
-
"API key为空,请检查是否输入正确。": "API-nyckeln är tom, kontrollera om den är korrekt inmatad.",
|
74 |
-
"请输入对话内容。": "Ange dialoginnehåll.",
|
75 |
-
"账单信息不适用": "Faktureringsinformation är inte tillämplig",
|
76 |
-
"由Bilibili [土川虎虎虎](https://space.bilibili.com/29125536)、[明昭MZhao](https://space.bilibili.com/24807452) 和 [Keldos](https://github.com/Keldos-Li) 开发<br />访问川虎Chat的 [GitHub项目](https://github.com/GaiZhenbiao/ChuanhuChatGPT) 下载最新版脚本": "Utvecklad av Bilibili [土川虎虎虎](https://space.bilibili.com/29125536), [明昭MZhao](https://space.bilibili.com/24807452) och [Keldos](https://github.com/Keldos-Li)\n\nLadda ner senaste koden från [GitHub](https://github.com/GaiZhenbiao/ChuanhuChatGPT)",
|
77 |
-
"切换亮暗色主题": "Byt ljus/mörk tema",
|
78 |
-
"您的IP区域:未知。": "Din IP-region: Okänd.",
|
79 |
-
"获取IP地理位置失败。原因:": "Misslyckades med att hämta IP-plats. Orsak: ",
|
80 |
-
"。你仍然可以使用聊天功能。": ". Du kan fortfarande använda chattfunktionen.",
|
81 |
-
"您的IP区域:": "Din IP-region: ",
|
82 |
-
"总结": "Sammanfatta",
|
83 |
-
"生成内容总结中……": "Genererar innehållssammanfattning...",
|
|
|
84 |
"由于下面的原因,Google 拒绝返回 PaLM 的回答:\n\n": "På grund av följande skäl vägrar Google att ge ett svar till PaLM: \n\n",
|
85 |
-
"
|
86 |
-
"
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"川虎Chat 🚀": "Chuanhu Chat 🚀",
|
3 |
+
"川虎Chat": "Chuanhu Chat",
|
4 |
+
"未命名对话历史记录": "Onämnd Dialoghistorik",
|
5 |
+
"在这里输入": "Skriv in här",
|
6 |
+
"🧹 新的对话": "🧹 Ny Dialog",
|
7 |
+
"🔄 重新生成": "🔄 Regenerera",
|
8 |
+
"🗑️ 删除最旧对话": "🗑️ Ta bort äldsta dialogen",
|
9 |
+
"🗑️ 删除最新对话": "🗑️ Ta bort senaste dialogen",
|
10 |
+
"🗑️ 删除": "🗑️ Ta bort",
|
11 |
+
"重新生成": "Återgenerera",
|
12 |
+
"删除这轮问答": "Ta bort denna omgång av Q&A",
|
13 |
+
"模型": "Modell",
|
14 |
+
"多账号模式已开启,无需输入key,可直接开始对话": "Flerkontoläge är aktiverat, ingen nyckel behövs, du kan starta dialogen direkt",
|
15 |
+
"**发送消息** 或 **提交key** 以显示额度": "**Skicka meddelande** eller **Skicka in nyckel** för att visa kredit",
|
16 |
+
"选择模型": "Välj Modell",
|
17 |
+
"选择LoRA模型": "Välj LoRA Modell",
|
18 |
+
"实时传输回答": "Strömmande utdata",
|
19 |
+
"单轮对话": "Enkel dialog",
|
20 |
+
"使用在线搜索": "Använd online-sökning",
|
21 |
+
"选择回复语言(针对搜索&索引功能)": "Välj svarspråk (för sök- och indexfunktion)",
|
22 |
+
"上传索引文件": "Ladda upp",
|
23 |
+
"双栏pdf": "Två-kolumns pdf",
|
24 |
+
"识别公式": "Formel OCR",
|
25 |
+
"在这里输入System Prompt...": "Skriv in System Prompt här...",
|
26 |
+
"加载Prompt模板": "Ladda Prompt-mall",
|
27 |
+
"选择Prompt模板集合文件": "Välj Prompt-mall Samlingsfil",
|
28 |
+
"🔄 刷新": "🔄 Uppdatera",
|
29 |
+
"从Prompt模板中加载": "Ladda från Prompt-mall",
|
30 |
+
"保存/加载": "Spara/Ladda",
|
31 |
+
"保存/加载对话历史记录": "Spara/Ladda Dialoghistorik",
|
32 |
+
"从列表中加载对话": "Ladda dialog från lista",
|
33 |
+
"设置文件名: 默认为.json,可选为.md": "Ställ in filnamn: standard är .json, valfritt är .md",
|
34 |
+
"设置保存文件名": "Ställ in sparfilnamn",
|
35 |
+
"对话历史记录": "Dialoghistorik",
|
36 |
+
"💾 保存对话": "💾 Spara Dialog",
|
37 |
+
"📝 导出为Markdown": "📝 Exportera som Markdown",
|
38 |
+
"历史记录(JSON)": "Historikfil (JSON)",
|
39 |
+
"��出为 Markdown": "Exportera som Markdown",
|
40 |
+
"默认保存于history文件夹": "Sparas som standard i mappen history",
|
41 |
+
"下载/上传历史记录": "Ladda ner/ladda upp historik",
|
42 |
+
"高级": "Avancerat",
|
43 |
+
"# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Var försiktig med ändringar. ⚠️",
|
44 |
+
"参数": "Parametrar",
|
45 |
+
"停止符,用英文逗号隔开...": "Skriv in stopptecken här, separerade med kommatecken...",
|
46 |
+
"用于定位滥用行为": "Används för att lokalisera missbruk",
|
47 |
+
"用户名": "Användarnamn",
|
48 |
+
"在这里输入API-Host...": "Skriv in API-Host här...",
|
49 |
+
"🔄 切换API地址": "🔄 Byt API-adress",
|
50 |
+
"未设置代理...": "Inte inställd proxy...",
|
51 |
+
"代理地址": "Proxyadress",
|
52 |
+
"🔄 设置代理地址": "🔄 Ställ in Proxyadress",
|
53 |
+
"🔙 恢复网络默认设置": "🔙 Återställ Nätverksinställningar",
|
54 |
+
"仅供查看": "Endast för visning",
|
55 |
+
"你真的要删除 ": "Är du säker på att du vill ta bort ",
|
56 |
+
" 吗?": " ?",
|
57 |
+
"重命名该对话": "Byt namn på dialogen",
|
58 |
+
"🔄 检查更新...": "🔄 Sök efter uppdateringar...",
|
59 |
+
"您使用的就是最新版!": "Du använder den senaste versionen!",
|
60 |
+
"正在尝试更新...": "Försöker uppdatera...",
|
61 |
+
"取消": "Avbryt",
|
62 |
+
"更新": "Uppdatera",
|
63 |
+
"详情": "Detaljer",
|
64 |
+
"好": "OK",
|
65 |
"更新成功,请重启本程序": "Uppdaterat framgångsrikt, starta om programmet",
|
66 |
"更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Uppdateringen misslyckades, prova att [uppdatera manuellt](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)",
|
67 |
+
"更新失败,请尝试<a href=\"https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新\" target=\"_blank\">手动更新</a>。": "Uppdateringen misslyckades, prova att <a href=\"https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新\" target=\"_blank\">uppdatera manuellt</a>.",
|
68 |
+
"开始实时传输回答……": "Börjar strömma utdata...",
|
69 |
+
"Token 计数: ": "Tokenräkning: ",
|
70 |
+
",本次对话累计消耗了 ": ", Total kostnad för denna dialog är ",
|
71 |
+
"**获取API使用情况失败**": "**Misslyckades med att hämta API-användning**",
|
72 |
+
"**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**Misslyckades med att hämta API-användning**, korrekt sensitive_id behövs i `config.json`",
|
73 |
+
"**获取API使用情况失败**,sensitive_id错误或已过期": "**Misslyckades med att hämta API-användning**, felaktig eller utgången sensitive_id",
|
74 |
+
"**本月使用金额** ": "**Månadens användning** ",
|
75 |
+
"本月使用金额": "Månadens användning",
|
76 |
+
"获取API使用情况失败:": "Misslyckades med att hämta API-användning:",
|
77 |
+
"API密钥更改为了": "API-nyckeln har ändrats till",
|
78 |
+
"JSON解析错误,收到的内容: ": "JSON-tolkningsfel, mottaget innehåll: ",
|
79 |
+
"模型设置为了:": "Modellen är inställd på: ",
|
80 |
+
"☹️发生了错误:": "☹️Fel: ",
|
81 |
+
"获取对话时发生错误,请查看后台日志": "Ett fel uppstod när dialogen hämtades, kontrollera bakgrundsloggen",
|
82 |
+
"请检查网络连接,或者API-Key是否有效。": "Kontrollera nätverksanslutningen eller om API-nyckeln är giltig.",
|
83 |
+
"连接超时,无法获取对话。": "Anslutningen tog för lång tid, kunde inte hämta dialogen.",
|
84 |
+
"读取超时,无法获取对话。": "Läsningen tog för lång tid, kunde inte hämta dialogen.",
|
85 |
+
"代理错误,无法获取对话。": "Proxyfel, kunde inte hämta dialogen.",
|
86 |
+
"SSL错误,无法获取对话。": "SSL-fel, kunde inte hämta dialogen.",
|
87 |
+
"API key为空,请检查是否输入正确。": "API-nyckeln är tom, kontrollera om den är korrekt inmatad.",
|
88 |
+
"请输入对话内容。": "Ange dialoginnehåll.",
|
89 |
+
"账单信息不适用": "Faktureringsinformation är inte tillämplig",
|
90 |
+
"由Bilibili [土川虎虎虎](https://space.bilibili.com/29125536)、[明昭MZhao](https://space.bilibili.com/24807452) 和 [Keldos](https://github.com/Keldos-Li) 开发<br />访问川虎Chat的 [GitHub项目](https://github.com/GaiZhenbiao/ChuanhuChatGPT) 下载最新版脚本": "Utvecklad av Bilibili [土川虎虎虎](https://space.bilibili.com/29125536), [明昭MZhao](https://space.bilibili.com/24807452) och [Keldos](https://github.com/Keldos-Li)\n\nLadda ner senaste koden från [GitHub](https://github.com/GaiZhenbiao/ChuanhuChatGPT)",
|
91 |
+
"切换亮暗色主题": "Byt ljus/mörk tema",
|
92 |
+
"您的IP区域:未知。": "Din IP-region: Okänd.",
|
93 |
+
"获取IP地理位置失败。原因:": "Misslyckades med att hämta IP-plats. Orsak: ",
|
94 |
+
"。你仍然可以使用聊天功能。": ". Du kan fortfarande använda chattfunktionen.",
|
95 |
+
"您的IP区域:": "Din IP-region: ",
|
96 |
+
"总结": "Sammanfatta",
|
97 |
+
"生成内容总结中……": "Genererar innehållssammanfattning...",
|
98 |
+
"上传": "Ladda upp",
|
99 |
"由于下面的原因,Google 拒绝返回 PaLM 的回答:\n\n": "På grund av följande skäl vägrar Google att ge ett svar till PaLM: \n\n",
|
100 |
+
"⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ För att säkerställa säkerheten för API-nyckeln, vänligen ändra nätverksinställningarna i konfigurationsfilen `config.json`.",
|
101 |
+
"网络": "nätverksparametrar",
|
102 |
+
"暂时未知": "Okänd",
|
103 |
+
|
104 |
+
"剩余配额不足,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/常见问题#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)": "Återstående kvot är otillräcklig, [läs mer](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/常见问题#you-exceeded-your-current-quota-please-check-your-plan-and-billing-details)",
|
105 |
+
"你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)": "Du har inte behörighet att komma åt GPT-4, [läs mer](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)",
|
106 |
+
"请查看 config_example.json,配置 Azure OpenAI": "Vänligen granska config_example.json för att konfigurera Azure OpenAI",
|
107 |
+
|
108 |
+
"微调": "Finjustering",
|
109 |
+
"训练状态": "Träningsstatus",
|
110 |
+
"查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "Se [användarguiden](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) för mer information",
|
111 |
+
"准备数据集": "Förbered dataset",
|
112 |
+
"数据集预览": "Datasetförhandsvisning",
|
113 |
+
"选择数据集": "Välj dataset",
|
114 |
+
"上传到OpenAI": "Ladda upp till OpenAI",
|
115 |
+
"文件ID": "Fil-ID",
|
116 |
+
"上传到 OpenAI 后自动填充": "Automatiskt ifylld efter uppladdning till OpenAI",
|
117 |
+
"模型名称后缀": "Modellnamnstillägg",
|
118 |
+
"可选,用于区分不同的模型": "Valfritt, används för att särskilja olika modeller",
|
119 |
+
"训练轮数(Epochs)": "Träningsomgångar (Epochs)",
|
120 |
+
"开始训练": "Börja träning",
|
121 |
+
"状态": "Status",
|
122 |
+
"刷新状态": "Uppdatera status",
|
123 |
+
"取消所有任务": "Avbryt alla uppgifter",
|
124 |
+
"添加训练好的模型到模型列表": "Lägg till tränad modell i modellistan",
|
125 |
+
|
126 |
+
"设置": "inställningar",
|
127 |
+
"训练": "träning",
|
128 |
+
"工具箱": "verktygslåda",
|
129 |
+
"对话": "konversation",
|
130 |
+
"拓展": "utvidgning",
|
131 |
+
"上传文件": "ladda upp fil",
|
132 |
+
"知识库": "kunskapsbank",
|
133 |
+
"知识库文件": "kunskapsbankfil",
|
134 |
+
"在工具箱中管理知识库文件": "hantera kunskapsbankfiler i verktygslådan",
|
135 |
+
"在线搜索": "onlinesökning",
|
136 |
+
"关于": "om",
|
137 |
+
"新对话 ": "Ny dialog ",
|
138 |
+
"搜索(支持正则)...": "Sök (stöd för reguljära uttryck)...",
|
139 |
+
|
140 |
+
"对话命名方式": "Dialognamn",
|
141 |
+
"根据日期时间": "Enligt datum och tid",
|
142 |
+
"第一条提问": "Första frågan",
|
143 |
+
"模型自动总结(消耗tokens)": "Modellens automatiska sammanfattning (förbrukar tokens)"
|
144 |
+
}
|
modules/config.py
CHANGED
@@ -27,7 +27,8 @@ __all__ = [
|
|
27 |
"latex_delimiters_set",
|
28 |
"hide_history_when_not_logged_in",
|
29 |
"default_chuanhu_assistant_model",
|
30 |
-
"show_api_billing"
|
|
|
31 |
]
|
32 |
|
33 |
# 添加一个统一的config文件,避免文件过多造成的疑惑(优先级最低)
|
@@ -50,6 +51,7 @@ hide_history_when_not_logged_in = config.get(
|
|
50 |
check_update = config.get("check_update", True)
|
51 |
show_api_billing = config.get("show_api_billing", False)
|
52 |
show_api_billing = bool(os.environ.get("SHOW_API_BILLING", show_api_billing))
|
|
|
53 |
|
54 |
if os.path.exists("api_key.txt"):
|
55 |
logging.info("检测到api_key.txt文件,正在进行迁移...")
|
@@ -288,4 +290,4 @@ elif bot_avatar == "default":
|
|
288 |
if user_avatar == "" or user_avatar == "none" or user_avatar is None:
|
289 |
user_avatar = None
|
290 |
elif user_avatar == "default":
|
291 |
-
user_avatar = "web_assets/user.png"
|
|
|
27 |
"latex_delimiters_set",
|
28 |
"hide_history_when_not_logged_in",
|
29 |
"default_chuanhu_assistant_model",
|
30 |
+
"show_api_billing",
|
31 |
+
"chat_name_method_index",
|
32 |
]
|
33 |
|
34 |
# 添加一个统一的config文件,避免文件过多造成的疑惑(优先级最低)
|
|
|
51 |
check_update = config.get("check_update", True)
|
52 |
show_api_billing = config.get("show_api_billing", False)
|
53 |
show_api_billing = bool(os.environ.get("SHOW_API_BILLING", show_api_billing))
|
54 |
+
chat_name_method_index = config.get("chat_name_method_index", 0)
|
55 |
|
56 |
if os.path.exists("api_key.txt"):
|
57 |
logging.info("检测到api_key.txt文件,正在进行迁移...")
|
|
|
290 |
if user_avatar == "" or user_avatar == "none" or user_avatar is None:
|
291 |
user_avatar = None
|
292 |
elif user_avatar == "default":
|
293 |
+
user_avatar = "web_assets/user.png"
|
modules/models/base_model.py
CHANGED
@@ -10,6 +10,7 @@ import requests
|
|
10 |
import urllib3
|
11 |
import traceback
|
12 |
import pathlib
|
|
|
13 |
|
14 |
from tqdm import tqdm
|
15 |
import colorama
|
@@ -207,6 +208,7 @@ class BaseLLMModel:
|
|
207 |
self.api_key = None
|
208 |
self.need_api_key = False
|
209 |
self.single_turn = False
|
|
|
210 |
|
211 |
self.temperature = temperature
|
212 |
self.top_p = top_p
|
@@ -623,9 +625,10 @@ class BaseLLMModel:
|
|
623 |
self.history = []
|
624 |
self.all_token_counts = []
|
625 |
self.interrupted = False
|
626 |
-
|
627 |
-
|
628 |
-
|
|
|
629 |
|
630 |
def delete_first_conversation(self):
|
631 |
if self.history:
|
@@ -658,16 +661,34 @@ class BaseLLMModel:
|
|
658 |
token_sum += sum(token_lst[: i + 1])
|
659 |
return i18n("Token 计数: ") + f"{sum(token_lst)}" + i18n(",本次对话累计消耗了 ") + f"{token_sum} tokens"
|
660 |
|
661 |
-
def
|
662 |
if filename == "":
|
663 |
-
return
|
664 |
if not filename.endswith(".json"):
|
665 |
filename += ".json"
|
666 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
667 |
|
668 |
def auto_save(self, chatbot):
|
669 |
-
history_file_path
|
670 |
-
save_file(history_file_path, self.system_prompt,
|
671 |
self.history, chatbot, self.user_identifier)
|
672 |
|
673 |
def export_markdown(self, filename, chatbot, user_name):
|
@@ -675,19 +696,27 @@ class BaseLLMModel:
|
|
675 |
return
|
676 |
if not filename.endswith(".md"):
|
677 |
filename += ".md"
|
678 |
-
|
679 |
-
|
680 |
-
def load_chat_history(self,
|
681 |
-
logging.debug(f"{
|
682 |
-
|
683 |
-
|
684 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
685 |
try:
|
686 |
-
if "/" not in
|
687 |
history_file_path = os.path.join(
|
688 |
-
HISTORY_DIR,
|
689 |
else:
|
690 |
-
history_file_path =
|
|
|
|
|
691 |
with open(history_file_path, "r", encoding="utf-8") as f:
|
692 |
json_s = json.load(f)
|
693 |
try:
|
@@ -703,13 +732,13 @@ class BaseLLMModel:
|
|
703 |
logging.info(new_history)
|
704 |
except:
|
705 |
pass
|
706 |
-
logging.debug(f"{
|
707 |
self.history = json_s["history"]
|
708 |
-
return os.path.basename(
|
709 |
except:
|
710 |
# 没有对话历史或者对话历史解析失败
|
711 |
-
logging.info(f"没有找到对话历史记录 {
|
712 |
-
return
|
713 |
|
714 |
def delete_chat_history(self, filename, user_name):
|
715 |
if filename == "CANCELED":
|
@@ -724,19 +753,21 @@ class BaseLLMModel:
|
|
724 |
history_file_path = filename
|
725 |
try:
|
726 |
os.remove(history_file_path)
|
727 |
-
return i18n("删除对话历史成功"),
|
728 |
except:
|
729 |
logging.info(f"删除对话历史失败 {history_file_path}")
|
730 |
-
return i18n("对话历史")+filename+i18n("已经被删除啦"),
|
731 |
|
732 |
def auto_load(self):
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
history_file_path
|
739 |
-
|
|
|
|
|
740 |
|
741 |
def like(self):
|
742 |
"""like the last response, implement if needed
|
|
|
10 |
import urllib3
|
11 |
import traceback
|
12 |
import pathlib
|
13 |
+
import shutil
|
14 |
|
15 |
from tqdm import tqdm
|
16 |
import colorama
|
|
|
208 |
self.api_key = None
|
209 |
self.need_api_key = False
|
210 |
self.single_turn = False
|
211 |
+
self.history_file_path = get_first_history_name(user)
|
212 |
|
213 |
self.temperature = temperature
|
214 |
self.top_p = top_p
|
|
|
625 |
self.history = []
|
626 |
self.all_token_counts = []
|
627 |
self.interrupted = False
|
628 |
+
self.history_file_path = new_auto_history_filename(self.user_identifier)
|
629 |
+
history_name = self.history_file_path[:-5]
|
630 |
+
choices = [history_name] + get_history_names(self.user_identifier)
|
631 |
+
return [], self.token_message([0]), gr.Radio.update(choices=choices, value=history_name)
|
632 |
|
633 |
def delete_first_conversation(self):
|
634 |
if self.history:
|
|
|
661 |
token_sum += sum(token_lst[: i + 1])
|
662 |
return i18n("Token 计数: ") + f"{sum(token_lst)}" + i18n(",本次对话累计消耗了 ") + f"{token_sum} tokens"
|
663 |
|
664 |
+
def rename_chat_history(self, filename, chatbot, user_name):
|
665 |
if filename == "":
|
666 |
+
return gr.update(), gr.update()
|
667 |
if not filename.endswith(".json"):
|
668 |
filename += ".json"
|
669 |
+
self.delete_chat_history(self.history_file_path, user_name)
|
670 |
+
# 命名重复检测
|
671 |
+
repeat_file_index = 2
|
672 |
+
full_path = os.path.join(HISTORY_DIR, user_name, filename)
|
673 |
+
while os.path.exists(full_path):
|
674 |
+
full_path = os.path.join(HISTORY_DIR, user_name, f"{repeat_file_index}_{filename}")
|
675 |
+
repeat_file_index += 1
|
676 |
+
filename = os.path.basename(full_path)
|
677 |
+
|
678 |
+
self.history_file_path = filename
|
679 |
+
save_file(filename, self.system_prompt, self.history, chatbot, user_name)
|
680 |
+
return init_history_list(user_name)
|
681 |
+
|
682 |
+
def auto_name_chat_history(self, name_chat_method, user_question, chatbot, user_name, language):
|
683 |
+
if len(self.history) == 2:
|
684 |
+
user_question = self.history[0]["content"]
|
685 |
+
filename = user_question[:16] + ".json"
|
686 |
+
return self.rename_chat_history(filename, chatbot, user_name)
|
687 |
+
else:
|
688 |
+
return gr.update()
|
689 |
|
690 |
def auto_save(self, chatbot):
|
691 |
+
save_file(self.history_file_path, self.system_prompt,
|
|
|
692 |
self.history, chatbot, self.user_identifier)
|
693 |
|
694 |
def export_markdown(self, filename, chatbot, user_name):
|
|
|
696 |
return
|
697 |
if not filename.endswith(".md"):
|
698 |
filename += ".md"
|
699 |
+
save_file(filename, self.system_prompt, self.history, chatbot, user_name)
|
700 |
+
|
701 |
+
def load_chat_history(self, new_history_file_path=None, username=None):
|
702 |
+
logging.debug(f"{self.user_identifier} 加载对话历史中……")
|
703 |
+
if new_history_file_path is not None:
|
704 |
+
if type(new_history_file_path) != str:
|
705 |
+
# copy file from new_history_file_path.name to os.path.join(HISTORY_DIR, self.user_identifier)
|
706 |
+
new_history_file_path = new_history_file_path.name
|
707 |
+
shutil.copyfile(new_history_file_path, os.path.join(
|
708 |
+
HISTORY_DIR, self.user_identifier, os.path.basename(new_history_file_path)))
|
709 |
+
self.history_file_path = os.path.basename(new_history_file_path)
|
710 |
+
else:
|
711 |
+
self.history_file_path = new_history_file_path
|
712 |
try:
|
713 |
+
if "/" not in self.history_file_path:
|
714 |
history_file_path = os.path.join(
|
715 |
+
HISTORY_DIR, self.user_identifier, self.history_file_path)
|
716 |
else:
|
717 |
+
history_file_path = self.history_file_path
|
718 |
+
if not self.history_file_path.endswith(".json"):
|
719 |
+
history_file_path += ".json"
|
720 |
with open(history_file_path, "r", encoding="utf-8") as f:
|
721 |
json_s = json.load(f)
|
722 |
try:
|
|
|
732 |
logging.info(new_history)
|
733 |
except:
|
734 |
pass
|
735 |
+
logging.debug(f"{self.user_identifier} 加载对话历史完毕")
|
736 |
self.history = json_s["history"]
|
737 |
+
return os.path.basename(self.history_file_path), json_s["system"], json_s["chatbot"]
|
738 |
except:
|
739 |
# 没有对话历史或者对话历史解析失败
|
740 |
+
logging.info(f"没有找到对话历史记录 {self.history_file_path}")
|
741 |
+
return self.history_file_path, self.system_prompt, []
|
742 |
|
743 |
def delete_chat_history(self, filename, user_name):
|
744 |
if filename == "CANCELED":
|
|
|
753 |
history_file_path = filename
|
754 |
try:
|
755 |
os.remove(history_file_path)
|
756 |
+
return i18n("删除对话历史成功"), get_history_list(user_name), []
|
757 |
except:
|
758 |
logging.info(f"删除对话历史失败 {history_file_path}")
|
759 |
+
return i18n("对话历史")+filename+i18n("已经被删除啦"), get_history_list(user_name), []
|
760 |
|
761 |
def auto_load(self):
|
762 |
+
filepath = get_history_filepath(self.user_identifier)
|
763 |
+
if not filepath:
|
764 |
+
self.history_file_path = new_auto_history_filename(
|
765 |
+
self.user_identifier)
|
766 |
+
else:
|
767 |
+
self.history_file_path = filepath
|
768 |
+
filename, system_prompt, chatbot = self.load_chat_history()
|
769 |
+
filename = filename[:-5]
|
770 |
+
return filename, system_prompt, chatbot
|
771 |
|
772 |
def like(self):
|
773 |
"""like the last response, implement if needed
|
modules/models/models.py
CHANGED
@@ -228,6 +228,59 @@ class OpenAIClient(BaseLLMModel):
|
|
228 |
ret = super().set_key(new_access_key)
|
229 |
self._refresh_header()
|
230 |
return ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
|
233 |
class ChatGLM_Client(BaseLLMModel):
|
@@ -580,8 +633,7 @@ def get_model(
|
|
580 |
logging.info(msg)
|
581 |
lora_selector_visibility = True
|
582 |
if os.path.isdir("lora"):
|
583 |
-
|
584 |
-
"lora", filetypes=[""])
|
585 |
lora_choices = ["No LoRA"] + lora_choices
|
586 |
elif model_type == ModelType.LLaMA and lora_model_path != "":
|
587 |
logging.info(f"正在加载LLaMA模型: {model_name} + {lora_model_path}")
|
|
|
228 |
ret = super().set_key(new_access_key)
|
229 |
self._refresh_header()
|
230 |
return ret
|
231 |
+
|
232 |
+
def _single_query_at_once(self, history, temperature=1.0):
|
233 |
+
timeout = TIMEOUT_ALL
|
234 |
+
headers = {
|
235 |
+
"Content-Type": "application/json",
|
236 |
+
"Authorization": f"Bearer {self.api_key}",
|
237 |
+
"temperature": f"{temperature}",
|
238 |
+
}
|
239 |
+
payload = {
|
240 |
+
"model": self.model_name,
|
241 |
+
"messages": history,
|
242 |
+
}
|
243 |
+
# 如果有自定义的api-host,使用自定义host发送请求,否则使用默认设置发送请求
|
244 |
+
if shared.state.completion_url != COMPLETION_URL:
|
245 |
+
logging.debug(f"使用自定义API URL: {shared.state.completion_url}")
|
246 |
+
|
247 |
+
with retrieve_proxy():
|
248 |
+
response = requests.post(
|
249 |
+
shared.state.completion_url,
|
250 |
+
headers=headers,
|
251 |
+
json=payload,
|
252 |
+
stream=False,
|
253 |
+
timeout=timeout,
|
254 |
+
)
|
255 |
+
|
256 |
+
return response
|
257 |
+
|
258 |
+
|
259 |
+
def auto_name_chat_history(self, name_chat_method, user_question, chatbot, user_name, language):
|
260 |
+
if len(self.history) == 2:
|
261 |
+
user_question = self.history[0]["content"]
|
262 |
+
if name_chat_method == i18n("模型自动总结(消耗tokens)"):
|
263 |
+
ai_answer = self.history[1]["content"]
|
264 |
+
try:
|
265 |
+
history = [
|
266 |
+
{ "role": "system", "content": SUMMARY_CHAT_SYSTEM_PROMPT},
|
267 |
+
{ "role": "user", "content": f"User: {user_question}\nAssistant: {ai_answer}"}
|
268 |
+
]
|
269 |
+
response = self._single_query_at_once(history, temperature=0.0)
|
270 |
+
response = json.loads(response.text)
|
271 |
+
content = response["choices"][0]["message"]["content"]
|
272 |
+
filename = content + ".json"
|
273 |
+
except Exception as e:
|
274 |
+
logging.info(f"自动命名失败。{e}")
|
275 |
+
filename = user_question[:16] + ".json"
|
276 |
+
return self.rename_chat_history(filename, chatbot, user_name)
|
277 |
+
elif name_chat_method == i18n("第一条提问"):
|
278 |
+
filename = user_question[:16] + ".json"
|
279 |
+
return self.rename_chat_history(filename, chatbot, user_name)
|
280 |
+
else:
|
281 |
+
return gr.update()
|
282 |
+
else:
|
283 |
+
return gr.update()
|
284 |
|
285 |
|
286 |
class ChatGLM_Client(BaseLLMModel):
|
|
|
633 |
logging.info(msg)
|
634 |
lora_selector_visibility = True
|
635 |
if os.path.isdir("lora"):
|
636 |
+
get_file_names_by_pinyin("lora", filetypes=[""])
|
|
|
637 |
lora_choices = ["No LoRA"] + lora_choices
|
638 |
elif model_type == ModelType.LLaMA and lora_model_path != "":
|
639 |
logging.info(f"正在加载LLaMA模型: {model_name} + {lora_model_path}")
|
modules/presets.py
CHANGED
@@ -36,6 +36,7 @@ BILLING_NOT_APPLICABLE_MSG = i18n("账单信息不适用") # 本地运行的模
|
|
36 |
TIMEOUT_STREAMING = 60 # 流式对话时的超时时间
|
37 |
TIMEOUT_ALL = 200 # 非流式对话时的超时时间
|
38 |
ENABLE_STREAMING_OPTION = True # 是否启用选择选择是否实时显示回答的勾选框
|
|
|
39 |
HIDE_MY_KEY = False # 如果你想在UI中隐藏你的 API 密钥,将此值设置为 True
|
40 |
CONCURRENT_COUNT = 100 # 允许同时使用的用户数量
|
41 |
|
@@ -132,6 +133,12 @@ REPLY_LANGUAGES = [
|
|
132 |
"跟随问题语言(不稳定)"
|
133 |
]
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
WEBSEARCH_PTOMPT_TEMPLATE = """\
|
137 |
Web search results:
|
@@ -177,6 +184,15 @@ SUMMARIZE_PROMPT = """Write a concise summary of the following:
|
|
177 |
|
178 |
CONCISE SUMMARY IN 中文:"""
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
ALREADY_CONVERTED_MARK = "<!-- ALREADY CONVERTED BY PARSER. -->"
|
181 |
START_OF_OUTPUT_MARK = "<!-- SOO IN MESSAGE -->"
|
182 |
END_OF_OUTPUT_MARK = "<!-- EOO IN MESSAGE -->"
|
@@ -249,3 +265,4 @@ small_and_beautiful_theme = gr.themes.Soft(
|
|
249 |
# gradio 会把这个几个chatbot打头的变量应用到其他md渲染的地方,鬼晓得怎么想的。。。
|
250 |
chatbot_code_background_color_dark="*neutral_950",
|
251 |
)
|
|
|
|
36 |
TIMEOUT_STREAMING = 60 # 流式对话时的超时时间
|
37 |
TIMEOUT_ALL = 200 # 非流式对话时的超时时间
|
38 |
ENABLE_STREAMING_OPTION = True # 是否启用选择选择是否实时显示回答的勾选框
|
39 |
+
ENABLE_LLM_NAME_CHAT_OPTION = True # 是否启用选择是否使用LLM模型的勾选框
|
40 |
HIDE_MY_KEY = False # 如果你想在UI中隐藏你的 API 密钥,将此值设置为 True
|
41 |
CONCURRENT_COUNT = 100 # 允许同时使用的用户数量
|
42 |
|
|
|
133 |
"跟随问题语言(不稳定)"
|
134 |
]
|
135 |
|
136 |
+
HISTORY_NAME_METHODS = [
|
137 |
+
i18n("根据日期时间"),
|
138 |
+
i18n("第一条提问"),
|
139 |
+
i18n("模型自动总结(消耗tokens)"),
|
140 |
+
]
|
141 |
+
|
142 |
|
143 |
WEBSEARCH_PTOMPT_TEMPLATE = """\
|
144 |
Web search results:
|
|
|
184 |
|
185 |
CONCISE SUMMARY IN 中文:"""
|
186 |
|
187 |
+
SUMMARY_CHAT_SYSTEM_PROMPT = """\
|
188 |
+
Please summarize the following conversation for a chat topic.
|
189 |
+
No more than 16 characters.
|
190 |
+
No special characters.
|
191 |
+
Punctuation mark is banned.
|
192 |
+
Not including '.' ':' '?' '!' '“' '*' '<' '>'.
|
193 |
+
Reply in user's language.
|
194 |
+
"""
|
195 |
+
|
196 |
ALREADY_CONVERTED_MARK = "<!-- ALREADY CONVERTED BY PARSER. -->"
|
197 |
START_OF_OUTPUT_MARK = "<!-- SOO IN MESSAGE -->"
|
198 |
END_OF_OUTPUT_MARK = "<!-- EOO IN MESSAGE -->"
|
|
|
265 |
# gradio 会把这个几个chatbot打头的变量应用到其他md渲染的地方,鬼晓得怎么想的。。。
|
266 |
chatbot_code_background_color_dark="*neutral_950",
|
267 |
)
|
268 |
+
|
modules/utils.py
CHANGED
@@ -68,8 +68,11 @@ def delete_last_conversation(current_model, *args):
|
|
68 |
def set_system_prompt(current_model, *args):
|
69 |
return current_model.set_system_prompt(*args)
|
70 |
|
71 |
-
def
|
72 |
-
return current_model.
|
|
|
|
|
|
|
73 |
|
74 |
def export_markdown(current_model, *args):
|
75 |
return current_model.export_markdown(*args)
|
@@ -331,23 +334,31 @@ def construct_assistant(text):
|
|
331 |
|
332 |
|
333 |
def save_file(filename, system, history, chatbot, user_name):
|
334 |
-
logging.debug(f"{user_name} 保存对话历史中……")
|
335 |
os.makedirs(os.path.join(HISTORY_DIR, user_name), exist_ok=True)
|
336 |
-
if filename.endswith(".
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
return os.path.join(HISTORY_DIR, user_name, filename)
|
352 |
|
353 |
|
@@ -355,16 +366,13 @@ def sorted_by_pinyin(list):
|
|
355 |
return sorted(list, key=lambda char: lazy_pinyin(char)[0][0])
|
356 |
|
357 |
def sorted_by_last_modified_time(list, dir):
|
358 |
-
return sorted(list, key=lambda char: os.path.
|
359 |
|
360 |
def get_file_names_by_type(dir, filetypes=[".json"]):
|
361 |
logging.debug(f"获取文件名列表,目录为{dir},文件类型为{filetypes}")
|
362 |
files = []
|
363 |
-
|
364 |
-
for
|
365 |
-
files += [f for f in os.listdir(dir) if f.endswith(type)]
|
366 |
-
except FileNotFoundError:
|
367 |
-
files = [""]
|
368 |
logging.debug(f"files are:{files}")
|
369 |
return files
|
370 |
|
@@ -390,15 +398,31 @@ def get_file_names_by_last_modified_time(dir, filetypes=[".json"]):
|
|
390 |
def get_history_names(user_name=""):
|
391 |
logging.debug(f"从用户 {user_name} 中获取历史记录文件名列表")
|
392 |
if user_name == "" and hide_history_when_not_logged_in:
|
393 |
-
return
|
394 |
else:
|
395 |
history_files = get_file_names_by_last_modified_time(os.path.join(HISTORY_DIR, user_name))
|
|
|
396 |
return history_files
|
397 |
|
398 |
-
def
|
|
|
|
|
|
|
|
|
399 |
history_names = get_history_names(user_name)
|
400 |
-
return gr.
|
401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
|
403 |
def load_template(filename, mode=0):
|
404 |
logging.debug(f"加载模板文件{filename},模式为{mode}(0为返回字典和下拉菜单,1为返回下拉菜单,2为返回字典)")
|
@@ -638,36 +662,21 @@ def toggle_like_btn_visibility(selected_model_name):
|
|
638 |
else:
|
639 |
return gr.update(visible=False)
|
640 |
|
641 |
-
def new_auto_history_filename(
|
642 |
-
latest_file =
|
643 |
if latest_file:
|
644 |
-
with open(os.path.join(
|
645 |
if len(f.read()) == 0:
|
646 |
return latest_file
|
647 |
-
now = datetime.datetime.now().strftime('%
|
648 |
return f'{now}.json'
|
649 |
|
650 |
-
def get_latest_filepath(dirname):
|
651 |
-
pattern = re.compile(r'\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}')
|
652 |
-
latest_time = None
|
653 |
-
latest_file = None
|
654 |
-
for filename in os.listdir(dirname):
|
655 |
-
if os.path.isfile(os.path.join(dirname, filename)):
|
656 |
-
match = pattern.search(filename)
|
657 |
-
if match and match.group(0) == filename[:19]:
|
658 |
-
time_str = filename[:19]
|
659 |
-
filetime = datetime.datetime.strptime(time_str, '%Y-%m-%d_%H-%M-%S')
|
660 |
-
if not latest_time or filetime > latest_time:
|
661 |
-
latest_time = filetime
|
662 |
-
latest_file = filename
|
663 |
-
return latest_file
|
664 |
-
|
665 |
def get_history_filepath(username):
|
666 |
dirname = os.path.join(HISTORY_DIR, username)
|
667 |
os.makedirs(dirname, exist_ok=True)
|
668 |
-
latest_file =
|
669 |
if not latest_file:
|
670 |
-
latest_file = new_auto_history_filename(
|
671 |
|
672 |
latest_file = os.path.join(dirname, latest_file)
|
673 |
return latest_file
|
@@ -705,3 +714,6 @@ def get_file_hash(file_src=None, file_paths=None):
|
|
705 |
md5_hash.update(chunk)
|
706 |
|
707 |
return md5_hash.hexdigest()
|
|
|
|
|
|
|
|
68 |
def set_system_prompt(current_model, *args):
|
69 |
return current_model.set_system_prompt(*args)
|
70 |
|
71 |
+
def rename_chat_history(current_model, *args):
|
72 |
+
return current_model.rename_chat_history(*args)
|
73 |
+
|
74 |
+
def auto_name_chat_history(current_model, *args):
|
75 |
+
return current_model.auto_name_chat_history(*args)
|
76 |
|
77 |
def export_markdown(current_model, *args):
|
78 |
return current_model.export_markdown(*args)
|
|
|
334 |
|
335 |
|
336 |
def save_file(filename, system, history, chatbot, user_name):
|
|
|
337 |
os.makedirs(os.path.join(HISTORY_DIR, user_name), exist_ok=True)
|
338 |
+
if filename.endswith(".md"):
|
339 |
+
filename = filename[:-3]
|
340 |
+
if not filename.endswith(".json") and not filename.endswith(".md"):
|
341 |
+
filename += ".json"
|
342 |
+
if filename == ".json":
|
343 |
+
raise Exception("文件名不能为空")
|
344 |
+
|
345 |
+
json_s = {"system": system, "history": history, "chatbot": chatbot}
|
346 |
+
repeat_file_index = 2
|
347 |
+
if "/" in filename or "\\" in filename:
|
348 |
+
history_file_path = filename
|
349 |
+
else:
|
350 |
+
history_file_path = os.path.join(HISTORY_DIR, user_name, filename)
|
351 |
+
|
352 |
+
with open(history_file_path, "w", encoding='utf-8') as f:
|
353 |
+
json.dump(json_s, f, ensure_ascii=False)
|
354 |
+
|
355 |
+
filename = filename.split("/")[-1]
|
356 |
+
filename_md = filename[:-5] + ".md"
|
357 |
+
md_s = f"system: \n- {system} \n"
|
358 |
+
for data in history:
|
359 |
+
md_s += f"\n{data['role']}: \n- {data['content']} \n"
|
360 |
+
with open(os.path.join(HISTORY_DIR, user_name, filename_md), "w", encoding="utf8") as f:
|
361 |
+
f.write(md_s)
|
362 |
return os.path.join(HISTORY_DIR, user_name, filename)
|
363 |
|
364 |
|
|
|
366 |
return sorted(list, key=lambda char: lazy_pinyin(char)[0][0])
|
367 |
|
368 |
def sorted_by_last_modified_time(list, dir):
|
369 |
+
return sorted(list, key=lambda char: os.path.getctime(os.path.join(dir, char)), reverse=True)
|
370 |
|
371 |
def get_file_names_by_type(dir, filetypes=[".json"]):
|
372 |
logging.debug(f"获取文件名列表,目录为{dir},文件类型为{filetypes}")
|
373 |
files = []
|
374 |
+
for type in filetypes:
|
375 |
+
files += [f for f in os.listdir(dir) if f.endswith(type)]
|
|
|
|
|
|
|
376 |
logging.debug(f"files are:{files}")
|
377 |
return files
|
378 |
|
|
|
398 |
def get_history_names(user_name=""):
|
399 |
logging.debug(f"从用户 {user_name} 中获取历史记录文件名列表")
|
400 |
if user_name == "" and hide_history_when_not_logged_in:
|
401 |
+
return []
|
402 |
else:
|
403 |
history_files = get_file_names_by_last_modified_time(os.path.join(HISTORY_DIR, user_name))
|
404 |
+
history_files = [f[:f.rfind(".")] for f in history_files]
|
405 |
return history_files
|
406 |
|
407 |
+
def get_first_history_name(user_name=""):
|
408 |
+
history_names = get_history_names(user_name)
|
409 |
+
return history_names[0] if history_names else None
|
410 |
+
|
411 |
+
def get_history_list(user_name=""):
|
412 |
history_names = get_history_names(user_name)
|
413 |
+
return gr.Radio.update(choices=history_names)
|
414 |
|
415 |
+
def init_history_list(user_name=""):
|
416 |
+
history_names = get_history_names(user_name)
|
417 |
+
return gr.Radio.update(choices=history_names, value=history_names[0] if history_names else "")
|
418 |
+
|
419 |
+
def filter_history(user_name, keyword):
|
420 |
+
history_names = get_history_names(user_name)
|
421 |
+
try:
|
422 |
+
history_names = [name for name in history_names if re.search(keyword, name)]
|
423 |
+
return gr.update(choices=history_names)
|
424 |
+
except:
|
425 |
+
return gr.update(choices=history_names)
|
426 |
|
427 |
def load_template(filename, mode=0):
|
428 |
logging.debug(f"加载模板文件{filename},模式为{mode}(0为返回字典和下拉菜单,1为返回下拉菜单,2为返回字典)")
|
|
|
662 |
else:
|
663 |
return gr.update(visible=False)
|
664 |
|
665 |
+
def new_auto_history_filename(username):
|
666 |
+
latest_file = get_first_history_name(username)
|
667 |
if latest_file:
|
668 |
+
with open(os.path.join(HISTORY_DIR, username, latest_file + ".json"), 'r', encoding="utf-8") as f:
|
669 |
if len(f.read()) == 0:
|
670 |
return latest_file
|
671 |
+
now = i18n("新对话 ") + datetime.datetime.now().strftime('%m-%d %H꞉%M')
|
672 |
return f'{now}.json'
|
673 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
674 |
def get_history_filepath(username):
|
675 |
dirname = os.path.join(HISTORY_DIR, username)
|
676 |
os.makedirs(dirname, exist_ok=True)
|
677 |
+
latest_file = get_first_history_name(username)
|
678 |
if not latest_file:
|
679 |
+
latest_file = new_auto_history_filename(username)
|
680 |
|
681 |
latest_file = os.path.join(dirname, latest_file)
|
682 |
return latest_file
|
|
|
714 |
md5_hash.update(chunk)
|
715 |
|
716 |
return md5_hash.hexdigest()
|
717 |
+
|
718 |
+
def myprint(**args):
|
719 |
+
print(args)
|
modules/webui.py
CHANGED
@@ -56,11 +56,24 @@ def reload_javascript():
|
|
56 |
js += '<script async type="module" src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>'
|
57 |
js += '<script async type="module" src="http://spin.js.org/spin.umd.js"></script><link type="text/css" href="https://spin.js.org/spin.css" rel="stylesheet" />'
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
css = css_html()
|
60 |
|
61 |
def template_response(*args, **kwargs):
|
62 |
res = GradioTemplateResponseOriginal(*args, **kwargs)
|
63 |
-
res.body = res.body.replace(b'</head>', f'{js}</head>'.encode("utf8"))
|
|
|
64 |
res.body = res.body.replace(b'</body>', f'{css}</body>'.encode("utf8"))
|
65 |
res.init_headers()
|
66 |
return res
|
|
|
56 |
js += '<script async type="module" src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>'
|
57 |
js += '<script async type="module" src="http://spin.js.org/spin.umd.js"></script><link type="text/css" href="https://spin.js.org/spin.css" rel="stylesheet" />'
|
58 |
|
59 |
+
meta = """
|
60 |
+
<meta name="apple-mobile-web-app-title" content="川虎 Chat">
|
61 |
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
62 |
+
<meta name="application-name" content="川虎 Chat">
|
63 |
+
<meta name='viewport' content='width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover'>
|
64 |
+
<meta name="theme-color" content="#ffffff">
|
65 |
+
|
66 |
+
<link rel="apple-touch-icon-precomposed" href="/file=web_assets/icon/mask-icon-512.png" crossorigin="use-credentials">
|
67 |
+
<link rel="apple-touch-icon" href="/file=web_assets/icon/mask-icon-512.png" crossorigin="use-credentials">
|
68 |
+
|
69 |
+
<link rel="manifest" href="/file=web_assets/manifest.json" crossorigin="use-credentials">
|
70 |
+
"""
|
71 |
css = css_html()
|
72 |
|
73 |
def template_response(*args, **kwargs):
|
74 |
res = GradioTemplateResponseOriginal(*args, **kwargs)
|
75 |
+
res.body = res.body.replace(b'</head>', f'{meta}{js}</head>'.encode("utf8"))
|
76 |
+
# res.body = res.body.replace(b'</head>', f'{js}</head>'.encode("utf8"))
|
77 |
res.body = res.body.replace(b'</body>', f'{css}</body>'.encode("utf8"))
|
78 |
res.init_headers()
|
79 |
return res
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
gradio==3.
|
2 |
gradio_client==0.5.0
|
3 |
pypinyin
|
4 |
tiktoken
|
@@ -28,3 +28,4 @@ tabulate
|
|
28 |
ujson
|
29 |
python-docx
|
30 |
websocket_client
|
|
|
|
1 |
+
gradio==3.43.2
|
2 |
gradio_client==0.5.0
|
3 |
pypinyin
|
4 |
tiktoken
|
|
|
28 |
ujson
|
29 |
python-docx
|
30 |
websocket_client
|
31 |
+
pydantic==1.10.8
|
web_assets/html/chatbot_header_btn.html
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="header-btn-groups">
|
2 |
+
<div class="btn-bar-group" style="margin-left: -12px;">
|
3 |
+
<span class="show-on-gpt">
|
4 |
+
<button id="chuanhu-training-btn" onclick="openTrainingBox()" class="chuanhu-ui-btn">
|
5 |
+
<svg width="24px" height="24px" viewBox="0 0 45.297 28.8394" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
6 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
7 |
+
<g fill="currentColor" fill-rule="nonzero">
|
8 |
+
<path d="M0,23.4288 C0,27.0248 1.8307,28.8394 5.45907,28.8394 L39.8379,28.8394 C43.4663,28.8394 45.297,27.0248 45.297,23.4288 L45.297,5.41055 C45.297,1.81453 43.4663,0 39.8379,0 L9.91219,0 C6.82641,0 5.13938,1.74422 4.24945,4.43907 L0.618281,15.4643 C0.1875,16.7405 0,17.8041 0,19.4644 L0,23.4288 Z M17.6306,14.2226 L17.6306,8.14923 C17.6306,7.09126 18.2522,6.46969 19.3263,6.46969 L36.3459,6.46969 C37.4201,6.46969 38.0344,7.09126 38.0344,8.14923 L38.0344,14.2226 C38.0344,15.2498 37.4201,15.8714 36.3459,15.8714 L19.3263,15.8714 C18.2522,15.8714 17.6306,15.2498 17.6306,14.2226 Z M6.14415,15.8714 C5.12415,15.8714 4.63102,15.0713 5.01259,13.8724 L7.02539,7.75805 C7.27758,6.97805 7.66875,6.46969 8.95946,6.46969 L11.2486,6.46969 C12.3066,6.46969 12.9443,7.09126 12.9443,8.14923 L12.9443,14.2226 C12.9443,15.2498 12.3066,15.8714 11.2486,15.8714 L6.14415,15.8714 Z" fill-opacity="0.85"></path>
|
9 |
+
</g>
|
10 |
+
</g>
|
11 |
+
</svg>
|
12 |
+
</button>
|
13 |
+
</span>
|
14 |
+
</div>
|
15 |
+
|
16 |
+
<div class="btn-bar-group">
|
17 |
+
<div class="nav-item-dropdown">
|
18 |
+
<button id="export-chat-btn" onclick="" class="chuanhu-ui-btn dropdown-trigger">
|
19 |
+
<svg width="24px" height="24px" viewBox="0 0 16.1359 20.56475" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
20 |
+
<g stroke="none" fill="currentColor" fill-opacity="0.85" fill-rule="nonzero">
|
21 |
+
<path d="M13.3438,5.76305 C15.2024,5.76305 16.1359,6.7002 16.1359,8.5309 L16.1359,17.79695 C16.1359,19.62395 15.2024,20.56475 13.3438,20.56475 L2.79211,20.56475 C0.941602,20.56475 0,19.63125 0,17.79695 L0,8.5309 C0,6.69293 0.941602,5.76305 2.79211,5.76305 L5.71,5.76275 L5.71,7.06975 L2.81555,7.06993 C1.89173222,7.06993 1.36322898,7.53591574 1.30735769,8.43213487 L1.30242,8.59475 L1.30242,17.73305 C1.30242,18.74355 1.83739,19.25425 2.81555,19.25425 L13.3204,19.25425 C14.2759,19.25425 14.8335,18.74355 14.8335,17.73305 L14.8335,8.59475 C14.8335,7.59235 14.2759,7.06993 13.3204,7.06993 L10.416,7.06975 L10.416,5.76275 L13.3438,5.76305 Z"></path>
|
22 |
+
<path d="M8.06391,13.43715 C8.41559,13.43715 8.71512,13.14575 8.71512,12.80215 L8.71512,3.14567 L8.66297,1.78664 L9.38039,2.54004 L10.8584,4.09078 C10.978,4.21852 11.1454,4.28602 11.301,4.28602 C11.6373,4.28602 11.8964,4.04309 11.8964,3.7193 C11.8964,3.53941 11.8245,3.41531 11.6967,3.29566 L8.5316,0.21586 C8.37153,0.05578 8.2357,0 8.06391,0 C7.9002,0 7.76074,0.05578 7.59621,0.21586 L4.42746,3.29566 C4.30781,3.41531 4.23586,3.53941 4.23586,3.7193 C4.23586,4.04309 4.48324,4.28602 4.82321,4.28602 C4.97883,4.28602 5.15426,4.21852 5.27028,4.09078 L6.75188,2.54004 L7.47293,1.78301 L7.42078,3.14567 L7.42078,12.80215 C7.42078,13.14575 7.72031,13.43715 8.06391,13.43715 Z"></path>
|
23 |
+
</g>
|
24 |
+
</svg>
|
25 |
+
</button>
|
26 |
+
<div class="dropdown-menu">
|
27 |
+
<div class="dropdown-menu-item">
|
28 |
+
<button onclick="jsonDownloadClick()">{json_label}</button>
|
29 |
+
</div>
|
30 |
+
<div class="dropdown-menu-item">
|
31 |
+
<button onclick="mdDownloadClick()">{md_label}</button>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
|
36 |
+
<button id="new-chat-btn" onclick="newChatClick()" class="chuanhu-ui-btn">
|
37 |
+
<svg width="24px" height="24px" viewBox="0 0 41.3058 37.9805" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
38 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
39 |
+
<g fill-rule="nonzero">
|
40 |
+
<path d="M7.85906,37.9732 C10.2516,37.9732 15.1013,35.6613 18.7802,33.1193 C31.3151,33.6708 41.3058,26.4138 41.3058,16.6013 C41.3058,7.42008 32.1359,0 20.6529,0 C9.17883,0 0,7.42008 0,16.6013 C0,22.5973 3.85266,27.9152 9.65789,30.6202 C8.82141,32.2172 7.33664,34.2469 6.52195,35.292 C5.57226,36.5116 6.08883,37.9732 7.85906,37.9732 Z M9.48751,35.2875 C9.34688,35.336 9.30727,35.2334 9.40829,35.1089 C10.392,33.8965 11.858,32.0149 12.5182,30.7552 C12.9734,29.9184 12.8473,29.1593 11.8221,28.6863 C6.06376,26.0217 2.68407,21.6335 2.68407,16.6013 C2.68407,8.91657 10.6542,2.66954 20.6529,2.66954 C30.6677,2.66954 38.6217,8.91657 38.6217,16.6013 C38.6217,24.2698 30.6677,30.5241 20.6529,30.5241 C20.1642,30.5241 19.5356,30.495 18.747,30.4659 C18.0687,30.4587 17.5069,30.66 16.9006,31.1402 C14.4764,32.7921 11.1403,34.7288 9.48751,35.2875 Z" fill-opacity="0.85" fill="currentColor"></path>
|
41 |
+
<path d="M12.233,16.7468 C12.233,17.5238 12.7908,18.0816 13.6235,18.0816 L19.2947,18.0816 L19.2947,23.7778 C19.2947,24.5855 19.8525,25.1522 20.6295,25.1522 C21.4371,25.1522 22.0111,24.5927 22.0111,23.7778 L22.0111,18.0816 L27.7146,18.0816 C28.515,18.0816 29.0817,17.5238 29.0817,16.7468 C29.0817,15.9391 28.5223,15.3652 27.7146,15.3652 L22.0111,15.3652 L22.0111,9.67782 C22.0111,8.85399 21.4371,8.28727 20.6295,8.28727 C19.8525,8.28727 19.2947,8.86125 19.2947,9.67782 L19.2947,15.3652 L13.6235,15.3652 C12.7835,15.3652 12.233,15.9391 12.233,16.7468 Z" fill-opacity="0.85" fill="currentColor"></path>
|
42 |
+
</g>
|
43 |
+
</g>
|
44 |
+
</svg>
|
45 |
+
</button>
|
46 |
+
|
47 |
+
<button id="open-toolbox-btn" onclick="toolboxClick()" class="chuanhu-ui-btn">
|
48 |
+
<!-- <svg width="24px" height="24px" viewBox="0 0 43.4767 34.1953" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
49 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
50 |
+
<g fill-rule="nonzero">
|
51 |
+
<path d="M5.97657,34.1953 L37.5,34.1953 C41.5078,34.1953 43.4767,32.2266 43.4767,28.289 L43.4767,5.92968 C43.4767,1.9922 41.5078,0.0234285 37.5,0.0234285 L5.97657,0.0234285 C1.99218,0.0234285 0,1.9922 0,5.92968 L0,28.289 C0,32.2266 1.99218,34.1953 5.97657,34.1953 Z M6.02346,30.7969 C4.33593,30.7969 3.37501,29.9063 3.37501,28.125 L3.37501,6.09375 C3.37501,4.33594 4.33593,3.42188 6.02346,3.42188 L37.4531,3.42188 C39.1406,3.42188 40.1015,4.33594 40.1015,6.09375 L40.1015,28.125 C40.1015,29.9063 39.1406,30.7969 37.4531,30.7969 L6.02346,30.7969 Z M26.0625,31.4531 L29.3437,31.4531 L29.3437,2.83594 L26.0625,2.83594 L26.0625,31.4531 Z M32.8828,10.2188 L36.5625,10.2188 C37.1953,10.2188 37.7344,9.65626 37.7344,9.04685 C37.7344,8.43749 37.1953,7.92188 36.5625,7.92188 L32.8828,7.92188 C32.2735,7.92188 31.7344,8.43749 31.7344,9.04685 C31.7344,9.65626 32.2735,10.2188 32.8828,10.2188 Z M32.8828,14.9063 L36.5625,14.9063 C37.1953,14.9063 37.7344,14.3672 37.7344,13.7344 C37.7344,13.125 37.1953,12.6094 36.5625,12.6094 L32.8828,12.6094 C32.2735,12.6094 31.7344,13.125 31.7344,13.7344 C31.7344,14.3672 32.2735,14.9063 32.8828,14.9063 Z M32.8828,19.5937 L36.5625,19.5937 C37.1953,19.5937 37.7344,19.0547 37.7344,18.4453 C37.7344,17.8359 37.1953,17.3203 36.5625,17.3203 L32.8828,17.3203 C32.2735,17.3203 31.7344,17.8359 31.7344,18.4453 C31.7344,19.0547 32.2735,19.5937 32.8828,19.5937 Z" fill-opacity="0.85" fill="currentColor"></path>
|
52 |
+
</g>
|
53 |
+
</g>
|
54 |
+
</svg> -->
|
55 |
+
<svg width="24px" height="24px" viewBox="0 0 33.5163 33.5705" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
56 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
57 |
+
<g fill="currentColor" fill-rule="nonzero">
|
58 |
+
<path d="M5.58422,33.5705 L27.9321,33.5705 C31.6493,33.5705 33.5163,31.6889 33.5163,28.0348 L33.5163,5.57367 C33.5163,1.91953 31.6493,0.0379686 27.9321,0.0379686 L5.58422,0.0379686 C1.8832,0.0379686 0,1.905 0,5.57367 L0,28.0348 C0,31.7034 1.8832,33.5705 5.58422,33.5705 Z M5.6311,30.9495 C3.67477,30.9495 2.60485,29.928 2.60485,27.907 L2.60485,5.70141 C2.60485,3.69657 3.67477,2.65899 5.6311,2.65899 L27.8852,2.65899 C29.8125,2.65899 30.9115,3.69657 30.9115,5.70141 L30.9115,27.907 C30.9115,29.928 29.8125,30.9495 27.8852,30.9495 L5.6311,30.9495 Z" fill-opacity="0.85"></path>
|
59 |
+
<path d="M7.69266,12.7402 L17.3438,12.7402 L17.3438,10.572 L7.69266,10.572 C7.07907,10.572 6.60047,11.0505 6.60047,11.648 C6.60047,12.2616 7.07907,12.7402 7.69266,12.7402 Z M20.021,15.3488 C22.0545,15.3488 23.704,13.683 23.704,11.6334 C23.704,9.6 22.0545,7.9343 20.021,7.9343 C17.9876,7.9343 16.3219,9.6 16.3219,11.6334 C16.3219,13.683 17.9876,15.3488 20.021,15.3488 Z M20.021,13.5841 C18.922,13.5841 18.0865,12.7179 18.0865,11.6262 C18.0865,10.5345 18.922,9.69165 20.021,9.69165 C21.0966,9.69165 21.9483,10.5345 21.9483,11.6262 C21.9483,12.7179 21.0966,13.5841 20.021,13.5841 Z M22.5487,12.7402 L25.8884,12.7402 C26.4534,12.7402 26.932,12.2616 26.932,11.648 C26.932,11.0505 26.4534,10.572 25.8884,10.572 L22.5487,10.572 L22.5487,12.7402 Z M25.8237,20.5158 L16.1726,20.5158 L16.1726,22.6913 L25.8237,22.6913 C26.4534,22.6913 26.932,22.2054 26.932,21.608 C26.932,21.0016 26.4534,20.5158 25.8237,20.5158 Z M13.4953,17.9145 C11.4781,17.9145 9.81962,19.5802 9.81962,21.6225 C9.81962,23.6559 11.4781,25.3216 13.4953,25.3216 C15.5288,25.3216 17.1945,23.6559 17.1945,21.6225 C17.1945,19.5802 15.5288,17.9145 13.4953,17.9145 Z M13.4953,19.6791 C14.5943,19.6791 15.4298,20.538 15.4298,21.6298 C15.4298,22.7288 14.5943,23.5643 13.4953,23.5643 C12.4198,23.5643 11.5842,22.7288 11.5842,21.6298 C11.5842,20.538 12.4198,19.6791 13.4953,19.6791 Z M10.9838,20.5158 L7.64415,20.5158 C7.07907,20.5158 6.60047,21.0016 6.60047,21.608 C6.60047,22.2054 7.07907,22.6913 7.64415,22.6913 L10.9838,22.6913 L10.9838,20.5158 Z" fill-opacity="0.85" transform="translate(16.7662, 16.628) scale(-1, 1) translate(-16.7662, -16.628)"></path>
|
60 |
+
</g>
|
61 |
+
</g>
|
62 |
+
</svg>
|
63 |
+
</button>
|
64 |
+
</div>
|
65 |
+
</div>
|
web_assets/html/chatbot_more.html
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div>
|
2 |
+
<div id="chatbot-input-more-area">
|
3 |
+
<span class="chatbot-input-more-label-group">
|
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>
|
18 |
+
|
19 |
+
<span class="chatbot-input-more-label-group">
|
20 |
+
<div class="chatbot-input-more-btn last-btn">
|
21 |
+
<label class="may-disable-label">
|
22 |
+
<div id="uploaded-files-div">
|
23 |
+
<span class="chatbot-input-more-span tooltip-toggle" aria-label="{uploaded_files_tip}">{uploaded_files_label}</span>
|
24 |
+
<span class="chatbot-input-more-icon" id="uploaded-files-count"></span>
|
25 |
+
</div>
|
26 |
+
<button id="upload-files-btn">
|
27 |
+
<span class="chatbot-input-more-span">{upload_file_label}</span>
|
28 |
+
<span class="chatbot-input-more-icon">
|
29 |
+
<svg width="18px" 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">
|
30 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
31 |
+
<g fill="currentColor" fill-rule="nonzero">
|
32 |
+
<path d="M10.6020285,2.51882667 C11.4362625,2.51882667 11.8921676,2.64807396 12.4438001,3.21682942 L16.9677143,7.80362991 C17.5473088,8.39718377 17.6625708,8.80801259 17.6625708,9.74013504 L17.6625708,17.0701838 C17.6625708,18.6697194 16.8588053,19.4835978 15.2701606,19.4835978 L9.30367012,19.4838726 C9.50801444,19.132339 9.67081559,18.754537 9.78494219,18.3575337 L15.2149282,18.3578162 C16.0814028,18.3578162 16.5329428,17.8954285 16.5329428,17.0499579 L16.5329428,9.75491554 L11.9107944,9.75491554 C10.9798389,9.75491554 10.4963609,9.29343541 10.4963609,8.34048196 L10.4963609,3.64458667 L6.87556994,3.64458667 C6.00213732,3.64458667 5.55375219,4.12267974 5.55375219,4.95246234 L5.55332282,12.0499339 C5.36755588,12.0285691 5.17882362,12.0175857 4.9877281,12.0175857 C4.79846417,12.0175857 4.61149369,12.028399 4.42740668,12.0494356 L4.42797059,4.93219317 C4.42797059,3.3327051 5.23415624,2.51882667 6.81337946,2.51882667 Z M11.552216,3.86783276 L11.552216,8.21151991 C11.552216,8.55164434 11.6926308,8.69205911 12.0359101,8.69205911 L16.3097226,8.69205911 L11.552216,3.86783276 Z" fill-opacity="0.85"></path>
|
33 |
+
<path d="M4.9877281,13.0174305 C7.17286548,13.0174305 8.97241326,14.8169783 8.97241326,17.0052706 C8.97241326,19.1904512 7.15190483,20.9970003 4.9877281,20.9970003 C2.80254317,20.9970003 0.999853452,19.1974525 0.999853452,17.0052706 C0.999853452,14.82009 2.80254317,13.0174305 4.9877281,13.0174305 Z M4.99784107,14.437007 C4.88115289,14.437007 4.7753124,14.4852382 4.64150995,14.6120393 L2.60482154,16.530609 C2.48641329,16.6350666 2.4357663,16.7447535 2.42877798,16.8911323 C2.414797,17.1440431 2.62022006,17.325342 2.87314384,17.325342 C3.00310422,17.3323433 3.12991834,17.2638862 3.21236934,17.1782716 L3.90166369,16.4757224 L4.5558954,15.8144894 L4.51466558,16.8528413 L4.51466558,19.0792085 C4.51466558,19.332854 4.73408257,19.5421148 4.99784107,19.5421148 C5.25844467,19.5421148 5.47470676,19.332854 5.47470676,19.0792085 L5.47470676,16.8528413 L5.44363313,15.8144894 L6.08075058,16.4757224 L6.78018815,17.1782716 C6.86960587,17.2638862 6.98560256,17.3183839 7.11555862,17.325342 C7.36531454,17.3393445 7.56061597,17.1440431 7.56061597,16.8911323 C7.56061597,16.7479084 7.50996466,16.6350666 7.39159099,16.530609 L5.34090431,14.6120393 C5.22352465,14.498506 5.12779713,14.437007 4.99784107,14.437007 Z" fill-opacity="0.85"></path>
|
34 |
+
</g>
|
35 |
+
</g>
|
36 |
+
</svg>
|
37 |
+
</span>
|
38 |
+
</button>
|
39 |
+
</label>
|
40 |
+
</div>
|
41 |
+
</span>
|
42 |
+
</div>
|
43 |
+
|
44 |
+
<!-- get more button -->
|
45 |
+
<div id="chatbot-input-more-btn-div">
|
46 |
+
<button class="chatbot-input-more-btn" onclick="chatMoreBtnClick()">
|
47 |
+
<!-- <svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
48 |
+
xmlns:xlink="http://www.w3.org/1999/xlink">
|
49 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
50 |
+
<g fill="currentColor" fill-rule="nonzero">
|
51 |
+
<path
|
52 |
+
d="M15.9930223,31.97976 C24.7467023,31.97976 32,24.7418401 32,15.98988 C32,7.23796297 24.7327468,0 15.9790668,0 C7.23313125,0 0,7.23796297 0,15.98988 C0,24.7418401 7.24706085,31.97976 15.9930223,31.97976 Z"
|
53 |
+
fill-opacity="0.1" class="sm-round-bg"></path>
|
54 |
+
<path
|
55 |
+
d="M8.41162523,16.0038327 C8.41162523,15.2803594 8.92769229,14.7720332 9.65130778,14.7720332 L14.7951802,14.7720332 L14.7951802,9.62925761 C14.7951802,8.91198549 15.2756953,8.40371964 15.9728644,8.40371964 C16.6964799,8.40371964 17.2048198,8.90578429 17.2048198,9.62925761 L17.2048198,14.7720332 L22.3626477,14.7720332 C23.0723077,14.7720332 23.5884006,15.2803594 23.5884006,16.0038327 C23.5884006,16.7008648 23.0660191,17.1952382 22.3626477,17.1952382 L17.2048198,17.1952382 L17.2048198,22.3380138 C17.2048198,23.0614872 16.6964799,23.563526 15.9728644,23.563526 C15.2756953,23.563526 14.7951802,23.0413333 14.7951802,22.3380138 L14.7951802,17.1952382 L9.65130778,17.1952382 C8.93398085,17.1952382 8.41162523,16.7008648 8.41162523,16.0038327 Z"
|
56 |
+
fill-opacity="0.85"></path>
|
57 |
+
</g>
|
58 |
+
</g>
|
59 |
+
</svg> -->
|
60 |
+
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
61 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
62 |
+
<g fill="currentColor" fill-rule="nonzero">
|
63 |
+
<path d="M15.9930223,31.97976 C24.7467023,31.97976 32,24.7418401 32,15.98988 C32,7.23796297 24.7327468,0 15.9790668,0 C7.23313125,0 0,7.23796297 0,15.98988 C0,24.7418401 7.24706085,31.97976 15.9930223,31.97976 Z" fill-opacity="0.1" class="sm-round-bg"></path>
|
64 |
+
<path d="M23.5318035,18.2475474 C22.2777951,18.2475474 21.2612876,17.2374408 21.2612876,15.9773915 C21.2612876,14.7173421 22.2777951,13.7072355 23.5318035,13.7072355 C24.7781451,13.7072355 25.8086942,14.7173421 25.8086942,15.9773915 C25.8086942,17.2374408 24.7781451,18.2475474 23.5318035,18.2475474 Z" fill-opacity="0.75"></path>
|
65 |
+
<path d="M15.9930223,18.2475474 C14.7327253,18.2475474 13.7224202,17.2374408 13.7224202,15.9773915 C13.7224202,14.7173421 14.7327253,13.7072355 15.9930223,13.7072355 C17.2533193,13.7072355 18.2775798,14.7173421 18.2775798,15.9773915 C18.2775798,17.2374408 17.2533193,18.2475474 15.9930223,18.2475474 Z" fill-opacity="0.75"></path>
|
66 |
+
<path d="M8.468162,18.2475474 C7.22182045,18.2475474 6.19131446,17.2374408 6.19131446,15.9773915 C6.19131446,14.7173421 7.22182045,13.7072355 8.468162,13.7072355 C9.70824943,13.7072355 10.7387124,14.7173421 10.7387124,15.9773915 C10.7387124,17.2374408 9.72220487,18.2475474 8.468162,18.2475474 Z" fill-opacity="0.75"></path>
|
67 |
+
</g>
|
68 |
+
</g>
|
69 |
+
</svg>
|
70 |
+
</button>
|
71 |
+
</div>
|
72 |
+
</div>
|
web_assets/html/close_btn.html
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<button onclick='closeBtnClick("{obj}")'>
|
2 |
+
<svg class="icon-need-hover" stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round"
|
3 |
+
stroke-linejoin="round" height="20" width="20" xmlns="http://www.w3.org/2000/svg"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>
|
4 |
+
</svg>
|
5 |
+
</button>
|
web_assets/html/config_info.html
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
|
2 |
-
<!-- removed -->
|
|
|
|
|
|
web_assets/html/func_nav.html
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="menu-footer-btn-bar" class="is-gpt">
|
2 |
+
<div class="btn-bar-group">
|
3 |
+
<button id="chuanhu-setting-btn" onclick="openSettingBox()" class="chuanhu-ui-btn">
|
4 |
+
<!-- <svg width="24px" height="24px" viewBox="0 0 39.6797 39.6328" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
5 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
6 |
+
<g id="gearshape" fill-rule="nonzero">
|
7 |
+
<path d="M17.9766,39.6094 L21.6797,39.6094 C23.1797,39.6094 24.3516,38.6953 24.7031,37.2891 L25.4766,33.9141 L25.8984,33.7734 L28.8047,35.5781 C30.0703,36.3516 31.5469,36.1641 32.6016,35.0859 L35.1797,32.5312 C36.2344,31.4766 36.4453,29.9766 35.6484,28.7578 L33.8203,25.8281 L33.9609,25.4766 L37.3359,24.7031 C38.7422,24.3516 39.6797,23.1562 39.6797,21.6797 L39.6797,18.0703 C39.6797,16.5938 38.7656,15.3984 37.3359,15.0469 L34.0078,14.2266 L33.8438,13.8516 L35.6719,10.9219 C36.4688,9.67969 36.2578,8.22656 35.2031,7.125 L32.625,4.57031 C31.5938,3.51562 30.1172,3.32812 28.8516,4.07812 L25.9219,5.85938 L25.4766,5.69531 L24.7031,2.32031 C24.3516,0.914062 23.1797,0 21.6797,0 L17.9766,0 C16.4766,0 15.3281,0.914062 14.9766,2.32031 L14.2031,5.69531 L13.7344,5.85938 L10.8047,4.07812 C9.5625,3.32812 8.08594,3.51562 7.03125,4.57031 L4.47656,7.125 C3.42188,8.22656 3.21094,9.67969 4.00781,10.9219 L5.8125,13.8516 L5.64844,14.2266 L2.32031,15.0469 C0.914062,15.3984 0,16.5938 0,18.0703 L0,21.6797 C0,23.1562 0.9375,24.3516 2.32031,24.7031 L5.69531,25.4766 L5.83594,25.8281 L4.03125,28.7578 C3.23438,29.9766 3.44531,31.4766 4.5,32.5312 L7.05469,35.0859 C8.10938,36.1641 9.60938,36.3516 10.8516,35.5781 L13.7812,33.7734 L14.2031,33.9141 L14.9766,37.2891 C15.3281,38.6953 16.4766,39.6094 17.9766,39.6094 Z M18.3047,36.3516 C18.0703,36.3516 17.9531,36.25781 17.9297,36.0469 L16.7812,31.4531 C15.5859,31.1484 14.5078,30.7031 13.6875,30.1406 L9.63281,32.6484 C9.46875,32.7422 9.30469,32.7188 9.14062,32.5781 L7.03125,30.4453 C6.86719,30.3047 6.86719,30.1406 6.98438,29.9531 L9.44531,25.9219 C9,25.125 8.48438,24.0469 8.17969,22.8516 L3.5625,21.7266 C3.35156,21.7031 3.25781,21.5859 3.25781,21.3516 L3.25781,18.3516 C3.25781,18.0938 3.32812,18.0234 3.5625,17.9531 L8.15625,16.8516 C8.46094,15.5625 9.07031,14.4375 9.39844,13.7344 L6.96094,9.72656 C6.82031,9.51562 6.82031,9.35156 6.98438,9.1875 L9.11719,7.10156 C9.28125,6.96094 9.39844,6.91406 9.63281,7.03125 L13.6406,9.46875 C14.4609,8.97656 15.6328,8.48438 16.8047,8.15625 L17.9297,3.5625 C17.9531,3.35156 18.0703,3.25781 18.3047,3.25781 L21.375,3.25781 C21.6094,3.25781 21.7266,3.35156 21.75,3.5625 L22.875,8.20312 C24.0938,8.50781 25.1484,9 25.9922,9.49219 L30.0469,7.03125 C30.25781,6.91406 30.375,6.96094 30.5625,7.10156 L32.6953,9.1875 C32.8359,9.35156 32.8594,9.51562 32.7188,9.72656 L30.25781,13.7344 C30.6094,14.4375 31.1953,15.5625 31.5,16.8516 L36.1172,17.9531 C36.3516,18.0234 36.3984,18.0938 36.3984,18.3516 L36.3984,21.3516 C36.3984,21.5859 36.3281,21.7031 36.1172,21.7266 L31.4766,22.8516 C31.1953,24.0469 30.6797,25.125 30.2109,25.9219 L32.6953,29.9531 C32.8125,30.1406 32.8125,30.3047 32.6484,30.4453 L30.5391,32.5781 C30.3516,32.7188 30.1875,32.7422 30.0469,32.6484 L25.9688,30.1406 C25.1719,30.7031 24.0703,31.1484 22.875,31.4531 L21.75,36.0469 C21.7266,36.25781 21.6094,36.3516 21.375,36.3516 L18.3047,36.3516 Z M19.8281,26.8125 C23.6719,26.8125 26.8359,23.6719 26.8359,19.8047 C26.8359,15.9844 23.6719,12.8438 19.8281,12.8438 C15.9844,12.8438 12.8203,15.9844 12.8203,19.8047 C12.8203,23.6484 15.9844,26.8125 19.8281,26.8125 Z M19.8281,23.5781 C17.7656,23.5781 16.1016,21.8906 16.1016,19.8047 C16.1016,17.7656 17.7656,16.0781 19.8281,16.0781 C21.8438,16.0781 23.5312,17.7656 23.5312,19.8047 C23.5312,21.8672 21.8438,23.5781 19.8281,23.5781 Z" id="形状" fill-opacity="0.85" fill="currentColor"></path>
|
8 |
+
</g>
|
9 |
+
</g>
|
10 |
+
</svg> -->
|
11 |
+
<svg width="24px" height="24px" viewBox="0 0 41.5547 40.9700126" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
12 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.85">
|
13 |
+
<g fill="currentColor" fill-rule="nonzero">
|
14 |
+
<path d="M20.7891,38.3561 C21.2344,38.3561 21.6328,38.3092 22.125,38.2858 L23.2031,40.3483 C23.4375,40.7936 23.8828,41.028 24.375,40.9577 C24.8438,40.8639 25.2188,40.4655 25.2891,39.9733 L25.6172,37.6764 C26.4609,37.442 27.3047,37.1139 28.1484,36.7858 L29.8359,38.3092 C30.2109,38.6608 30.7031,38.7311 31.1719,38.4733 C31.5938,38.2155 31.7812,37.7467 31.6875,37.2545 L31.1953,34.9811 C31.8984,34.4655 32.625,33.903 33.2578,33.2702 L35.3906,34.1608 C35.8594,34.3717 36.3516,34.2311 36.7031,33.8092 C37.0078,33.4577 37.0312,32.942 36.7734,32.5202 L35.5547,30.5514 C36.0703,29.8249 36.4688,29.0514 36.8672,28.2077 L39.1875,28.3249 C39.6797,28.3483 40.125,28.0436 40.2891,27.5983 C40.4531,27.1295 40.2891,26.6139 39.9141,26.3327 L38.0859,24.8795 C38.3203,24.0358 38.5078,23.1686 38.5781,22.2311 L40.7578,21.528 C41.25,21.3639 41.5547,20.9889 41.5547,20.4733 C41.5547,19.9577 41.25,19.5827 40.7578,19.4186 L38.5781,18.7155 C38.5078,17.778 38.3203,16.9342 38.0859,16.067 L39.9141,14.6139 C40.2891,14.3327 40.4531,13.8405 40.2891,13.3717 C40.125,12.9264 39.6797,12.6217 39.1875,12.6452 L36.8672,12.7389 C36.4688,11.8952 36.0703,11.1452 35.5547,10.3952 L36.7734,8.42641998 C37.0312,8.02797998 37.0078,7.51235998 36.7031,7.16078998 C36.3516,6.73891998 35.8594,6.62172998 35.3906,6.80922998 L33.2578,7.67641998 C32.625,7.06703998 31.8984,6.48110998 31.1953,5.96547998 L31.6875,3.71547998 C31.7812,3.19985998 31.5938,2.73110998 31.1719,2.49672998 C30.7031,2.23891998 30.2109,2.28578998 29.8359,2.66078998 L28.1484,4.16078998 C27.3047,3.80922998 26.4609,3.52797998 25.6172,3.27016998 L25.2891,0.996730977 C25.2188,0.504542977 24.8438,0.106105977 24.375,0.0123557768 C23.8828,-0.0579567232 23.4141,0.176417977 23.2031,0.598292977 L22.125,2.66078998 C21.6328,2.63735998 21.2344,2.61391998 20.7891,2.61391998 C20.2969,2.61391998 19.8984,2.63735998 19.4297,2.66078998 L18.3281,0.598292977 C18.1172,0.176417977 17.6719,-0.0579567232 17.1562,0.0123557768 C16.6875,0.106105977 16.3359,0.504542977 16.2656,0.996730977 L15.9375,3.27016998 C15.0703,3.52797998 14.2266,3.80922998 13.4062,4.16078998 L11.6953,2.66078998 C11.3203,2.28578998 10.8281,2.23891998 10.3594,2.49672998 C9.96094,2.73110998 9.75,3.19985998 9.86719,3.71547998 L10.3359,5.96547998 C9.63281,6.48110998 8.90625,7.06703998 8.27344,7.67641998 L6.16406,6.80922998 C5.67188,6.62172998 5.20312,6.73891998 4.85156,7.16078998 C4.54688,7.51235998 4.5,8.02797998 4.75781,8.42641998 L5.97656,10.3952 C5.48438,11.1452 5.0625,11.8952 4.66406,12.7389 L2.34375,12.6452 C1.85156,12.6217 1.40625,12.9264 1.24219,13.3717 C1.10156,13.8405 1.24219,14.3092 1.64062,14.6139 L3.44531,16.067 C3.23438,16.9342 3.04688,17.778 2.97656,18.7155 L0.773438,19.4186 C0.304688,19.5827 0,19.9577 0,20.4733 C0,20.9889 0.304688,21.3639 0.773438,21.528 L2.97656,22.2311 C3.04688,23.1686 3.23438,24.0358 3.44531,24.8795 L1.64062,26.3327 C1.24219,26.6139 1.10156,27.1295 1.24219,27.5983 C1.40625,28.0436 1.85156,28.3483 2.34375,28.3249 L4.66406,28.2077 C5.0625,29.0514 5.48438,29.8249 5.97656,30.5514 L4.75781,32.5202 C4.5,32.942 4.54688,33.4577 4.85156,33.8092 C5.20312,34.2311 5.67188,34.3717 6.16406,34.1608 L8.27344,33.2702 C8.90625,33.903 9.63281,34.4655 10.3359,34.9811 L9.86719,37.2545 C9.77344,37.7467 9.96094,38.2155 10.3594,38.4733 C10.8281,38.7311 11.3203,38.6608 11.6953,38.3092 L13.4062,36.7858 C14.2266,37.1139 15.0703,37.442 15.9375,37.6764 L16.2656,39.9733 C16.3359,40.4655 16.6875,40.8639 17.1562,40.9577 C17.6719,41.028 18.0938,40.7936 18.3281,40.3483 L19.4297,38.2858 C19.8984,38.3092 20.2969,38.3561 20.7891,38.3561 Z M20.7891,35.1686 C12.5859,35.1686 6.25781,28.6295 6.25781,20.4967 C6.25781,12.3405 12.5859,5.80141998 20.7891,5.80141998 C28.9688,5.80141998 35.2969,12.3405 35.2969,20.4967 C35.2969,28.6295 28.9688,35.1686 20.7891,35.1686 Z M17.3672,17.4733 L19.6641,15.9967 L13.5938,5.66078998 L11.2266,7.02016998 L17.3672,17.4733 Z M25.1484,21.8327 L37.2188,21.8327 L37.1953,19.1608 L25.1484,19.1608 L25.1484,21.8327 Z M19.6406,25.0202 L17.3438,23.5202 L10.9922,33.8795 L13.3359,35.2858 L19.6406,25.0202 Z M20.7188,25.5124 C23.4844,25.5124 25.6875,23.2858 25.6875,20.5202 C25.6875,17.7545 23.4844,15.528 20.7188,15.528 C17.9531,15.528 15.7266,17.7545 15.7266,20.5202 C15.7266,23.2858 17.9531,25.5124 20.7188,25.5124 Z M20.7188,22.5592 C19.5703,22.5592 18.6562,21.6686 18.6562,20.5202 C18.6562,19.3717 19.5703,18.4811 20.7188,18.4811 C21.8672,18.4811 22.7578,19.3717 22.7578,20.5202 C22.7578,21.6686 21.8672,22.5592 20.7188,22.5592 Z"></path>
|
15 |
+
</g>
|
16 |
+
</g>
|
17 |
+
</svg>
|
18 |
+
</button>
|
19 |
+
<button id="chuanhu-manual-check-btn" onclick="manualCheckUpdate()" class="chuanhu-ui-btn">
|
20 |
+
<span class="show-on-latest">
|
21 |
+
<svg width="24px" height="24px" viewBox="0 0 45.2923004 37.8516" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
22 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
23 |
+
<g fill-rule="nonzero">
|
24 |
+
<path d="M0.415684357,19.0078 C-0.381190643,20.1094 -0.0296279434,21.1172 1.44693036,21.1172 L3.86100036,21.1172 C4.96256036,30.4453 13.0719004,37.8281 22.6344004,37.8281 C28.2360004,37.8281 33.2985004,35.3203 36.7672004,31.3828 C37.5641004,30.4922 37.4469004,29.3438 36.6266004,28.7578 C35.8063004,28.1719 34.8219004,28.3828 34.1188004,29.1562 C31.3297004,32.2969 27.2282004,34.2656 22.6344004,34.2656 C14.8532004,34.2656 8.52506036,28.5703 7.47037036,21.1172 L9.97818036,21.1172 C11.4313004,21.1172 11.8063004,20.1094 11.0329004,19.0312 L6.86100036,13.0781 C6.22818036,12.1641 5.24381036,12.1406 4.58756036,13.0781 L0.415684357,19.0078 Z M8.52506036,6.42188 C7.72818036,7.3125 7.84537036,8.4375 8.66568036,9.02344 C9.50943036,9.60938 10.4938004,9.44531 11.1969004,8.64844 C14.0094004,5.53125 18.0876004,3.5625 22.6344004,3.5625 C30.4157004,3.5625 36.7672004,9.25781 37.7985004,16.7109 L35.2907004,16.7109 C33.8376004,16.7109 33.4860004,17.7188 34.2594004,18.8203 L38.4313004,24.75 C39.0641004,25.6641 40.0485004,25.6875 40.7047004,24.75 L44.8766004,18.8438 C45.6735004,17.7188 45.3219004,16.7109 43.8454004,16.7109 L41.4313004,16.7109 C40.3297004,7.38281 32.2204004,0 22.6344004,0 C17.0797004,0 12.0172004,2.48438 8.52506036,6.42188 Z" fill-opacity="0.85" fill="currentColor"></path>
|
25 |
+
</g>
|
26 |
+
</g>
|
27 |
+
</svg>
|
28 |
+
</span>
|
29 |
+
<span class="show-on-outdated">
|
30 |
+
<svg width="24px" height="24px" viewBox="0 0 45.2924004 37.8516" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
31 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
32 |
+
<g fill="currentColor" fill-rule="nonzero">
|
33 |
+
<path d="M0.415682396,19.0078 C-0.381189604,20.1094 -0.0296276044,21.1172 1.4469304,21.1172 L3.8610104,21.1172 C4.9625604,30.4453 13.0719004,37.8281 22.6344004,37.8281 C28.2360004,37.8281 33.2985004,35.3203 36.7673004,31.3828 C37.5641004,30.4922 37.4469004,29.3437 36.6266004,28.7578 C35.8063004,28.1719 34.8219004,28.3828 34.1188004,29.1563 C31.3297004,32.2969 27.2282004,34.2656 22.6344004,34.2656 C14.8532004,34.2656 8.5250704,28.5703 7.4703704,21.1172 L9.9781804,21.1172 C11.4313004,21.1172 11.8063004,20.1094 11.0329004,19.0312 L6.8610104,13.0781 C6.2281804,12.1641 5.2437904,12.1406 4.5875404,13.0781 L0.415682396,19.0078 Z M8.5250704,6.42187 C7.7281804,7.31251 7.8453904,8.43749 8.6656604,9.02342 C9.5094604,9.60936 10.4938004,9.4453 11.1969004,8.64845 C14.0095004,5.53123 18.0875004,3.56251 22.6344004,3.56251 C30.4157004,3.56251 36.7673004,9.25781 37.7985004,16.7109 L35.2907004,16.7109 C33.8376004,16.7109 33.4860004,17.7188 34.2595004,18.8203 L38.4313004,24.75 C39.0641004,25.6641 40.0485004,25.6875 40.7048004,24.75 L44.8767004,18.8437 C45.6735004,17.7188 45.3222004,16.7109 43.8454004,16.7109 L41.4313004,16.7109 C40.3297004,7.38283 32.2204004,0 22.6344004,0 C17.0797004,0 12.0173004,2.48438 8.5250704,6.42187 Z" fill-opacity="0.85"></path>
|
34 |
+
<path d="M22.6344004,22.2422 C23.6422004,22.2422 24.2048004,21.6797 24.2282004,20.625 L24.5095004,11.0156 C24.5329004,9.96096 23.7126004,9.18749 22.6110004,9.18749 C21.5095004,9.18749 20.7126004,9.93749 20.7360004,10.9922 L21.0173004,20.625 C21.0407004,21.6797 21.6032004,22.2422 22.6344004,22.2422 Z M22.6344004,28.3828 C23.7829004,28.3828 24.7907004,27.4688 24.7907004,26.3203 C24.7907004,25.1484 23.8063004,24.2578 22.6344004,24.2578 C21.4626004,24.2578 20.5016004,25.1719 20.5016004,26.3203 C20.5016004,27.4453 21.4860004,28.3828 22.6344004,28.3828 Z" fill-opacity="0.85"></path>
|
35 |
+
</g>
|
36 |
+
</g>
|
37 |
+
</svg>
|
38 |
+
</span>
|
39 |
+
</button>
|
40 |
+
<!--
|
41 |
+
<button id="chuanhu-training-btn" onclick="openTrainingBox()" class="chuanhu-ui-btn">
|
42 |
+
<svg width="24px" height="24px" viewBox="0 0 37.3359 44.6953" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
43 |
+
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
44 |
+
<g id="brain.filled.head.profile" fill-rule="nonzero">
|
45 |
+
<rect id="矩形" fill="#000000" opacity="0" x="0" y="0" width="37.3359" height="44.6953"></rect>
|
46 |
+
<path d="M21.5156,44.5312 C28.5,44.5312 32.7656,42.0469 32.7656,37.7109 L32.7656,28.7812 C35.6484,26.2031 37.3359,22.1016 37.3359,17.625 C37.3359,7.05469 30.4453,0 20.2031,0 C9.98438,0 3.14062,6.91406 3.14062,17.2266 C3.14062,17.7891 3.16406,18.2578 3.21094,18.7031 L0.960938,22.7109 C0.328125,23.8594 0,25.0078 0,26.0391 C0,27.9844 1.17188,29.5781 3.14062,30.1641 L3.14062,33.6562 C3.14062,37.1719 5.67188,38.8828 8.8125,38.5312 L12.8438,38.1328 L10.4531,35.5781 L10.4531,37.7109 C10.4531,42.0234 14.625,44.5312 21.5156,44.5312 Z M21.5156,41.1562 C16.5703,41.1562 13.6406,39.6328 13.6406,37.125 L13.6406,34.9453 C13.6406,34.7109 13.5234,34.5938 13.3125,34.6172 L8.34375,35.1797 C7.17188,35.2969 6.51562,34.8281 6.51562,33.4453 L6.51562,27.6562 C6.51562,27.4922 6.39844,27.375 6.16406,27.375 L5.13281,27.375 C4.03125,27.375 3.39844,26.8359 3.39844,25.9922 C3.39844,25.5234 3.5625,24.9844 3.89062,24.3984 L6.70312,19.3828 C6.58594,18.6562 6.51562,17.9062 6.51562,17.1797 C6.51562,8.90625 11.9766,3.39844 20.2031,3.39844 C28.4297,3.39844 33.9609,9.07031 33.9609,17.625 C33.9609,21.7266 32.2266,25.3359 29.3672,27.1172 L29.3672,37.125 C29.3672,39.6328 26.4375,41.1562 21.5156,41.1562 Z" id="形状" fill-opacity="0.85" fill="currentColor"></path>
|
47 |
+
<path d="M14.1797,19.7812 C16.2656,19.7812 17.7188,18.375 17.7188,16.4062 C17.7188,15.7031 17.5312,15.1875 17.2031,14.8359 C16.8516,14.5078 16.7109,14.1562 16.7109,13.9219 C16.7109,13.4062 17.1562,13.0312 17.6719,13.0312 C17.8828,13.0312 18.1641,13.0781 18.375,13.2891 C18.4219,13.3359 18.4688,13.4062 18.4922,13.4531 C19.9219,13.2891 20.6484,12.4688 20.6484,11.1328 C20.6484,10.6172 21.0703,10.1719 21.5859,10.1719 C22.1016,10.1719 22.5469,10.6406 22.5469,11.1328 C22.5703,13.2656 21.4922,14.6016 19.4297,15.0703 C19.5703,15.4922 19.6172,15.9609 19.6172,16.4297 C19.6172,18.2109 18.75,19.6641 17.3203,20.4844 C18.1172,20.8594 19.0312,21.0469 20.0156,21.0469 C20.4844,21.0469 20.9766,21 21.4688,20.9062 C21.375,20.6719 21.3516,20.4141 21.3516,20.2031 C21.3516,15.4453 28.1719,14.6484 28.1719,10.4531 C28.1719,8.34375 26.5781,6.72656 24.5859,6.72656 C23.8125,6.72656 23.6719,6.75 23.5078,6.77344 C22.7344,5.95312 21.6328,5.48438 20.6953,5.48438 C18.9844,5.48438 17.8125,6.5625 17.8125,8.15625 C17.8125,8.71875 17.4141,9.09375 16.8516,9.09375 C16.2891,9.09375 15.8906,8.67188 15.9141,8.10938 C15.9141,7.35938 16.1484,6.89062 16.2891,6.44531 C16.0078,6.39844 15.7266,6.375 15.4688,6.375 C13.2656,6.375 11.5547,7.73438 11.5547,9.39844 C11.5547,10.4766 12.2812,11.3438 13.2422,11.3438 C13.7812,11.3438 14.2031,11.7656 14.2031,12.2578 C14.2031,12.7969 13.7578,13.2422 13.2422,13.2422 C11.7656,13.2422 10.6172,12.5625 10.0547,11.4844 C9.51562,12.3516 9.21094,13.3594 9.21094,14.3906 C9.21094,17.4141 11.1562,19.7812 14.1797,19.7812 Z M27.7969,24.5156 C29.7656,24.5156 31.1953,22.3125 31.1953,19.3359 C31.1953,19.125 31.1953,18.8906 31.1953,18.6328 C30.4688,18.9609 29.6016,19.1016 28.6172,19.0312 C28.1016,18.9609 27.7031,18.5625 27.7031,18.0469 C27.7031,17.5312 28.1484,17.0625 28.6641,17.1094 C30.5859,17.2734 31.8516,16.2188 31.8516,14.5078 C31.8516,12.9375 31.125,11.625 29.8828,10.8047 C29.3203,15.9141 23.0156,16.5938 23.0156,20.1328 C23.0156,21.0938 23.6484,21.7734 24.75,21.7734 L25.0078,21.7734 C25.3125,23.3906 26.4375,24.5156 27.7969,24.5156 Z" id="形状" fill-opacity="0.85" fill="currentColor"></path>
|
48 |
+
</g>
|
49 |
+
</g>
|
50 |
+
</svg>
|
51 |
+
</button>
|
52 |
+
-->
|
53 |
+
</div>
|
54 |
+
<div class="btn-bar-group">
|
55 |
+
<button id="chuanhu-appearance-switcher" onclick="btnToggleDarkMode()" class="chuanhu-ui-btn">
|
56 |
+
<span class="show-on-dark">
|
57 |
+
<svg width="24px" height="24px" viewBox="0 0 39.9141 40.0547" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
58 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
59 |
+
<g fill-rule="nonzero">
|
60 |
+
<path d="M19.9688,7.42969 C20.9531,7.42969 21.7734,6.58594 21.7734,5.60156 L21.7734,1.80469 C21.7734,0.820312 20.9531,0 19.9688,0 C18.9609,0 18.1406,0.820312 18.1406,1.80469 L18.1406,5.60156 C18.1406,6.58594 18.9609,7.42969 19.9688,7.42969 Z M28.8281,11.1328 C29.5312,11.8359 30.7031,11.8594 31.4297,11.1328 L34.125,8.46094 C34.8047,7.75781 34.8047,6.5625 34.125,5.85938 C33.4219,5.15625 32.25,5.15625 31.5469,5.85938 L28.8281,8.57812 C28.1484,9.28125 28.1484,10.4297 28.8281,11.1328 Z M32.5078,20.0156 C32.5078,21 33.3516,21.8438 34.3359,21.8438 L38.0859,21.8438 C39.0938,21.8438 39.9141,21 39.9141,20.0156 C39.9141,19.0312 39.0938,18.1875 38.0859,18.1875 L34.3359,18.1875 C33.3516,18.1875 32.5078,19.0312 32.5078,20.0156 Z M28.8281,28.9219 C28.1484,29.625 28.1484,30.7734 28.8281,31.4766 L31.5469,34.1953 C32.25,34.8984 33.4219,34.875 34.125,34.1719 C34.8047,33.4688 34.8047,32.2969 34.125,31.5938 L31.4062,28.9219 C30.7031,28.2188 29.5312,28.2188 28.8281,28.9219 Z M19.9688,32.6016 C18.9609,32.6016 18.1406,33.4453 18.1406,34.4297 L18.1406,38.2266 C18.1406,39.2109 18.9609,40.0312 19.9688,40.0312 C20.9531,40.0312 21.7734,39.2109 21.7734,38.2266 L21.7734,34.4297 C21.7734,33.4453 20.9531,32.6016 19.9688,32.6016 Z M11.0859,28.9219 C10.3828,28.2188 9.1875,28.2188 8.48438,28.9219 L5.8125,31.5703 C5.10938,32.2734 5.10938,33.4453 5.78906,34.1484 C6.49219,34.8516 7.66406,34.875 8.36719,34.1719 L11.0625,31.4766 C11.7656,30.7734 11.7656,29.625 11.0859,28.9219 Z M7.40625,20.0156 C7.40625,19.0312 6.58594,18.1875 5.57812,18.1875 L1.82812,18.1875 C0.820312,18.1875 0,19.0312 0,20.0156 C0,21 0.820312,21.8438 1.82812,21.8438 L5.57812,21.8438 C6.58594,21.8438 7.40625,21 7.40625,20.0156 Z M11.0625,11.1328 C11.7656,10.4531 11.7656,9.25781 11.0859,8.57812 L8.39062,5.85938 C7.71094,5.17969 6.51562,5.15625 5.83594,5.85938 C5.13281,6.5625 5.13281,7.75781 5.8125,8.4375 L8.48438,11.1328 C9.1875,11.8359 10.3594,11.8359 11.0625,11.1328 Z" id="形状" fill-opacity="0.85" fill="currentColor"></path>
|
61 |
+
<path d="M19.9688,29.5781 C25.1719,29.5781 29.5078,25.2656 29.5078,20.0156 C29.5078,14.7656 25.1719,10.4531 19.9688,10.4531 C14.7422,10.4531 10.4062,14.7656 10.4062,20.0156 C10.4062,25.2656 14.7422,29.5781 19.9688,29.5781 Z M19.9688,26.3906 C16.4766,26.3906 13.5938,23.4844 13.5938,20.0156 C13.5938,16.5469 16.4766,13.6406 19.9688,13.6406 C23.4375,13.6406 26.3203,16.5469 26.3203,20.0156 C26.3203,23.4844 23.4375,26.3906 19.9688,26.3906 Z" id="形状" fill-opacity="0.85" fill="currentColor"></path>
|
62 |
+
</g>
|
63 |
+
</g>
|
64 |
+
</svg>
|
65 |
+
</span>
|
66 |
+
<span class="show-on-light">
|
67 |
+
<svg width="24px" height="24px" viewBox="0 0 37.2422 42.2109" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
68 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
69 |
+
<g fill="currentColor" fill-rule="nonzero">
|
70 |
+
<path d="M30,21.6797 C30.375,21.6797 30.6562,21.3984 30.7031,21 C31.2422,16.1016 31.5469,15.9141 36.5156,15.1406 C36.9844,15.0703 37.2422,14.8594 37.2422,14.4375 C37.2422,14.0625 36.9844,13.8047 36.6094,13.7578 C31.5938,12.7969 31.2422,12.7969 30.7031,7.89844 C30.6562,7.47656 30.375,7.21875 30,7.21875 C29.6016,7.21875 29.3438,7.47656 29.2969,7.875 C28.6875,12.8672 28.4531,13.1016 23.3672,13.7578 C23.0156,13.7812 22.7344,14.0625 22.7344,14.4375 C22.7344,14.8359 23.0156,15.0703 23.3672,15.1406 C28.4531,16.1016 28.6641,16.1484 29.2969,21.0469 C29.3438,21.3984 29.6016,21.6797 30,21.6797 Z M21.2109,9 C21.4453,9 21.5859,8.85938 21.6328,8.625 C22.2422,5.60156 22.1719,5.55469 25.3359,4.92188 C25.5469,4.875 25.7109,4.75781 25.7109,4.5 C25.7109,4.24219 25.5469,4.125 25.3359,4.07812 C22.1719,3.44531 22.2422,3.39844 21.6328,0.375 C21.5859,0.140625 21.4453,0 21.2109,0 C20.9531,0 20.8125,0.140625 20.7656,0.375 C20.1562,3.39844 20.2266,3.44531 17.0859,4.07812 C16.8516,4.125 16.6875,4.24219 16.6875,4.5 C16.6875,4.75781 16.8516,4.875 17.0859,4.92188 C20.2266,5.55469 20.1797,5.60156 20.7656,8.625 C20.8125,8.85938 20.9531,9 21.2109,9 Z" fill-opacity="0.85"></path>
|
71 |
+
<path d="M16.3125,38.625 C23.1094,38.625 28.5938,35.1562 31.0781,29.2734 C31.4297,28.4062 31.3125,27.75 30.9141,27.3516 C30.5625,27 29.9531,26.9297 29.2734,27.2109 C27.8906,27.75 26.2031,28.0547 24.1406,28.0547 C16.0078,28.0547 10.7578,22.9453 10.7578,15.0938 C10.7578,12.7734 11.2031,10.5 11.7188,9.49219 C12.0938,8.69531 12.0703,8.01562 11.7422,7.61719 C11.3672,7.17188 10.7109,7.00781 9.77344,7.35938 C3.98438,9.58594 0,15.6562 0,22.5938 C0,31.6875 6.79688,38.625 16.3125,38.625 Z M16.3594,35.4141 C8.69531,35.4141 3.21094,29.8359 3.21094,22.3359 C3.21094,17.9766 5.08594,14.0391 8.29688,11.4375 C7.89844,12.6094 7.6875,14.3438 7.6875,16.0078 C7.6875,24.9844 14.0156,31.1484 23.2969,31.1484 C24.8203,31.1484 26.2266,30.9844 26.9062,30.7734 C24.6094,33.6562 20.6953,35.4141 16.3594,35.4141 Z" fill-opacity="0.85"></path>
|
72 |
+
</g>
|
73 |
+
</g>
|
74 |
+
</svg>
|
75 |
+
</span>
|
76 |
+
</button>
|
77 |
+
</div>
|
78 |
+
</div>
|
web_assets/html/header_title.html
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div style="display:inline-flex;">
|
2 |
+
<buttom id="chuanhu-menu-btn" onclick='menuClick()'
|
3 |
+
class="chuanhu-ui-btn hover-round-btn" style="visibility: visible; width:42px; height:42px; margin-right:5px;">
|
4 |
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
5 |
+
<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"></path>
|
6 |
+
</svg>
|
7 |
+
</div>
|
8 |
+
<!-- <buttom class="gb_Ec gb_Ic gb_p" aria-label="Go back" title="Go back" role="button" tabindex="0">
|
9 |
+
<svg focusable="false" viewBox="0 0 24 24"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
|
10 |
+
</svg>
|
11 |
+
</buttom>
|
12 |
+
<div class="gb_Ec gb_Jc gb_p" aria-label="Close" role="button" tabindex="0"><svg viewBox="0 0 24 24">
|
13 |
+
<path
|
14 |
+
d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z">
|
15 |
+
</path>
|
16 |
+
</svg></div> -->
|
17 |
+
<div style="margin-left: 6px;">
|
18 |
+
<div>{app_title}</div>
|
19 |
+
</div>
|
20 |
+
</div>
|
web_assets/html/web_config.html
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div aria-label="config-div" style="display:none;">
|
2 |
+
<!-- app config -->
|
3 |
+
<div id="app_config">
|
4 |
+
<span id="hideHistoryWhenNotLoggedIn_config">{hideHistoryWhenNotLoggedIn_config}</span>
|
5 |
+
</div>
|
6 |
+
<!-- i18n config -->
|
7 |
+
<div id="config_i18n">
|
8 |
+
<span id="forView_i18n">{forView_i18n}</span>
|
9 |
+
<span id="deleteConfirm_i18n_pref">{deleteConfirm_i18n_pref}</span>
|
10 |
+
<span id="deleteConfirm_i18n_suff">{deleteConfirm_i18n_suff}</span>
|
11 |
+
<span id="usingLatest_i18n">{usingLatest_i18n}</span>
|
12 |
+
<span id="updatingMsg_i18n">{updatingMsg_i18n}</span>
|
13 |
+
<span id="updateSuccess_i18n">{updateSuccess_i18n}</span>
|
14 |
+
<span id="updateFailure_i18n">{updateFailure_i18n}</span>
|
15 |
+
<span id="regenerate_i18n">{regenerate_i18n}</span>
|
16 |
+
<span id="deleteRound_i18n">{deleteRound_i18n}</span>
|
17 |
+
<span id="renameChat_i18n">{renameChat_i18n}</span>
|
18 |
+
</div>
|
19 |
+
</div>
|
web_assets/icon/any-icon-512.png
ADDED
web_assets/icon/mask-icon-512.png
ADDED
web_assets/javascript/ChuanhuChat.js
CHANGED
@@ -11,8 +11,11 @@ var user_input_ta = null;
|
|
11 |
var user_input_tb = null;
|
12 |
var userInfoDiv = null;
|
13 |
var appTitleDiv = null;
|
|
|
14 |
var chatbot = null;
|
15 |
var chatbotIndicator = null;
|
|
|
|
|
16 |
var chatbotWrap = null;
|
17 |
var apSwitch = null;
|
18 |
var messageBotDivs = null;
|
@@ -25,14 +28,27 @@ var sliders = null;
|
|
25 |
var updateChuanhuBtn = null;
|
26 |
var statusDisplay = null;
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
var isInIframe = (window.self !== window.top);
|
29 |
var currentTime = new Date().getTime();
|
30 |
|
|
|
31 |
|
32 |
function addInit() {
|
33 |
-
var needInit = {chatbotIndicator};
|
34 |
|
35 |
chatbotIndicator = gradioApp().querySelector('#chuanhu-chatbot > div.wrap');
|
|
|
|
|
36 |
|
37 |
for (let elem in needInit) {
|
38 |
if (needInit[elem] == null) {
|
@@ -42,7 +58,9 @@ function addInit() {
|
|
42 |
}
|
43 |
|
44 |
chatbotObserver.observe(chatbotIndicator, { attributes: true });
|
45 |
-
|
|
|
|
|
46 |
return true;
|
47 |
}
|
48 |
|
@@ -54,6 +72,7 @@ function initialize() {
|
|
54 |
user_input_tb = gradioApp().getElementById('user-input-tb');
|
55 |
userInfoDiv = gradioApp().getElementById("user-info");
|
56 |
appTitleDiv = gradioApp().getElementById("app-title");
|
|
|
57 |
chatbot = gradioApp().querySelector('#chuanhu-chatbot');
|
58 |
chatbotWrap = gradioApp().querySelector('#chuanhu-chatbot > .wrapper > .wrap');
|
59 |
apSwitch = gradioApp().querySelector('.apSwitch input[type="checkbox"]');
|
@@ -64,17 +83,35 @@ function initialize() {
|
|
64 |
updateChuanhuBtn = gradioApp().getElementById("update-chuanhu-btn");
|
65 |
statusDisplay = gradioApp().querySelector('#status-display');
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
adjustDarkMode();
|
|
|
|
|
|
|
|
|
73 |
selectHistory();
|
74 |
-
|
75 |
-
|
76 |
-
setChatbotScroll();
|
77 |
setSlider();
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
if (!historyLoaded) loadHistoryHtml();
|
80 |
if (!usernameGotten) getUserInfo();
|
@@ -84,6 +121,14 @@ function initialize() {
|
|
84 |
if (longTimeNoCheck && !updateInfoGotten && !isLatestVersion || isLatestVersion && !updateInfoGotten) {
|
85 |
updateLatestVersion();
|
86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
return true;
|
88 |
}
|
89 |
|
@@ -164,17 +209,49 @@ function disableSendBtn() {
|
|
164 |
});
|
165 |
}
|
166 |
|
167 |
-
function
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
172 |
} else {
|
173 |
-
|
174 |
-
document.body.style.backgroundColor = "";
|
175 |
}
|
|
|
176 |
}
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
const darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
179 |
apSwitch.checked = darkModeQuery.matches;
|
180 |
toggleDarkMode(darkModeQuery.matches);
|
@@ -186,8 +263,55 @@ function adjustDarkMode() {
|
|
186 |
toggleDarkMode(e.target.checked);
|
187 |
});
|
188 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
|
190 |
function setChatbotHeight() {
|
|
|
191 |
const screenWidth = window.innerWidth;
|
192 |
const statusDisplay = document.querySelector('#status-display');
|
193 |
const statusDisplayHeight = statusDisplay ? statusDisplay.offsetHeight : 0;
|
@@ -226,8 +350,13 @@ function chatbotContentChanged(attempt = 1) {
|
|
226 |
saveHistoryHtml();
|
227 |
disableSendBtn();
|
228 |
// gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message.user').forEach((userElement) => {addAvatars(userElement, 'user')});
|
229 |
-
gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message.bot').forEach(addChuanhuButton);
|
230 |
-
|
|
|
|
|
|
|
|
|
|
|
231 |
}
|
232 |
// 理论上是不需要多次尝试执行的,可惜gradio的bug导致message可能没有渲染完毕,所以尝试500ms后再次执行
|
233 |
}
|
@@ -235,10 +364,15 @@ function chatbotContentChanged(attempt = 1) {
|
|
235 |
var chatbotObserver = new MutationObserver(() => {
|
236 |
chatbotContentChanged(1);
|
237 |
if (chatbotIndicator.classList.contains('hide')) {
|
|
|
238 |
chatbotContentChanged(2);
|
239 |
}
|
240 |
});
|
241 |
|
|
|
|
|
|
|
|
|
242 |
// 监视页面内部 DOM 变动
|
243 |
var gradioObserver = new MutationObserver(function (mutations) {
|
244 |
for (var i = 0; i < mutations.length; i++) {
|
@@ -254,12 +388,26 @@ var gradioObserver = new MutationObserver(function (mutations) {
|
|
254 |
// 监视页面变化
|
255 |
window.addEventListener("DOMContentLoaded", function () {
|
256 |
// const ga = document.getElementsByTagName("gradio-app");
|
|
|
|
|
257 |
gradioApp().addEventListener("render", initialize);
|
258 |
isInIframe = (window.self !== window.top);
|
259 |
historyLoaded = false;
|
260 |
});
|
261 |
-
window.addEventListener('resize',
|
262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", adjustDarkMode);
|
264 |
|
265 |
// console suprise
|
@@ -293,11 +441,5 @@ let description = `
|
|
293 |
GitHub repository: [https://github.com/GaiZhenbiao/ChuanhuChatGPT]\n
|
294 |
Enjoy our project!\n
|
295 |
`
|
296 |
-
console.log(`%c${makeML(ChuanhuInfo)}`,styleTitle1)
|
297 |
-
console.log(`%c${description}`, styleDesc1)
|
298 |
-
|
299 |
-
// button svg code
|
300 |
-
const copyIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span>';
|
301 |
-
const copiedIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><polyline points="20 6 9 17 4 12"></polyline></svg></span>';
|
302 |
-
const mdIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="1" viewBox="0 0 14 18" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><g transform-origin="center" transform="scale(0.85)"><path d="M1.5,0 L12.5,0 C13.3284271,-1.52179594e-16 14,0.671572875 14,1.5 L14,16.5 C14,17.3284271 13.3284271,18 12.5,18 L1.5,18 C0.671572875,18 1.01453063e-16,17.3284271 0,16.5 L0,1.5 C-1.01453063e-16,0.671572875 0.671572875,1.52179594e-16 1.5,0 Z" stroke-width="1.8"></path><line x1="3.5" y1="3.5" x2="10.5" y2="3.5"></line><line x1="3.5" y1="6.5" x2="8" y2="6.5"></line></g><path d="M4,9 L10,9 C10.5522847,9 11,9.44771525 11,10 L11,13.5 C11,14.0522847 10.5522847,14.5 10,14.5 L4,14.5 C3.44771525,14.5 3,14.0522847 3,13.5 L3,10 C3,9.44771525 3.44771525,9 4,9 Z" stroke="none" fill="currentColor"></path></svg></span>';
|
303 |
-
const rawIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="1.8" viewBox="0 0 18 14" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><g transform-origin="center" transform="scale(0.85)"><polyline points="4 3 0 7 4 11"></polyline><polyline points="14 3 18 7 14 11"></polyline><line x1="12" y1="0" x2="6" y2="14"></line></g></svg></span>';
|
|
|
11 |
var user_input_tb = null;
|
12 |
var userInfoDiv = null;
|
13 |
var appTitleDiv = null;
|
14 |
+
var chatbotArea = null;
|
15 |
var chatbot = null;
|
16 |
var chatbotIndicator = null;
|
17 |
+
var uploaderIndicator = null;
|
18 |
+
var chatListIndicator = null;
|
19 |
var chatbotWrap = null;
|
20 |
var apSwitch = null;
|
21 |
var messageBotDivs = null;
|
|
|
28 |
var updateChuanhuBtn = null;
|
29 |
var statusDisplay = null;
|
30 |
|
31 |
+
var historySelector = null;
|
32 |
+
var chuanhuPopup = null;
|
33 |
+
var settingBox = null;
|
34 |
+
var trainingBox = null;
|
35 |
+
var popupWrapper = null;
|
36 |
+
var chuanhuHeader = null;
|
37 |
+
var menu = null;
|
38 |
+
var toolbox = null;
|
39 |
+
// var trainBody = null;
|
40 |
+
|
41 |
var isInIframe = (window.self !== window.top);
|
42 |
var currentTime = new Date().getTime();
|
43 |
|
44 |
+
let windowWidth = window.innerWidth; // 初始窗口宽度
|
45 |
|
46 |
function addInit() {
|
47 |
+
var needInit = {chatbotIndicator, uploaderIndicator};
|
48 |
|
49 |
chatbotIndicator = gradioApp().querySelector('#chuanhu-chatbot > div.wrap');
|
50 |
+
uploaderIndicator = gradioApp().querySelector('#upload-index-file > div.wrap');
|
51 |
+
chatListIndicator = gradioApp().querySelector('#history-select-dropdown > div.wrap');
|
52 |
|
53 |
for (let elem in needInit) {
|
54 |
if (needInit[elem] == null) {
|
|
|
58 |
}
|
59 |
|
60 |
chatbotObserver.observe(chatbotIndicator, { attributes: true });
|
61 |
+
chatListObserver.observe(chatListIndicator, { attributes: true });
|
62 |
+
setUploader();
|
63 |
+
|
64 |
return true;
|
65 |
}
|
66 |
|
|
|
72 |
user_input_tb = gradioApp().getElementById('user-input-tb');
|
73 |
userInfoDiv = gradioApp().getElementById("user-info");
|
74 |
appTitleDiv = gradioApp().getElementById("app-title");
|
75 |
+
chatbotArea = gradioApp().querySelector('#chatbot-area');
|
76 |
chatbot = gradioApp().querySelector('#chuanhu-chatbot');
|
77 |
chatbotWrap = gradioApp().querySelector('#chuanhu-chatbot > .wrapper > .wrap');
|
78 |
apSwitch = gradioApp().querySelector('.apSwitch input[type="checkbox"]');
|
|
|
83 |
updateChuanhuBtn = gradioApp().getElementById("update-chuanhu-btn");
|
84 |
statusDisplay = gradioApp().querySelector('#status-display');
|
85 |
|
86 |
+
historySelector = gradioApp().querySelector('#history-select-dropdown');
|
87 |
+
chuanhuPopup = gradioApp().querySelector('#chuanhu-popup');
|
88 |
+
settingBox = gradioApp().querySelector('#chuanhu-setting');
|
89 |
+
trainingBox = gradioApp().querySelector('#chuanhu-training');
|
90 |
+
popupWrapper = gradioApp().querySelector('#popup-wrapper');
|
91 |
+
chuanhuHeader = gradioApp().querySelector('#chuanhu-header');
|
92 |
+
menu = gradioApp().querySelector('#menu-area');
|
93 |
+
toolbox = gradioApp().querySelector('#toolbox-area');
|
94 |
+
// trainBody = gradioApp().querySelector('#train-body');
|
95 |
+
|
96 |
+
// if (loginUserForm) {
|
97 |
+
// localStorage.setItem("userLogged", true);
|
98 |
+
// userLogged = true;
|
99 |
+
// }
|
100 |
|
101 |
adjustDarkMode();
|
102 |
+
adjustSide();
|
103 |
+
setChatList();
|
104 |
+
setChatListHeader();
|
105 |
+
setLoclize();
|
106 |
selectHistory();
|
107 |
+
// setChatbotHeight();
|
108 |
+
setPopupBoxPosition();
|
|
|
109 |
setSlider();
|
110 |
+
setCheckboxes();
|
111 |
+
checkModel();
|
112 |
+
|
113 |
+
settingBox.classList.add('hideBox');
|
114 |
+
trainingBox.classList.add('hideBox');
|
115 |
|
116 |
if (!historyLoaded) loadHistoryHtml();
|
117 |
if (!usernameGotten) getUserInfo();
|
|
|
121 |
if (longTimeNoCheck && !updateInfoGotten && !isLatestVersion || isLatestVersion && !updateInfoGotten) {
|
122 |
updateLatestVersion();
|
123 |
}
|
124 |
+
setChatbotScroll();
|
125 |
+
setTimeout(showOrHideUserInfo(), 2000);
|
126 |
+
|
127 |
+
// setHistroyPanel();
|
128 |
+
// trainBody.classList.add('hide-body');
|
129 |
+
|
130 |
+
|
131 |
+
|
132 |
return true;
|
133 |
}
|
134 |
|
|
|
209 |
});
|
210 |
}
|
211 |
|
212 |
+
function checkModel() {
|
213 |
+
const model = gradioApp().querySelector('#model-select-dropdown input');
|
214 |
+
var modelValue = model.value;
|
215 |
+
checkGPT();
|
216 |
+
checkXMChat();
|
217 |
+
function checkGPT() {
|
218 |
+
modelValue = model.value;
|
219 |
+
if (modelValue.includes('gpt')) {
|
220 |
+
gradioApp().querySelector('#header-btn-groups').classList.add('is-gpt');
|
221 |
} else {
|
222 |
+
gradioApp().querySelector('#header-btn-groups').classList.remove('is-gpt');
|
|
|
223 |
}
|
224 |
+
// console.log('gpt model checked')
|
225 |
}
|
226 |
+
function checkXMChat() {
|
227 |
+
modelValue = model.value;
|
228 |
+
if (modelValue.includes('xmchat')) {
|
229 |
+
chatbotArea.classList.add('is-xmchat');
|
230 |
+
} else {
|
231 |
+
chatbotArea.classList.remove('is-xmchat');
|
232 |
+
}
|
233 |
+
}
|
234 |
+
|
235 |
+
model.addEventListener('blur', ()=>{
|
236 |
+
setTimeout(()=>{
|
237 |
+
checkGPT();
|
238 |
+
checkXMChat();
|
239 |
+
}, 100);
|
240 |
+
});
|
241 |
+
}
|
242 |
+
|
243 |
+
function toggleDarkMode(isEnabled) {
|
244 |
+
if (isEnabled) {
|
245 |
+
document.body.classList.add("dark");
|
246 |
+
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#171717');
|
247 |
+
document.body.style.setProperty("background-color", "var(--neutral-950)", "important");
|
248 |
+
} else {
|
249 |
+
document.body.classList.remove("dark");
|
250 |
+
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff');
|
251 |
+
document.body.style.backgroundColor = "";
|
252 |
+
}
|
253 |
+
}
|
254 |
+
function adjustDarkMode() {
|
255 |
const darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
256 |
apSwitch.checked = darkModeQuery.matches;
|
257 |
toggleDarkMode(darkModeQuery.matches);
|
|
|
263 |
toggleDarkMode(e.target.checked);
|
264 |
});
|
265 |
}
|
266 |
+
function btnToggleDarkMode() {
|
267 |
+
apSwitch.checked = !apSwitch.checked;
|
268 |
+
toggleDarkMode(apSwitch.checked);
|
269 |
+
}
|
270 |
+
|
271 |
+
function setScrollShadow() {
|
272 |
+
const toolboxScroll = toolbox.querySelector('#toolbox-area > .gradio-box > .gradio-tabs > div.tab-nav');
|
273 |
+
const toolboxTabs = toolboxScroll.querySelectorAll('button');
|
274 |
+
let toolboxScrollWidth = 0;
|
275 |
+
toolboxTabs.forEach((tab) => {
|
276 |
+
toolboxScrollWidth += tab.offsetWidth; // 获取按钮宽度并累加
|
277 |
+
});
|
278 |
+
function adjustScrollShadow() {
|
279 |
+
if (toolboxScroll.scrollLeft > 0) {
|
280 |
+
toolboxScroll.classList.add('scroll-shadow-left');
|
281 |
+
} else {
|
282 |
+
toolboxScroll.classList.remove('scroll-shadow-left');
|
283 |
+
}
|
284 |
+
|
285 |
+
if (toolboxScroll.scrollLeft + toolboxScroll.clientWidth < toolboxScrollWidth) {
|
286 |
+
toolboxScroll.classList.add('scroll-shadow-right');
|
287 |
+
} else {
|
288 |
+
toolboxScroll.classList.remove('scroll-shadow-right');
|
289 |
+
}
|
290 |
+
}
|
291 |
+
toolboxScroll.addEventListener('scroll', () => {
|
292 |
+
adjustScrollShadow();
|
293 |
+
});
|
294 |
+
// no, I failed to make shadow appear on the top layer...
|
295 |
+
}
|
296 |
+
|
297 |
+
function setPopupBoxPosition() {
|
298 |
+
const screenWidth = window.innerWidth;
|
299 |
+
const screenHeight = window.innerHeight;
|
300 |
+
popupWrapper.style.height = `${screenHeight}px`;
|
301 |
+
popupWrapper.style.width = `${screenWidth}px`;
|
302 |
+
// const popupBoxWidth = 680;
|
303 |
+
// const popupBoxHeight = 400;
|
304 |
+
// chuanhuPopup.style.left = `${(screenWidth - popupBoxWidth) / 2}px`;
|
305 |
+
// chuanhuPopup.style.top = `${(screenHeight - popupBoxHeight) / 2}px`;
|
306 |
+
}
|
307 |
+
|
308 |
+
function updateVH() {
|
309 |
+
const vh = window.innerHeight * 0.01;
|
310 |
+
document.documentElement.style.setProperty('--vh', `${vh}px`);
|
311 |
+
}
|
312 |
|
313 |
function setChatbotHeight() {
|
314 |
+
return;
|
315 |
const screenWidth = window.innerWidth;
|
316 |
const statusDisplay = document.querySelector('#status-display');
|
317 |
const statusDisplayHeight = statusDisplay ? statusDisplay.offsetHeight : 0;
|
|
|
350 |
saveHistoryHtml();
|
351 |
disableSendBtn();
|
352 |
// gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message.user').forEach((userElement) => {addAvatars(userElement, 'user')});
|
353 |
+
// gradioApp().querySelectorAll('#chuanhu-chatbot > .wrapper > .wrap > .message-wrap .message-row.bot-row').forEach(addChuanhuButton);
|
354 |
+
gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message-row.bot-row').forEach(addChuanhuButton);
|
355 |
+
if (chatbotIndicator.classList.contains('hide')) {
|
356 |
+
setLatestMessage();
|
357 |
+
setChatList();
|
358 |
+
}
|
359 |
+
}, i === 0 ? 0 : 200);
|
360 |
}
|
361 |
// 理论上是不需要多次尝试执行的,可惜gradio的bug导致message可能没有渲染完毕,所以尝试500ms后再次执行
|
362 |
}
|
|
|
364 |
var chatbotObserver = new MutationObserver(() => {
|
365 |
chatbotContentChanged(1);
|
366 |
if (chatbotIndicator.classList.contains('hide')) {
|
367 |
+
// setLatestMessage();
|
368 |
chatbotContentChanged(2);
|
369 |
}
|
370 |
});
|
371 |
|
372 |
+
var chatListObserver = new MutationObserver(() => {
|
373 |
+
setChatList();
|
374 |
+
});
|
375 |
+
|
376 |
// 监视页面内部 DOM 变动
|
377 |
var gradioObserver = new MutationObserver(function (mutations) {
|
378 |
for (var i = 0; i < mutations.length; i++) {
|
|
|
388 |
// 监视页面变化
|
389 |
window.addEventListener("DOMContentLoaded", function () {
|
390 |
// const ga = document.getElementsByTagName("gradio-app");
|
391 |
+
updateVH();
|
392 |
+
windowWidth = window.innerWidth;
|
393 |
gradioApp().addEventListener("render", initialize);
|
394 |
isInIframe = (window.self !== window.top);
|
395 |
historyLoaded = false;
|
396 |
});
|
397 |
+
window.addEventListener('resize', ()=>{
|
398 |
+
// setChatbotHeight();
|
399 |
+
updateVH();
|
400 |
+
windowWidth = window.innerWidth;
|
401 |
+
setPopupBoxPosition();
|
402 |
+
adjustSide();
|
403 |
+
});
|
404 |
+
window.addEventListener('orientationchange', (event) => {
|
405 |
+
updateVH();
|
406 |
+
windowWidth = window.innerWidth;
|
407 |
+
setPopupBoxPosition();
|
408 |
+
adjustSide();
|
409 |
+
});
|
410 |
+
window.addEventListener('scroll', ()=>{setPopupBoxPosition();});
|
411 |
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", adjustDarkMode);
|
412 |
|
413 |
// console suprise
|
|
|
441 |
GitHub repository: [https://github.com/GaiZhenbiao/ChuanhuChatGPT]\n
|
442 |
Enjoy our project!\n
|
443 |
`
|
444 |
+
console.log(`%c${makeML(ChuanhuInfo)}`,styleTitle1);
|
445 |
+
console.log(`%c${description}`, styleDesc1);
|
|
|
|
|
|
|
|
|
|
|
|
web_assets/javascript/chat-history.js
CHANGED
@@ -20,16 +20,27 @@ function loadHistoryHtml() {
|
|
20 |
return; // no history, do nothing
|
21 |
}
|
22 |
userLogged = localStorage.getItem('userLogged');
|
23 |
-
|
|
|
24 |
historyLoaded = true;
|
25 |
-
return; // logged in, do nothing
|
26 |
}
|
|
|
|
|
27 |
if (!historyLoaded) {
|
28 |
// preprocess, gradio buttons in history lost their event listeners
|
29 |
var gradioCopyButtons = tempDiv.querySelectorAll('button.copy_code_button');
|
30 |
for (var i = 0; i < gradioCopyButtons.length; i++) {
|
31 |
gradioCopyButtons[i].parentNode.removeChild(gradioCopyButtons[i]);
|
32 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
var fakeHistory = document.createElement('div');
|
35 |
fakeHistory.classList.add('history-message');
|
@@ -43,7 +54,7 @@ function loadHistoryHtml() {
|
|
43 |
// fakeHistory.innerHTML = historyHtml;
|
44 |
// chatbotWrap.insertBefore(fakeHistory, chatbotWrap.firstChild);
|
45 |
historyLoaded = true;
|
46 |
-
console.log("History Loaded");
|
47 |
loadhistorytime += 1; // for debugging
|
48 |
} else {
|
49 |
historyLoaded = false;
|
|
|
20 |
return; // no history, do nothing
|
21 |
}
|
22 |
userLogged = localStorage.getItem('userLogged');
|
23 |
+
hideHistoryWhenNotLoggedIn = gradioApp().querySelector('#hideHistoryWhenNotLoggedIn_config').innerText === "True";
|
24 |
+
if (userLogged || (!userLogged && !hideHistoryWhenNotLoggedIn)){
|
25 |
historyLoaded = true;
|
26 |
+
return; // logged in, do nothing. OR, not logged in but not hide history list, do nothing.
|
27 |
}
|
28 |
+
|
29 |
+
// 只有用户未登录,还隐藏历史记录列表时,才选用只读历史记录
|
30 |
if (!historyLoaded) {
|
31 |
// preprocess, gradio buttons in history lost their event listeners
|
32 |
var gradioCopyButtons = tempDiv.querySelectorAll('button.copy_code_button');
|
33 |
for (var i = 0; i < gradioCopyButtons.length; i++) {
|
34 |
gradioCopyButtons[i].parentNode.removeChild(gradioCopyButtons[i]);
|
35 |
}
|
36 |
+
var messageBtnRows = tempDiv.querySelectorAll('.message-btn-row');
|
37 |
+
for (var i = 0; i < messageBtnRows.length; i++) {
|
38 |
+
messageBtnRows[i].parentNode.removeChild(messageBtnRows[i]);
|
39 |
+
}
|
40 |
+
var latestMessages = tempDiv.querySelectorAll('.message.latest');
|
41 |
+
for (var i = 0; i < latestMessages.length; i++) {
|
42 |
+
latestMessages[i].classList.remove('latest');
|
43 |
+
}
|
44 |
|
45 |
var fakeHistory = document.createElement('div');
|
46 |
fakeHistory.classList.add('history-message');
|
|
|
54 |
// fakeHistory.innerHTML = historyHtml;
|
55 |
// chatbotWrap.insertBefore(fakeHistory, chatbotWrap.firstChild);
|
56 |
historyLoaded = true;
|
57 |
+
// console.log("History Loaded");
|
58 |
loadhistorytime += 1; // for debugging
|
59 |
} else {
|
60 |
historyLoaded = false;
|
web_assets/javascript/chat-list.js
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
var currentChatName = null;
|
3 |
+
|
4 |
+
function setChatListHeader() {
|
5 |
+
var grHistoryRefreshBtn = gradioApp().querySelector('button#gr-history-refresh-btn');
|
6 |
+
var grHistoryUploadBtn = gradioApp().querySelector('button#gr-history-upload-btn');
|
7 |
+
|
8 |
+
grHistoryRefreshBtn.className = "";
|
9 |
+
grHistoryUploadBtn.className = "";
|
10 |
+
|
11 |
+
|
12 |
+
grHistoryRefreshBtn.innerHTML = HistoryRefreshIcon;
|
13 |
+
grHistoryUploadBtn.innerHTML = HistoryUploadIcon;
|
14 |
+
}
|
15 |
+
|
16 |
+
function setChatList() {
|
17 |
+
var selectedChat = null;
|
18 |
+
var chatList = gradioApp().querySelector('fieldset#history-select-dropdown');
|
19 |
+
selectedChat = chatList.querySelector(".wrap label.selected")
|
20 |
+
if (!selectedChat) {
|
21 |
+
currentChatName = null;
|
22 |
+
return;
|
23 |
+
}
|
24 |
+
|
25 |
+
// if (userLogged) {
|
26 |
+
// currentChatName = username + "/" + selectedChat.querySelector('span').innerText;
|
27 |
+
// } else {
|
28 |
+
currentChatName = selectedChat.querySelector('span').innerText;
|
29 |
+
// }
|
30 |
+
|
31 |
+
if (selectedChat.classList.contains('added-chat-btns')) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
chatList.querySelector('.chat-selected-btns')?.remove(); // remove old buttons
|
36 |
+
chatList.querySelectorAll('.added-chat-btns').forEach(chat => chat.classList.remove('added-chat-btns'));
|
37 |
+
|
38 |
+
var ChatSelectedBtns = document.createElement('div');
|
39 |
+
ChatSelectedBtns.classList.add('chat-selected-btns');
|
40 |
+
selectedChat.classList.add('added-chat-btns');
|
41 |
+
ChatSelectedBtns.innerHTML = selectedChatBtns;
|
42 |
+
|
43 |
+
var renameBtn = ChatSelectedBtns.querySelector('#history-rename-btn');
|
44 |
+
renameBtn.addEventListener('click', function () {
|
45 |
+
gradioApp().querySelector('#gr-history-save-btn').click();
|
46 |
+
});
|
47 |
+
|
48 |
+
var deleteBtn = ChatSelectedBtns.querySelector('#history-delete-btn');
|
49 |
+
deleteBtn.addEventListener('click', function () {
|
50 |
+
gradioApp().querySelector('#gr-history-delete-btn').click();
|
51 |
+
});
|
52 |
+
selectedChat.appendChild(ChatSelectedBtns);
|
53 |
+
|
54 |
+
return;
|
55 |
+
}
|
56 |
+
|
57 |
+
function saveChatHistory(a, b, c, d) {
|
58 |
+
var fileName = b;
|
59 |
+
fileName = prompt(renameChat_i18n, b);
|
60 |
+
if (fileName && fileName.trim() !== "") {
|
61 |
+
return [a, fileName, c, d];
|
62 |
+
} else {
|
63 |
+
return [a, "", c, d];
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
const selectedChatBtns = `
|
68 |
+
<button id="history-rename-btn"><svg class="icon-need-hover" stroke="currentColor" fill="none" stroke-width="2" height="18px" width="18px" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg></button>
|
69 |
+
<button id="history-delete-btn"><svg class="icon-need-hover" stroke="currentColor" fill="none" stroke-width="2" height="18px" width="18px" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg></button>
|
70 |
+
`
|
71 |
+
const HistoryRefreshIcon = '<svg class="icon-need-hover" width="18px" height="18px" viewBox="0 0 16.3594 21.9258 " version="1.1" xmlns="http://www.w3.org/2000/svg"><g><path d="M0 11.6367C0 16.1836 3.65625 19.8398 8.17969 19.8398C12.7031 19.8398 16.3594 16.1836 16.3594 11.6367C16.3594 11.1328 16.0078 10.7695 15.4805 10.7695C14.9883 10.7695 14.6719 11.1328 14.6719 11.6367C14.6719 15.2461 11.7773 18.1406 8.17969 18.1406C4.59376 18.1406 1.6875 15.2461 1.6875 11.6367C1.6875 8.03906 4.59376 5.14452 8.17969 5.14452C8.80079 5.14452 9.33985 5.17968 9.83202 5.28516L7.35937 7.72265C7.19531 7.88671 7.11328 8.09765 7.11328 8.30858C7.11328 8.78906 7.47657 9.15235 7.94531 9.15235C8.20312 9.15235 8.40234 9.07032 8.54296 8.91797L12.2578 5.21484C12.4219 5.05078 12.4922 4.85155 12.4922 4.60546C12.4922 4.38281 12.4102 4.16016 12.2578 4.00781L8.54296 0.257808C8.40234 0.093744 8.19141 0 7.9336 0C7.47657 0 7.11328 0.386712 7.11328 0.867192C7.11328 1.08984 7.19531 1.30078 7.34766 1.46484L9.49218 3.57422C9.07031 3.49219 8.62499 3.45703 8.17969 3.45703C3.65625 3.45703 0 7.10155 0 11.6367Z" fill="currentColor"/></g></svg>';
|
72 |
+
const HistoryUploadIcon = '<svg class="icon-need-hover" width="18px" height="18px" viewBox="0 0 21.0234 19.5352" version="1.1" xmlns="http://www.w3.org/2000/svg"><g fill="currentColor"><path d="M4.03125 19.5352C5.34375 19.5352 8.01562 18.1758 9.90234 16.7812C16.4531 16.8281 21.0234 13.1016 21.0234 8.40234C21.0234 3.75 16.3477 0 10.5117 0C4.6875 0 0 3.75 0 8.40234C0 11.4258 1.93359 14.1211 4.83984 15.4336C4.41797 16.2539 3.62109 17.4141 3.19922 17.9766C2.69531 18.6445 3.01172 19.5352 4.03125 19.5352ZM5.17969 17.7891C5.10938 17.8242 5.08594 17.7656 5.13281 17.707C5.67188 17.0391 6.38672 16.0547 6.69141 15.5156C6.98438 14.9883 6.91406 14.4961 6.23438 14.1797C3.35156 12.8438 1.73438 10.7695 1.73438 8.40234C1.73438 4.73438 5.625 1.73438 10.5117 1.73438C15.4102 1.73438 19.2891 4.73438 19.2891 8.40234C19.2891 12.0586 15.4102 15.0586 10.5117 15.0586C10.3945 15.0586 10.1602 15.0586 9.82031 15.0586C9.38672 15.0586 9.05859 15.1992 8.67188 15.5156C7.65234 16.3125 6.03516 17.3789 5.17969 17.7891Z"/><path d="M10.5234 13.1133C10.9805 13.1133 11.3086 12.7969 11.3086 12.3398L11.3086 8.20312L11.2266 6.10547L12.0938 7.19531L13.0312 8.15625C13.1719 8.30859 13.3594 8.37891 13.5938 8.37891C14.0156 8.37891 14.3555 8.05078 14.3555 7.62891C14.3555 7.41797 14.2734 7.21875 14.1445 7.08984L11.1445 4.10156C10.9453 3.90234 10.7578 3.79688 10.5234 3.79688C10.3008 3.79688 10.125 3.89062 9.91406 4.10156L6.91406 7.08984C6.77344 7.21875 6.70312 7.41797 6.70312 7.62891C6.70312 8.05078 7.03125 8.37891 7.46484 8.37891C7.6875 8.37891 7.875 8.29688 8.01562 8.15625L8.96484 7.19531L9.82031 6.11719L9.75 8.20312L9.75 12.3398C9.75 12.7969 10.0781 13.1133 10.5234 13.1133Z"/></g></svg>';
|
web_assets/javascript/fake-gradio.js
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
// Fake gradio components!
|
3 |
+
|
4 |
+
// buttons
|
5 |
+
function newChatClick() {
|
6 |
+
gradioApp().querySelector('#empty-btn').click();
|
7 |
+
}
|
8 |
+
function jsonDownloadClick() {
|
9 |
+
gradioApp().querySelector('#gr-history-download-btn').click();
|
10 |
+
}
|
11 |
+
function mdDownloadClick() {
|
12 |
+
gradioApp().querySelector('#gr-markdown-export-btn').click();
|
13 |
+
gradioApp().querySelector('#gr-history-mardown-download-btn').click();
|
14 |
+
|
15 |
+
// downloadHistory(username, currentChatName, ".md");
|
16 |
+
}
|
17 |
+
|
18 |
+
// index files
|
19 |
+
function setUploader() {
|
20 |
+
transUpload();
|
21 |
+
var uploaderObserver = new MutationObserver(function (mutations) {
|
22 |
+
var fileInput = null;
|
23 |
+
var fileCount = 0;
|
24 |
+
fileInput = gradioApp().querySelector("#upload-index-file table.file-preview");
|
25 |
+
var fileCountSpan = gradioApp().querySelector("#uploaded-files-count");
|
26 |
+
if (fileInput) {
|
27 |
+
chatbotArea.classList.add('with-file');
|
28 |
+
fileCount = fileInput.querySelectorAll('tbody > tr.file').length;
|
29 |
+
fileCountSpan.innerText = fileCount;
|
30 |
+
} else {
|
31 |
+
chatbotArea.classList.remove('with-file');
|
32 |
+
fileCount = 0;
|
33 |
+
transUpload();
|
34 |
+
}
|
35 |
+
});
|
36 |
+
uploaderObserver.observe(uploaderIndicator, {attributes: true})
|
37 |
+
}
|
38 |
+
var grUploader;
|
39 |
+
var chatbotUploader;
|
40 |
+
var handleClick = function() {
|
41 |
+
grUploader.click();
|
42 |
+
|
43 |
+
};
|
44 |
+
function transUpload() {
|
45 |
+
chatbotUploader = gradioApp().querySelector("#upload-files-btn");
|
46 |
+
chatbotUploader.removeEventListener('click', handleClick);
|
47 |
+
grUploader = gradioApp().querySelector("#upload-index-file > .center.flex");
|
48 |
+
|
49 |
+
// let uploaderEvents = ["click", "drag", "dragend", "dragenter", "dragleave", "dragover", "dragstart", "drop"];
|
50 |
+
// transEventListeners(chatbotUploader, grUploader, uploaderEvents);
|
51 |
+
|
52 |
+
chatbotUploader.addEventListener('click', handleClick);
|
53 |
+
}
|
54 |
+
|
55 |
+
// checkbox
|
56 |
+
var grSingleSessionCB;
|
57 |
+
var grOnlineSearchCB;
|
58 |
+
var chatbotSingleSessionCB;
|
59 |
+
var chatbotOnlineSearchCB;
|
60 |
+
function setCheckboxes() {
|
61 |
+
chatbotSingleSessionCB = gradioApp().querySelector('input[name="single-session-cb"]');
|
62 |
+
chatbotOnlineSearchCB = gradioApp().querySelector('input[name="online-search-cb"]');
|
63 |
+
grSingleSessionCB = gradioApp().querySelector("#gr-single-session-cb > label > input");
|
64 |
+
grOnlineSearchCB = gradioApp().querySelector("#gr-websearch-cb > label> input");
|
65 |
+
|
66 |
+
chatbotSingleSessionCB.addEventListener('change', (e) => {
|
67 |
+
grSingleSessionCB.checked = chatbotSingleSessionCB.checked;
|
68 |
+
gradioApp().querySelector('#change-single-session-btn').click();
|
69 |
+
});
|
70 |
+
chatbotOnlineSearchCB.addEventListener('change', (e) => {
|
71 |
+
grOnlineSearchCB.checked = chatbotOnlineSearchCB.checked;
|
72 |
+
gradioApp().querySelector('#change-online-search-btn').click();
|
73 |
+
});
|
74 |
+
grSingleSessionCB.addEventListener('change', (e) => {
|
75 |
+
chatbotSingleSessionCB.checked = grSingleSessionCB.checked;
|
76 |
+
});
|
77 |
+
grOnlineSearchCB.addEventListener('change', (e) => {
|
78 |
+
chatbotOnlineSearchCB.checked = grOnlineSearchCB.checked;
|
79 |
+
});
|
80 |
+
}
|
81 |
+
|
82 |
+
function bgChangeSingleSession() {
|
83 |
+
// const grSingleSessionCB = gradioApp().querySelector("#gr-single-session-cb > label > input");
|
84 |
+
let a = chatbotSingleSessionCB.checked;
|
85 |
+
return [a];
|
86 |
+
}
|
87 |
+
function bgChangeOnlineSearch() {
|
88 |
+
// const grOnlineSearchCB = gradioApp().querySelector("#gr-websearch-cb > label> input");
|
89 |
+
let a = chatbotOnlineSearchCB.checked;
|
90 |
+
return [a];
|
91 |
+
}
|
92 |
+
|
93 |
+
// UTILS
|
94 |
+
function transEventListeners(target, source, events) {
|
95 |
+
events.forEach((sourceEvent) => {
|
96 |
+
target.addEventListener(sourceEvent, function (targetEvent) {
|
97 |
+
if(targetEvent.preventDefault) targetEvent.preventDefault();
|
98 |
+
if(targetEvent.stopPropagation) targetEvent.stopPropagation();
|
99 |
+
|
100 |
+
source.dispatchEvent(new Event(sourceEvent, {detail: targetEvent.detail}));
|
101 |
+
// console.log(targetEvent.detail);
|
102 |
+
});
|
103 |
+
});
|
104 |
+
/* 事实上,我发现这样写的大多数gradio组件并不适用。。所以。。。生气 */
|
105 |
+
}
|
106 |
+
|
107 |
+
function bgSelectHistory(a,b){
|
108 |
+
const historySelectorInput = gradioApp().querySelector('#history-select-dropdown input');
|
109 |
+
let file = historySelectorInput.value;
|
110 |
+
return [a,file]
|
111 |
+
}
|
web_assets/javascript/localization.js
CHANGED
@@ -3,72 +3,30 @@
|
|
3 |
|
4 |
const language = navigator.language.slice(0,2);
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
'
|
19 |
-
'
|
20 |
-
'
|
21 |
-
'
|
22 |
-
'
|
23 |
-
'
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
'zh': " 吗?",
|
28 |
-
'en': " ?",
|
29 |
-
'ja': " を削除してもよろしいですか?",
|
30 |
-
'ko': " 을(를) 삭제하시겠습니까?",
|
31 |
-
'sv': " ?",
|
32 |
-
'ru': " ?"
|
33 |
-
};
|
34 |
-
|
35 |
-
const usingLatest_i18n = {
|
36 |
-
'zh': "您使用的就是最新版!",
|
37 |
-
'en': "You are using the latest version!",
|
38 |
-
'ja': "最新バージョンを使用しています!",
|
39 |
-
'ko': "최신 버전을 사용하고 있습니다!",
|
40 |
-
'sv': "Du använder den senaste versionen!",
|
41 |
-
'ru': "Вы используете последнюю версию!"
|
42 |
-
};
|
43 |
-
|
44 |
-
const updatingMsg_i18n = {
|
45 |
-
'zh': "正在尝试更新...",
|
46 |
-
'en': "Trying to update...",
|
47 |
-
'ja': "更新を試みています...",
|
48 |
-
'ko': "업데이트를 시도 중...",
|
49 |
-
'sv': "Försöker uppdatera...",
|
50 |
-
'ru': "Попытка обновления..."
|
51 |
}
|
52 |
|
53 |
-
const updateSuccess_i18n = {
|
54 |
-
'zh': "更新成功,请重启本程序。",
|
55 |
-
'en': "Updated successfully, please restart this program.",
|
56 |
-
'ja': "更新が成功しました、このプログラムを再起動してください。",
|
57 |
-
'ko': "업데이트 성공, 이 프로그램을 재시작 해주세요.",
|
58 |
-
'sv': "Uppdaterat framgångsrikt, starta om programmet.",
|
59 |
-
'ru': "Обновлено успешно, перезапустите эту программу."
|
60 |
-
}
|
61 |
-
|
62 |
-
const updateFailure_i18n = {
|
63 |
-
'zh': '更新失败,请尝试<a href="https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新" target="_blank">手动更新</a>。',
|
64 |
-
'en': 'Update failed, please try <a href="https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新" target="_blank">manually updating</a>.',
|
65 |
-
'ja': '更新に失敗しました、<a href="https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新" target="_blank">手動での更新</a>をお試しください。',
|
66 |
-
'ko': '업데이트 실패, <a href="https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新" target="_blank">수동 업데이트</a>를 시도하십시오.',
|
67 |
-
'sv': 'Uppdateringen misslyckades, prova att <a href="https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新" target="_blank">uppdatera manuellt</a>.',
|
68 |
-
'ru': 'Обновление не удалось, попробуйте <a href="https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新" target="_blank">обновление вручную</a>.'
|
69 |
-
}
|
70 |
-
|
71 |
-
|
72 |
function i18n(msg) {
|
73 |
-
return msg
|
|
|
74 |
}
|
|
|
3 |
|
4 |
const language = navigator.language.slice(0,2);
|
5 |
|
6 |
+
var forView_i18n;
|
7 |
+
var deleteConfirm_i18n_pref;
|
8 |
+
var deleteConfirm_i18n_suff;
|
9 |
+
var usingLatest_i18n;
|
10 |
+
var updatingMsg_i18n;
|
11 |
+
var updateSuccess_i18n;
|
12 |
+
var updateFailure_i18n;
|
13 |
+
var regenerate_i18n;
|
14 |
+
var deleteRound_i18n;
|
15 |
+
|
16 |
+
function setLoclize() {
|
17 |
+
forView_i18n = gradioApp().querySelector('#forView_i18n').innerText;
|
18 |
+
deleteConfirm_i18n_pref = gradioApp().querySelector('#deleteConfirm_i18n_pref').innerText;
|
19 |
+
deleteConfirm_i18n_suff = gradioApp().querySelector('#deleteConfirm_i18n_suff').innerText;
|
20 |
+
usingLatest_i18n = gradioApp().querySelector('#usingLatest_i18n').innerText;
|
21 |
+
updatingMsg_i18n = gradioApp().querySelector('#updatingMsg_i18n').innerText;
|
22 |
+
updateSuccess_i18n = gradioApp().querySelector('#updateSuccess_i18n').innerText;
|
23 |
+
updateFailure_i18n = gradioApp().querySelector('#updateFailure_i18n').innerText;
|
24 |
+
regenerate_i18n = gradioApp().querySelector('#regenerate_i18n').innerText;
|
25 |
+
deleteRound_i18n = gradioApp().querySelector('#deleteRound_i18n').innerText;
|
26 |
+
renameChat_i18n = gradioApp().querySelector('#renameChat_i18n').innerText;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
function i18n(msg) {
|
30 |
+
return msg;
|
31 |
+
// return msg.hasOwnProperty(language) ? msg[language] : msg['en'];
|
32 |
}
|
web_assets/javascript/message-button.js
CHANGED
@@ -1,18 +1,26 @@
|
|
1 |
|
2 |
-
// 为 bot 消息添加复制与切换显示按钮
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
function addChuanhuButton(botElement) {
|
5 |
var rawMessage = botElement.querySelector('.raw-message');
|
6 |
var mdMessage = botElement.querySelector('.md-message');
|
7 |
|
8 |
if (!rawMessage) { // 如果没有 raw message,说明是早期历史记录,去除按钮
|
9 |
-
var buttons = botElement.querySelectorAll('button.chuanhu-btn');
|
10 |
-
for (var i = 0; i < buttons.length; i++) {
|
11 |
-
|
12 |
-
}
|
|
|
|
|
13 |
return;
|
14 |
}
|
15 |
-
botElement.querySelectorAll('button.copy-bot-btn, button.toggle-md-btn').forEach(btn => btn.remove()); // 就算原先有了,也必须重新添加,而不是跳过
|
|
|
|
|
16 |
|
17 |
// Copy bot button
|
18 |
var copyButton = document.createElement('button');
|
@@ -50,7 +58,7 @@ function addChuanhuButton(botElement) {
|
|
50 |
console.error("Copy failed: ", error);
|
51 |
}
|
52 |
});
|
53 |
-
botElement.appendChild(copyButton);
|
54 |
|
55 |
// Toggle button
|
56 |
var toggleButton = document.createElement('button');
|
@@ -70,7 +78,13 @@ function addChuanhuButton(botElement) {
|
|
70 |
}
|
71 |
chatbotContentChanged(1); // to set md or raw in read-only history html
|
72 |
});
|
73 |
-
botElement.insertBefore(toggleButton, copyButton);
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
function renderMarkdownText(message) {
|
76 |
var mdDiv = message.querySelector('.md-message');
|
@@ -89,4 +103,90 @@ function addChuanhuButton(botElement) {
|
|
89 |
}
|
90 |
}
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
|
|
|
|
|
1 |
|
2 |
+
// 为 bot 消息添加复制与切换显示按钮 以及最新消息加上重新生成,删除最新消息,嗯。
|
3 |
+
|
4 |
+
function addChuanhuButton(botRow) {
|
5 |
+
|
6 |
+
botElement = botRow.querySelector('.message.bot');
|
7 |
+
isLatestMessage = botElement.classList.contains('latest');
|
8 |
|
|
|
9 |
var rawMessage = botElement.querySelector('.raw-message');
|
10 |
var mdMessage = botElement.querySelector('.md-message');
|
11 |
|
12 |
if (!rawMessage) { // 如果没有 raw message,说明是早期历史记录,去除按钮
|
13 |
+
// var buttons = botElement.querySelectorAll('button.chuanhu-btn');
|
14 |
+
// for (var i = 0; i < buttons.length; i++) {
|
15 |
+
// buttons[i].parentNode.removeChild(buttons[i]);
|
16 |
+
// }
|
17 |
+
botElement.querySelector('.message-btn-row')?.remove();
|
18 |
+
botElement.querySelector('.message-btn-column')?.remove();
|
19 |
return;
|
20 |
}
|
21 |
+
// botElement.querySelectorAll('button.copy-bot-btn, button.toggle-md-btn').forEach(btn => btn.remove()); // 就算原先有了,也必须重新添加,而不是跳过
|
22 |
+
if (!isLatestMessage) botElement.querySelector('.message-btn-row')?.remove();
|
23 |
+
botElement.querySelector('.message-btn-column')?.remove();
|
24 |
|
25 |
// Copy bot button
|
26 |
var copyButton = document.createElement('button');
|
|
|
58 |
console.error("Copy failed: ", error);
|
59 |
}
|
60 |
});
|
61 |
+
// botElement.appendChild(copyButton);
|
62 |
|
63 |
// Toggle button
|
64 |
var toggleButton = document.createElement('button');
|
|
|
78 |
}
|
79 |
chatbotContentChanged(1); // to set md or raw in read-only history html
|
80 |
});
|
81 |
+
// botElement.insertBefore(toggleButton, copyButton);
|
82 |
+
|
83 |
+
var messageBtnColumn = document.createElement('div');
|
84 |
+
messageBtnColumn.classList.add('message-btn-column');
|
85 |
+
messageBtnColumn.appendChild(toggleButton);
|
86 |
+
messageBtnColumn.appendChild(copyButton);
|
87 |
+
botElement.appendChild(messageBtnColumn);
|
88 |
|
89 |
function renderMarkdownText(message) {
|
90 |
var mdDiv = message.querySelector('.md-message');
|
|
|
103 |
}
|
104 |
}
|
105 |
|
106 |
+
function setLatestMessage() {
|
107 |
+
var latestMessage = gradioApp().querySelector('#chuanhu-chatbot > .wrapper > .wrap > .message-wrap .message.bot.latest');
|
108 |
+
if (latestMessage) addLatestMessageButtons(latestMessage);
|
109 |
+
}
|
110 |
+
|
111 |
+
function addLatestMessageButtons(botElement) {
|
112 |
+
botElement.querySelector('.message-btn-row')?.remove();
|
113 |
+
|
114 |
+
var messageBtnRow = document.createElement('div');
|
115 |
+
messageBtnRow.classList.add('message-btn-row');
|
116 |
+
var messageBtnRowLeading = document.createElement('div');
|
117 |
+
messageBtnRowLeading.classList.add('message-btn-row-leading');
|
118 |
+
var messageBtnRowTrailing = document.createElement('div');
|
119 |
+
messageBtnRowTrailing.classList.add('message-btn-row-trailing');
|
120 |
+
|
121 |
+
messageBtnRow.appendChild(messageBtnRowLeading);
|
122 |
+
messageBtnRow.appendChild(messageBtnRowTrailing);
|
123 |
+
|
124 |
+
botElement.appendChild(messageBtnRow);
|
125 |
+
|
126 |
+
//leading
|
127 |
+
var regenerateButton = document.createElement('button');
|
128 |
+
regenerateButton.classList.add('chuanhu-btn');
|
129 |
+
regenerateButton.classList.add('regenerate-btn');
|
130 |
+
regenerateButton.setAttribute('aria-label', 'Regenerate');
|
131 |
+
regenerateButton.innerHTML = regenIcon + `<span>${i18n(regenerate_i18n)}</span>`;
|
132 |
+
|
133 |
+
var gradioRetryBtn = gradioApp().querySelector('#gr-retry-btn');
|
134 |
+
regenerateButton.addEventListener('click', () => {
|
135 |
+
gradioRetryBtn.click();
|
136 |
+
});
|
137 |
+
|
138 |
+
var deleteButton = document.createElement('button');
|
139 |
+
deleteButton.classList.add('chuanhu-btn');
|
140 |
+
deleteButton.classList.add('delete-latest-btn');
|
141 |
+
deleteButton.setAttribute('aria-label', 'Delete');
|
142 |
+
deleteButton.innerHTML = deleteIcon + `<span>${i18n(deleteRound_i18n)}</span>`;
|
143 |
+
|
144 |
+
var gradioDelLastBtn = gradioApp().querySelector('#gr-dellast-btn');
|
145 |
+
deleteButton.addEventListener('click', () => {
|
146 |
+
gradioDelLastBtn.click();
|
147 |
+
chatbotContentChanged(2);
|
148 |
+
});
|
149 |
+
|
150 |
+
messageBtnRowLeading.appendChild(regenerateButton);
|
151 |
+
messageBtnRowLeading.appendChild(deleteButton);
|
152 |
+
|
153 |
+
// trailing
|
154 |
+
var likeButton = document.createElement('button');
|
155 |
+
likeButton.classList.add('chuanhu-btn');
|
156 |
+
likeButton.classList.add('like-latest-btn');
|
157 |
+
likeButton.setAttribute('aria-label', 'Like');
|
158 |
+
likeButton.innerHTML = likeIcon;
|
159 |
+
|
160 |
+
var gradioLikeBtn = gradioApp().querySelector('#gr-like-btn');
|
161 |
+
likeButton.addEventListener('click', () => {
|
162 |
+
gradioLikeBtn.click();
|
163 |
+
});
|
164 |
+
|
165 |
+
var dislikeButton = document.createElement('button');
|
166 |
+
dislikeButton.classList.add('chuanhu-btn');
|
167 |
+
dislikeButton.classList.add('dislike-latest-btn');
|
168 |
+
dislikeButton.setAttribute('aria-label', 'Dislike');
|
169 |
+
dislikeButton.innerHTML = dislikeIcon;
|
170 |
+
|
171 |
+
var gradioDislikeBtn = gradioApp().querySelector('#gr-dislike-btn');
|
172 |
+
dislikeButton.addEventListener('click', () => {
|
173 |
+
gradioDislikeBtn.click();
|
174 |
+
});
|
175 |
+
|
176 |
+
messageBtnRowTrailing.appendChild(likeButton);
|
177 |
+
messageBtnRowTrailing.appendChild(dislikeButton);
|
178 |
+
}
|
179 |
+
|
180 |
+
|
181 |
+
// button svg code
|
182 |
+
const copyIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span>';
|
183 |
+
const copiedIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><polyline points="20 6 9 17 4 12"></polyline></svg></span>';
|
184 |
+
const mdIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="1" viewBox="0 0 14 18" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><g transform-origin="center" transform="scale(0.85)"><path d="M1.5,0 L12.5,0 C13.3284271,-1.52179594e-16 14,0.671572875 14,1.5 L14,16.5 C14,17.3284271 13.3284271,18 12.5,18 L1.5,18 C0.671572875,18 1.01453063e-16,17.3284271 0,16.5 L0,1.5 C-1.01453063e-16,0.671572875 0.671572875,1.52179594e-16 1.5,0 Z" stroke-width="1.8"></path><line x1="3.5" y1="3.5" x2="10.5" y2="3.5"></line><line x1="3.5" y1="6.5" x2="8" y2="6.5"></line></g><path d="M4,9 L10,9 C10.5522847,9 11,9.44771525 11,10 L11,13.5 C11,14.0522847 10.5522847,14.5 10,14.5 L4,14.5 C3.44771525,14.5 3,14.0522847 3,13.5 L3,10 C3,9.44771525 3.44771525,9 4,9 Z" stroke="none" fill="currentColor"></path></svg></span>';
|
185 |
+
const rawIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="1.8" viewBox="0 0 18 14" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><g transform-origin="center" transform="scale(0.85)"><polyline points="4 3 0 7 4 11"></polyline><polyline points="14 3 18 7 14 11"></polyline><line x1="12" y1="0" x2="6" y2="14"></line></g></svg></span>';
|
186 |
+
|
187 |
+
const regenIcon = '<span><svg viewBox="0 0 15.6737 14.3099" height="11px" width="10px" xmlns="http://www.w3.org/2000/svg"><g fill="currentColor"><path d="M8.52344 14.3043C12.4453 14.3043 15.6737 11.0704 15.6737 7.15396C15.6737 3.23385 12.4453 0 8.52344 0C4.61357 0 1.39193 3.20969 1.37314 7.11614L2.77012 7.11614C2.78891 3.94173 5.34391 1.40431 8.52344 1.40431C11.7096 1.40431 14.2785 3.96418 14.2785 7.15396C14.2785 10.3401 11.7096 12.9163 8.52344 12.9073C6.6559 12.9036 5.0325 12.0192 3.98219 10.6317C3.70247 10.3165 3.29141 10.2174 2.96431 10.4686C2.65796 10.6988 2.60863 11.1321 2.91325 11.5028C4.17573 13.1677 6.28972 14.3043 8.52344 14.3043ZM0.520576 5.73631C-0.0035439 5.73631-0.140743 6.14811 0.149274 6.53993L1.86425 8.89772C2.08543 9.20509 2.4372 9.20143 2.65301 8.89772L4.36628 6.53626C4.64726 6.14981 4.51544 5.73631 3.99839 5.73631Z"/></g></svg></span>';
|
188 |
+
const deleteIcon = '<span><svg viewBox="0 0 17.0644 12.9388" height="11px" width="11px" xmlns="http://www.w3.org/2000/svg"><g fill="currentColor"><path d="M4.85464 12.9388L12.2098 12.9388C13.6299 12.9388 14.26 12.2074 14.4792 10.7927L15.6069 3.38561L14.2702 3.42907L13.1479 10.686C13.049 11.3506 12.7252 11.6268 12.12 11.6268L4.94444 11.6268C4.32818 11.6268 4.01711 11.3506 3.91652 10.686L2.79421 3.42907L1.45752 3.38561L2.5852 10.7927C2.80443 12.2147 3.43453 12.9388 4.85464 12.9388ZM1.5018 4.10325L15.5643 4.10325C16.5061 4.10325 17.0644 3.49076 17.0644 2.55799L17.0644 1.55796C17.0644 0.623227 16.5061 0.0144053 15.5643 0.0144053L1.5018 0.0144053C0.588798 0.0144053 0 0.623227 0 1.55796L0 2.55799C0 3.49076 0.561696 4.10325 1.5018 4.10325ZM1.72372 2.88176C1.41559 2.88176 1.26666 2.7255 1.26666 2.412L1.26666 1.70028C1.26666 1.39215 1.41559 1.23589 1.72372 1.23589L15.3444 1.23589C15.6542 1.23589 15.7978 1.39215 15.7978 1.70028L15.7978 2.412C15.7978 2.7255 15.6542 2.88176 15.3444 2.88176Z"/><path d="M6.62087 10.2995C6.77686 10.2995 6.90282 10.2353 7.01438 10.1274L8.53038 8.60625L10.0517 10.1274C10.1633 10.2316 10.2876 10.2995 10.4526 10.2995C10.7594 10.2995 11.0131 10.0368 11.0131 9.72824C11.0131 9.56151 10.9542 9.44092 10.8427 9.32936L9.33033 7.81679L10.8463 6.29151C10.965 6.17458 11.0184 6.0557 11.0184 5.90166C11.0184 5.58407 10.7685 5.33044 10.4526 5.33044C10.302 5.33044 10.1814 5.38928 10.0608 5.5062L8.53038 7.03269L7.01072 5.50987C6.89379 5.39831 6.77686 5.33947 6.62087 5.33947C6.31036 5.33947 6.05307 5.59311 6.05307 5.90166C6.05307 6.05936 6.11019 6.18899 6.22346 6.29688L7.73579 7.81679L6.22346 9.33303C6.1119 9.44092 6.05307 9.56688 6.05307 9.72824C6.05307 10.0405 6.3067 10.2995 6.62087 10.2995Z"/></g></svg></span>';
|
189 |
+
// const deleteIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" height="11px" width="11px" viewBox="0 0 216 163" version="1.1" xmlns="http://www.w3.org/2000/svg"><rect x="0.5" y="0.5" width="215" height="39" rx="9"/><path d="M197.485,39.535 L181.664,145.870 C180.953,150.648 178.547,154.805 175.110,157.768 C171.674,160.731 167.207,162.500 162.376,162.500 L53.558,162.500 C48.737,162.500 44.278,160.738 40.843,157.785 C37.409,154.831 34.999,150.686 34.278,145.919 L18.173,39.535 L197.485,39.535 Z" /><line x1="79.5" y1="71.5" x2="135.5" y2="127.5"/><line x1="79.5" y1="127.5" x2="135.5" y2="71.5"/></svg></span>'
|
190 |
|
191 |
+
const likeIcon = '<span><svg viewBox="0 0 14.4675 15.7462" height="11px" width="11px" xmlns="http://www.w3.org/2000/svg"><g fill="currentColor"><path d="M0 10.371C0 12.7447 1.51703 14.6758 3.48611 14.6758L5.667 14.6758C6.55809 15.123 7.61471 15.3774 8.77071 15.3774L9.69842 15.3774C10.58 15.3774 11.3136 15.3276 11.7943 15.2026C12.7703 14.9639 13.3931 14.2618 13.3931 13.3949C13.3931 13.2345 13.3677 13.0941 13.3208 12.9537C13.7842 12.5939 14.042 12.0763 14.042 11.4997C14.042 11.2309 13.9917 10.9655 13.8908 10.7507C14.206 10.4318 14.3799 9.96358 14.3799 9.46848C14.3799 9.14304 14.3027 8.81345 14.1645 8.57078C14.3581 8.2876 14.4675 7.90016 14.4675 7.47879C14.4675 6.42124 13.6602 5.60147 12.6063 5.60147L10.1642 5.60147C10.0006 5.60147 9.8919 5.52528 9.89873 5.37707C9.94826 4.69467 11.0035 3.06283 11.0035 1.72154C11.0035 0.72357 10.3014 0 9.33735 0C8.63623 0 8.15116 0.370089 7.70051 1.23942C6.86069 2.86536 5.8793 4.19561 4.39803 6.0414L3.23221 6.0414C1.38812 6.0414 0 7.9527 0 10.371ZM4.16181 10.3188C4.16181 8.90914 4.47725 8.01363 5.3808 6.80246C6.38763 5.45238 7.78384 3.82937 8.78871 1.82159C8.99528 1.42114 9.12909 1.3181 9.34054 1.3181C9.5974 1.3181 9.76222 1.50416 9.76222 1.81548C9.76222 2.78038 8.64211 4.4305 8.64211 5.51371C8.64211 6.3203 9.28051 6.84271 10.1713 6.84271L12.5653 6.84271C12.9408 6.84271 13.2246 7.12839 13.2246 7.50612C13.2246 7.76811 13.1415 7.94147 12.9377 8.15218C12.7334 8.34524 12.7053 8.65131 12.8901 8.84536C13.0595 9.07976 13.1352 9.25141 13.1352 9.47018C13.1352 9.73072 13.007 9.95486 12.7653 10.139C12.5131 10.3172 12.4299 10.6154 12.5712 10.9049C12.7031 11.1466 12.77 11.2853 12.77 11.4877C12.77 11.7944 12.5751 12.0361 12.1869 12.2381C11.9475 12.3752 11.8772 12.6425 11.9851 12.8802C12.1062 13.1749 12.1242 13.2435 12.1225 13.3864C12.1225 13.6664 11.9184 13.8921 11.4792 14.0019C11.0907 14.1006 10.4594 14.1416 9.60644 14.1399L8.82296 14.1382C6.03316 14.1313 4.16181 12.5581 4.16181 10.3188ZM1.21733 10.371C1.21733 8.67034 2.08408 7.32534 3.09216 7.26898C3.26992 7.26556 3.44573 7.26386 3.62349 7.26215C3.13079 8.20088 2.91716 9.15693 2.91716 10.3266C2.91716 11.5559 3.35395 12.646 4.14963 13.4907C3.90227 13.4907 3.64466 13.489 3.39046 13.4872C2.20833 13.4275 1.21733 12.0649 1.21733 10.371Z"/></g></svg></span>';
|
192 |
+
const dislikeIcon= '<span><svg viewBox="0 0 14.4675 15.5664" height="11px" width="11px" xmlns="http://www.w3.org/2000/svg"><g fill="currentColor"><path d="M14.4675 5.19535C14.4675 2.82169 12.9488 0.890613 10.9814 0.890613L8.7988 0.890613C7.90771 0.443351 6.85109 0.188955 5.70046 0.188955L4.76908 0.188955C3.88948 0.188955 3.15391 0.238755 2.6715 0.363751C1.6972 0.602507 1.07444 1.30459 1.07444 2.17147C1.07444 2.33189 1.09984 2.47228 1.14501 2.61267C0.683343 2.97251 0.423822 3.49007 0.423822 4.06671C0.423822 4.33551 0.47778 4.60089 0.574954 4.81574C0.265139 5.13456 0.0859375 5.60282 0.0859375 6.09792C0.0859375 6.42336 0.168459 6.75295 0.302984 6.99562C0.11304 7.2788 0 7.66624 0 8.0859C0 9.14516 0.807327 9.96493 1.8595 9.96493L4.30164 9.96493C4.46695 9.96493 4.57561 10.0411 4.56707 10.1893C4.51754 10.8717 3.46404 12.5036 3.46404 13.8449C3.46404 14.8428 4.16442 15.5664 5.12845 15.5664C5.83128 15.5664 6.31634 15.1963 6.76895 14.327C7.60878 12.701 8.5882 11.3708 10.0695 9.525L11.2353 9.525C13.0794 9.525 14.4675 7.6137 14.4675 5.19535ZM10.3057 5.24758C10.3057 6.65726 9.98855 7.55277 9.09036 8.76394C8.07817 10.114 6.68196 11.737 5.67709 13.7448C5.47418 14.1453 5.33671 14.2483 5.12697 14.2483C4.87376 14.2483 4.70528 14.0622 4.70528 13.7509C4.70528 12.786 5.82539 11.1359 5.82539 10.0527C5.82539 9.2461 5.187 8.72369 4.29816 8.72369L1.90049 8.72369C1.52497 8.72369 1.24124 8.43801 1.24124 8.06028C1.24124 7.79829 1.32426 7.62493 1.52984 7.41422C1.7361 7.22116 1.76051 6.91509 1.5811 6.72104C1.41166 6.48664 1.3323 6.31499 1.3323 6.09622C1.3323 5.83398 1.46049 5.61154 1.70587 5.42744C1.95436 5.24925 2.03956 4.95098 1.89627 4.66148C1.76271 4.41976 1.69581 4.28108 1.69581 4.07866C1.69581 3.77199 1.89065 3.53027 2.28058 3.32835C2.52003 3.19117 2.59033 2.92392 2.4861 2.68447C2.35962 2.39146 2.34155 2.32115 2.34497 2.17831C2.34497 1.89995 2.54909 1.67434 2.99028 1.56447C3.38042 1.46584 4.01005 1.42116 4.85936 1.42653L5.64284 1.42824C8.43435 1.4424 10.3057 3.00833 10.3057 5.24758ZM13.2502 5.19535C13.2502 6.89606 12.3834 8.24106 11.3736 8.29742C11.2013 8.30084 11.0218 8.30254 10.844 8.30425C11.3367 7.36552 11.5486 6.40947 11.5486 5.23978C11.5486 4.01052 11.1136 2.92044 10.3162 2.07574C10.5689 2.07574 10.8228 2.07745 11.077 2.07915C12.2575 2.13893 13.2502 3.50151 13.2502 5.19535Z"/></g></svg></span>'
|
web_assets/javascript/updater.js
CHANGED
@@ -60,6 +60,7 @@ async function updateLatestVersion() {
|
|
60 |
|
61 |
const versionTime = document.getElementById('version-time').innerText;
|
62 |
const localVersionTime = versionTime !== "unknown" ? (new Date(versionTime)).getTime() : 0;
|
|
|
63 |
updateInfoGotten = true; //无论成功与否都只执行一次,否则容易api超限...
|
64 |
try {
|
65 |
const data = await getLatestRelease();
|
@@ -75,7 +76,9 @@ async function updateLatestVersion() {
|
|
75 |
latestVersionElement.textContent = latestVersion;
|
76 |
console.log(`New version ${latestVersion} found!`);
|
77 |
if (!isInIframe) openUpdateToast();
|
|
|
78 |
}
|
|
|
79 |
} else { //如果当前版本号获取失败,使用时间比较
|
80 |
const latestVersionTime = (new Date(data.created_at)).getTime();
|
81 |
if (latestVersionTime) {
|
@@ -88,6 +91,7 @@ async function updateLatestVersion() {
|
|
88 |
disableUpdateBtn_enableCancelBtn();
|
89 |
localStorage.setItem('isLatestVersion', 'false');
|
90 |
isLatestVersion = false;
|
|
|
91 |
} else if (localVersionTime < latestVersionTime) {
|
92 |
const infoMessage = `Local version check failed, it seems to be a local rivision. \n\nBut latest revision is ${latestVersionInfo}. Try ${manualUpdateInfo}.`
|
93 |
versionInfoElement.innerHTML = marked.parse(infoMessage, {mangle: false, headerIds: false});
|
@@ -96,15 +100,19 @@ async function updateLatestVersion() {
|
|
96 |
// if (!isInIframe) openUpdateToast();
|
97 |
localStorage.setItem('isLatestVersion', 'false');
|
98 |
isLatestVersion = false;
|
|
|
99 |
} else {
|
100 |
noUpdate("Local version check failed, it seems to be a local rivision. <br>But your revision is newer than the latest release.");
|
|
|
101 |
}
|
102 |
}
|
103 |
}
|
104 |
currentTime = new Date().getTime();
|
105 |
localStorage.setItem('lastCheckTime', currentTime);
|
|
|
106 |
} catch (error) {
|
107 |
console.error(error);
|
|
|
108 |
}
|
109 |
}
|
110 |
|
@@ -135,14 +143,16 @@ function cancelUpdate() {
|
|
135 |
}
|
136 |
function openUpdateToast() {
|
137 |
showingUpdateInfo = true;
|
138 |
-
|
|
|
139 |
}
|
140 |
function closeUpdateToast() {
|
141 |
-
updateToast.style.setProperty('top', '-
|
142 |
showingUpdateInfo = false;
|
143 |
if (updatingInfoElement.classList.contains('hideK') === false) {
|
144 |
updatingInfoElement.classList.add('hideK');
|
145 |
}
|
|
|
146 |
}
|
147 |
function manualCheckUpdate() {
|
148 |
openUpdateToast();
|
@@ -197,10 +207,10 @@ function disableUpdateBtn_enableCancelBtn() {
|
|
197 |
document.querySelector('#cancel-button.btn-update').disabled = false;
|
198 |
}
|
199 |
|
200 |
-
function setUpdateWindowHeight() {
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
}
|
|
|
60 |
|
61 |
const versionTime = document.getElementById('version-time').innerText;
|
62 |
const localVersionTime = versionTime !== "unknown" ? (new Date(versionTime)).getTime() : 0;
|
63 |
+
disableUpdateBtns();
|
64 |
updateInfoGotten = true; //无论成功与否都只执行一次,否则容易api超限...
|
65 |
try {
|
66 |
const data = await getLatestRelease();
|
|
|
76 |
latestVersionElement.textContent = latestVersion;
|
77 |
console.log(`New version ${latestVersion} found!`);
|
78 |
if (!isInIframe) openUpdateToast();
|
79 |
+
gradioApp().classList.add('is-outdated');
|
80 |
}
|
81 |
+
enableUpdateBtns();
|
82 |
} else { //如果当前版本号获取失败,使用时间比较
|
83 |
const latestVersionTime = (new Date(data.created_at)).getTime();
|
84 |
if (latestVersionTime) {
|
|
|
91 |
disableUpdateBtn_enableCancelBtn();
|
92 |
localStorage.setItem('isLatestVersion', 'false');
|
93 |
isLatestVersion = false;
|
94 |
+
gradioApp().classList.add('is-outdated');
|
95 |
} else if (localVersionTime < latestVersionTime) {
|
96 |
const infoMessage = `Local version check failed, it seems to be a local rivision. \n\nBut latest revision is ${latestVersionInfo}. Try ${manualUpdateInfo}.`
|
97 |
versionInfoElement.innerHTML = marked.parse(infoMessage, {mangle: false, headerIds: false});
|
|
|
100 |
// if (!isInIframe) openUpdateToast();
|
101 |
localStorage.setItem('isLatestVersion', 'false');
|
102 |
isLatestVersion = false;
|
103 |
+
gradioApp().classList.add('is-outdated');
|
104 |
} else {
|
105 |
noUpdate("Local version check failed, it seems to be a local rivision. <br>But your revision is newer than the latest release.");
|
106 |
+
gradioApp().classList.add('is-outdated');
|
107 |
}
|
108 |
}
|
109 |
}
|
110 |
currentTime = new Date().getTime();
|
111 |
localStorage.setItem('lastCheckTime', currentTime);
|
112 |
+
disableUpdateBtn_enableCancelBtn()
|
113 |
} catch (error) {
|
114 |
console.error(error);
|
115 |
+
disableUpdateBtn_enableCancelBtn()
|
116 |
}
|
117 |
}
|
118 |
|
|
|
143 |
}
|
144 |
function openUpdateToast() {
|
145 |
showingUpdateInfo = true;
|
146 |
+
updateToast.style.setProperty('top', '0px');
|
147 |
+
showMask("update-toast");
|
148 |
}
|
149 |
function closeUpdateToast() {
|
150 |
+
updateToast.style.setProperty('top', '-600px');
|
151 |
showingUpdateInfo = false;
|
152 |
if (updatingInfoElement.classList.contains('hideK') === false) {
|
153 |
updatingInfoElement.classList.add('hideK');
|
154 |
}
|
155 |
+
document.querySelector('.chuanhu-mask')?.remove();
|
156 |
}
|
157 |
function manualCheckUpdate() {
|
158 |
openUpdateToast();
|
|
|
207 |
document.querySelector('#cancel-button.btn-update').disabled = false;
|
208 |
}
|
209 |
|
210 |
+
// function setUpdateWindowHeight() {
|
211 |
+
// if (!showingUpdateInfo) {return;}
|
212 |
+
// const scrollPosition = window.scrollY;
|
213 |
+
// // const originalTop = updateToast.style.getPropertyValue('top');
|
214 |
+
// const resultTop = scrollPosition - 20 + 'px';
|
215 |
+
// updateToast.style.setProperty('top', resultTop);
|
216 |
+
// }
|
web_assets/javascript/user-info.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
|
2 |
-
var userLogged = false;
|
3 |
var usernameGotten = false;
|
|
|
4 |
var username = null;
|
5 |
|
6 |
|
@@ -8,27 +9,28 @@ function getUserInfo() {
|
|
8 |
if (usernameGotten) {
|
9 |
return;
|
10 |
}
|
11 |
-
userLogged = localStorage.getItem('userLogged');
|
12 |
-
if (userLogged) {
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
}
|
31 |
}
|
|
|
32 |
}
|
33 |
|
34 |
function showOrHideUserInfo() {
|
@@ -47,7 +49,8 @@ function showOrHideUserInfo() {
|
|
47 |
toggleUserInfoVisibility(true);
|
48 |
}, 2000);
|
49 |
|
50 |
-
let triggerElements = {appTitleDiv, userInfoDiv, sendBtn};
|
|
|
51 |
for (let elem in triggerElements) {
|
52 |
triggerElements[elem].addEventListener("mouseenter", function () {
|
53 |
toggleUserInfoVisibility(false);
|
|
|
1 |
|
2 |
+
// var userLogged = false;
|
3 |
var usernameGotten = false;
|
4 |
+
var usernameTmp = null;
|
5 |
var username = null;
|
6 |
|
7 |
|
|
|
9 |
if (usernameGotten) {
|
10 |
return;
|
11 |
}
|
12 |
+
// userLogged = localStorage.getItem('userLogged');
|
13 |
+
// if (userLogged) {
|
14 |
+
usernameTmp = userInfoDiv.innerText;
|
15 |
+
if (usernameTmp) {
|
16 |
+
if (usernameTmp.includes("getting user info")) {
|
17 |
+
setTimeout(getUserInfo, 500);
|
18 |
+
return;
|
19 |
+
} else if (usernameTmp === " ") {
|
20 |
+
localStorage.removeItem("username");
|
21 |
+
// localStorage.removeItem("userLogged")
|
22 |
+
// userLogged = false;
|
23 |
+
usernameGotten = true;
|
24 |
+
return;
|
25 |
+
} else {
|
26 |
+
usernameTmp = usernameTmp.match(/User:\s*(.*)/)[1] || usernameTmp;
|
27 |
+
localStorage.setItem("username", usernameTmp);
|
28 |
+
username = usernameTmp;
|
29 |
+
usernameGotten = true;
|
30 |
+
clearHistoryHtml();
|
31 |
}
|
32 |
}
|
33 |
+
// }
|
34 |
}
|
35 |
|
36 |
function showOrHideUserInfo() {
|
|
|
49 |
toggleUserInfoVisibility(true);
|
50 |
}, 2000);
|
51 |
|
52 |
+
// let triggerElements = {appTitleDiv, userInfoDiv, sendBtn};
|
53 |
+
let triggerElements = {userInfoDiv, statusDisplay};
|
54 |
for (let elem in triggerElements) {
|
55 |
triggerElements[elem].addEventListener("mouseenter", function () {
|
56 |
toggleUserInfoVisibility(false);
|
web_assets/javascript/utils.js
CHANGED
@@ -1,25 +1,4 @@
|
|
1 |
|
2 |
-
var gradioUploader = null;
|
3 |
-
|
4 |
-
function testUpload(target) {
|
5 |
-
gradioUploader = gradioApp().querySelector("#upload-index-file > .center.flex");
|
6 |
-
let uploaderEvents = ["click", "drag", "dragend", "dragenter", "dragleave", "dragover", "dragstart", "drop"];
|
7 |
-
transEventListeners(target, gradioUploader, uploaderEvents);
|
8 |
-
}
|
9 |
-
|
10 |
-
|
11 |
-
function transEventListeners(target, source, events) {
|
12 |
-
events.forEach((sourceEvent) => {
|
13 |
-
target.addEventListener(sourceEvent, function (targetEvent) {
|
14 |
-
if(targetEvent.preventDefault) targetEvent.preventDefault();
|
15 |
-
if(targetEvent.stopPropagation) targetEvent.stopPropagation();
|
16 |
-
|
17 |
-
source.dispatchEvent(new Event(sourceEvent, {detail: targetEvent.detail}));
|
18 |
-
console.log(targetEvent.detail);
|
19 |
-
});
|
20 |
-
});
|
21 |
-
}
|
22 |
-
|
23 |
|
24 |
function isImgUrl(url) {
|
25 |
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp)$/i;
|
@@ -36,6 +15,62 @@ function isImgUrl(url) {
|
|
36 |
return false;
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
/* NOTE: These reload functions are not used in the current version of the code.
|
41 |
* From stable-diffusion-webui
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
function isImgUrl(url) {
|
4 |
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp)$/i;
|
|
|
15 |
return false;
|
16 |
}
|
17 |
|
18 |
+
function downloadHistory(gradioUsername, historyname, format=".json") {
|
19 |
+
let fileUrl;
|
20 |
+
if (gradioUsername === null || gradioUsername.trim() === "") {
|
21 |
+
fileUrl = `/file=./history/${historyname}`;
|
22 |
+
} else {
|
23 |
+
fileUrl = `/file=./history/${gradioUsername}/${historyname}`;
|
24 |
+
}
|
25 |
+
downloadFile(fileUrl, historyname, format);
|
26 |
+
}
|
27 |
+
|
28 |
+
function downloadFile(fileUrl, filename = "", format = "", retryTimeout = 200, maxAttempts = 10) {
|
29 |
+
|
30 |
+
fileUrl = fileUrl + format;
|
31 |
+
filename = filename + format;
|
32 |
+
|
33 |
+
let attempts = 0;
|
34 |
+
|
35 |
+
async function tryDownload() {
|
36 |
+
if (attempts >= maxAttempts) {
|
37 |
+
console.error('Max attempts reached, download failed.');
|
38 |
+
alert('Download failed:' + filename);
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
try {
|
42 |
+
const response = await fetch(fileUrl);
|
43 |
+
if (!response.ok) {
|
44 |
+
attempts++;
|
45 |
+
console.error("Error fetching file, retrying...");
|
46 |
+
setTimeout(tryDownload, retryTimeout);
|
47 |
+
} else {
|
48 |
+
response.blob()
|
49 |
+
.then(blob => {
|
50 |
+
const url = URL.createObjectURL(blob);
|
51 |
+
const a = document.createElement('a');
|
52 |
+
a.style.display = 'none';
|
53 |
+
a.href = url;
|
54 |
+
a.download = filename;
|
55 |
+
document.body.appendChild(a);
|
56 |
+
a.click();
|
57 |
+
URL.revokeObjectURL(url);
|
58 |
+
document.body.removeChild(a);
|
59 |
+
})
|
60 |
+
.catch(error => {
|
61 |
+
console.error('Error downloading file:', error);
|
62 |
+
});
|
63 |
+
}
|
64 |
+
} catch (error) {
|
65 |
+
attempts++;
|
66 |
+
setTimeout(tryDownload, retryTimeout);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
tryDownload();
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
|
75 |
/* NOTE: These reload functions are not used in the current version of the code.
|
76 |
* From stable-diffusion-webui
|
web_assets/javascript/webui.js
ADDED
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
function openSettingBox() {
|
3 |
+
chuanhuPopup.classList.add('showBox');
|
4 |
+
popupWrapper.classList.add('showBox');
|
5 |
+
settingBox.classList.remove('hideBox');
|
6 |
+
trainingBox.classList.add('hideBox');
|
7 |
+
showMask("box");
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
+
function openTrainingBox() {
|
12 |
+
chuanhuPopup.classList.add('showBox');
|
13 |
+
popupWrapper.classList.add('showBox');
|
14 |
+
trainingBox.classList.remove('hideBox');
|
15 |
+
settingBox.classList.add('hideBox');
|
16 |
+
showMask("box");
|
17 |
+
}
|
18 |
+
|
19 |
+
function openChatMore() {
|
20 |
+
chatbotArea.classList.add('show-chat-more');
|
21 |
+
showMask("chat-more");
|
22 |
+
}
|
23 |
+
|
24 |
+
function closeChatMore() {
|
25 |
+
chatbotArea.classList.remove('show-chat-more');
|
26 |
+
chatbotArea.querySelector('.chuanhu-mask')?.remove();
|
27 |
+
}
|
28 |
+
|
29 |
+
|
30 |
+
function showMask(obj) {
|
31 |
+
const mask = document.createElement('div');
|
32 |
+
mask.classList.add('chuanhu-mask');
|
33 |
+
if (obj == "box") {
|
34 |
+
mask.classList.add('mask-blur');
|
35 |
+
document.body.classList.add('popup-open');
|
36 |
+
popupWrapper.appendChild(mask);
|
37 |
+
} else if (obj == "chat-more") {
|
38 |
+
mask.classList.add('transparent-mask');
|
39 |
+
chatbotArea.querySelector('#chatbot-input-more-area').parentNode.appendChild(mask);
|
40 |
+
} else if (obj == "update-toast") {
|
41 |
+
mask.classList.add('chuanhu-top-mask');
|
42 |
+
document.body.appendChild(mask);
|
43 |
+
// mask.classList.add('transparent-mask');
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
mask.addEventListener('click', () => {
|
49 |
+
if (obj == "box") {
|
50 |
+
closeBox();
|
51 |
+
} else if (obj == "chat-more") {
|
52 |
+
closeChatMore();
|
53 |
+
} else if (obj == "update-toast") {
|
54 |
+
closeUpdateToast();
|
55 |
+
}
|
56 |
+
});
|
57 |
+
}
|
58 |
+
|
59 |
+
function chatMoreBtnClick() {
|
60 |
+
if (chatbotArea.classList.contains('show-chat-more')) {
|
61 |
+
closeChatMore();
|
62 |
+
} else {
|
63 |
+
openChatMore();
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
function closeBtnClick(obj) {
|
68 |
+
if (obj == "box") {
|
69 |
+
closeBox();
|
70 |
+
} else if (obj == "toolbox") {
|
71 |
+
closeSide(toolbox);
|
72 |
+
wantOpenToolbox = false;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
function closeBox() {
|
77 |
+
chuanhuPopup.classList.remove('showBox');
|
78 |
+
popupWrapper.classList.remove('showBox');
|
79 |
+
trainingBox.classList.add('hideBox');
|
80 |
+
settingBox.classList.add('hideBox');
|
81 |
+
document.querySelector('.chuanhu-mask')?.remove();
|
82 |
+
document.body.classList.remove('popup-open');
|
83 |
+
}
|
84 |
+
|
85 |
+
function closeSide(sideArea) {
|
86 |
+
document.body.classList.remove('popup-open');
|
87 |
+
sideArea.classList.remove('showSide');
|
88 |
+
if (sideArea == toolbox) {
|
89 |
+
chuanhuHeader.classList.remove('under-box');
|
90 |
+
chatbotArea.classList.remove('toolbox-open')
|
91 |
+
toolboxOpening = false;
|
92 |
+
} else if (sideArea == menu) {
|
93 |
+
chatbotArea.classList.remove('menu-open')
|
94 |
+
menuOpening = false;
|
95 |
+
}
|
96 |
+
adjustMask();
|
97 |
+
}
|
98 |
+
|
99 |
+
function openSide(sideArea) {
|
100 |
+
sideArea.classList.add('showSide');
|
101 |
+
if (sideArea == toolbox) {
|
102 |
+
chuanhuHeader.classList.add('under-box');
|
103 |
+
chatbotArea.classList.add('toolbox-open')
|
104 |
+
toolboxOpening = true;
|
105 |
+
} else if (sideArea == menu) {
|
106 |
+
chatbotArea.classList.add('menu-open')
|
107 |
+
menuOpening = true;
|
108 |
+
}
|
109 |
+
// document.body.classList.add('popup-open');
|
110 |
+
}
|
111 |
+
|
112 |
+
function menuClick() {
|
113 |
+
shouldAutoClose = false;
|
114 |
+
if (menuOpening) {
|
115 |
+
closeSide(menu);
|
116 |
+
wantOpenMenu = false;
|
117 |
+
} else {
|
118 |
+
if (windowWidth < 1024 && toolboxOpening) {
|
119 |
+
closeSide(toolbox);
|
120 |
+
wantOpenToolbox = false;
|
121 |
+
}
|
122 |
+
openSide(menu);
|
123 |
+
wantOpenMenu = true;
|
124 |
+
}
|
125 |
+
adjustSide();
|
126 |
+
}
|
127 |
+
|
128 |
+
function toolboxClick() {
|
129 |
+
shouldAutoClose = false;
|
130 |
+
if (toolboxOpening) {
|
131 |
+
closeSide(toolbox);
|
132 |
+
wantOpenToolbox = false;
|
133 |
+
} else {
|
134 |
+
if (windowWidth < 1024 && menuOpening) {
|
135 |
+
closeSide(menu);
|
136 |
+
wantOpenMenu = false;
|
137 |
+
}
|
138 |
+
openSide(toolbox);
|
139 |
+
wantOpenToolbox = true;
|
140 |
+
}
|
141 |
+
adjustSide();
|
142 |
+
}
|
143 |
+
|
144 |
+
var menuOpening = false;
|
145 |
+
var toolboxOpening = false;
|
146 |
+
var shouldAutoClose = true;
|
147 |
+
var wantOpenMenu = windowWidth > 768;
|
148 |
+
var wantOpenToolbox = windowWidth >= 1024;
|
149 |
+
|
150 |
+
function adjustSide() {
|
151 |
+
if (windowWidth >= 1024) {
|
152 |
+
shouldAutoClose = true;
|
153 |
+
if (wantOpenMenu) {
|
154 |
+
openSide(menu);
|
155 |
+
if (wantOpenToolbox) openSide(toolbox);
|
156 |
+
} else if (wantOpenToolbox) {
|
157 |
+
openSide(toolbox);
|
158 |
+
} else {
|
159 |
+
closeSide(menu);
|
160 |
+
closeSide(toolbox);
|
161 |
+
}
|
162 |
+
} else if (windowWidth > 768 && windowWidth < 1024 ) {
|
163 |
+
shouldAutoClose = true;
|
164 |
+
if (wantOpenToolbox) {
|
165 |
+
if (wantOpenMenu) {
|
166 |
+
closeSide(toolbox);
|
167 |
+
openSide(menu);
|
168 |
+
} else {
|
169 |
+
closeSide(menu);
|
170 |
+
openSide(toolbox);
|
171 |
+
}
|
172 |
+
} else if (wantOpenMenu) {
|
173 |
+
if (wantOpenToolbox) {
|
174 |
+
closeSide(menu);
|
175 |
+
openSide(toolbox);
|
176 |
+
} else {
|
177 |
+
closeSide(toolbox);
|
178 |
+
openSide(menu);
|
179 |
+
}
|
180 |
+
} else if (!wantOpenMenu && !wantOpenToolbox){
|
181 |
+
closeSide(menu);
|
182 |
+
closeSide(toolbox);
|
183 |
+
}
|
184 |
+
} else { // windowWidth <= 768
|
185 |
+
if (shouldAutoClose) {
|
186 |
+
closeSide(menu);
|
187 |
+
// closeSide(toolbox);
|
188 |
+
}
|
189 |
+
}
|
190 |
+
checkChatbotWidth();
|
191 |
+
adjustMask();
|
192 |
+
}
|
193 |
+
|
194 |
+
function adjustMask() {
|
195 |
+
var sideMask = null;
|
196 |
+
if (!gradioApp().querySelector('.chuanhu-side-mask')) {
|
197 |
+
sideMask = document.createElement('div');
|
198 |
+
sideMask.classList.add('chuanhu-side-mask');
|
199 |
+
gradioApp().appendChild(sideMask);
|
200 |
+
sideMask.addEventListener('click', () => {
|
201 |
+
closeSide(menu);
|
202 |
+
closeSide(toolbox);
|
203 |
+
});
|
204 |
+
}
|
205 |
+
sideMask = gradioApp().querySelector('.chuanhu-side-mask');
|
206 |
+
|
207 |
+
if (windowWidth > 768) {
|
208 |
+
sideMask.style.backgroundColor = 'rgba(0, 0, 0, 0)';
|
209 |
+
setTimeout(() => {sideMask.style.display = 'none'; }, 100);
|
210 |
+
return;
|
211 |
+
}
|
212 |
+
// if (windowWidth <= 768)
|
213 |
+
if (menuOpening || toolboxOpening) {
|
214 |
+
document.body.classList.add('popup-open');
|
215 |
+
sideMask.style.display = 'block';
|
216 |
+
setTimeout(() => {sideMask.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';}, 200);
|
217 |
+
sideMask.classList.add('mask-blur');
|
218 |
+
} else if (!menuOpening && !toolboxOpening) {
|
219 |
+
sideMask.style.backgroundColor = 'rgba(0, 0, 0, 0)';
|
220 |
+
setTimeout(() => {sideMask.style.display = 'none'; }, 100);
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
function checkChatbotWidth() {
|
225 |
+
// let chatbotWidth = chatbotArea.clientWidth;
|
226 |
+
// if (chatbotWidth > 488) {
|
227 |
+
if (windowWidth > 768) {
|
228 |
+
chatbotArea.classList.add('chatbot-full-width');
|
229 |
+
} else {
|
230 |
+
chatbotArea.classList.remove('chatbot-full-width');
|
231 |
+
}
|
232 |
+
|
233 |
+
if (windowWidth > 768) {
|
234 |
+
chatbotArea.classList.remove('no-toolbox');
|
235 |
+
chatbotArea.classList.remove('no-menu');
|
236 |
+
|
237 |
+
if (!chatbotArea.classList.contains('toolbox-open') && chatbotArea.classList.contains('menu-open')) {
|
238 |
+
chatbotArea.classList.add('no-toolbox');
|
239 |
+
} else if (!chatbotArea.classList.contains('menu-open') && chatbotArea.classList.contains('toolbox-open')) {
|
240 |
+
chatbotArea.classList.add('no-menu');
|
241 |
+
} else if (!chatbotArea.classList.contains('menu-open') && !chatbotArea.classList.contains('toolbox-open')) {
|
242 |
+
chatbotArea.classList.add('no-toolbox');
|
243 |
+
chatbotArea.classList.add('no-menu');
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
checkChatMoreMask();
|
248 |
+
}
|
249 |
+
|
250 |
+
function checkChatMoreMask() {
|
251 |
+
if (!chatbotArea.classList.contains('chatbot-full-width')) {
|
252 |
+
chatbotArea.querySelector('.chuanhu-mask')?.remove();
|
253 |
+
chatbotArea.classList.remove('show-chat-more');
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
/*
|
258 |
+
function setHistroyPanel() {
|
259 |
+
const historySelectorInput = gradioApp().querySelector('#history-select-dropdown input');
|
260 |
+
const historyPanel = document.createElement('div');
|
261 |
+
historyPanel.classList.add('chuanhu-history-panel');
|
262 |
+
historySelector.parentNode.insertBefore(historyPanel, historySelector);
|
263 |
+
var historyList=null;
|
264 |
+
|
265 |
+
historySelectorInput.addEventListener('click', (e) => {
|
266 |
+
e.stopPropagation();
|
267 |
+
historyList = gradioApp().querySelector('#history-select-dropdown ul.options');
|
268 |
+
|
269 |
+
if (historyList) {
|
270 |
+
// gradioApp().querySelector('.chuanhu-history-panel')?.remove();
|
271 |
+
historyPanel.innerHTML = '';
|
272 |
+
let historyListClone = historyList.cloneNode(true);
|
273 |
+
historyListClone.removeAttribute('style');
|
274 |
+
// historyList.classList.add('hidden');
|
275 |
+
historyList.classList.add('hideK');
|
276 |
+
historyPanel.appendChild(historyListClone);
|
277 |
+
addHistoryPanelListener(historyPanel);
|
278 |
+
// historySelector.parentNode.insertBefore(historyPanel, historySelector);
|
279 |
+
}
|
280 |
+
});
|
281 |
+
}
|
282 |
+
*/
|
283 |
+
|
284 |
+
// function addHistoryPanelListener(historyPanel){
|
285 |
+
// historyPanel.querySelectorAll('ul.options > li').forEach((historyItem) => {
|
286 |
+
// historyItem.addEventListener('click', (e) => {
|
287 |
+
// const historySelectorInput = gradioApp().querySelector('#history-select-dropdown input');
|
288 |
+
// const historySelectBtn = gradioApp().querySelector('#history-select-btn');
|
289 |
+
// historySelectorInput.value = historyItem.innerText;
|
290 |
+
// historySelectBtn.click();
|
291 |
+
// });
|
292 |
+
// });
|
293 |
+
// }
|
294 |
+
|
295 |
+
|
296 |
+
// function testTrain() {
|
297 |
+
|
298 |
+
// trainBody.classList.toggle('hide-body');
|
299 |
+
// trainingBox.classList.remove('hideBox');
|
300 |
+
|
301 |
+
// var chuanhuBody = document.querySelector('#chuanhu-body');
|
302 |
+
// chuanhuBody.classList.toggle('hide-body');
|
303 |
+
// }
|
web_assets/manifest.json
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "川虎Chat",
|
3 |
+
"short_name": "川虎Chat",
|
4 |
+
"description": "川虎Chat - 为ChatGPT等多种LLM提供了一个轻快好用的Web图形界面和众多附加功能 \nChuanhu Chat - Lightweight and User-friendly Web-UI for LLMs including ChatGPT/ChatGLM/LLaMA ",
|
5 |
+
"display": "standalone",
|
6 |
+
"scope": "/",
|
7 |
+
"start_url": "/",
|
8 |
+
"icons": [
|
9 |
+
{
|
10 |
+
"src": "/file=web_assets/icon/mask-icon-512.png",
|
11 |
+
"type": "image/png",
|
12 |
+
"sizes": "512x512",
|
13 |
+
"purpose": "maskable"
|
14 |
+
},
|
15 |
+
{
|
16 |
+
"src": "/file=web_assets/icon/any-icon-512.png",
|
17 |
+
"type": "image/png",
|
18 |
+
"sizes": "512x512",
|
19 |
+
"purpose": "any"
|
20 |
+
}
|
21 |
+
]
|
22 |
+
}
|
web_assets/stylesheet/ChuanhuChat.css
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
:root {
|
|
|
|
|
2 |
--chatbot-color-light: #000000;
|
3 |
--chatbot-color-dark: #FFFFFF;
|
4 |
--chatbot-background-color-light: #F3F3F3;
|
@@ -9,6 +11,39 @@
|
|
9 |
--message-bot-background-color-dark: #2C2C2C;
|
10 |
--switch-checkbox-color-light: #e5e7eb;
|
11 |
--switch-checkbox-color-dark: #515151;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
|
14 |
.hideK {
|
@@ -20,16 +55,26 @@
|
|
20 |
font-size: var(--text-xxl);
|
21 |
line-height: 1.3;
|
22 |
text-align: left;
|
23 |
-
margin-top:
|
24 |
white-space: nowrap;
|
|
|
|
|
|
|
25 |
}
|
26 |
#description {
|
27 |
text-align: center;
|
28 |
-
margin: 32px 0 4px 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
/* 高级页面 */
|
32 |
#advanced-warning {
|
|
|
33 |
display: flex;
|
34 |
flex-wrap: wrap;
|
35 |
flex-direction: column;
|
@@ -92,17 +137,29 @@
|
|
92 |
color: var(--body-text-color-subdued);
|
93 |
}
|
94 |
|
95 |
-
|
|
|
|
|
|
|
96 |
#submit-btn, #cancel-btn {
|
97 |
-
height:
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
#submit-btn::before {
|
100 |
-
content: url("data:image/svg+xml, %3Csvg width='21px' height='
|
101 |
height: 21px;
|
|
|
|
|
|
|
102 |
}
|
103 |
#cancel-btn::before {
|
104 |
-
content: url("data:image/svg+xml,%3Csvg
|
105 |
-
height:
|
|
|
106 |
}
|
107 |
|
108 |
#chatbot-buttons button {
|
@@ -110,4 +167,1000 @@
|
|
110 |
overflow: hidden;
|
111 |
text-overflow: ellipsis;
|
112 |
white-space: nowrap;
|
113 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
:root {
|
2 |
+
--vh: 1vh;
|
3 |
+
|
4 |
--chatbot-color-light: #000000;
|
5 |
--chatbot-color-dark: #FFFFFF;
|
6 |
--chatbot-background-color-light: #F3F3F3;
|
|
|
11 |
--message-bot-background-color-dark: #2C2C2C;
|
12 |
--switch-checkbox-color-light: #e5e7eb;
|
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: #FFFFFFAA;
|
18 |
+
--chatbot-input-more-background-solid-color: #FFFFFF;
|
19 |
+
--chatbot-input-more-background-fullwidth-hover: #FFFFFF99;
|
20 |
+
--chatbot-input-more-background-mobilewidth-hover: #E6E6E644;
|
21 |
+
|
22 |
+
--message-list-background-hover: #F3F3F3;
|
23 |
+
--message-list-background-selected: #EAEAEA;
|
24 |
+
|
25 |
+
--menu-width: 320px;
|
26 |
+
--menu-background-fill: var(--background-fill-primary);
|
27 |
+
|
28 |
+
--toolbox-width: 280px;
|
29 |
+
--toolbox-background-fill: var(--background-fill-secondary);
|
30 |
+
|
31 |
+
.dark {
|
32 |
+
--chatbot-blur-background-color: #12111166;
|
33 |
+
--chatbot-input-background-color: rgba(144, 144, 144, 0.32);
|
34 |
+
--chatbot-input-more-background-color: #3C3C3CAA;
|
35 |
+
--chatbot-input-more-background-solid-color: #3C3C3C;
|
36 |
+
--chatbot-input-more-background-fullwidth-hover: #2F2F2F88;
|
37 |
+
--chatbot-input-more-background-mobilewidth-hover: #1F1F1F44;
|
38 |
+
|
39 |
+
--message-list-background-hover: #202020;
|
40 |
+
--message-list-background-selected: #2F3030;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
body.popup-open {
|
46 |
+
overflow: hidden;
|
47 |
}
|
48 |
|
49 |
.hideK {
|
|
|
55 |
font-size: var(--text-xxl);
|
56 |
line-height: 1.3;
|
57 |
text-align: left;
|
58 |
+
margin-top: 4px;
|
59 |
white-space: nowrap;
|
60 |
+
flex-direction: row;
|
61 |
+
display: inline-flex;
|
62 |
+
align-items: center;
|
63 |
}
|
64 |
#description {
|
65 |
text-align: center;
|
66 |
+
/* margin: 32px 0 4px 0; */
|
67 |
+
}
|
68 |
+
#about-tab {
|
69 |
+
text-align: center;
|
70 |
+
}
|
71 |
+
#about-tab img {
|
72 |
+
margin: 0 auto;
|
73 |
}
|
74 |
|
75 |
/* 高级页面 */
|
76 |
#advanced-warning {
|
77 |
+
margin-top: 0.5rem;
|
78 |
display: flex;
|
79 |
flex-wrap: wrap;
|
80 |
flex-direction: column;
|
|
|
137 |
color: var(--body-text-color-subdued);
|
138 |
}
|
139 |
|
140 |
+
#chatbot-ctrl-btns {
|
141 |
+
align-self: end;
|
142 |
+
max-width: 42px;
|
143 |
+
}
|
144 |
#submit-btn, #cancel-btn {
|
145 |
+
height: 42px !important;
|
146 |
+
width: 42px !important;
|
147 |
+
border-radius: 50%;
|
148 |
+
transform: scale(0.8);
|
149 |
+
justify-content: center;
|
150 |
+
align-items: center;
|
151 |
}
|
152 |
#submit-btn::before {
|
153 |
+
content: url("data:image/svg+xml, %3Csvg width='21px' height='21px' viewBox='0 0 21 20' version='1.1' xmlns='http://www.w3.org/2000/svg' %3E %3Cg id='page' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E %3Cg id='send' transform='translate(0.435849, 0.088463)' fill='%23FFFFFF' fill-rule='nonzero'%3E %3Cpath d='M0.579148261,0.0428666046 C0.301105539,-0.0961547561 -0.036517765,0.122307382 0.0032026237,0.420210298 L1.4927172,18.1553639 C1.5125774,18.4334066 1.79062012,18.5922882 2.04880264,18.4929872 L8.24518329,15.8913017 L11.6412765,19.7441794 C11.8597387,19.9825018 12.2370824,19.8832008 12.3165231,19.5852979 L13.9450591,13.4882182 L19.7839562,11.0255541 C20.0619989,10.8865327 20.0818591,10.4694687 19.7839562,10.3105871 L0.579148261,0.0428666046 Z M11.6138902,17.0883151 L9.85385903,14.7195502 L0.718169621,0.618812241 L12.69945,12.9346347 L11.6138902,17.0883151 Z' id='shape'%3E%3C/path%3E %3C/g%3E %3C/g%3E %3C/svg%3E");
|
154 |
height: 21px;
|
155 |
+
width: 21px;
|
156 |
+
position: relative;
|
157 |
+
left: 2px;
|
158 |
}
|
159 |
#cancel-btn::before {
|
160 |
+
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34px' height='34px' fill='%23ff453a' fill-opacity='0.85'%3E%3Cg%3E%3Cpath d='M16.8954 33.7909C26.1546 33.7909 33.8049 26.1546 33.8049 16.8954C33.8049 7.63629 26.1406 0 16.8814 0C7.63629 0 0 7.63629 0 16.8954C0 26.1546 7.65027 33.7909 16.8954 33.7909ZM16.8954 29.7737C9.76412 29.7737 4.04511 24.0407 4.04511 16.8954C4.04511 9.75014 9.75014 4.01713 16.8814 4.01713C24.0267 4.01713 29.7737 9.75014 29.7737 16.8954C29.7737 24.0407 24.0407 29.7737 16.8954 29.7737Z'/%3E%3Cpath d='M12.7957 22.7421L20.9747 22.7421C22.0532 22.7421 22.7346 22.1007 22.7346 21.0688L22.7346 12.709C22.7346 11.6771 22.0532 11.0358 20.9747 11.0358L12.7957 11.0358C11.7032 11.0358 11.0358 11.6771 11.0358 12.709L11.0358 21.0688C11.0358 22.1007 11.7032 22.7421 12.7957 22.7421Z'/%3E%3C/g%3E%3C/svg%3E");
|
161 |
+
height: 34px;
|
162 |
+
width: 34px;
|
163 |
}
|
164 |
|
165 |
#chatbot-buttons button {
|
|
|
167 |
overflow: hidden;
|
168 |
text-overflow: ellipsis;
|
169 |
white-space: nowrap;
|
170 |
+
}
|
171 |
+
|
172 |
+
/* masks */
|
173 |
+
.chuanhu-mask, .chuanhu-side-mask {
|
174 |
+
/* background-color: gray; */
|
175 |
+
background-color: rgba(0, 0, 0, 0.5);
|
176 |
+
transition: background-color 0.3s ease;
|
177 |
+
position: fixed;
|
178 |
+
top: 0;
|
179 |
+
left: 0;
|
180 |
+
width: 100%;
|
181 |
+
height: 100%;
|
182 |
+
z-index: 999;
|
183 |
+
/* background-color: transparent; */
|
184 |
+
}
|
185 |
+
/* .chuanhu-mask {
|
186 |
+
background-color: rgba(0, 0, 0, 0.5);
|
187 |
+
/* -webkit-backdrop-filter: blur(2px);
|
188 |
+
backdrop-filter: blur(2px);
|
189 |
+
} */
|
190 |
+
.mask-blur {
|
191 |
+
-webkit-backdrop-filter: blur(2px);
|
192 |
+
backdrop-filter: blur(2px);
|
193 |
+
}
|
194 |
+
.transparent-mask {
|
195 |
+
background-color: transparent !important;
|
196 |
+
}
|
197 |
+
|
198 |
+
.chuanhu-side-mask {
|
199 |
+
background-color: rgba(0, 0, 0, 0);
|
200 |
+
}
|
201 |
+
.chuanhu-top-mask {
|
202 |
+
/* background-color: rgba(0, 0, 0, 0.0); */
|
203 |
+
z-index: 10001;
|
204 |
+
}
|
205 |
+
|
206 |
+
|
207 |
+
#popup-wrapper {
|
208 |
+
display: none;
|
209 |
+
position: fixed;
|
210 |
+
overflow: auto;
|
211 |
+
top: 0;
|
212 |
+
left: 0;
|
213 |
+
z-index: 99999;
|
214 |
+
}
|
215 |
+
#popup-wrapper.showBox {
|
216 |
+
display: grid;
|
217 |
+
place-items: center;
|
218 |
+
}
|
219 |
+
|
220 |
+
#chuanhu-popup {
|
221 |
+
display: none;
|
222 |
+
z-index: 99999;
|
223 |
+
width: 680px;
|
224 |
+
height: 400px;
|
225 |
+
padding: 0;
|
226 |
+
}
|
227 |
+
#chuanhu-popup.showBox {
|
228 |
+
display: block;
|
229 |
+
box-shadow: 0 2px 64px 4px rgba(0, 0, 0, 0.2);
|
230 |
+
}
|
231 |
+
|
232 |
+
#chuanhu-popup > .gradio-box {
|
233 |
+
padding: 0;
|
234 |
+
}
|
235 |
+
.hideBox {
|
236 |
+
display: none;
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
+
#chuanhu-header {
|
241 |
+
position: fixed;
|
242 |
+
top: 0;
|
243 |
+
z-index: 1000;
|
244 |
+
left: 0;
|
245 |
+
right: 0;
|
246 |
+
/* padding: 6px 64px; */
|
247 |
+
height: 65px;
|
248 |
+
background: var(--background-fill-primary);
|
249 |
+
border-bottom: 1px solid var(--border-color-primary);
|
250 |
+
|
251 |
+
@media screen and (max-width: 639px) {
|
252 |
+
padding: 6px 16px;
|
253 |
+
padding-left: max(16px, env(safe-area-inset-left));
|
254 |
+
padding-right: max(16px, env(safe-area-inset-right));
|
255 |
+
}
|
256 |
+
@media screen and (min-width: 640px) {
|
257 |
+
padding: 6px 24px;
|
258 |
+
padding-left: max(24px, env(safe-area-inset-left));
|
259 |
+
padding-right: max(24px, env(safe-area-inset-right));
|
260 |
+
}
|
261 |
+
/* @media screen and (min-width: 1024px) {
|
262 |
+
padding: 6px 96px;
|
263 |
+
} */
|
264 |
+
}
|
265 |
+
#chuanhu-header.under-box {
|
266 |
+
z-index: 995 !important;
|
267 |
+
}
|
268 |
+
|
269 |
+
#chuanhu-body {
|
270 |
+
flex-wrap: nowrap;
|
271 |
+
gap: 0;
|
272 |
+
overflow: hidden;
|
273 |
+
display: inline-flex;
|
274 |
+
justify-content: space-between;
|
275 |
+
/* margin-top: 54px; */
|
276 |
+
/* height: calc(100*var(--vh) - 72px); */
|
277 |
+
position: absolute;
|
278 |
+
top: 65px;
|
279 |
+
height: calc(100*var(--vh) - 65px);
|
280 |
+
}
|
281 |
+
|
282 |
+
#chuanhu-area {
|
283 |
+
flex: unset;
|
284 |
+
width: 100%;
|
285 |
+
flex-wrap: nowrap;
|
286 |
+
justify-content: center;
|
287 |
+
overflow: hidden;
|
288 |
+
flex-direction: row;
|
289 |
+
/* padding-inline: 24px; */
|
290 |
+
/* margin: 16px; */
|
291 |
+
/* border-radius: 24px; */
|
292 |
+
background: var(--chatbot-background-color-light);
|
293 |
+
}
|
294 |
+
.dark #chuanhu-area {
|
295 |
+
background: var(--chatbot-background-color-dark);
|
296 |
+
}
|
297 |
+
#chatbot-header {
|
298 |
+
justify-content: space-between;
|
299 |
+
border-bottom: 0.5px solid var(--border-color-primary);
|
300 |
+
height: 60px;
|
301 |
+
padding-inline: 20px 16px;
|
302 |
+
gap: 0;
|
303 |
+
position: absolute;
|
304 |
+
top: 0;
|
305 |
+
right: 4px;
|
306 |
+
width: calc(100% - 4px);
|
307 |
+
z-index: 50;
|
308 |
+
background: var(--chatbot-blur-background-color);
|
309 |
+
backdrop-filter: blur(24px);
|
310 |
+
-webkit-backdrop-filter: blur(24px);
|
311 |
+
}
|
312 |
+
|
313 |
+
#chatbot-header .gradio-dropdown {
|
314 |
+
max-width: 14em;
|
315 |
+
background: none;
|
316 |
+
height: 60px;
|
317 |
+
overflow: unset !important;
|
318 |
+
}
|
319 |
+
#chatbot-header .gradio-dropdown > label {
|
320 |
+
display: flex;
|
321 |
+
}
|
322 |
+
#chatbot-header .gradio-dropdown ul.options {
|
323 |
+
top: 60px !important;
|
324 |
+
left: 0 !important;
|
325 |
+
position: absolute !important;
|
326 |
+
}
|
327 |
+
#chatbot-header .gradio-dropdown > label > span[data-testid="block-info"] {
|
328 |
+
height: unset;
|
329 |
+
overflow: visible;
|
330 |
+
top: 0;
|
331 |
+
align-self: center;
|
332 |
+
background: none;
|
333 |
+
margin: 0;
|
334 |
+
padding: 0;
|
335 |
+
position: relative;
|
336 |
+
width: auto;
|
337 |
+
color: var(--body-text-color-subdued);
|
338 |
+
}
|
339 |
+
#chatbot-header .gradio-dropdown > label > .wrap {
|
340 |
+
background: none;
|
341 |
+
padding-left: 8px;
|
342 |
+
}
|
343 |
+
#model-select-dropdown > label > span[data-testid="block-info"] {
|
344 |
+
display: none;
|
345 |
+
}
|
346 |
+
#chatbot-header .gradio-dropdown > label > .wrap input {
|
347 |
+
font-weight: bold;
|
348 |
+
}
|
349 |
+
#chatbot-header #model-select-dropdown > label::before {
|
350 |
+
content: "";
|
351 |
+
background: var(--primary-600);
|
352 |
+
height: 12px;
|
353 |
+
width: 12px;
|
354 |
+
border-radius: 50%;
|
355 |
+
position: absolute;
|
356 |
+
/* left: 2px; */
|
357 |
+
top: calc(50% - 6px);
|
358 |
+
}
|
359 |
+
|
360 |
+
#chatbot-header-btn-bar {
|
361 |
+
justify-content: space-between;
|
362 |
+
align-items: center;
|
363 |
+
display: flex;
|
364 |
+
height: 60px;
|
365 |
+
}
|
366 |
+
#chatbot-header-btn-bar > * {
|
367 |
+
width: 100%;
|
368 |
+
}
|
369 |
+
#header-btn-groups {
|
370 |
+
width: 100%;
|
371 |
+
display: flex;
|
372 |
+
justify-content: space-between;
|
373 |
+
}
|
374 |
+
/* #header-btn-group {
|
375 |
+
justify-content: space-between;
|
376 |
+
display: flex;
|
377 |
+
height: 36px;
|
378 |
+
align-items: center;
|
379 |
+
} */
|
380 |
+
.show-on-gpt {
|
381 |
+
/* visibility: hidden; */
|
382 |
+
display: none;
|
383 |
+
}
|
384 |
+
.is-gpt .show-on-gpt {
|
385 |
+
/* visibility: visible; */
|
386 |
+
display: block;
|
387 |
+
}
|
388 |
+
|
389 |
+
#chatbot-footer {
|
390 |
+
position: absolute;
|
391 |
+
bottom: 0;
|
392 |
+
right: 4px;
|
393 |
+
width: calc(100% - 4px);
|
394 |
+
display: flex;
|
395 |
+
justify-content: center;
|
396 |
+
/* padding: 24px; */
|
397 |
+
/* padding: 8px 6px; */
|
398 |
+
min-height: 82px;
|
399 |
+
/* max-height: 166px; */
|
400 |
+
background: var(--chatbot-blur-background-color);
|
401 |
+
-webkit-backdrop-filter: blur(24px);
|
402 |
+
backdrop-filter: blur(24px);
|
403 |
+
}
|
404 |
+
|
405 |
+
#chatbot-input-box {
|
406 |
+
max-width: 800px;
|
407 |
+
/* margin: 0 auto; */
|
408 |
+
gap: 20px;
|
409 |
+
padding: 16px 16px 24px;
|
410 |
+
padding-bottom: max(24px, calc( env(safe-area-inset-bottom) + 6px));
|
411 |
+
display: flex;
|
412 |
+
background: none;
|
413 |
+
align-self: end;
|
414 |
+
}
|
415 |
+
|
416 |
+
#chatbot-input-btn-bar {
|
417 |
+
height: 27px;
|
418 |
+
overflow-y: auto;
|
419 |
+
flex-wrap: nowrap;
|
420 |
+
}
|
421 |
+
|
422 |
+
button.chatbot-input-more-btn {
|
423 |
+
margin: 5px;
|
424 |
+
height: 32px;
|
425 |
+
width: 32px;
|
426 |
+
border-radius: 50%;
|
427 |
+
z-index: 1001;
|
428 |
+
}
|
429 |
+
button.chatbot-input-more-btn:hover .sm-round-bg {
|
430 |
+
fill-opacity: 0.2125;
|
431 |
+
}
|
432 |
+
button.chatbot-input-more-btn:active .sm-round-bg {
|
433 |
+
fill-opacity: 0.25;
|
434 |
+
}
|
435 |
+
|
436 |
+
/* 三个点号点开! */
|
437 |
+
.show-chat-more #chatbot-input-more-area {
|
438 |
+
display: flex;
|
439 |
+
}
|
440 |
+
@supports (-webkit-backdrop-filter: blur(24px)) {
|
441 |
+
/* Note: I would only try this feat on apple devices... */
|
442 |
+
.show-chat-more #chatbot-input-more-area {
|
443 |
+
background: var(--chatbot-input-more-background-color);
|
444 |
+
-webkit-backdrop-filter: blur(24px);
|
445 |
+
backdrop-filter: blur(24px);
|
446 |
+
}
|
447 |
+
}
|
448 |
+
/* no!屏幕宽度窄的时候! */
|
449 |
+
#chatbot-input-more-area {
|
450 |
+
display: none;
|
451 |
+
position: absolute;
|
452 |
+
flex-direction: column;
|
453 |
+
bottom: 60px;
|
454 |
+
min-width: 120px;
|
455 |
+
z-index: 1001;
|
456 |
+
border-radius: 6px;
|
457 |
+
box-shadow: var(--shadow-sm);
|
458 |
+
background: var(--chatbot-input-more-background-solid-color);
|
459 |
+
}
|
460 |
+
#chatbot-input-more-area > span > div {
|
461 |
+
min-width: 120px;
|
462 |
+
padding: 2px;
|
463 |
+
align-content: center;
|
464 |
+
/* display: flex; */
|
465 |
+
border-bottom: 0.5px solid var(--border-color-primary);
|
466 |
+
}
|
467 |
+
#chatbot-input-more-area > span > div.last-btn {
|
468 |
+
border-bottom: none;
|
469 |
+
}
|
470 |
+
#chatbot-input-more-area > span > div > label {
|
471 |
+
padding: 6px 8px;
|
472 |
+
border-radius: 4px;
|
473 |
+
height: 39px;
|
474 |
+
display: flex;
|
475 |
+
align-items: center;
|
476 |
+
justify-content: space-between;
|
477 |
+
cursor: pointer;
|
478 |
+
}
|
479 |
+
#chatbot-input-more-area > span > div:hover > label {
|
480 |
+
background: var(--chatbot-input-more-background-mobilewidth-hover);
|
481 |
+
}
|
482 |
+
#chatbot-input-more-area > span > div > label button {
|
483 |
+
margin: 0;
|
484 |
+
width: 100%;
|
485 |
+
display: flex;
|
486 |
+
justify-content: space-between;
|
487 |
+
align-items: center;
|
488 |
+
gap: 4px;
|
489 |
+
}
|
490 |
+
.chatbot-input-more-icon {
|
491 |
+
margin-right: 12px;
|
492 |
+
}
|
493 |
+
.chatbot-input-more-span {
|
494 |
+
white-space: nowrap;
|
495 |
+
}
|
496 |
+
|
497 |
+
/* 哈哈!川虎哥觉得不方便,那再写个全宽的吧!
|
498 |
+
* 再让我重写一份样式我是狗
|
499 |
+
*/
|
500 |
+
.chatbot-full-width #chatbot-input-row {
|
501 |
+
flex-direction: column;
|
502 |
+
justify-content: flex-start !important;
|
503 |
+
justify-items: start;
|
504 |
+
}
|
505 |
+
.chatbot-full-width #chatbot-input-more-area {
|
506 |
+
display: flex;
|
507 |
+
position: relative;
|
508 |
+
flex-direction: row-reverse;
|
509 |
+
justify-content: space-between;
|
510 |
+
height: 32px;
|
511 |
+
min-width: unset;
|
512 |
+
background: none;
|
513 |
+
box-shadow: none;
|
514 |
+
bottom: 0;
|
515 |
+
backdrop-filter: none;
|
516 |
+
-webkit-backdrop-filter: none;
|
517 |
+
}
|
518 |
+
.chatbot-full-width #chatbot-input-more-area > span > div {
|
519 |
+
/* min-width: unset; */
|
520 |
+
border-bottom: none;
|
521 |
+
}
|
522 |
+
.chatbot-full-width #chatbot-input-more-area > span > div > label {
|
523 |
+
height: 32px;
|
524 |
+
border-radius: 8px;
|
525 |
+
}
|
526 |
+
.chatbot-full-width #chatbot-input-more-area > span > div:hover > label {
|
527 |
+
background: var(--chatbot-input-more-background-fullwidth-hover);
|
528 |
+
}
|
529 |
+
.chatbot-full-width #chatbot-input-more-btn-div {
|
530 |
+
display: none;
|
531 |
+
}
|
532 |
+
.chatbot-full-width #chatbot-input-box {
|
533 |
+
padding-top: 4px;
|
534 |
+
}
|
535 |
+
.chatbot-full-width #chatbot-input-row .gradio-html {
|
536 |
+
width: 100%;
|
537 |
+
max-width: unset;
|
538 |
+
}
|
539 |
+
.chatbot-full-width .chatbot-input-more-label-group {
|
540 |
+
flex-wrap: nowrap;
|
541 |
+
flex-direction: row-reverse;
|
542 |
+
display: inline-flex;
|
543 |
+
}
|
544 |
+
.chatbot-input-more-span {
|
545 |
+
opacity: 0.64;
|
546 |
+
}
|
547 |
+
input:checked + .chatbot-input-more-span {
|
548 |
+
opacity: 1;
|
549 |
+
}
|
550 |
+
|
551 |
+
#uploaded-files-div {
|
552 |
+
display: none;
|
553 |
+
}
|
554 |
+
.with-file #uploaded-files-div {
|
555 |
+
display: flex;
|
556 |
+
justify-content: space-between;
|
557 |
+
width: 100%;
|
558 |
+
}
|
559 |
+
.with-file label.may-disable-label {
|
560 |
+
cursor: not-allowed !important;
|
561 |
+
}
|
562 |
+
.with-file #uploaded-files-div > .chatbot-input-more-span {
|
563 |
+
opacity: 1;
|
564 |
+
}
|
565 |
+
#uploaded-files-count {
|
566 |
+
background: var(--primary-600);
|
567 |
+
color: white;
|
568 |
+
width: 19px;
|
569 |
+
height: 19px;
|
570 |
+
border-radius: 50%;
|
571 |
+
margin-right: 4px;
|
572 |
+
margin-left: 6px;
|
573 |
+
text-align: center;
|
574 |
+
}
|
575 |
+
.with-file #upload-files-btn {
|
576 |
+
display: none;
|
577 |
+
}
|
578 |
+
|
579 |
+
/* default invisible */
|
580 |
+
#menu-area, #toolbox-area {
|
581 |
+
width: 0;
|
582 |
+
transition: width 0.3s ease;
|
583 |
+
visibility: hidden;
|
584 |
+
flex: unset;
|
585 |
+
min-width: unset !important;
|
586 |
+
display: flex;
|
587 |
+
flex-shrink: 0;
|
588 |
+
overflow: hidden;
|
589 |
+
flex-wrap: nowrap;
|
590 |
+
}
|
591 |
+
#menu-area {
|
592 |
+
border-radius: 0;
|
593 |
+
background: var(--background-fill-primary);
|
594 |
+
}
|
595 |
+
#toolbox-area {
|
596 |
+
background: var(--background-fill-secondary);
|
597 |
+
}
|
598 |
+
#menu-area > div {
|
599 |
+
width: var(--menu-width);
|
600 |
+
}
|
601 |
+
#chuanhu-history {
|
602 |
+
padding-left: env(safe-area-inset-left);
|
603 |
+
}
|
604 |
+
#menu-area.showSide {
|
605 |
+
width: var(--menu-width);
|
606 |
+
max-width: var(--menu-width);
|
607 |
+
height: calc(100*var(--vh) - 65px);
|
608 |
+
visibility: visible;
|
609 |
+
/* margin-right: 16px; */
|
610 |
+
border-right: 0.5px solid var(--border-color-primary);
|
611 |
+
/* box-shadow: -1px 0 4px 0 rgba(0, 0, 0, 0.1) inset; */
|
612 |
+
}
|
613 |
+
|
614 |
+
#toolbox-area > div {
|
615 |
+
width: var(--toolbox-width);
|
616 |
+
}
|
617 |
+
#toolbox-area.showSide {
|
618 |
+
width: var(--toolbox-width);
|
619 |
+
height: calc(100*var(--vh) - 65px);
|
620 |
+
visibility: visible;
|
621 |
+
/* margin-left: 16px; */
|
622 |
+
}
|
623 |
+
|
624 |
+
/* When screen width <= 768 */
|
625 |
+
@media screen and (max-width: 767px) {
|
626 |
+
#menu-area {
|
627 |
+
position: fixed;
|
628 |
+
transition: left 0.3s ease, visibility 0.1s ease;
|
629 |
+
left: calc(0px - var(--menu-width));
|
630 |
+
z-index: 9999;
|
631 |
+
/* overflow: unset; */
|
632 |
+
border-right: none !important;
|
633 |
+
}
|
634 |
+
#chuanhu-history {
|
635 |
+
padding-left: 0;
|
636 |
+
}
|
637 |
+
#menu-area.showSide {
|
638 |
+
left: 0;
|
639 |
+
}
|
640 |
+
|
641 |
+
#toolbox-area {
|
642 |
+
position: fixed;
|
643 |
+
width: 100vw;
|
644 |
+
transition: top 0.3s ease, visibility 0.1s ease;
|
645 |
+
/* right: calc(0px - var(--toolbox-width)); */
|
646 |
+
z-index: 10008;
|
647 |
+
overflow: unset;
|
648 |
+
top: calc(100*var(--vh));
|
649 |
+
margin: 0;
|
650 |
+
}
|
651 |
+
#toolbox-area > div {
|
652 |
+
width: 100vw;
|
653 |
+
height: calc( 90*var(--vh) - 48px );
|
654 |
+
}
|
655 |
+
#toolbox-area.showSide {
|
656 |
+
width: 100vw;
|
657 |
+
right: 0;
|
658 |
+
top: calc( 10*var(--vh) + 48px );
|
659 |
+
margin: 0;
|
660 |
+
border-radius: 6px;
|
661 |
+
box-shadow: 0 2px 64px 4px rgba(0, 0, 0, 0.2);
|
662 |
+
}
|
663 |
+
/* #menu-area.showSide, #toolbox-area.showSide {
|
664 |
+
z-index: 9999;
|
665 |
+
} */
|
666 |
+
}
|
667 |
+
|
668 |
+
/* .chuanhu-history-panel ul.options {
|
669 |
+
position: relative;
|
670 |
+
box-shadow: unset;
|
671 |
+
overflow: hidden;
|
672 |
+
} */
|
673 |
+
/* .chuanhu-history-panel {
|
674 |
+
height: 500px;
|
675 |
+
overflow: auto;
|
676 |
+
box-shadow: var(--shadow-drop-lg);
|
677 |
+
} */
|
678 |
+
|
679 |
+
#chuanhu-popup > .gradio-box {
|
680 |
+
height: 100%;
|
681 |
+
}
|
682 |
+
#chuanhu-popup > .gradio-box > .gradio-row:first-of-type {
|
683 |
+
padding: 24px !important;
|
684 |
+
border-bottom: 1.8px solid var(--border-color-primary);
|
685 |
+
}
|
686 |
+
#toolbox-area > .gradio-box > .gradio-row:first-of-type * ,
|
687 |
+
#chuanhu-popup > .gradio-box > .gradio-row:first-of-type * {
|
688 |
+
margin: 0;
|
689 |
+
}
|
690 |
+
|
691 |
+
#toolbox-area > .gradio-box > .gradio-row > .close-btn,
|
692 |
+
#chuanhu-popup > .gradio-box > .gradio-row > .close-btn {
|
693 |
+
max-width: 28px;
|
694 |
+
display: flex;
|
695 |
+
justify-content: flex-end;
|
696 |
+
}
|
697 |
+
|
698 |
+
|
699 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs {
|
700 |
+
display: block;
|
701 |
+
height: 322px;
|
702 |
+
/* margin: 16px 24px; */
|
703 |
+
}
|
704 |
+
|
705 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs > div.tabitem {
|
706 |
+
border: none;
|
707 |
+
border-radius: 0;
|
708 |
+
overflow: auto;
|
709 |
+
height: 100%;
|
710 |
+
padding: 16px 24px;
|
711 |
+
}
|
712 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs > div.tab-nav {
|
713 |
+
float: left;
|
714 |
+
display: block;
|
715 |
+
border: none;
|
716 |
+
padding: 16px;
|
717 |
+
width: 180px;
|
718 |
+
height: 100%;
|
719 |
+
overflow: auto;
|
720 |
+
background: var(--background-fill-secondary);
|
721 |
+
border-bottom-left-radius: var(--block-radius);
|
722 |
+
border-right: 1px solid var(--border-color-primary);
|
723 |
+
}
|
724 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs > div.tab-nav > button {
|
725 |
+
display: block;
|
726 |
+
border: none;
|
727 |
+
border-radius: 6px;
|
728 |
+
text-align: left;
|
729 |
+
white-space: initial;
|
730 |
+
width: 100%;
|
731 |
+
/* height: 32px; */
|
732 |
+
padding: 7px 12px;
|
733 |
+
}
|
734 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs > div.tab-nav > button.selected {
|
735 |
+
background-color: var(--button-primary-background-fill);
|
736 |
+
/* font-weight: bold; */
|
737 |
+
color: var(--button-primary-text-color);
|
738 |
+
}
|
739 |
+
|
740 |
+
/* 这是为了第二级tab的选项,比如training里的openai tab下的几个准备数据集tab */
|
741 |
+
.gradio-box > .gradio-tabs .gradio-tabs > div.tab-nav > button.selected {
|
742 |
+
background-color: var(--block-background-fill);
|
743 |
+
}
|
744 |
+
|
745 |
+
/* 小屏幕的tab样式 */
|
746 |
+
@media screen and (max-width: 767px) {
|
747 |
+
#popup-wrapper.showBox {
|
748 |
+
place-items: end;
|
749 |
+
}
|
750 |
+
#chuanhu-popup {
|
751 |
+
width: 100vw;
|
752 |
+
height: calc( 90*var(--vh) - 48px );
|
753 |
+
border-bottom-left-radius: 0;
|
754 |
+
border-bottom-right-radius: 0;
|
755 |
+
}
|
756 |
+
#toolbox-area > .gradio-box > .gradio-row:first-of-type,
|
757 |
+
#chuanhu-popup > .gradio-box > .gradio-row:first-of-type {
|
758 |
+
padding: 18px 24px 0 !important;
|
759 |
+
border-bottom: 0;
|
760 |
+
}
|
761 |
+
#toolbox-area > .gradio-box > .gradio-tabs,
|
762 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs {
|
763 |
+
height: auto;
|
764 |
+
width: 100vw;
|
765 |
+
overflow: hidden;
|
766 |
+
}
|
767 |
+
#toolbox-area > .gradio-box > .gradio-tabs > div.tabitem,
|
768 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs > div.tabitem {
|
769 |
+
height: calc( 90*var(--vh) - 48px - 46px - 45px );
|
770 |
+
overflow-x: auto;
|
771 |
+
border: none;
|
772 |
+
}
|
773 |
+
/* 下面是弃用方案:横条按钮tab */
|
774 |
+
/*
|
775 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs > div.tab-nav {
|
776 |
+
display: flex;
|
777 |
+
margin: 0;
|
778 |
+
padding: 12px 16px 8px;
|
779 |
+
overflow-x: auto;
|
780 |
+
overflow-y: hidden;
|
781 |
+
flex-direction: row;
|
782 |
+
flex-wrap: nowrap;
|
783 |
+
border-radius: 8px;
|
784 |
+
gap: 12px;
|
785 |
+
width: 100%;
|
786 |
+
height: auto;
|
787 |
+
background: none;
|
788 |
+
}
|
789 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs > div.tab-nav > button {
|
790 |
+
display: inline-block;
|
791 |
+
border-style: none;
|
792 |
+
border-radius: 6px;
|
793 |
+
white-space: nowrap;
|
794 |
+
width: auto;
|
795 |
+
padding: 7px 32px;
|
796 |
+
text-align: center;
|
797 |
+
background: var(--background-fill-secondary);
|
798 |
+
}
|
799 |
+
*/
|
800 |
+
#toolbox-area > .gradio-box > .gradio-tabs > div.tab-nav,
|
801 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs > div.tab-nav {
|
802 |
+
display: flex;
|
803 |
+
margin: 0;
|
804 |
+
padding: 6px 16px 0;
|
805 |
+
overflow-x: auto;
|
806 |
+
overflow-y: hidden;
|
807 |
+
flex-direction: row;
|
808 |
+
flex-wrap: nowrap;
|
809 |
+
border-radius: 0;
|
810 |
+
gap: 12px;
|
811 |
+
width: 100%;
|
812 |
+
height: auto;
|
813 |
+
background: none;
|
814 |
+
border-bottom: 1px solid var(--border-color-primary);
|
815 |
+
align-items: baseline;
|
816 |
+
}
|
817 |
+
#toolbox-area > .gradio-box > .gradio-tabs > div.tab-nav > button,
|
818 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs > div.tab-nav > button {
|
819 |
+
display: inline-block;
|
820 |
+
position: relative;
|
821 |
+
padding: 7px 6px;
|
822 |
+
border: none;
|
823 |
+
white-space: nowrap;
|
824 |
+
width: auto;
|
825 |
+
text-align: center;
|
826 |
+
background: none;
|
827 |
+
transition: font-size 0.3s ease-in-out;
|
828 |
+
}
|
829 |
+
#toolbox-area > .gradio-box > .gradio-tabs > div.tab-nav > button.selected,
|
830 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs > div.tab-nav > button.selected {
|
831 |
+
background-color: unset !important;
|
832 |
+
font-weight: bold;
|
833 |
+
font-size: large;
|
834 |
+
color: var(--body-text-color);
|
835 |
+
}
|
836 |
+
#toolbox-area > .gradio-box > .gradio-tabs > div.tab-nav > button.selected::after,
|
837 |
+
#chuanhu-popup > .gradio-box > .gradio-tabs > div.tab-nav > button.selected::after {
|
838 |
+
content: "";
|
839 |
+
background-color: var(--primary-600);
|
840 |
+
height: 4px;
|
841 |
+
width: 32%;
|
842 |
+
border-radius: 4px;
|
843 |
+
position: absolute;
|
844 |
+
left: 50%;
|
845 |
+
bottom: 1px;
|
846 |
+
transform: translateX(-50%);
|
847 |
+
}
|
848 |
+
}
|
849 |
+
|
850 |
+
/* 下面是大屏幕的 toolbox tab 样式 */
|
851 |
+
@media screen and (min-width: 768px) {
|
852 |
+
#toolbox-area {
|
853 |
+
border-left: 1px solid var(--border-color-primary);
|
854 |
+
}
|
855 |
+
#toolbox-area > .gradio-box {
|
856 |
+
border-radius: 0;
|
857 |
+
}
|
858 |
+
#toolbox-area > .gradio-box > .gradio-row > .close-btn {
|
859 |
+
display: none;
|
860 |
+
}
|
861 |
+
#toolbox-area > .gradio-box > .gradio-row:first-of-type {
|
862 |
+
display: none;
|
863 |
+
}
|
864 |
+
#toolbox-area > .gradio-box > .gradio-tabs{
|
865 |
+
height: 100%;
|
866 |
+
width: var(--toolbox-width);
|
867 |
+
overflow: hidden;
|
868 |
+
}
|
869 |
+
#toolbox-area > .gradio-box > .gradio-tabs > div.tabitem {
|
870 |
+
height: calc(100% - 35px);
|
871 |
+
overflow-y: auto;
|
872 |
+
border-style: none;
|
873 |
+
padding: 0;
|
874 |
+
/* 理论上不该是0,但这里考虑内部gradio有好多container有padding了 */
|
875 |
+
padding-right: env(safe-area-inset-right);
|
876 |
+
}
|
877 |
+
#toolbox-area > .gradio-box > .gradio-tabs > div.tab-nav {
|
878 |
+
display: flex;
|
879 |
+
margin: 0;
|
880 |
+
/* padding: 4px; */
|
881 |
+
overflow-x: auto;
|
882 |
+
overflow-y: hidden;
|
883 |
+
flex-direction: row;
|
884 |
+
flex-wrap: nowrap;
|
885 |
+
/* border-radius: 10px; */
|
886 |
+
/* gap: 4px; */
|
887 |
+
width: 100%;
|
888 |
+
height: auto;
|
889 |
+
background: var(--button-secondary-background-fill);
|
890 |
+
border-bottom: 1px solid var(--border-color-primary);
|
891 |
+
border:none;
|
892 |
+
align-items: baseline;
|
893 |
+
}
|
894 |
+
#toolbox-area > .gradio-box > .gradio-tabs > div.tab-nav > button {
|
895 |
+
display: inline-block;
|
896 |
+
position: relative;
|
897 |
+
padding: 8px 2rem;
|
898 |
+
border: none;
|
899 |
+
white-space: nowrap;
|
900 |
+
width: auto;
|
901 |
+
text-align: center;
|
902 |
+
background: var(--button-secondary-background-fill);
|
903 |
+
transition: font-size 0.3s ease-in-out;
|
904 |
+
border-right: 1px var(--border-color-primary) solid;
|
905 |
+
border-radius: 0;
|
906 |
+
}
|
907 |
+
#toolbox-area > .gradio-box > .gradio-tabs > div.tab-nav > button.selected {
|
908 |
+
background-color: var(--block-background-fill);
|
909 |
+
font-weight: bold;
|
910 |
+
/* border-top-left-radius: 8px;
|
911 |
+
border-top-right-radius: 8px; */
|
912 |
+
/* font-size: large; */
|
913 |
+
/* color: white; */
|
914 |
+
}
|
915 |
+
}
|
916 |
+
|
917 |
+
#toolbox-area > .gradio-box {
|
918 |
+
padding: 0;
|
919 |
+
height: 100%;
|
920 |
+
}
|
921 |
+
/*
|
922 |
+
#toolbox-area > .gradio-box > .gradio-tabs > div.tabitem {
|
923 |
+
padding: 0;
|
924 |
+
理论上不该是0,但这里考虑内部gradio有好多container有padding了
|
925 |
+
}
|
926 |
+
*/
|
927 |
+
#toolbox-area .tabitem > div > .gradio-markdown {
|
928 |
+
padding: 12px;
|
929 |
+
}
|
930 |
+
|
931 |
+
#toolbox-area .tabitem > div > .gradio-accordion > .label-wrap > span {
|
932 |
+
font-weight: bold;
|
933 |
+
}
|
934 |
+
#toolbox-area .tabitem > div {
|
935 |
+
gap: 0 !important;
|
936 |
+
}
|
937 |
+
|
938 |
+
/* #chuanhu-popup ul.options {
|
939 |
+
transform: translate(-50%, -50%);
|
940 |
+
} */
|
941 |
+
|
942 |
+
#chuanhu-history {
|
943 |
+
max-height: calc(100*var(--vh) - 65px - 61px);
|
944 |
+
max-height: calc(100*var(--vh) - 65px - calc(36px + 12px + max(12px, env(safe-area-inset-bottom)) + 1px ));
|
945 |
+
/* overflow-y: auto; */
|
946 |
+
}
|
947 |
+
#chuanhu-history > div {
|
948 |
+
border-radius: 0;
|
949 |
+
background: none;
|
950 |
+
height: 100%;
|
951 |
+
padding: 0;
|
952 |
+
}
|
953 |
+
#chuanhu-history > div > div {
|
954 |
+
padding-inline: 12px;
|
955 |
+
}
|
956 |
+
#chuanhu-history-header {
|
957 |
+
margin-top: 12px;
|
958 |
+
height: 42px;
|
959 |
+
margin-bottom: 12px;
|
960 |
+
}
|
961 |
+
#chuanhu-history-search-row {
|
962 |
+
gap: 0;
|
963 |
+
/* background:var(--input-background-fill); */
|
964 |
+
/* border-radius: var(--block-radius); */
|
965 |
+
justify-content: space-between;
|
966 |
+
display: flex;
|
967 |
+
}
|
968 |
+
#history-search-tb {
|
969 |
+
background:var(--input-background-fill);
|
970 |
+
border-radius: var(--block-radius);
|
971 |
+
}
|
972 |
+
#history-search-tb > label::before {
|
973 |
+
content: url("data:image/svg+xml,%3Csvg fill='gray' fill-opacity='0.64' width='18px' height='18px' viewBox='0 0 18.0938 18.2695' xmlns='http://www.w3.org/2000/svg'%3E%3Cg%3E%3Cpath d='M0 7.45312C0 11.5664 3.33984 14.8945 7.45312 14.8945C9.03516 14.8945 10.4883 14.4023 11.6953 13.5586L16.0547 17.9297C16.3008 18.1641 16.6055 18.2695 16.9219 18.2695C17.6016 18.2695 18.0938 17.7539 18.0938 17.0742C18.0938 16.7461 17.9648 16.4531 17.7656 16.2305L13.4297 11.8828C14.3555 10.6406 14.8945 9.11719 14.8945 7.45312C14.8945 3.33984 11.5664 0 7.45312 0C3.33984 0 0 3.33984 0 7.45312ZM1.80469 7.45312C1.80469 4.32422 4.32422 1.80469 7.45312 1.80469C10.5703 1.80469 13.1016 4.32422 13.1016 7.45312C13.1016 10.5703 10.5703 13.1016 7.45312 13.1016C4.32422 13.1016 1.80469 10.5703 1.80469 7.45312Z'/%3E%3C/g%3E%3C/svg%3E");
|
974 |
+
width: 24px;
|
975 |
+
height: 24px;
|
976 |
+
position: absolute;
|
977 |
+
top: 50%;
|
978 |
+
transform: translateY(-50%);
|
979 |
+
display: block;
|
980 |
+
padding: 3px 0 3px 3px;
|
981 |
+
left: 7px;
|
982 |
+
}
|
983 |
+
#history-search-tb textarea {
|
984 |
+
width: calc(100% - 32px);
|
985 |
+
margin-left: 32px;
|
986 |
+
padding-left: 6px;
|
987 |
+
box-shadow: none;
|
988 |
+
}
|
989 |
+
#chuanhu-history-body {
|
990 |
+
height: calc(100% - 66px);
|
991 |
+
overflow-y: auto;
|
992 |
+
overflow-x: hidden;
|
993 |
+
padding-bottom: 6px;
|
994 |
+
}
|
995 |
+
#gr-history-header-btns {
|
996 |
+
max-height: 42px;
|
997 |
+
gap: 4px;
|
998 |
+
display: flex;
|
999 |
+
justify-content: end;
|
1000 |
+
align-content: center;
|
1001 |
+
flex-direction: row;
|
1002 |
+
max-width: 52px;
|
1003 |
+
margin-inline: 8px;
|
1004 |
+
}
|
1005 |
+
#gr-history-header-btns button {
|
1006 |
+
box-shadow: none;
|
1007 |
+
justify-content: center;
|
1008 |
+
align-items: center;
|
1009 |
+
height: 24px;
|
1010 |
+
width: 24px;
|
1011 |
+
display: flex;
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
#chuanhu-menu-footer {
|
1015 |
+
position: absolute;
|
1016 |
+
bottom: 0;
|
1017 |
+
background: var(--background-fill-primary);
|
1018 |
+
height: auto;
|
1019 |
+
overflow: hidden;
|
1020 |
+
padding: 12px 18px;
|
1021 |
+
padding-bottom: max(12px, env(safe-area-inset-bottom));
|
1022 |
+
padding-left: max(18px, env(safe-area-inset-left));
|
1023 |
+
border-top: 0.8px solid var(--border-color-primary);
|
1024 |
+
}
|
1025 |
+
#menu-footer-btn-bar {
|
1026 |
+
justify-content: space-between;
|
1027 |
+
display: flex;
|
1028 |
+
height: 36px;
|
1029 |
+
align-items: center;
|
1030 |
+
}
|
1031 |
+
.btn-bar-group {
|
1032 |
+
gap: 6px;
|
1033 |
+
display: inline-flex;
|
1034 |
+
}
|
1035 |
+
.chuanhu-ui-btn {
|
1036 |
+
border-radius: 8px;
|
1037 |
+
/* color: rgba(120, 120, 120, 0.64) !important; */
|
1038 |
+
padding: 6px !important;
|
1039 |
+
margin: 0 !important;
|
1040 |
+
cursor: pointer !important;
|
1041 |
+
transition: background-color .2s ease;
|
1042 |
+
}
|
1043 |
+
.chuanhu-ui-btn:hover {
|
1044 |
+
background-color: rgba(167, 167, 167, 0.25) !important;
|
1045 |
+
/* color: unset !important; */
|
1046 |
+
}
|
1047 |
+
.chuanhu-ui-btn:active {
|
1048 |
+
background-color: rgba(167, 167, 167, 0.5) !important;
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
.hover-round-btn {
|
1052 |
+
border-radius: 50% !important;
|
1053 |
+
}
|
1054 |
+
|
1055 |
+
.show-on-light {
|
1056 |
+
display: block;
|
1057 |
+
}
|
1058 |
+
.show-on-dark {
|
1059 |
+
display: none;
|
1060 |
+
}
|
1061 |
+
.dark .show-on-light {
|
1062 |
+
display: none;
|
1063 |
+
}
|
1064 |
+
.dark .show-on-dark {
|
1065 |
+
display: block;
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
.show-on-latest {
|
1069 |
+
display: block;
|
1070 |
+
}
|
1071 |
+
.show-on-outdated {
|
1072 |
+
display: none;
|
1073 |
+
}
|
1074 |
+
.is-outdated .show-on-latest {
|
1075 |
+
display: none;
|
1076 |
+
}
|
1077 |
+
.is-outdated .show-on-outdated {
|
1078 |
+
display: block;
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
#chatbot-area.no-menu #chatbot-header {
|
1082 |
+
padding-left: max(20px, env(safe-area-inset-left));
|
1083 |
+
}
|
1084 |
+
#chatbot-area.no-menu #chatbot-area {
|
1085 |
+
padding-left: env(safe-area-inset-left);
|
1086 |
+
}
|
1087 |
+
#chatbot-area.no-menu #chatbot-input-box {
|
1088 |
+
padding-left: max(16px, env(safe-area-inset-left));
|
1089 |
+
}
|
1090 |
+
#chatbot-area.no-menu #chuanhu-chatbot>.wrapper>.wrap {
|
1091 |
+
padding-left: max(20px, env(safe-area-inset-left));
|
1092 |
+
}
|
1093 |
+
|
1094 |
+
#chatbot-area.no-toolbox #chatbot-header {
|
1095 |
+
padding-right: max(16px, env(safe-area-inset-right));
|
1096 |
+
}
|
1097 |
+
#chatbot-area.no-toolbox #chatbot-area {
|
1098 |
+
padding-right: env(safe-area-inset-right);
|
1099 |
+
}
|
1100 |
+
#chatbot-area.no-toolbox #chatbot-input-box {
|
1101 |
+
padding-right: max(16px, env(safe-area-inset-right));
|
1102 |
+
}
|
1103 |
+
#chatbot-area.no-toolbox #chuanhu-chatbot>.wrapper>.wrap {
|
1104 |
+
padding-right: max(20px, env(safe-area-inset-right));
|
1105 |
+
}
|
1106 |
+
|
1107 |
+
|
1108 |
+
/* #history-select-wrap {
|
1109 |
+
height: 600px;
|
1110 |
+
overflow: auto;
|
1111 |
+
overflow-x: hidden;
|
1112 |
+
} */
|
1113 |
+
|
1114 |
+
.chat-selected-btns {
|
1115 |
+
height: 18px;
|
1116 |
+
gap: 8px;
|
1117 |
+
display: inline-flex;
|
1118 |
+
position: absolute;
|
1119 |
+
right: 16px;
|
1120 |
+
}
|
1121 |
+
.chat-selected-btns::before {
|
1122 |
+
content: "";
|
1123 |
+
position: absolute;
|
1124 |
+
background-image: linear-gradient(to right, rgba(0, 0, 0, 0), var(--message-list-background-selected) 80%);
|
1125 |
+
width: 32px;
|
1126 |
+
height: 22px;
|
1127 |
+
top: 0;
|
1128 |
+
left: -32px;
|
1129 |
+
}
|
1130 |
+
.icon-need-hover {
|
1131 |
+
opacity: 0.64;
|
1132 |
+
}
|
1133 |
+
button:hover .icon-need-hover, button:hover.icon-need-hover {
|
1134 |
+
opacity: 0.85;
|
1135 |
+
}
|
1136 |
+
button:active .icon-need-hover, button:active.icon-need-hover {
|
1137 |
+
opacity: 1;
|
1138 |
+
}
|
1139 |
+
/* .main-body {
|
1140 |
+
flex-wrap: nowrap;
|
1141 |
+
gap: 0;
|
1142 |
+
overflow: hidden;
|
1143 |
+
display: inline-flex;
|
1144 |
+
/* margin-top: 54px; */
|
1145 |
+
/* height: calc(100*var(--vh) - 72px); */
|
1146 |
+
/* position: absolute;
|
1147 |
+
top: 48px;
|
1148 |
+
} */
|
1149 |
+
/*
|
1150 |
+
.hide-body {
|
1151 |
+
display: none;
|
1152 |
+
top: calc(-100*var(--vh));
|
1153 |
+
|
1154 |
+
}
|
1155 |
+
#train-body {
|
1156 |
+
transition: top 0.3s ease-in-out, display 0.3s ease;
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
#chuanhu-body.hide-body {
|
1160 |
+
display: none;
|
1161 |
+
top: calc(100*var(--vh) + 48px);
|
1162 |
+
}
|
1163 |
+
#chuanhu-body {
|
1164 |
+
transition: top 0.3s ease-in-out, display 0.3s ease;
|
1165 |
+
} */
|
1166 |
+
|
web_assets/stylesheet/chatbot.css
CHANGED
@@ -50,6 +50,43 @@ hr.append-display {
|
|
50 |
padding: 0 4px;
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
/* 亮色(默认) */
|
54 |
#chuanhu-chatbot {
|
55 |
background-color: var(--chatbot-background-color-light) !important;
|
@@ -99,40 +136,61 @@ hr.append-display {
|
|
99 |
justify-content: flex-end;
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
102 |
/* 屏幕宽度大于等于500px的设备 */
|
103 |
/* update on 2023.4.8: 高度的细致调整已写入JavaScript */
|
104 |
@media screen and (min-width: 500px) {
|
105 |
-
#chuanhu-chatbot {
|
106 |
-
height: calc(
|
107 |
}
|
108 |
#chuanhu-chatbot>.wrapper>.wrap {
|
109 |
-
max-height: calc(
|
110 |
-
}
|
111 |
}
|
112 |
/* 屏幕宽度小于500px的设备 */
|
113 |
@media screen and (max-width: 499px) {
|
114 |
-
#chuanhu-chatbot {
|
115 |
-
height: calc(
|
116 |
}
|
117 |
#chuanhu-chatbot>.wrapper>.wrap {
|
118 |
-
max-height: calc(
|
119 |
-
}
|
120 |
[data-testid = "bot"] {
|
121 |
max-width: calc(100% - 84px) !important;
|
122 |
}
|
123 |
[data-testid = "user"] {
|
124 |
max-width: calc(100% - 84px) !important;
|
125 |
}
|
126 |
-
|
127 |
-
|
|
|
|
|
128 |
}
|
129 |
#app-title h1{
|
130 |
letter-spacing: -1px; font-size: 22px;
|
131 |
}
|
132 |
}
|
133 |
|
|
|
|
|
|
|
|
|
134 |
#chuanhu-chatbot>.wrapper>.wrap {
|
135 |
overflow-x: hidden;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
}
|
137 |
|
138 |
.message.user p {
|
@@ -173,8 +231,6 @@ hr.append-display {
|
|
173 |
/* background-color: #E6E6E6 !important; */
|
174 |
color: rgba(120, 120, 120, 0.64) !important;
|
175 |
padding: 4px !important;
|
176 |
-
position: absolute;
|
177 |
-
right: -22px;
|
178 |
cursor: pointer !important;
|
179 |
transition: color .2s ease, background-color .2s ease;
|
180 |
}
|
@@ -189,14 +245,58 @@ hr.append-display {
|
|
189 |
outline: none;
|
190 |
}
|
191 |
|
192 |
-
.
|
193 |
-
|
|
|
194 |
bottom: 0;
|
|
|
|
|
|
|
|
|
195 |
}
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
/* note: this is deprecated */
|
202 |
.copy-code-btn {
|
|
|
50 |
padding: 0 4px;
|
51 |
}
|
52 |
|
53 |
+
/* 阻止generating时的border */
|
54 |
+
#chuanhu-chatbot > .wrap {
|
55 |
+
border: none !important;
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
#chatbot-input-row {
|
61 |
+
align-items: end;
|
62 |
+
gap: 6px;
|
63 |
+
}
|
64 |
+
#chatbot-input-row .gradio-html {
|
65 |
+
min-width: 0;
|
66 |
+
max-width: 42px;
|
67 |
+
width: 42px;
|
68 |
+
}
|
69 |
+
#chatbot-input-tb-row {
|
70 |
+
gap: 0;
|
71 |
+
justify-content: end;
|
72 |
+
border-radius: 21px;
|
73 |
+
background: var(--chatbot-input-background-color);
|
74 |
+
box-shadow: var(--shadow-md);
|
75 |
+
}
|
76 |
+
#user-input-tb {
|
77 |
+
padding: 0 !important;
|
78 |
+
/* border: 1px solid rgba(167, 167, 167, 0.5) !important; */
|
79 |
+
/* border-radius: 21px !important; */
|
80 |
+
}
|
81 |
+
#user-input-tb textarea {
|
82 |
+
/* max-height: 110px; */
|
83 |
+
background: transparent;
|
84 |
+
}
|
85 |
+
#user-input-tb .wrap {
|
86 |
+
background: none !important;
|
87 |
+
border-radius: 21px !important;
|
88 |
+
}
|
89 |
+
|
90 |
/* 亮色(默认) */
|
91 |
#chuanhu-chatbot {
|
92 |
background-color: var(--chatbot-background-color-light) !important;
|
|
|
136 |
justify-content: flex-end;
|
137 |
}
|
138 |
|
139 |
+
/* .message-row.has-message-btn-row{
|
140 |
+
padding-bottom: 19px !important;
|
141 |
+
} */
|
142 |
+
|
143 |
/* 屏幕宽度大于等于500px的设备 */
|
144 |
/* update on 2023.4.8: 高度的细致调整已写入JavaScript */
|
145 |
@media screen and (min-width: 500px) {
|
146 |
+
/* #chuanhu-chatbot {
|
147 |
+
height: calc(100*var(--vh) - 200px);
|
148 |
}
|
149 |
#chuanhu-chatbot>.wrapper>.wrap {
|
150 |
+
max-height: calc(100*var(--vh) - 200px - var(--line-sm)*1rem - 2*var(--block-label-margin) );
|
151 |
+
} */
|
152 |
}
|
153 |
/* 屏幕宽度小于500px的设备 */
|
154 |
@media screen and (max-width: 499px) {
|
155 |
+
/* #chuanhu-chatbot {
|
156 |
+
height: calc(100*var(--vh) - 140px);
|
157 |
}
|
158 |
#chuanhu-chatbot>.wrapper>.wrap {
|
159 |
+
max-height: calc(100*var(--vh) - 140px - var(--line-sm)*1rem - 2*var(--block-label-margin) );
|
160 |
+
} */
|
161 |
[data-testid = "bot"] {
|
162 |
max-width: calc(100% - 84px) !important;
|
163 |
}
|
164 |
[data-testid = "user"] {
|
165 |
max-width: calc(100% - 84px) !important;
|
166 |
}
|
167 |
+
|
168 |
+
#app-title {
|
169 |
+
transform: scale(0.95);
|
170 |
+
transform-origin: left center;
|
171 |
}
|
172 |
#app-title h1{
|
173 |
letter-spacing: -1px; font-size: 22px;
|
174 |
}
|
175 |
}
|
176 |
|
177 |
+
#chuanhu-chatbot {
|
178 |
+
height: calc(100*var(--vh) - 65px) !important;
|
179 |
+
border-radius: 0;
|
180 |
+
}
|
181 |
#chuanhu-chatbot>.wrapper>.wrap {
|
182 |
overflow-x: hidden;
|
183 |
+
display: flex;
|
184 |
+
width: 100%;
|
185 |
+
flex-direction: column;
|
186 |
+
padding-inline: 20px;
|
187 |
+
padding-top: 72px;
|
188 |
+
padding-bottom: 180px;
|
189 |
+
}
|
190 |
+
#chuanhu-chatbot>.wrapper>.wrap .message-wrap {
|
191 |
+
align-self: center;
|
192 |
+
width: 100%;
|
193 |
+
max-width: 1024px;
|
194 |
}
|
195 |
|
196 |
.message.user p {
|
|
|
231 |
/* background-color: #E6E6E6 !important; */
|
232 |
color: rgba(120, 120, 120, 0.64) !important;
|
233 |
padding: 4px !important;
|
|
|
|
|
234 |
cursor: pointer !important;
|
235 |
transition: color .2s ease, background-color .2s ease;
|
236 |
}
|
|
|
245 |
outline: none;
|
246 |
}
|
247 |
|
248 |
+
.message-btn-column {
|
249 |
+
position: absolute;
|
250 |
+
right: -23px;
|
251 |
bottom: 0;
|
252 |
+
display: flex;
|
253 |
+
flex-direction: column;
|
254 |
+
align-content: end;
|
255 |
+
gap: 2px;
|
256 |
}
|
257 |
+
|
258 |
+
.message-btn-row {
|
259 |
+
/* background: red; */
|
260 |
+
width: 100%;
|
261 |
+
height: 19px;
|
262 |
+
position: absolute;
|
263 |
+
top: calc(100% + 2px);
|
264 |
+
left: 0;
|
265 |
+
display: flex;
|
266 |
+
justify-content: space-between;
|
267 |
+
}
|
268 |
+
.message-btn-row-leading, .message-btn-row-trailing {
|
269 |
+
display: inline-flex;
|
270 |
+
gap: 4px;
|
271 |
+
}
|
272 |
+
.message-btn-row button {
|
273 |
+
font-size: 10px;
|
274 |
+
align-self: center;
|
275 |
+
align-items: center;
|
276 |
+
flex-wrap: nowrap;
|
277 |
+
white-space: nowrap;
|
278 |
+
display: inline-flex;
|
279 |
+
flex-direction: row;
|
280 |
+
gap: 4px;
|
281 |
+
padding-block: 2px !important;
|
282 |
+
}
|
283 |
+
|
284 |
+
.like-latest-btn, .dislike-latest-btn {
|
285 |
+
display: none !important;
|
286 |
+
/* filter: grayscale(); */
|
287 |
}
|
288 |
+
.is-xmchat .like-latest-btn, .is-xmchat .dislike-latest-btn {
|
289 |
+
display: inline-flex !important;
|
290 |
+
}
|
291 |
+
|
292 |
+
/* .copy-bot-btn {
|
293 |
+
top: 18px; */
|
294 |
+
/* bottom: 0;
|
295 |
+
}
|
296 |
+
.toggle-md-btn {
|
297 |
+
top: 0; */
|
298 |
+
/* bottom: 20px;
|
299 |
+
} */
|
300 |
|
301 |
/* note: this is deprecated */
|
302 |
.copy-code-btn {
|
web_assets/stylesheet/custom-components.css
CHANGED
@@ -2,7 +2,9 @@
|
|
2 |
/* user-info */
|
3 |
#user-info.block {
|
4 |
white-space: nowrap;
|
5 |
-
position: absolute;
|
|
|
|
|
6 |
z-index: var(--layer-2);
|
7 |
box-shadow: var(--block-shadow);
|
8 |
border: none!important; border-radius: var(--block-label-radius);
|
@@ -11,6 +13,7 @@
|
|
11 |
font-size: var(--block-label-text-size); line-height: var(--line-sm);
|
12 |
width: auto; max-height: 30px!important;
|
13 |
opacity: 1;
|
|
|
14 |
transition: opacity 0.3s ease-in-out;
|
15 |
}
|
16 |
#user-info.block .wrap {
|
@@ -28,9 +31,9 @@
|
|
28 |
|
29 |
/* updater */
|
30 |
#toast-update {
|
31 |
-
position:
|
32 |
display: flex;
|
33 |
-
top: -
|
34 |
width: 100%;
|
35 |
justify-content: center;
|
36 |
z-index: var(--layer-top);
|
@@ -62,10 +65,11 @@
|
|
62 |
#release-note-wrap {
|
63 |
width: 100%;
|
64 |
max-width: 400px;
|
65 |
-
height:
|
66 |
border: solid 1px var(--border-color-primary);
|
67 |
-
overflow: auto;
|
68 |
-
|
|
|
69 |
}
|
70 |
#release-note-wrap.hideK {
|
71 |
display: none;
|
@@ -203,6 +207,7 @@ input:checked + .apSlider::before {
|
|
203 |
position: relative !important;
|
204 |
border: none !important;
|
205 |
outline: none;
|
|
|
206 |
width: 40px !important;
|
207 |
height: 22px !important;
|
208 |
border-radius: 11px !important;
|
@@ -238,3 +243,126 @@ input:checked + .apSlider::before {
|
|
238 |
left: 18px;
|
239 |
}
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/* user-info */
|
3 |
#user-info.block {
|
4 |
white-space: nowrap;
|
5 |
+
position: absolute;
|
6 |
+
right: max(32px, env(safe-area-inset-right));
|
7 |
+
top: 16px;
|
8 |
z-index: var(--layer-2);
|
9 |
box-shadow: var(--block-shadow);
|
10 |
border: none!important; border-radius: var(--block-label-radius);
|
|
|
13 |
font-size: var(--block-label-text-size); line-height: var(--line-sm);
|
14 |
width: auto; max-height: 30px!important;
|
15 |
opacity: 1;
|
16 |
+
z-index: 1000;
|
17 |
transition: opacity 0.3s ease-in-out;
|
18 |
}
|
19 |
#user-info.block .wrap {
|
|
|
31 |
|
32 |
/* updater */
|
33 |
#toast-update {
|
34 |
+
position: fixed;
|
35 |
display: flex;
|
36 |
+
top: -600px;
|
37 |
width: 100%;
|
38 |
justify-content: center;
|
39 |
z-index: var(--layer-top);
|
|
|
65 |
#release-note-wrap {
|
66 |
width: 100%;
|
67 |
max-width: 400px;
|
68 |
+
height: 240px;
|
69 |
border: solid 1px var(--border-color-primary);
|
70 |
+
overflow-y: auto;
|
71 |
+
overflow-x: hidden;
|
72 |
+
padding: 8px;
|
73 |
}
|
74 |
#release-note-wrap.hideK {
|
75 |
display: none;
|
|
|
207 |
position: relative !important;
|
208 |
border: none !important;
|
209 |
outline: none;
|
210 |
+
margin: 0;
|
211 |
width: 40px !important;
|
212 |
height: 22px !important;
|
213 |
border-radius: 11px !important;
|
|
|
243 |
left: 18px;
|
244 |
}
|
245 |
|
246 |
+
|
247 |
+
/* .scroll-shadow-left::before {
|
248 |
+
content: "";
|
249 |
+
position: absolute;
|
250 |
+
top: 0;
|
251 |
+
left: -6px;
|
252 |
+
width: 6px;
|
253 |
+
height: 100%;
|
254 |
+
box-shadow: 6px 0 10px rgba(0, 0, 0, 0.36);
|
255 |
+
z-index: 1;
|
256 |
+
}
|
257 |
+
|
258 |
+
.scroll-shadow-right::before {
|
259 |
+
content: "";
|
260 |
+
position: absolute;
|
261 |
+
top: 0;
|
262 |
+
right: -6px;
|
263 |
+
width: 6px;
|
264 |
+
height: 100%;
|
265 |
+
box-shadow: -6px 0 10px rgba(0, 0, 0, 0.36);
|
266 |
+
z-index: 1;
|
267 |
+
} */
|
268 |
+
|
269 |
+
|
270 |
+
.hr-line hr{
|
271 |
+
margin: 0 !important;
|
272 |
+
}
|
273 |
+
|
274 |
+
.tooltip-toggle {
|
275 |
+
cursor: help;
|
276 |
+
position: relative;
|
277 |
+
}
|
278 |
+
|
279 |
+
.tooltip-toggle::before {
|
280 |
+
position: absolute;
|
281 |
+
bottom: calc(100% + 12px);
|
282 |
+
left: calc(50% - 60px + 0.5rem);
|
283 |
+
background-color: #393939;
|
284 |
+
border-radius: 5px;
|
285 |
+
color: #fff;
|
286 |
+
content: attr(aria-label);
|
287 |
+
padding: 0.5rem;
|
288 |
+
text-transform: none;
|
289 |
+
transition: all 0.5s ease;
|
290 |
+
/* height: fit-content; */
|
291 |
+
white-space: normal;
|
292 |
+
width: 120px;
|
293 |
+
}
|
294 |
+
.tooltip-toggle::after {
|
295 |
+
position: absolute;
|
296 |
+
top: -12px;
|
297 |
+
left: 50%;
|
298 |
+
border-left: 5px solid transparent;
|
299 |
+
border-right: 5px solid transparent;
|
300 |
+
border-top: 5px solid #393939;
|
301 |
+
content: " ";
|
302 |
+
font-size: 0;
|
303 |
+
line-height: 0;
|
304 |
+
/* margin-left: -5px; */
|
305 |
+
width: 0;
|
306 |
+
}
|
307 |
+
|
308 |
+
|
309 |
+
.tooltip-toggle::before,
|
310 |
+
.tooltip-toggle::after {
|
311 |
+
color: #efefef;
|
312 |
+
/* font-family: monospace; */
|
313 |
+
/* font-size: 16px; */
|
314 |
+
opacity: 0;
|
315 |
+
pointer-events: none;
|
316 |
+
text-align: center;
|
317 |
+
}
|
318 |
+
|
319 |
+
.tooltip-toggle:focus::before,
|
320 |
+
.tooltip-toggle:focus::after,
|
321 |
+
.tooltip-toggle:hover::before,
|
322 |
+
.tooltip-toggle:hover::after {
|
323 |
+
opacity: 1;
|
324 |
+
transition: all 0.5s ease;
|
325 |
+
}
|
326 |
+
|
327 |
+
|
328 |
+
.nav-item-dropdown, .dropdown-trigger {
|
329 |
+
position: relative;
|
330 |
+
}
|
331 |
+
.nav-item-dropdown:hover>.dropdown-menu {
|
332 |
+
display: block;
|
333 |
+
opacity: 1;
|
334 |
+
}
|
335 |
+
.dropdown-trigger:focus+.dropdown-menu {
|
336 |
+
display: block;
|
337 |
+
opacity: 1;
|
338 |
+
}
|
339 |
+
.dropdown-menu {
|
340 |
+
background-color: var(--chatbot-input-more-background-solid-color);
|
341 |
+
display: inline-block;
|
342 |
+
/* text-align: right; */
|
343 |
+
position: absolute;
|
344 |
+
/* top: 2.5rem; */
|
345 |
+
left: 50%;
|
346 |
+
transform: translateX(-50%);
|
347 |
+
display: none;
|
348 |
+
opacity: 0;
|
349 |
+
transition: opacity 0.5s ease;
|
350 |
+
font-size: small;
|
351 |
+
width: auto;
|
352 |
+
border-radius: 5px;
|
353 |
+
box-shadow: var(--shadow-sm);
|
354 |
+
}
|
355 |
+
|
356 |
+
.dropdown-menu-item {
|
357 |
+
cursor: pointer;
|
358 |
+
padding: 8px 12px;
|
359 |
+
text-align: center;
|
360 |
+
white-space: nowrap;
|
361 |
+
margin: 0 !important;
|
362 |
+
}
|
363 |
+
.dropdown-menu-item button {
|
364 |
+
margin: 0 !important;
|
365 |
+
}
|
366 |
+
.dropdown-menu-item:hover {
|
367 |
+
background-color: var(--chatbot-input-more-background-mobilewidth-hover);
|
368 |
+
}
|
web_assets/stylesheet/override-gradio.css
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
/* 解决container=False时的错误填充 */
|
3 |
div.form {
|
@@ -5,15 +9,68 @@ div.form {
|
|
5 |
}
|
6 |
div.no-container {
|
7 |
padding: 10px 0 0 0 !important;
|
|
|
8 |
}
|
9 |
|
10 |
/* gradio的页脚信息 */
|
11 |
footer {
|
12 |
-
|
13 |
margin-top: .2em !important;
|
14 |
font-size: 85%;
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
/* 覆盖 gradio 丑陋的复制按钮样式 */
|
18 |
.message .code_wrap button[title="copy"] {
|
19 |
border-radius: 5px !important;
|
@@ -66,3 +123,35 @@ input[type=range]::-webkit-slider-runnable-track {
|
|
66 |
border: none;
|
67 |
background: transparent;
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.gradio-container {
|
2 |
+
max-width: unset !important;
|
3 |
+
padding: 0 !important;
|
4 |
+
}
|
5 |
|
6 |
/* 解决container=False时的错误填充 */
|
7 |
div.form {
|
|
|
9 |
}
|
10 |
div.no-container {
|
11 |
padding: 10px 0 0 0 !important;
|
12 |
+
background: none !important;
|
13 |
}
|
14 |
|
15 |
/* gradio的页脚信息 */
|
16 |
footer {
|
17 |
+
display: none !important;
|
18 |
margin-top: .2em !important;
|
19 |
font-size: 85%;
|
20 |
}
|
21 |
|
22 |
+
.api-docs-wrap {
|
23 |
+
margin-top: 64px;
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
/* 把radio做成列表 */
|
28 |
+
fieldset#history-select-dropdown .wrap {
|
29 |
+
gap: 0;
|
30 |
+
}
|
31 |
+
fieldset#history-select-dropdown .wrap label {
|
32 |
+
width: 100%;
|
33 |
+
background: none;
|
34 |
+
padding: 10px 16px 10px;
|
35 |
+
box-shadow: none;
|
36 |
+
justify-content: space-between;
|
37 |
+
}
|
38 |
+
fieldset#history-select-dropdown .wrap label:hover {
|
39 |
+
background: var(--message-list-background-hover);
|
40 |
+
}
|
41 |
+
fieldset#history-select-dropdown .wrap label:active {
|
42 |
+
background: var(--message-list-background-selected);
|
43 |
+
}
|
44 |
+
fieldset#history-select-dropdown .wrap label.selected {
|
45 |
+
color: var(--checkbox-label-text-color);
|
46 |
+
background: var(--message-list-background-selected);
|
47 |
+
padding: 10px 64px 10px 16px;
|
48 |
+
}
|
49 |
+
fieldset#history-select-dropdown .wrap label:not(.selected) .chat-selected-btns{
|
50 |
+
display: none;
|
51 |
+
}
|
52 |
+
fieldset#history-select-dropdown .wrap label > span {
|
53 |
+
/* font-size: small; */
|
54 |
+
margin-left: 0;
|
55 |
+
/* text-overflow: ellipsis; */
|
56 |
+
white-space: nowrap;
|
57 |
+
word-break: break-all;
|
58 |
+
overflow: hidden;
|
59 |
+
}
|
60 |
+
fieldset#history-select-dropdown .wrap label > span::before {
|
61 |
+
content: url("data:image/svg+xml,%3Csvg stroke='%23000000' fill='none' stroke-opacity='0.85' stroke-width='2' viewBox='0 0 24 24' stroke-linecap='round' stroke-linejoin='round' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'%3E%3C/path%3E%3C/svg%3E");
|
62 |
+
padding-right: .8em;
|
63 |
+
position: relative;
|
64 |
+
top: 4px;
|
65 |
+
}
|
66 |
+
.dark fieldset#history-select-dropdown .wrap label > span::before {
|
67 |
+
content: url("data:image/svg+xml,%3Csvg stroke='%23FFFFFF' fill='none' stroke-opacity='0.85' stroke-width='2' viewBox='0 0 24 24' stroke-linecap='round' stroke-linejoin='round' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'%3E%3C/path%3E%3C/svg%3E");
|
68 |
+
}
|
69 |
+
fieldset#history-select-dropdown .wrap label > input {
|
70 |
+
display: none;
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
/* 覆盖 gradio 丑陋的复制按钮样式 */
|
75 |
.message .code_wrap button[title="copy"] {
|
76 |
border-radius: 5px !important;
|
|
|
123 |
border: none;
|
124 |
background: transparent;
|
125 |
}
|
126 |
+
|
127 |
+
|
128 |
+
#chuanhu-chatbot>.wrapper>.wrap::-webkit-scrollbar {
|
129 |
+
height: 1rem;
|
130 |
+
width: 4px;
|
131 |
+
}
|
132 |
+
|
133 |
+
#chuanhu-chatbot>.wrapper>.wrap::-webkit-scrollbar-track {
|
134 |
+
background-color: transparent;
|
135 |
+
border-radius:9999px
|
136 |
+
}
|
137 |
+
|
138 |
+
#chuanhu-chatbot>.wrapper>.wrap::-webkit-scrollbar-thumb {
|
139 |
+
background-color: rgba(231, 231, 231, 0.8);
|
140 |
+
/* border-color: rgba(255, 255, 255, var(--tw-border-opacity)); */
|
141 |
+
border: none;
|
142 |
+
border-radius: 9999px;
|
143 |
+
/* border-width:1px */
|
144 |
+
}
|
145 |
+
|
146 |
+
#chuanhu-chatbot>.wrapper>.wrap::-webkit-scrollbar-thumb:hover {
|
147 |
+
--tw-bg-opacity: 1;
|
148 |
+
background-color:rgb(195, 195, 195);
|
149 |
+
}
|
150 |
+
|
151 |
+
.dark #chuanhu-chatbot>.wrapper>.wrap::-webkit-scrollbar-thumb {
|
152 |
+
background-color: rgba(56, 56, 56, 0.5);
|
153 |
+
}
|
154 |
+
|
155 |
+
.dark #chuanhu-chatbot>.wrapper>.wrap::-webkit-scrollbar-thumb:hover {
|
156 |
+
background-color: rgba(56, 56, 56, 0.8);
|
157 |
+
}
|