发生了错误:{“statusCode”:401,“message”:“Unauthorized”,“data”:null}

#71
by qwejip - opened
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 +5 -5
  2. ChuanhuChatbot.py +277 -633
  3. Dockerfile +8 -11
  4. README.md +4 -3
  5. assets/custom.css +104 -219
  6. assets/custom.js +7 -285
  7. assets/external-scripts.js +0 -2
  8. assets/html/appearance_switcher.html +0 -11
  9. assets/html/footer.html +0 -1
  10. config.json +0 -3
  11. config_example.json +17 -69
  12. history/2023-06-14_15-05-04.json +0 -0
  13. locale/en_US.json +60 -128
  14. locale/extract_locale.py +20 -132
  15. locale/ja_JP.json +59 -127
  16. locale/ko_KR.json +0 -141
  17. locale/ru_RU.json +0 -141
  18. locale/sv-SE.json +0 -87
  19. locale/sv_SE.json +0 -141
  20. locale/vi_VN.json +0 -141
  21. locale/zh_CN.json +0 -1
  22. modules/.DS_Store +0 -0
  23. modules/__pycache__/__init__.cpython-311.pyc +0 -0
  24. modules/__pycache__/__init__.cpython-39.pyc +0 -0
  25. modules/__pycache__/base_model.cpython-311.pyc +0 -0
  26. modules/__pycache__/base_model.cpython-39.pyc +0 -0
  27. modules/__pycache__/config.cpython-311.pyc +0 -0
  28. modules/__pycache__/config.cpython-39.pyc +0 -0
  29. modules/__pycache__/index_func.cpython-311.pyc +0 -0
  30. modules/__pycache__/index_func.cpython-39.pyc +0 -0
  31. modules/__pycache__/llama_func.cpython-311.pyc +0 -0
  32. modules/__pycache__/llama_func.cpython-39.pyc +0 -0
  33. modules/__pycache__/models.cpython-311.pyc +0 -0
  34. modules/__pycache__/models.cpython-39.pyc +0 -0
  35. modules/__pycache__/overwrites.cpython-311.pyc +0 -0
  36. modules/__pycache__/overwrites.cpython-39.pyc +0 -0
  37. modules/__pycache__/pdf_func.cpython-311.pyc +0 -0
  38. modules/__pycache__/pdf_func.cpython-39.pyc +0 -0
  39. modules/__pycache__/presets.cpython-311.pyc +0 -0
  40. modules/__pycache__/presets.cpython-39.pyc +0 -0
  41. modules/__pycache__/repo.cpython-311.pyc +0 -0
  42. modules/__pycache__/shared.cpython-311.pyc +0 -0
  43. modules/__pycache__/shared.cpython-39.pyc +0 -0
  44. modules/__pycache__/train_func.cpython-311.pyc +0 -0
  45. modules/__pycache__/utils.cpython-311.pyc +0 -0
  46. modules/__pycache__/utils.cpython-39.pyc +0 -0
  47. modules/__pycache__/webui.cpython-311.pyc +0 -0
  48. modules/__pycache__/webui_locale.cpython-311.pyc +0 -0
  49. modules/__pycache__/webui_locale.cpython-39.pyc +0 -0
  50. modules/base_model.py +7 -18
CITATION.cff CHANGED
@@ -1,5 +1,5 @@
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.
@@ -13,8 +13,8 @@ authors:
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'
1
  cff-version: 1.2.0
2
+ title: ChuanhuChatGPT
3
  message: >-
4
  If you use this software, please cite it using these
5
  metadata.
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: Provided a light and easy to use interface for ChatGPT API
17
  license: GPL-3.0
18
+ commit: bd0034c37e5af6a90bd9c2f7dd073f6cd27c61af
19
+ version: '20230405'
20
+ date-released: '2023-04-05'
ChuanhuChatbot.py CHANGED
@@ -1,512 +1,274 @@
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=[
@@ -538,59 +300,38 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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,
@@ -620,43 +361,19 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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],
@@ -670,125 +387,51 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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 查看界面"
@@ -800,9 +443,10 @@ demo.title = i18n("川虎Chat 🚀")
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
  # -*- coding:utf-8 -*-
2
+ import os
3
  import logging
4
+ import sys
 
 
 
5
 
 
 
 
 
 
 
 
 
 
6
  import gradio as gr
 
7
 
8
+ from modules import config
9
+ from modules.config import *
10
+ from modules.utils import *
11
+ from modules.presets import *
12
+ from modules.overwrites import *
13
+ from modules.models import get_model
14
 
 
15
 
16
  gr.Chatbot._postprocess_chat_messages = postprocess_chat_messages
17
  gr.Chatbot.postprocess = postprocess
18
+ PromptHelper.compact_text_chunks = compact_text_chunks
19
 
20
+ with open("assets/custom.css", "r", encoding="utf-8") as f:
21
+ customCSS = f.read()
 
22
 
23
  def create_new_model():
24
+ return get_model(model_name = MODELS[DEFAULT_MODEL], access_key = my_api_key)[0]
 
25
 
26
+ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
27
+ user_name = gr.State("")
28
+ promptTemplates = gr.State(load_template(get_template_names(plain=True)[0], mode=2))
29
  user_question = gr.State("")
 
30
  user_api_key = gr.State(my_api_key)
31
+ current_model = gr.State(create_new_model)
32
 
33
  topic = gr.State(i18n("未命名对话历史记录"))
34
 
35
+ with gr.Row():
36
+ gr.HTML(CHUANHU_TITLE, elem_id="app_title")
37
+ status_display = gr.Markdown(get_geoip(), elem_id="status_display")
38
+ with gr.Row(elem_id="float_display"):
39
+ user_info = gr.Markdown(value="getting user info...", elem_id="user_info")
40
+
41
+ # https://github.com/gradio-app/gradio/pull/3296
42
+ def create_greeting(request: gr.Request):
43
+ if hasattr(request, "username") and request.username: # is not None or is not ""
44
+ logging.info(f"Get User Name: {request.username}")
45
+ return gr.Markdown.update(value=f"User: {request.username}"), request.username
46
+ else:
47
+ return gr.Markdown.update(value=f"User: default", visible=False), ""
48
+ demo.load(create_greeting, inputs=None, outputs=[user_info, user_name])
49
+
50
+ with gr.Row().style(equal_height=True):
51
+ with gr.Column(scale=5):
52
+ with gr.Row():
53
+ chatbot = gr.Chatbot(elem_id="chuanhu_chatbot").style(height="100%")
54
+ with gr.Row():
55
+ with gr.Column(min_width=225, scale=12):
56
+ user_input = gr.Textbox(
57
+ elem_id="user_input_tb",
58
+ show_label=False, placeholder=i18n("在这里输入")
59
+ ).style(container=False)
60
+ with gr.Column(min_width=42, scale=1):
61
+ submitBtn = gr.Button(value="", variant="primary", elem_id="submit_btn")
62
+ cancelBtn = gr.Button(value="", variant="secondary", visible=False, elem_id="cancel_btn")
63
+ with gr.Row():
64
+ emptyBtn = gr.Button(
65
+ i18n("🧹 新的对话"),
66
+ )
67
+ retryBtn = gr.Button(i18n("🔄 重新生成"))
68
+ delFirstBtn = gr.Button(i18n("🗑️ 删除最旧对话"))
69
+ delLastBtn = gr.Button(i18n("🗑️ 删除最新对话"))
70
+
71
+ with gr.Column():
72
+ with gr.Column(min_width=50, scale=1):
73
+ with gr.Tab(label=i18n("模型")):
74
+ keyTxt = gr.Textbox(
75
+ show_label=True,
76
+ placeholder=f"OpenAI API-key...",
77
+ value=hide_middle_chars(user_api_key.value),
78
+ type="password",
79
+ visible=not HIDE_MY_KEY,
80
+ label="API-Key",
81
+ )
82
+ if multi_api_key:
83
+ usageTxt = gr.Markdown(i18n("多账号模式已开启,无需输入key,可直接开始对话"), elem_id="usage_display", elem_classes="insert_block")
84
+ else:
85
+ usageTxt = gr.Markdown(i18n("**发送消息** 或 **提交key** 以显示额度"), elem_id="usage_display", elem_classes="insert_block")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  model_select_dropdown = gr.Dropdown(
87
+ label=i18n("选择模型"), choices=MODELS, multiselect=False, value=MODELS[DEFAULT_MODEL], interactive=True
 
88
  )
89
  lora_select_dropdown = gr.Dropdown(
90
+ label=i18n("选择LoRA模型"), choices=[], multiselect=False, interactive=True, visible=False
 
91
  )
92
+ with gr.Row():
93
+ use_streaming_checkbox = gr.Checkbox(
94
+ label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION
95
+ )
96
+ single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False)
97
+ use_websearch_checkbox = gr.Checkbox(label=i18n("使用在线搜索"), value=False)
98
+ language_select_dropdown = gr.Dropdown(
99
+ label=i18n("选择回复语言(针对搜索&索引功能)"),
100
+ choices=REPLY_LANGUAGES,
101
+ multiselect=False,
102
+ value=REPLY_LANGUAGES[0],
 
 
 
103
  )
104
+ index_files = gr.Files(label=i18n("上传索引文件"), type="file")
105
+ two_column = gr.Checkbox(label=i18n("双栏pdf"), value=advance_docs["pdf"].get("two_column", False))
106
+ # TODO: 公式ocr
107
+ # formula_ocr = gr.Checkbox(label=i18n("识别公式"), value=advance_docs["pdf"].get("formula_ocr", False))
108
+
109
+ with gr.Tab(label="Prompt"):
110
+ systemPromptTxt = gr.Textbox(
111
+ show_label=True,
112
+ placeholder=i18n("在这里输入System Prompt..."),
113
+ label="System prompt",
114
+ value=INITIAL_SYSTEM_PROMPT,
115
+ lines=10,
116
+ ).style(container=False)
117
+ with gr.Accordion(label=i18n("加载Prompt模板"), open=True):
118
+ with gr.Column():
119
+ with gr.Row():
120
+ with gr.Column(scale=6):
121
+ templateFileSelectDropdown = gr.Dropdown(
122
+ label=i18n("选择Prompt模板集合文件"),
123
+ choices=get_template_names(plain=True),
124
+ multiselect=False,
125
+ value=get_template_names(plain=True)[0],
126
+ ).style(container=False)
127
+ with gr.Column(scale=1):
128
+ templateRefreshBtn = gr.Button(i18n("🔄 刷新"))
129
+ with gr.Row():
130
+ with gr.Column():
131
+ templateSelectDropdown = gr.Dropdown(
132
+ label=i18n("从Prompt模板中加载"),
133
+ choices=load_template(
134
+ get_template_names(plain=True)[0], mode=1
135
+ ),
136
+ multiselect=False,
137
+ ).style(container=False)
138
+
139
+ with gr.Tab(label=i18n("保存/加载")):
140
+ with gr.Accordion(label=i18n("保存/加载对话历史记录"), open=True):
141
+ with gr.Column():
142
+ with gr.Row():
143
+ with gr.Column(scale=6):
144
+ historyFileSelectDropdown = gr.Dropdown(
145
+ label=i18n("从列表中加载对话"),
146
+ choices=get_history_names(plain=True),
147
+ multiselect=False,
148
+ value=get_history_names(plain=True)[0],
149
  )
150
+ with gr.Column(scale=1):
151
+ historyRefreshBtn = gr.Button(i18n("🔄 刷新"))
152
+ with gr.Row():
153
+ with gr.Column(scale=6):
154
+ saveFileName = gr.Textbox(
155
+ show_label=True,
156
+ placeholder=i18n("设置文件名: 默认为.json,可选为.md"),
157
+ label=i18n("设置保存文件名"),
158
+ value=i18n("对话历史记录"),
159
+ ).style(container=True)
160
+ with gr.Column(scale=1):
161
+ saveHistoryBtn = gr.Button(i18n("💾 保存对话"))
162
+ exportMarkdownBtn = gr.Button(i18n("📝 导出为Markdown"))
163
+ gr.Markdown(i18n("默认保存于history文件夹"))
164
+ with gr.Row():
165
+ with gr.Column():
166
+ downloadFile = gr.File(interactive=True)
167
+
168
+ with gr.Tab(label=i18n("高级")):
169
+ gr.Markdown(i18n("# ⚠️ 务必谨慎更改 ⚠️\n\n如果无法使用请恢复默认设置"))
170
+ gr.HTML(APPEARANCE_SWITCHER, elem_classes="insert_block")
171
+ with gr.Accordion(i18n("参数"), open=False):
172
+ temperature_slider = gr.Slider(
173
+ minimum=-0,
174
+ maximum=2.0,
175
+ value=1.0,
176
+ step=0.1,
177
+ interactive=True,
178
+ label="temperature",
179
+ )
180
+ top_p_slider = gr.Slider(
181
+ minimum=-0,
182
+ maximum=1.0,
183
+ value=1.0,
184
+ step=0.05,
185
+ interactive=True,
186
+ label="top-p",
187
+ )
188
+ n_choices_slider = gr.Slider(
189
+ minimum=1,
190
+ maximum=10,
191
+ value=1,
192
+ step=1,
193
+ interactive=True,
194
+ label="n choices",
195
+ )
196
+ stop_sequence_txt = gr.Textbox(
197
  show_label=True,
198
+ placeholder=i18n("在这里输入停止符,用英文逗号隔开..."),
199
+ label="stop",
200
+ value="",
201
+ lines=1,
 
202
  )
203
+ max_context_length_slider = gr.Slider(
204
+ minimum=1,
205
+ maximum=32768,
206
+ value=2000,
207
+ step=1,
208
+ interactive=True,
209
+ label="max context",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  )
211
+ max_generation_slider = gr.Slider(
212
+ minimum=1,
213
+ maximum=32768,
214
+ value=1000,
215
+ step=1,
216
+ interactive=True,
217
+ label="max generations",
218
  )
219
+ presence_penalty_slider = gr.Slider(
220
+ minimum=-2.0,
221
+ maximum=2.0,
222
+ value=0.0,
223
+ step=0.01,
224
  interactive=True,
225
+ label="presence penalty",
226
  )
227
+ frequency_penalty_slider = gr.Slider(
228
+ minimum=-2.0,
229
+ maximum=2.0,
230
+ value=0.0,
231
+ step=0.01,
232
+ interactive=True,
233
+ label="frequency penalty",
234
+ )
235
+ logit_bias_txt = gr.Textbox(
 
236
  show_label=True,
237
+ placeholder=f"word:likelihood",
238
+ label="logit bias",
239
+ value="",
240
+ lines=1,
241
+ )
242
+ user_identifier_txt = gr.Textbox(
243
+ show_label=True,
244
+ placeholder=i18n("用于定位滥用行为"),
245
+ label=i18n("用户名"),
246
+ value=user_name.value,
247
  lines=1,
 
 
 
248
  )
 
249
 
250
+ with gr.Accordion(i18n("网络设置"), open=False):
251
  # 优先展示自定义的api_host
252
  apihostTxt = gr.Textbox(
253
  show_label=True,
254
+ placeholder=i18n("在这里输入API-Host..."),
255
+ label="API-Host",
256
  value=config.api_host or shared.API_HOST,
257
  lines=1,
 
 
 
258
  )
259
+ changeAPIURLBtn = gr.Button(i18n("🔄 切换API地址"))
260
+ proxyTxt = gr.Textbox(
261
+ show_label=True,
262
+ placeholder=i18n("在这里输入代理地址..."),
263
+ label=i18n("代理地址(示例:http://127.0.0.1:10809)"),
264
+ value="",
265
+ lines=2,
266
+ )
267
+ changeProxyBtn = gr.Button(i18n("🔄 设置代理地址"))
268
+ default_btn = gr.Button(i18n("🔙 恢复默认设置"))
269
 
270
+ gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
271
+ gr.HTML(FOOTER.format(versions=versions_html()), elem_id="footer")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
  chatgpt_predict_args = dict(
273
  fn=predict,
274
  inputs=[
300
  )
301
 
302
  transfer_input_args = dict(
303
+ fn=transfer_input, inputs=[user_input], outputs=[user_question, user_input, submitBtn, cancelBtn], show_progress=True
 
304
  )
305
 
306
  get_usage_args = dict(
307
+ fn=billing_info, inputs=[current_model], outputs=[usageTxt], show_progress=False
 
308
  )
309
 
310
  load_history_from_file_args = dict(
311
  fn=load_chat_history,
312
+ inputs=[current_model, historyFileSelectDropdown, chatbot, user_name],
313
  outputs=[saveFileName, systemPromptTxt, chatbot]
314
  )
315
 
 
 
 
 
 
 
 
 
 
 
316
 
317
  # Chatbot
318
  cancelBtn.click(interrupt, [current_model], [])
319
 
320
+ user_input.submit(**transfer_input_args).then(**chatgpt_predict_args).then(**end_outputing_args)
 
321
  user_input.submit(**get_usage_args)
322
 
323
+ submitBtn.click(**transfer_input_args).then(**chatgpt_predict_args).then(**end_outputing_args)
 
 
 
324
  submitBtn.click(**get_usage_args)
325
 
326
+ index_files.change(handle_file_upload, [current_model, index_files, chatbot], [index_files, chatbot, status_display])
 
 
 
 
 
327
 
328
  emptyBtn.click(
329
  reset,
330
+ inputs=[current_model],
331
+ outputs=[chatbot, status_display],
332
  show_progress=True,
 
333
  )
334
+ emptyBtn.click(**reset_textbox_args)
335
 
336
  retryBtn.click(**start_outputing_args).then(
337
  retry,
361
  show_progress=False
362
  )
363
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  two_column.change(update_doc_config, [two_column], None)
365
 
366
  # LLM Models
367
+ keyTxt.change(set_key, [current_model, keyTxt], [user_api_key, status_display]).then(**get_usage_args)
 
368
  keyTxt.submit(**get_usage_args)
369
+ single_turn_checkbox.change(set_single_turn, [current_model, single_turn_checkbox], None)
370
+ model_select_dropdown.change(get_model, [model_select_dropdown, lora_select_dropdown, user_api_key, temperature_slider, top_p_slider, systemPromptTxt], [current_model, status_display, lora_select_dropdown], show_progress=True)
371
+ lora_select_dropdown.change(get_model, [model_select_dropdown, lora_select_dropdown, user_api_key, temperature_slider, top_p_slider, systemPromptTxt], [current_model, status_display], show_progress=True)
 
 
 
 
 
 
 
372
 
373
  # Template
374
+ systemPromptTxt.change(set_system_prompt, [current_model, systemPromptTxt], None)
375
+ templateRefreshBtn.click(get_template_names, None, [templateFileSelectDropdown])
376
+ templateFileSelectDropdown.change(
 
 
377
  load_template,
378
  [templateFileSelectDropdown],
379
  [promptTemplates, templateSelectDropdown],
387
  )
388
 
389
  # S&L
390
+ saveHistoryBtn.click(
391
+ save_chat_history,
392
  [current_model, saveFileName, chatbot, user_name],
393
+ downloadFile,
394
  show_progress=True,
 
395
  )
396
+ saveHistoryBtn.click(get_history_names, [gr.State(False), user_name], [historyFileSelectDropdown])
397
  exportMarkdownBtn.click(
398
  export_markdown,
399
  [current_model, saveFileName, chatbot, user_name],
400
+ downloadFile,
 
 
 
 
 
 
 
401
  show_progress=True,
 
402
  )
403
+ historyRefreshBtn.click(get_history_names, [gr.State(False), user_name], [historyFileSelectDropdown])
404
+ historyFileSelectDropdown.change(**load_history_from_file_args)
405
+ downloadFile.change(**load_history_from_file_args)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
406
 
407
  # Advanced
408
+ max_context_length_slider.change(set_token_upper_limit, [current_model, max_context_length_slider], None)
409
+ temperature_slider.change(set_temperature, [current_model, temperature_slider], None)
 
 
410
  top_p_slider.change(set_top_p, [current_model, top_p_slider], None)
411
+ n_choices_slider.change(set_n_choices, [current_model, n_choices_slider], None)
412
+ stop_sequence_txt.change(set_stop_sequence, [current_model, stop_sequence_txt], None)
413
+ max_generation_slider.change(set_max_tokens, [current_model, max_generation_slider], None)
414
+ presence_penalty_slider.change(set_presence_penalty, [current_model, presence_penalty_slider], None)
415
+ frequency_penalty_slider.change(set_frequency_penalty, [current_model, frequency_penalty_slider], None)
416
+ logit_bias_txt.change(set_logit_bias, [current_model, logit_bias_txt], None)
417
+ user_identifier_txt.change(set_user_identifier, [current_model, user_identifier_txt], None)
 
 
 
 
 
 
 
418
 
419
  default_btn.click(
420
  reset_default, [], [apihostTxt, proxyTxt, status_display], show_progress=True
421
  )
422
+ changeAPIURLBtn.click(
423
+ change_api_host,
424
+ [apihostTxt],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
425
  [status_display],
426
  show_progress=True,
427
  )
428
+ changeProxyBtn.click(
429
+ change_proxy,
430
+ [proxyTxt],
431
+ [status_display],
432
+ show_progress=True,
 
 
 
 
 
 
 
 
 
 
 
 
433
  )
434
 
 
435
  logging.info(
436
  colorama.Back.GREEN
437
  + "\n川虎的温馨提示:访问 http://localhost:7860 查看界面"
443
  if __name__ == "__main__":
444
  reload_javascript()
445
  demo.queue(concurrency_count=CONCURRENT_COUNT).launch(
446
+ auth=auth_list if authflag else None,
447
+ favicon_path="./assets/favicon.ico",
448
+ inbrowser=not dockerflag, # 禁止在docker下开启inbrowser
 
 
449
  )
450
+ # demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=7860, share=False) # 可自定义端口
451
+ # demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=7860,auth=("在这里填写用户名", "在这里填写密码")) # 可设置用户名与密码
452
+ # demo.queue(concurrency_count=CONCURRENT_COUNT).launch(auth=("在这里填写用户名", "在这里填写密码")) # 适合Nginx反向代理
Dockerfile CHANGED
@@ -1,18 +1,15 @@
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"]
1
+ FROM python:3.9 as builder
2
+ RUN apt-get update && apt-get install -y build-essential
 
 
 
3
  COPY requirements.txt .
4
  COPY requirements_advanced.txt .
5
+ RUN pip install --user -r requirements.txt
6
+ # RUN pip install --user -r requirements_advanced.txt
7
 
8
+ FROM python:3.9
9
+ MAINTAINER iskoldt
10
  COPY --from=builder /root/.local /root/.local
11
  ENV PATH=/root/.local/bin:$PATH
12
  COPY . /app
13
  WORKDIR /app
14
+ ENV dockerrun yes
15
+ CMD ["python3", "-u", "ChuanhuChatbot.py", "2>&1", "|", "tee", "/var/log/application.log"]
README.md CHANGED
@@ -1,11 +1,12 @@
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
 
1
  ---
2
  title: ChuanhuChatGPT
3
  emoji: 🐯
4
+ colorFrom: green
5
+ colorTo: red
6
  sdk: gradio
7
+ sdk_version: 3.25.0
8
  app_file: ChuanhuChatbot.py
9
+ pinned: false
10
  license: gpl-3.0
11
  ---
12
 
assets/custom.css CHANGED
@@ -1,12 +1,6 @@
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 {
@@ -19,15 +13,13 @@
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
  }
@@ -36,7 +28,7 @@ footer {
36
  }
37
  #footer .versions{
38
  font-size: 85%;
39
- opacity: 0.60;
40
  }
41
 
42
  #float_display {
@@ -78,8 +70,7 @@ footer {
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
 
@@ -111,7 +102,7 @@ footer {
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;
@@ -144,7 +135,7 @@ footer {
144
  display: none !important;
145
  }
146
  .apSlider {
147
- background-color: var(--neutral-200);
148
  bottom: 0;
149
  cursor: pointer;
150
  left: 0;
@@ -163,47 +154,13 @@ footer {
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
  }
@@ -222,25 +179,25 @@ ol:not(.options), ul:not(.options) {
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的设备 */
@@ -262,17 +219,14 @@ ol:not(.options), ul:not(.options) {
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;
@@ -290,116 +244,6 @@ ol:not(.options), ul:not(.options) {
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;
@@ -417,52 +261,93 @@ 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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  :root {
2
+ --chatbot-color-light: #F3F3F3;
3
+ --chatbot-color-dark: #121111;
 
 
 
 
 
 
4
  }
5
 
6
  #app_title {
13
  }
14
  #description {
15
  text-align: center;
16
+ margin:16px 0
17
  }
18
 
19
+ /* 覆盖gradio的页脚信息QAQ */
20
+ /* footer {
21
+ display: none !important;
22
+ } */
 
 
23
  #footer {
24
  text-align: center;
25
  }
28
  }
29
  #footer .versions{
30
  font-size: 85%;
31
+ opacity: 0.85;
32
  }
33
 
34
  #float_display {
70
  }
71
  #status_display p {
72
  font-size: .85em;
73
+ font-family: monospace;
 
74
  color: var(--body-text-color-subdued);
75
  }
76
 
102
  }
103
  .progress-bar {
104
  background-color: var(--input-background-fill);;
105
+ margin: 0 1em;
106
  height: 20px;
107
  border-radius: 10px;
108
  overflow: hidden;
135
  display: none !important;
136
  }
137
  .apSlider {
138
+ background-color: var(--block-label-background-fill);
139
  bottom: 0;
140
  cursor: pointer;
141
  left: 0;
154
  content: "🌞";
155
  }
156
  input:checked + .apSlider {
157
+ background-color: var(--block-label-background-fill);
158
  }
159
  input:checked + .apSlider::before {
160
  transform: translateX(23px);
161
  content:"🌚";
162
  }
163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  #submit_btn, #cancel_btn {
165
  height: 42px !important;
166
  }
179
 
180
  /* 亮色(默认) */
181
  #chuanhu_chatbot {
182
+ background-color: var(--chatbot-color-light) !important;
183
+ color: #000000 !important;
184
  }
185
  [data-testid = "bot"] {
186
+ background-color: #FFFFFF !important;
187
  }
188
  [data-testid = "user"] {
189
+ background-color: #95EC69 !important;
190
  }
191
  /* 暗色 */
192
  .dark #chuanhu_chatbot {
193
+ background-color: var(--chatbot-color-dark) !important;
194
+ color: #FFFFFF !important;
195
  }
196
  .dark [data-testid = "bot"] {
197
+ background-color: #2C2C2C !important;
198
  }
199
  .dark [data-testid = "user"] {
200
+ background-color: #26B561 !important;
201
  }
202
 
203
  /* 屏幕宽度大于等于500px的设备 */
219
  max-height: calc(100vh - 140px - var(--line-sm)*1rem - 2*var(--block-label-margin) );
220
  }
221
  [data-testid = "bot"] {
222
+ max-width: 98% !important;
223
  }
224
  #app_title h1{
225
  letter-spacing: -1px; font-size: 22px;
226
  }
227
  }
 
 
 
228
  /* 对话气泡 */
229
+ [class *= "message"] {
230
  border-radius: var(--radius-xl) !important;
231
  border: none;
232
  padding: var(--spacing-xl) !important;
244
  width: auto !important;
245
  border-bottom-right-radius: 0 !important;
246
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  /* 表格 */
248
  table {
249
  margin: 1em 0;
261
  padding: .5em .2em;
262
  }
263
  /* 行内代码 */
264
+ code {
265
  display: inline;
266
  white-space: break-spaces;
 
267
  border-radius: 6px;
268
  margin: 0 2px 0 2px;
269
  padding: .2em .4em .1em .4em;
270
  background-color: rgba(175,184,193,0.2);
271
  }
272
  /* 代码块 */
273
+ pre code {
274
+ display: block;
275
+ overflow: auto;
276
+ white-space: pre;
277
+ background-color: hsla(0, 0%, 0%, 80%)!important;
278
+ border-radius: 10px;
279
+ padding: 1.4em 1.2em 0em 1.4em;
280
+ margin: 1.2em 2em 1.2em 0.5em;
281
+ color: #FFF;
282
+ box-shadow: 6px 6px 16px hsla(0, 0%, 0%, 0.2);
283
+ }
284
+ /* 代码高亮样式 */
285
+ .highlight .hll { background-color: #49483e }
286
+ .highlight .c { color: #75715e } /* Comment */
287
+ .highlight .err { color: #960050; background-color: #1e0010 } /* Error */
288
+ .highlight .k { color: #66d9ef } /* Keyword */
289
+ .highlight .l { color: #ae81ff } /* Literal */
290
+ .highlight .n { color: #f8f8f2 } /* Name */
291
+ .highlight .o { color: #f92672 } /* Operator */
292
+ .highlight .p { color: #f8f8f2 } /* Punctuation */
293
+ .highlight .ch { color: #75715e } /* Comment.Hashbang */
294
+ .highlight .cm { color: #75715e } /* Comment.Multiline */
295
+ .highlight .cp { color: #75715e } /* Comment.Preproc */
296
+ .highlight .cpf { color: #75715e } /* Comment.PreprocFile */
297
+ .highlight .c1 { color: #75715e } /* Comment.Single */
298
+ .highlight .cs { color: #75715e } /* Comment.Special */
299
+ .highlight .gd { color: #f92672 } /* Generic.Deleted */
300
+ .highlight .ge { font-style: italic } /* Generic.Emph */
301
+ .highlight .gi { color: #a6e22e } /* Generic.Inserted */
302
+ .highlight .gs { font-weight: bold } /* Generic.Strong */
303
+ .highlight .gu { color: #75715e } /* Generic.Subheading */
304
+ .highlight .kc { color: #66d9ef } /* Keyword.Constant */
305
+ .highlight .kd { color: #66d9ef } /* Keyword.Declaration */
306
+ .highlight .kn { color: #f92672 } /* Keyword.Namespace */
307
+ .highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
308
+ .highlight .kr { color: #66d9ef } /* Keyword.Reserved */
309
+ .highlight .kt { color: #66d9ef } /* Keyword.Type */
310
+ .highlight .ld { color: #e6db74 } /* Literal.Date */
311
+ .highlight .m { color: #ae81ff } /* Literal.Number */
312
+ .highlight .s { color: #e6db74 } /* Literal.String */
313
+ .highlight .na { color: #a6e22e } /* Name.Attribute */
314
+ .highlight .nb { color: #f8f8f2 } /* Name.Builtin */
315
+ .highlight .nc { color: #a6e22e } /* Name.Class */
316
+ .highlight .no { color: #66d9ef } /* Name.Constant */
317
+ .highlight .nd { color: #a6e22e } /* Name.Decorator */
318
+ .highlight .ni { color: #f8f8f2 } /* Name.Entity */
319
+ .highlight .ne { color: #a6e22e } /* Name.Exception */
320
+ .highlight .nf { color: #a6e22e } /* Name.Function */
321
+ .highlight .nl { color: #f8f8f2 } /* Name.Label */
322
+ .highlight .nn { color: #f8f8f2 } /* Name.Namespace */
323
+ .highlight .nx { color: #a6e22e } /* Name.Other */
324
+ .highlight .py { color: #f8f8f2 } /* Name.Property */
325
+ .highlight .nt { color: #f92672 } /* Name.Tag */
326
+ .highlight .nv { color: #f8f8f2 } /* Name.Variable */
327
+ .highlight .ow { color: #f92672 } /* Operator.Word */
328
+ .highlight .w { color: #f8f8f2 } /* Text.Whitespace */
329
+ .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
330
+ .highlight .mf { color: #ae81ff } /* Literal.Number.Float */
331
+ .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
332
+ .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
333
+ .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
334
+ .highlight .sa { color: #e6db74 } /* Literal.String.Affix */
335
+ .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
336
+ .highlight .sc { color: #e6db74 } /* Literal.String.Char */
337
+ .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
338
+ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */
339
+ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */
340
+ .highlight .se { color: #ae81ff } /* Literal.String.Escape */
341
+ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
342
+ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */
343
+ .highlight .sx { color: #e6db74 } /* Literal.String.Other */
344
+ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */
345
+ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */
346
+ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
347
+ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
348
+ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */
349
+ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
350
+ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
351
+ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
352
+ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
353
+ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
assets/custom.js CHANGED
@@ -13,48 +13,22 @@ 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();
@@ -63,38 +37,15 @@ function gradioLoaded(mutations) {
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) {
@@ -143,34 +94,6 @@ function selectHistory() {
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) {
@@ -217,12 +140,12 @@ function showOrHideUserInfo() {
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 () {
@@ -238,10 +161,10 @@ function showOrHideUserInfo() {
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
  }
@@ -285,200 +208,6 @@ function setChatbotHeight() {
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) {
@@ -489,14 +218,7 @@ observer.observe(targetNode, { childList: true, subtree: true });
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>';
13
  var userInfoDiv = null;
14
  var appTitleDiv = null;
15
  var chatbot = null;
 
16
  var apSwitch = null;
 
 
 
 
 
 
 
 
17
 
18
  var ga = document.getElementsByTagName("gradio-app");
19
  var targetNode = ga[0];
20
  var isInIframe = (window.self !== window.top);
 
 
 
 
 
 
 
 
 
21
 
22
  // gradio 页面加载好了么??? 我能动你的元素了么??
23
  function gradioLoaded(mutations) {
24
  for (var i = 0; i < mutations.length; i++) {
25
+ if (mutations[i].addedNodes.length) {
 
26
  gradioContainer = document.querySelector(".gradio-container");
27
  user_input_tb = document.getElementById('user_input_tb');
28
  userInfoDiv = document.getElementById("user_info");
29
  appTitleDiv = document.getElementById("app_title");
30
  chatbot = document.querySelector('#chuanhu_chatbot');
 
31
  apSwitch = document.querySelector('.apSwitch input[type="checkbox"]');
 
 
 
 
 
 
32
 
33
  if (gradioContainer && apSwitch) { // gradioCainter 加载出来了没?
34
  adjustDarkMode();
37
  selectHistory();
38
  }
39
  if (userInfoDiv && appTitleDiv) { // userInfoDiv 和 appTitleDiv 加载出来了没?
 
 
 
40
  setTimeout(showOrHideUserInfo(), 2000);
41
  }
42
  if (chatbot) { // chatbot 加载出来了没?
43
+ setChatbotHeight()
 
 
 
 
 
 
 
 
 
44
  }
45
  }
46
  }
47
  }
48
 
 
 
 
 
 
 
 
 
 
 
 
49
  function selectHistory() {
50
  user_input_ta = user_input_tb.querySelector("textarea");
51
  if (user_input_ta) {
94
  }
95
  }
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  function toggleUserInfoVisibility(shouldHide) {
98
  if (userInfoDiv) {
99
  if (shouldHide) {
140
  appTitleDiv.ontouchend = function () {
141
  setTimeout(function () {
142
  toggleUserInfoVisibility(true);
143
+ }, 3000);
144
  };
145
  userInfoDiv.ontouchend = function () {
146
  setTimeout(function () {
147
  toggleUserInfoVisibility(true);
148
+ }, 3000);
149
  };
150
  sendBtn.ontouchend = function () {
151
  setTimeout(function () {
161
 
162
  function toggleDarkMode(isEnabled) {
163
  if (isEnabled) {
164
+ gradioContainer.classList.add("dark");
165
  document.body.style.setProperty("background-color", "var(--neutral-950)", "important");
166
  } else {
167
+ gradioContainer.classList.remove("dark");
168
  document.body.style.backgroundColor = "";
169
  }
170
  }
208
  }
209
  }
210
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
 
212
  // 监视页面内部 DOM 变动
213
  var observer = new MutationObserver(function (mutations) {
218
  // 监视页面变化
219
  window.addEventListener("DOMContentLoaded", function () {
220
  isInIframe = (window.self !== window.top);
 
221
  });
222
  window.addEventListener('resize', setChatbotHeight);
223
  window.addEventListener('scroll', setChatbotHeight);
224
+ window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", adjustDarkMode);
 
 
 
 
 
 
assets/external-scripts.js DELETED
@@ -1,2 +0,0 @@
1
-
2
- // external javascript here
 
 
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>
 
config.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "hide_history_when_not_logged_in": true
3
- }
 
 
 
config_example.json CHANGED
@@ -1,82 +1,30 @@
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
1
  {
2
+ // 你的OpenAI API Key,一般必填,
3
+ // 若缺省填为 "openai_api_key": "" 则必须再在图形界面中填入API Key
4
+ "openai_api_key": "",
5
+ "language": "auto",
6
+ // 如果使用代理,请取消注释下面的两行,并替换代理URL
7
+ // "https_proxy": "http://127.0.0.1:1079",
8
+ // "http_proxy": "http://127.0.0.1:1079",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  "users": [], // 用户列表,[[用户名1, 密码1], [用户名2, 密码2], ...]
10
  "local_embedding": false, //是否在本地编制索引
 
 
11
  "default_model": "gpt-3.5-turbo", // 默认模型
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  "advance_docs": {
13
  "pdf": {
14
+ // 是否认为PDF是双栏的
15
+ "two_column": false,
16
+ // 是否使用OCR识别PDF中的公式
17
+ "formula_ocr": true
18
  }
19
  },
 
 
20
  // 是否多个API Key轮换使用
21
  "multi_api_key": false,
22
+ "api_key_list": [
23
+ "sk-xxxxxxxxxxxxxxxxxxxxxxxx1",
24
+ "sk-xxxxxxxxxxxxxxxxxxxxxxxx2",
25
+ "sk-xxxxxxxxxxxxxxxxxxxxxxxx3"
26
+ ],
27
+ // 如果使用自定义端口、自定义ip,请取消注释并替换对应内容
 
 
 
 
 
 
 
28
  // "server_name": "0.0.0.0",
29
  // "server_port": 7860,
30
  // 如果要share到gradio,设置为true
history/2023-06-14_15-05-04.json DELETED
File without changes
locale/en_US.json CHANGED
@@ -1,141 +1,73 @@
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
- }
1
  {
2
+ "未命名对话历史记录": "Unnamed Dialog History",
3
+ "在这里输入": "Type in here",
4
+ "🧹 新的对话": "🧹 New Dialogue",
5
+ "🔄 重新生成": "🔄 Regeneration",
6
+ "🗑️ 删除最旧对话": "🗑️ Delete oldest dialog",
7
+ "🗑️ 删除最新对话": "🗑️ Delete latest dialog",
8
+ "模型": "Model",
9
+ "多账号模式已开启,无需输入key,可直接开始对话": "Multi-account mode is enabled, no need to enter key, you can start the dialogue directly",
10
  "**发送消息** 或 **提交key** 以显示额度": "**Send message** or **Submit key** to display credit",
11
+ "选择模型": "Select Model",
12
+ "选择LoRA模型": "Select LoRA Model",
13
+ "实时传输回答": "Stream output",
14
+ "单轮对话": "Single-turn dialogue",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  "使用在线搜索": "Use online search",
16
+ "选择回复语言(针对搜索&索引功能)": "Select reply language (for search & index)",
17
+ "上传索引文件": "Upload index file",
 
 
 
 
 
 
 
 
 
 
18
  "双栏pdf": "Two-column pdf",
19
+ "识别公式": "formula OCR",
 
 
 
 
 
 
20
  "在这里输入System Prompt...": "Type in System Prompt here...",
21
+ "加载Prompt模板": "Load Prompt Template",
22
+ "选择Prompt模板集合文件": "Select Prompt Template Collection File",
23
+ "🔄 刷新": "🔄 Refresh",
24
+ "从Prompt模板中加载": "Load from Prompt Template",
25
+ "保存/加载": "Save/Load",
26
+ "保存/加载对话历史记录": "Save/Load Dialog History",
27
+ "从列表中加载对话": "Load dialog from list",
28
+ "设置文件名: 默认为.json,可选为.md": "Set file name: default is .json, optional is .md",
29
+ "设置保存文件名": "Set save file name",
30
  "对话历史记录": "Dialog History",
31
+ "💾 保存对话": "💾 Save Dialog",
32
+ "📝 导出为Markdown": "📝 Export as Markdown",
33
+ "默认保存于history文件夹": "Default save in history folder",
34
+ "高级": "Advanced",
35
+ "# ⚠️ 务必谨慎更改 ⚠️\n\n如果无法使用请恢复默认设置": "# ⚠️ Caution: Changes require care. ⚠️\n\nIf unable to use, restore default settings.",
36
+ "参数": "Parameters",
37
+ "在这里输入停止符,用英文逗号隔开...": "Type in stop token here, separated by comma...",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  "用于定位滥用行为": "Used to locate abuse",
39
  "用户名": "Username",
40
+ "网络设置": "Network Settings",
41
+ "在这里输入API-Host...": "Type in API-Host here...",
42
+ "🔄 切换API地址": "🔄 Switch API Address",
43
+ "在这里输入代理地址...": "Type in proxy address here...",
44
+ "代理地址(示例:http://127.0.0.1:10809)": "Proxy address (example: http://127.0.0.1:10809)",
45
+ "🔄 设置代理地址": "🔄 Set Proxy Address",
46
+ "🔙 恢复默认设置": "🔙 Restore Default Settings",
47
+ "川虎Chat 🚀": "Chuanhu Chat 🚀",
48
+ "开始实时传输回答……": "Start streaming output...",
49
+ "Token 计数: ": "Token Count: ",
50
+ ",本次对话累计消耗了 ": ",Total cost for this dialogue is ",
51
+ "**获取API使用情况失败**": "**Failed to get API usage**",
52
+ "**本月使用金额** ": "**Monthly usage** ",
53
  "获取API使用情况失败:": "Failed to get API usage:",
54
+ "API密钥更改为了": "The API key is changed to",
55
+ "JSON解析错误,收到的内容: ": "JSON parsing error, received content: ",
56
+ "模型设置为了:": "Model is set to: ",
57
+ "☹️发生了错误:": "☹️Error: ",
58
  "获取对话时发生错误,请查看后台日志": "Error occurred when getting dialogue, check the background log",
 
 
 
 
 
 
 
 
 
59
  "请检查网络连接,或者API-Key是否有效。": "Check the network connection or whether the API-Key is valid.",
60
+ "连接超时,无法获取对话。": "Connection timed out, unable to get dialogue.",
 
61
  "读取超时,无法获取对话。": "Read timed out, unable to get dialogue.",
62
+ "代理错误,无法获取对话。": "Proxy error, unable to get dialogue.",
63
+ "SSL错误,无法获取对话。": "SSL error, unable to get dialogue.",
64
+ "API key为空,请检查是否输入正确。": "API key is empty, check whether it is entered correctly.",
65
+ "请输入对话内容。": "Enter the content of the conversation.",
66
  "账单信息不适用": "Billing information is not applicable",
67
+ "由Bilibili [土川虎虎虎](https://space.bilibili.com/29125536) 和 [明昭MZhao](https://space.bilibili.com/24807452)开发<br />访问川虎Chat的 [GitHub项目](https://github.com/GaiZhenbiao/ChuanhuChatGPT) 下载最新版脚本": "developor: Bilibili [土川虎虎虎](https://space.bilibili.com/29125536) and [明昭MZhao](https://space.bilibili.com/24807452)\n\nDownload latest code from [GitHub](https://github.com/GaiZhenbiao/ChuanhuChatGPT)",
68
+ "切换亮暗色主题": "Switch light/dark theme",
69
+ "您的IP区域:未知。": "Your IP region: Unknown.",
70
+ "获取IP地理位置失败。原因:": "Failed to get IP location. Reason: ",
71
+ "。你仍然可以使用聊天功能。": ". You can still use the chat function.",
72
+ "您的IP区域:": "Your IP region: "
73
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locale/extract_locale.py CHANGED
@@ -1,138 +1,26 @@
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))
1
+ import os
2
+ import json
3
+ import re
4
 
5
+ # Define regular expression patterns
6
+ pattern = r'i18n\((\"{3}.*?\"{3}|\".*?\")\)'
7
 
8
+ # Load the .py file
9
+ with open('ChuanhuChatbot.py', 'r', encoding='utf-8') as f:
10
+ contents = f.read()
 
11
 
12
+ # Load the .py files in the modules folder
13
+ for filename in os.listdir("modules"):
14
+ if filename.endswith(".py"):
15
+ with open(os.path.join("modules", filename), "r", encoding="utf-8") as f:
16
+ contents += f.read()
17
 
18
+ # Matching with regular expressions
19
+ matches = re.findall(pattern, contents, re.DOTALL)
20
 
21
+ # Convert to key/value pairs
22
+ data = {match.strip('()"'): '' for match in matches}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ # Save as a JSON file
25
+ with open('labels.json', 'w', encoding='utf-8') as f:
26
+ json.dump(data, f, ensure_ascii=False, indent=4)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locale/ja_JP.json CHANGED
@@ -1,141 +1,73 @@
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
  }
1
  {
2
+ "未命名对话历史记录": "名無しの会話履歴",
3
+ "在这里输入": "ここに入力",
4
+ "🧹 新的对话": "🧹 新しい会話",
5
+ "🔄 重新生成": "🔄 再生成",
6
+ "🗑️ 删除最旧对话": "🗑️ 最古の会話削除",
7
+ "🗑️ 删除最新对话": "🗑️ 最新の会話削除",
8
+ "模型": "LLMモデル",
9
+ "多账号模式已开启,无需输入key,可直接开始对话": "複数アカウントモードがオンになっています。キーを入力する必要はありません。会話を開始できます",
10
  "**发送消息** 或 **提交key** 以显示额度": "**メッセージを送信** または **キーを送信** して、クレジットを表示します",
11
+ "选择模型": "LLMモデルを選択",
12
+ "选择LoRA模型": "LoRAモデルを選択",
13
+ "实时传输回答": "ストリーム出力",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  "单轮对话": "単発会話",
15
+ "使用在线搜索": "オンライン検索を使用",
16
+ "选择回复语言(针对搜索&索引功能)": "回答言語を選択(検索とインデックス機能に対して)",
17
+ "上传索引文件": "インデックスファイルをアップロード",
18
  "双栏pdf": "2カラムpdf",
19
+ "识别公式": "formula OCR",
 
 
 
 
 
 
20
  "在这里输入System Prompt...": "System Promptを入力してください...",
21
+ "加载Prompt模板": "Promptテンプレートを読込",
22
+ "选择Prompt模板集合文件": "Promptテンプレートコレクションを選択",
23
+ "🔄 刷新": "🔄 更新",
24
+ "从Prompt模板中加载": "Promptテンプレートから読込",
25
+ "保存/加载": "保存/読込",
26
+ "保存/加载对话历史记录": "会話履歴を保存/読込",
27
+ "从列表中加载对话": "リストから会話を読込",
28
+ "设置文件名: 默认为.json,可选为.md": "ファイル名を設定: デフォルトは.json、.mdを選択できます",
29
+ "设置保存文件名": "保存ファイル名を設定",
30
  "对话历史记录": "会話履歴",
31
+ "💾 保存对话": "💾 会話を保存",
32
+ "📝 导出为Markdown": "📝 Markdownでエクスポート",
33
+ "默认保存于history文件夹": "デフォルトでhistoryフォルダに保存されます",
34
+ "高级": "Advanced",
35
+ "# ⚠️ 务必谨慎更改 ⚠️\n\n如果无法使用请恢复默认设置": "# ⚠️ 変更には慎重に ⚠️\n\nもし動作しない場合は、デフォルト設定に戻してください。",
36
+ "参数": "パラメータ",
37
+ "在这里输入停止符,用英文逗号隔开...": "ここにストップ文字を英語のカンマで区切って入力してください...",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  "用于定位滥用行为": "不正行為を特定するために使用されます",
39
  "用户名": "ユーザー名",
40
+ "网络设置": "ネットワーク設定",
41
+ "在这里输入API-Host...": "API-Hostを入力してください...",
42
+ "🔄 切换API地址": "🔄 APIアドレスを切り替え",
43
+ "在这里输入代理地址...": "プロキシアドレスを入力してください...",
44
+ "代理地址(示例:http://127.0.0.1:10809)": "プロキシアドレス(例:http://127.0.0.1:10809)",
45
+ "🔄 设置代理地址": "🔄 プロキシアドレスを設定",
46
+ "🔙 恢复默认设置": "🔙 デフォルト設定に戻す",
47
+ "川虎Chat 🚀": "川虎Chat 🚀",
48
+ "开始实时传输回答……": "ストリーム出力開始……",
49
+ "Token 计数: ": "Token数: ",
50
+ ",本次对话累计消耗了 ": ", 今の会話で消費合計 ",
51
+ "**获取API使用情况失败**": "**API使用状況の取得に失敗しました**",
52
+ "**本月使用金额** ": "**今月の使用料金** ",
53
  "获取API使用情况失败:": "API使用状況の取得に失敗しました:",
54
+ "API密钥更改为了": "APIキーが変更されました",
55
+ "JSON解析错误,收到的内容: ": "JSON解析エラー、受信内容: ",
56
+ "模型设置为了:": "LLMモデルを設定しました: ",
57
+ "☹️发生了错误:": "エラーが発生しました: ",
58
  "获取对话时发生错误,请查看后台日志": "会話取得時にエラー発生、あとのログを確認してください",
 
 
 
 
 
 
 
 
 
59
  "请检查网络连接,或者API-Key是否有效。": "ネットワーク接続を確認するか、APIキーが有効かどうかを確認してください。",
60
+ "连接超时,无法获取对话。": "接続タイムアウト、会話を取得できません。",
 
61
  "读取超时,无法获取对话。": "読み込みタイムアウト、会話を取得できません。",
62
+ "代理错误,无法获取对话。": "プロキシエラー、会話を取得できません。",
63
+ "SSL错误,无法获取对话。": "SSLエラー、会話を取得できません。",
64
+ "API key为空,请检查是否输入正确。": "APIキーが入力されていません。正しく入力されているか確認してください。",
65
+ "请输入对话内容。": "会話内容を入力してください。",
66
  "账单信息不适用": "課金情報は対象外です",
67
+ "由Bilibili [土川虎虎虎](https://space.bilibili.com/29125536) 和 [明昭MZhao](https://space.bilibili.com/24807452)开发<br />访问川虎Chat的 [GitHub项目](https://github.com/GaiZhenbiao/ChuanhuChatGPT) 下载最新版脚本": "開発:Bilibili [土川虎虎虎](https://space.bilibili.com/29125536) と [明昭MZhao](https://space.bilibili.com/24807452)\n\n最新コードは川虎Chatのサイトへ [GitHubプロジェクト](https://github.com/GaiZhenbiao/ChuanhuChatGPT)",
68
+ "切换亮暗色主题": "テーマの明暗切替",
69
+ "您的IP区域:未知。": "あなたのIPアドレス地域:不明",
70
+ "获取IP地理位置失败。原因:": "IPアドレス地域の取得に失敗しました。理由:",
71
+ "。你仍然可以使用聊天功能。": "。あなたはまだチャット機能を使用できます。",
72
+ "您的IP区域:": "あなたのIPアドレス地域:"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
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/__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__/config.cpython-311.pyc DELETED
Binary file (14.3 kB)
modules/__pycache__/config.cpython-39.pyc CHANGED
Binary files a/modules/__pycache__/config.cpython-39.pyc and b/modules/__pycache__/config.cpython-39.pyc differ
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 CHANGED
Binary files a/modules/__pycache__/llama_func.cpython-39.pyc and b/modules/__pycache__/llama_func.cpython-39.pyc differ
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__/overwrites.cpython-311.pyc DELETED
Binary file (5.16 kB)
modules/__pycache__/overwrites.cpython-39.pyc CHANGED
Binary files a/modules/__pycache__/overwrites.cpython-39.pyc and b/modules/__pycache__/overwrites.cpython-39.pyc differ
modules/__pycache__/pdf_func.cpython-311.pyc DELETED
Binary file (10.4 kB)
modules/__pycache__/pdf_func.cpython-39.pyc CHANGED
Binary files a/modules/__pycache__/pdf_func.cpython-39.pyc and b/modules/__pycache__/pdf_func.cpython-39.pyc differ
modules/__pycache__/presets.cpython-311.pyc DELETED
Binary file (9.24 kB)
modules/__pycache__/presets.cpython-39.pyc CHANGED
Binary files a/modules/__pycache__/presets.cpython-39.pyc and b/modules/__pycache__/presets.cpython-39.pyc differ
modules/__pycache__/repo.cpython-311.pyc DELETED
Binary file (14.8 kB)
modules/__pycache__/shared.cpython-311.pyc DELETED
Binary file (4 kB)
modules/__pycache__/shared.cpython-39.pyc CHANGED
Binary files a/modules/__pycache__/shared.cpython-39.pyc and b/modules/__pycache__/shared.cpython-39.pyc differ
modules/__pycache__/train_func.cpython-311.pyc DELETED
Binary file (11.7 kB)
modules/__pycache__/utils.cpython-311.pyc DELETED
Binary file (44.2 kB)
modules/__pycache__/utils.cpython-39.pyc CHANGED
Binary files a/modules/__pycache__/utils.cpython-39.pyc and b/modules/__pycache__/utils.cpython-39.pyc differ
modules/__pycache__/webui.cpython-311.pyc DELETED
Binary file (6.23 kB)
modules/__pycache__/webui_locale.cpython-311.pyc DELETED
Binary file (3.27 kB)
modules/__pycache__/webui_locale.cpython-39.pyc DELETED
Binary file (1.14 kB)
modules/base_model.py CHANGED
@@ -29,7 +29,7 @@ class ModelType(Enum):
29
  OpenAI = 0
30
  ChatGLM = 1
31
  LLaMA = 2
32
- XMChat = 3
33
 
34
  @classmethod
35
  def get_type(cls, model_name: str):
@@ -42,7 +42,7 @@ class ModelType(Enum):
42
  elif "llama" in model_name_lower or "alpaca" in model_name_lower:
43
  model_type = ModelType.LLaMA
44
  elif "xmchat" in model_name_lower:
45
- model_type = ModelType.XMChat
46
  else:
47
  model_type = ModelType.Unknown
48
  return model_type
@@ -201,7 +201,7 @@ class BaseLLMModel:
201
  msg = "索引获取成功,生成回答中……"
202
  logging.info(msg)
203
  if local_embedding or self.model_type != ModelType.OpenAI:
204
- embed_model = LangchainEmbedding(HuggingFaceEmbeddings(model_name = "sentence-transformers/distiluse-base-multilingual-cased-v2"))
205
  else:
206
  embed_model = OpenAIEmbedding()
207
  # yield chatbot + [(inputs, "")], msg
@@ -245,11 +245,10 @@ class BaseLLMModel:
245
  domain_name = urllib3.util.parse_url(result["href"]).host
246
  reference_results.append([result["body"], result["href"]])
247
  display_append.append(
248
- # f"{idx+1}. [{domain_name}]({result['href']})\n"
249
- f"<li><a href=\"{result['href']}\" target=\"_blank\">{domain_name}</a></li>\n"
250
  )
251
  reference_results = add_source_numbers(reference_results)
252
- display_append = "<ol>\n\n" + "".join(display_append) + "</ol>"
253
  real_inputs = (
254
  replace_today(WEBSEARCH_PTOMPT_TEMPLATE)
255
  .replace("{query}", real_inputs)
@@ -464,9 +463,9 @@ class BaseLLMModel:
464
 
465
  def set_key(self, new_access_key):
466
  self.api_key = new_access_key.strip()
467
- msg = i18n("API密钥更改为了") + hide_middle_chars(self.api_key)
468
  logging.info(msg)
469
- return self.api_key, msg
470
 
471
  def set_single_turn(self, new_single_turn):
472
  self.single_turn = new_single_turn
@@ -549,13 +548,3 @@ class BaseLLMModel:
549
  except FileNotFoundError:
550
  logging.warning(f"{user_name} 没有找到对话历史文件,不执行任何操作")
551
  return filename, self.system_prompt, chatbot
552
-
553
- def like(self):
554
- """like the last response, implement if needed
555
- """
556
- return gr.update()
557
-
558
- def dislike(self):
559
- """dislike the last response, implement if needed
560
- """
561
- return gr.update()
29
  OpenAI = 0
30
  ChatGLM = 1
31
  LLaMA = 2
32
+ XMBot = 3
33
 
34
  @classmethod
35
  def get_type(cls, model_name: str):
42
  elif "llama" in model_name_lower or "alpaca" in model_name_lower:
43
  model_type = ModelType.LLaMA
44
  elif "xmchat" in model_name_lower:
45
+ model_type = ModelType.XMBot
46
  else:
47
  model_type = ModelType.Unknown
48
  return model_type
201
  msg = "索引获取成功,生成回答中……"
202
  logging.info(msg)
203
  if local_embedding or self.model_type != ModelType.OpenAI:
204
+ embed_model = LangchainEmbedding(HuggingFaceEmbeddings())
205
  else:
206
  embed_model = OpenAIEmbedding()
207
  # yield chatbot + [(inputs, "")], msg
245
  domain_name = urllib3.util.parse_url(result["href"]).host
246
  reference_results.append([result["body"], result["href"]])
247
  display_append.append(
248
+ f"{idx+1}. [{domain_name}]({result['href']})\n"
 
249
  )
250
  reference_results = add_source_numbers(reference_results)
251
+ display_append = "\n\n" + "".join(display_append)
252
  real_inputs = (
253
  replace_today(WEBSEARCH_PTOMPT_TEMPLATE)
254
  .replace("{query}", real_inputs)
463
 
464
  def set_key(self, new_access_key):
465
  self.api_key = new_access_key.strip()
466
+ msg = f"API密钥更改为了{hide_middle_chars(self.api_key)}"
467
  logging.info(msg)
468
+ return new_access_key, msg
469
 
470
  def set_single_turn(self, new_single_turn):
471
  self.single_turn = new_single_turn
548
  except FileNotFoundError:
549
  logging.warning(f"{user_name} 没有找到对话历史文件,不执行任何操作")
550
  return filename, self.system_prompt, chatbot