This view is limited to 50 files because it contains too many changes.  See the raw diff here.
Files changed (50) hide show
  1. CITATION.cff +0 -20
  2. ChuanhuChatbot.py +152 -801
  3. Dockerfile +0 -18
  4. LICENSE +0 -674
  5. README.md +8 -7
  6. app.py +177 -0
  7. assets/Kelpy-Codos.js +0 -76
  8. assets/custom.css +0 -468
  9. assets/custom.js +0 -502
  10. assets/external-scripts.js +0 -2
  11. assets/favicon.ico +0 -0
  12. assets/favicon.png +0 -0
  13. assets/html/appearance_switcher.html +0 -11
  14. assets/html/footer.html +0 -1
  15. chatgpt - macOS.command +0 -7
  16. chatgpt - windows.bat +0 -14
  17. config.json +0 -3
  18. config_example.json +0 -84
  19. configs/ds_config_chatbot.json +0 -17
  20. custom.css +0 -162
  21. history/2023-06-14_15-05-04.json +0 -0
  22. locale/en_US.json +0 -141
  23. locale/extract_locale.py +0 -138
  24. locale/ja_JP.json +0 -141
  25. locale/ko_KR.json +0 -141
  26. locale/ru_RU.json +0 -141
  27. locale/sv-SE.json +0 -87
  28. locale/sv_SE.json +0 -141
  29. locale/vi_VN.json +0 -141
  30. locale/zh_CN.json +0 -1
  31. modules/.DS_Store +0 -0
  32. modules/__init__.py +0 -0
  33. modules/__pycache__/__init__.cpython-311.pyc +0 -0
  34. modules/__pycache__/__init__.cpython-39.pyc +0 -0
  35. modules/__pycache__/base_model.cpython-311.pyc +0 -0
  36. modules/__pycache__/base_model.cpython-39.pyc +0 -0
  37. modules/__pycache__/chat_func.cpython-39.pyc +0 -0
  38. modules/__pycache__/config.cpython-311.pyc +0 -0
  39. modules/__pycache__/config.cpython-39.pyc +0 -0
  40. modules/__pycache__/index_func.cpython-311.pyc +0 -0
  41. modules/__pycache__/index_func.cpython-39.pyc +0 -0
  42. modules/__pycache__/llama_func.cpython-311.pyc +0 -0
  43. modules/__pycache__/llama_func.cpython-39.pyc +0 -0
  44. modules/__pycache__/models.cpython-311.pyc +0 -0
  45. modules/__pycache__/models.cpython-39.pyc +0 -0
  46. modules/__pycache__/openai_func.cpython-39.pyc +0 -0
  47. modules/__pycache__/overwrites.cpython-311.pyc +0 -0
  48. modules/__pycache__/overwrites.cpython-39.pyc +0 -0
  49. modules/__pycache__/pdf_func.cpython-311.pyc +0 -0
  50. modules/__pycache__/pdf_func.cpython-39.pyc +0 -0
CITATION.cff DELETED
@@ -1,20 +0,0 @@
1
- cff-version: 1.2.0
2
- title: Chuanhu Chat
3
- message: >-
4
- If you use this software, please cite it using these
5
- metadata.
6
- type: software
7
- authors:
8
- - given-names: Chuanhu
9
- orcid: https://orcid.org/0000-0001-8954-8598
10
- - given-names: MZhao
11
- orcid: https://orcid.org/0000-0003-2298-6213
12
- - given-names: Keldos
13
- orcid: https://orcid.org/0009-0005-0357-272X
14
- repository-code: 'https://github.com/GaiZhenbiao/ChuanhuChatGPT'
15
- url: 'https://github.com/GaiZhenbiao/ChuanhuChatGPT'
16
- abstract: This software provides a light and easy-to-use interface for ChatGPT API and many LLMs.
17
- license: GPL-3.0
18
- commit: c6c08bc62ef80e37c8be52f65f9b6051a7eea1fa
19
- version: '20230709'
20
- date-released: '2023-07-09'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ChuanhuChatbot.py CHANGED
@@ -1,808 +1,159 @@
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
- from modules.models.models import get_model
9
- from modules.train_func import *
10
- from modules.repo import *
11
- from modules.webui import *
12
- from modules.overwrites import *
13
- from modules.presets import *
14
- from modules.utils import *
15
- from modules.config import *
16
- from modules import config
17
  import gradio as gr
18
- import colorama
19
-
20
-
21
- logging.getLogger("httpx").setLevel(logging.WARNING)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- gr.Chatbot._postprocess_chat_messages = postprocess_chat_messages
24
  gr.Chatbot.postprocess = postprocess
25
 
26
- # with open("web_assets/css/ChuanhuChat.css", "r", encoding="utf-8") as f:
27
- # ChuanhuChatCSS = f.read()
28
-
29
-
30
- def create_new_model():
31
- return get_model(model_name=MODELS[DEFAULT_MODEL], access_key=my_api_key)[0]
32
-
33
-
34
- with gr.Blocks(theme=small_and_beautiful_theme) as demo:
35
- user_name = gr.Textbox("", visible=False)
36
- promptTemplates = gr.State(load_template(get_template_names()[0], mode=2))
37
- user_question = gr.State("")
38
- assert type(my_api_key) == str
39
- user_api_key = gr.State(my_api_key)
40
- current_model = gr.State()
41
-
42
- topic = gr.State(i18n("未命名对话历史记录"))
43
-
44
- with gr.Row(elem_id="chuanhu-header"):
45
- gr.HTML(get_html("header_title.html").format(
46
- app_title=CHUANHU_TITLE), elem_id="app-title")
47
- status_display = gr.Markdown(get_geoip(), elem_id="status-display")
48
- with gr.Row(elem_id="float-display"):
49
- user_info = gr.Markdown(
50
- value="getting user info...", elem_id="user-info")
51
- update_info = gr.HTML(get_html("update.html").format(
52
- current_version=repo_tag_html(),
53
- version_time=version_time(),
54
- cancel_btn=i18n("取消"),
55
- update_btn=i18n("更新"),
56
- seenew_btn=i18n("详情"),
57
- ok_btn=i18n("好"),
58
- ), visible=check_update)
59
-
60
- with gr.Row(equal_height=True, elem_id="chuanhu-body"):
61
-
62
- with gr.Column(elem_id="menu-area"):
63
- with gr.Column(elem_id="chuanhu-history"):
64
- with gr.Box():
65
- with gr.Row(elem_id="chuanhu-history-header"):
66
- with gr.Row(elem_id="chuanhu-history-search-row"):
67
- with gr.Column(min_width=150, scale=2):
68
- historySearchTextbox = gr.Textbox(show_label=False, container=False, placeholder=i18n(
69
- "搜索(支持正则)..."), lines=1, elem_id="history-search-tb")
70
- with gr.Column(min_width=52, scale=1, elem_id="gr-history-header-btns"):
71
- uploadFileBtn = gr.UploadButton(
72
- interactive=True, label="", file_types=[".json"], elem_id="gr-history-upload-btn")
73
- historyRefreshBtn = gr.Button("", elem_id="gr-history-refresh-btn")
74
-
75
-
76
- with gr.Row(elem_id="chuanhu-history-body"):
77
- with gr.Column(scale=6, elem_id="history-select-wrap"):
78
- historySelectList = gr.Radio(
79
- label=i18n("从列表中加载对话"),
80
- choices=get_history_names(),
81
- value=get_first_history_name(),
82
- # multiselect=False,
83
- container=False,
84
- elem_id="history-select-dropdown"
85
- )
86
- with gr.Row(visible=False):
87
- with gr.Column(min_width=42, scale=1):
88
- historyDeleteBtn = gr.Button(
89
- "🗑️", elem_id="gr-history-delete-btn")
90
- with gr.Column(min_width=42, scale=1):
91
- historyDownloadBtn = gr.Button(
92
- "⏬", elem_id="gr-history-download-btn")
93
- with gr.Column(min_width=42, scale=1):
94
- historyMarkdownDownloadBtn = gr.Button(
95
- "⤵️", elem_id="gr-history-mardown-download-btn")
96
- with gr.Row(visible=False):
97
- with gr.Column(scale=6):
98
- saveFileName = gr.Textbox(
99
- show_label=True,
100
- placeholder=i18n("设置文件名: 默认为.json,可选为.md"),
101
- label=i18n("设置保存文件名"),
102
- value=i18n("对话历史记录"),
103
- elem_classes="no-container"
104
- # container=False,
105
- )
106
- with gr.Column(scale=1):
107
- renameHistoryBtn = gr.Button(
108
- i18n("💾 保存对话"), elem_id="gr-history-save-btn")
109
- exportMarkdownBtn = gr.Button(
110
- i18n("📝 导出为 Markdown"), elem_id="gr-markdown-export-btn")
111
-
112
- with gr.Column(elem_id="chuanhu-menu-footer"):
113
- with gr.Row(elem_id="chuanhu-func-nav"):
114
- gr.HTML(get_html("func_nav.html"))
115
- # gr.HTML(get_html("footer.html").format(versions=versions_html()), elem_id="footer")
116
- # gr.Markdown(CHUANHU_DESCRIPTION, elem_id="chuanhu-author")
117
-
118
- with gr.Column(elem_id="chuanhu-area", scale=5):
119
- with gr.Column(elem_id="chatbot-area"):
120
- with gr.Row(elem_id="chatbot-header"):
121
- model_select_dropdown = gr.Dropdown(
122
- label=i18n("选择模型"), choices=MODELS, multiselect=False, value=MODELS[DEFAULT_MODEL], interactive=True,
123
- show_label=False, container=False, elem_id="model-select-dropdown"
124
- )
125
- lora_select_dropdown = gr.Dropdown(
126
- label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False,
127
- container=False,
128
- )
129
- gr.HTML(get_html("chatbot_header_btn.html").format(
130
- json_label=i18n("历史记录(JSON)"),
131
- md_label=i18n("导出为 Markdown")
132
- ), elem_id="chatbot-header-btn-bar")
133
- with gr.Row():
134
- chatbot = gr.Chatbot(
135
- label="Chuanhu Chat",
136
- elem_id="chuanhu-chatbot",
137
- latex_delimiters=latex_delimiters_set,
138
- sanitize_html=False,
139
- # height=700,
140
- show_label=False,
141
- avatar_images=[config.user_avatar, config.bot_avatar],
142
- show_share_button=False,
143
- )
144
- with gr.Row(elem_id="chatbot-footer"):
145
- with gr.Box(elem_id="chatbot-input-box"):
146
- with gr.Row(elem_id="chatbot-input-row"):
147
- gr.HTML(get_html("chatbot_more.html").format(
148
- single_turn_label=i18n("单轮对话"),
149
- websearch_label=i18n("在线搜索"),
150
- upload_file_label=i18n("上传文件"),
151
- uploaded_files_label=i18n("知识库文件"),
152
- uploaded_files_tip=i18n("在工具箱中管理知识库文件")
153
- ))
154
- with gr.Row(elem_id="chatbot-input-tb-row"):
155
- with gr.Column(min_width=225, scale=12):
156
- user_input = gr.Textbox(
157
- elem_id="user-input-tb",
158
- show_label=False,
159
- placeholder=i18n("在这里输入"),
160
- elem_classes="no-container",
161
- max_lines=5,
162
- # container=False
163
- )
164
- with gr.Column(min_width=42, scale=1, elem_id="chatbot-ctrl-btns"):
165
- submitBtn = gr.Button(
166
- value="", variant="primary", elem_id="submit-btn")
167
- cancelBtn = gr.Button(
168
- value="", variant="secondary", visible=False, elem_id="cancel-btn")
169
- # Note: Buttons below are set invisible in UI. But they are used in JS.
170
- with gr.Row(elem_id="chatbot-buttons", visible=False):
171
- with gr.Column(min_width=120, scale=1):
172
- emptyBtn = gr.Button(
173
- i18n("🧹 新的对话"), elem_id="empty-btn"
174
- )
175
- with gr.Column(min_width=120, scale=1):
176
- retryBtn = gr.Button(
177
- i18n("🔄 重新生成"), elem_id="gr-retry-btn")
178
- with gr.Column(min_width=120, scale=1):
179
- delFirstBtn = gr.Button(i18n("🗑️ 删除最旧对话"))
180
- with gr.Column(min_width=120, scale=1):
181
- delLastBtn = gr.Button(
182
- i18n("🗑️ 删除最新对话"), elem_id="gr-dellast-btn")
183
- with gr.Row(visible=False) as like_dislike_area:
184
- with gr.Column(min_width=20, scale=1):
185
- likeBtn = gr.Button(
186
- "👍", elem_id="gr-like-btn")
187
- with gr.Column(min_width=20, scale=1):
188
- dislikeBtn = gr.Button(
189
- "👎", elem_id="gr-dislike-btn")
190
-
191
- with gr.Column(elem_id="toolbox-area", scale=1):
192
- # For CSS setting, there is an extra box. Don't remove it.
193
- with gr.Box(elem_id="chuanhu-toolbox"):
194
- with gr.Row():
195
- gr.Markdown("## "+i18n("工具箱"))
196
- gr.HTML(get_html("close_btn.html").format(
197
- obj="toolbox"), elem_classes="close-btn")
198
- with gr.Tabs(elem_id="chuanhu-toolbox-tabs"):
199
- with gr.Tab(label=i18n("对话")):
200
- keyTxt = gr.Textbox(
201
- show_label=True,
202
- placeholder=f"Your API-key...",
203
- value=hide_middle_chars(user_api_key.value),
204
- type="password",
205
- visible=not HIDE_MY_KEY,
206
- label="API-Key",
207
- )
208
- with gr.Accordion(label="Prompt", open=True):
209
- systemPromptTxt = gr.Textbox(
210
- show_label=True,
211
- placeholder=i18n("在这里输入System Prompt..."),
212
- label="System prompt",
213
- value=INITIAL_SYSTEM_PROMPT,
214
- lines=8
215
- )
216
- retain_system_prompt_checkbox = gr.Checkbox(
217
- label=i18n("新建对话保留Prompt"), value=False, visible=True, elem_classes="switch-checkbox")
218
- with gr.Accordion(label=i18n("加载Prompt模板"), open=False):
219
- with gr.Column():
220
- with gr.Row():
221
- with gr.Column(scale=6):
222
- templateFileSelectDropdown = gr.Dropdown(
223
- label=i18n("选择Prompt模板集合文件"),
224
- choices=get_template_names(),
225
- multiselect=False,
226
- value=get_template_names()[0],
227
- container=False,
228
- )
229
- with gr.Column(scale=1):
230
- templateRefreshBtn = gr.Button(
231
- i18n("🔄 刷新"))
232
- with gr.Row():
233
- with gr.Column():
234
- templateSelectDropdown = gr.Dropdown(
235
- label=i18n("从Prompt模板中加载"),
236
- choices=load_template(
237
- get_template_names()[
238
- 0], mode=1
239
- ),
240
- multiselect=False,
241
- container=False,
242
- )
243
- gr.Markdown("---", elem_classes="hr-line")
244
- with gr.Accordion(label=i18n("知识库"), open=True):
245
- use_websearch_checkbox = gr.Checkbox(label=i18n(
246
- "使用在线搜索"), value=False, elem_classes="switch-checkbox", elem_id="gr-websearch-cb", visible=False)
247
- index_files = gr.Files(label=i18n(
248
- "上传"), type="file", file_types=[".pdf", ".docx", ".pptx", ".epub", ".xlsx", ".txt", "text", "image"], elem_id="upload-index-file")
249
- two_column = gr.Checkbox(label=i18n(
250
- "双栏pdf"), value=advance_docs["pdf"].get("two_column", False))
251
- summarize_btn = gr.Button(i18n("总结"))
252
- # TODO: 公式ocr
253
- # formula_ocr = gr.Checkbox(label=i18n("识别公式"), value=advance_docs["pdf"].get("formula_ocr", False))
254
-
255
- with gr.Tab(label=i18n("参数")):
256
- gr.Markdown(i18n("# ⚠️ 务必谨慎更改 ⚠️"),
257
- elem_id="advanced-warning")
258
- with gr.Accordion(i18n("参数"), open=True):
259
- temperature_slider = gr.Slider(
260
- minimum=-0,
261
- maximum=2.0,
262
- value=1.0,
263
- step=0.1,
264
- interactive=True,
265
- label="temperature",
266
- )
267
- top_p_slider = gr.Slider(
268
- minimum=-0,
269
- maximum=1.0,
270
- value=1.0,
271
- step=0.05,
272
- interactive=True,
273
- label="top-p",
274
- )
275
- n_choices_slider = gr.Slider(
276
- minimum=1,
277
- maximum=10,
278
- value=1,
279
- step=1,
280
- interactive=True,
281
- label="n choices",
282
- )
283
- stop_sequence_txt = gr.Textbox(
284
- show_label=True,
285
- placeholder=i18n("停止符,用英文逗号隔开..."),
286
- label="stop",
287
- value="",
288
- lines=1,
289
- )
290
- max_context_length_slider = gr.Slider(
291
- minimum=1,
292
- maximum=32768,
293
- value=2000,
294
- step=1,
295
- interactive=True,
296
- label="max context",
297
- )
298
- max_generation_slider = gr.Slider(
299
- minimum=1,
300
- maximum=32768,
301
- value=1000,
302
- step=1,
303
- interactive=True,
304
- label="max generations",
305
- )
306
- presence_penalty_slider = gr.Slider(
307
- minimum=-2.0,
308
- maximum=2.0,
309
- value=0.0,
310
- step=0.01,
311
- interactive=True,
312
- label="presence penalty",
313
- )
314
- frequency_penalty_slider = gr.Slider(
315
- minimum=-2.0,
316
- maximum=2.0,
317
- value=0.0,
318
- step=0.01,
319
- interactive=True,
320
- label="frequency penalty",
321
- )
322
- logit_bias_txt = gr.Textbox(
323
- show_label=True,
324
- placeholder=f"word:likelihood",
325
- label="logit bias",
326
- value="",
327
- lines=1,
328
- )
329
- user_identifier_txt = gr.Textbox(
330
- show_label=True,
331
- placeholder=i18n("用于定位滥用行为"),
332
- label=i18n("用户名"),
333
- value=user_name.value,
334
- lines=1,
335
- )
336
- with gr.Tab(label=i18n("拓展")):
337
- gr.Markdown(
338
- "Will be here soon...\n(We hope)\n\nAnd we hope you can help us to make more extensions!")
339
-
340
- # changeAPIURLBtn = gr.Button(i18n("🔄 切换API地址"))
341
-
342
- with gr.Row(elem_id="popup-wrapper"):
343
- with gr.Box(elem_id="chuanhu-popup"):
344
- with gr.Box(elem_id="chuanhu-setting"):
345
- with gr.Row():
346
- gr.Markdown("## "+i18n("设置"))
347
- gr.HTML(get_html("close_btn.html").format(
348
- obj="box"), elem_classes="close-btn")
349
- with gr.Tabs(elem_id="chuanhu-setting-tabs"):
350
- with gr.Tab(label=i18n("模型")):
351
- if multi_api_key:
352
- usageTxt = gr.Markdown(i18n(
353
- "多账号模式已开启,无需输入key,可直接开始对话"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
354
- else:
355
- usageTxt = gr.Markdown(i18n(
356
- "**发送消息** 或 **提交key** 以显示额度"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
357
- # model_select_dropdown = gr.Dropdown(
358
- # label=i18n("选择模型"), choices=MODELS, multiselect=False, value=MODELS[DEFAULT_MODEL], interactive=True
359
- # )
360
- # lora_select_dropdown = gr.Dropdown(
361
- # label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False
362
- # )
363
- # with gr.Row():
364
-
365
- language_select_dropdown = gr.Dropdown(
366
- label=i18n("选择回复语言(针对搜索&索引功能)"),
367
- choices=REPLY_LANGUAGES,
368
- multiselect=False,
369
- value=REPLY_LANGUAGES[0],
370
- )
371
-
372
- with gr.Tab(label=i18n("高级")):
373
- gr.HTML(get_html("appearance_switcher.html").format(
374
- label=i18n("切换亮暗色主题")), elem_classes="insert-block", visible=False)
375
- use_streaming_checkbox = gr.Checkbox(
376
- label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION, elem_classes="switch-checkbox"
377
- )
378
- name_chat_method = gr.Dropdown(
379
- label=i18n("对话命名方式"),
380
- choices=HISTORY_NAME_METHODS,
381
- multiselect=False,
382
- interactive=True,
383
- value=HISTORY_NAME_METHODS[chat_name_method_index],
384
- )
385
- single_turn_checkbox = gr.Checkbox(label=i18n(
386
- "单轮对话"), value=False, elem_classes="switch-checkbox", elem_id="gr-single-session-cb", visible=False)
387
- # checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."), visible=check_update)
388
-
389
- with gr.Tab(i18n("网络")):
390
- gr.Markdown(
391
- i18n("⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置"), elem_id="netsetting-warning")
392
- default_btn = gr.Button(i18n("🔙 恢复默认网络设置"))
393
- # 网络代理
394
- proxyTxt = gr.Textbox(
395
- show_label=True,
396
- placeholder=i18n("未设置代理..."),
397
- label=i18n("代理地址"),
398
- value=config.http_proxy,
399
- lines=1,
400
- interactive=False,
401
- # container=False,
402
- elem_classes="view-only-textbox no-container",
403
- )
404
- # changeProxyBtn = gr.Button(i18n("🔄 设置代理地址"))
405
-
406
- # 优先展示自定义的api_host
407
- apihostTxt = gr.Textbox(
408
- show_label=True,
409
- placeholder="api.openai.com",
410
- label="OpenAI API-Host",
411
- value=config.api_host or shared.API_HOST,
412
- lines=1,
413
- interactive=False,
414
- # container=False,
415
- elem_classes="view-only-textbox no-container",
416
- )
417
-
418
- with gr.Tab(label=i18n("关于"), elem_id="about-tab"):
419
- gr.Markdown(
420
- '<img alt="Chuanhu Chat logo" src="file=web_assets/icon/any-icon-512.png" style="max-width: 144px;">')
421
- gr.Markdown("# "+i18n("川虎Chat"))
422
- gr.HTML(get_html("footer.html").format(
423
- versions=versions_html()), elem_id="footer")
424
- gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
425
-
426
- with gr.Box(elem_id="chuanhu-training"):
427
- with gr.Row():
428
- gr.Markdown("## "+i18n("训练"))
429
- gr.HTML(get_html("close_btn.html").format(
430
- obj="box"), elem_classes="close-btn")
431
- with gr.Tabs(elem_id="chuanhu-training-tabs"):
432
- with gr.Tab(label="OpenAI "+i18n("微调")):
433
- openai_train_status = gr.Markdown(label=i18n("训练状态"), value=i18n(
434
- "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)"))
435
-
436
- with gr.Tab(label=i18n("准备数据集")):
437
- dataset_preview_json = gr.JSON(
438
- label=i18n("数据集预览"))
439
- dataset_selection = gr.Files(label=i18n("选择数据集"), file_types=[
440
- ".xlsx", ".jsonl"], file_count="single")
441
- upload_to_openai_btn = gr.Button(
442
- i18n("上传到OpenAI"), variant="primary", interactive=False)
443
-
444
- with gr.Tab(label=i18n("训练")):
445
- openai_ft_file_id = gr.Textbox(label=i18n(
446
- "文件ID"), value="", lines=1, placeholder=i18n("上传到 OpenAI 后自动填充"))
447
- openai_ft_suffix = gr.Textbox(label=i18n(
448
- "模型名称后缀"), value="", lines=1, placeholder=i18n("可选,用于区分不同的模型"))
449
- openai_train_epoch_slider = gr.Slider(label=i18n(
450
- "训练轮数(Epochs)"), minimum=1, maximum=100, value=3, step=1, interactive=True)
451
- openai_start_train_btn = gr.Button(
452
- i18n("开始训练"), variant="primary", interactive=False)
453
-
454
- with gr.Tab(label=i18n("状态")):
455
- openai_status_refresh_btn = gr.Button(i18n("刷新状态"))
456
- openai_cancel_all_jobs_btn = gr.Button(
457
- i18n("取消所有任务"))
458
- add_to_models_btn = gr.Button(
459
- i18n("添加训练好的模型到模型列表"), interactive=False)
460
-
461
- with gr.Box(elem_id="web-config", visible=False):
462
- gr.HTML(get_html('web_config.html').format(
463
- enableCheckUpdate_config=check_update,
464
- hideHistoryWhenNotLoggedIn_config=hide_history_when_not_logged_in,
465
- forView_i18n=i18n("仅供查看"),
466
- deleteConfirm_i18n_pref=i18n("你真的要删除 "),
467
- deleteConfirm_i18n_suff=i18n(" 吗?"),
468
- usingLatest_i18n=i18n("您使用的就是最新版!"),
469
- updatingMsg_i18n=i18n("正在尝试更新..."),
470
- updateSuccess_i18n=i18n("更新成功,请重启本程序"),
471
- updateFailure_i18n=i18n(
472
- "更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)"),
473
- regenerate_i18n=i18n("重新生成"),
474
- deleteRound_i18n=i18n("删除这轮问答"),
475
- renameChat_i18n=i18n("重命名该对话"),
476
- validFileName_i18n=i18n("请输入有效的文件名,不要包含以下特殊字符:"),
477
- ))
478
- with gr.Box(elem_id="fake-gradio-components", visible=False):
479
- updateChuanhuBtn = gr.Button(
480
- visible=False, elem_classes="invisible-btn", elem_id="update-chuanhu-btn")
481
- changeSingleSessionBtn = gr.Button(
482
- visible=False, elem_classes="invisible-btn", elem_id="change-single-session-btn")
483
- changeOnlineSearchBtn = gr.Button(
484
- visible=False, elem_classes="invisible-btn", elem_id="change-online-search-btn")
485
- historySelectBtn = gr.Button(
486
- visible=False, elem_classes="invisible-btn", elem_id="history-select-btn") # Not used
487
-
488
- # https://github.com/gradio-app/gradio/pull/3296
489
-
490
- def create_greeting(request: gr.Request):
491
- if hasattr(request, "username") and request.username: # is not None or is not ""
492
- logging.info(f"Get User Name: {request.username}")
493
- user_info, user_name = gr.Markdown.update(
494
- value=f"User: {request.username}"), request.username
495
- else:
496
- user_info, user_name = gr.Markdown.update(
497
- value=f"", visible=False), ""
498
- current_model = get_model(
499
- model_name=MODELS[DEFAULT_MODEL], access_key=my_api_key)[0]
500
- current_model.set_user_identifier(user_name)
501
- if not hide_history_when_not_logged_in or user_name:
502
- filename, system_prompt, chatbot = current_model.auto_load()
503
- else:
504
- system_prompt = gr.update()
505
- filename = gr.update()
506
- chatbot = gr.Chatbot.update(label=MODELS[DEFAULT_MODEL])
507
- return user_info, user_name, current_model, toggle_like_btn_visibility(DEFAULT_MODEL), filename, system_prompt, chatbot, init_history_list(user_name)
508
- demo.load(create_greeting, inputs=None, outputs=[
509
- user_info, user_name, current_model, like_dislike_area, saveFileName, systemPromptTxt, chatbot, historySelectList], api_name="load")
510
- chatgpt_predict_args = dict(
511
- fn=predict,
512
- inputs=[
513
- current_model,
514
- user_question,
515
- chatbot,
516
- use_streaming_checkbox,
517
- use_websearch_checkbox,
518
- index_files,
519
- language_select_dropdown,
520
- ],
521
- outputs=[chatbot, status_display],
522
- show_progress=True,
523
- )
524
-
525
- start_outputing_args = dict(
526
- fn=start_outputing,
527
- inputs=[],
528
- outputs=[submitBtn, cancelBtn],
529
- show_progress=True,
530
- )
531
-
532
- end_outputing_args = dict(
533
- fn=end_outputing, inputs=[], outputs=[submitBtn, cancelBtn]
534
- )
535
-
536
- reset_textbox_args = dict(
537
- fn=reset_textbox, inputs=[], outputs=[user_input]
538
- )
539
-
540
- transfer_input_args = dict(
541
- fn=transfer_input, inputs=[user_input], outputs=[
542
- user_question, user_input, submitBtn, cancelBtn], show_progress=True
543
- )
544
-
545
- get_usage_args = dict(
546
- fn=billing_info, inputs=[current_model], outputs=[
547
- usageTxt], show_progress=False
548
- )
549
-
550
- load_history_from_file_args = dict(
551
- fn=load_chat_history,
552
- inputs=[current_model, historySelectList, user_name],
553
- outputs=[saveFileName, systemPromptTxt, chatbot]
554
- )
555
-
556
- refresh_history_args = dict(
557
- fn=get_history_list, inputs=[user_name], outputs=[historySelectList]
558
- )
559
-
560
- auto_name_chat_history_args = dict(
561
- fn=auto_name_chat_history,
562
- inputs=[current_model, name_chat_method, user_question, chatbot, user_name, single_turn_checkbox],
563
- outputs=[historySelectList],
564
- show_progress=False,
565
- )
566
-
567
- # Chatbot
568
- cancelBtn.click(interrupt, [current_model], [])
569
-
570
- user_input.submit(**transfer_input_args).then(**
571
- chatgpt_predict_args).then(**end_outputing_args).then(**auto_name_chat_history_args)
572
- user_input.submit(**get_usage_args)
573
-
574
- # user_input.submit(auto_name_chat_history, [current_model, user_question, chatbot, user_name], [historySelectList], show_progress=False)
575
-
576
- submitBtn.click(**transfer_input_args).then(**chatgpt_predict_args,
577
- api_name="predict").then(**end_outputing_args).then(**auto_name_chat_history_args)
578
- submitBtn.click(**get_usage_args)
579
-
580
- # submitBtn.click(auto_name_chat_history, [current_model, user_question, chatbot, user_name], [historySelectList], show_progress=False)
581
-
582
- index_files.upload(handle_file_upload, [current_model, index_files, chatbot, language_select_dropdown], [
583
- index_files, chatbot, status_display])
584
- summarize_btn.click(handle_summarize_index, [
585
- current_model, index_files, chatbot, language_select_dropdown], [chatbot, status_display])
586
-
587
- emptyBtn.click(
588
- reset,
589
- inputs=[current_model, retain_system_prompt_checkbox],
590
- outputs=[chatbot, status_display, historySelectList, systemPromptTxt],
591
- show_progress=True,
592
- _js='(a,b)=>{return clearChatbot(a,b);}',
593
- )
594
-
595
- retryBtn.click(**start_outputing_args).then(
596
- retry,
597
- [
598
- current_model,
599
- chatbot,
600
- use_streaming_checkbox,
601
- use_websearch_checkbox,
602
- index_files,
603
- language_select_dropdown,
604
- ],
605
- [chatbot, status_display],
606
- show_progress=True,
607
- ).then(**end_outputing_args)
608
- retryBtn.click(**get_usage_args)
609
-
610
- delFirstBtn.click(
611
- delete_first_conversation,
612
- [current_model],
613
- [status_display],
614
- )
615
-
616
- delLastBtn.click(
617
- delete_last_conversation,
618
- [current_model, chatbot],
619
- [chatbot, status_display],
620
- show_progress=False
621
- )
622
-
623
- likeBtn.click(
624
- like,
625
- [current_model],
626
- [status_display],
627
- show_progress=False
628
- )
629
-
630
- dislikeBtn.click(
631
- dislike,
632
- [current_model],
633
- [status_display],
634
- show_progress=False
635
- )
636
-
637
- two_column.change(update_doc_config, [two_column], None)
638
-
639
- # LLM Models
640
- keyTxt.change(set_key, [current_model, keyTxt], [
641
- user_api_key, status_display], api_name="set_key").then(**get_usage_args)
642
- keyTxt.submit(**get_usage_args)
643
- single_turn_checkbox.change(
644
- set_single_turn, [current_model, single_turn_checkbox], None)
645
- model_select_dropdown.change(get_model, [model_select_dropdown, lora_select_dropdown, user_api_key, temperature_slider, top_p_slider, systemPromptTxt, user_name, current_model], [
646
- current_model, status_display, chatbot, lora_select_dropdown, user_api_key, keyTxt], show_progress=True, api_name="get_model")
647
- model_select_dropdown.change(toggle_like_btn_visibility, [model_select_dropdown], [
648
- like_dislike_area], show_progress=False)
649
- # model_select_dropdown.change(
650
- # toggle_file_type, [model_select_dropdown], [index_files], show_progress=False)
651
- lora_select_dropdown.change(get_model, [model_select_dropdown, lora_select_dropdown, user_api_key, temperature_slider,
652
- top_p_slider, systemPromptTxt, user_name, current_model], [current_model, status_display, chatbot], show_progress=True)
653
-
654
- # Template
655
- systemPromptTxt.change(set_system_prompt, [
656
- current_model, systemPromptTxt], None)
657
- templateRefreshBtn.click(get_template_dropdown, None, [
658
- templateFileSelectDropdown])
659
- templateFileSelectDropdown.input(
660
- load_template,
661
- [templateFileSelectDropdown],
662
- [promptTemplates, templateSelectDropdown],
663
- show_progress=True,
664
- )
665
- templateSelectDropdown.change(
666
- get_template_content,
667
- [promptTemplates, templateSelectDropdown, systemPromptTxt],
668
- [systemPromptTxt],
669
- show_progress=True,
670
- )
671
-
672
- # S&L
673
- renameHistoryBtn.click(
674
- rename_chat_history,
675
- [current_model, saveFileName, chatbot, user_name],
676
- [historySelectList],
677
- show_progress=True,
678
- _js='(a,b,c,d)=>{return saveChatHistory(a,b,c,d);}'
679
- )
680
- exportMarkdownBtn.click(
681
- export_markdown,
682
- [current_model, saveFileName, chatbot, user_name],
683
- [],
684
- show_progress=True,
685
- )
686
- historyRefreshBtn.click(**refresh_history_args)
687
- historyDeleteBtn.click(delete_chat_history, [current_model, historySelectList, user_name], [status_display, historySelectList, chatbot], _js='(a,b,c)=>{return showConfirmationDialog(a, b, c);}').then(
688
- reset,
689
- inputs=[current_model, retain_system_prompt_checkbox],
690
- outputs=[chatbot, status_display, historySelectList, systemPromptTxt],
691
- show_progress=True,
692
- _js='(a,b)=>{return clearChatbot(a,b);}',
693
- )
694
- historySelectList.input(**load_history_from_file_args)
695
- uploadFileBtn.upload(upload_chat_history, [current_model, uploadFileBtn, user_name], [
696
- saveFileName, systemPromptTxt, chatbot]).then(**refresh_history_args)
697
- historyDownloadBtn.click(None, [
698
- user_name, historySelectList], None, _js='(a,b)=>{return downloadHistory(a,b,".json");}')
699
- historyMarkdownDownloadBtn.click(None, [
700
- user_name, historySelectList], None, _js='(a,b)=>{return downloadHistory(a,b,".md");}')
701
- historySearchTextbox.input(
702
- filter_history,
703
- [user_name, historySearchTextbox],
704
- [historySelectList]
705
- )
706
-
707
- # Train
708
- dataset_selection.upload(handle_dataset_selection, dataset_selection, [
709
- dataset_preview_json, upload_to_openai_btn, openai_train_status])
710
- dataset_selection.clear(handle_dataset_clear, [], [
711
- dataset_preview_json, upload_to_openai_btn])
712
- upload_to_openai_btn.click(upload_to_openai, [dataset_selection], [
713
- openai_ft_file_id, openai_train_status], show_progress=True)
714
-
715
- openai_ft_file_id.change(lambda x: gr.update(interactive=True) if len(
716
- x) > 0 else gr.update(interactive=False), [openai_ft_file_id], [openai_start_train_btn])
717
- openai_start_train_btn.click(start_training, [
718
- openai_ft_file_id, openai_ft_suffix, openai_train_epoch_slider], [openai_train_status])
719
-
720
- openai_status_refresh_btn.click(get_training_status, [], [
721
- openai_train_status, add_to_models_btn])
722
- add_to_models_btn.click(add_to_models, [], [
723
- model_select_dropdown, openai_train_status], show_progress=True)
724
- openai_cancel_all_jobs_btn.click(
725
- cancel_all_jobs, [], [openai_train_status], show_progress=True)
726
-
727
- # Advanced
728
- max_context_length_slider.change(
729
- set_token_upper_limit, [current_model, max_context_length_slider], None)
730
- temperature_slider.change(
731
- set_temperature, [current_model, temperature_slider], None)
732
- top_p_slider.change(set_top_p, [current_model, top_p_slider], None)
733
- n_choices_slider.change(
734
- set_n_choices, [current_model, n_choices_slider], None)
735
- stop_sequence_txt.change(
736
- set_stop_sequence, [current_model, stop_sequence_txt], None)
737
- max_generation_slider.change(
738
- set_max_tokens, [current_model, max_generation_slider], None)
739
- presence_penalty_slider.change(
740
- set_presence_penalty, [current_model, presence_penalty_slider], None)
741
- frequency_penalty_slider.change(
742
- set_frequency_penalty, [current_model, frequency_penalty_slider], None)
743
- logit_bias_txt.change(
744
- set_logit_bias, [current_model, logit_bias_txt], None)
745
- user_identifier_txt.change(set_user_identifier, [
746
- current_model, user_identifier_txt], None)
747
-
748
- default_btn.click(
749
- reset_default, [], [apihostTxt, proxyTxt, status_display], show_progress=True
750
- )
751
- # changeAPIURLBtn.click(
752
- # change_api_host,
753
- # [apihostTxt],
754
- # [status_display],
755
- # show_progress=True,
756
- # )
757
- # changeProxyBtn.click(
758
- # change_proxy,
759
- # [proxyTxt],
760
- # [status_display],
761
- # show_progress=True,
762
- # )
763
- # checkUpdateBtn.click(fn=None, _js='manualCheckUpdate')
764
-
765
- # Invisible elements
766
- updateChuanhuBtn.click(
767
- update_chuanhu,
768
- [],
769
- [status_display],
770
- show_progress=True,
771
- )
772
- changeSingleSessionBtn.click(
773
- fn=lambda value: gr.Checkbox.update(value=value),
774
- inputs=[single_turn_checkbox],
775
- outputs=[single_turn_checkbox],
776
- _js='(a)=>{return bgChangeSingleSession(a);}'
777
- )
778
- changeOnlineSearchBtn.click(
779
- fn=lambda value: gr.Checkbox.update(value=value),
780
- inputs=[use_websearch_checkbox],
781
- outputs=[use_websearch_checkbox],
782
- _js='(a)=>{return bgChangeOnlineSearch(a);}'
783
- )
784
- historySelectBtn.click( # This is an experimental feature... Not actually used.
785
- fn=load_chat_history,
786
- inputs=[current_model, historySelectList],
787
- outputs=[saveFileName, systemPromptTxt, chatbot],
788
- _js='(a,b)=>{return bgSelectHistory(a,b);}'
789
- )
790
-
791
-
792
- logging.info(
793
- colorama.Back.GREEN
794
- + "\n川虎的温馨提示:访问 http://localhost:7860 查看界面"
795
- + colorama.Style.RESET_ALL
796
- )
797
  # 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
798
- demo.title = i18n("川虎Chat 🚀")
799
 
800
  if __name__ == "__main__":
801
- reload_javascript()
802
- demo.queue(concurrency_count=CONCURRENT_COUNT).launch(
803
- allowed_paths=["history", "web_assets"],
804
- share=share,
805
- auth=auth_from_conf if authflag else None,
806
- favicon_path="./web_assets/favicon.ico",
807
- inbrowser=not dockerflag, # 禁止在docker下开启inbrowser
808
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ # import openai
3
+ import os
4
+ import sys
5
+ import argparse
6
+ from utils import *
7
+ from presets import *
8
+
9
+
10
+ my_api_key = "" # 在这里输入你的 API 密钥
11
+
12
+ #if we are running in Docker
13
+ if os.environ.get('dockerrun') == 'yes':
14
+ dockerflag = True
15
+ else:
16
+ dockerflag = False
17
+
18
+ authflag = False
19
+
20
+ if dockerflag:
21
+ my_api_key = os.environ.get('my_api_key')
22
+ if my_api_key == "empty":
23
+ print("Please give a api key!")
24
+ sys.exit(1)
25
+ #auth
26
+ username = os.environ.get('USERNAME')
27
+ password = os.environ.get('PASSWORD')
28
+ if not (isinstance(username, type(None)) or isinstance(password, type(None))):
29
+ authflag = True
30
+ else:
31
+ if not my_api_key and os.path.exists("api_key.txt") and os.path.getsize("api_key.txt"):
32
+ with open("api_key.txt", "r") as f:
33
+ my_api_key = f.read().strip()
34
+ if os.path.exists("auth.json"):
35
+ with open("auth.json", "r") as f:
36
+ auth = json.load(f)
37
+ username = auth["username"]
38
+ password = auth["password"]
39
+ if username != "" and password != "":
40
+ authflag = True
41
 
 
42
  gr.Chatbot.postprocess = postprocess
43
 
44
+ with gr.Blocks(css=customCSS) as demo:
45
+ gr.HTML(title)
46
+ with gr.Row():
47
+ keyTxt = gr.Textbox(show_label=False, placeholder=f"在这里输入你的OpenAI API-key...",
48
+ value=my_api_key, type="password", visible=not HIDE_MY_KEY).style(container=True)
49
+ use_streaming_checkbox = gr.Checkbox(label="实时传输回答", value=True, visible=enable_streaming_option)
50
+ chatbot = gr.Chatbot() # .style(color_map=("#1D51EE", "#585A5B"))
51
+ history = gr.State([])
52
+ token_count = gr.State([])
53
+ promptTemplates = gr.State(load_template(get_template_names(plain=True)[0], mode=2))
54
+ TRUECOMSTANT = gr.State(True)
55
+ FALSECONSTANT = gr.State(False)
56
+ topic = gr.State("未命名对话历史记录")
57
+
58
+ with gr.Row():
59
+ with gr.Column(scale=12):
60
+ user_input = gr.Textbox(show_label=False, placeholder="在这里输入").style(
61
+ container=False)
62
+ with gr.Column(min_width=50, scale=1):
63
+ submitBtn = gr.Button("🚀", variant="primary")
64
+ with gr.Row():
65
+ emptyBtn = gr.Button("🧹 新的对话")
66
+ retryBtn = gr.Button("🔄 重新生成")
67
+ delLastBtn = gr.Button("🗑️ 删除最近一条对话")
68
+ reduceTokenBtn = gr.Button("♻️ 总结对话")
69
+ status_display = gr.Markdown("status: ready")
70
+ systemPromptTxt = gr.Textbox(show_label=True, placeholder=f"在这里输入System Prompt...",
71
+ label="System prompt", value=initial_prompt).style(container=True)
72
+ with gr.Accordion(label="加载Prompt模板", open=False):
73
+ with gr.Column():
74
+ with gr.Row():
75
+ with gr.Column(scale=6):
76
+ templateFileSelectDropdown = gr.Dropdown(label="选择Prompt模板集合文件", choices=get_template_names(plain=True), multiselect=False, value=get_template_names(plain=True)[0])
77
+ with gr.Column(scale=1):
78
+ templateRefreshBtn = gr.Button("🔄 刷新")
79
+ templaeFileReadBtn = gr.Button("📂 读入模板")
80
+ with gr.Row():
81
+ with gr.Column(scale=6):
82
+ templateSelectDropdown = gr.Dropdown(label="从Prompt模板中加载", choices=load_template(get_template_names(plain=True)[0], mode=1), multiselect=False, value=load_template(get_template_names(plain=True)[0], mode=1)[0])
83
+ with gr.Column(scale=1):
84
+ templateApplyBtn = gr.Button("⬇️ 应用")
85
+ with gr.Accordion(label="保存/加载对话历史记录", open=False):
86
+ with gr.Column():
87
+ with gr.Row():
88
+ with gr.Column(scale=6):
89
+ saveFileName = gr.Textbox(
90
+ show_label=True, placeholder=f"在这里输入保存的文件名...", label="设置保存文件名", value="对话历史记录").style(container=True)
91
+ with gr.Column(scale=1):
92
+ saveHistoryBtn = gr.Button("💾 保存对话")
93
+ with gr.Row():
94
+ with gr.Column(scale=6):
95
+ historyFileSelectDropdown = gr.Dropdown(label="从列表中加载对话", choices=get_history_names(plain=True), multiselect=False, value=get_history_names(plain=True)[0])
96
+ with gr.Column(scale=1):
97
+ historyRefreshBtn = gr.Button("🔄 刷新")
98
+ historyReadBtn = gr.Button("📂 读入对话")
99
+ #inputs, top_p, temperature, top_k, repetition_penalty
100
+ with gr.Accordion("参数", open=False):
101
+ top_p = gr.Slider(minimum=-0, maximum=1.0, value=1.0, step=0.05,
102
+ interactive=True, label="Top-p (nucleus sampling)",)
103
+ temperature = gr.Slider(minimum=-0, maximum=5.0, value=1.0,
104
+ step=0.1, interactive=True, label="Temperature",)
105
+ #top_k = gr.Slider( minimum=1, maximum=50, value=4, step=1, interactive=True, label="Top-k",)
106
+ #repetition_penalty = gr.Slider( minimum=0.1, maximum=3.0, value=1.03, step=0.01, interactive=True, label="Repetition Penalty", )
107
+ gr.Markdown(description)
108
+
109
+
110
+ user_input.submit(predict, [keyTxt, systemPromptTxt, history, user_input, chatbot, token_count, top_p, temperature, use_streaming_checkbox], [chatbot, history, status_display, token_count], show_progress=True)
111
+ user_input.submit(reset_textbox, [], [user_input])
112
+
113
+ submitBtn.click(predict, [keyTxt, systemPromptTxt, history, user_input, chatbot, token_count, top_p, temperature, use_streaming_checkbox], [chatbot, history, status_display, token_count], show_progress=True)
114
+ submitBtn.click(reset_textbox, [], [user_input])
115
+
116
+ emptyBtn.click(reset_state, outputs=[chatbot, history, token_count, status_display], show_progress=True)
117
+
118
+ retryBtn.click(retry, [keyTxt, systemPromptTxt, history, chatbot, token_count, top_p, temperature, use_streaming_checkbox], [chatbot, history, status_display, token_count], show_progress=True)
119
+
120
+ delLastBtn.click(delete_last_conversation, [chatbot, history, token_count, use_streaming_checkbox], [
121
+ chatbot, history, token_count, status_display], show_progress=True)
122
+
123
+ reduceTokenBtn.click(reduce_token_size, [keyTxt, systemPromptTxt, history, chatbot, token_count, top_p, temperature, use_streaming_checkbox], [chatbot, history, status_display, token_count], show_progress=True)
124
+
125
+ saveHistoryBtn.click(save_chat_history, [
126
+ saveFileName, systemPromptTxt, history, chatbot], None, show_progress=True)
127
+
128
+ saveHistoryBtn.click(get_history_names, None, [historyFileSelectDropdown])
129
+
130
+ historyRefreshBtn.click(get_history_names, None, [historyFileSelectDropdown])
131
+
132
+ historyReadBtn.click(load_chat_history, [historyFileSelectDropdown, systemPromptTxt, history, chatbot], [saveFileName, systemPromptTxt, history, chatbot], show_progress=True)
133
+
134
+ templateRefreshBtn.click(get_template_names, None, [templateFileSelectDropdown])
135
+
136
+ templaeFileReadBtn.click(load_template, [templateFileSelectDropdown], [promptTemplates, templateSelectDropdown], show_progress=True)
137
+
138
+ templateApplyBtn.click(get_template_content, [promptTemplates, templateSelectDropdown, systemPromptTxt], [systemPromptTxt], show_progress=True)
139
+
140
+ print("川虎的温馨提示:访问 http://localhost:7860 查看界面")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  # 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
142
+ demo.title = "川虎ChatGPT 🚀"
143
 
144
  if __name__ == "__main__":
145
+ #if running in Docker
146
+ if dockerflag:
147
+ if authflag:
148
+ demo.queue().launch(server_name="0.0.0.0", server_port=7860,auth=(username, password))
149
+ else:
150
+ demo.queue().launch(server_name="0.0.0.0", server_port=7860, share=False)
151
+ #if not running in Docker
152
+ else:
153
+ if authflag:
154
+ demo.queue().launch(share=False, auth=(username, password))
155
+ else:
156
+ demo.queue().launch(share=False) # 改为 share=True 可以创建公开分享链接
157
+ #demo.queue().launch(server_name="0.0.0.0", server_port=7860, share=False) # 可自定义端口
158
+ #demo.queue().launch(server_name="0.0.0.0", server_port=7860,auth=("在这里填写用户名", "在这里填写密码")) # 可设置用户名与密码
159
+ #demo.queue().launch(auth=("在这里填写用户名", "在这里填写密码")) # 适合Nginx反向代理
Dockerfile DELETED
@@ -1,18 +0,0 @@
1
- FROM python:3.9-slim-buster as builder
2
- RUN apt-get update \
3
- && apt-get install -y build-essential \
4
- && apt-get clean \
5
- && rm -rf /var/lib/apt/lists/*
6
- COPY requirements.txt .
7
- COPY requirements_advanced.txt .
8
- RUN pip install --user --no-cache-dir -r requirements.txt
9
- # RUN pip install --user --no-cache-dir -r requirements_advanced.txt
10
-
11
- FROM python:3.9-slim-buster
12
- LABEL maintainer="iskoldt"
13
- COPY --from=builder /root/.local /root/.local
14
- ENV PATH=/root/.local/bin:$PATH
15
- COPY . /app
16
- WORKDIR /app
17
- ENV dockerrun=yes
18
- CMD ["python3", "-u", "ChuanhuChatbot.py","2>&1", "|", "tee", "/var/log/application.log"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
LICENSE DELETED
@@ -1,674 +0,0 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
- Preamble
9
-
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
12
-
13
- The licenses for most software and other practical works are designed
14
- to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
- share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- them if you wish), that you receive source code or can get it if you
26
- want it, that you can change the software or use pieces of it in new
27
- free programs, and that you know you can do these things.
28
-
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
67
-
68
- The precise terms and conditions for copying, distribution and
69
- modification follow.
70
-
71
- TERMS AND CONDITIONS
72
-
73
- 0. Definitions.
74
-
75
- "This License" refers to version 3 of the GNU General Public License.
76
-
77
- "Copyright" also means copyright-like laws that apply to other kinds of
78
- works, such as semiconductor masks.
79
-
80
- "The Program" refers to any copyrightable work licensed under this
81
- License. Each licensee is addressed as "you". "Licensees" and
82
- "recipients" may be individuals or organizations.
83
-
84
- To "modify" a work means to copy from or adapt all or part of the work
85
- in a fashion requiring copyright permission, other than the making of an
86
- exact copy. The resulting work is called a "modified version" of the
87
- earlier work or a work "based on" the earlier work.
88
-
89
- A "covered work" means either the unmodified Program or a work based
90
- on the Program.
91
-
92
- To "propagate" a work means to do anything with it that, without
93
- permission, would make you directly or secondarily liable for
94
- infringement under applicable copyright law, except executing it on a
95
- computer or modifying a private copy. Propagation includes copying,
96
- distribution (with or without modification), making available to the
97
- public, and in some countries other activities as well.
98
-
99
- To "convey" a work means any kind of propagation that enables other
100
- parties to make or receive copies. Mere interaction with a user through
101
- a computer network, with no transfer of a copy, is not conveying.
102
-
103
- An interactive user interface displays "Appropriate Legal Notices"
104
- to the extent that it includes a convenient and prominently visible
105
- feature that (1) displays an appropriate copyright notice, and (2)
106
- tells the user that there is no warranty for the work (except to the
107
- extent that warranties are provided), that licensees may convey the
108
- work under this License, and how to view a copy of this License. If
109
- the interface presents a list of user commands or options, such as a
110
- menu, a prominent item in the list meets this criterion.
111
-
112
- 1. Source Code.
113
-
114
- The "source code" for a work means the preferred form of the work
115
- for making modifications to it. "Object code" means any non-source
116
- form of a work.
117
-
118
- A "Standard Interface" means an interface that either is an official
119
- standard defined by a recognized standards body, or, in the case of
120
- interfaces specified for a particular programming language, one that
121
- is widely used among developers working in that language.
122
-
123
- The "System Libraries" of an executable work include anything, other
124
- than the work as a whole, that (a) is included in the normal form of
125
- packaging a Major Component, but which is not part of that Major
126
- Component, and (b) serves only to enable use of the work with that
127
- Major Component, or to implement a Standard Interface for which an
128
- implementation is available to the public in source code form. A
129
- "Major Component", in this context, means a major essential component
130
- (kernel, window system, and so on) of the specific operating system
131
- (if any) on which the executable work runs, or a compiler used to
132
- produce the work, or an object code interpreter used to run it.
133
-
134
- The "Corresponding Source" for a work in object code form means all
135
- the source code needed to generate, install, and (for an executable
136
- work) run the object code and to modify the work, including scripts to
137
- control those activities. However, it does not include the work's
138
- System Libraries, or general-purpose tools or generally available free
139
- programs which are used unmodified in performing those activities but
140
- which are not part of the work. For example, Corresponding Source
141
- includes interface definition files associated with source files for
142
- the work, and the source code for shared libraries and dynamically
143
- linked subprograms that the work is specifically designed to require,
144
- such as by intimate data communication or control flow between those
145
- subprograms and other parts of the work.
146
-
147
- The Corresponding Source need not include anything that users
148
- can regenerate automatically from other parts of the Corresponding
149
- Source.
150
-
151
- The Corresponding Source for a work in source code form is that
152
- same work.
153
-
154
- 2. Basic Permissions.
155
-
156
- All rights granted under this License are granted for the term of
157
- copyright on the Program, and are irrevocable provided the stated
158
- conditions are met. This License explicitly affirms your unlimited
159
- permission to run the unmodified Program. The output from running a
160
- covered work is covered by this License only if the output, given its
161
- content, constitutes a covered work. This License acknowledges your
162
- rights of fair use or other equivalent, as provided by copyright law.
163
-
164
- You may make, run and propagate covered works that you do not
165
- convey, without conditions so long as your license otherwise remains
166
- in force. You may convey covered works to others for the sole purpose
167
- of having them make modifications exclusively for you, or provide you
168
- with facilities for running those works, provided that you comply with
169
- the terms of this License in conveying all material for which you do
170
- not control copyright. Those thus making or running the covered works
171
- for you must do so exclusively on your behalf, under your direction
172
- and control, on terms that prohibit them from making any copies of
173
- your copyrighted material outside their relationship with you.
174
-
175
- Conveying under any other circumstances is permitted solely under
176
- the conditions stated below. Sublicensing is not allowed; section 10
177
- makes it unnecessary.
178
-
179
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
-
181
- No covered work shall be deemed part of an effective technological
182
- measure under any applicable law fulfilling obligations under article
183
- 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
- similar laws prohibiting or restricting circumvention of such
185
- measures.
186
-
187
- When you convey a covered work, you waive any legal power to forbid
188
- circumvention of technological measures to the extent such circumvention
189
- is effected by exercising rights under this License with respect to
190
- the covered work, and you disclaim any intention to limit operation or
191
- modification of the work as a means of enforcing, against the work's
192
- users, your or third parties' legal rights to forbid circumvention of
193
- technological measures.
194
-
195
- 4. Conveying Verbatim Copies.
196
-
197
- You may convey verbatim copies of the Program's source code as you
198
- receive it, in any medium, provided that you conspicuously and
199
- appropriately publish on each copy an appropriate copyright notice;
200
- keep intact all notices stating that this License and any
201
- non-permissive terms added in accord with section 7 apply to the code;
202
- keep intact all notices of the absence of any warranty; and give all
203
- recipients a copy of this License along with the Program.
204
-
205
- You may charge any price or no price for each copy that you convey,
206
- and you may offer support or warranty protection for a fee.
207
-
208
- 5. Conveying Modified Source Versions.
209
-
210
- You may convey a work based on the Program, or the modifications to
211
- produce it from the Program, in the form of source code under the
212
- terms of section 4, provided that you also meet all of these conditions:
213
-
214
- a) The work must carry prominent notices stating that you modified
215
- it, and giving a relevant date.
216
-
217
- b) The work must carry prominent notices stating that it is
218
- released under this License and any conditions added under section
219
- 7. This requirement modifies the requirement in section 4 to
220
- "keep intact all notices".
221
-
222
- c) You must license the entire work, as a whole, under this
223
- License to anyone who comes into possession of a copy. This
224
- License will therefore apply, along with any applicable section 7
225
- additional terms, to the whole of the work, and all its parts,
226
- regardless of how they are packaged. This License gives no
227
- permission to license the work in any other way, but it does not
228
- invalidate such permission if you have separately received it.
229
-
230
- d) If the work has interactive user interfaces, each must display
231
- Appropriate Legal Notices; however, if the Program has interactive
232
- interfaces that do not display Appropriate Legal Notices, your
233
- work need not make them do so.
234
-
235
- A compilation of a covered work with other separate and independent
236
- works, which are not by their nature extensions of the covered work,
237
- and which are not combined with it such as to form a larger program,
238
- in or on a volume of a storage or distribution medium, is called an
239
- "aggregate" if the compilation and its resulting copyright are not
240
- used to limit the access or legal rights of the compilation's users
241
- beyond what the individual works permit. Inclusion of a covered work
242
- in an aggregate does not cause this License to apply to the other
243
- parts of the aggregate.
244
-
245
- 6. Conveying Non-Source Forms.
246
-
247
- You may convey a covered work in object code form under the terms
248
- of sections 4 and 5, provided that you also convey the
249
- machine-readable Corresponding Source under the terms of this License,
250
- in one of these ways:
251
-
252
- a) Convey the object code in, or embodied in, a physical product
253
- (including a physical distribution medium), accompanied by the
254
- Corresponding Source fixed on a durable physical medium
255
- customarily used for software interchange.
256
-
257
- b) Convey the object code in, or embodied in, a physical product
258
- (including a physical distribution medium), accompanied by a
259
- written offer, valid for at least three years and valid for as
260
- long as you offer spare parts or customer support for that product
261
- model, to give anyone who possesses the object code either (1) a
262
- copy of the Corresponding Source for all the software in the
263
- product that is covered by this License, on a durable physical
264
- medium customarily used for software interchange, for a price no
265
- more than your reasonable cost of physically performing this
266
- conveying of source, or (2) access to copy the
267
- Corresponding Source from a network server at no charge.
268
-
269
- c) Convey individual copies of the object code with a copy of the
270
- written offer to provide the Corresponding Source. This
271
- alternative is allowed only occasionally and noncommercially, and
272
- only if you received the object code with such an offer, in accord
273
- with subsection 6b.
274
-
275
- d) Convey the object code by offering access from a designated
276
- place (gratis or for a charge), and offer equivalent access to the
277
- Corresponding Source in the same way through the same place at no
278
- further charge. You need not require recipients to copy the
279
- Corresponding Source along with the object code. If the place to
280
- copy the object code is a network server, the Corresponding Source
281
- may be on a different server (operated by you or a third party)
282
- that supports equivalent copying facilities, provided you maintain
283
- clear directions next to the object code saying where to find the
284
- Corresponding Source. Regardless of what server hosts the
285
- Corresponding Source, you remain obligated to ensure that it is
286
- available for as long as needed to satisfy these requirements.
287
-
288
- e) Convey the object code using peer-to-peer transmission, provided
289
- you inform other peers where the object code and Corresponding
290
- Source of the work are being offered to the general public at no
291
- charge under subsection 6d.
292
-
293
- A separable portion of the object code, whose source code is excluded
294
- from the Corresponding Source as a System Library, need not be
295
- included in conveying the object code work.
296
-
297
- A "User Product" is either (1) a "consumer product", which means any
298
- tangible personal property which is normally used for personal, family,
299
- or household purposes, or (2) anything designed or sold for incorporation
300
- into a dwelling. In determining whether a product is a consumer product,
301
- doubtful cases shall be resolved in favor of coverage. For a particular
302
- product received by a particular user, "normally used" refers to a
303
- typical or common use of that class of product, regardless of the status
304
- of the particular user or of the way in which the particular user
305
- actually uses, or expects or is expected to use, the product. A product
306
- is a consumer product regardless of whether the product has substantial
307
- commercial, industrial or non-consumer uses, unless such uses represent
308
- the only significant mode of use of the product.
309
-
310
- "Installation Information" for a User Product means any methods,
311
- procedures, authorization keys, or other information required to install
312
- and execute modified versions of a covered work in that User Product from
313
- a modified version of its Corresponding Source. The information must
314
- suffice to ensure that the continued functioning of the modified object
315
- code is in no case prevented or interfered with solely because
316
- modification has been made.
317
-
318
- If you convey an object code work under this section in, or with, or
319
- specifically for use in, a User Product, and the conveying occurs as
320
- part of a transaction in which the right of possession and use of the
321
- User Product is transferred to the recipient in perpetuity or for a
322
- fixed term (regardless of how the transaction is characterized), the
323
- Corresponding Source conveyed under this section must be accompanied
324
- by the Installation Information. But this requirement does not apply
325
- if neither you nor any third party retains the ability to install
326
- modified object code on the User Product (for example, the work has
327
- been installed in ROM).
328
-
329
- The requirement to provide Installation Information does not include a
330
- requirement to continue to provide support service, warranty, or updates
331
- for a work that has been modified or installed by the recipient, or for
332
- the User Product in which it has been modified or installed. Access to a
333
- network may be denied when the modification itself materially and
334
- adversely affects the operation of the network or violates the rules and
335
- protocols for communication across the network.
336
-
337
- Corresponding Source conveyed, and Installation Information provided,
338
- in accord with this section must be in a format that is publicly
339
- documented (and with an implementation available to the public in
340
- source code form), and must require no special password or key for
341
- unpacking, reading or copying.
342
-
343
- 7. Additional Terms.
344
-
345
- "Additional permissions" are terms that supplement the terms of this
346
- License by making exceptions from one or more of its conditions.
347
- Additional permissions that are applicable to the entire Program shall
348
- be treated as though they were included in this License, to the extent
349
- that they are valid under applicable law. If additional permissions
350
- apply only to part of the Program, that part may be used separately
351
- under those permissions, but the entire Program remains governed by
352
- this License without regard to the additional permissions.
353
-
354
- When you convey a copy of a covered work, you may at your option
355
- remove any additional permissions from that copy, or from any part of
356
- it. (Additional permissions may be written to require their own
357
- removal in certain cases when you modify the work.) You may place
358
- additional permissions on material, added by you to a covered work,
359
- for which you have or can give appropriate copyright permission.
360
-
361
- Notwithstanding any other provision of this License, for material you
362
- add to a covered work, you may (if authorized by the copyright holders of
363
- that material) supplement the terms of this License with terms:
364
-
365
- a) Disclaiming warranty or limiting liability differently from the
366
- terms of sections 15 and 16 of this License; or
367
-
368
- b) Requiring preservation of specified reasonable legal notices or
369
- author attributions in that material or in the Appropriate Legal
370
- Notices displayed by works containing it; or
371
-
372
- c) Prohibiting misrepresentation of the origin of that material, or
373
- requiring that modified versions of such material be marked in
374
- reasonable ways as different from the original version; or
375
-
376
- d) Limiting the use for publicity purposes of names of licensors or
377
- authors of the material; or
378
-
379
- e) Declining to grant rights under trademark law for use of some
380
- trade names, trademarks, or service marks; or
381
-
382
- f) Requiring indemnification of licensors and authors of that
383
- material by anyone who conveys the material (or modified versions of
384
- it) with contractual assumptions of liability to the recipient, for
385
- any liability that these contractual assumptions directly impose on
386
- those licensors and authors.
387
-
388
- All other non-permissive additional terms are considered "further
389
- restrictions" within the meaning of section 10. If the Program as you
390
- received it, or any part of it, contains a notice stating that it is
391
- governed by this License along with a term that is a further
392
- restriction, you may remove that term. If a license document contains
393
- a further restriction but permits relicensing or conveying under this
394
- License, you may add to a covered work material governed by the terms
395
- of that license document, provided that the further restriction does
396
- not survive such relicensing or conveying.
397
-
398
- If you add terms to a covered work in accord with this section, you
399
- must place, in the relevant source files, a statement of the
400
- additional terms that apply to those files, or a notice indicating
401
- where to find the applicable terms.
402
-
403
- Additional terms, permissive or non-permissive, may be stated in the
404
- form of a separately written license, or stated as exceptions;
405
- the above requirements apply either way.
406
-
407
- 8. Termination.
408
-
409
- You may not propagate or modify a covered work except as expressly
410
- provided under this License. Any attempt otherwise to propagate or
411
- modify it is void, and will automatically terminate your rights under
412
- this License (including any patent licenses granted under the third
413
- paragraph of section 11).
414
-
415
- However, if you cease all violation of this License, then your
416
- license from a particular copyright holder is reinstated (a)
417
- provisionally, unless and until the copyright holder explicitly and
418
- finally terminates your license, and (b) permanently, if the copyright
419
- holder fails to notify you of the violation by some reasonable means
420
- prior to 60 days after the cessation.
421
-
422
- Moreover, your license from a particular copyright holder is
423
- reinstated permanently if the copyright holder notifies you of the
424
- violation by some reasonable means, this is the first time you have
425
- received notice of violation of this License (for any work) from that
426
- copyright holder, and you cure the violation prior to 30 days after
427
- your receipt of the notice.
428
-
429
- Termination of your rights under this section does not terminate the
430
- licenses of parties who have received copies or rights from you under
431
- this License. If your rights have been terminated and not permanently
432
- reinstated, you do not qualify to receive new licenses for the same
433
- material under section 10.
434
-
435
- 9. Acceptance Not Required for Having Copies.
436
-
437
- You are not required to accept this License in order to receive or
438
- run a copy of the Program. Ancillary propagation of a covered work
439
- occurring solely as a consequence of using peer-to-peer transmission
440
- to receive a copy likewise does not require acceptance. However,
441
- nothing other than this License grants you permission to propagate or
442
- modify any covered work. These actions infringe copyright if you do
443
- not accept this License. Therefore, by modifying or propagating a
444
- covered work, you indicate your acceptance of this License to do so.
445
-
446
- 10. Automatic Licensing of Downstream Recipients.
447
-
448
- Each time you convey a covered work, the recipient automatically
449
- receives a license from the original licensors, to run, modify and
450
- propagate that work, subject to this License. You are not responsible
451
- for enforcing compliance by third parties with this License.
452
-
453
- An "entity transaction" is a transaction transferring control of an
454
- organization, or substantially all assets of one, or subdividing an
455
- organization, or merging organizations. If propagation of a covered
456
- work results from an entity transaction, each party to that
457
- transaction who receives a copy of the work also receives whatever
458
- licenses to the work the party's predecessor in interest had or could
459
- give under the previous paragraph, plus a right to possession of the
460
- Corresponding Source of the work from the predecessor in interest, if
461
- the predecessor has it or can get it with reasonable efforts.
462
-
463
- You may not impose any further restrictions on the exercise of the
464
- rights granted or affirmed under this License. For example, you may
465
- not impose a license fee, royalty, or other charge for exercise of
466
- rights granted under this License, and you may not initiate litigation
467
- (including a cross-claim or counterclaim in a lawsuit) alleging that
468
- any patent claim is infringed by making, using, selling, offering for
469
- sale, or importing the Program or any portion of it.
470
-
471
- 11. Patents.
472
-
473
- A "contributor" is a copyright holder who authorizes use under this
474
- License of the Program or a work on which the Program is based. The
475
- work thus licensed is called the contributor's "contributor version".
476
-
477
- A contributor's "essential patent claims" are all patent claims
478
- owned or controlled by the contributor, whether already acquired or
479
- hereafter acquired, that would be infringed by some manner, permitted
480
- by this License, of making, using, or selling its contributor version,
481
- but do not include claims that would be infringed only as a
482
- consequence of further modification of the contributor version. For
483
- purposes of this definition, "control" includes the right to grant
484
- patent sublicenses in a manner consistent with the requirements of
485
- this License.
486
-
487
- Each contributor grants you a non-exclusive, worldwide, royalty-free
488
- patent license under the contributor's essential patent claims, to
489
- make, use, sell, offer for sale, import and otherwise run, modify and
490
- propagate the contents of its contributor version.
491
-
492
- In the following three paragraphs, a "patent license" is any express
493
- agreement or commitment, however denominated, not to enforce a patent
494
- (such as an express permission to practice a patent or covenant not to
495
- sue for patent infringement). To "grant" such a patent license to a
496
- party means to make such an agreement or commitment not to enforce a
497
- patent against the party.
498
-
499
- If you convey a covered work, knowingly relying on a patent license,
500
- and the Corresponding Source of the work is not available for anyone
501
- to copy, free of charge and under the terms of this License, through a
502
- publicly available network server or other readily accessible means,
503
- then you must either (1) cause the Corresponding Source to be so
504
- available, or (2) arrange to deprive yourself of the benefit of the
505
- patent license for this particular work, or (3) arrange, in a manner
506
- consistent with the requirements of this License, to extend the patent
507
- license to downstream recipients. "Knowingly relying" means you have
508
- actual knowledge that, but for the patent license, your conveying the
509
- covered work in a country, or your recipient's use of the covered work
510
- in a country, would infringe one or more identifiable patents in that
511
- country that you have reason to believe are valid.
512
-
513
- If, pursuant to or in connection with a single transaction or
514
- arrangement, you convey, or propagate by procuring conveyance of, a
515
- covered work, and grant a patent license to some of the parties
516
- receiving the covered work authorizing them to use, propagate, modify
517
- or convey a specific copy of the covered work, then the patent license
518
- you grant is automatically extended to all recipients of the covered
519
- work and works based on it.
520
-
521
- A patent license is "discriminatory" if it does not include within
522
- the scope of its coverage, prohibits the exercise of, or is
523
- conditioned on the non-exercise of one or more of the rights that are
524
- specifically granted under this License. You may not convey a covered
525
- work if you are a party to an arrangement with a third party that is
526
- in the business of distributing software, under which you make payment
527
- to the third party based on the extent of your activity of conveying
528
- the work, and under which the third party grants, to any of the
529
- parties who would receive the covered work from you, a discriminatory
530
- patent license (a) in connection with copies of the covered work
531
- conveyed by you (or copies made from those copies), or (b) primarily
532
- for and in connection with specific products or compilations that
533
- contain the covered work, unless you entered into that arrangement,
534
- or that patent license was granted, prior to 28 March 2007.
535
-
536
- Nothing in this License shall be construed as excluding or limiting
537
- any implied license or other defenses to infringement that may
538
- otherwise be available to you under applicable patent law.
539
-
540
- 12. No Surrender of Others' Freedom.
541
-
542
- If conditions are imposed on you (whether by court order, agreement or
543
- otherwise) that contradict the conditions of this License, they do not
544
- excuse you from the conditions of this License. If you cannot convey a
545
- covered work so as to satisfy simultaneously your obligations under this
546
- License and any other pertinent obligations, then as a consequence you may
547
- not convey it at all. For example, if you agree to terms that obligate you
548
- to collect a royalty for further conveying from those to whom you convey
549
- the Program, the only way you could satisfy both those terms and this
550
- License would be to refrain entirely from conveying the Program.
551
-
552
- 13. Use with the GNU Affero General Public License.
553
-
554
- Notwithstanding any other provision of this License, you have
555
- permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
557
- combined work, and to convey the resulting work. The terms of this
558
- License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
562
-
563
- 14. Revised Versions of this License.
564
-
565
- The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
568
- address new problems or concerns.
569
-
570
- Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
572
- Public License "or any later version" applies to it, you have the
573
- option of following the terms and conditions either of that numbered
574
- version or of any later version published by the Free Software
575
- Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
577
- by the Free Software Foundation.
578
-
579
- If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
581
- public statement of acceptance of a version permanently authorizes you
582
- to choose that version for the Program.
583
-
584
- Later license versions may give you additional or different
585
- permissions. However, no additional obligations are imposed on any
586
- author or copyright holder as a result of your choosing to follow a
587
- later version.
588
-
589
- 15. Disclaimer of Warranty.
590
-
591
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
- APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
- HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
- OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
- IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
-
600
- 16. Limitation of Liability.
601
-
602
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
- THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
- GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
- USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
- PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
- EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
- SUCH DAMAGES.
611
-
612
- 17. Interpretation of Sections 15 and 16.
613
-
614
- If the disclaimer of warranty and limitation of liability provided
615
- above cannot be given local legal effect according to their terms,
616
- reviewing courts shall apply local law that most closely approximates
617
- an absolute waiver of all civil liability in connection with the
618
- Program, unless a warranty or assumption of liability accompanies a
619
- copy of the Program in return for a fee.
620
-
621
- END OF TERMS AND CONDITIONS
622
-
623
- How to Apply These Terms to Your New Programs
624
-
625
- If you develop a new program, and you want it to be of the greatest
626
- possible use to the public, the best way to achieve this is to make it
627
- free software which everyone can redistribute and change under these terms.
628
-
629
- To do so, attach the following notices to the program. It is safest
630
- to attach them to the start of each source file to most effectively
631
- state the exclusion of warranty; and each file should have at least
632
- the "copyright" line and a pointer to where the full notice is found.
633
-
634
- <one line to give the program's name and a brief idea of what it does.>
635
- Copyright (C) <year> <name of author>
636
-
637
- This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
639
- the Free Software Foundation, either version 3 of the License, or
640
- (at your option) any later version.
641
-
642
- This program is distributed in the hope that it will be useful,
643
- but WITHOUT ANY WARRANTY; without even the implied warranty of
644
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
646
-
647
- You should have received a copy of the GNU General Public License
648
- along with this program. If not, see <https://www.gnu.org/licenses/>.
649
-
650
- Also add information on how to contact you by electronic and paper mail.
651
-
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- <program> Copyright (C) <year> <name of author>
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
663
-
664
- You should also get your employer (if you work as a programmer) or school,
665
- if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
667
- <https://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <https://www.gnu.org/licenses/why-not-lgpl.html>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -1,12 +1,13 @@
1
  ---
2
  title: ChuanhuChatGPT
3
- emoji: 🐯
4
- colorFrom: yellow
5
- colorTo: yellow
6
  sdk: gradio
7
- sdk_version: 3.43.2
8
- app_file: ChuanhuChatbot.py
9
- license: gpl-3.0
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: ChuanhuChatGPT
3
+ emoji: 🐠
4
+ colorFrom: blue
5
+ colorTo: red
6
  sdk: gradio
7
+ sdk_version: 3.19.1
8
+ app_file: app.py
9
+ pinned: false
10
+ license: mit
11
  ---
12
 
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding:utf-8 -*-
2
+ import gradio as gr
3
+ import os
4
+ import logging
5
+ import sys
6
+ import argparse
7
+ from utils import *
8
+ from presets import *
9
+
10
+ logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] [%(filename)s:%(lineno)d] %(message)s")
11
+
12
+ my_api_key = "" # 在这里输入你的 API 密钥
13
+
14
+ #if we are running in Docker
15
+ if os.environ.get('dockerrun') == 'yes':
16
+ dockerflag = True
17
+ else:
18
+ dockerflag = False
19
+
20
+ authflag = False
21
+
22
+ if dockerflag:
23
+ my_api_key = os.environ.get('my_api_key')
24
+ if my_api_key == "empty":
25
+ logging.error("Please give a api key!")
26
+ sys.exit(1)
27
+ #auth
28
+ username = os.environ.get('USERNAME')
29
+ password = os.environ.get('PASSWORD')
30
+ if not (isinstance(username, type(None)) or isinstance(password, type(None))):
31
+ authflag = True
32
+ else:
33
+ if not my_api_key and os.path.exists("api_key.txt") and os.path.getsize("api_key.txt"):
34
+ with open("api_key.txt", "r") as f:
35
+ my_api_key = f.read().strip()
36
+ if os.path.exists("auth.json"):
37
+ with open("auth.json", "r") as f:
38
+ auth = json.load(f)
39
+ username = auth["username"]
40
+ password = auth["password"]
41
+ if username != "" and password != "":
42
+ authflag = True
43
+
44
+ gr.Chatbot.postprocess = postprocess
45
+
46
+ with gr.Blocks(css=customCSS,) as demo:
47
+ history = gr.State([])
48
+ token_count = gr.State([])
49
+ promptTemplates = gr.State(load_template(get_template_names(plain=True)[0], mode=2))
50
+ TRUECOMSTANT = gr.State(True)
51
+ FALSECONSTANT = gr.State(False)
52
+ topic = gr.State("未命名对话历史记录")
53
+
54
+ # gr.HTML("""
55
+ # <div style="text-align: center; margin-top: 20px;">
56
+ # """)
57
+ gr.HTML(title)
58
+
59
+ with gr.Row(scale=1).style(equal_height=True):
60
+
61
+ with gr.Column(scale=5):
62
+ with gr.Row(scale=1):
63
+ chatbot = gr.Chatbot().style(height=600) # .style(color_map=("#1D51EE", "#585A5B"))
64
+ with gr.Row(scale=1):
65
+ with gr.Column(scale=12):
66
+ user_input = gr.Textbox(show_label=False, placeholder="在这里输入").style(
67
+ container=False)
68
+ with gr.Column(min_width=50, scale=1):
69
+ submitBtn = gr.Button("🚀", variant="primary")
70
+ with gr.Row(scale=1):
71
+ emptyBtn = gr.Button("🧹 新的对话",)
72
+ retryBtn = gr.Button("🔄 重新生成")
73
+ delLastBtn = gr.Button("🗑️ 删除一条对话")
74
+ reduceTokenBtn = gr.Button("♻️ 总结对话")
75
+
76
+
77
+
78
+ with gr.Column():
79
+ with gr.Column(min_width=50,scale=1):
80
+ status_display = gr.Markdown("status: ready")
81
+ with gr.Tab(label="ChatGPT"):
82
+ keyTxt = gr.Textbox(show_label=True, placeholder=f"OpenAI API-key...",value=my_api_key, type="password", visible=not HIDE_MY_KEY, label="API-Key")
83
+ model_select_dropdown = gr.Dropdown(label="选择模型", choices=MODELS, multiselect=False, value=MODELS[0])
84
+ with gr.Accordion("参数", open=False):
85
+ top_p = gr.Slider(minimum=-0, maximum=1.0, value=1.0, step=0.05,
86
+ interactive=True, label="Top-p (nucleus sampling)",)
87
+ temperature = gr.Slider(minimum=-0, maximum=2.0, value=1.0,
88
+ step=0.1, interactive=True, label="Temperature",)
89
+ use_streaming_checkbox = gr.Checkbox(label="实时传输回答", value=True, visible=enable_streaming_option)
90
+ use_websearch_checkbox = gr.Checkbox(label="使用在线搜索", value=False)
91
+
92
+ with gr.Tab(label="Prompt"):
93
+ systemPromptTxt = gr.Textbox(show_label=True, placeholder=f"在这里输入System Prompt...", label="System prompt", value=initial_prompt).style(container=True)
94
+ with gr.Accordion(label="加载Prompt模板", open=True):
95
+ with gr.Column():
96
+ with gr.Row():
97
+ with gr.Column(scale=6):
98
+ templateFileSelectDropdown = gr.Dropdown(label="选择Prompt模板集合文件", choices=get_template_names(plain=True), multiselect=False, value=get_template_names(plain=True)[0])
99
+ with gr.Column(scale=1):
100
+ templateRefreshBtn = gr.Button("🔄 刷新")
101
+ with gr.Row():
102
+ with gr.Column():
103
+ templateSelectDropdown = gr.Dropdown(label="从Prompt模板中加载", choices=load_template(get_template_names(plain=True)[0], mode=1), multiselect=False, value=load_template(get_template_names(plain=True)[0], mode=1)[0])
104
+
105
+ with gr.Tab(label="保存/加载"):
106
+ with gr.Accordion(label="保存/加载对话历史记录", open=True):
107
+ with gr.Column():
108
+ with gr.Row():
109
+ with gr.Column(scale=6):
110
+ saveFileName = gr.Textbox(
111
+ show_label=True, placeholder=f"在这里输入保存的文件名...", label="设置保存文件名", value="对话历史记录").style(container=True)
112
+ with gr.Column(scale=1):
113
+ saveHistoryBtn = gr.Button("💾 保存对话")
114
+ with gr.Row():
115
+ with gr.Column(scale=6):
116
+ historyFileSelectDropdown = gr.Dropdown(label="从列表中加载对话", choices=get_history_names(plain=True), multiselect=False, value=get_history_names(plain=True)[0])
117
+ with gr.Column(scale=1):
118
+ historyRefreshBtn = gr.Button("🔄 刷新")
119
+
120
+
121
+
122
+ gr.HTML("""
123
+ <div style="text-align: center; margin-top: 20px; margin-bottom: 20px;">
124
+ """)
125
+ gr.Markdown(description)
126
+
127
+
128
+ user_input.submit(predict, [keyTxt, systemPromptTxt, history, user_input, chatbot, token_count, top_p, temperature, use_streaming_checkbox, model_select_dropdown, use_websearch_checkbox], [chatbot, history, status_display, token_count], show_progress=True)
129
+ user_input.submit(reset_textbox, [], [user_input])
130
+
131
+ submitBtn.click(predict, [keyTxt, systemPromptTxt, history, user_input, chatbot, token_count, top_p, temperature, use_streaming_checkbox, model_select_dropdown, use_websearch_checkbox], [chatbot, history, status_display, token_count], show_progress=True)
132
+ submitBtn.click(reset_textbox, [], [user_input])
133
+
134
+ emptyBtn.click(reset_state, outputs=[chatbot, history, token_count, status_display], show_progress=True)
135
+
136
+ retryBtn.click(retry, [keyTxt, systemPromptTxt, history, chatbot, token_count, top_p, temperature, use_streaming_checkbox, model_select_dropdown], [chatbot, history, status_display, token_count], show_progress=True)
137
+
138
+ delLastBtn.click(delete_last_conversation, [chatbot, history, token_count], [
139
+ chatbot, history, token_count, status_display], show_progress=True)
140
+
141
+ reduceTokenBtn.click(reduce_token_size, [keyTxt, systemPromptTxt, history, chatbot, token_count, top_p, temperature, use_streaming_checkbox, model_select_dropdown], [chatbot, history, status_display, token_count], show_progress=True)
142
+
143
+ saveHistoryBtn.click(save_chat_history, [
144
+ saveFileName, systemPromptTxt, history, chatbot], None, show_progress=True)
145
+
146
+ saveHistoryBtn.click(get_history_names, None, [historyFileSelectDropdown])
147
+
148
+ historyRefreshBtn.click(get_history_names, None, [historyFileSelectDropdown])
149
+
150
+ historyFileSelectDropdown.change(load_chat_history, [historyFileSelectDropdown, systemPromptTxt, history, chatbot], [saveFileName, systemPromptTxt, history, chatbot], show_progress=True)
151
+
152
+ templateRefreshBtn.click(get_template_names, None, [templateFileSelectDropdown])
153
+
154
+ templateFileSelectDropdown.change(load_template, [templateFileSelectDropdown], [promptTemplates, templateSelectDropdown], show_progress=True)
155
+
156
+ templateSelectDropdown.change(get_template_content, [promptTemplates, templateSelectDropdown, systemPromptTxt], [systemPromptTxt], show_progress=True)
157
+
158
+ logging.info(colorama.Back.GREEN + "\n川虎的温馨提示:访问 http://localhost:7860 查看界面" + colorama.Style.RESET_ALL)
159
+ # 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
160
+ demo.title = "川虎ChatGPT 🚀"
161
+
162
+ if __name__ == "__main__":
163
+ #if running in Docker
164
+ if dockerflag:
165
+ if authflag:
166
+ demo.queue().launch(server_name="0.0.0.0", server_port=7860,auth=(username, password))
167
+ else:
168
+ demo.queue().launch(server_name="0.0.0.0", server_port=7860, share=False)
169
+ #if not running in Docker
170
+ else:
171
+ if authflag:
172
+ demo.queue().launch(share=False, auth=(username, password))
173
+ else:
174
+ demo.queue().launch(share=False) # 改为 share=True 可以创建公开分享链接
175
+ #demo.queue().launch(server_name="0.0.0.0", server_port=7860, share=False) # 可自定义端口
176
+ #demo.queue().launch(server_name="0.0.0.0", server_port=7860,auth=("在这里填写用户名", "在这里填写密码")) # 可设置用户名与密码
177
+ #demo.queue().launch(auth=("在这里填写用户名", "在这里填写密码")) # 适合Nginx反向代理
assets/Kelpy-Codos.js DELETED
@@ -1,76 +0,0 @@
1
- // ==UserScript==
2
- // @name Kelpy Codos
3
- // @namespace https://github.com/Keldos-Li/Kelpy-Codos
4
- // @version 1.0.5
5
- // @author Keldos; https://keldos.me/
6
- // @description Add copy button to PRE tags before CODE tag, for Chuanhu ChatGPT especially.
7
- // Based on Chuanhu ChatGPT version: ac04408 (2023-3-22)
8
- // @license GPL-3.0
9
- // @grant none
10
- // ==/UserScript==
11
-
12
- (function () {
13
- 'use strict';
14
-
15
- function addCopyButton(pre) {
16
- var code = pre.querySelector('code');
17
- if (!code) {
18
- return; // 如果没有找到 <code> 元素,则不添加按钮
19
- }
20
- var firstChild = code.firstChild;
21
- if (!firstChild) {
22
- return; // 如果 <code> 元素没有子节点,则不添加按钮
23
- }
24
- var button = document.createElement('button');
25
- button.textContent = '\uD83D\uDCCE'; // 使用 📎 符号作为“复制”按钮的文本
26
- button.style.position = 'relative';
27
- button.style.float = 'right';
28
- button.style.fontSize = '1em'; // 可选:调整按钮大小
29
- button.style.background = 'none'; // 可选:去掉背景颜色
30
- button.style.border = 'none'; // 可选:去掉边框
31
- button.style.cursor = 'pointer'; // 可选:显示指针样式
32
- button.addEventListener('click', function () {
33
- var range = document.createRange();
34
- range.selectNodeContents(code);
35
- range.setStartBefore(firstChild); // 将范围设置为第一个子节点之前
36
- var selection = window.getSelection();
37
- selection.removeAllRanges();
38
- selection.addRange(range);
39
-
40
- try {
41
- var success = document.execCommand('copy');
42
- if (success) {
43
- button.textContent = '\u2714';
44
- setTimeout(function () {
45
- button.textContent = '\uD83D\uDCCE'; // 恢复按钮为“复制”
46
- }, 2000);
47
- } else {
48
- button.textContent = '\u2716';
49
- }
50
- } catch (e) {
51
- console.error(e);
52
- button.textContent = '\u2716';
53
- }
54
-
55
- selection.removeAllRanges();
56
- });
57
- code.insertBefore(button, firstChild); // 将按钮插入到第一个子元素之前
58
- }
59
-
60
- function handleNewElements(mutationsList, observer) {
61
- for (var mutation of mutationsList) {
62
- if (mutation.type === 'childList') {
63
- for (var node of mutation.addedNodes) {
64
- if (node.nodeName === 'PRE') {
65
- addCopyButton(node);
66
- }
67
- }
68
- }
69
- }
70
- }
71
-
72
- var observer = new MutationObserver(handleNewElements);
73
- observer.observe(document.documentElement, { childList: true, subtree: true });
74
-
75
- document.querySelectorAll('pre').forEach(addCopyButton);
76
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/custom.css DELETED
@@ -1,468 +0,0 @@
1
- :root {
2
- --chatbot-color-light: #000000;
3
- --chatbot-color-dark: #FFFFFF;
4
- --chatbot-background-color-light: #F3F3F3;
5
- --chatbot-background-color-dark: #121111;
6
- --message-user-background-color-light: #95EC69;
7
- --message-user-background-color-dark: #26B561;
8
- --message-bot-background-color-light: #FFFFFF;
9
- --message-bot-background-color-dark: #2C2C2C;
10
- }
11
-
12
- #app_title {
13
- font-weight: var(--prose-header-text-weight);
14
- font-size: var(--text-xxl);
15
- line-height: 1.3;
16
- text-align: left;
17
- margin-top: 6px;
18
- white-space: nowrap;
19
- }
20
- #description {
21
- text-align: center;
22
- margin: 32px 0 4px 0;
23
- }
24
-
25
- /* gradio的页脚信息 */
26
- footer {
27
- /* display: none !important; */
28
- margin-top: .2em !important;
29
- font-size: 85%;
30
- }
31
- #footer {
32
- text-align: center;
33
- }
34
- #footer div {
35
- display: inline-block;
36
- }
37
- #footer .versions{
38
- font-size: 85%;
39
- opacity: 0.60;
40
- }
41
-
42
- #float_display {
43
- position: absolute;
44
- max-height: 30px;
45
- }
46
- /* user_info */
47
- #user_info {
48
- white-space: nowrap;
49
- position: absolute; left: 8em; top: .2em;
50
- z-index: var(--layer-2);
51
- box-shadow: var(--block-shadow);
52
- border: none; border-radius: var(--block-label-radius);
53
- background: var(--color-accent);
54
- padding: var(--block-label-padding);
55
- font-size: var(--block-label-text-size); line-height: var(--line-sm);
56
- width: auto; min-height: 30px!important;
57
- opacity: 1;
58
- transition: opacity 0.3s ease-in-out;
59
- }
60
- #user_info .wrap {
61
- opacity: 0;
62
- }
63
- #user_info p {
64
- color: white;
65
- font-weight: var(--block-label-text-weight);
66
- }
67
- #user_info.hideK {
68
- opacity: 0;
69
- transition: opacity 1s ease-in-out;
70
- }
71
-
72
- /* status_display */
73
- #status_display {
74
- display: flex;
75
- min-height: 2em;
76
- align-items: flex-end;
77
- justify-content: flex-end;
78
- }
79
- #status_display p {
80
- font-size: .85em;
81
- font-family: ui-monospace, "SF Mono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "Microsoft Yahei UI", "Microsoft Yahei", monospace;
82
- /* Windows下中文的monospace会fallback为新宋体,实在太丑,这里折中使用微软雅黑 */
83
- color: var(--body-text-color-subdued);
84
- }
85
-
86
- #status_display {
87
- transition: all 0.6s;
88
- }
89
- #chuanhu_chatbot {
90
- transition: height 0.3s ease;
91
- }
92
-
93
- /* usage_display */
94
- .insert_block {
95
- position: relative;
96
- margin: 0;
97
- padding: .5em 1em;
98
- box-shadow: var(--block-shadow);
99
- border-width: var(--block-border-width);
100
- border-color: var(--block-border-color);
101
- border-radius: var(--block-radius);
102
- background: var(--block-background-fill);
103
- width: 100%;
104
- line-height: var(--line-sm);
105
- min-height: 2em;
106
- }
107
- #usage_display p, #usage_display span {
108
- margin: 0;
109
- font-size: .85em;
110
- color: var(--body-text-color-subdued);
111
- }
112
- .progress-bar {
113
- background-color: var(--input-background-fill);;
114
- margin: .5em 0 !important;
115
- height: 20px;
116
- border-radius: 10px;
117
- overflow: hidden;
118
- }
119
- .progress {
120
- background-color: var(--block-title-background-fill);
121
- height: 100%;
122
- border-radius: 10px;
123
- text-align: right;
124
- transition: width 0.5s ease-in-out;
125
- }
126
- .progress-text {
127
- /* color: white; */
128
- color: var(--color-accent) !important;
129
- font-size: 1em !important;
130
- font-weight: bold;
131
- padding-right: 10px;
132
- line-height: 20px;
133
- }
134
-
135
- .apSwitch {
136
- top: 2px;
137
- display: inline-block;
138
- height: 24px;
139
- position: relative;
140
- width: 48px;
141
- border-radius: 12px;
142
- }
143
- .apSwitch input {
144
- display: none !important;
145
- }
146
- .apSlider {
147
- background-color: var(--neutral-200);
148
- bottom: 0;
149
- cursor: pointer;
150
- left: 0;
151
- position: absolute;
152
- right: 0;
153
- top: 0;
154
- transition: .4s;
155
- font-size: 18px;
156
- border-radius: 12px;
157
- }
158
- .apSlider::before {
159
- bottom: -1.5px;
160
- left: 1px;
161
- position: absolute;
162
- transition: .4s;
163
- content: "🌞";
164
- }
165
- input:checked + .apSlider {
166
- background-color: var(--primary-600);
167
- }
168
- input:checked + .apSlider::before {
169
- transform: translateX(23px);
170
- content:"🌚";
171
- }
172
-
173
- /* Override Slider Styles (for webkit browsers like Safari and Chrome)
174
- * 好希望这份提案能早日实现 https://github.com/w3c/csswg-drafts/issues/4410
175
- * 进度滑块在各个平台还是太不统一了
176
- */
177
- input[type="range"] {
178
- -webkit-appearance: none;
179
- height: 4px;
180
- background: var(--input-background-fill);
181
- border-radius: 5px;
182
- background-image: linear-gradient(var(--primary-500),var(--primary-500));
183
- background-size: 0% 100%;
184
- background-repeat: no-repeat;
185
- }
186
- input[type="range"]::-webkit-slider-thumb {
187
- -webkit-appearance: none;
188
- height: 20px;
189
- width: 20px;
190
- border-radius: 50%;
191
- border: solid 0.5px #ddd;
192
- background-color: white;
193
- cursor: ew-resize;
194
- box-shadow: var(--input-shadow);
195
- transition: background-color .1s ease;
196
- }
197
- input[type="range"]::-webkit-slider-thumb:hover {
198
- background: var(--neutral-50);
199
- }
200
- input[type=range]::-webkit-slider-runnable-track {
201
- -webkit-appearance: none;
202
- box-shadow: none;
203
- border: none;
204
- background: transparent;
205
- }
206
-
207
- #submit_btn, #cancel_btn {
208
- height: 42px !important;
209
- }
210
- #submit_btn::before {
211
- content: url("data:image/svg+xml, %3Csvg width='21px' height='20px' viewBox='0 0 21 20' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%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");
212
- height: 21px;
213
- }
214
- #cancel_btn::before {
215
- content: url("data:image/svg+xml,%3Csvg width='21px' height='21px' viewBox='0 0 21 21' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E %3Cg id='pg' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E %3Cpath d='M10.2072007,20.088463 C11.5727865,20.088463 12.8594566,19.8259823 14.067211,19.3010209 C15.2749653,18.7760595 16.3386126,18.0538087 17.2581528,17.1342685 C18.177693,16.2147282 18.8982283,15.1527965 19.4197586,13.9484733 C19.9412889,12.7441501 20.202054,11.4557644 20.202054,10.0833163 C20.202054,8.71773046 19.9395733,7.43106036 19.4146119,6.22330603 C18.8896505,5.01555169 18.1673997,3.95018885 17.2478595,3.0272175 C16.3283192,2.10424615 15.2646719,1.3837109 14.0569176,0.865611739 C12.8491633,0.34751258 11.5624932,0.088463 10.1969073,0.088463 C8.83132146,0.088463 7.54636692,0.34751258 6.34204371,0.865611739 C5.1377205,1.3837109 4.07407321,2.10424615 3.15110186,3.0272175 C2.22813051,3.95018885 1.5058797,5.01555169 0.984349419,6.22330603 C0.46281914,7.43106036 0.202054,8.71773046 0.202054,10.0833163 C0.202054,11.4557644 0.4645347,12.7441501 0.9894961,13.9484733 C1.5144575,15.1527965 2.23670831,16.2147282 3.15624854,17.1342685 C4.07578877,18.0538087 5.1377205,18.7760595 6.34204371,19.3010209 C7.54636692,19.8259823 8.83475258,20.088463 10.2072007,20.088463 Z M10.2072007,18.2562448 C9.07493099,18.2562448 8.01471483,18.0452309 7.0265522,17.6232031 C6.03838956,17.2011753 5.17031614,16.6161693 4.42233192,15.8681851 C3.6743477,15.1202009 3.09105726,14.2521274 2.67246059,13.2639648 C2.25386392,12.2758022 2.04456558,11.215586 2.04456558,10.0833163 C2.04456558,8.95104663 2.25386392,7.89083047 2.67246059,6.90266784 C3.09105726,5.9145052 3.6743477,5.04643178 4.42233192,4.29844756 C5.17031614,3.55046334 6.036674,2.9671729 7.02140552,2.54857623 C8.00613703,2.12997956 9.06463763,1.92068122 10.1969073,1.92068122 C11.329177,1.92068122 12.3911087,2.12997956 13.3827025,2.54857623 C14.3742962,2.9671729 15.2440852,3.55046334 15.9920694,4.29844756 C16.7400537,5.04643178 17.3233441,5.9145052 17.7419408,6.90266784 C18.1605374,7.89083047 18.3698358,8.95104663 18.3698358,10.0833163 C18.3698358,11.215586 18.1605374,12.2758022 17.7419408,13.2639648 C17.3233441,14.2521274 16.7400537,15.1202009 15.9920694,15.8681851 C15.2440852,16.6161693 14.3760118,17.2011753 13.3878492,17.6232031 C12.3996865,18.0452309 11.3394704,18.2562448 10.2072007,18.2562448 Z M7.65444721,13.6242324 L12.7496608,13.6242324 C13.0584616,13.6242324 13.3003556,13.5384544 13.4753427,13.3668984 C13.6503299,13.1953424 13.7378234,12.9585951 13.7378234,12.6566565 L13.7378234,7.49968276 C13.7378234,7.19774418 13.6503299,6.96099688 13.4753427,6.78944087 C13.3003556,6.61788486 13.0584616,6.53210685 12.7496608,6.53210685 L7.65444721,6.53210685 C7.33878414,6.53210685 7.09345904,6.61788486 6.91847191,6.78944087 C6.74348478,6.96099688 6.65599121,7.19774418 6.65599121,7.49968276 L6.65599121,12.6566565 C6.65599121,12.9585951 6.74348478,13.1953424 6.91847191,13.3668984 C7.09345904,13.5384544 7.33878414,13.6242324 7.65444721,13.6242324 Z' id='shape' fill='%23FF3B30' fill-rule='nonzero'%3E%3C/path%3E %3C/g%3E %3C/svg%3E");
216
- height: 21px;
217
- }
218
- /* list */
219
- ol:not(.options), ul:not(.options) {
220
- padding-inline-start: 2em !important;
221
- }
222
-
223
- /* 亮色(默认) */
224
- #chuanhu_chatbot {
225
- background-color: var(--chatbot-background-color-light) !important;
226
- color: var(--chatbot-color-light) !important;
227
- }
228
- [data-testid = "bot"] {
229
- background-color: var(--message-bot-background-color-light) !important;
230
- }
231
- [data-testid = "user"] {
232
- background-color: var(--message-user-background-color-light) !important;
233
- }
234
- /* 暗色 */
235
- .dark #chuanhu_chatbot {
236
- background-color: var(--chatbot-background-color-dark) !important;
237
- color: var(--chatbot-color-dark) !important;
238
- }
239
- .dark [data-testid = "bot"] {
240
- background-color: var(--message-bot-background-color-dark) !important;
241
- }
242
- .dark [data-testid = "user"] {
243
- background-color: var(--message-user-background-color-dark) !important;
244
- }
245
-
246
- /* 屏幕宽度大于等于500px的设备 */
247
- /* update on 2023.4.8: 高度的细致调整已写入JavaScript */
248
- @media screen and (min-width: 500px) {
249
- #chuanhu_chatbot {
250
- height: calc(100vh - 200px);
251
- }
252
- #chuanhu_chatbot .wrap {
253
- max-height: calc(100vh - 200px - var(--line-sm)*1rem - 2*var(--block-label-margin) );
254
- }
255
- }
256
- /* 屏幕宽度小于500px的设备 */
257
- @media screen and (max-width: 499px) {
258
- #chuanhu_chatbot {
259
- height: calc(100vh - 140px);
260
- }
261
- #chuanhu_chatbot .wrap {
262
- max-height: calc(100vh - 140px - var(--line-sm)*1rem - 2*var(--block-label-margin) );
263
- }
264
- [data-testid = "bot"] {
265
- max-width: 95% !important;
266
- }
267
- #app_title h1{
268
- letter-spacing: -1px; font-size: 22px;
269
- }
270
- }
271
- #chuanhu_chatbot .wrap {
272
- overflow-x: hidden;
273
- }
274
- /* 对话气泡 */
275
- .message {
276
- border-radius: var(--radius-xl) !important;
277
- border: none;
278
- padding: var(--spacing-xl) !important;
279
- font-size: var(--text-md) !important;
280
- line-height: var(--line-md) !important;
281
- min-height: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl));
282
- min-width: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl));
283
- }
284
- [data-testid = "bot"] {
285
- max-width: 85%;
286
- border-bottom-left-radius: 0 !important;
287
- }
288
- [data-testid = "user"] {
289
- max-width: 85%;
290
- width: auto !important;
291
- border-bottom-right-radius: 0 !important;
292
- }
293
-
294
- .message.user p {
295
- white-space: pre-wrap;
296
- }
297
- .message .user-message {
298
- display: block;
299
- padding: 0 !important;
300
- white-space: pre-wrap;
301
- }
302
-
303
- .message .md-message p {
304
- margin-top: 0.6em !important;
305
- margin-bottom: 0.6em !important;
306
- }
307
- .message .md-message p:first-child { margin-top: 0 !important; }
308
- .message .md-message p:last-of-type { margin-bottom: 0 !important; }
309
-
310
- .message .md-message {
311
- display: block;
312
- padding: 0 !important;
313
- }
314
- .message .raw-message p {
315
- margin:0 !important;
316
- }
317
- .message .raw-message {
318
- display: block;
319
- padding: 0 !important;
320
- white-space: pre-wrap;
321
- }
322
- .raw-message.hideM, .md-message.hideM {
323
- display: none;
324
- }
325
-
326
- /* custom buttons */
327
- .chuanhu-btn {
328
- border-radius: 5px;
329
- /* background-color: #E6E6E6 !important; */
330
- color: rgba(120, 120, 120, 0.64) !important;
331
- padding: 4px !important;
332
- position: absolute;
333
- right: -22px;
334
- cursor: pointer !important;
335
- transition: color .2s ease, background-color .2s ease;
336
- }
337
- .chuanhu-btn:hover {
338
- background-color: rgba(167, 167, 167, 0.25) !important;
339
- color: unset !important;
340
- }
341
- .chuanhu-btn:active {
342
- background-color: rgba(167, 167, 167, 0.5) !important;
343
- }
344
- .chuanhu-btn:focus {
345
- outline: none;
346
- }
347
- .copy-bot-btn {
348
- /* top: 18px; */
349
- bottom: 0;
350
- }
351
- .toggle-md-btn {
352
- /* top: 0; */
353
- bottom: 20px;
354
- }
355
- .copy-code-btn {
356
- position: relative;
357
- float: right;
358
- font-size: 1em;
359
- cursor: pointer;
360
- }
361
-
362
- .message-wrap>div img{
363
- border-radius: 10px !important;
364
- }
365
-
366
- /* history message */
367
- .wrap>.history-message {
368
- padding: 10px !important;
369
- }
370
- .history-message {
371
- /* padding: 0 !important; */
372
- opacity: 80%;
373
- display: flex;
374
- flex-direction: column;
375
- }
376
- .history-message>.history-message {
377
- padding: 0 !important;
378
- }
379
- .history-message>.message-wrap {
380
- padding: 0 !important;
381
- margin-bottom: 16px;
382
- }
383
- .history-message>.message {
384
- margin-bottom: 16px;
385
- }
386
- .wrap>.history-message::after {
387
- content: "";
388
- display: block;
389
- height: 2px;
390
- background-color: var(--body-text-color-subdued);
391
- margin-bottom: 10px;
392
- margin-top: -10px;
393
- clear: both;
394
- }
395
- .wrap>.history-message>:last-child::after {
396
- content: "仅供查看";
397
- display: block;
398
- text-align: center;
399
- color: var(--body-text-color-subdued);
400
- font-size: 0.8em;
401
- }
402
-
403
- /* 表格 */
404
- table {
405
- margin: 1em 0;
406
- border-collapse: collapse;
407
- empty-cells: show;
408
- }
409
- td,th {
410
- border: 1.2px solid var(--border-color-primary) !important;
411
- padding: 0.2em;
412
- }
413
- thead {
414
- background-color: rgba(175,184,193,0.2);
415
- }
416
- thead th {
417
- padding: .5em .2em;
418
- }
419
- /* 行内代码 */
420
- .message :not(pre) code {
421
- display: inline;
422
- white-space: break-spaces;
423
- font-family: var(--font-mono);
424
- border-radius: 6px;
425
- margin: 0 2px 0 2px;
426
- padding: .2em .4em .1em .4em;
427
- background-color: rgba(175,184,193,0.2);
428
- }
429
- /* 代码块 */
430
- .message pre,
431
- .message pre[class*=language-] {
432
- color: #fff;
433
- overflow-x: auto;
434
- overflow-y: hidden;
435
- margin: .8em 1em 1em 0em !important;
436
- padding: var(--spacing-xl) 1.2em !important;
437
- border-radius: var(--radius-lg) !important;
438
- }
439
- .message pre code,
440
- .message pre code[class*=language-] {
441
- color: #fff;
442
- padding: 0;
443
- margin: 0;
444
- background-color: unset;
445
- text-shadow: none;
446
- font-family: var(--font-mono);
447
- }
448
- /* 覆盖 gradio 丑陋���复制按钮样式 */
449
- pre button[title="copy"] {
450
- border-radius: 5px;
451
- transition: background-color .2s ease;
452
- }
453
- pre button[title="copy"]:hover {
454
- background-color: #333232;
455
- }
456
- pre button .check {
457
- color: #fff !important;
458
- background: var(--neutral-950) !important;
459
- }
460
-
461
- /* 覆盖prism.css */
462
- .language-css .token.string,
463
- .style .token.string,
464
- .token.entity,
465
- .token.operator,
466
- .token.url {
467
- background: none !important;
468
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/custom.js DELETED
@@ -1,502 +0,0 @@
1
-
2
- // custom javascript here
3
-
4
- const MAX_HISTORY_LENGTH = 32;
5
-
6
- var key_down_history = [];
7
- var currentIndex = -1;
8
- var user_input_ta;
9
-
10
- var gradioContainer = null;
11
- var user_input_ta = null;
12
- var user_input_tb = null;
13
- var userInfoDiv = null;
14
- var appTitleDiv = null;
15
- var chatbot = null;
16
- var chatbotWrap = null;
17
- var apSwitch = null;
18
- var empty_botton = null;
19
- var messageBotDivs = null;
20
- var loginUserForm = null;
21
- var logginUser = null;
22
-
23
- var userLogged = false;
24
- var usernameGotten = false;
25
- var historyLoaded = false;
26
-
27
- var ga = document.getElementsByTagName("gradio-app");
28
- var targetNode = ga[0];
29
- var isInIframe = (window.self !== window.top);
30
- var language = navigator.language.slice(0,2);
31
-
32
- var forView_i18n = {
33
- 'zh': "仅供查看",
34
- 'en': "For viewing only",
35
- 'ja': "閲覧専用",
36
- 'fr': "Pour consultation seulement",
37
- 'es': "Solo para visualización",
38
- };
39
-
40
- // gradio 页面加载好了么??? 我能动你的元素了么??
41
- function gradioLoaded(mutations) {
42
- for (var i = 0; i < mutations.length; i++) {
43
- if (mutations[i].addedNodes.length) {
44
- loginUserForm = document.querySelector(".gradio-container > .main > .wrap > .panel > .form")
45
- gradioContainer = document.querySelector(".gradio-container");
46
- user_input_tb = document.getElementById('user_input_tb');
47
- userInfoDiv = document.getElementById("user_info");
48
- appTitleDiv = document.getElementById("app_title");
49
- chatbot = document.querySelector('#chuanhu_chatbot');
50
- chatbotWrap = document.querySelector('#chuanhu_chatbot > .wrap');
51
- apSwitch = document.querySelector('.apSwitch input[type="checkbox"]');
52
- empty_botton = document.getElementById("empty_btn")
53
-
54
- if (loginUserForm) {
55
- localStorage.setItem("userLogged", true);
56
- userLogged = true;
57
- }
58
-
59
- if (gradioContainer && apSwitch) { // gradioCainter 加载出来了没?
60
- adjustDarkMode();
61
- }
62
- if (user_input_tb) { // user_input_tb 加载出来了没?
63
- selectHistory();
64
- }
65
- if (userInfoDiv && appTitleDiv) { // userInfoDiv 和 appTitleDiv 加载出来了没?
66
- if (!usernameGotten) {
67
- getUserInfo();
68
- }
69
- setTimeout(showOrHideUserInfo(), 2000);
70
- }
71
- if (chatbot) { // chatbot 加载出来了没?
72
- setChatbotHeight();
73
- }
74
- if (chatbotWrap) {
75
- if (!historyLoaded) {
76
- loadHistoryHtml();
77
- }
78
- setChatbotScroll();
79
- }
80
- if (empty_botton) {
81
- emptyHistory();
82
- }
83
- }
84
- }
85
- }
86
-
87
- function webLocale() {
88
- console.log("webLocale", language);
89
- if (forView_i18n.hasOwnProperty(language)) {
90
- var forView = forView_i18n[language];
91
- var forViewStyle = document.createElement('style');
92
- forViewStyle.innerHTML = '.wrap>.history-message>:last-child::after { content: "' + forView + '"!important; }';
93
- document.head.appendChild(forViewStyle);
94
- // console.log("added forViewStyle", forView);
95
- }
96
- }
97
-
98
- function selectHistory() {
99
- user_input_ta = user_input_tb.querySelector("textarea");
100
- if (user_input_ta) {
101
- observer.disconnect(); // 停止监听
102
- // 在 textarea 上监听 keydown 事件
103
- user_input_ta.addEventListener("keydown", function (event) {
104
- var value = user_input_ta.value.trim();
105
- // 判断按下的是否为方向键
106
- if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
107
- // 如果按下的是方向键,且输入框中有内容,且历史记录中没有该内容,则不执行操作
108
- if (value && key_down_history.indexOf(value) === -1)
109
- return;
110
- // 对于需要响应的动作,阻止默认行为。
111
- event.preventDefault();
112
- var length = key_down_history.length;
113
- if (length === 0) {
114
- currentIndex = -1; // 如果历史记录为空,直接将当前选中的记录重置
115
- return;
116
- }
117
- if (currentIndex === -1) {
118
- currentIndex = length;
119
- }
120
- if (event.code === 'ArrowUp' && currentIndex > 0) {
121
- currentIndex--;
122
- user_input_ta.value = key_down_history[currentIndex];
123
- } else if (event.code === 'ArrowDown' && currentIndex < length - 1) {
124
- currentIndex++;
125
- user_input_ta.value = key_down_history[currentIndex];
126
- }
127
- user_input_ta.selectionStart = user_input_ta.value.length;
128
- user_input_ta.selectionEnd = user_input_ta.value.length;
129
- const input_event = new InputEvent("input", { bubbles: true, cancelable: true });
130
- user_input_ta.dispatchEvent(input_event);
131
- } else if (event.code === "Enter") {
132
- if (value) {
133
- currentIndex = -1;
134
- if (key_down_history.indexOf(value) === -1) {
135
- key_down_history.push(value);
136
- if (key_down_history.length > MAX_HISTORY_LENGTH) {
137
- key_down_history.shift();
138
- }
139
- }
140
- }
141
- }
142
- });
143
- }
144
- }
145
-
146
- var username = null;
147
- function getUserInfo() {
148
- if (usernameGotten) {
149
- return;
150
- }
151
- userLogged = localStorage.getItem('userLogged');
152
- if (userLogged) {
153
- username = userInfoDiv.innerText;
154
- if (username) {
155
- if (username.includes("getting user info…")) {
156
- setTimeout(getUserInfo, 500);
157
- return;
158
- } else if (username === " ") {
159
- localStorage.removeItem("username");
160
- localStorage.removeItem("userLogged")
161
- userLogged = false;
162
- usernameGotten = true;
163
- return;
164
- } else {
165
- username = username.match(/User:\s*(.*)/)[1] || username;
166
- localStorage.setItem("username", username);
167
- usernameGotten = true;
168
- clearHistoryHtml();
169
- }
170
- }
171
- }
172
- }
173
-
174
- function toggleUserInfoVisibility(shouldHide) {
175
- if (userInfoDiv) {
176
- if (shouldHide) {
177
- userInfoDiv.classList.add("hideK");
178
- } else {
179
- userInfoDiv.classList.remove("hideK");
180
- }
181
- }
182
- }
183
- function showOrHideUserInfo() {
184
- var sendBtn = document.getElementById("submit_btn");
185
-
186
- // Bind mouse/touch events to show/hide user info
187
- appTitleDiv.addEventListener("mouseenter", function () {
188
- toggleUserInfoVisibility(false);
189
- });
190
- userInfoDiv.addEventListener("mouseenter", function () {
191
- toggleUserInfoVisibility(false);
192
- });
193
- sendBtn.addEventListener("mouseenter", function () {
194
- toggleUserInfoVisibility(false);
195
- });
196
-
197
- appTitleDiv.addEventListener("mouseleave", function () {
198
- toggleUserInfoVisibility(true);
199
- });
200
- userInfoDiv.addEventListener("mouseleave", function () {
201
- toggleUserInfoVisibility(true);
202
- });
203
- sendBtn.addEventListener("mouseleave", function () {
204
- toggleUserInfoVisibility(true);
205
- });
206
-
207
- appTitleDiv.ontouchstart = function () {
208
- toggleUserInfoVisibility(false);
209
- };
210
- userInfoDiv.ontouchstart = function () {
211
- toggleUserInfoVisibility(false);
212
- };
213
- sendBtn.ontouchstart = function () {
214
- toggleUserInfoVisibility(false);
215
- };
216
-
217
- appTitleDiv.ontouchend = function () {
218
- setTimeout(function () {
219
- toggleUserInfoVisibility(true);
220
- }, 3000);
221
- };
222
- userInfoDiv.ontouchend = function () {
223
- setTimeout(function () {
224
- toggleUserInfoVisibility(true);
225
- }, 3000);
226
- };
227
- sendBtn.ontouchend = function () {
228
- setTimeout(function () {
229
- toggleUserInfoVisibility(true);
230
- }, 3000); // Delay 1 second to hide user info
231
- };
232
-
233
- // Hide user info after 2 second
234
- setTimeout(function () {
235
- toggleUserInfoVisibility(true);
236
- }, 2000);
237
- }
238
-
239
- function toggleDarkMode(isEnabled) {
240
- if (isEnabled) {
241
- document.body.classList.add("dark");
242
- document.body.style.setProperty("background-color", "var(--neutral-950)", "important");
243
- } else {
244
- document.body.classList.remove("dark");
245
- document.body.style.backgroundColor = "";
246
- }
247
- }
248
- function adjustDarkMode() {
249
- const darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)");
250
-
251
- // 根据当前颜色模式设置初始状态
252
- apSwitch.checked = darkModeQuery.matches;
253
- toggleDarkMode(darkModeQuery.matches);
254
- // 监听颜色模式变化
255
- darkModeQuery.addEventListener("change", (e) => {
256
- apSwitch.checked = e.matches;
257
- toggleDarkMode(e.matches);
258
- });
259
- // apSwitch = document.querySelector('.apSwitch input[type="checkbox"]');
260
- apSwitch.addEventListener("change", (e) => {
261
- toggleDarkMode(e.target.checked);
262
- });
263
- }
264
-
265
- function setChatbotHeight() {
266
- const screenWidth = window.innerWidth;
267
- const statusDisplay = document.querySelector('#status_display');
268
- const statusDisplayHeight = statusDisplay ? statusDisplay.offsetHeight : 0;
269
- const wrap = chatbot.querySelector('.wrap');
270
- const vh = window.innerHeight * 0.01;
271
- document.documentElement.style.setProperty('--vh', `${vh}px`);
272
- if (isInIframe) {
273
- chatbot.style.height = `700px`;
274
- wrap.style.maxHeight = `calc(700px - var(--line-sm) * 1rem - 2 * var(--block-label-margin))`
275
- } else {
276
- if (screenWidth <= 320) {
277
- chatbot.style.height = `calc(var(--vh, 1vh) * 100 - ${statusDisplayHeight + 150}px)`;
278
- wrap.style.maxHeight = `calc(var(--vh, 1vh) * 100 - ${statusDisplayHeight + 150}px - var(--line-sm) * 1rem - 2 * var(--block-label-margin))`;
279
- } else if (screenWidth <= 499) {
280
- chatbot.style.height = `calc(var(--vh, 1vh) * 100 - ${statusDisplayHeight + 100}px)`;
281
- wrap.style.maxHeight = `calc(var(--vh, 1vh) * 100 - ${statusDisplayHeight + 100}px - var(--line-sm) * 1rem - 2 * var(--block-label-margin))`;
282
- } else {
283
- chatbot.style.height = `calc(var(--vh, 1vh) * 100 - ${statusDisplayHeight + 160}px)`;
284
- wrap.style.maxHeight = `calc(var(--vh, 1vh) * 100 - ${statusDisplayHeight + 160}px - var(--line-sm) * 1rem - 2 * var(--block-label-margin))`;
285
- }
286
- }
287
- }
288
- function setChatbotScroll() {
289
- var scrollHeight = chatbotWrap.scrollHeight;
290
- chatbotWrap.scrollTo(0,scrollHeight)
291
- }
292
- var rangeInputs = null;
293
- var numberInputs = null;
294
- function setSlider() {
295
- rangeInputs = document.querySelectorAll('input[type="range"]');
296
- numberInputs = document.querySelectorAll('input[type="number"]')
297
- setSliderRange();
298
- rangeInputs.forEach(rangeInput => {
299
- rangeInput.addEventListener('input', setSliderRange);
300
- });
301
- numberInputs.forEach(numberInput => {
302
- numberInput.addEventListener('input', setSliderRange);
303
- })
304
- }
305
- function setSliderRange() {
306
- var range = document.querySelectorAll('input[type="range"]');
307
- range.forEach(range => {
308
- range.style.backgroundSize = (range.value - range.min) / (range.max - range.min) * 100 + '% 100%';
309
- });
310
- }
311
-
312
- function addChuanhuButton(botElement) {
313
- var rawMessage = null;
314
- var mdMessage = null;
315
- rawMessage = botElement.querySelector('.raw-message');
316
- mdMessage = botElement.querySelector('.md-message');
317
- if (!rawMessage) {
318
- var buttons = botElement.querySelectorAll('button.chuanhu-btn');
319
- for (var i = 0; i < buttons.length; i++) {
320
- buttons[i].parentNode.removeChild(buttons[i]);
321
- }
322
- return;
323
- }
324
- var copyButton = null;
325
- var toggleButton = null;
326
- copyButton = botElement.querySelector('button.copy-bot-btn');
327
- toggleButton = botElement.querySelector('button.toggle-md-btn');
328
- if (copyButton) copyButton.remove();
329
- if (toggleButton) toggleButton.remove();
330
-
331
- // Copy bot button
332
- var copyButton = document.createElement('button');
333
- copyButton.classList.add('chuanhu-btn');
334
- copyButton.classList.add('copy-bot-btn');
335
- copyButton.setAttribute('aria-label', 'Copy');
336
- copyButton.innerHTML = copyIcon;
337
- copyButton.addEventListener('click', () => {
338
- const textToCopy = rawMessage.innerText;
339
- navigator.clipboard
340
- .writeText(textToCopy)
341
- .then(() => {
342
- copyButton.innerHTML = copiedIcon;
343
- setTimeout(() => {
344
- copyButton.innerHTML = copyIcon;
345
- }, 1500);
346
- })
347
- .catch(() => {
348
- console.error("copy failed");
349
- });
350
- });
351
- botElement.appendChild(copyButton);
352
-
353
- // Toggle button
354
- var toggleButton = document.createElement('button');
355
- toggleButton.classList.add('chuanhu-btn');
356
- toggleButton.classList.add('toggle-md-btn');
357
- toggleButton.setAttribute('aria-label', 'Toggle');
358
- var renderMarkdown = mdMessage.classList.contains('hideM');
359
- toggleButton.innerHTML = renderMarkdown ? mdIcon : rawIcon;
360
- toggleButton.addEventListener('click', () => {
361
- renderMarkdown = mdMessage.classList.contains('hideM');
362
- if (renderMarkdown){
363
- renderMarkdownText(botElement);
364
- toggleButton.innerHTML=rawIcon;
365
- } else {
366
- removeMarkdownText(botElement);
367
- toggleButton.innerHTML=mdIcon;
368
- }
369
- });
370
- botElement.insertBefore(toggleButton, copyButton);
371
- }
372
-
373
- function renderMarkdownText(message) {
374
- var mdDiv = message.querySelector('.md-message');
375
- if (mdDiv) mdDiv.classList.remove('hideM');
376
- var rawDiv = message.querySelector('.raw-message');
377
- if (rawDiv) rawDiv.classList.add('hideM');
378
- }
379
- function removeMarkdownText(message) {
380
- var rawDiv = message.querySelector('.raw-message');
381
- if (rawDiv) rawDiv.classList.remove('hideM');
382
- var mdDiv = message.querySelector('.md-message');
383
- if (mdDiv) mdDiv.classList.add('hideM');
384
- }
385
-
386
- let timeoutId;
387
- let isThrottled = false;
388
- var mmutation
389
- // 监听所有元素中 bot message 的变化,为 bot 消息添加复制按钮。
390
- var mObserver = new MutationObserver(function (mutationsList) {
391
- for (mmutation of mutationsList) {
392
- if (mmutation.type === 'childList') {
393
- for (var node of mmutation.addedNodes) {
394
- if (node.nodeType === 1 && node.classList.contains('message') && node.getAttribute('data-testid') === 'bot') {
395
- saveHistoryHtml();
396
- document.querySelectorAll('#chuanhu_chatbot>.wrap>.message-wrap .message.bot').forEach(addChuanhuButton);
397
- }
398
- if (node.tagName === 'INPUT' && node.getAttribute('type') === 'range') {
399
- setSlider();
400
- }
401
- }
402
- for (var node of mmutation.removedNodes) {
403
- if (node.nodeType === 1 && node.classList.contains('message') && node.getAttribute('data-testid') === 'bot') {
404
- saveHistoryHtml();
405
- document.querySelectorAll('#chuanhu_chatbot>.wrap>.message-wrap .message.bot').forEach(addChuanhuButton);
406
- }
407
- }
408
- } else if (mmutation.type === 'attributes') {
409
- if (mmutation.target.nodeType === 1 && mmutation.target.classList.contains('message') && mmutation.target.getAttribute('data-testid') === 'bot') {
410
- if (isThrottled) break; // 为了防止重复不断疯狂渲染,加上等待_(:з」∠)_
411
- isThrottled = true;
412
- clearTimeout(timeoutId);
413
- timeoutId = setTimeout(() => {
414
- isThrottled = false;
415
- document.querySelectorAll('#chuanhu_chatbot>.wrap>.message-wrap .message.bot').forEach(addChuanhuButton);
416
- saveHistoryHtml();
417
- }, 500);
418
- }
419
- }
420
- }
421
- });
422
- mObserver.observe(document.documentElement, { attributes: true, childList: true, subtree: true });
423
-
424
- var loadhistorytime = 0; // for debugging
425
- function saveHistoryHtml() {
426
- var historyHtml = document.querySelector('#chuanhu_chatbot > .wrap');
427
- localStorage.setItem('chatHistory', historyHtml.innerHTML);
428
- // console.log("History Saved")
429
- historyLoaded = false;
430
- }
431
- function loadHistoryHtml() {
432
- var historyHtml = localStorage.getItem('chatHistory');
433
- if (!historyHtml) {
434
- historyLoaded = true;
435
- return; // no history, do nothing
436
- }
437
- userLogged = localStorage.getItem('userLogged');
438
- if (userLogged){
439
- historyLoaded = true;
440
- return; // logged in, do nothing
441
- }
442
- if (!historyLoaded) {
443
- var tempDiv = document.createElement('div');
444
- tempDiv.innerHTML = historyHtml;
445
- var buttons = tempDiv.querySelectorAll('button.chuanhu-btn');
446
- var gradioCopyButtons = tempDiv.querySelectorAll('button.copy_code_button');
447
- for (var i = 0; i < buttons.length; i++) {
448
- buttons[i].parentNode.removeChild(buttons[i]);
449
- }
450
- for (var i = 0; i < gradioCopyButtons.length; i++) {
451
- gradioCopyButtons[i].parentNode.removeChild(gradioCopyButtons[i]);
452
- }
453
- var fakeHistory = document.createElement('div');
454
- fakeHistory.classList.add('history-message');
455
- fakeHistory.innerHTML = tempDiv.innerHTML;
456
- webLocale();
457
- chatbotWrap.insertBefore(fakeHistory, chatbotWrap.firstChild);
458
- // var fakeHistory = document.createElement('div');
459
- // fakeHistory.classList.add('history-message');
460
- // fakeHistory.innerHTML = historyHtml;
461
- // chatbotWrap.insertBefore(fakeHistory, chatbotWrap.firstChild);
462
- historyLoaded = true;
463
- console.log("History Loaded");
464
- loadhistorytime += 1; // for debugging
465
- } else {
466
- historyLoaded = false;
467
- }
468
- }
469
- function clearHistoryHtml() {
470
- localStorage.removeItem("chatHistory");
471
- historyMessages = chatbotWrap.querySelector('.history-message');
472
- if (historyMessages) {
473
- chatbotWrap.removeChild(historyMessages);
474
- console.log("History Cleared");
475
- }
476
- }
477
- function emptyHistory() {
478
- empty_botton.addEventListener("click", function () {
479
- clearHistoryHtml();
480
- });
481
- }
482
-
483
- // 监视页面内部 DOM 变动
484
- var observer = new MutationObserver(function (mutations) {
485
- gradioLoaded(mutations);
486
- });
487
- observer.observe(targetNode, { childList: true, subtree: true });
488
-
489
- // 监视页面变化
490
- window.addEventListener("DOMContentLoaded", function () {
491
- isInIframe = (window.self !== window.top);
492
- historyLoaded = false;
493
- });
494
- window.addEventListener('resize', setChatbotHeight);
495
- window.addEventListener('scroll', setChatbotHeight);
496
- window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", adjustDarkMode);
497
-
498
- // button svg code
499
- 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>';
500
- 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>';
501
- 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>';
502
- 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>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/external-scripts.js DELETED
@@ -1,2 +0,0 @@
1
-
2
- // external javascript here
 
 
 
assets/favicon.ico DELETED
Binary file (15.4 kB)
 
assets/favicon.png DELETED
Binary file (560 kB)
 
assets/html/appearance_switcher.html DELETED
@@ -1,11 +0,0 @@
1
- <div style="display: flex; justify-content: space-between;">
2
- <span style="margin-top: 4px !important;">
3
- {label}
4
- </span>
5
- <span>
6
- <label class="apSwitch" for="checkbox">
7
- <input type="checkbox" id="checkbox">
8
- <div class="apSlider"></div>
9
- </label>
10
- </span>
11
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
assets/html/footer.html DELETED
@@ -1 +0,0 @@
1
- <div class="versions">{versions}</div>
 
 
chatgpt - macOS.command DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- echo Opening ChuanhuChatGPT...
3
- cd "$(dirname "${BASH_SOURCE[0]}")"
4
- nohup python3 ChuanhuChatbot.py >/dev/null 2>&1 &
5
- sleep 5
6
- open http://127.0.0.1:7860
7
- echo Finished opening ChuanhuChatGPT (http://127.0.0.1:7860/). If you kill ChuanhuChatbot, Use "pkill -f 'ChuanhuChatbot'" command in terminal.
 
 
 
 
 
 
 
 
chatgpt - windows.bat DELETED
@@ -1,14 +0,0 @@
1
- @echo off
2
- echo Opening ChuanhuChatGPT...
3
-
4
- REM Open powershell via bat
5
- start powershell.exe -NoExit -Command "python ./ChuanhuChatbot.py"
6
-
7
- REM The web page can be accessed with delayed start http://127.0.0.1:7860/
8
- ping -n 5 127.0.0.1>nul
9
-
10
- REM access chargpt via your default browser
11
- start "" "http://127.0.0.1:7860/"
12
-
13
-
14
- echo Finished opening ChuanhuChatGPT (http://127.0.0.1:7860/).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
config.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "hide_history_when_not_logged_in": true
3
- }
 
 
 
 
config_example.json DELETED
@@ -1,84 +0,0 @@
1
- {
2
- // 各配置具体说明,见 [https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#配置-configjson]
3
-
4
- //== API 配置 ==
5
- "openai_api_key": "", // 你的 OpenAI API Key,一般必填,若空缺则需在图形界面中填入API Key
6
- "google_palm_api_key": "", // 你的 Google PaLM API Key,用于 Google PaLM 对话模型
7
- "xmchat_api_key": "", // 你的 xmchat API Key,用于 XMChat 对话模型
8
- "minimax_api_key": "", // 你的 MiniMax API Key,用于 MiniMax 对话模型
9
- "minimax_group_id": "", // 你的 MiniMax Group ID,用于 MiniMax 对话模型
10
- "midjourney_proxy_api_base": "https://xxx/mj", // 你的 https://github.com/novicezk/midjourney-proxy 代理地址
11
- "midjourney_proxy_api_secret": "", // 你的 MidJourney Proxy API Secret,用于鉴权访问 api,可选
12
- "midjourney_discord_proxy_url": "", // 你的 MidJourney Discord Proxy URL,用于对生成对图进行反代,可选
13
- "midjourney_temp_folder": "./tmp", // 你的 MidJourney 临时文件夹,用于存放生成的图片,填空则关闭自动下载切图(直接显示MJ的四宫格图)
14
- "spark_appid": "", // 你的 讯飞星火大模型 API AppID,用于讯飞星火大模型对话模型
15
- "spark_api_key": "", // 你的 讯飞星火大模型 API Key,用于讯飞星火大模型对话模型
16
- "spark_api_secret": "", // 你的 讯飞星火大模型 API Secret,用于讯飞星火大模型对话模型
17
- "claude_api_secret":"",// 你的 Claude API Secret,用于 Claude 对话模型
18
- "ernie_api_key": "",// 你的文心一言在百度云中的API Key,用于文心一言对话模型
19
- "ernie_secret_key": "",// 你的文心一言在百度云中的Secret Key,用于文心一言对话模型
20
-
21
-
22
- //== Azure ==
23
- "openai_api_type": "openai", // 可选项:azure, openai
24
- "azure_openai_api_key": "", // 你的 Azure OpenAI API Key,用于 Azure OpenAI 对话模型
25
- "azure_openai_api_base_url": "", // 你的 Azure Base URL
26
- "azure_openai_api_version": "2023-05-15", // 你的 Azure OpenAI API 版本
27
- "azure_deployment_name": "", // 你的 Azure OpenAI Chat 模型 Deployment 名称
28
- "azure_embedding_deployment_name": "", // 你的 Azure OpenAI Embedding 模型 Deployment 名称
29
- "azure_embedding_model_name": "text-embedding-ada-002", // 你的 Azure OpenAI Embedding 模型名称
30
-
31
- //== 基础配置 ==
32
- "language": "auto", // 界面语言,可选"auto", "zh_CN", "en_US", "ja_JP", "ko_KR", "sv_SE", "ru_RU", "vi_VN"
33
- "users": [], // 用户列表,[[用户名1, 密码1], [用户名2, 密码2], ...]
34
- "local_embedding": false, //是否在本地编制索引
35
- "hide_history_when_not_logged_in": false, //未登录情况下是否不展示对话历史
36
- "check_update": true, //是否启用检查更新
37
- "default_model": "gpt-3.5-turbo", // 默认模型
38
- "chat_name_method_index": 2, // 选择对话名称的方法。0: 使用日期时间命名;1: 使用第一条提问命名,2: 使用模型自动总结
39
- "bot_avatar": "default", // 机器人头像,可填写本地或网络图片链接,或者"none"(不显示头像)
40
- "user_avatar": "default", // 用户头像,可填写本地或网络图片链接,或者"none"(不显示头像)
41
-
42
- //== API 用量 ==
43
- "show_api_billing": false, //是否显示OpenAI API用量(启用需要填写sensitive_id)
44
- "sensitive_id": "", // 你 OpenAI 账户的 Sensitive ID,用于查询 API 用量
45
- "usage_limit": 120, // 该 OpenAI API Key 的当月限额,单位:美元,用于计算百分比和显示上限
46
- "legacy_api_usage": false, // 是否使用旧版 API 用量查询接口(OpenAI现已关闭该接口,但是如果你在使用第三方 API,第三方可能仍然支持此接口)
47
-
48
- //== 川虎助理设置 ==
49
- "default_chuanhu_assistant_model": "gpt-4", //川虎助理使用的模型,可选gpt-3.5-turbo或者gpt-4等
50
- "GOOGLE_CSE_ID": "", //谷歌搜索引擎ID,用于川虎助理Pro模式,获取方式请看 https://stackoverflow.com/questions/37083058/programmatically-searching-google-in-python-using-custom-search
51
- "GOOGLE_API_KEY": "", //谷歌API Key,用于川虎助理Pro模式
52
- "WOLFRAM_ALPHA_APPID": "", //Wolfram Alpha API Key,用于川虎助理Pro模式,获取方式请看 https://products.wolframalpha.com/api/
53
- "SERPAPI_API_KEY": "", //SerpAPI API Key,用于川虎助理Pro模式,获取方式请看 https://serpapi.com/
54
-
55
- //== 文档处理与显示 ==
56
- "latex_option": "default", // LaTeX 公式渲染策略,可选"default", "strict", "all"或者"disabled"
57
- "advance_docs": {
58
- "pdf": {
59
- "two_column": false, // 是否认为PDF是双栏的
60
- "formula_ocr": true // 是否使用OCR识别PDF中的公式
61
- }
62
- },
63
-
64
- //== 高级配置 ==
65
- // 是否多个API Key轮换使用
66
- "multi_api_key": false,
67
- // "available_models": ["GPT3.5 Turbo", "GPT4 Turbo", "GPT4 Vision"], // 可用的模型列表,将覆盖默认的可用模型列���
68
- // "extra_models": ["模型名称3", "模型名称4", ...], // 额外的模型,将添加到可用的模型列表之后
69
- // "api_key_list": [
70
- // "sk-xxxxxxxxxxxxxxxxxxxxxxxx1",
71
- // "sk-xxxxxxxxxxxxxxxxxxxxxxxx2",
72
- // "sk-xxxxxxxxxxxxxxxxxxxxxxxx3"
73
- // ],
74
- // 自定义OpenAI API Base
75
- // "openai_api_base": "https://api.openai.com",
76
- // 自定义使用代理(请替换代理URL)
77
- // "https_proxy": "http://127.0.0.1:1079",
78
- // "http_proxy": "http://127.0.0.1:1079",
79
- // 自定义端口、自定义ip(请替换对应内容)
80
- // "server_name": "0.0.0.0",
81
- // "server_port": 7860,
82
- // 如果要share到gradio,设置为true
83
- // "share": false,
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
configs/ds_config_chatbot.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "fp16": {
3
- "enabled": false
4
- },
5
- "bf16": {
6
- "enabled": true
7
- },
8
- "comms_logger": {
9
- "enabled": false,
10
- "verbose": false,
11
- "prof_all": false,
12
- "debug": false
13
- },
14
- "steps_per_print": 20000000000000000,
15
- "train_micro_batch_size_per_gpu": 1,
16
- "wall_clock_breakdown": false
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom.css DELETED
@@ -1,162 +0,0 @@
1
- :root {
2
- --chatbot-color-light: #F3F3F3;
3
- --chatbot-color-dark: #121111;
4
- }
5
-
6
- /* status_display */
7
- #status_display {
8
- display: flex;
9
- min-height: 2.5em;
10
- align-items: flex-end;
11
- justify-content: flex-end;
12
- }
13
- #status_display p {
14
- font-size: .85em;
15
- font-family: monospace;
16
- color: var(--body-text-color-subdued);
17
- }
18
-
19
- #chuanhu_chatbot, #status_display {
20
- transition: all 0.6s;
21
- }
22
- /* list */
23
- ol:not(.options), ul:not(.options) {
24
- padding-inline-start: 2em !important;
25
- }
26
-
27
- /* 亮色 */
28
- #chuanhu_chatbot {
29
- background-color: var(--chatbot-color-light) !important;
30
- }
31
- [data-testid = "bot"] {
32
- background-color: #FFFFFF !important;
33
- }
34
- [data-testid = "user"] {
35
- background-color: #95EC69 !important;
36
- }
37
- /* 对话气泡 */
38
- [class *= "message"] {
39
- border-radius: var(--radius-xl) !important;
40
- border: none;
41
- padding: var(--spacing-xl) !important;
42
- font-size: var(--text-md) !important;
43
- line-height: var(--line-md) !important;
44
- min-height: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl));
45
- min-width: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl));
46
- }
47
- [data-testid = "bot"] {
48
- max-width: 85%;
49
- border-bottom-left-radius: 0 !important;
50
- }
51
- [data-testid = "user"] {
52
- max-width: 85%;
53
- width: auto !important;
54
- border-bottom-right-radius: 0 !important;
55
- }
56
- /* 表格 */
57
- table {
58
- margin: 1em 0;
59
- border-collapse: collapse;
60
- empty-cells: show;
61
- }
62
- td,th {
63
- border: 1.2px solid var(--border-color-primary) !important;
64
- padding: 0.2em;
65
- }
66
- thead {
67
- background-color: rgba(175,184,193,0.2);
68
- }
69
- thead th {
70
- padding: .5em .2em;
71
- }
72
- /* 行内代码 */
73
- code {
74
- display: inline;
75
- white-space: break-spaces;
76
- border-radius: 6px;
77
- margin: 0 2px 0 2px;
78
- padding: .2em .4em .1em .4em;
79
- background-color: rgba(175,184,193,0.2);
80
- }
81
- /* 代码块 */
82
- pre code {
83
- display: block;
84
- overflow: auto;
85
- white-space: pre;
86
- background-color: hsla(0, 0%, 0%, 80%)!important;
87
- border-radius: 10px;
88
- padding: 1.4em 1.2em 0em 1.4em;
89
- margin: 1.2em 2em 1.2em 0.5em;
90
- color: #FFF;
91
- box-shadow: 6px 6px 16px hsla(0, 0%, 0%, 0.2);
92
- }
93
- /* 代码高亮样式 */
94
- .highlight .hll { background-color: #49483e }
95
- .highlight .c { color: #75715e } /* Comment */
96
- .highlight .err { color: #960050; background-color: #1e0010 } /* Error */
97
- .highlight .k { color: #66d9ef } /* Keyword */
98
- .highlight .l { color: #ae81ff } /* Literal */
99
- .highlight .n { color: #f8f8f2 } /* Name */
100
- .highlight .o { color: #f92672 } /* Operator */
101
- .highlight .p { color: #f8f8f2 } /* Punctuation */
102
- .highlight .ch { color: #75715e } /* Comment.Hashbang */
103
- .highlight .cm { color: #75715e } /* Comment.Multiline */
104
- .highlight .cp { color: #75715e } /* Comment.Preproc */
105
- .highlight .cpf { color: #75715e } /* Comment.PreprocFile */
106
- .highlight .c1 { color: #75715e } /* Comment.Single */
107
- .highlight .cs { color: #75715e } /* Comment.Special */
108
- .highlight .gd { color: #f92672 } /* Generic.Deleted */
109
- .highlight .ge { font-style: italic } /* Generic.Emph */
110
- .highlight .gi { color: #a6e22e } /* Generic.Inserted */
111
- .highlight .gs { font-weight: bold } /* Generic.Strong */
112
- .highlight .gu { color: #75715e } /* Generic.Subheading */
113
- .highlight .kc { color: #66d9ef } /* Keyword.Constant */
114
- .highlight .kd { color: #66d9ef } /* Keyword.Declaration */
115
- .highlight .kn { color: #f92672 } /* Keyword.Namespace */
116
- .highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
117
- .highlight .kr { color: #66d9ef } /* Keyword.Reserved */
118
- .highlight .kt { color: #66d9ef } /* Keyword.Type */
119
- .highlight .ld { color: #e6db74 } /* Literal.Date */
120
- .highlight .m { color: #ae81ff } /* Literal.Number */
121
- .highlight .s { color: #e6db74 } /* Literal.String */
122
- .highlight .na { color: #a6e22e } /* Name.Attribute */
123
- .highlight .nb { color: #f8f8f2 } /* Name.Builtin */
124
- .highlight .nc { color: #a6e22e } /* Name.Class */
125
- .highlight .no { color: #66d9ef } /* Name.Constant */
126
- .highlight .nd { color: #a6e22e } /* Name.Decorator */
127
- .highlight .ni { color: #f8f8f2 } /* Name.Entity */
128
- .highlight .ne { color: #a6e22e } /* Name.Exception */
129
- .highlight .nf { color: #a6e22e } /* Name.Function */
130
- .highlight .nl { color: #f8f8f2 } /* Name.Label */
131
- .highlight .nn { color: #f8f8f2 } /* Name.Namespace */
132
- .highlight .nx { color: #a6e22e } /* Name.Other */
133
- .highlight .py { color: #f8f8f2 } /* Name.Property */
134
- .highlight .nt { color: #f92672 } /* Name.Tag */
135
- .highlight .nv { color: #f8f8f2 } /* Name.Variable */
136
- .highlight .ow { color: #f92672 } /* Operator.Word */
137
- .highlight .w { color: #f8f8f2 } /* Text.Whitespace */
138
- .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
139
- .highlight .mf { color: #ae81ff } /* Literal.Number.Float */
140
- .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
141
- .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
142
- .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
143
- .highlight .sa { color: #e6db74 } /* Literal.String.Affix */
144
- .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
145
- .highlight .sc { color: #e6db74 } /* Literal.String.Char */
146
- .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
147
- .highlight .sd { color: #e6db74 } /* Literal.String.Doc */
148
- .highlight .s2 { color: #e6db74 } /* Literal.String.Double */
149
- .highlight .se { color: #ae81ff } /* Literal.String.Escape */
150
- .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
151
- .highlight .si { color: #e6db74 } /* Literal.String.Interpol */
152
- .highlight .sx { color: #e6db74 } /* Literal.String.Other */
153
- .highlight .sr { color: #e6db74 } /* Literal.String.Regex */
154
- .highlight .s1 { color: #e6db74 } /* Literal.String.Single */
155
- .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
156
- .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
157
- .highlight .fm { color: #a6e22e } /* Name.Function.Magic */
158
- .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
159
- .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
160
- .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
161
- .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
162
- .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
history/2023-06-14_15-05-04.json DELETED
File without changes
locale/en_US.json DELETED
@@ -1,141 +0,0 @@
1
- {
2
- " 吗?": " ?",
3
- "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Caution: Changes require care. ⚠️",
4
- "**发送消息** 或 **提交key** 以显示额度": "**Send message** or **Submit key** to display credit",
5
- "**本月使用金额** ": "**Monthly usage** ",
6
- "**获取API使用情况失败**": "**Failed to get API usage**",
7
- "**获取API使用情况失败**,sensitive_id错误或已过期": "**Failed to get API usage**, wrong or expired sensitive_id",
8
- "**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**Failed to get API usage**, correct sensitive_id needed in `config.json`",
9
- "API key为空,请检查是否输入正确。": "API key is empty, check whether it is entered correctly.",
10
- "API密钥更改为了": "The API key is changed to",
11
- "JSON解析错误,收到的内容: ": "JSON parsing error, received content: ",
12
- "SSL错误,无法获取对话。": "SSL error, unable to get dialogue.",
13
- "Token 计数: ": "Token Count: ",
14
- "☹️发生了错误:": "☹️Error: ",
15
- "⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ To ensure the security of API-Key, please modify the network settings in the configuration file `config.json`.",
16
- "。你仍然可以使用聊天功能。": ". You can still use the chat function.",
17
- "上传": "Upload",
18
- "上传了": "Uploaded",
19
- "上传到 OpenAI 后自动填充": "Automatically filled after uploading to OpenAI",
20
- "上传到OpenAI": "Upload to OpenAI",
21
- "上传文件": "Upload files",
22
- "仅供查看": "For viewing only",
23
- "从Prompt模板中加载": "Load from Prompt Template",
24
- "从列表中加载对话": "Load dialog from list",
25
- "代理地址": "Proxy address",
26
- "代理错误,无法获取对话。": "Proxy error, unable to get dialogue.",
27
- "你没有权限访问 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)",
28
- "你没有选择任何对话历史": "You have not selected any conversation history.",
29
- "你真的要删除 ": "Are you sure you want to delete ",
30
- "使用在线搜索": "Use online search",
31
- "停止符,用英文逗号隔开...": "Type in stop token here, separated by comma...",
32
- "关于": "About",
33
- "准备数据集": "Prepare Dataset",
34
- "切换亮暗色主题": "Switch light/dark theme",
35
- "删除对话历史成功": "Successfully deleted conversation history.",
36
- "删除这轮问答": "Delete this round of Q&A",
37
- "刷新状态": "Refresh Status",
38
- "剩余配额不足,[进一步了解](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)": "Insufficient remaining quota, [learn more](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)",
39
- "加载Prompt模板": "Load Prompt Template",
40
- "单轮对话": "Single-turn",
41
- "历史记录(JSON)": "History file (JSON)",
42
- "参数": "Parameters",
43
- "双栏pdf": "Two-column pdf",
44
- "取消": "Cancel",
45
- "取消所有任务": "Cancel All Tasks",
46
- "可选,用于区分不同的模型": "Optional, used to distinguish different models",
47
- "启用的工具:": "Enabled tools: ",
48
- "在工具箱中管理知识库文件": "Manage knowledge base files in the toolbox",
49
- "在线搜索": "Web search",
50
- "在这里输入": "Type in here",
51
- "在这里输入System Prompt...": "Type in System Prompt here...",
52
- "多账号模式已开启,无需输入key,可直接开始对话": "Multi-account mode is enabled, no need to enter key, you can start the dialogue directly",
53
- "好": "OK",
54
- "实时传输回答": "Stream output",
55
- "对话": "Dialogue",
56
- "对话历史": "Conversation history",
57
- "对话历史记录": "Dialog History",
58
- "对话命名方式": "History naming method",
59
- "导出为 Markdown": "Export as Markdown",
60
- "川虎Chat": "Chuanhu Chat",
61
- "川虎Chat 🚀": "Chuanhu Chat 🚀",
62
- "工具箱": "Toolbox",
63
- "已经被删除啦": "It has been deleted.",
64
- "开始实时传输回答……": "Start streaming output...",
65
- "开始训练": "Start Training",
66
- "微调": "Fine-tuning",
67
- "总结": "Summarize",
68
- "总结完成": "Summary completed.",
69
- "您使用的就是最新版!": "You are using the latest version!",
70
- "您的IP区域:": "Your IP region: ",
71
- "您的IP区域:未知。": "Your IP region: Unknown.",
72
- "拓展": "Extensions",
73
- "搜索(支持正则)...": "Search (supports regex)...",
74
- "数据集预览": "Dataset Preview",
75
- "文件ID": "File ID",
76
- "新对话 ": "New Chat ",
77
- "新建对话保留Prompt": "Retain Prompt For New Chat",
78
- "暂时未知": "Unknown",
79
- "更新": "Update",
80
- "更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Update failed, please try [manually updating](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)",
81
- "更新成功,请重启本程序": "Updated successfully, please restart this program",
82
- "未命名对话历史记录": "Unnamed Dialog History",
83
- "未设置代理...": "No proxy...",
84
- "本月使用金额": "Monthly usage",
85
- "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "View the [usage guide](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) for more details",
86
- "根据日期时间": "By date and time",
87
- "模型": "Model",
88
- "模型名称后缀": "Model Name Suffix",
89
- "模型自动总结(消耗tokens)": "Auto summary by LLM (Consume tokens)",
90
- "模型设置为了:": "Model is set to: ",
91
- "正在尝试更新...": "Trying to update...",
92
- "添加训练好的模型到模型列表": "Add trained model to the model list",
93
- "状态": "Status",
94
- "生成内容总结中……": "Generating content summary...",
95
- "用于定位滥用行为": "Used to locate abuse",
96
- "用户名": "Username",
97
- "由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) 下载最新版脚本": "Developed by Bilibili [土川虎虎虎](https://space.bilibili.com/29125536), [明昭MZhao](https://space.bilibili.com/24807452) and [Keldos](https://github.com/Keldos-Li)\n\nDownload latest code from [GitHub](https://github.com/GaiZhenbiao/ChuanhuChatGPT)",
98
- "知识库": "Knowledge base",
99
- "知识库文件": "Knowledge base files",
100
- "第一条提问": "By first question",
101
- "索引构建完成": "Indexing complete.",
102
- "网络": "Network",
103
- "获取API使用情况失败:": "Failed to get API usage:",
104
- "获取IP地理位置失败。原因:": "Failed to get IP location. Reason: ",
105
- "获取对话时发生错误,请查看后台日志": "Error occurred when getting dialogue, check the background log",
106
- "训练": "Training",
107
- "训练状态": "Training Status",
108
- "训练轮数(Epochs)": "Training Epochs",
109
- "设置": "Settings",
110
- "设置保存文件名": "Set save file name",
111
- "设置文件名: 默认为.json,可选为.md": "Set file name: default is .json, optional is .md",
112
- "识别公式": "formula OCR",
113
- "详情": "Details",
114
- "请查看 config_example.json,配置 Azure OpenAI": "Please review config_example.json to configure Azure OpenAI",
115
- "请检查网络连接,或者API-Key是否有效。": "Check the network connection or whether the API-Key is valid.",
116
- "请输入对话内容。": "Enter the content of the conversation.",
117
- "请输入有效的文件名,不要包含以下特殊字符:": "Please enter a valid file name, do not include the following special characters: ",
118
- "读取超时,无法获取对话。": "Read timed out, unable to get dialogue.",
119
- "账单信息不适用": "Billing information is not applicable",
120
- "连接超时,无法获取对话。": "Connection timed out, unable to get dialogue.",
121
- "选择LoRA模型": "Select LoRA Model",
122
- "选择Prompt模板集合文件": "Select Prompt Template Collection File",
123
- "选择回复语言(针对搜索&索引功能)": "Select reply language (for search & index)",
124
- "选择数据集": "Select Dataset",
125
- "选择模型": "Select Model",
126
- "重命名该对话": "Rename this chat",
127
- "重新生成": "Regenerate",
128
- "高级": "Advanced",
129
- ",本次对话累计消耗了 ": ", total cost: ",
130
- "💾 保存对话": "💾 Save Dialog",
131
- "📝 导出为 Markdown": "📝 Export as Markdown",
132
- "🔄 切换API地址": "🔄 Switch API Address",
133
- "🔄 刷新": "🔄 Refresh",
134
- "🔄 检查更新...": "🔄 Check for Update...",
135
- "🔄 设置代理地址": "🔄 Set Proxy Address",
136
- "🔄 重新生成": "🔄 Regeneration",
137
- "🔙 恢复默认网络设置": "🔙 Reset Network Settings",
138
- "🗑️ 删除最新对话": "🗑️ Delete latest dialog",
139
- "🗑️ 删除最旧对话": "🗑️ Delete oldest dialog",
140
- "🧹 新的对话": "🧹 New Dialogue"
141
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locale/extract_locale.py DELETED
@@ -1,138 +0,0 @@
1
- import os, json, re, sys
2
- import aiohttp, asyncio
3
- import commentjson
4
-
5
- asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
6
-
7
- with open("config.json", "r", encoding="utf-8") as f:
8
- config = commentjson.load(f)
9
- api_key = config["openai_api_key"]
10
- url = config["openai_api_base"] + "/v1/chat/completions" if "openai_api_base" in config else "https://api.openai.com/v1/chat/completions"
11
-
12
-
13
- def get_current_strings():
14
- pattern = r'i18n\s*\(\s*["\']([^"\']*(?:\)[^"\']*)?)["\']\s*\)'
15
-
16
- # Load the .py files
17
- contents = ""
18
- for dirpath, dirnames, filenames in os.walk("."):
19
- for filename in filenames:
20
- if filename.endswith(".py"):
21
- filepath = os.path.join(dirpath, filename)
22
- with open(filepath, 'r', encoding='utf-8') as f:
23
- contents += f.read()
24
- # Matching with regular expressions
25
- matches = re.findall(pattern, contents, re.DOTALL)
26
- data = {match.strip('()"'): '' for match in matches}
27
- fixed_data = {} # fix some keys
28
- for key, value in data.items():
29
- if "](" in key and key.count("(") != key.count(")"):
30
- fixed_data[key+")"] = value
31
- else:
32
- fixed_data[key] = value
33
-
34
- return fixed_data
35
-
36
-
37
- def get_locale_strings(filename):
38
- try:
39
- with open(filename, "r", encoding="utf-8") as f:
40
- locale_strs = json.load(f)
41
- except FileNotFoundError:
42
- locale_strs = {}
43
- return locale_strs
44
-
45
-
46
- def sort_strings(existing_translations):
47
- # Sort the merged data
48
- sorted_translations = {}
49
- # Add entries with (NOT USED) in their values
50
- for key, value in sorted(existing_translations.items(), key=lambda x: x[0]):
51
- if "(🔴NOT USED)" in value:
52
- sorted_translations[key] = value
53
- # Add entries with empty values
54
- for key, value in sorted(existing_translations.items(), key=lambda x: x[0]):
55
- if value == "":
56
- sorted_translations[key] = value
57
- # Add the rest of the entries
58
- for key, value in sorted(existing_translations.items(), key=lambda x: x[0]):
59
- if value != "" and "(NOT USED)" not in value:
60
- sorted_translations[key] = value
61
-
62
- return sorted_translations
63
-
64
-
65
- async def auto_translate(str, language):
66
- headers = {
67
- "Content-Type": "application/json",
68
- "Authorization": f"Bearer {api_key}",
69
- "temperature": f"{0}",
70
- }
71
- payload = {
72
- "model": "gpt-3.5-turbo",
73
- "messages": [
74
- {
75
- "role": "system",
76
- "content": f"You are a translation program;\nYour job is to translate user input into {language};\nThe content you are translating is a string in the App;\nDo not explain emoji;\nIf input is only a emoji, please simply return origin emoji;\nPlease ensure that the translation results are concise and easy to understand."
77
- },
78
- {"role": "user", "content": f"{str}"}
79
- ],
80
- }
81
-
82
- async with aiohttp.ClientSession() as session:
83
- async with session.post(url, headers=headers, json=payload) as response:
84
- data = await response.json()
85
- return data["choices"][0]["message"]["content"]
86
-
87
-
88
- async def main(auto=False):
89
- current_strs = get_current_strings()
90
- locale_files = []
91
- # 遍历locale目录下的所有json文件
92
- for dirpath, dirnames, filenames in os.walk("locale"):
93
- for filename in filenames:
94
- if filename.endswith(".json"):
95
- locale_files.append(os.path.join(dirpath, filename))
96
-
97
-
98
- for locale_filename in locale_files:
99
- if "zh_CN" in locale_filename:
100
- continue
101
- locale_strs = get_locale_strings(locale_filename)
102
-
103
- # Add new keys
104
- new_keys = []
105
- for key in current_strs:
106
- if key not in locale_strs:
107
- new_keys.append(key)
108
- locale_strs[key] = ""
109
- print(f"{locale_filename[7:-5]}'s new str: {len(new_keys)}")
110
- # Add (NOT USED) to invalid keys
111
- for key in locale_strs:
112
- if key not in current_strs:
113
- locale_strs[key] = "(🔴NOT USED)" + locale_strs[key]
114
- print(f"{locale_filename[7:-5]}'s invalid str: {len(locale_strs) - len(current_strs)}")
115
-
116
- locale_strs = sort_strings(locale_strs)
117
-
118
- if auto:
119
- tasks = []
120
- non_translated_keys = []
121
- for key in locale_strs:
122
- if locale_strs[key] == "":
123
- non_translated_keys.append(key)
124
- tasks.append(auto_translate(key, locale_filename[7:-5]))
125
- results = await asyncio.gather(*tasks)
126
- for key, result in zip(non_translated_keys, results):
127
- locale_strs[key] = "(🟡REVIEW NEEDED)" + result
128
- print(f"{locale_filename[7:-5]}'s auto translated str: {len(non_translated_keys)}")
129
-
130
- with open(locale_filename, 'w', encoding='utf-8') as f:
131
- json.dump(locale_strs, f, ensure_ascii=False, indent=4)
132
-
133
-
134
- if __name__ == "__main__":
135
- auto = False
136
- if len(sys.argv) > 1 and sys.argv[1] == "--auto":
137
- auto = True
138
- asyncio.run(main(auto))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locale/ja_JP.json DELETED
@@ -1,141 +0,0 @@
1
- {
2
- " 吗?": " を削除してもよろしいですか?",
3
- "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ 変更には慎重に ⚠️",
4
- "**发送消息** 或 **提交key** 以显示额度": "**メッセージを送信** または **キーを送信** して、クレジットを表示します",
5
- "**本月使用金额** ": "**今月の使用料金** ",
6
- "**获取API使用情况失败**": "**API使用状況の取得に失敗しました**",
7
- "**获取API使用情况失败**,sensitive_id错误或已过期": "**API使用状況の取得に失敗しました**、sensitive_idが間違っているか、期限切れです",
8
- "**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**API使用状況の取得に失敗しました**、`config.json`に正しい`sensitive_id`を入力する必要があります",
9
- "API key为空,请检查是否输入正确。": "APIキーが入力されていません。正しく入力されているか確認してください。",
10
- "API密钥更改为了": "APIキーが変更されました",
11
- "JSON解析错误,收到的内容: ": "JSON解析エラー、受信内容: ",
12
- "SSL错误,无法获取对话。": "SSLエラー、会話を取得できません。",
13
- "Token 计数: ": "Token数: ",
14
- "☹️发生了错误:": "エラーが発生しました: ",
15
- "⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ APIキーの安全性を確保するために、`config.json`ファイルでネットワーク設定を変更してください。",
16
- "。你仍然可以使用聊天功能。": "。あなたはまだチャット機能を使用できます。",
17
- "上传": "アップロード",
18
- "上传了": "アップロードしました。",
19
- "上传到 OpenAI 后自动填充": "OpenAIへのアップロード後、自動的に入力されます",
20
- "上传到OpenAI": "OpenAIへのアップロード",
21
- "上传文件": "ファイルをアップロード",
22
- "仅供查看": "閲覧専用",
23
- "从Prompt模板中加载": "Promptテンプレートから読込",
24
- "从列表中加载对话": "リストから会話を読込",
25
- "代理地址": "プロキシアドレス",
26
- "代理错误,无法获取对话。": "プロキシエラー、会話を取得できません。",
27
- "你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)": "GPT-4にアクセス権がありません、[詳細はこちら](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)",
28
- "你没有选择任何对话历史": "あなたは何の会話履歴も選択していません。",
29
- "你真的要删除 ": "本当に ",
30
- "使用在线搜索": "オンライン検索を使用",
31
- "停止符,用英文逗号隔开...": "ここにストップ文字を英語のカンマで区切って入力してください...",
32
- "关于": "について",
33
- "准备数据集": "データセットの準備",
34
- "切换亮暗色主题": "テーマの明暗切替",
35
- "删除对话历史成功": "削除した会話の履歴",
36
- "删除这轮问答": "この質疑応答を削除",
37
- "刷新状态": "ステータスを更新",
38
- "剩余配额不足,[进一步了解](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)",
39
- "加载Prompt模板": "Promptテンプレートを読込",
40
- "单轮对话": "単発会話",
41
- "历史记录(JSON)": "履歴ファイル(JSON)",
42
- "参数": "パラメータ",
43
- "双栏pdf": "2カラムpdf",
44
- "取消": "キャンセル",
45
- "取消所有任务": "すべてのタスクをキャンセル",
46
- "可选,用于区分不同的模型": "オプション、異なるモデルを区別するために使用",
47
- "启用的工具:": "有効なツール:",
48
- "在工具箱中管理知识库文件": "ツールボックスでナレッジベースファイルの管理を行う",
49
- "在线搜索": "オンライン検索",
50
- "在这里输入": "ここに入力",
51
- "在这里输入System Prompt...": "System Promptを入力してください...",
52
- "多账号模式已开启,无需输入key,可直接开始对话": "複数アカウントモードがオンになっています。キーを入力する必要はありません。会話を開始できます",
53
- "好": "はい",
54
- "实时传输回答": "ストリーム出力",
55
- "对话": "会話",
56
- "对话历史": "対話履歴",
57
- "对话历史记录": "会話履歴",
58
- "对话命名方式": "会話の命名方法",
59
- "导出为 Markdown": "Markdownでエクスポート",
60
- "川虎Chat": "川虎Chat",
61
- "川虎Chat 🚀": "川虎Chat 🚀",
62
- "工具箱": "ツールボックス",
63
- "已经被删除啦": "削除されました。",
64
- "开始实时传输回答……": "ストリーム出力開始……",
65
- "开始训练": "トレーニングを開始",
66
- "微调": "ファインチューニング",
67
- "总结": "要約する",
68
- "总结完成": "完了",
69
- "您使用的就是最新版!": "最新バージョンを使用しています!",
70
- "您的IP区域:": "あなたのIPアドレス地域:",
71
- "您的IP区域:未知。": "あなたのIPアドレス地域:不明",
72
- "拓展": "拡張",
73
- "搜索(支持正则)...": "検索(正規表現をサポート)...",
74
- "数据集预览": "データセットのプレビュー",
75
- "文件ID": "ファイルID",
76
- "新对话 ": "新しい会話 ",
77
- "新建对话保留Prompt": "新しい会話を作成してください。プロンプトを保留します。",
78
- "暂时未知": "しばらく不明である",
79
- "更新": "アップデート",
80
- "更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "更新に失敗しました、[手動での更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)をお試しください。",
81
- "更新成功,请重启本程序": "更新が成功しました、このプログラムを再起動してください",
82
- "未命名对话历史记录": "名無しの会話履歴",
83
- "未设置代理...": "代理が設定されていません...",
84
- "本月使用金额": "今月の使用料金",
85
- "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "[使用ガイド](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)を表示",
86
- "根据日期时间": "日付と時刻に基づいて",
87
- "模型": "LLMモデル",
88
- "模型名称后缀": "モデル名のサフィックス",
89
- "模型自动总结(消耗tokens)": "モデルによる自動要約(トークン消費)",
90
- "模型设置为了:": "LLMモデルを設定しました: ",
91
- "正在尝试更新...": "更新を試みています...",
92
- "添加训练好的模型到模型列表": "トレーニング済みモデルをモデルリストに追加",
93
- "状态": "ステータス",
94
- "生成内容总结中……": "コンテンツ概要を生成しています...",
95
- "用于定位滥用行为": "不正行為を特定するために使用されます",
96
- "用户名": "ユーザー名",
97
- "由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)\n\n最新コードは川虎Chatのサイトへ [GitHubプロジェクト](https://github.com/GaiZhenbiao/ChuanhuChatGPT)",
98
- "知识库": "ナレッジベース",
99
- "知识库文件": "ナレッジベースファイル",
100
- "第一条提问": "最初の質問",
101
- "索引构建完成": "索引の構築が完了しました。",
102
- "网络": "ネットワーク",
103
- "获取API使用情况失败:": "API使用状況の取得に失敗しました:",
104
- "获取IP地理位置失败。原因:": "IPアドレス地域の取得に失敗しました。理由:",
105
- "获取对话时发生错误,请查看后台日志": "会話取得時にエラー発生、あとのログを確認してください",
106
- "训练": "トレーニング",
107
- "训练状态": "トレーニングステータス",
108
- "训练轮数(Epochs)": "トレーニングエポック数",
109
- "设置": "設定",
110
- "设置保存文件名": "保存ファイル名を設定",
111
- "设置文件名: 默认为.json,可选为.md": "ファイル名を設定: デフォルトは.json、.mdを選択できます",
112
- "识别公式": "formula OCR",
113
- "详情": "詳細",
114
- "请查看 config_example.json,配置 Azure OpenAI": "Azure OpenAIの設定については、config_example.jsonをご覧ください",
115
- "请检查网络连接,或者API-Key是否有效。": "ネットワーク接続を確認するか、APIキーが有効かどうかを確認してください。",
116
- "请输入对话内容。": "会話内容を入力してください。",
117
- "请输入有效的文件名,不要包含以下特殊字符:": "有効なファイル名を入力してください。以下の特殊文字は使用しないでください:",
118
- "读取超时,无法获取对话。": "読み込みタイムアウト、会話を取得できません。",
119
- "账单信息不适用": "課金情報は対象外です",
120
- "连接超时,无法获取对话。": "接続タイムアウト、会話を取得できません。",
121
- "选择LoRA模型": "LoRAモデルを選択",
122
- "选择Prompt模板集合文件": "Promptテンプレートコレクションを選択",
123
- "选择回复语言(针对搜索&索引功能)": "回答言語を選択(検索とインデックス機能に対して)",
124
- "选择数据集": "データセットの選択",
125
- "选择模型": "LLMモデルを選択",
126
- "重命名该对话": "会話の名前を変更",
127
- "重新生成": "再生成",
128
- "高级": "Advanced",
129
- ",本次对话累计消耗了 ": ", 今の会話で消費合計 ",
130
- "💾 保存对话": "💾 会話を保存",
131
- "📝 导出为 Markdown": "📝 Markdownにエクスポート",
132
- "🔄 切换API地址": "🔄 APIアドレスを切り替え",
133
- "🔄 刷新": "🔄 更新",
134
- "🔄 检查更新...": "🔄 アップデートをチェック...",
135
- "🔄 设置代理地址": "🔄 プロキシアドレスを設定",
136
- "🔄 重新生成": "🔄 再生成",
137
- "🔙 恢复默认网络设置": "🔙 ネットワーク設定のリセット",
138
- "🗑️ 删除最新对话": "🗑️ 最新の会話削除",
139
- "🗑️ 删除最旧对话": "🗑️ 最古の会話削除",
140
- "🧹 新的对话": "🧹 新しい会話"
141
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locale/ko_KR.json DELETED
@@ -1,141 +0,0 @@
1
- {
2
- " 吗?": " 을(를) 삭제하시겠습니까?",
3
- "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ 주의: 변경시 주의하세요. ⚠️",
4
- "**发送消息** 或 **提交key** 以显示额度": "**메세지를 전송** 하거나 **Key를 입력**하여 크레딧 표시",
5
- "**本月使用金额** ": "**이번 달 사용금액** ",
6
- "**获取API使用情况失败**": "**API 사용량 가져오기 실패**",
7
- "**获取API使用情况失败**,sensitive_id错误或已过期": "**API 사용량 가져오기 실패**. sensitive_id가 잘못되었거나 만료되었습니다",
8
- "**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**API 사용량 가져오기 실패**. `config.json`에 올바른 `sensitive_id`를 입력해야 합니다",
9
- "API key为空,请检查是否输入正确。": "API 키가 비어 있습니다. 올바르게 입력되었는지 확인하십세요.",
10
- "API密钥更改为了": "API 키가 변경되었습니다.",
11
- "JSON解析错误,收到的内容: ": "JSON 파싱 에러, 응답: ",
12
- "SSL错误,无法获取对话。": "SSL 에러, 대화를 가져올 수 없습니다.",
13
- "Token 计数: ": "토큰 수: ",
14
- "☹️发生了错误:": "☹️에러: ",
15
- "⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ API-Key의 안전을 보장하기 위해 네트워크 설정을 `config.json` 구성 파일에서 수정해주세요.",
16
- "。你仍然可以使用聊天功能。": ". 채팅 기능을 계속 사용할 수 있습니다.",
17
- "上传": "업로드",
18
- "上传了": "업로드되었습니다.",
19
- "上传到 OpenAI 后自动填充": "OpenAI로 업로드한 후 자동으로 채워집니다",
20
- "上传到OpenAI": "OpenAI로 업로드",
21
- "上传文件": "파일 업로드",
22
- "仅供查看": "읽기 전용",
23
- "从Prompt模板中加载": "프롬프트 템플릿에서 불러오기",
24
- "从列表中加载对话": "리스트에서 대화 불러오기",
25
- "代理地址": "프록시 주소",
26
- "代理错误,无法获取对话。": "프록시 에러, 대화를 가져올 수 없습니다.",
27
- "你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)": "GPT-4에 접근 권한이 없습니다. [자세히 알아보기](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)",
28
- "你没有选择任何对话历史": "대화 기록을 선택하지 않았습니다.",
29
- "你真的要删除 ": "정말로 ",
30
- "使用在线搜索": "온라인 검색 사용",
31
- "停止符,用英文逗号隔开...": "여기에 정지 토큰 입력, ','로 구분됨...",
32
- "关于": "관련",
33
- "准备数据集": "데이터셋 준비",
34
- "切换亮暗色主题": "라이트/다크 테마 전환",
35
- "删除对话历史成功": "대화 기록이 성공적으로 삭제되었습니다.",
36
- "删除这轮问答": "이 라운드의 질문과 답변 삭제",
37
- "刷新状态": "상태 새로 고침",
38
- "剩余配额不足,[进一步了解](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)을 확인하세요.",
39
- "加载Prompt模板": "프롬프트 템플릿 불러오기",
40
- "单轮对话": "단일 대화",
41
- "历史记录(JSON)": "기록 파일 (JSON)",
42
- "参数": "파라미터들",
43
- "双栏pdf": "2-column pdf",
44
- "取消": "취소",
45
- "取消所有任务": "모든 작업 취소",
46
- "可选,用于区分不同的模型": "선택 사항, 다른 모델을 구분하는 데 사용",
47
- "启用的工具:": "활성화된 도구: ",
48
- "在工具箱中管理知识库文件": "지식 라이브러리 파일을 도구 상자에서 관리",
49
- "在线搜索": "온라인 검색",
50
- "在这里输入": "여기에 입력하세요",
51
- "在这里输入System Prompt...": "여기에 시스템 프롬프트를 입력하세요...",
52
- "多账号模式已开启,无需输入key,可直接开始对话": "다중 계정 모드가 활성화되어 있으므로 키를 입력할 필요가 없이 바로 대화를 시작할 수 있습니다",
53
- "好": "예",
54
- "实时传输回答": "실시간 전송",
55
- "对话": "대화",
56
- "对话历史": "대화 내역",
57
- "对话历史记录": "대화 기록",
58
- "对话命名方式": "대화 이름 설정",
59
- "导出为 Markdown": "마크다운으로 내보내기",
60
- "川虎Chat": "Chuanhu Chat",
61
- "川虎Chat 🚀": "Chuanhu Chat 🚀",
62
- "工具箱": "도구 상자",
63
- "已经被删除啦": "이미 삭제되었습니다.",
64
- "开始实时传输回答……": "실시간 응답 출력 시작...",
65
- "开始训练": "훈련 시작",
66
- "微调": "미세 조정",
67
- "总结": "요약",
68
- "总结完成": "작업 완료",
69
- "您使用的就是最新版!": "최신 버전을 사용하고 있습니다!",
70
- "您的IP区域:": "당신의 IP 지역: ",
71
- "您的IP区域:未知。": "IP 지역: 알 수 없음.",
72
- "拓展": "확장",
73
- "搜索(支持正则)...": "검색 (정규식 지원)...",
74
- "数据集预览": "데이터셋 미리보기",
75
- "文件ID": "파일 ID",
76
- "新对话 ": "새 대화 ",
77
- "新建对话保留Prompt": "새 대화 생성, 프롬프트 유지하기",
78
- "暂时未知": "알 수 없음",
79
- "更新": "업데이트",
80
- "更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "업데이트 실패, [수동 업데이트](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)를 시도하십시오",
81
- "更新成功,请重启本程序": "업데이트 성공, 이 프로그램을 재시작 해주세요",
82
- "未命名对话历史记录": "이름없는 대화 기록",
83
- "未设置代理...": "대리인이 설정되지 않았습니다...",
84
- "本月使用金额": "이번 달 사용금액",
85
- "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "[사용 가이드](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) 보기",
86
- "根据日期时间": "날짜 및 시간 기준",
87
- "模型": "LLM 모델",
88
- "模型名称后缀": "모델 이름 접미사",
89
- "模型自动总结(消耗tokens)": "모델에 의한 자동 요약 (토큰 소비)",
90
- "模型设置为了:": "설정된 모델: ",
91
- "正在尝试更新...": "업데이트를 시도 중...",
92
- "添加训练好的模型到模型列表": "훈련된 모델을 모델 목록에 추가",
93
- "状态": "상태",
94
- "生成内容总结中……": "콘텐츠 요약 생성중...",
95
- "用于定位滥用行为": "악용 사례 파악에 활용됨",
96
- "用户名": "사용자 이름",
97
- "由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)\n\n최신 코드 다운로드: [GitHub](https://github.com/GaiZhenbiao/ChuanhuChatGPT)",
98
- "知识库": "지식 라이브러리",
99
- "知识库文件": "지식 라이브러리 파일",
100
- "第一条提问": "첫 번째 질문",
101
- "索引构建完成": "인덱스 구축이 완료되었습니다.",
102
- "网络": "네트워크",
103
- "获取API使用情况失败:": "API 사용량 가져오기 실패:",
104
- "获取IP地理位置失败。原因:": "다음과 같은 이유로 IP 위치를 가져올 수 없습니다. 이유: ",
105
- "获取对话时发生错误,请查看后台日志": "대화를 가져오는 중 에러가 발생했습니다. 백그라운드 로그를 확인하세요",
106
- "训练": "훈련",
107
- "训练状态": "훈련 상태",
108
- "训练轮数(Epochs)": "훈련 라운드(Epochs)",
109
- "设置": "설정",
110
- "设置保存文件名": "저장 파일명 설정",
111
- "设置文件名: 默认为.json,可选为.md": "파일 이름 설정: 기본값: .json, 선택: .md",
112
- "识别公式": "formula OCR",
113
- "详情": "상세",
114
- "请查看 config_example.json,配置 Azure OpenAI": "Azure OpenAI 설정을 확인하세요",
115
- "请检查网络连接,或者API-Key是否有效。": "네트워크 연결 또는 API키가 유효한지 확인하세요",
116
- "请输入对话内容。": "대화 내용을 입력하세요.",
117
- "请输入有效的文件名,不要包含以下特殊字符:": "유효한 파일 이름을 입력하세요. 다음 특수 문자는 포함하지 마세요: ",
118
- "读取超时,无法获取对话。": "읽기 시간 초과, 대화를 가져올 수 없습니다.",
119
- "账单信息不适用": "청구 정보를 가져올 수 없습니다",
120
- "连接超时,无法获取对话。": "연결 시간 초과, 대화를 가져올 수 없습니다.",
121
- "选择LoRA模型": "LoRA 모델 선택",
122
- "选择Prompt模板集合文件": "프롬프트 콜렉션 파일 선택",
123
- "选择回复语言(针对搜索&索引功能)": "답장 언어 선택 (검색 & 인덱스용)",
124
- "选择数据集": "데이터셋 선택",
125
- "选择模型": "모델 선택",
126
- "重命名该对话": "대화 이름 변경",
127
- "重新生成": "재생성",
128
- "高级": "고급",
129
- ",本次对话累计消耗了 ": ",이 대화의 전체 비용은 ",
130
- "💾 保存对话": "💾 대화 저장",
131
- "📝 导出为 Markdown": "📝 마크다운으로 내보내기",
132
- "🔄 切换API地址": "🔄 API 주소 변경",
133
- "🔄 刷新": "🔄 새로고침",
134
- "🔄 检查更新...": "🔄 업���이트 확인...",
135
- "🔄 设置代理地址": "🔄 프록시 주소 설정",
136
- "🔄 重新生成": "🔄 재생성",
137
- "🔙 恢复默认网络设置": "🔙 네트워크 설정 초기화",
138
- "🗑️ 删除最新对话": "🗑️ 최신 대화 삭제",
139
- "🗑️ 删除最旧对话": "🗑️ 가장 오래된 대화 삭제",
140
- "🧹 新的对话": "🧹 새로운 대화"
141
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locale/ru_RU.json DELETED
@@ -1,141 +0,0 @@
1
- {
2
- " 吗?": " ?",
3
- "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ ВНИМАНИЕ: ИЗМЕНЯЙТЕ ОСТОРОЖНО ⚠️",
4
- "**发送消息** 或 **提交key** 以显示额度": "**Отправить сообщение** или **отправить ключ** для отображения лимита",
5
- "**本月使用金额** ": "**Использовано средств в этом месяце**",
6
- "**获取API使用情况失败**": "**Не удалось получить информацию об использовании API**",
7
- "**获取API使用情况失败**,sensitive_id错误或已过期": "**Не удалось получить информацию об использовании API**, ошибка sensitive_id или истек срок действия",
8
- "**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**Не удалось получить информацию об использовании API**, необходимо правильно заполнить sensitive_id в `config.json`",
9
- "API key为空,请检查是否输入正确。": "Пустой API-Key, пожалуйста, проверьте правильность ввода.",
10
- "API密钥更改为了": "Ключ API изменен на",
11
- "JSON解析错误,收到的内容: ": "Ошибка анализа JSON, полученный контент:",
12
- "SSL错误,无法获取对话。": "Ошибка SSL, не удалось получить диалог.",
13
- "Token 计数: ": "Использованно токенов: ",
14
- "☹️发生了错误:": "☹️ Произошла ошибка:",
15
- "⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ Для обеспечения безопасности API-Key, измените настройки сети в файле конфигурации `config.json`",
16
- "。你仍然可以使用聊天功能。": ". Вы все равно можете использовать функцию чата.",
17
- "上传": "Загрузить",
18
- "上传了": "Загрузка завершена.",
19
- "上传到 OpenAI 后自动填充": "Автоматическое заполнение после загрузки в OpenAI",
20
- "上传到OpenAI": "Загрузить в OpenAI",
21
- "上传文件": "Загрузить файл",
22
- "仅供查看": "Только для просмотра",
23
- "从Prompt模板中加载": "Загрузить из шаблона Prompt",
24
- "从列表中加载对话": "Загрузить диалог из списка",
25
- "代理地址": "Адрес прокси",
26
- "代理错误,无法获取对话。": "Ошибка прокси, не удалось получить диалог.",
27
- "你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)": "У вас нет доступа к GPT4, [подробнее](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)",
28
- "你没有选择任何对话历史": "Вы не выбрали никакой истории переписки",
29
- "你真的要删除 ": "Вы уверены, что хотите удалить ",
30
- "使用在线搜索": "Использовать онлайн-поиск",
31
- "停止符,用英文逗号隔开...": "Разделительные символы, разделенные запятой...",
32
- "关于": "О программе",
33
- "准备数据集": "Подготовка набора данных",
34
- "切换亮暗色主题": "Переключить светлую/темную тему",
35
- "删除对话历史成功": "Успешно удалена история переписки.",
36
- "删除这轮问答": "Удалить этот раунд вопросов и ответов",
37
- "刷新状态": "Обновить статус",
38
- "剩余配额不足,[进一步了解](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)",
39
- "加载Prompt模板": "Загрузить шаблон Prompt",
40
- "单轮对话": "Одиночный диалог",
41
- "历史记录(JSON)": "Файл истории (JSON)",
42
- "参数": "Параметры",
43
- "双栏pdf": "Двухколоночный PDF",
44
- "取消": "Отмена",
45
- "取消所有任务": "Отменить все задачи",
46
- "可选,用于区分不同的模型": "Необязательно, используется для различения разных моделей",
47
- "启用的工具:": "Включенные инструменты:",
48
- "在工具箱中管理知识库文件": "Управление файлами базы знаний в инструментах",
49
- "在线搜索": "Онлайн-поиск",
50
- "在这里输入": "Введите здесь",
51
- "在这里输入System Prompt...": "Введите здесь системное подсказку...",
52
- "多账号模式已开启,无需输入key,可直接开始对话": "Режим множественных аккаунтов включен, не требуется ввод ключа, можно сразу начать диалог",
53
- "好": "Хорошо",
54
- "实时传输回答": "Передача ответа в реальном времени",
55
- "对话": "Диалог",
56
- "对话历史": "Диалоговая история",
57
- "对话历史记录": "История диалога",
58
- "对话命名方式": "Способ названия диалога",
59
- "导出为 Markdown": "Экспортировать в Markdown",
60
- "川虎Chat": "Chuanhu Чат",
61
- "川虎Chat 🚀": "Chuanhu Чат 🚀",
62
- "工具箱": "Инструменты",
63
- "已经被删除啦": "Уже удалено.",
64
- "开始实时传输回答……": "Начните трансляцию ответов в режиме реального времени...",
65
- "开始训练": "Начать обучение",
66
- "微调": "Своя модель",
67
- "总结": "Подведение итога",
68
- "总结完成": "Готово",
69
- "您使用的就是最新版!": "Вы используете последнюю версию!",
70
- "您的IP区域:": "Ваша IP-зона:",
71
- "您的IP区域:未知。": "Ваша IP-зона: неизвестно.",
72
- "拓展": "Расширенные настройки",
73
- "搜索(支持正则)...": "Поиск (поддержка регулярности)...",
74
- "数据集预览": "Предпросмотр набора данных",
75
- "文件ID": "Идентификатор файла",
76
- "新对话 ": "Новый диалог ",
77
- "新建对话保留Prompt": "Создать диалог с сохранением подсказки",
78
- "暂时未知": "Временно неизвестно",
79
- "更新": "Обновить",
80
- "更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Обновление не удалось, пожалуйста, попробуйте обновить вручную",
81
- "更新成功,请重启本程序": "Обновление успешно, пожалуйста, перезапустите программу",
82
- "未命名对话历史记录": "Безымянная история диалога",
83
- "未设置代理...": "Прокси не настроен...",
84
- "本月使用金额": "Использовано средств в этом месяце",
85
- "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "[Здесь](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) можно ознакомиться с инструкцией по использованию",
86
- "根据日期时间": "По дате и времени",
87
- "模型": "Модель",
88
- "模型名称后缀": "Суффикс имени модели",
89
- "模型自动总结(消耗tokens)": "Автоматическое подведение итогов модели (потребление токенов)",
90
- "模型设置为了:": "Модель настроена на:",
91
- "正在尝试更新...": "Попытка обновления...",
92
- "添加训练好的模型到模型列表": "Добавить обученную модель в список моделей",
93
- "状态": "Статус",
94
- "生成内容总结中……": "Создание сводки контента...",
95
- "用于定位滥用行为": "Используется для выявления злоупотреблений",
96
- "用户名": "Имя пользователя",
97
- "由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, чтобы загрузить последнюю версию скрипта",
98
- "知识库": "База знаний",
99
- "知识库文件": "Файл базы знаний",
100
- "第一条提问": "Первый вопрос",
101
- "索引构建完成": "Индексирование завершено.",
102
- "网络": "Параметры сети",
103
- "获取API使用情况失败:": "Не удалось получитьAPIинформацию об использовании:",
104
- "获取IP地理位置失��。原因:": "Не удалось получить географическое положение IP. Причина:",
105
- "获取对话时发生错误,请查看后台日志": "Возникла ошибка при получении диалога, пожалуйста, проверьте журналы",
106
- "训练": "Обучение",
107
- "训练状态": "Статус обучения",
108
- "训练轮数(Epochs)": "Количество эпох обучения",
109
- "设置": "Настройки",
110
- "设置保存文件名": "Установить имя сохраняемого файла",
111
- "设置文件名: 默认为.json,可选为.md": "Установить имя файла: по умолчанию .json, можно выбрать .md",
112
- "识别公式": "Распознавание формул",
113
- "详情": "Подробности",
114
- "请查看 config_example.json,配置 Azure OpenAI": "Пожалуйста, просмотрите config_example.json для настройки Azure OpenAI",
115
- "请检查网络连接,或者API-Key是否有效。": "Проверьте подключение к сети или действительность API-Key.",
116
- "请输入对话内容。": "Пожалуйста, введите содержание диалога.",
117
- "请输入有效的文件名,不要包含以下特殊字符:": "Введите действительное имя файла, не содержащее следующих специальных символов: ",
118
- "读取超时,无法获取对话。": "Тайм-аут чтения, не удалось получить диалог.",
119
- "账单信息不适用": "Информация о счете не применима",
120
- "连接超时,无法获取对话。": "Тайм-аут подключения, не удалось получить диалог.",
121
- "选择LoRA模型": "Выберите модель LoRA",
122
- "选择Prompt模板集合文件": "Выберите файл с набором шаблонов Prompt",
123
- "选择回复语言(针对搜索&索引功能)": "Выберите язык ответа (для функций поиска и индексации)",
124
- "选择数据集": "Выберите набор данных",
125
- "选择模型": "Выберите модель",
126
- "重命名该对话": "Переименовать этот диалог",
127
- "重新生成": "Пересоздать",
128
- "高级": "Расширенные настройки",
129
- ",本次对话累计消耗了 ": ", Общая стоимость этого диалога составляет ",
130
- "💾 保存对话": "💾 Сохранить диалог",
131
- "📝 导出为 Markdown": "📝 Экспортировать в Markdown",
132
- "🔄 切换API地址": "🔄 Переключить адрес API",
133
- "🔄 刷新": "🔄 Обновить",
134
- "🔄 检查更新...": "🔄 Проверить обновления...",
135
- "🔄 设置代理地址": "🔄 Установить адрес прокси",
136
- "🔄 重新生成": "🔄 Пересоздать",
137
- "🔙 恢复默认网络设置": "🔙 Восстановить настройки сети по умолчанию",
138
- "🗑️ 删除最新对话": "🗑️ Удалить последний диалог",
139
- "🗑️ 删除最旧对话": "🗑️ Удалить старейший диалог",
140
- "🧹 新的对话": "🧹 Новый диалог"
141
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locale/sv-SE.json DELETED
@@ -1,87 +0,0 @@
1
- {
2
- "未命名对话历史记录": "Onämnd Dialoghistorik",
3
- "在这里输入": "Skriv in här",
4
- "🧹 新的对话": "🧹 Ny Dialog",
5
- "🔄 重新生成": "🔄 Regenerera",
6
- "🗑️ 删除最旧对话": "🗑️ Ta bort äldsta dialogen",
7
- "🗑️ 删除最新对话": "🗑️ Ta bort senaste dialogen",
8
- "模型": "Modell",
9
- "多账号模式已开启,无需输入key,可直接开始对话": "Flerkontoläge är aktiverat, ingen nyckel behövs, du kan starta dialogen direkt",
10
- "**发送消息** 或 **提交key** 以显示额度": "**Skicka meddelande** eller **Skicka in nyckel** för att visa kredit",
11
- "选择模型": "Välj Modell",
12
- "选择LoRA模型": "Välj LoRA Modell",
13
- "实时传输回答": "Strömmande utdata",
14
- "单轮对话": "Enkel dialog",
15
- "使用在线搜索": "Använd online-sökning",
16
- "选择回复语言(针对搜索&索引功能)": "Välj svarspråk (för sök- och indexfunktion)",
17
- "上传索引文件": "Ladda upp",
18
- "双栏pdf": "Två-kolumns pdf",
19
- "识别公式": "Formel OCR",
20
- "在这里输入System Prompt...": "Skriv in System Prompt här...",
21
- "加载Prompt模板": "Ladda Prompt-mall",
22
- "选择Prompt模板集合文件": "Välj Prompt-mall Samlingsfil",
23
- "🔄 刷新": "🔄 Uppdatera",
24
- "从Prompt模板中加载": "Ladda från Prompt-mall",
25
- "保存/加载": "Spara/Ladda",
26
- "保存/加载对话历史记录": "Spara/Ladda Dialoghistorik",
27
- "从列表中加载对话": "Ladda dialog från lista",
28
- "设置文件名: 默认为.json,可选为.md": "Ställ in filnamn: standard är .json, valfritt är .md",
29
- "设置保存文件名": "Ställ in sparfilnamn",
30
- "对话历史记录": "Dialoghistorik",
31
- "💾 保存对话": "💾 Spara Dialog",
32
- "📝 导出为Markdown": "📝 Exportera som Markdown",
33
- "默认保存于history文件夹": "Sparas som standard i mappen history",
34
- "高级": "Avancerat",
35
- "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Var försiktig med ändringar. ⚠️",
36
- "参数": "Parametrar",
37
- "停止符,用英文逗号隔开...": "Skriv in stopptecken här, separerade med kommatecken...",
38
- "用于定位滥用行为": "Används för att lokalisera missbruk",
39
- "用户名": "Användarnamn",
40
- "在这里输入API-Host...": "Skriv in API-Host här...",
41
- "🔄 切换API地址": "🔄 Byt API-adress",
42
- "未设置代理...": "Inte inställd proxy...",
43
- "代理地址": "Proxyadress",
44
- "🔄 设置代理地址": "🔄 Ställ in Proxyadress",
45
- "🔙 恢复网络默认设置": "🔙 Återställ Nätverksinställningar",
46
- "🔄 检查更新...": "🔄 Sök efter uppdateringar...",
47
- "取消": "Avbryt",
48
- "更新": "Uppdatera",
49
- "详情": "Detaljer",
50
- "好": "OK",
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
- "川虎Chat 🚀": "Chuanhu Chat 🚀",
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
- "---\n⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "---\n⚠️ För att säkerställa säkerheten för API-nyckeln, vänligen ändra nätverksinställningarna i konfigurationsfilen `config.json`.",
86
- "网络参数": "nätverksparametrar"
87
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locale/sv_SE.json DELETED
@@ -1,141 +0,0 @@
1
- {
2
- " 吗?": " ?",
3
- "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Var försiktig med ändringar. ⚠️",
4
- "**发送消息** 或 **提交key** 以显示额度": "**Skicka meddelande** eller **Skicka in nyckel** för att visa kredit",
5
- "**本月使用金额** ": "**Månadens användning** ",
6
- "**获取API使用情况失败**": "**Misslyckades med att hämta API-användning**",
7
- "**获取API使用情况失败**,sensitive_id错误或已过期": "**Misslyckades med att hämta API-användning**, felaktig eller utgången sensitive_id",
8
- "**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**Misslyckades med att hämta API-användning**, korrekt sensitive_id behövs i `config.json`",
9
- "API key为空,请检查是否输入正确。": "API-nyckeln är tom, kontrollera om den är korrekt inmatad.",
10
- "API密钥更改为了": "API-nyckeln har ändrats till",
11
- "JSON解析错误,收到的内容: ": "JSON-tolkningsfel, mottaget innehåll: ",
12
- "SSL错误,无法获取对话。": "SSL-fel, kunde inte hämta dialogen.",
13
- "Token 计数: ": "Tokenräkning: ",
14
- "☹️发生了错误:": "☹️Fel: ",
15
- "⚠️ 为保证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`.",
16
- "。你仍然可以使用聊天功能。": ". Du kan fortfarande använda chattfunktionen.",
17
- "上传": "Ladda upp",
18
- "上传了": "Uppladdad",
19
- "上传到 OpenAI 后自动填充": "Automatiskt ifylld efter uppladdning till OpenAI",
20
- "上传到OpenAI": "Ladda upp till OpenAI",
21
- "上传文件": "ladda upp fil",
22
- "仅供查看": "Endast för visning",
23
- "从Prompt模板中加载": "Ladda från Prompt-mall",
24
- "从列表中加载对话": "Ladda dialog från lista",
25
- "代理地址": "Proxyadress",
26
- "代理错误,无法获取对话。": "Proxyfel, kunde inte hämta dialogen.",
27
- "你没有权限访问 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)",
28
- "你没有选择任何对话历史": "Du har inte valt någon konversationshistorik.",
29
- "你真的要删除 ": "Är du säker på att du vill ta bort ",
30
- "使用在线搜索": "Använd online-sökning",
31
- "停止符,用英文逗号隔开...": "Skriv in stopptecken här, separerade med kommatecken...",
32
- "关于": "om",
33
- "准备数据集": "Förbered dataset",
34
- "切换亮暗色主题": "Byt ljus/mörk tema",
35
- "删除对话历史成功": "Raderade konversationens historik.",
36
- "删除这轮问答": "Ta bort denna omgång av Q&A",
37
- "刷新状态": "Uppdatera status",
38
- "剩余配额不足,[进一步了解](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)": "Återstående kvot är otillräcklig, [läs mer](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/%C3%84mnen)",
39
- "加载Prompt模板": "Ladda Prompt-mall",
40
- "单轮对话": "Enkel dialog",
41
- "历史记录(JSON)": "Historikfil (JSON)",
42
- "参数": "Parametrar",
43
- "双栏pdf": "Två-kolumns pdf",
44
- "取消": "Avbryt",
45
- "取消所有任务": "Avbryt alla uppgifter",
46
- "可选,用于区分不同的模型": "Valfritt, används för att särskilja olika modeller",
47
- "启用的工具:": "Aktiverade verktyg: ",
48
- "在工具箱中管理知识库文件": "hantera kunskapsbankfiler i verktygslådan",
49
- "在线搜索": "onlinesökning",
50
- "在这里输入": "Skriv in här",
51
- "在这里输入System Prompt...": "Skriv in System Prompt här...",
52
- "多账号模式已开启,无需输入key,可直接开始对话": "Flerkontoläge är aktiverat, ingen nyckel behövs, du kan starta dialogen direkt",
53
- "好": "OK",
54
- "实时传输回答": "Strömmande utdata",
55
- "对话": "konversation",
56
- "对话历史": "Dialoghistorik",
57
- "对话历史记录": "Dialoghistorik",
58
- "对话命名方式": "Dialognamn",
59
- "导出为 Markdown": "Exportera som Markdown",
60
- "川虎Chat": "Chuanhu Chat",
61
- "川虎Chat 🚀": "Chuanhu Chat 🚀",
62
- "工具箱": "verktygslåda",
63
- "已经被删除啦": "Har raderats.",
64
- "开始实时传输回答……": "Börjar strömma utdata...",
65
- "开始训练": "Börja träning",
66
- "微调": "Finjustering",
67
- "总结": "Sammanfatta",
68
- "总结完成": "Slutfört sammanfattningen.",
69
- "您使用的就是最新版!": "Du använder den senaste versionen!",
70
- "您的IP区域:": "Din IP-region: ",
71
- "您的IP区域:未知。": "Din IP-region: Okänd.",
72
- "拓展": "utvidgning",
73
- "搜索(支持正则)...": "Sök (stöd för reguljära uttryck)...",
74
- "数据集预览": "Datasetförhandsvisning",
75
- "文件ID": "Fil-ID",
76
- "新���话 ": "Ny dialog ",
77
- "新建对话保留Prompt": "Skapa ny konversation med bevarad Prompt",
78
- "暂时未知": "Okänd",
79
- "更新": "Uppdatera",
80
- "更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Uppdateringen misslyckades, prova att [uppdatera manuellt](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)",
81
- "更新成功,请重启本程序": "Uppdaterat framgångsrikt, starta om programmet",
82
- "未命名对话历史记录": "Onämnd Dialoghistorik",
83
- "未设置代理...": "Inte inställd proxy...",
84
- "本月使用金额": "Månadens användning",
85
- "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "Se [användarguiden](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) för mer information",
86
- "根据日期时间": "Enligt datum och tid",
87
- "模型": "Modell",
88
- "模型名称后缀": "Modellnamnstillägg",
89
- "模型自动总结(消耗tokens)": "Modellens automatiska sammanfattning (förbrukar tokens)",
90
- "模型设置为了:": "Modellen är inställd på: ",
91
- "正在尝试更新...": "Försöker uppdatera...",
92
- "添加训练好的模型到模型列表": "Lägg till tränad modell i modellistan",
93
- "状态": "Status",
94
- "生成内容总结中……": "Genererar innehållssammanfattning...",
95
- "用于定位滥用行为": "Används för att lokalisera missbruk",
96
- "用户名": "Användarnamn",
97
- "由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)",
98
- "知识库": "kunskapsbank",
99
- "知识库文件": "kunskapsbankfil",
100
- "第一条提问": "Första frågan",
101
- "索引构建完成": "Indexet har blivit byggt färdigt.",
102
- "网络": "nätverksparametrar",
103
- "获取API使用情况失败:": "Misslyckades med att hämta API-användning:",
104
- "获取IP地理位置失败。原因:": "Misslyckades med att hämta IP-plats. Orsak: ",
105
- "获取对话时发生错误,请查看后台日志": "Ett fel uppstod när dialogen hämtades, kontrollera bakgrundsloggen",
106
- "训练": "träning",
107
- "训练状态": "Träningsstatus",
108
- "训练轮数(Epochs)": "Träningsomgångar (Epochs)",
109
- "设置": "inställningar",
110
- "设置保存文件名": "Ställ in sparfilnamn",
111
- "设置文件名: 默认为.json,可选为.md": "Ställ in filnamn: standard är .json, valfritt är .md",
112
- "识别公式": "Formel OCR",
113
- "详情": "Detaljer",
114
- "请查看 config_example.json,配置 Azure OpenAI": "Vänligen granska config_example.json för att konfigurera Azure OpenAI",
115
- "请检查网络连接,或者API-Key是否有效。": "Kontrollera nätverksanslutningen eller om API-nyckeln är giltig.",
116
- "请输入对话内容。": "Ange dialoginnehåll.",
117
- "请输入有效的文件名,不要包含以下特殊字符:": "Ange ett giltigt filnamn, använd inte följande specialtecken: ",
118
- "读取超时,无法获取对话。": "Läsningen tog för lång tid, kunde inte hämta dialogen.",
119
- "账单信息不适用": "Faktureringsinformation är inte tillämplig",
120
- "连接超时,无法获取对话。": "Anslutningen tog för lång tid, kunde inte hämta dialogen.",
121
- "选择LoRA模型": "Välj LoRA Modell",
122
- "选择Prompt模板集合文件": "Välj Prompt-mall Samlingsfil",
123
- "选择回复语言(针对搜索&索引功能)": "Välj svarspråk (för sök- och indexfunktion)",
124
- "选择数据集": "Välj dataset",
125
- "选择模型": "Välj Modell",
126
- "重命名该对话": "Byt namn på dialogen",
127
- "重新生成": "Återgenerera",
128
- "高级": "Avancerat",
129
- ",本次对话累计消耗了 ": ", Total kostnad för denna dialog är ",
130
- "💾 保存对话": "💾 Spara Dialog",
131
- "📝 导出为 Markdown": "📝 Exportera som Markdown",
132
- "🔄 切换API地址": "🔄 Byt API-adress",
133
- "🔄 刷新": "🔄 Uppdatera",
134
- "🔄 检查更新...": "🔄 Sök efter uppdateringar...",
135
- "🔄 设置代理地址": "🔄 Ställ in Proxyadress",
136
- "🔄 重新生成": "🔄 Regenerera",
137
- "🔙 恢复默认网络设置": "🔙 Återställ standardnätverksinställningar+",
138
- "🗑️ 删除最新对话": "🗑️ Ta bort senaste dialogen",
139
- "🗑️ 删除最旧对话": "🗑️ Ta bort äldsta dialogen",
140
- "🧹 新的对话": "🧹 Ny Dialog"
141
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locale/vi_VN.json DELETED
@@ -1,141 +0,0 @@
1
- {
2
- " 吗?": " ?",
3
- "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Lưu ý: Thay đổi yêu cầu cẩn thận. ⚠️",
4
- "**发送消息** 或 **提交key** 以显示额度": "**Gửi tin nhắn** hoặc **Gửi khóa(key)** để hiển thị số dư",
5
- "**本月使用金额** ": "**Số tiền sử dụng trong tháng** ",
6
- "**获取API使用情况失败**": "**Lỗi khi lấy thông tin sử dụng API**",
7
- "**获取API使用情况失败**,sensitive_id错误或已过期": "**Lỗi khi lấy thông tin sử dụng API**, sensitive_id sai hoặc đã hết hạn",
8
- "**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**Lỗi khi lấy thông tin sử dụng API**, cần điền đúng sensitive_id trong tệp `config.json`",
9
- "API key为空,请检查是否输入正确。": "Khóa API trống, vui lòng kiểm tra xem đã nhập đúng chưa.",
10
- "API密钥更改为了": "Khóa API đã được thay đổi thành",
11
- "JSON解析错误,收到的内容: ": "Lỗi phân tích JSON, nội dung nhận được: ",
12
- "SSL错误,无法获取对话。": "Lỗi SSL, không thể nhận cuộc trò chuyện.",
13
- "Token 计数: ": "Số lượng Token: ",
14
- "☹️发生了错误:": "☹️Lỗi: ",
15
- "⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ Để đảm bảo an toàn cho API-Key, vui lòng chỉnh sửa cài đặt mạng trong tệp cấu hình `config.json`.",
16
- "。你仍然可以使用聊天功能。": ". Bạn vẫn có thể sử dụng chức năng trò chuyện.",
17
- "上传": "Tải lên",
18
- "上传了": "Tải lên thành công.",
19
- "上传到 OpenAI 后自动填充": "Tự động điền sau khi tải lên OpenAI",
20
- "上传到OpenAI": "Tải lên OpenAI",
21
- "上传文件": "Tải lên tệp",
22
- "仅供查看": "Chỉ xem",
23
- "从Prompt模板中加载": "Tải từ mẫu Prompt",
24
- "从列表中加载对话": "Tải cuộc trò chuyện từ danh sách",
25
- "代理地址": "Địa chỉ proxy",
26
- "代理错误,无法获取对话。": "Lỗi proxy, không thể nhận cuộc trò chuyện.",
27
- "你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)": "Bạn không có quyền truy cập GPT-4, [tìm hiểu thêm](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)",
28
- "你没有选择任何对话历史": "Bạn chưa chọn bất kỳ lịch sử trò chuyện nào.",
29
- "你真的要删除 ": "Bạn có chắc chắn muốn xóa ",
30
- "使用在线搜索": "Sử dụng tìm kiếm trực tuyến",
31
- "停止符,用英文逗号隔开...": "Nhập dấu dừng, cách nhau bằng dấu phẩy...",
32
- "关于": "Về",
33
- "准备数据集": "Chuẩn bị tập dữ liệu",
34
- "切换亮暗色主题": "Chuyển đổi chủ đề sáng/tối",
35
- "删除对话历史成功": "Xóa lịch sử cuộc trò chuyện thành công.",
36
- "删除这轮问答": "Xóa cuộc trò chuyện này",
37
- "刷新状态": "Làm mới tình trạng",
38
- "剩余配额不足,[进一步了解](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)": "剩余配额 không đủ, [Nhấn vào đây để biết thêm](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)",
39
- "加载Prompt模板": "Tải mẫu Prompt",
40
- "单轮对话": "Cuộc trò chuyện một lượt",
41
- "历史记录(JSON)": "Tệp lịch sử (JSON)",
42
- "参数": "Tham số",
43
- "双栏pdf": "PDF hai cột",
44
- "取消": "Hủy",
45
- "取消所有任务": "Hủy tất cả các nhiệm vụ",
46
- "可选,用于区分不同的模型": "Tùy chọn, sử dụng để phân biệt các mô hình khác nhau",
47
- "启用的工具:": "Công cụ đã bật: ",
48
- "在工具箱中管理知识库文件": "Quản lý tệp cơ sở kiến thức trong hộp công cụ",
49
- "在线搜索": "Tìm kiếm trực tuyến",
50
- "在这里输入": "Nhập vào đây",
51
- "在这里输入System Prompt...": "Nhập System Prompt ở đây...",
52
- "多账号模式已开启,无需输入key,可直接开始对话": "Chế độ nhiều tài khoản đã được bật, không cần nhập key, bạn có thể bắt đầu cuộc trò chuyện trực tiếp",
53
- "好": "OK",
54
- "实时传输回答": "Truyền đầu ra trực tiếp",
55
- "对话": "Cuộc trò chuyện",
56
- "对话历史": "Lịch sử cuộc trò chuyện",
57
- "对话历史记录": "Lịch sử Cuộc trò chuyện",
58
- "对话命名方式": "Phương thức đặt tên lịch sử trò chuyện",
59
- "导出为 Markdown": "Xuất ra Markdown",
60
- "川虎Chat": "Chuanhu Chat",
61
- "川虎Chat 🚀": "Chuanhu Chat 🚀",
62
- "工具箱": "Hộp công cụ",
63
- "已经��删除啦": "Đã bị xóa rồi.",
64
- "开始实时传输回答……": "Bắt đầu truyền đầu ra trực tiếp...",
65
- "开始训练": "Bắt đầu đào tạo",
66
- "微调": "Feeling-tuning",
67
- "总结": "Tóm tắt",
68
- "总结完成": "Hoàn thành tóm tắt",
69
- "您使用的就是最新版!": "Bạn đang sử dụng phiên bản mới nhất!",
70
- "您的IP区域:": "Khu vực IP của bạn: ",
71
- "您的IP区域:未知。": "Khu vực IP của bạn: Không xác định.",
72
- "拓展": "Mở rộng",
73
- "搜索(支持正则)...": "Tìm kiếm (hỗ trợ regex)...",
74
- "数据集预览": "Xem trước tập dữ liệu",
75
- "文件ID": "ID Tệp",
76
- "新对话 ": "Cuộc trò chuyện mới ",
77
- "新建对话保留Prompt": "Tạo Cuộc trò chuyện mới và giữ Prompt nguyên vẹn",
78
- "暂时未知": "Tạm thời chưa xác định",
79
- "更新": "Cập nhật",
80
- "更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Cập nhật thất bại, vui lòng thử [cập nhật thủ công](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)",
81
- "更新成功,请重启本程序": "Cập nhật thành công, vui lòng khởi động lại chương trình này",
82
- "未命名对话历史记录": "Lịch sử Cuộc trò chuyện không đặt tên",
83
- "未设置代理...": "Không có proxy...",
84
- "本月使用金额": "Số tiền sử dụng trong tháng",
85
- "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "Xem [hướng dẫn sử dụng](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) để biết thêm chi tiết",
86
- "根据日期时间": "Theo ngày và giờ",
87
- "模型": "Mô hình",
88
- "模型名称后缀": "Hậu tố Tên Mô hình",
89
- "模型自动总结(消耗tokens)": "Tự động tóm tắt bằng LLM (Tiêu thụ token)",
90
- "模型设置为了:": "Mô hình đã được đặt thành: ",
91
- "正在尝试更新...": "Đang cố gắng cập nhật...",
92
- "添加训练好的模型到模型列表": "Thêm mô hình đã đào tạo vào danh sách mô hình",
93
- "状态": "Tình trạng",
94
- "生成内容总结中……": "Đang tạo tóm tắt nội dung...",
95
- "用于定位滥用行为": "Sử dụng để xác định hành vi lạm dụng",
96
- "用户名": "Tên người dùng",
97
- "由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) 下载最新版脚本": "Phát triển bởi Bilibili [土川虎虎虎](https://space.bilibili.com/29125536), [明昭MZhao](https://space.bilibili.com/24807452) và [Keldos](https://github.com/Keldos-Li)\n\nTải mã nguồn mới nhất từ [GitHub](https://github.com/GaiZhenbiao/ChuanhuChatGPT)",
98
- "知识库": "Cơ sở kiến thức",
99
- "知识库文件": "Tệp cơ sở kiến thức",
100
- "第一条提问": "Theo câu hỏi đầu tiên",
101
- "索引构建完成": "Xây dựng chỉ mục hoàn tất",
102
- "网络": "Mạng",
103
- "获取API使用情况失败:": "Lỗi khi lấy thông tin sử dụng API:",
104
- "获取IP地理位置失败。原因:": "Không thể lấy vị trí địa lý của IP. Nguyên nhân: ",
105
- "获取对话时发生错误,请查看后台日志": "Xảy ra lỗi khi nhận cuộc trò chuyện, kiểm tra nhật ký nền",
106
- "训练": "Đào tạo",
107
- "训练状态": "Tình trạng đào tạo",
108
- "训练轮数(Epochs)": "Số lượt đào tạo (Epochs)",
109
- "设置": "Cài đặt",
110
- "设置保存文件名": "Đặt tên tệp lưu",
111
- "设置文件名: 默认为.json,可选为.md": "Đặt tên tệp: mặc định là .json, tùy chọn là .md",
112
- "识别公式": "Nhận dạng công thức",
113
- "详情": "Chi tiết",
114
- "请查看 config_example.json,配置 Azure OpenAI": "Vui lòng xem tệp config_example.json để cấu hình Azure OpenAI",
115
- "请检查网络连接,或者API-Key是否有效。": "Vui lòng kiểm tra kết nối mạng hoặc xem xét tính hợp lệ của API-Key.",
116
- "请输入对话内容。": "Nhập nội dung cuộc trò chuyện.",
117
- "请输入有效的文件名,不要包含以下特殊字符:": "Vui lòng nhập tên tệp hợp lệ, không chứa các ký tự đặc biệt sau: ",
118
- "读取超时,无法获取对话。": "Hết thời gian đọc, không thể nhận cuộc trò chuyện.",
119
- "账单信息不适用": "Thông tin thanh toán không áp dụng",
120
- "连接超时,无法获取对话。": "Hết thời gian kết nối, không thể nhận cuộc trò chuyện.",
121
- "选择LoRA模型": "Chọn Mô hình LoRA",
122
- "选择Prompt模板集合文件": "Chọn Tệp bộ sưu tập mẫu Prompt",
123
- "选择回复语言��针对搜索&索引功能)": "Chọn ngôn ngữ phản hồi (đối với chức năng tìm kiếm & chỉ mục)",
124
- "选择数据集": "Chọn tập dữ liệu",
125
- "选择模型": "Chọn Mô hình",
126
- "重命名该对话": "Đổi tên cuộc trò chuyện này",
127
- "重新生成": "Tạo lại",
128
- "高级": "Nâng cao",
129
- ",本次对话累计消耗了 ": ", Tổng cộng chi phí cho cuộc trò chuyện này là ",
130
- "💾 保存对话": "💾 Lưu Cuộc trò chuyện",
131
- "📝 导出为 Markdown": "📝 Xuất ra dưới dạng Markdown",
132
- "🔄 切换API地址": "🔄 Chuyển đổi Địa chỉ API",
133
- "🔄 刷新": "🔄 Làm mới",
134
- "🔄 检查更新...": "🔄 Kiểm tra cập nhật...",
135
- "🔄 设置代理地址": "🔄 Đặt Địa chỉ Proxy",
136
- "🔄 重新生成": "🔄 Tạo lại",
137
- "🔙 恢复默认网络设置": "🔙 Khôi phục cài đặt mạng mặc định",
138
- "🗑️ 删除最新对话": "🗑️ Xóa cuộc trò chuyện mới nhất",
139
- "🗑️ 删除最旧对话": "🗑️ Xóa cuộc trò chuyện cũ nhất",
140
- "🧹 新的对话": "🧹 Cuộc trò chuyện mới"
141
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locale/zh_CN.json DELETED
@@ -1 +0,0 @@
1
- {}
 
 
modules/.DS_Store DELETED
Binary file (6.15 kB)
 
modules/__init__.py DELETED
File without changes
modules/__pycache__/__init__.cpython-311.pyc DELETED
Binary file (172 Bytes)
 
modules/__pycache__/__init__.cpython-39.pyc DELETED
Binary file (154 Bytes)
 
modules/__pycache__/base_model.cpython-311.pyc DELETED
Binary file (28.7 kB)
 
modules/__pycache__/base_model.cpython-39.pyc DELETED
Binary file (16.3 kB)
 
modules/__pycache__/chat_func.cpython-39.pyc DELETED
Binary file (10.1 kB)
 
modules/__pycache__/config.cpython-311.pyc DELETED
Binary file (14.3 kB)
 
modules/__pycache__/config.cpython-39.pyc DELETED
Binary file (5.3 kB)
 
modules/__pycache__/index_func.cpython-311.pyc DELETED
Binary file (8.2 kB)
 
modules/__pycache__/index_func.cpython-39.pyc DELETED
Binary file (4.52 kB)
 
modules/__pycache__/llama_func.cpython-311.pyc DELETED
Binary file (9.44 kB)
 
modules/__pycache__/llama_func.cpython-39.pyc DELETED
Binary file (4.85 kB)
 
modules/__pycache__/models.cpython-311.pyc DELETED
Binary file (31.2 kB)
 
modules/__pycache__/models.cpython-39.pyc DELETED
Binary file (17.5 kB)
 
modules/__pycache__/openai_func.cpython-39.pyc DELETED
Binary file (2.16 kB)
 
modules/__pycache__/overwrites.cpython-311.pyc DELETED
Binary file (5.16 kB)
 
modules/__pycache__/overwrites.cpython-39.pyc DELETED
Binary file (3.41 kB)
 
modules/__pycache__/pdf_func.cpython-311.pyc DELETED
Binary file (10.4 kB)
 
modules/__pycache__/pdf_func.cpython-39.pyc DELETED
Binary file (6.13 kB)