JohnSmith9982 commited on
Commit
458ae42
1 Parent(s): 120129a

Upload 166 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. ChuanhuChatbot.py +93 -71
  2. locale/en_US.json +118 -1
  3. locale/extract_locale.py +15 -3
  4. locale/ja_JP.json +61 -7
  5. locale/ko_KR.json +66 -12
  6. locale/ru_RU.json +55 -1
  7. locale/sv_SE.json +55 -1
  8. locale/vi_VN.json +55 -1
  9. modules/.DS_Store +0 -0
  10. modules/__pycache__/__init__.cpython-310.pyc +0 -0
  11. modules/__pycache__/__init__.cpython-311.pyc +0 -0
  12. modules/__pycache__/config.cpython-310.pyc +0 -0
  13. modules/__pycache__/config.cpython-311.pyc +0 -0
  14. modules/__pycache__/gradio_patch.cpython-311.pyc +0 -0
  15. modules/__pycache__/index_func.cpython-310.pyc +0 -0
  16. modules/__pycache__/index_func.cpython-311.pyc +0 -0
  17. modules/__pycache__/overwrites.cpython-310.pyc +0 -0
  18. modules/__pycache__/overwrites.cpython-311.pyc +0 -0
  19. modules/__pycache__/pdf_func.cpython-311.pyc +0 -0
  20. modules/__pycache__/presets.cpython-310.pyc +0 -0
  21. modules/__pycache__/presets.cpython-311.pyc +0 -0
  22. modules/__pycache__/repo.cpython-310.pyc +0 -0
  23. modules/__pycache__/repo.cpython-311.pyc +0 -0
  24. modules/__pycache__/shared.cpython-310.pyc +0 -0
  25. modules/__pycache__/shared.cpython-311.pyc +0 -0
  26. modules/__pycache__/train_func.cpython-310.pyc +0 -0
  27. modules/__pycache__/train_func.cpython-311.pyc +0 -0
  28. modules/__pycache__/utils.cpython-310.pyc +0 -0
  29. modules/__pycache__/utils.cpython-311.pyc +0 -0
  30. modules/__pycache__/webui.cpython-310.pyc +0 -0
  31. modules/__pycache__/webui.cpython-311.pyc +0 -0
  32. modules/__pycache__/webui_locale.cpython-310.pyc +0 -0
  33. modules/__pycache__/webui_locale.cpython-311.pyc +0 -0
  34. modules/config.py +28 -8
  35. modules/gradio_patch.py +114 -0
  36. modules/index_func.py +14 -15
  37. modules/models/ChatGLM.py +24 -1
  38. modules/models/ChuanhuAgent.py +2 -2
  39. modules/models/DALLE3.py +63 -0
  40. modules/models/GoogleGemini.py +81 -0
  41. modules/models/GoogleGemma.py +102 -0
  42. modules/models/LLaMA.py +2 -32
  43. modules/models/Ollama.py +54 -0
  44. modules/models/OpenAI.py +8 -7
  45. modules/models/OpenAIInstruct.py +6 -6
  46. modules/models/OpenAIVision.py +22 -9
  47. modules/models/Qwen.py +13 -2
  48. modules/models/__pycache__/ChatGLM.cpython-311.pyc +0 -0
  49. modules/models/__pycache__/ChuanhuAgent.cpython-310.pyc +0 -0
  50. modules/models/__pycache__/ChuanhuAgent.cpython-311.pyc +0 -0
ChuanhuChatbot.py CHANGED
@@ -16,7 +16,9 @@ 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
 
@@ -33,6 +35,8 @@ def create_new_model():
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
@@ -44,7 +48,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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")
@@ -55,6 +59,8 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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"):
@@ -123,7 +129,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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(
@@ -197,14 +203,23 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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,
@@ -241,7 +256,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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(
@@ -329,7 +344,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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
  )
@@ -347,13 +362,8 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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
  # )
@@ -362,12 +372,6 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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(
@@ -375,6 +379,12 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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,
@@ -385,6 +395,8 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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(
@@ -474,10 +486,14 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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(
@@ -496,17 +512,14 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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=[
@@ -549,8 +562,8 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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(
@@ -559,7 +572,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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
  )
@@ -587,7 +600,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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
  )
@@ -641,7 +654,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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], [
@@ -672,19 +685,19 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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],
@@ -692,8 +705,8 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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, [
@@ -725,25 +738,25 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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
@@ -769,6 +782,13 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
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],
@@ -784,25 +804,27 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
784
  historySelectBtn.click( # This is an experimental feature... Not actually used.
785
  fn=load_chat_history,
786
  inputs=[current_model, historySelectList],
787
- outputs=[saveFileName, systemPromptTxt, chatbot],
788
  _js='(a,b)=>{return bgSelectHistory(a,b);}'
789
  )
790
-
791
-
792
- logging.info(
793
- colorama.Back.GREEN
794
- + "\n川虎的温馨提示:访问 http://localhost:7860 查看界面"
795
- + colorama.Style.RESET_ALL
796
- )
797
  # 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
798
  demo.title = i18n("川虎Chat 🚀")
799
 
800
  if __name__ == "__main__":
801
  reload_javascript()
 
802
  demo.queue(concurrency_count=CONCURRENT_COUNT).launch(
803
  allowed_paths=["history", "web_assets"],
 
 
804
  share=share,
805
  auth=auth_from_conf if authflag else None,
806
  favicon_path="./web_assets/favicon.ico",
807
- inbrowser=not dockerflag, # 禁止在docker下开启inbrowser
808
  )
 
16
  from modules import config
17
  import gradio as gr
18
  import colorama
19
+ from modules.gradio_patch import reg_patch
20
 
21
+ reg_patch()
22
 
23
  logging.getLogger("httpx").setLevel(logging.WARNING)
24
 
 
35
 
36
  with gr.Blocks(theme=small_and_beautiful_theme) as demo:
37
  user_name = gr.Textbox("", visible=False)
38
+ # 激活/logout路由
39
+ logout_hidden_btn = gr.LogoutButton(visible=False)
40
  promptTemplates = gr.State(load_template(get_template_names()[0], mode=2))
41
  user_question = gr.State("")
42
  assert type(my_api_key) == str
 
48
  with gr.Row(elem_id="chuanhu-header"):
49
  gr.HTML(get_html("header_title.html").format(
50
  app_title=CHUANHU_TITLE), elem_id="app-title")
51
+ status_display = gr.Markdown(get_geoip, elem_id="status-display")
52
  with gr.Row(elem_id="float-display"):
53
  user_info = gr.Markdown(
54
  value="getting user info...", elem_id="user-info")
 
59
  update_btn=i18n("更新"),
60
  seenew_btn=i18n("详情"),
61
  ok_btn=i18n("好"),
62
+ close_btn=i18n("关闭"),
63
+ reboot_btn=i18n("立即重启"),
64
  ), visible=check_update)
65
 
66
  with gr.Row(equal_height=True, elem_id="chuanhu-body"):
 
129
  show_label=False, container=False, elem_id="model-select-dropdown"
130
  )
131
  lora_select_dropdown = gr.Dropdown(
132
+ label=i18n("选择模型"), choices=[], multiselect=False, interactive=True, visible=False,
133
  container=False,
134
  )
135
  gr.HTML(get_html("chatbot_header_btn.html").format(
 
203
  obj="toolbox"), elem_classes="close-btn")
204
  with gr.Tabs(elem_id="chuanhu-toolbox-tabs"):
205
  with gr.Tab(label=i18n("对话")):
206
+ with gr.Accordion(label=i18n("模型"), open=not HIDE_MY_KEY, visible=not HIDE_MY_KEY):
207
+ keyTxt = gr.Textbox(
208
+ show_label=True,
209
+ placeholder=f"Your API-key...",
210
+ value=hide_middle_chars(user_api_key.value),
211
+ type="password",
212
+ visible=not HIDE_MY_KEY,
213
+ label="API-Key",
214
+ elem_id="api-key"
215
+ )
216
+ if multi_api_key:
217
+ usageTxt = gr.Markdown(i18n(
218
+ "多账号模式已开启,无需输入key,可直接开始对话"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
219
+ else:
220
+ usageTxt = gr.Markdown(i18n(
221
+ "**发送消息** 或 **提交key** 以显示额度"), elem_id="usage-display", elem_classes="insert-block", visible=show_api_billing)
222
+ gr.Markdown("---", elem_classes="hr-line", visible=not HIDE_MY_KEY)
223
  with gr.Accordion(label="Prompt", open=True):
224
  systemPromptTxt = gr.Textbox(
225
  show_label=True,
 
256
  container=False,
257
  )
258
  gr.Markdown("---", elem_classes="hr-line")
259
+ with gr.Accordion(label=i18n("知识库"), open=True, elem_id="gr-kb-accordion"):
260
  use_websearch_checkbox = gr.Checkbox(label=i18n(
261
  "使用在线搜索"), value=False, elem_classes="switch-checkbox", elem_id="gr-websearch-cb", visible=False)
262
  index_files = gr.Files(label=i18n(
 
344
  user_identifier_txt = gr.Textbox(
345
  show_label=True,
346
  placeholder=i18n("用于定位滥用行为"),
347
+ label=i18n("用户标识符"),
348
  value=user_name.value,
349
  lines=1,
350
  )
 
362
  gr.HTML(get_html("close_btn.html").format(
363
  obj="box"), elem_classes="close-btn")
364
  with gr.Tabs(elem_id="chuanhu-setting-tabs"):
365
+ # with gr.Tab(label=i18n("模型")):
366
+
 
 
 
 
 
367
  # model_select_dropdown = gr.Dropdown(
368
  # label=i18n("选择模型"), choices=MODELS, multiselect=False, value=MODELS[DEFAULT_MODEL], interactive=True
369
  # )
 
372
  # )
373
  # with gr.Row():
374
 
 
 
 
 
 
 
375
 
376
  with gr.Tab(label=i18n("高级")):
377
  gr.HTML(get_html("appearance_switcher.html").format(
 
379
  use_streaming_checkbox = gr.Checkbox(
380
  label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION, elem_classes="switch-checkbox"
381
  )
382
+ language_select_dropdown = gr.Dropdown(
383
+ label=i18n("选择回复语言(针对搜索&索引功能)"),
384
+ choices=REPLY_LANGUAGES,
385
+ multiselect=False,
386
+ value=REPLY_LANGUAGES[0],
387
+ )
388
  name_chat_method = gr.Dropdown(
389
  label=i18n("对话命名方式"),
390
  choices=HISTORY_NAME_METHODS,
 
395
  single_turn_checkbox = gr.Checkbox(label=i18n(
396
  "单轮对话"), value=False, elem_classes="switch-checkbox", elem_id="gr-single-session-cb", visible=False)
397
  # checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."), visible=check_update)
398
+ logout_btn = gr.Button(
399
+ i18n("退出用户"), variant="primary", visible=authflag)
400
 
401
  with gr.Tab(i18n("网络")):
402
  gr.Markdown(
 
486
  deleteRound_i18n=i18n("删除这轮问答"),
487
  renameChat_i18n=i18n("重命名该对话"),
488
  validFileName_i18n=i18n("请输入有效的文件名,不要包含以下特殊字符:"),
489
+ clearFileHistoryMsg_i18n=i18n("⚠️请先删除知识库中的历史文件,再尝试上传!"),
490
+ dropUploadMsg_i18n=i18n("释放文件以上传"),
491
  ))
492
  with gr.Box(elem_id="fake-gradio-components", visible=False):
493
  updateChuanhuBtn = gr.Button(
494
  visible=False, elem_classes="invisible-btn", elem_id="update-chuanhu-btn")
495
+ rebootChuanhuBtn = gr.Button(
496
+ visible=False, elem_classes="invisible-btn", elem_id="reboot-chuanhu-btn")
497
  changeSingleSessionBtn = gr.Button(
498
  visible=False, elem_classes="invisible-btn", elem_id="change-single-session-btn")
499
  changeOnlineSearchBtn = gr.Button(
 
512
  user_info, user_name = gr.Markdown.update(
513
  value=f"", visible=False), ""
514
  current_model = get_model(
515
+ model_name=MODELS[DEFAULT_MODEL], access_key=my_api_key, user_name=user_name)[0]
 
516
  if not hide_history_when_not_logged_in or user_name:
517
+ loaded_stuff = current_model.auto_load()
518
  else:
519
+ loaded_stuff = [gr.update(), gr.update(), gr.Chatbot.update(label=MODELS[DEFAULT_MODEL]), current_model.single_turn, current_model.temperature, current_model.top_p, current_model.n_choices, current_model.stop_sequence, current_model.token_upper_limit, current_model.max_generation_token, current_model.presence_penalty, current_model.frequency_penalty, current_model.logit_bias, current_model.user_identifier]
520
+ return user_info, user_name, current_model, toggle_like_btn_visibility(DEFAULT_MODEL), *loaded_stuff, init_history_list(user_name, prepend=current_model.history_file_path[:-5])
 
 
521
  demo.load(create_greeting, inputs=None, outputs=[
522
+ user_info, user_name, current_model, like_dislike_area, saveFileName, systemPromptTxt, chatbot, single_turn_checkbox, temperature_slider, top_p_slider, n_choices_slider, stop_sequence_txt, max_context_length_slider, max_generation_slider, presence_penalty_slider, frequency_penalty_slider, logit_bias_txt, user_identifier_txt, historySelectList], api_name="load")
523
  chatgpt_predict_args = dict(
524
  fn=predict,
525
  inputs=[
 
562
 
563
  load_history_from_file_args = dict(
564
  fn=load_chat_history,
565
+ inputs=[current_model, historySelectList],
566
+ outputs=[saveFileName, systemPromptTxt, chatbot, single_turn_checkbox, temperature_slider, top_p_slider, n_choices_slider, stop_sequence_txt, max_context_length_slider, max_generation_slider, presence_penalty_slider, frequency_penalty_slider, logit_bias_txt, user_identifier_txt],
567
  )
568
 
569
  refresh_history_args = dict(
 
572
 
573
  auto_name_chat_history_args = dict(
574
  fn=auto_name_chat_history,
575
+ inputs=[current_model, name_chat_method, user_question, chatbot, single_turn_checkbox],
576
  outputs=[historySelectList],
577
  show_progress=False,
578
  )
 
600
  emptyBtn.click(
601
  reset,
602
  inputs=[current_model, retain_system_prompt_checkbox],
603
+ outputs=[chatbot, status_display, historySelectList, systemPromptTxt, single_turn_checkbox, temperature_slider, top_p_slider, n_choices_slider, stop_sequence_txt, max_context_length_slider, max_generation_slider, presence_penalty_slider, frequency_penalty_slider, logit_bias_txt, user_identifier_txt],
604
  show_progress=True,
605
  _js='(a,b)=>{return clearChatbot(a,b);}',
606
  )
 
654
  user_api_key, status_display], api_name="set_key").then(**get_usage_args)
655
  keyTxt.submit(**get_usage_args)
656
  single_turn_checkbox.change(
657
+ set_single_turn, [current_model, single_turn_checkbox], None, show_progress=False)
658
  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], [
659
  current_model, status_display, chatbot, lora_select_dropdown, user_api_key, keyTxt], show_progress=True, api_name="get_model")
660
  model_select_dropdown.change(toggle_like_btn_visibility, [model_select_dropdown], [
 
685
  # S&L
686
  renameHistoryBtn.click(
687
  rename_chat_history,
688
+ [current_model, saveFileName, chatbot],
689
  [historySelectList],
690
  show_progress=True,
691
  _js='(a,b,c,d)=>{return saveChatHistory(a,b,c,d);}'
692
  )
693
  exportMarkdownBtn.click(
694
  export_markdown,
695
+ [current_model, saveFileName, chatbot],
696
  [],
697
  show_progress=True,
698
  )
699
  historyRefreshBtn.click(**refresh_history_args)
700
+ historyDeleteBtn.click(delete_chat_history, [current_model, historySelectList], [status_display, historySelectList, chatbot], _js='(a,b,c)=>{return showConfirmationDialog(a, b, c);}').then(
701
  reset,
702
  inputs=[current_model, retain_system_prompt_checkbox],
703
  outputs=[chatbot, status_display, historySelectList, systemPromptTxt],
 
705
  _js='(a,b)=>{return clearChatbot(a,b);}',
706
  )
707
  historySelectList.input(**load_history_from_file_args)
708
+ uploadFileBtn.upload(upload_chat_history, [current_model, uploadFileBtn], [
709
+ saveFileName, systemPromptTxt, chatbot, single_turn_checkbox, temperature_slider, top_p_slider, n_choices_slider, stop_sequence_txt, max_context_length_slider, max_generation_slider, presence_penalty_slider, frequency_penalty_slider, logit_bias_txt, user_identifier_txt]).then(**refresh_history_args)
710
  historyDownloadBtn.click(None, [
711
  user_name, historySelectList], None, _js='(a,b)=>{return downloadHistory(a,b,".json");}')
712
  historyMarkdownDownloadBtn.click(None, [
 
738
  cancel_all_jobs, [], [openai_train_status], show_progress=True)
739
 
740
  # Advanced
741
+ temperature_slider.input(
742
+ set_temperature, [current_model, temperature_slider], None, show_progress=False)
743
+ top_p_slider.input(set_top_p, [current_model, top_p_slider], None, show_progress=False)
744
+ n_choices_slider.input(
745
+ set_n_choices, [current_model, n_choices_slider], None, show_progress=False)
746
+ stop_sequence_txt.input(
747
+ set_stop_sequence, [current_model, stop_sequence_txt], None, show_progress=False)
748
+ max_context_length_slider.input(
749
+ set_token_upper_limit, [current_model, max_context_length_slider], None, show_progress=False)
750
+ max_generation_slider.input(
751
+ set_max_tokens, [current_model, max_generation_slider], None, show_progress=False)
752
+ presence_penalty_slider.input(
753
+ set_presence_penalty, [current_model, presence_penalty_slider], None, show_progress=False)
754
+ frequency_penalty_slider.input(
755
+ set_frequency_penalty, [current_model, frequency_penalty_slider], None, show_progress=False)
756
+ logit_bias_txt.input(
757
+ set_logit_bias, [current_model, logit_bias_txt], None, show_progress=False)
758
+ user_identifier_txt.input(set_user_identifier, [
759
+ current_model, user_identifier_txt], None, show_progress=False)
760
 
761
  default_btn.click(
762
  reset_default, [], [apihostTxt, proxyTxt, status_display], show_progress=True
 
782
  [status_display],
783
  show_progress=True,
784
  )
785
+ rebootChuanhuBtn.click(
786
+ reboot_chuanhu,
787
+ [],
788
+ [],
789
+ show_progress=True,
790
+ _js='rebootingChuanhu'
791
+ )
792
  changeSingleSessionBtn.click(
793
  fn=lambda value: gr.Checkbox.update(value=value),
794
  inputs=[single_turn_checkbox],
 
804
  historySelectBtn.click( # This is an experimental feature... Not actually used.
805
  fn=load_chat_history,
806
  inputs=[current_model, historySelectList],
807
+ outputs=[saveFileName, systemPromptTxt, chatbot, single_turn_checkbox, temperature_slider, top_p_slider, n_choices_slider, stop_sequence_txt, max_context_length_slider, max_generation_slider, presence_penalty_slider, frequency_penalty_slider, logit_bias_txt, user_identifier_txt],
808
  _js='(a,b)=>{return bgSelectHistory(a,b);}'
809
  )
810
+ logout_btn.click(
811
+ fn=None,
812
+ inputs=[],
813
+ outputs=[],
814
+ _js='self.location="/logout"'
815
+ )
 
816
  # 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
817
  demo.title = i18n("川虎Chat 🚀")
818
 
819
  if __name__ == "__main__":
820
  reload_javascript()
821
+ setup_wizard()
822
  demo.queue(concurrency_count=CONCURRENT_COUNT).launch(
823
  allowed_paths=["history", "web_assets"],
824
+ server_name=server_name,
825
+ server_port=server_port,
826
  share=share,
827
  auth=auth_from_conf if authflag else None,
828
  favicon_path="./web_assets/favicon.ico",
829
+ inbrowser=autobrowser and not dockerflag, # 禁止在docker下开启inbrowser
830
  )
locale/en_US.json CHANGED
@@ -1,4 +1,69 @@
1
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  " 吗?": " ?",
3
  "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Caution: Changes require care. ⚠️",
4
  "**发送消息** 或 **提交key** 以显示额度": "**Send message** or **Submit key** to display credit",
@@ -6,19 +71,28 @@
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",
@@ -26,10 +100,15 @@
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.",
@@ -45,6 +124,7 @@
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",
@@ -69,12 +149,17 @@
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/使用教程#手动更新)",
@@ -82,6 +167,7 @@
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",
@@ -89,44 +175,75 @@
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",
 
1
  {
2
+ "API Key 列表": "API Key List",
3
+ "Azure OpenAI Chat 模型 Deployment 名称": "Azure OpenAI Chat Model Deployment Name",
4
+ "Azure OpenAI Embedding 模型 Deployment 名称": "Azure OpenAI Embedding Model Deployment Name",
5
+ "Azure OpenAI Embedding 模型名称": "Azure OpenAI Embedding Model Name",
6
+ "HTTP 代理": "HTTP Proxy",
7
+ "LaTeX 公式渲染策略": "LaTeX formula rendering strategy",
8
+ "MidJourney Discord Proxy URL(用于对生成对图进行反代,可选)": "MidJourney Discord Proxy URL (used to reverse the generated image, optional)",
9
+ "MidJourney Proxy API Secret(用于鉴权访问 api,可选)": "MidJourney Proxy API Secret (used for authentication access api, optional)",
10
+ "SerpAPI API Key(获取方式请看 https://serpapi.com/)": "SerpAPI API Key (see https://serpapi.com/ for how to get it)",
11
+ "Wolfram Alpha API Key(获取方式请看 https://products.wolframalpha.com/api/)": "Wolfram Alpha API Key (see https://products.wolframalpha.com/api/ for how to get it)",
12
+ "你的 MidJourney 临时文件夹,用于存放生成的图片,填空则关闭自动下载切图(直接显示MJ的四宫格图)": "Your MidJourney temporary folder, used to store the generated images, leave blank to turn off the automatic download of the cut image (display the four-grid image of MJ directly)",
13
+ "可用模型列表": "Available model list",
14
+ "可选的本地模型为:": "The optional local models are:",
15
+ "如果不设置,将无法使用GPT模型和知识库在线索引功能。如果不设置此选项,您必须每次手动输入API Key。如果不设置,将自动启用本地编制索引的功能,可与本地模型配合使用。请问要设置默认 OpenAI API Key 吗?": "If not set, you will not be able to use the GPT model and the knowledge base online indexing function. If this option is not set, you must manually enter the API Key each time. If not set, the function of indexing locally will be automatically enabled, which can be used with local models. Do you want to set the default OpenAI API Key?",
16
+ "川虎助理使用的模型": "The model used by Chuanhu Assistant",
17
+ "是否不展示对话历史": "Do not show conversation history",
18
+ "是否启用检查更新": "Enable check for update",
19
+ "是否启用检查更新?如果设置,软件启动时会自动检查更新。": "Enable check for update? If set, the software will automatically check for updates when it starts.",
20
+ "是否在本地编制知识库索引?如果是,可以在使用本地模型时离线使用知识库,否则使用OpenAI服务来编制索引(需要OpenAI API Key)。请确保你的电脑有至少16GB内存。本地索引模型需要从互联网下载。": "Do you want to index the knowledge base locally? If so, you can use the knowledge base offline when using the local model, otherwise use the OpenAI service to index (requires OpenAI API Key). Make sure your computer has at least 16GB of memory. The local index model needs to be downloaded from the Internet.",
21
+ "是否指定可用模型列表?如果设置,将只会在 UI 中显示指定的模型。默认展示所有模型。可用的模型有:": "Specify the available model list? If set, only the specified models will be displayed in the UI. All models are displayed by default. The available models are:",
22
+ "是否更改默认模型?如果设置,软件启动时会自动加载该模型,无需在 UI 中手动选择。目前的默认模型为 gpt-3.5-turbo。可选的在线模型有:": "Change the default model? If set, the software will automatically load the model when it starts, and there is no need to manually select it in the UI. The current default model is gpt-3.5-turbo. The optional online models are:",
23
+ "是否添加模型到列表?例如,训练好的GPT模型可以添加到列表中。可以在UI中自动添加模型到列表。": "Add model to list? For example, the trained GPT model can be added to the list. You can automatically add models to the list in the UI.",
24
+ "是否设置 Azure OpenAI?如果设置,软件启动时会自动加载该API Key,无需在 UI 中手动输入。如果不设置,将无法使用 Azure OpenAI 模型。": "Set the default Azure OpenAI API Key? If set, the API Key will be automatically loaded when the software starts, and there is no need to manually enter it in the UI. If not set, the Azure OpenAI model will not be available.",
25
+ "是否设置 Midjourney ?如果设置,软件启动时会自动加载该API Key,无需在 UI 中手动输入。如果不设置,将无法使用 Midjourney 模型。": "Set the default Midjourney API Key? If set, the API Key will be automatically loaded when the software starts, and there is no need to manually enter it in the UI. If not set, the Midjourney model will not be available.",
26
+ "是否设置Cloude API?如果设置,软件启动时会自动加载该API Key,无需在 UI 中手动输入。如果不设置,将无法使用 Cloude 模型。": "Set the default Cloude API Key? If set, the API Key will be automatically loaded when the software starts, and there is no need to manually enter it in the UI. If not set, the Cloude model will not be available.",
27
+ "是否设置多 API Key 切换?如果设置,将在多个API Key之间切换使用。": "Set multiple API Key switching? If set, it will switch between multiple API Keys.",
28
+ "是否设置川虎助理?如果不设置,仍可设置川虎助理。如果设置,可以使用川虎助理Pro模式。": "Set Chuanhu Assistant? If not set, Chuanhu Assistant can still be set. If set, you can use Chuanhu Assistant Pro mode.",
29
+ "是否设置文心一言?如果设置,软件启动时会自动加载该API Key,无需在 UI 中手动输入。如果不设置,将无法使用 文心一言 模型。": "Set the default ERNIE Bot API Key? If set, the API Key will be automatically loaded when the software starts, and there is no need to manually enter it in the UI. If not set, the ERNIE Bot model will not be available.",
30
+ "是否设置文档处理与显示?可选的 LaTeX 公式渲染策略有:\"default\", \"strict\", \"all\"或者\"disabled\"。": "Set document processing and display? The optional LaTeX formula rendering strategies are: \"default\", \"strict\", \"all\" or \"disabled\".",
31
+ "是否设置未登录情况下是否不展示对话历史?如果设置,未登录情况下将不展示对话历史。": "Set whether to show conversation history when not logged in? If set, the conversation history will not be displayed when not logged in.",
32
+ "是否设置机器人头像和用户头像?可填写本地或网络图片链接,或者\"none\"(不显示头像)。": "Set the bot avatar and user avatar? You can fill in the local or network picture link, or \"none\" (do not display the avatar).",
33
+ "是否设置讯飞星火?如果设置,软件启动时会自动加载该API Key,无需在 UI 中手动输入。如果不设置,将无法使用 讯飞星火 模型。请注意不要搞混App ID和API Secret。": "Set the default Spark API Key? If set, the API Key will be automatically loaded when the software starts, and there is no need to manually enter it in the UI. If not set, the Spark model will not be available. Please be careful not to confuse App ID and API Secret.",
34
+ "是否设置默认 Google AI Studio API 密钥?如果设置,软件启动时会自动加载该API Key,无需在 UI 中手动输入。如果不设置,可以在软件启动后手动输入 API Key。": "Set the default Google Palm API Key? If set, the API Key will be automatically loaded when the software starts, and there is no need to manually enter it in the UI. If not set, you can manually enter the API Key after the software starts.",
35
+ "是否设置默认 HTTP 代理?这可以透过代理使用OpenAI API。": "Set the default HTTP proxy? This can use the OpenAI API through the proxy.",
36
+ "是否设置默认 MiniMax API 密钥和 Group ID?如果设置,软件启动时会自动加载该API Key,无需在 UI 中手动输入。如果不设置,将无法使用 MiniMax 模型。": "Set the default MiniMax API Key and Group ID? If set, the API Key will be automatically loaded when the software starts, and there is no need to manually enter it in the UI. If not set, the MiniMax model will not be available.",
37
+ "是否设置默认 OpenAI API Base?如果你在使用第三方API或者CloudFlare Workers等来中转OpenAI API,可以在这里设置。": "Set the default OpenAI API Base? If you are using a third-party API or CloudFlare Workers to transfer the OpenAI API, you can set it here.",
38
+ "是否设置默认 OpenAI API Key?如果设置,软件启动时会自动加载该API Key,无需在 UI 中手动输入。如果不设置,可以在软件启动后手动输入 API Key。": "Set the default OpenAI API Key? If set, the API Key will be automatically loaded when the software starts, and there is no need to manually enter it in the UI. If not set, you can manually enter the API Key after the software starts.",
39
+ "是否设置默认 XMChat API 密钥?如果设置,软件启动时会自动加载该API Key,无需在 UI 中手动输入。如果不设置,可以在软件启动后手动输入 API Key。": "Set the default XMChat API Key? If set, the API Key will be automatically loaded when the software starts, and there is no need to manually enter it in the UI. If not set, you can manually enter the API Key after the software starts.",
40
+ "是否选择自动命名对话历史的方式?": "Do you want to choose the way to automatically name the conversation history?",
41
+ "是否通过gradio分享?": "Share via gradio?",
42
+ "是否通过gradio分享?可以通过公网访问。": "Share via gradio? Can be accessed through the public network.",
43
+ "是否配置运行地址和端口?(不建议设置)": "Configure the running address and port? (Not recommended)",
44
+ "是否隐藏API Key输入框": "Hide API Key input box",
45
+ "是否隐藏API Key输入框?���果设置,将不会在 UI 中显示API Key输入框。": "Hide API Key input box? If set, the API Key input box will not be displayed in the UI.",
46
+ "服务器地址,例如设置为 0.0.0.0 则可以通过公网访问(如果你用公网IP)": "Server address, for example, set to 0.0.0。0 can be accessed through the public network (if you use a public network IP)",
47
+ "服务器端口": "Server port",
48
+ "未登录情况下是否不展示对话历史": "Do not show conversation history when not logged in",
49
+ "未设置用户名/密码情况下是否不展示对话历史?": "Do not show conversation history when username/password is not set?",
50
+ "本地编制索引": "Local indexing",
51
+ "机器人头像": "Bot avatar",
52
+ "用户头像": "User avatar",
53
+ "由于下面的原因,Google 拒绝返回 Gemini 的回答:\n\n": "For the following reasons, Google refuses to return Gemini's response:\n\n",
54
+ "百度云中的文心一言 API Key": "Baidu Cloud's ERNIE Bot API Key",
55
+ "百度云中的文心一言 Secret Key": "Baidu Cloud's ERNIE Bot Secret Key",
56
+ "自动命名对话历史的方式(0: 使用日期时间命名;1: 使用第一条提问命名,2: 使用模型自动总结。)": "The way to automatically name the conversation history (0: name by date and time; 1: name by first question, 2: name by model auto summary.)",
57
+ "讯飞星火 API Key": "Spark API Key",
58
+ "讯飞星火 API Secret": "Spark API Secret",
59
+ "讯飞星火 App ID": "Spark App ID",
60
+ "谷歌API Key(获取方式请看 https://stackoverflow.com/questions/37083058/programmatically-searching-google-in-python-using-custom-search)": "Google API Key (see https://stackoverflow.com/questions/37083058/programmatically-searching-google-in-python-using-custom-search for how to get it)",
61
+ "谷歌搜索引擎ID(获取方式请看 https://stackoverflow.com/questions/37083058/programmatically-searching-google-in-python-using-custom-search)": "Google search engine ID (see https://stackoverflow.com/questions/37083058/programmatically-searching-google-in-python-using-custom-search for how to get it)",
62
+ "输入的不是数字,将使用默认值。": "The input is not a number, the default value will be used.",
63
+ "额外模型列表": "Extra model list",
64
+ "默认模型": "Default model",
65
+ " 中。": ".",
66
+ " 为: ": " as: ",
67
  " 吗?": " ?",
68
  "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Caution: Changes require care. ⚠️",
69
  "**发送消息** 或 **提交key** 以显示额度": "**Send message** or **Submit key** to display credit",
 
71
  "**获取API使用情况失败**": "**Failed to get API usage**",
72
  "**获取API使用情况失败**,sensitive_id错误或已过期": "**Failed to get API usage**, wrong or expired sensitive_id",
73
  "**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**Failed to get API usage**, correct sensitive_id needed in `config.json`",
74
+ "== API 配置 ==": "== API Configuration ==",
75
+ "== 基础配置 ==": "== Basic Settings ==",
76
+ "== 高级配置 ==": "== Advanced Settings ==",
77
  "API key为空,请检查是否输入正确。": "API key is empty, check whether it is entered correctly.",
78
  "API密钥更改为了": "The API key is changed to",
79
+ "IP地址信息正在获取中,请稍候...": "IP address information is being retrieved, please wait...",
80
  "JSON解析错误,收到的内容: ": "JSON parsing error, received content: ",
81
  "SSL错误,无法获取对话。": "SSL error, unable to get dialogue.",
82
  "Token 计数: ": "Token Count: ",
83
  "☹️发生了错误:": "☹️Error: ",
84
  "⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ To ensure the security of API-Key, please modify the network settings in the configuration file `config.json`.",
85
+ "⚠️请先删除知识库中的历史文件,再尝试上传!": "⚠️ Please clear the files in the knowledge base before trying to upload new files!",
86
+ "。": ".",
87
  "。你仍然可以使用聊天功能。": ". You can still use the chat function.",
88
  "上传": "Upload",
89
  "上传了": "Uploaded",
90
  "上传到 OpenAI 后自动填充": "Automatically filled after uploading to OpenAI",
91
  "上传到OpenAI": "Upload to OpenAI",
92
  "上传文件": "Upload files",
93
+ "不支持的文件: ": "Unsupported file:",
94
+ "中。": ".",
95
+ "中,包含了可用设置项及其简要说明。请查看 wiki 获取更多信息:": " contains available settings and brief descriptions. Please check the wiki for more information:",
96
  "仅供查看": "For viewing only",
97
  "从Prompt模板中加载": "Load from Prompt Template",
98
  "从列表中加载对话": "Load dialog from list",
 
100
  "代理错误,无法获取对话。": "Proxy error, unable to get dialogue.",
101
  "你没有权限访问 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)",
102
  "你没有选择任何对话历史": "You have not selected any conversation history.",
103
+ "你的": "Your ",
104
  "你真的要删除 ": "Are you sure you want to delete ",
105
+ "你设置了 ": "You set ",
106
+ "你选择了不设置 ": "You chose not to set ",
107
+ "你选择了不设置用户账户。": "You chose not to set user account.",
108
  "使用在线搜索": "Use online search",
109
  "停止符,用英文逗号隔开...": "Type in stop token here, separated by comma...",
110
  "关于": "About",
111
+ "关闭": "Close",
112
  "准备数据集": "Prepare Dataset",
113
  "切换亮暗色主题": "Switch light/dark theme",
114
  "删除对话历史成功": "Successfully deleted conversation history.",
 
124
  "取消所有任务": "Cancel All Tasks",
125
  "可选,用于区分不同的模型": "Optional, used to distinguish different models",
126
  "启用的工具:": "Enabled tools: ",
127
+ "在": "in",
128
  "在工具箱中管理知识库文件": "Manage knowledge base files in the toolbox",
129
  "在线搜索": "Web search",
130
  "在这里输入": "Type in here",
 
149
  "您使用的就是最新版!": "You are using the latest version!",
150
  "您的IP区域:": "Your IP region: ",
151
  "您的IP区域:未知。": "Your IP region: Unknown.",
152
+ "您输入的 API 密钥为:": "The API key you entered is:",
153
+ "找到了缓存的索引文件,加载中……": "Found cached index file, loading...",
154
  "拓展": "Extensions",
155
  "搜索(支持正则)...": "Search (supports regex)...",
156
  "数据集预览": "Dataset Preview",
157
  "文件ID": "File ID",
158
  "新对话 ": "New Chat ",
159
  "新建对话保留Prompt": "Retain Prompt For New Chat",
160
+ "是否设置 HTTP 代理?[Y/N]:": "Do you want to set up an HTTP proxy? [Y/N]:",
161
+ "是否设置 OpenAI API 密钥?[Y/N]:": "Have you set the OpenAI API key? [Y/N]:",
162
+ "是否设置用户账户?设置后,用户需要登陆才可访问。输入 Yes(y) 或 No(n),默认No:": "Set user account? After setting, users need to log in to access. Enter Yes(y) or No(n), default No: ",
163
  "暂时未知": "Unknown",
164
  "更新": "Update",
165
  "更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Update failed, please try [manually updating](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)",
 
167
  "未命名对话历史记录": "Unnamed Dialog History",
168
  "未设置代理...": "No proxy...",
169
  "本月使用金额": "Monthly usage",
170
+ "构建索引中……": "Building index...",
171
  "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "View the [usage guide](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) for more details",
172
  "根据日期时间": "By date and time",
173
  "模型": "Model",
 
175
  "模型自动总结(消耗tokens)": "Auto summary by LLM (Consume tokens)",
176
  "模型设置为了:": "Model is set to: ",
177
  "正在尝试更新...": "Trying to update...",
178
+ "正在尝试重启...": "Trying to restart...",
179
+ "正在获取IP地址信息,请稍候...": "Getting IP address information, please wait...",
180
+ "正在进行首次设置,请按照提示进行配置,配置将会被保存在": "First-time setup is in progress, please follow the prompts to configure, and the configuration will be saved in",
181
+ "没有找到任何支持的文档。": "No supported documents found.",
182
  "添加训练好的模型到模型列表": "Add trained model to the model list",
183
  "状态": "Status",
184
+ "现在开始设置其他在线模型的API Key": "Start setting the API Key for other online models",
185
+ "现在开始进行交互式配置。碰到不知道该怎么办的设置项时,请直接按回车键跳过,程序会自动选择合适的默认值。": "Starting interactive configuration now. When you encounter a setting that you don't know what to do, just press the Enter key to skip, and the program will automatically select the appropriate default value.",
186
+ "现在开始进行交互式配置:": "Interactive configuration will now begin:",
187
+ "现在开始进行软件功能设置": "Start setting the software function now",
188
  "生成内容总结中……": "Generating content summary...",
189
  "用于定位滥用行为": "Used to locate abuse",
190
+ "用户标识符": "User identifier",
191
  "由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)",
192
+ "由于下面的原因,Google 拒绝返回 Gemini 的回答:\\n\\n": "Google has refused to return Gemini's response due to the following reasons:",
193
  "知识库": "Knowledge base",
194
  "知识库文件": "Knowledge base files",
195
+ "立即重启": "Restart now",
196
  "第一条提问": "By first question",
197
+ "索引已保存至本地!": "Index saved locally!",
198
+ "索引构建失败!": "Index build failed!",
199
  "索引构建完成": "Indexing complete.",
200
+ "索引构建完成!": "Indexing completed!",
201
  "网络": "Network",
202
  "获取API使用情况失败:": "Failed to get API usage:",
203
  "获取IP地理位置失败。原因:": "Failed to get IP location. Reason: ",
204
  "获取对话时发生错误,请查看后台日志": "Error occurred when getting dialogue, check the background log",
205
+ "覆盖gradio.oauth /logout路由": "Overrided the gradio.oauth/logout route",
206
  "训练": "Training",
207
  "训练状态": "Training Status",
208
  "训练轮数(Epochs)": "Training Epochs",
209
  "设置": "Settings",
210
  "设置保存文件名": "Set save file name",
211
+ "设置完成。现在请重启本程序。": "Setup completed. Please restart this program now.",
212
  "设置文件名: 默认为.json,可选为.md": "Set file name: default is .json, optional is .md",
213
  "识别公式": "formula OCR",
214
  "详情": "Details",
215
+ "请先输入用户名,输入空行结束添加用户:": "Please enter the username first, press Enter to add the user: ",
216
+ "请先选择Ollama后端模型\\n\\n": "Please select the Ollama backend model first.",
217
  "请查看 config_example.json,配置 Azure OpenAI": "Please review config_example.json to configure Azure OpenAI",
218
  "请检查网络连接,或者API-Key是否有效。": "Check the network connection or whether the API-Key is valid.",
219
+ "请输入 ": "Please enter ",
220
+ "请输入 HTTP 代理地址:": "Please enter the HTTP proxy address:",
221
+ "请输入 OpenAI API 密钥:": "Please enter your OpenAI API key:",
222
+ "请输入密码:": "Please enter the password: ",
223
  "请输入对话内容。": "Enter the content of the conversation.",
224
  "请输入有效的文件名,不要包含以下特殊字符:": "Please enter a valid file name, do not include the following special characters: ",
225
  "读取超时,无法获取对话。": "Read timed out, unable to get dialogue.",
226
  "账单信息不适用": "Billing information is not applicable",
227
+ "跳过设置 HTTP 代理。": "Skip setting up HTTP proxy.",
228
+ "跳过设置 OpenAI API 密钥。": "Skip setting up OpenAI API key.",
229
+ "输入 Yes(y) 或 No(n),默认No:": "Enter Yes(y) or No(n), default No: ",
230
  "连接超时,无法获取对话。": "Connection timed out, unable to get dialogue.",
231
+ "退出用户": "Log out user.",
232
  "选择LoRA模型": "Select LoRA Model",
233
  "选择Prompt模板集合文件": "Select Prompt Template Collection File",
234
  "选择回复语言(针对搜索&索引功能)": "Select reply language (for search & index)",
235
  "选择数据集": "Select Dataset",
236
  "选择模型": "Select Model",
237
+ "配置已保存在 config.json 中。": "The configuration has been saved in config.json.",
238
+ "释放文件以上传": "Drop files to upload",
239
  "重命名该对话": "Rename this chat",
240
  "重新生成": "Regenerate",
241
  "高级": "Advanced",
242
  ",本次对话累计消耗了 ": ", total cost: ",
243
+ ",请使用 .pdf, .docx, .pptx, .epub, .xlsx 等文档。": "Please use .pdf, .docx, .pptx, .epub, .xlsx, etc. documents.",
244
+ ",输入空行结束:": ", press Enter to end: ",
245
+ ",默认为 ": ", default is ",
246
+ ":": ": ",
247
  "💾 保存对话": "💾 Save Dialog",
248
  "📝 导出为 Markdown": "📝 Export as Markdown",
249
  "🔄 切换API地址": "🔄 Switch API Address",
locale/extract_locale.py CHANGED
@@ -1,6 +1,12 @@
1
- import os, json, re, sys
2
- import aiohttp, asyncio
 
 
 
 
 
3
  import commentjson
 
4
 
5
  asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
6
 
@@ -98,7 +104,13 @@ async def main(auto=False):
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 = []
 
1
+ import asyncio
2
+ import logging
3
+ import os
4
+ import re
5
+ import sys
6
+
7
+ import aiohttp
8
  import commentjson
9
+ import commentjson as json
10
 
11
  asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
12
 
 
104
  for locale_filename in locale_files:
105
  if "zh_CN" in locale_filename:
106
  continue
107
+ try:
108
+ locale_strs = get_locale_strings(locale_filename)
109
+ except json.decoder.JSONDecodeError:
110
+ import traceback
111
+ traceback.print_exc()
112
+ logging.error(f"Error decoding {locale_filename}")
113
+ continue
114
 
115
  # Add new keys
116
  new_keys = []
locale/ja_JP.json CHANGED
@@ -1,24 +1,35 @@
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
  "从列表中加载对话": "リストから会話を読込",
@@ -26,10 +37,15 @@
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
  "删除对话历史成功": "削除した会話の履歴",
@@ -39,12 +55,13 @@
39
  "加载Prompt模板": "Promptテンプレートを読込",
40
  "单轮对话": "単発会話",
41
  "历史记录(JSON)": "履歴ファイル(JSON)",
42
- "参数": "パラメータ",
43
  "双栏pdf": "2カラムpdf",
44
  "取消": "キャンセル",
45
  "取消所有任务": "すべてのタスクをキャンセル",
46
  "可选,用于区分不同的模型": "オプション、異なるモデルを区別するために使用",
47
  "启用的工具:": "有効なツール:",
 
48
  "在工具箱中管理知识库文件": "ツールボックスでナレッジベースファイルの管理を行う",
49
  "在线搜索": "オンライン検索",
50
  "在这里输入": "ここに入力",
@@ -69,12 +86,17 @@
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/使用教程#手动更新)をお試しください。",
@@ -82,6 +104,7 @@
82
  "未命名对话历史记录": "名無しの会話履歴",
83
  "未设置代理...": "代理が設定されていません...",
84
  "本月使用金额": "今月の使用料金",
 
85
  "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "[使用ガイド](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)を表示",
86
  "根据日期时间": "日付と時刻に基づいて",
87
  "模型": "LLMモデル",
@@ -89,44 +112,75 @@
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アドレスを切り替え",
 
1
  {
2
+ " 中。": "中。",
3
+ " 为: ": "対:",
4
  " 吗?": " を削除してもよろしいですか?",
5
+ "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ 変更を慎重に ⚠️",
6
  "**发送消息** 或 **提交key** 以显示额度": "**メッセージを送信** または **キーを送信** して、クレジットを表示します",
7
  "**本月使用金额** ": "**今月の使用料金** ",
8
  "**获取API使用情况失败**": "**API使用状況の取得に失敗しました**",
9
  "**获取API使用情况失败**,sensitive_id错误或已过期": "**API使用状況の取得に失敗しました**、sensitive_idが間違っているか、期限切れです",
10
  "**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**API使用状況の取得に失敗しました**、`config.json`に正しい`sensitive_id`を入力する必要があります",
11
+ "== API 配置 ==": "== API設定 ==",
12
+ "== 基础配置 ==": "== Basic Configuration ==",
13
+ "== 高级配置 ==": "== Advanced Settings ==",
14
  "API key为空,请检查是否输入正确。": "APIキーが入力されていません。正しく入力されているか確認してください。",
15
  "API密钥更改为了": "APIキーが変更されました",
16
+ "IP地址信息正在获取中,请稍候...": "IPアドレス情報を取得中です。お待ちください...",
17
  "JSON解析错误,收到的内容: ": "JSON解析エラー、受信内容: ",
18
  "SSL错误,无法获取对话。": "SSLエラー、会話を取得できません。",
19
  "Token 计数: ": "Token数: ",
20
  "☹️发生了错误:": "エラーが発生しました: ",
21
  "⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ APIキーの安全性を確保するために、`config.json`ファイルでネットワーク設定を変更してください。",
22
+ "⚠️请先删除知识库中的历史文件,再尝试上传!": "⚠️ ナレッジベースの履歴ファイルを削除してから、アップロードを試してください!",
23
+ "。": "。",
24
  "。你仍然可以使用聊天功能。": "。あなたはまだチャット機能を使用できます。",
25
  "上传": "アップロード",
26
  "上传了": "アップロードしました。",
27
  "上传到 OpenAI 后自动填充": "OpenAIへのアップロード後、自動的に入力されます",
28
  "上传到OpenAI": "OpenAIへのアップロード",
29
  "上传文件": "ファイルをアップロード",
30
+ "不支持的文件: ": "サポートされていないファイル:",
31
+ "中。": "ちゅう。",
32
+ "中,包含了可用设置项及其简要说明。请查看 wiki 获取更多信息:": "使用者名またはパスワードが正しくありません。再試行してください。",
33
  "仅供查看": "閲覧専用",
34
  "从Prompt模板中加载": "Promptテンプレートから読込",
35
  "从列表中加载对话": "リストから会話を読込",
 
37
  "代理错误,无法获取对话。": "プロキシエラー、会話を取得できません。",
38
  "你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)": "GPT-4にアクセス権がありません、[詳細はこちら](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)",
39
  "你没有选择任何对话历史": "あなたは何の会話履歴も選択していません。",
40
+ "你的": "あなたの",
41
  "你真的要删除 ": "本当に ",
42
+ "你设置了 ": "設定した内容: ",
43
+ "你选择了不设置 ": "設定を選択していません。",
44
+ "你选择了不设置用户账户。": "You have chosen not to set up a user account.",
45
  "使用在线搜索": "オンライン検索を使用",
46
+ "停止符,用英文逗号隔开...": "英語のカンマで区切りにしてください。...",
47
  "关于": "について",
48
+ "关闭": "閉じる",
49
  "准备数据集": "データセットの準備",
50
  "切换亮暗色主题": "テーマの明暗切替",
51
  "删除对话历史成功": "削除した会話の履歴",
 
55
  "加载Prompt模板": "Promptテンプレートを読込",
56
  "单轮对话": "単発会話",
57
  "历史记录(JSON)": "履歴ファイル(JSON)",
58
+ "参数": "調整",
59
  "双栏pdf": "2カラムpdf",
60
  "取消": "キャンセル",
61
  "取消所有任务": "すべてのタスクをキャンセル",
62
  "可选,用于区分不同的模型": "オプション、異なるモデルを区別するために使用",
63
  "启用的工具:": "有効なツール:",
64
+ "在": "In",
65
  "在工具箱中管理知识库文件": "ツールボックスでナレッジベースファイルの管理を行う",
66
  "在线搜索": "オンライン検索",
67
  "在这里输入": "ここに入力",
 
86
  "您使用的就是最新版!": "最新バージョンを使用しています!",
87
  "您的IP区域:": "あなたのIPアドレス地域:",
88
  "您的IP区域:未知。": "あなたのIPアドレス地域:不明",
89
+ "您输入的 API 密钥为:": "入力されたAPIキーは:",
90
+ "找到了缓存的索引文件,加载中……": "キャッシュされたインデックスファイルが見つかりました、読み込んでいます...",
91
  "拓展": "拡張",
92
  "搜索(支持正则)...": "検索(正規表現をサポート)...",
93
  "数据集预览": "データセットのプレビュー",
94
  "文件ID": "ファイルID",
95
  "新对话 ": "新しい会話 ",
96
+ "新建对话保留Prompt": "新しい会話を作るたびに、このプロンプトが維持しますか。",
97
+ "是否设置 HTTP 代理?[Y/N]:": "HTTPプロキシを設定しますか?[Y/N]:",
98
+ "是否设置 OpenAI API 密钥?[Y/N]:": "OpenAI APIのキーを設定しますか?[Y/N]:",
99
+ "是否设置用户账户?设置后,用户需要登陆才可访问。输入 Yes(y) 或 No(n),默认No:": "ユーザーアカウントを設定しますか?アカウントを設定すると、ユーザーはログインしてアクセスする必要があります。Yes(y) または No(n) を入力してください。デフォルトはNoです:",
100
  "暂时未知": "しばらく不明である",
101
  "更新": "アップデート",
102
  "更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "更新に失敗しました、[手動での更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)をお試しください。",
 
104
  "未命名对话历史记录": "名無しの会話履歴",
105
  "未设置代理...": "代理が設定されていません...",
106
  "本月使用金额": "今月の使用料金",
107
+ "构建索引中……": "インデックスを構築中...",
108
  "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "[使用ガイド](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)を表示",
109
  "根据日期时间": "日付と時刻に基づいて",
110
  "模型": "LLMモデル",
 
112
  "模型自动总结(消耗tokens)": "モデルによる自動要約(トークン消費)",
113
  "模型设置为了:": "LLMモデルを設定しました: ",
114
  "正在尝试更新...": "更新を試みています...",
115
+ "正在尝试重启...": "再起動を試みています...",
116
+ "正在获取IP地址信息,请稍候...": "IPアドレス情報を取得しています、しばらくお待ちください...",
117
+ "正在进行首次设置,请按照提示进行配置,配置将会被保存在": "最初のセットアップ中です。指示に従って設定を行い、設定は保存されます。",
118
+ "没有找到任何支持的文档。": "サポートされているドキュメントが見つかりませんでした。",
119
  "添加训练好的模型到模型列表": "トレーニング済みモデルをモデルリストに追加",
120
  "状态": "ステータス",
121
+ "现在开始设置其他在线模型的API Key": "他のオンラインモデルのAPIキーを設定します。",
122
+ "现在开始进行交互式配置。碰到不知道该怎么办的设置项时,请直接按回车键跳过,程序会自动选择合适的默认值。": "インタラクティブな構成が始まりました。わからない設定がある場合は、Enterキーを押してスキップしてください。プログラムが適切なデフォルト値を自動で選択します。",
123
+ "现在开始进行交互式配置:": "インタラクティブな設定が始まります:",
124
+ "现在开始进行软件功能设置": "ソフトウェア機能の設定を開始します",
125
  "生成内容总结中……": "コンテンツ概要を生成しています...",
126
+ "用于定位滥用行为": "不正行為を特定できるため",
127
+ "用户标识符": "ユーザー識別子",
128
  "由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)",
129
+ "由于下面的原因,Google 拒绝返回 Gemini 的回答:\\n\\n": "GoogleがGeminiの回答を返信しない理由:",
130
+ "知识库": "ファイル収納庫",
131
  "知识库文件": "ナレッジベースファイル",
132
+ "立即重启": "今すぐ再起動",
133
  "第一条提问": "最初の質問",
134
+ "索引已保存至本地!": "インデックスはローカルに保存されました!",
135
+ "索引构建失败!": "インデックスの作成に失敗しました!",
136
  "索引构建完成": "索引の構築が完了しました。",
137
+ "索引构建完成!": "インデックスの構築が完了しました!",
138
  "网络": "ネットワーク",
139
  "获取API使用情况失败:": "API使用状況の取得に失敗しました:",
140
  "获取IP地理位置失败。原因:": "IPアドレス地域の取得に失敗しました。理由:",
141
  "获取对话时发生错误,请查看后台日志": "会話取得時にエラー発生、あとのログを確認してください",
142
+ "覆盖gradio.oauth /logout路由": "\"gradio.oauth /logout\" ルートをオーバーライドします。",
143
  "训练": "トレーニング",
144
  "训练状态": "トレーニングステータス",
145
  "训练轮数(Epochs)": "トレーニングエポック数",
146
  "设置": "設定",
147
  "设置保存文件名": "保存ファイル名を設定",
148
+ "设置完成。现在请重启本程序。": "設定完了。今度はアプリを再起動してください。",
149
  "设置文件名: 默认为.json,可选为.md": "ファイル名を設定: デフォルトは.json、.mdを選択できます",
150
  "识别公式": "formula OCR",
151
  "详情": "詳細",
152
+ "请先输入用户名,输入空行结束添加用户:": "ユーザー名を入力してください。ユーザーの追加は空行で終了します。",
153
+ "请先选择Ollama后端模型\\n\\n": "Ollamaのバックエンドモデルを選択してください。",
154
  "请查看 config_example.json,配置 Azure OpenAI": "Azure OpenAIの設定については、config_example.jsonをご覧ください",
155
  "请检查网络连接,或者API-Key是否有效。": "ネットワーク接続を確認するか、APIキーが有効かどうかを確認してください。",
156
+ "请输入 ": "入力してください",
157
+ "请输入 HTTP 代理地址:": "HTTPプロキシアドレスを入力してください:",
158
+ "请输入 OpenAI API 密钥:": "OpenAI APIキーを入力してください:",
159
+ "请输入密码:": "パスワードを入力してください。",
160
  "请输入对话内容。": "会話内容を入力してください。",
161
  "请输入有效的文件名,不要包含以下特殊字符:": "有効なファイル名を入力してください。以下の特殊文字は使用しないでください:",
162
  "读取超时,无法获取对话。": "読み込みタイムアウト、会話を取得できません。",
163
  "账单信息不适用": "課金情報は対象外です",
164
+ "跳过设置 HTTP 代理。": "Skip setting up HTTP proxy.",
165
+ "跳过设置 OpenAI API 密钥。": "OpenAI APIキーの設定をスキップします。",
166
+ "输入 Yes(y) 或 No(n),默认No:": "Yes(y)またはNo(n)を入力してください、デフォルトはNoです:",
167
  "连接超时,无法获取对话。": "接続タイムアウト、会話を取得できません。",
168
+ "退出用户": "ユーザーをログアウトします。",
169
  "选择LoRA模型": "LoRAモデルを選択",
170
  "选择Prompt模板集合文件": "Promptテンプレートコレクションを選択",
171
  "选择回复语言(针对搜索&索引功能)": "回答言語を選択(検索とインデックス機能に対して)",
172
  "选择数据集": "データセットの選択",
173
  "选择模型": "LLMモデルを選択",
174
+ "配置已保存在 config.json 中。": "Config.json に設定が保存されました。",
175
+ "释放文件以上传": "ファイルをアップロードするには、ここでドロップしてください",
176
  "重命名该对话": "会話の名前を変更",
177
  "重新生成": "再生成",
178
  "高级": "Advanced",
179
  ",本次对话累计消耗了 ": ", 今の会話で消費合計 ",
180
+ ",请使用 .pdf, .docx, .pptx, .epub, .xlsx 等文档。": ".pdf、.docx、.pptx、.epub、.xlsxなどのドキュメントを使用してください。",
181
+ ",输入空行结束:": "、空行で終了します:",
182
+ ",默认为 ": "デフォルトです",
183
+ ":": ":",
184
  "💾 保存对话": "💾 会話を保存",
185
  "📝 导出为 Markdown": "📝 Markdownにエクスポート",
186
  "🔄 切换API地址": "🔄 APIアドレスを切り替え",
locale/ko_KR.json CHANGED
@@ -1,4 +1,6 @@
1
  {
 
 
2
  " 吗?": " 을(를) 삭제하시겠습니까?",
3
  "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ 주의: 변경시 주의하세요. ⚠️",
4
  "**发送消息** 或 **提交key** 以显示额度": "**메세지를 전송** 하거나 **Key를 입력**하여 크레딧 표시",
@@ -6,19 +8,28 @@
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
  "从列表中加载对话": "리스트에서 대화 불러오기",
@@ -26,10 +37,15 @@
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
  "删除对话历史成功": "대화 기록이 성공적으로 삭제되었습니다.",
@@ -45,6 +61,7 @@
45
  "取消所有任务": "모든 작업 취소",
46
  "可选,用于区分不同的模型": "선택 사항, 다른 모델을 구분하는 데 사용",
47
  "启用的工具:": "활성화된 도구: ",
 
48
  "在工具箱中管理知识库文件": "지식 라이브러리 파일을 도구 상자에서 관리",
49
  "在线搜索": "온라인 검색",
50
  "在这里输入": "여기에 입력하세요",
@@ -56,32 +73,38 @@
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 모델",
@@ -89,46 +112,77 @@
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
  "🔄 检查更新...": "🔄 업데이트 확인...",
 
1
  {
2
+ " 中。": "가운데입니다.",
3
+ " 为: ": "되다",
4
  " 吗?": " 을(를) 삭제하시겠습니까?",
5
  "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ 주의: 변경시 주의하세요. ⚠️",
6
  "**发送消息** 或 **提交key** 以显示额度": "**메세지를 전송** 하거나 **Key를 입력**하여 크레딧 표시",
 
8
  "**获取API使用情况失败**": "**API 사용량 가져오기 실패**",
9
  "**获取API使用情况失败**,sensitive_id错误或已过期": "**API 사용량 가져오기 실패**. sensitive_id가 잘못되었거나 만료되었습니다",
10
  "**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**API 사용량 가져오기 실패**. `config.json`에 올바른 `sensitive_id`를 입력해야 합니다",
11
+ "== API 配置 ==": "== API 설정 ==",
12
+ "== 基础配置 ==": "== Basic Settings ==",
13
+ "== 高级配置 ==": "== Advanced Settings ==",
14
  "API key为空,请检查是否输入正确。": "API 키가 비어 있습니다. 올바르게 입력되었는지 확인하십세요.",
15
  "API密钥更改为了": "API 키가 변경되었습니다.",
16
+ "IP地址信息正在获取中,请稍候...": "IP 주소 정보를 가져오는 중입니다. 잠시 기다려주세요...",
17
  "JSON解析错误,收到的内容: ": "JSON 파싱 에러, 응답: ",
18
  "SSL错误,无法获取对话。": "SSL 에러, 대화를 가져올 수 없습니다.",
19
  "Token 计数: ": "토큰 수: ",
20
  "☹️发生了错误:": "☹️에러: ",
21
  "⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ API-Key의 안전을 보장하기 위해 네트워크 설정을 `config.json` 구성 파일에서 수정해주세요.",
22
+ "⚠️请先删除知识库中的历史文件,再尝试上传!": "⚠️ 먼저 지식 라이브러리에서 기록 파일을 삭제한 후 다시 업로드하세요!",
23
+ "。": "。",
24
  "。你仍然可以使用聊天功能。": ". 채팅 기능을 계속 사용할 수 있습니다.",
25
  "上传": "업로드",
26
+ "上传了": "업로드완료.",
27
  "上传到 OpenAI 后自动填充": "OpenAI로 업로드한 후 자동으로 채워집니다",
28
  "上传到OpenAI": "OpenAI로 업로드",
29
  "上传文件": "파일 업로드",
30
+ "不支持的文件: ": "지원되지 않는 파일:",
31
+ "中。": "중요합니다.",
32
+ "中,包含了可用设置项及其简要说明。请查看 wiki 获取更多信息:": "중에는 사용 가능한 설정 옵션과 간단한 설명이 포함되어 있습니다. 자세한 정보는 위키를 확인해주세요.",
33
  "仅供查看": "읽기 전용",
34
  "从Prompt模板中加载": "프롬프트 템플릿에서 불러오기",
35
  "从列表中加载对话": "리스트에서 대화 불러오기",
 
37
  "代理错误,无法获取对话。": "프록시 에러, 대화를 가져올 수 없습니다.",
38
  "你没有权限访问 GPT4,[进一步了解](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)": "GPT-4에 접근 권한이 없습니다. [자세히 알아보기](https://github.com/GaiZhenbiao/ChuanhuChatGPT/issues/843)",
39
  "你没有选择任何对话历史": "대화 기록을 선택하지 않았습니다.",
40
+ "你的": "당신의",
41
  "你真的要删除 ": "정말로 ",
42
+ "你设置了 ": "설정되었습니다.",
43
+ "你选择了不设置 ": "설정을 하지 않았습니다",
44
+ "你选择了不设置用户账户。": "사용자 계정을 설정하지 않았습니다.",
45
  "使用在线搜索": "온라인 검색 사용",
46
  "停止符,用英文逗号隔开...": "여기에 정지 토큰 입력, ','로 구분됨...",
47
  "关于": "관련",
48
+ "关闭": "닫기",
49
  "准备数据集": "데이터셋 준비",
50
  "切换亮暗色主题": "라이트/다크 테마 전환",
51
  "删除对话历史成功": "대화 기록이 성공적으로 삭제되었습니다.",
 
61
  "取消所有任务": "모든 작업 취소",
62
  "可选,用于区分不同的模型": "선택 사항, 다른 모델을 구분하는 데 사용",
63
  "启用的工具:": "활성화된 도구: ",
64
+ "在": "올",
65
  "在工具箱中管理知识库文件": "지식 라이브러리 파일을 도구 상자에서 관리",
66
  "在线搜索": "온라인 검색",
67
  "在这里输入": "여기에 입력하세요",
 
73
  "对话历史": "대화 내역",
74
  "对话历史记录": "대화 기록",
75
  "对话命名方式": "대화 이름 설정",
76
+ "导出为 Markdown": "Markdown으로 내보내기",
77
  "川虎Chat": "Chuanhu Chat",
78
  "川虎Chat 🚀": "Chuanhu Chat 🚀",
79
  "工具箱": "도구 상자",
80
  "已经被删除啦": "이미 삭제되었습니다.",
81
  "开始实时传输回答……": "실시간 응답 출력 시작...",
82
  "开始训练": "훈련 시작",
83
+ "微调": "파인튜닝",
84
  "总结": "요약",
85
  "总结完成": "작업 완료",
86
  "您使用的就是最新版!": "최신 버전을 사용하고 있습니다!",
87
  "您的IP区域:": "당신의 IP 지역: ",
88
  "您的IP区域:未知。": "IP 지역: 알 수 없음.",
89
+ "您输入的 API 密钥为:": "당신이 입력한 API 키는:",
90
+ "找到了缓存的索引文件,加载中……": "캐시된 인덱스 파일을 찾았습니다. 로딩 중...",
91
  "拓展": "확장",
92
  "搜索(支持正则)...": "검색 (정규식 지원)...",
93
  "数据集预览": "데이터셋 미리보기",
94
  "文件ID": "파일 ID",
95
  "新对话 ": "새 대화 ",
96
  "新建对话保留Prompt": "새 대화 생성, 프롬프트 유지하기",
97
+ "是否设置 HTTP 代理?[Y/N]:": "HTTP 프록시를 설정하시겠습니까? [Y/N]: ",
98
+ "是否设置 OpenAI API 密钥?[Y/N]:": "OpenAI API 키를 설정하시겠습니까? [Y/N]:",
99
+ "是否设置用户账户?设置后,用户需要登陆才可访问。输入 Yes(y) 或 No(n),默认No:": "사용자 계정을 설정하시겠습니까? 계정을 설정하면 사용자는 로그인해야만 접속할 수 있습니다. Yes(y) 또는 No(n)을 입력하세요. 기본값은 No입니다:",
100
  "暂时未知": "알 수 없음",
101
  "更新": "업데이트",
102
  "更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "업데이트 실패, [수동 업데이트](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)를 시도하십시오",
103
  "更新成功,请重启本程序": "업데이트 성공, 이 프로그램을 재시작 해주세요",
104
  "未命名对话历史记录": "이름없는 대화 기록",
105
+ "未设置代理...": "프록시가 설정되지 않았습니다...",
106
  "本月使用金额": "이번 달 사용금액",
107
+ "构建索引中……": "인덱스 작성 중...",
108
  "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "[사용 가이드](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) 보기",
109
  "根据日期时间": "날짜 및 시간 기준",
110
  "模型": "LLM 모델",
 
112
  "模型自动总结(消耗tokens)": "모델에 의한 자동 요약 (토큰 소비)",
113
  "模型设置为了:": "설정된 모델: ",
114
  "正在尝试更新...": "업데이트를 시도 중...",
115
+ "正在尝试重启...": "재시작을 시도 중...",
116
+ "正在获取IP地址信息,请稍候...": "IP 주소 정보를 가져오는 중입니다. 잠시만 기다려주세요...",
117
+ "正在进行首次设置,请按照提示进行配置,配置将会被保存在": "첫 설정 중입니다. 안내에 따라 구성하십시오. 설정은 저장됩니다.",
118
+ "没有找到任何支持的文档。": "지원되는 문서를 찾을 수 없습니다.",
119
  "添加训练好的模型到模型列表": "훈련된 모델을 모델 목록에 추가",
120
  "状态": "상태",
121
+ "现在开始设置其他在线模型的API Key": "다른 온라인 모델의 API 키를 설정하세요.",
122
+ "现在开始进行交互式配置。碰到不知道该怎么办的设置项时,请直接按回车键跳过,程序会自动选择合适的默认值。": "인터랙티브 설정이 시작되었습니다. 설정 항목을 모르는 경우 바로 Enter 키를 눌러 기본값을 자동으로 선택합니다.",
123
+ "现在开始进行交互式配置:": "대화형 설정이 시작됩니다:",
124
+ "现在开始进行软件功能设置": "소프트웨어 기능 설정을 시작합니다.",
125
  "生成内容总结中……": "콘텐츠 요약 생성중...",
126
  "用于定位滥用行为": "악용 사례 파악에 활용됨",
127
+ "用户标识符": "사용자 식별자",
128
  "由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)",
129
+ "由于下面的原因,Google 拒绝返回 Gemini 的回答:\\n\\n": "Google이 Gemini의 답변을 반환하는 것을 거부하는 이유에는 다음과 같은 이유가 있습니다:",
130
+ "知识库": "knowledge base",
131
+ "知识库文件": "knowledge base 파일",
132
+ "立即重启": "지금 재시작",
133
  "第一条提问": "첫 번째 질문",
134
+ "索引已保存至本地!": "로컬에 인덱스가 저장되었습니다!",
135
+ "索引构建失败!": "인덱스 빌드 실패했습니다!",
136
  "索引构建完成": "인덱스 구축이 완료되었습니다.",
137
+ "索引构建完成!": "인덱스가 구축되었습니다!",
138
  "网络": "네트워크",
139
  "获取API使用情况失败:": "API 사용량 가져오기 실패:",
140
  "获取IP地理位置失败。原因:": "다음과 같은 이유로 IP 위치를 가져올 수 없습니다. 이유: ",
141
  "获取对话时发生错误,请查看后台日志": "대화를 가져오는 중 에러가 발생했습니다. 백그라운드 로그를 확인하세요",
142
+ "覆盖gradio.oauth /logout路由": "gradio.oauth/logout 경로를 덮어쓰세요.",
143
+ "训练": "학습",
144
+ "训练状态": "학습 상태",
145
+ "训练轮数(Epochs)": "학습 Epochs",
146
  "设置": "설정",
147
  "设置保存文件名": "저장 파일명 설정",
148
+ "设置完成。现在请重启本程序。": "앱 설정이 완료되었습니다. 이제 앱을 다시 시작해주세요.",
149
  "设置文件名: 默认为.json,可选为.md": "파일 이름 설정: 기본값: .json, 선택: .md",
150
  "识别公式": "formula OCR",
151
  "详情": "상세",
152
+ "请先输入用户名,输入空行结束添加用户:": "사용자 이름을 먼저 입력하고 사용자 추가를 완료하려면 빈 줄을 입력하세요:",
153
+ "请先选择Ollama后端模型\\n\\n": "Ollama 후단 모델을 먼저 선택하십시오.",
154
  "请查看 config_example.json,配置 Azure OpenAI": "Azure OpenAI 설정을 확인하세요",
155
  "请检查网络连接,或者API-Key是否有效。": "네트워크 연결 또는 API키가 유효한지 확인하세요",
156
+ "请输入 ": "입력하십시오",
157
+ "请输入 HTTP 代理地址:": "HTTP 프록시 주소를 입력하세요.",
158
+ "请输入 OpenAI API 密钥:": "OpenAI API 키를 입력하십시오:",
159
+ "请输入密码:": "비밀번호를 입력하십시오:",
160
  "请输入对话内容。": "대화 내용을 입력하세요.",
161
+ "请输入有效的文件名,不要包含以下特殊字符:": "유효한 파일 이름을 입력하세요. 다음 특수 문자를 포함하지 마세요: ",
162
  "读取超时,无法获取对话。": "읽기 시간 초과, 대화를 가져올 수 없습니다.",
163
  "账单信息不适用": "청구 정보를 가져올 수 없습니다",
164
+ "跳过设置 HTTP 代理。": "HTTP 프록시 설정을 건너뛰세요.",
165
+ "跳过设置 OpenAI API 密钥。": "OpenAI API 키 설정을 건너뛸까요.",
166
+ "输入 Yes(y) 或 No(n),默认No:": "예(y)나 아니오(n)를 입력하십시오. 기본값은 아니오입니다.",
167
  "连接超时,无法获取对话。": "연결 시간 초과, 대화를 가져올 수 없습니다.",
168
+ "退出用户": "사용자 로그 아웃",
169
  "选择LoRA模型": "LoRA 모델 선택",
170
  "选择Prompt模板集合文件": "프롬프트 콜렉션 파일 선택",
171
  "选择回复语言(针对搜索&索引功能)": "답장 언어 선택 (검색 & 인덱스용)",
172
  "选择数据集": "데이터셋 선택",
173
  "选择模型": "모델 선택",
174
+ "配置已保存在 config.json 中。": "구성은 config.json 파일에 저장되어 있습니다.",
175
+ "释放文件以上传": "파일을 놓아 업로드",
176
  "重命名该对话": "대화 이름 변경",
177
  "重新生成": "재생성",
178
  "高级": "고급",
179
  ",本次对话累计消耗了 ": ",이 대화의 전체 비용은 ",
180
+ ",请使用 .pdf, .docx, .pptx, .epub, .xlsx 等文档。": ".pdf, .docx, .pptx, .epub, .xlsx 등의 문서를 사용해주세요.",
181
+ ",输入空行结束:": "입력하려면 빈 줄을 입력하십시오.",
182
+ ",默认为 ": "기본값:",
183
+ ":": "원하시는 내용이 없습니다.",
184
  "💾 保存对话": "💾 대화 저장",
185
+ "📝 导出为 Markdown": "📝 Markdown으로 내보내기",
186
  "🔄 切换API地址": "🔄 API 주소 변경",
187
  "🔄 刷新": "🔄 새로고침",
188
  "🔄 检查更新...": "🔄 업데이트 확인...",
locale/ru_RU.json CHANGED
@@ -1,4 +1,52 @@
1
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  " 吗?": " ?",
3
  "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ ВНИМАНИЕ: ИЗМЕНЯЙТЕ ОСТОРОЖНО ⚠️",
4
  "**发送消息** 或 **提交key** 以显示额度": "**Отправить сообщение** или **отправить ключ** для отображения лимита",
@@ -13,6 +61,7 @@
13
  "Token 计数: ": "Использованно токенов: ",
14
  "☹️发生了错误:": "☹️ Произошла ошибка:",
15
  "⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ Для обеспечения безопасности API-Key, измените настройки сети в файле конфигурации `config.json`",
 
16
  "。你仍然可以使用聊天功能。": ". Вы все равно можете использовать функцию чата.",
17
  "上传": "Загрузить",
18
  "上传了": "Загрузка завершена.",
@@ -30,6 +79,7 @@
30
  "使用在线搜索": "Использовать онлайн-поиск",
31
  "停止符,用英文逗号隔开...": "Разделительные символы, разделенные запятой...",
32
  "关于": "О программе",
 
33
  "准备数据集": "Подготовка набора данных",
34
  "切换亮暗色主题": "Переключить светлую/темную тему",
35
  "删除对话历史成功": "Успешно удалена история переписки.",
@@ -89,14 +139,17 @@
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
  "网络": "Параметры сети",
@@ -123,6 +176,7 @@
123
  "选择回复语言(针对搜索&索引功能)": "Выберите язык ответа (для функций поиска и индексации)",
124
  "选择数据集": "Выберите набор данных",
125
  "选择模型": "Выберите модель",
 
126
  "重命名该对话": "Переименовать этот диалог",
127
  "重新生成": "Пересоздать",
128
  "高级": "Расширенные настройки",
 
1
  {
2
+ " 中。": "в центре.",
3
+ " 为: ": "Язык:",
4
+ "== API 配置 ==": "== Настройка API ==",
5
+ "== 基础配置 ==": "== Basic settings ==",
6
+ "== 高级配置 ==": "== Advanced settings ==",
7
+ "IP地址信息正在获取中,请稍候...": "Информация об IP-адресе загружается, пожалуйста, подождите...",
8
+ "。": "。",
9
+ "不支持的文件: ": "Неподдерживаемый файл:",
10
+ "中。": "Центр.",
11
+ "中,包含了可用设置项及其简要说明。请查看 wiki 获取更多信息:": "На стороне клиента API, после того как на клиенте будет создан HELP_BASE64_JS событие, нужно отправить идентификатор события на сервер для обработки.",
12
+ "你的": "Your",
13
+ "你设置了 ": "Вы установили.",
14
+ "你选择了不设置 ": "Вы выбрали не устанавливать",
15
+ "你选择了不设置用户账户。": "Вы выбрали не создавать учетную запись пользователя.",
16
+ "在": "в",
17
+ "您输入的 API 密钥为:": "Ваш API ключ:",
18
+ "找到了缓存的索引文件,加载中……": "Индексный файл кэша найден, загрузка…",
19
+ "是否设置 HTTP 代理?[Y/N]:": "Нужно установить HTTP-прокси? [Д/Н]:",
20
+ "是否设置 OpenAI API 密钥?[Y/N]:": "Установить ключ API OpenAI? [Д/Н]:",
21
+ "是否设置用户账户?设置后,用户需要登陆才可访问。输入 Yes(y) 或 No(n),默认No:": "Вы хотите установить учетную запись пользователя? После установки пользователь должен войти в систему, чтобы получить доступ. Введите Да(д) или Нет(н), по умолчанию Нет:",
22
+ "构建索引中……": "Построение индекса…",
23
+ "正在进行首次设置,请按照提示进行配置,配置将会被保存在": "Выполняется первоначальная настройка, следуйте подсказкам для настройки, результаты будут сохранены.",
24
+ "没有找到任何支持的文档。": "Документация не найдена.",
25
+ "现在开始设置其他在线模型的API Key": "Укажите ключ API для других онлайн моделей.",
26
+ "现在开始进行交互式配置。碰到不知道该怎么办的设置项时,请直接按回车键跳过,程序会自动选择合适的默认值。": "Проводится интерактивная настройка. Для пропуска непонятных параметров просто нажмите Enter, программа автоматически выберет соответствующее значение по умолчанию.",
27
+ "现在开始进行交互式配置:": "Теперь начнется интерактивная настройка:",
28
+ "现在开始进行软件功能设置": "Настройка функций программы начата.",
29
+ "由于下面的原因,Google 拒绝返回 Gemini 的回答:\\n\\n": "Из-за указанных причин Google отказывается возвращать ответ от Gemini:",
30
+ "索引已保存至本地!": "Индекс сохранен локально!",
31
+ "索引构建失败!": "Индексация не удалась!",
32
+ "索引构建完成!": "Индекс построен!",
33
+ "覆盖gradio.oauth /logout路由": "Перепишите маршрут gradio.oauth/logout.",
34
+ "设置完成。现在请重启本程序。": "Настройки завершены. Пожалуйста, перезапустите приложение.",
35
+ "请先输入用户名,输入空行结束添加用户:": "Пожалуйста, введите имя пользователя. Для завершения добавления пользователя оставьте строку пустой.",
36
+ "请先选择Ollama后端模型\\n\\n": "Пожалуйста, выберите модель Ollama для бэкэнда.",
37
+ "请输入 ": "Введите",
38
+ "请输入 HTTP 代理地址:": "Введите адрес HTTP-прокси:",
39
+ "请输入 OpenAI API 密钥:": "Введите ключ API OpenAI:",
40
+ "请输入密码:": "Введите пароль:",
41
+ "跳过设置 HTTP 代理。": "Пропустить настройку HTTP-прокси.",
42
+ "跳过设置 OpenAI API 密钥。": "Пропустить настройку ключа API OpenAI.",
43
+ "输入 Yes(y) 或 No(n),默认No:": "Введите Да(д) или Нет(н), по умолчанию Нет:",
44
+ "退出用户": "Пользователь вышел",
45
+ "配置已保存在 config.json 中。": "К��нфигурация сохранена в файле config.json.",
46
+ ",请使用 .pdf, .docx, .pptx, .epub, .xlsx 等文档。": "Пожалуйста, используйте файлы .pdf, .docx, .pptx, .epub, .xlsx и т. д.",
47
+ ",输入空行结束:": "Введите пустую строку, чтобы завершить:",
48
+ ",默认为 ": "По умолчанию",
49
+ ":": ":",
50
  " 吗?": " ?",
51
  "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ ВНИМАНИЕ: ИЗМЕНЯЙТЕ ОСТОРОЖНО ⚠️",
52
  "**发送消息** 或 **提交key** 以显示额度": "**Отправить сообщение** или **отправить ключ** для отображения лимита",
 
61
  "Token 计数: ": "Использованно токенов: ",
62
  "☹️发生了错误:": "☹️ Произошла ошибка:",
63
  "⚠️ 为保证API-Key安全,请在配置文件`config.json`中修改网络设置": "⚠️ Для обеспечения безопасности API-Key, измените настройки сети в файле конфигурации `config.json`",
64
+ "⚠️请先删除知识库中的历史文件,再尝试上传!": "⚠️ Сначала удалите исторические файлы из базы знаний, а затем попробуйте загрузить!",
65
  "。你仍然可以使用聊天功能。": ". Вы все равно можете использовать функцию чата.",
66
  "上传": "Загрузить",
67
  "上传了": "Загрузка завершена.",
 
79
  "使用在线搜索": "Использовать онлайн-поиск",
80
  "停止符,用英文逗号隔开...": "Разделительные символы, разделенные запятой...",
81
  "关于": "О программе",
82
+ "关闭": "Закрыть",
83
  "准备数据集": "Подготовка набора данных",
84
  "切换亮暗色主题": "Переключить светлую/темную тему",
85
  "删除对话历史成功": "Успешно удалена история переписки.",
 
139
  "模型自动总结(消耗tokens)": "Автоматическое подведение итогов модели (потребление токенов)",
140
  "模型设置为了:": "Модель настроена на:",
141
  "正在尝试更新...": "Попытка обновления...",
142
+ "正在尝试重启...": "Попытка перезапуска...",
143
+ "正在获取IP地址信息,请稍候...": "Получение информации об IP-адресе, пожалуйста, подождите...",
144
  "添加训练好的模型到模型列表": "Добавить обученную модель в список моделей",
145
  "状态": "Статус",
146
  "生成内容总结中……": "Создание сводки контента...",
147
  "用于定位滥用行为": "Используется для выявления злоупотреблений",
148
+ "用户标识符": "Идентификатор пользователя",
149
  "由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, чтобы загрузить последнюю версию скрипта",
150
  "知识库": "База знаний",
151
  "知识库文件": "Файл базы знаний",
152
+ "立即重启": "Перезапустить сейчас",
153
  "第一条提问": "Первый вопрос",
154
  "索引构建完成": "Индексирование завершено.",
155
  "网络": "Параметры сети",
 
176
  "选择回复语言(针对搜索&索引功能)": "Выберите язык ответа (для функций поиска и индексации)",
177
  "选择数据集": "Выберите набор данных",
178
  "选择模型": "Выберите модель",
179
+ "释放文件以上传": "Отпустите файл для загрузки",
180
  "重命名该对话": "Переименовать этот диалог",
181
  "重新生成": "Пересоздать",
182
  "高级": "Расширенные настройки",
locale/sv_SE.json CHANGED
@@ -1,4 +1,6 @@
1
  {
 
 
2
  " 吗?": " ?",
3
  "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Var försiktig med ändringar. ⚠️",
4
  "**发送消息** 或 **提交key** 以显示额度": "**Skicka meddelande** eller **Skicka in nyckel** för att visa kredit",
@@ -6,19 +8,28 @@
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",
@@ -26,10 +37,15 @@
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.",
@@ -45,6 +61,7 @@
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",
@@ -69,12 +86,17 @@
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/使用教程#手动更新)",
@@ -82,6 +104,7 @@
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",
@@ -89,44 +112,75 @@
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",
 
1
  {
2
+ " 中。": "Mitten.",
3
+ " 为: ": "För:",
4
  " 吗?": " ?",
5
  "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Var försiktig med ändringar. ⚠️",
6
  "**发送消息** 或 **提交key** 以显示额度": "**Skicka meddelande** eller **Skicka in nyckel** för att visa kredit",
 
8
  "**获取API使用情况失败**": "**Misslyckades med att hämta API-användning**",
9
  "**获取API使用情况失败**,sensitive_id错误或已过期": "**Misslyckades med att hämta API-användning**, felaktig eller utgången sensitive_id",
10
  "**获取API使用情况失败**,需在填写`config.json`中正确填写sensitive_id": "**Misslyckades med att hämta API-användning**, korrekt sensitive_id behövs i `config.json`",
11
+ "== API 配置 ==": "== API-inställningar ==",
12
+ "== 基础配置 ==": "== Grundläggande konfiguration ==",
13
+ "== 高级配置 ==": "== Avancerade inställningar ==",
14
  "API key为空,请检查是否输入正确。": "API-nyckeln är tom, kontrollera om den är korrekt inmatad.",
15
  "API密钥更改为了": "API-nyckeln har ändrats till",
16
+ "IP地址信息正在获取中,请稍候...": "IP-adressinformation hämtas, vänligen vänta...",
17
  "JSON解析错误,收到的内容: ": "JSON-tolkningsfel, mottaget innehåll: ",
18
  "SSL错误,无法获取对话。": "SSL-fel, kunde inte hämta dialogen.",
19
  "Token 计数: ": "Tokenräkning: ",
20
  "☹️发生了错误:": "☹️Fel: ",
21
  "⚠️ 为保证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`.",
22
+ "⚠️请先删除知识库中的历史文件,再尝试上传!": "⚠️ Ta bort historikfilen i kunskapsbanken innan du försöker ladda upp!",
23
+ "。": "。",
24
  "。你仍然可以使用聊天功能。": ". Du kan fortfarande använda chattfunktionen.",
25
  "上传": "Ladda upp",
26
  "上传了": "Uppladdad",
27
  "上传到 OpenAI 后自动填充": "Automatiskt ifylld efter uppladdning till OpenAI",
28
  "上传到OpenAI": "Ladda upp till OpenAI",
29
  "上传文件": "ladda upp fil",
30
+ "不支持的文件: ": "Ogiltig fil:",
31
+ "中。": "Mellan.",
32
+ "中,包含了可用设置项及其简要说明。请查看 wiki 获取更多信息:": "I, innehåller tillgängliga inställningsalternativ och deras korta beskrivningar. Besök wikin för mer information:",
33
  "仅供查看": "Endast för visning",
34
  "从Prompt模板中加载": "Ladda från Prompt-mall",
35
  "从列表中加载对话": "Ladda dialog från lista",
 
37
  "代理错误,无法获取对话。": "Proxyfel, kunde inte hämta dialogen.",
38
  "你没有权限访问 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)",
39
  "你没有选择任何对话历史": "Du har inte valt någon konversationshistorik.",
40
+ "你的": "Din",
41
  "你真的要删除 ": "Är du säker på att du vill ta bort ",
42
+ "你设置了 ": "Du har ställt in.",
43
+ "你选择了不设置 ": "Du har valt att inte ställa in",
44
+ "你选择了不设置用户账户。": "Du har valt att inte skapa ett användarkonto.",
45
  "使用在线搜索": "Använd online-sökning",
46
  "停止符,用英文逗号隔开...": "Skriv in stopptecken här, separerade med kommatecken...",
47
  "关于": "om",
48
+ "关闭": "Stäng",
49
  "准备数据集": "Förbered dataset",
50
  "切换亮暗色主题": "Byt ljus/mörk tema",
51
  "删除对话历史成功": "Raderade konversationens historik.",
 
61
  "取消所有任务": "Avbryt alla uppgifter",
62
  "可选,用于区分不同的模型": "Valfritt, används för att särskilja olika modeller",
63
  "启用的工具:": "Aktiverade verktyg: ",
64
+ "在": "på",
65
  "在工具箱中管理知识库文件": "hantera kunskapsbankfiler i verktygslådan",
66
  "在线搜索": "onlinesökning",
67
  "在这里输入": "Skriv in här",
 
86
  "您使用的就是最新版!": "Du använder den senaste versionen!",
87
  "您的IP区域:": "Din IP-region: ",
88
  "您的IP区域:未知。": "Din IP-region: Okänd.",
89
+ "您输入的 API 密钥为:": "Den API-nyckel du angav är:",
90
+ "找到了缓存的索引文件,加载中……": "Hittade cachefilens index, laddar...",
91
  "拓展": "utvidgning",
92
  "搜索(支持正则)...": "Sök (stöd för reguljära uttryck)...",
93
  "数据集预览": "Datasetförhandsvisning",
94
  "文件ID": "Fil-ID",
95
  "新对话 ": "Ny dialog ",
96
  "新建对话保留Prompt": "Skapa ny konversation med bevarad Prompt",
97
+ "是否设置 HTTP 代理?[Y/N]:": "Vill du ställa in en HTTP-proxy? [J/N]:",
98
+ "是否设置 OpenAI API 密钥?[Y/N]:": "Har du ställt in OpenAI API-nyckeln? [J/N]:",
99
+ "是否设置用户账户?设置后,��户需要登陆才可访问。输入 Yes(y) 或 No(n),默认No:": "Vill du skapa ett användarkonto? Användaren måste logga in för att få åtkomst. Ange Ja(j) eller Nej(n), standard är Nej:",
100
  "暂时未知": "Okänd",
101
  "更新": "Uppdatera",
102
  "更新失败,请尝试[手动更新](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)": "Uppdateringen misslyckades, prova att [uppdatera manuellt](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新)",
 
104
  "未命名对话历史记录": "Onämnd Dialoghistorik",
105
  "未设置代理...": "Inte inställd proxy...",
106
  "本月使用金额": "Månadens användning",
107
+ "构建索引中……": "Bygger index ...",
108
  "查看[使用介绍](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35)": "Se [användarguiden](https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#微调-gpt-35) för mer information",
109
  "根据日期时间": "Enligt datum och tid",
110
  "模型": "Modell",
 
112
  "模型自动总结(消耗tokens)": "Modellens automatiska sammanfattning (förbrukar tokens)",
113
  "模型设置为了:": "Modellen är inställd på: ",
114
  "正在尝试更新...": "Försöker uppdatera...",
115
+ "正在尝试重启...": "Försöker starta om...",
116
+ "正在获取IP地址信息,请稍候...": "Hämtar IP-adressinformation, vänta...",
117
+ "正在进行首次设置,请按照提示进行配置,配置将会被保存在": "Du håller på med första inställningen, följ anvisningarna för att konfigurera. Konfigurationen sparas i",
118
+ "没有找到任何支持的文档。": "Inga supportdokument hittades.",
119
  "添加训练好的模型到模型列表": "Lägg till tränad modell i modellistan",
120
  "状态": "Status",
121
+ "现在开始设置其他在线模型的API Key": "Nu börja ställa in API-nyckeln för andra online-modeller.",
122
+ "现在开始进行交互式配置。碰到不知道该怎么办的设置项时,请直接按回车键跳过,程序会自动选择合适的默认值。": "Interaktiv konfiguration påbörjas nu. Om du stöter på en inställning som du inte vet hur du ska hantera, tryck bara på Retur-tangenten för att hoppa över den. Programmet kommer automatiskt välja lämpligt standardvärde.",
123
+ "现在开始进行交互式配置:": "Interaktiv konfiguration påbörjas nu:",
124
+ "现在开始进行软件功能设置": "Nu börjar du konfigurera programfunktionaliteten.",
125
  "生成内容总结中……": "Genererar innehållssammanfattning...",
126
  "用于定位滥用行为": "Används för att lokalisera missbruk",
127
+ "用户标识符": "Användar-ID",
128
  "由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)",
129
+ "由于下面的原因,Google 拒绝返回 Gemini 的回答:\\n\\n": "Google vägrar att returnera Gemini's svar av följande skäl:",
130
  "知识库": "kunskapsbank",
131
  "知识库文件": "kunskapsbankfil",
132
+ "立即重启": "Starta om nu",
133
  "第一条提问": "Första frågan",
134
+ "索引已保存至本地!": "Index har sparats lokalt!",
135
+ "索引构建失败!": "Indexeringen misslyckades!",
136
  "索引构建完成": "Indexet har blivit byggt färdigt.",
137
+ "索引构建完成!": "Indexeringen är klar!",
138
  "网络": "nätverksparametrar",
139
  "获取API使用情况失败:": "Misslyckades med att hämta API-användning:",
140
  "获取IP地理位置失败。原因:": "Misslyckades med att hämta IP-plats. Orsak: ",
141
  "获取对话时发生错误,请查看后台日志": "Ett fel uppstod när dialogen hämtades, kontrollera bakgrundsloggen",
142
+ "覆盖gradio.oauth /logout路由": "Ersätt 'gradio.oauth/logout'-rutten.",
143
  "训练": "träning",
144
  "训练状态": "Träningsstatus",
145
  "训练轮数(Epochs)": "Träningsomgångar (Epochs)",
146
  "设置": "inställningar",
147
  "设置保存文件名": "Ställ in sparfilnamn",
148
+ "设置完成。现在请重启本程序。": "Inställningarna är klara. Vänligen starta om programmet nu.",
149
  "设置文件名: 默认为.json,可选为.md": "Ställ in filnamn: standard är .json, valfritt är .md",
150
  "识别公式": "Formel OCR",
151
  "详情": "Detaljer",
152
+ "请先输入用户名,输入空行结束添加用户:": "Var god och ange användarnamn, lägg till användare genom att trycka på Enter när du är klar:",
153
+ "请先选择Ollama后端模型\\n\\n": "Vänligen välj först Ollama backend-modellen.",
154
  "请查看 config_example.json,配置 Azure OpenAI": "Vänligen granska config_example.json för att konfigurera Azure OpenAI",
155
  "请检查网络连接,或者API-Key是否有效。": "Kontrollera nätverksanslutningen eller om API-nyckeln är giltig.",
156
+ "请输入 ": "Ange texten.",
157
+ "请输入 HTTP 代理地址:": "Ange HTTP-proxyadressen:",
158
+ "请输入 OpenAI API 密钥:": "Ange OpenAI API-nyckel:",
159
+ "请输入密码:": "Ange lösenord:",
160
  "请输入对话内容。": "Ange dialoginnehåll.",
161
  "请输入有效的文件名,不要包含以下特殊字符:": "Ange ett giltigt filnamn, använd inte följande specialtecken: ",
162
  "读取超时,无法获取对话。": "Läsningen tog för lång tid, kunde inte hämta dialogen.",
163
  "账单信息不适用": "Faktureringsinformation är inte tillämplig",
164
+ "跳过设置 HTTP 代理。": "Hoppa över inställning av HTTP-proxy.",
165
+ "跳过设置 OpenAI API 密钥。": "Hoppa över att ange OpenAI API-nyckel.",
166
+ "输入 Yes(y) 或 No(n),默认No:": "Ange Ja(j) eller Nej(n), standard är Nej:",
167
  "连接超时,无法获取对话。": "Anslutningen tog för lång tid, kunde inte hämta dialogen.",
168
+ "退出用户": "Logga ut användaren",
169
  "选择LoRA模型": "Välj LoRA Modell",
170
  "选择Prompt模板集合文件": "Välj Prompt-mall Samlingsfil",
171
  "选择回复语言(针对搜索&索引功能)": "Välj svarspråk (för sök- och indexfunktion)",
172
  "选择数据集": "Välj dataset",
173
  "选择模型": "Välj Modell",
174
+ "配置已保存在 config.json 中。": "Inställningarna har sparats i config.json.",
175
+ "释放文件以上传": "Släpp filen för att ladda upp",
176
  "重命名该对话": "Byt namn på dialogen",
177
  "重新生成": "Återgenerera",
178
  "高级": "Avancerat",
179
  ",本次对话累计消耗了 ": ", Total kostnad för denna dialog är ",
180
+ ",请使用 .pdf, .docx, .pptx, .epub, .xlsx 等文档。": "Använd .pdf, .docx, .pptx, .epub, .xlsx eller liknande dokument.",
181
+ ",输入空行结束:": ",Ange en tom rad för att avsluta:",
182
+ ",默认为 ": "Standardinställning.",
183
+ ":": ":",
184
  "💾 保存对话": "💾 Spara Dialog",
185
  "📝 导出为 Markdown": "📝 Exportera som Markdown",
186
  "🔄 切换API地址": "🔄 Byt API-adress",
locale/vi_VN.json CHANGED
@@ -1,4 +1,52 @@
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ư",
@@ -13,6 +61,7 @@
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.",
@@ -30,6 +79,7 @@
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.",
@@ -89,14 +139,17 @@
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",
@@ -123,6 +176,7 @@
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",
 
1
  {
2
+ " 中。": "Giữa.",
3
+ " 为: ": "Cho:",
4
+ "== API 配置 ==": "== Cấu hình API ==",
5
+ "== 基础配置 ==": "== Cấu hình cơ bản ==",
6
+ "== 高级配置 ==": "== Cấu hình Nâng cao ==",
7
+ "IP地址信息正在获取中,请稍候...": "Đang lấy thông tin địa chỉ IP, vui lòng chờ...",
8
+ "。": "。",
9
+ "不支持的文件: ": "Tệp không được hỗ trợ:",
10
+ "中。": "Trong.",
11
+ "中,包含了可用设置项及其简要说明。请查看 wiki 获取更多信息:": "Trong đó chứa các mục cài đặt có sẵn và mô tả ngắn gọn của chúng. Vui lòng xem wiki để biết thêm thông tin:",
12
+ "你的": "Tôi không hiểu.",
13
+ "你设置了 ": "Bạn đã thiết lập了",
14
+ "你选择了不设置 ": "Bạn đã chọn không thiết lập",
15
+ "你选择了不设置用户账户。": "Bạn đã chọn không thiết lập tài khoản người dùng.",
16
+ "在": "trong",
17
+ "您输入的 API 密钥为:": "Khóa API bạn đã nhập là:",
18
+ "找到了缓存的索引文件,加载中……": "Tìm thấy tập tin chỉ mục của bộ nhớ cache, đang tải...",
19
+ "是否设置 HTTP 代理?[Y/N]:": "Bạn có muốn thiết lập proxy HTTP không? [C/K]:",
20
+ "是否设置 OpenAI API 密钥?[Y/N]:": "Bạn có muốn cài đặt mã khóa API của OpenAI không? [Y/N]:",
21
+ "是否设置用户账户?设置后,用户需要登陆才可访问。输入 Yes(y) 或 No(n),默认No:": "Bạn có muốn thiết lập tài khoản người dùng không? Sau khi thiết lập, người dùng cần đăng nhập để truy cập. Nhập Yes(y) hoặc No(n), mặc định là No:",
22
+ "构建索引中……": "Xây dựng chỉ mục...",
23
+ "正在进行首次设置,请按照提示进行配置,配置将会被保存在": "Đang thiết lập lần đầu, vui lòng làm theo hướng dẫn để cấu hình, cài đặt sẽ được lưu vào",
24
+ "没有找到任何支持的文档。": "Không tìm thấy tài liệu hỗ trợ nào.",
25
+ "现在开始设置其他在线模型的API Key": "Bây giờ bắt đầu thiết lập API Key cho các mô hình trực tuyến khác",
26
+ "现在开始进行交互式配置。碰到不知道该怎么办的设置项时,请直接按回车键跳过,程序会自动选择合适的默认值。": "Bắt đầu cấu hình tương tác ngay bây giờ. Khi gặp các mục cài đặt không biết phải làm gì, hãy nhấn Enter để bỏ qua, chương trình sẽ tự động chọn giá trị mặc định phù hợp.",
27
+ "现在开始进行交互式配置:": "Bắt đầu cấu hình tương tác ngay bây giờ:",
28
+ "现在开始进行软件功能设置": "Bắt đầu cài đặt chức năng phần mềm ngay bây giờ.",
29
+ "由于下面的原因,Google 拒绝返回 Gemini 的回答:\\n\\n": "Vì lý do dưới đây, Google từ chối trả lời của Gemini:",
30
+ "索引已保存至本地!": "Chỉ số đã được lưu cục bộ!",
31
+ "索引构建失败!": "Xây dựng chỉ mục thất bại!",
32
+ "索引构建完成!": "Xây dựng chỉ mục đã hoàn thành!",
33
+ "覆盖gradio.oauth /logout路由": "Ghi đè tuyến đường gradio.oauth / logout.",
34
+ "设置完成。现在请重启本程序。": "Đã thiết lập xong. Vui lòng khởi động lại chương trình này.",
35
+ "请先输入用户名,输入空行结束添加用户:": "Vui lòng nhập tên người dùng trước, nhấn Enter để kết thúc thêm người dùng:",
36
+ "请先选择Ollama后端模型\\n\\n": "Vui lòng chọn mô hình backend của Ollama trước\\n",
37
+ "请输入 ": "Vui lòng nhập.",
38
+ "请输入 HTTP 代理地址:": "Nhập địa chỉ proxy HTTP:",
39
+ "请输入 OpenAI API 密钥:": "Nhập khóa API của OpenAI:",
40
+ "请输入密码:": "Nhập mật khẩu:",
41
+ "跳过设置 HTTP 代理。": "Bỏ qua cài đặt proxy HTTP.",
42
+ "跳过设置 OpenAI API 密钥。": "Bỏ qua cài đặt mã API của OpenAI.",
43
+ "输入 Yes(y) 或 No(n),默认No:": "Nhập Yes(y) hoặc No(n), mặc định là No:",
44
+ "退出用户": "Đăng xuất",
45
+ "配置已保存在 config.json 中。": "Cấu hình đã được lưu trong tệp config.json.",
46
+ ",请使用 .pdf, .docx, .pptx, .epub, .xlsx 等文档。": "Vui lòng sử dụng các tệp .pdf, .docx, .pptx, .epub, .xlsx và các loại tài liệu khác.",
47
+ ",输入空行结束:": "Vui lòng nhập vào một dòng trống để kết thúc:",
48
+ ",默认为 ": "Mặc định là",
49
+ ":": ":Xin chào! Bạn cần giúp đỡ với điều gì?",
50
  " 吗?": " ?",
51
  "# ⚠️ 务必谨慎更改 ⚠️": "# ⚠️ Lưu ý: Thay đổi yêu cầu cẩn thận. ⚠️",
52
  "**发送消息** 或 **提交key** 以显示额度": "**Gửi tin nhắn** hoặc **Gửi khóa(key)** để hiển thị số dư",
 
61
  "Token 计数: ": "Số lượng Token: ",
62
  "☹️发生了错误:": "☹️Lỗi: ",
63
  "⚠️ 为保证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`.",
64
+ "⚠️请先删除知识库中的历史文件,再尝试上传!": "⚠️ Vui lòng xóa tệp lịch sử trong cơ sở kiến thức trước khi tải lên!",
65
  "。你仍然可以使用聊天功能。": ". Bạn vẫn có thể sử dụng chức năng trò chuyện.",
66
  "上传": "Tải lên",
67
  "上传了": "Tải lên thành công.",
 
79
  "使用在线搜索": "Sử dụng tìm kiếm trực tuyến",
80
  "停止符,用英文逗号隔开...": "Nhập dấu dừng, cách nhau bằng dấu phẩy...",
81
  "关于": "Về",
82
+ "关闭": "Đóng",
83
  "准备数据集": "Chuẩn bị tập dữ liệu",
84
  "切换亮暗色主题": "Chuyển đổi chủ đề sáng/tối",
85
  "删除对话历史成功": "Xóa lịch sử cuộc trò chuyện thành công.",
 
139
  "模型自动总结(消耗tokens)": "Tự động tóm tắt bằng LLM (Tiêu thụ token)",
140
  "模型设置为了:": "Mô hình đã được đặt thành: ",
141
  "正在尝试更新...": "Đang cố gắng cập nhật...",
142
+ "正在尝试重启...": "Đang cố gắng khởi động lại...",
143
+ "正在获取IP地址信息,请稍候...": "Đang lấy thông tin địa chỉ IP, vui lòng đợi...",
144
  "添加训练好的模型到模型列表": "Thêm mô hình đã đào tạo vào danh sách mô hình",
145
  "状态": "Tình trạng",
146
  "生成内容总结中……": "Đang tạo tóm tắt nội dung...",
147
  "用于定位滥用行为": "Sử dụng để xác định hành vi lạm dụng",
148
+ "用户标识符": "Định danh người dùng",
149
  "由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)",
150
  "知识库": "Cơ sở kiến thức",
151
  "知识库文件": "Tệp cơ sở kiến thức",
152
+ "立即重启": "Khởi động lại ngay",
153
  "第一条提问": "Theo câu hỏi đầu tiên",
154
  "索引构建完成": "Xây dựng chỉ mục hoàn tất",
155
  "网络": "Mạng",
 
176
  "选择回复语言(针对搜索&索引功能)": "Chọn ngôn ngữ phản hồi (đối với chức năng tìm kiếm & chỉ mục)",
177
  "选择数据集": "Chọn tập dữ liệu",
178
  "选择模型": "Chọn Mô hình",
179
+ "释放文件以上传": "Thả tệp để tải lên",
180
  "重命名该对话": "Đổi tên cuộc trò chuyện này",
181
  "重新生成": "Tạo lại",
182
  "高级": "Nâng cao",
modules/.DS_Store CHANGED
Binary files a/modules/.DS_Store and b/modules/.DS_Store differ
 
modules/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (150 Bytes). View file
 
modules/__pycache__/__init__.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/__init__.cpython-311.pyc and b/modules/__pycache__/__init__.cpython-311.pyc differ
 
modules/__pycache__/config.cpython-310.pyc ADDED
Binary file (6.93 kB). View file
 
modules/__pycache__/config.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/config.cpython-311.pyc and b/modules/__pycache__/config.cpython-311.pyc differ
 
modules/__pycache__/gradio_patch.cpython-311.pyc ADDED
Binary file (7.29 kB). View file
 
modules/__pycache__/index_func.cpython-310.pyc ADDED
Binary file (4.24 kB). View file
 
modules/__pycache__/index_func.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/index_func.cpython-311.pyc and b/modules/__pycache__/index_func.cpython-311.pyc differ
 
modules/__pycache__/overwrites.cpython-310.pyc ADDED
Binary file (3.42 kB). View file
 
modules/__pycache__/overwrites.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/overwrites.cpython-311.pyc and b/modules/__pycache__/overwrites.cpython-311.pyc differ
 
modules/__pycache__/pdf_func.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/pdf_func.cpython-311.pyc and b/modules/__pycache__/pdf_func.cpython-311.pyc differ
 
modules/__pycache__/presets.cpython-310.pyc ADDED
Binary file (7.9 kB). View file
 
modules/__pycache__/presets.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/presets.cpython-311.pyc and b/modules/__pycache__/presets.cpython-311.pyc differ
 
modules/__pycache__/repo.cpython-310.pyc ADDED
Binary file (8.28 kB). View file
 
modules/__pycache__/repo.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/repo.cpython-311.pyc and b/modules/__pycache__/repo.cpython-311.pyc differ
 
modules/__pycache__/shared.cpython-310.pyc ADDED
Binary file (2.63 kB). View file
 
modules/__pycache__/shared.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/shared.cpython-311.pyc and b/modules/__pycache__/shared.cpython-311.pyc differ
 
modules/__pycache__/train_func.cpython-310.pyc ADDED
Binary file (6.1 kB). View file
 
modules/__pycache__/train_func.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/train_func.cpython-311.pyc and b/modules/__pycache__/train_func.cpython-311.pyc differ
 
modules/__pycache__/utils.cpython-310.pyc ADDED
Binary file (41.1 kB). View file
 
modules/__pycache__/utils.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/utils.cpython-311.pyc and b/modules/__pycache__/utils.cpython-311.pyc differ
 
modules/__pycache__/webui.cpython-310.pyc ADDED
Binary file (3.87 kB). View file
 
modules/__pycache__/webui.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/webui.cpython-311.pyc and b/modules/__pycache__/webui.cpython-311.pyc differ
 
modules/__pycache__/webui_locale.cpython-310.pyc ADDED
Binary file (2.27 kB). View file
 
modules/__pycache__/webui_locale.cpython-311.pyc CHANGED
Binary files a/modules/__pycache__/webui_locale.cpython-311.pyc and b/modules/__pycache__/webui_locale.cpython-311.pyc differ
 
modules/config.py CHANGED
@@ -4,6 +4,7 @@ import os
4
  import logging
5
  import sys
6
  import commentjson as json
 
7
 
8
  from . import shared
9
  from . import presets
@@ -23,12 +24,14 @@ __all__ = [
23
  "server_name",
24
  "server_port",
25
  "share",
 
26
  "check_update",
27
  "latex_delimiters_set",
28
  "hide_history_when_not_logged_in",
29
  "default_chuanhu_assistant_model",
30
  "show_api_billing",
31
  "chat_name_method_index",
 
32
  ]
33
 
34
  # 添加一个统一的config文件,避免文件过多造成的疑惑(优先级最低)
@@ -103,10 +106,19 @@ if "extra_models" in config:
103
  presets.MODELS.extend(config["extra_models"])
104
  logging.info(f"已添加额外的模型:{config['extra_models']}")
105
 
106
- google_palm_api_key = config.get("google_palm_api_key", "")
107
- google_palm_api_key = os.environ.get(
108
- "GOOGLE_PALM_API_KEY", google_palm_api_key)
109
- os.environ["GOOGLE_PALM_API_KEY"] = google_palm_api_key
 
 
 
 
 
 
 
 
 
110
 
111
  xmchat_api_key = config.get("xmchat_api_key", "")
112
  os.environ["XMCHAT_API_KEY"] = xmchat_api_key
@@ -140,6 +152,9 @@ os.environ["ERNIE_APIKEY"] = ernie_api_key
140
  ernie_secret_key = config.get("ernie_secret_key", "")
141
  os.environ["ERNIE_SECRETKEY"] = ernie_secret_key
142
 
 
 
 
143
  load_config_to_environ(["openai_api_type", "azure_openai_api_key", "azure_openai_api_base_url",
144
  "azure_openai_api_version", "azure_deployment_name", "azure_embedding_deployment_name", "azure_embedding_model_name"])
145
 
@@ -163,7 +178,7 @@ api_host = os.environ.get(
163
  "OPENAI_API_BASE", config.get("openai_api_base", None))
164
  if api_host is not None:
165
  shared.state.set_api_host(api_host)
166
- os.environ["OPENAI_API_BASE"] = f"{api_host}/v1"
167
  logging.info(f"OpenAI API Base set to: {os.environ['OPENAI_API_BASE']}")
168
 
169
  default_chuanhu_assistant_model = config.get(
@@ -284,13 +299,18 @@ if server_port is None:
284
  assert server_port is None or type(server_port) == int, "要求port设置为int类型"
285
 
286
  # 设置默认model
287
- default_model = config.get("default_model", "")
288
  try:
289
- presets.DEFAULT_MODEL = presets.MODELS.index(default_model)
 
 
 
 
290
  except ValueError:
291
- pass
292
 
293
  share = config.get("share", False)
 
294
 
295
  # avatar
296
  bot_avatar = config.get("bot_avatar", "default")
 
4
  import logging
5
  import sys
6
  import commentjson as json
7
+ import colorama
8
 
9
  from . import shared
10
  from . import presets
 
24
  "server_name",
25
  "server_port",
26
  "share",
27
+ "autobrowser",
28
  "check_update",
29
  "latex_delimiters_set",
30
  "hide_history_when_not_logged_in",
31
  "default_chuanhu_assistant_model",
32
  "show_api_billing",
33
  "chat_name_method_index",
34
+ "HIDE_MY_KEY",
35
  ]
36
 
37
  # 添加一个统一的config文件,避免文件过多造成的疑惑(优先级最低)
 
106
  presets.MODELS.extend(config["extra_models"])
107
  logging.info(f"已添加额外的模型:{config['extra_models']}")
108
 
109
+ HIDE_MY_KEY = config.get("hide_my_key", False)
110
+
111
+ google_genai_api_key = os.environ.get(
112
+ "GOOGLE_PALM_API_KEY", "")
113
+ google_genai_api_key = os.environ.get(
114
+ "GOOGLE_GENAI_API_KEY", "")
115
+ google_genai_api_key = config.get("google_palm_api_key", google_genai_api_key)
116
+ google_genai_api_key = config.get("google_genai_api_key", google_genai_api_key)
117
+ os.environ["GOOGLE_GENAI_API_KEY"] = google_genai_api_key
118
+
119
+ huggingface_auth_token = os.environ.get("HF_AUTH_TOKEN", "")
120
+ huggingface_auth_token = config.get("hf_auth_token", huggingface_auth_token)
121
+ os.environ["HF_AUTH_TOKEN"] = huggingface_auth_token
122
 
123
  xmchat_api_key = config.get("xmchat_api_key", "")
124
  os.environ["XMCHAT_API_KEY"] = xmchat_api_key
 
152
  ernie_secret_key = config.get("ernie_secret_key", "")
153
  os.environ["ERNIE_SECRETKEY"] = ernie_secret_key
154
 
155
+ ollama_host = config.get("ollama_host", "")
156
+ os.environ["OLLAMA_HOST"] = ollama_host
157
+
158
  load_config_to_environ(["openai_api_type", "azure_openai_api_key", "azure_openai_api_base_url",
159
  "azure_openai_api_version", "azure_deployment_name", "azure_embedding_deployment_name", "azure_embedding_model_name"])
160
 
 
178
  "OPENAI_API_BASE", config.get("openai_api_base", None))
179
  if api_host is not None:
180
  shared.state.set_api_host(api_host)
181
+ # os.environ["OPENAI_API_BASE"] = f"{api_host}/v1"
182
  logging.info(f"OpenAI API Base set to: {os.environ['OPENAI_API_BASE']}")
183
 
184
  default_chuanhu_assistant_model = config.get(
 
299
  assert server_port is None or type(server_port) == int, "要求port设置为int类型"
300
 
301
  # 设置默认model
302
+ default_model = config.get("default_model", "GPT3.5 Turbo")
303
  try:
304
+ if default_model in presets.MODELS:
305
+ presets.DEFAULT_MODEL = presets.MODELS.index(default_model)
306
+ else:
307
+ presets.DEFAULT_MODEL = presets.MODELS.index(next((k for k, v in presets.MODEL_METADATA.items() if v.get("model_name") == default_model), None))
308
+ logging.info("默认模型设置为了:" + str(presets.MODELS[presets.DEFAULT_MODEL]))
309
  except ValueError:
310
+ logging.error("你填写的默认模型" + default_model + "不存在!请从下面的列表中挑一个填写:" + str(presets.MODELS))
311
 
312
  share = config.get("share", False)
313
+ autobrowser = config.get("autobrowser", True)
314
 
315
  # avatar
316
  bot_avatar = config.get("bot_avatar", "default")
modules/gradio_patch.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import os
3
+
4
+ import fastapi
5
+ import gradio
6
+ from fastapi.responses import RedirectResponse
7
+ from gradio.oauth import MOCKED_OAUTH_TOKEN
8
+
9
+ from modules.presets import i18n
10
+
11
+ OAUTH_CLIENT_ID = os.environ.get("OAUTH_CLIENT_ID")
12
+ OAUTH_CLIENT_SECRET = os.environ.get("OAUTH_CLIENT_SECRET")
13
+ OAUTH_SCOPES = os.environ.get("OAUTH_SCOPES")
14
+ OPENID_PROVIDER_URL = os.environ.get("OPENID_PROVIDER_URL")
15
+ def _add_oauth_routes(app: fastapi.FastAPI) -> None:
16
+ """Add OAuth routes to the FastAPI app (login, callback handler and logout)."""
17
+ try:
18
+ from authlib.integrations.starlette_client import OAuth
19
+ except ImportError as e:
20
+ raise ImportError(
21
+ "Cannot initialize OAuth to due a missing library. Please run `pip install gradio[oauth]` or add "
22
+ "`gradio[oauth]` to your requirements.txt file in order to install the required dependencies."
23
+ ) from e
24
+
25
+ # Check environment variables
26
+ msg = (
27
+ "OAuth is required but {} environment variable is not set. Make sure you've enabled OAuth in your Space by"
28
+ " setting `hf_oauth: true` in the Space metadata."
29
+ )
30
+ if OAUTH_CLIENT_ID is None:
31
+ raise ValueError(msg.format("OAUTH_CLIENT_ID"))
32
+ if OAUTH_CLIENT_SECRET is None:
33
+ raise ValueError(msg.format("OAUTH_CLIENT_SECRET"))
34
+ if OAUTH_SCOPES is None:
35
+ raise ValueError(msg.format("OAUTH_SCOPES"))
36
+ if OPENID_PROVIDER_URL is None:
37
+ raise ValueError(msg.format("OPENID_PROVIDER_URL"))
38
+
39
+ # Register OAuth server
40
+ oauth = OAuth()
41
+ oauth.register(
42
+ name="huggingface",
43
+ client_id=OAUTH_CLIENT_ID,
44
+ client_secret=OAUTH_CLIENT_SECRET,
45
+ client_kwargs={"scope": OAUTH_SCOPES},
46
+ server_metadata_url=OPENID_PROVIDER_URL + "/.well-known/openid-configuration",
47
+ )
48
+
49
+ # Define OAuth routes
50
+ @app.get("/login/huggingface")
51
+ async def oauth_login(request: fastapi.Request):
52
+ """Endpoint that redirects to HF OAuth page."""
53
+ redirect_uri = str(request.url_for("oauth_redirect_callback"))
54
+ if ".hf.space" in redirect_uri:
55
+ # In Space, FastAPI redirect as http but we want https
56
+ redirect_uri = redirect_uri.replace("http://", "https://")
57
+ return await oauth.huggingface.authorize_redirect(request, redirect_uri)
58
+
59
+ @app.get("/login/callback")
60
+ async def oauth_redirect_callback(request: fastapi.Request) -> RedirectResponse:
61
+ """Endpoint that handles the OAuth callback."""
62
+ token = await oauth.huggingface.authorize_access_token(request)
63
+ request.session["oauth_profile"] = token["userinfo"]
64
+ request.session["oauth_token"] = token
65
+ return RedirectResponse("/")
66
+
67
+ @app.get("/logout")
68
+ async def oauth_logout(request: fastapi.Request) -> RedirectResponse:
69
+ """Endpoint that logs out the user (e.g. delete cookie session)."""
70
+ request.session.pop("oauth_profile", None)
71
+ request.session.pop("oauth_token", None)
72
+ # 清除cookie并跳转到首页
73
+ response = RedirectResponse(url="/", status_code=302)
74
+ response.delete_cookie(key=f"access-token")
75
+ response.delete_cookie(key=f"access-token-unsecure")
76
+ return response
77
+
78
+
79
+ def _add_mocked_oauth_routes(app: fastapi.FastAPI) -> None:
80
+ """Add fake oauth routes if Gradio is run locally and OAuth is enabled.
81
+
82
+ Clicking on a gr.LoginButton will have the same behavior as in a Space (i.e. gets redirected in a new tab) but
83
+ instead of authenticating with HF, a mocked user profile is added to the session.
84
+ """
85
+
86
+ # Define OAuth routes
87
+ @app.get("/login/huggingface")
88
+ async def oauth_login(request: fastapi.Request):
89
+ """Fake endpoint that redirects to HF OAuth page."""
90
+ return RedirectResponse("/login/callback")
91
+
92
+ @app.get("/login/callback")
93
+ async def oauth_redirect_callback(request: fastapi.Request) -> RedirectResponse:
94
+ """Endpoint that handles the OAuth callback."""
95
+ request.session["oauth_profile"] = MOCKED_OAUTH_TOKEN["userinfo"]
96
+ request.session["oauth_token"] = MOCKED_OAUTH_TOKEN
97
+ return RedirectResponse("/")
98
+
99
+ @app.get("/logout")
100
+ async def oauth_logout(request: fastapi.Request) -> RedirectResponse:
101
+ """Endpoint that logs out the user (e.g. delete cookie session)."""
102
+ request.session.pop("oauth_profile", None)
103
+ request.session.pop("oauth_token", None)
104
+ # 清除cookie并跳转到首页
105
+ response = RedirectResponse(url="/", status_code=302)
106
+ response.delete_cookie(key=f"access-token")
107
+ response.delete_cookie(key=f"access-token-unsecure")
108
+ return response
109
+
110
+
111
+ def reg_patch():
112
+ gradio.oauth._add_mocked_oauth_routes = _add_mocked_oauth_routes
113
+ gradio.oauth._add_oauth_routes = _add_oauth_routes
114
+ logging.info(i18n("覆盖gradio.oauth /logout路由"))
modules/index_func.py CHANGED
@@ -63,6 +63,8 @@ def get_documents(file_src):
63
  for elem in text_list:
64
  texts.append(Document(page_content=elem,
65
  metadata={"source": filepath}))
 
 
66
  else:
67
  logging.debug("Loading text file...")
68
  from langchain.document_loaders import TextLoader
@@ -99,6 +101,7 @@ def construct_index(
99
  else:
100
  # 由于一个依赖的愚蠢的设计,这里必须要有一个API KEY
101
  os.environ["OPENAI_API_KEY"] = "sk-xxxxxxx"
 
102
  chunk_size_limit = None if chunk_size_limit == 0 else chunk_size_limit
103
  embedding_limit = None if embedding_limit == 0 else embedding_limit
104
  separator = " " if separator == "" else separator
@@ -118,22 +121,18 @@ def construct_index(
118
  embeddings = OpenAIEmbeddings(deployment=os.environ["AZURE_EMBEDDING_DEPLOYMENT_NAME"], openai_api_key=os.environ["AZURE_OPENAI_API_KEY"],
119
  model=os.environ["AZURE_EMBEDDING_MODEL_NAME"], openai_api_base=os.environ["AZURE_OPENAI_API_BASE_URL"], openai_api_type="azure")
120
  if os.path.exists(index_path) and load_from_cache_if_possible:
121
- logging.info("找到了缓存的索引文件,加载中……")
122
  return FAISS.load_local(index_path, embeddings)
123
  else:
124
- try:
125
- documents = get_documents(file_src)
126
- logging.info("构建索引中……")
127
  with retrieve_proxy():
128
  index = FAISS.from_documents(documents, embeddings)
129
- logging.debug("索引构建完成!")
130
- os.makedirs("./index", exist_ok=True)
131
- index.save_local(index_path)
132
- logging.debug("索引已保存至本地!")
133
- return index
134
-
135
- except Exception as e:
136
- import traceback
137
- logging.error("索引构建失败!%s", e)
138
- traceback.print_exc()
139
- return None
 
63
  for elem in text_list:
64
  texts.append(Document(page_content=elem,
65
  metadata={"source": filepath}))
66
+ elif file_type in [".jpg", ".jpeg", ".png", ".heif", ".heic", ".webp", ".bmp", ".gif", ".tiff", ".tif"]:
67
+ raise gr.Warning(i18n("不支持的文件: ") + filename + i18n(",请使用 .pdf, .docx, .pptx, .epub, .xlsx 等文档。"))
68
  else:
69
  logging.debug("Loading text file...")
70
  from langchain.document_loaders import TextLoader
 
101
  else:
102
  # 由于一个依赖的愚蠢的设计,这里必须要有一个API KEY
103
  os.environ["OPENAI_API_KEY"] = "sk-xxxxxxx"
104
+ logging.debug(f"api base: {os.environ.get('OPENAI_API_BASE', None)}")
105
  chunk_size_limit = None if chunk_size_limit == 0 else chunk_size_limit
106
  embedding_limit = None if embedding_limit == 0 else embedding_limit
107
  separator = " " if separator == "" else separator
 
121
  embeddings = OpenAIEmbeddings(deployment=os.environ["AZURE_EMBEDDING_DEPLOYMENT_NAME"], openai_api_key=os.environ["AZURE_OPENAI_API_KEY"],
122
  model=os.environ["AZURE_EMBEDDING_MODEL_NAME"], openai_api_base=os.environ["AZURE_OPENAI_API_BASE_URL"], openai_api_type="azure")
123
  if os.path.exists(index_path) and load_from_cache_if_possible:
124
+ logging.info(i18n("找到了缓存的索引文件,加载中……"))
125
  return FAISS.load_local(index_path, embeddings)
126
  else:
127
+ documents = get_documents(file_src)
128
+ logging.debug(i18n("构建索引中……"))
129
+ if documents:
130
  with retrieve_proxy():
131
  index = FAISS.from_documents(documents, embeddings)
132
+ else:
133
+ raise Exception(i18n("没有找到任何支持的文档。"))
134
+ logging.debug(i18n("索引构建完成!"))
135
+ os.makedirs("./index", exist_ok=True)
136
+ index.save_local(index_path)
137
+ logging.debug(i18n("索引已保存至本地!"))
138
+ return index
 
 
 
 
modules/models/ChatGLM.py CHANGED
@@ -4,6 +4,8 @@ import logging
4
  import os
5
  import platform
6
 
 
 
7
  import colorama
8
 
9
  from ..index_func import *
@@ -18,6 +20,7 @@ class ChatGLM_Client(BaseLLMModel):
18
  import torch
19
  from transformers import AutoModel, AutoTokenizer
20
  global CHATGLM_TOKENIZER, CHATGLM_MODEL
 
21
  if CHATGLM_TOKENIZER is None or CHATGLM_MODEL is None:
22
  system_name = platform.system()
23
  model_path = None
@@ -53,7 +56,12 @@ class ChatGLM_Client(BaseLLMModel):
53
  model = model.eval()
54
  CHATGLM_MODEL = model
55
 
56
- def _get_glm_style_input(self):
 
 
 
 
 
57
  history = [x["content"] for x in self.history]
58
  query = history.pop()
59
  logging.debug(colorama.Fore.YELLOW +
@@ -65,6 +73,12 @@ class ChatGLM_Client(BaseLLMModel):
65
  for i in range(0, len(history), 2)]
66
  return history, query
67
 
 
 
 
 
 
 
68
  def get_answer_at_once(self):
69
  history, query = self._get_glm_style_input()
70
  response, _ = CHATGLM_MODEL.chat(
@@ -82,3 +96,12 @@ class ChatGLM_Client(BaseLLMModel):
82
  temperature=self.temperature,
83
  ):
84
  yield response
 
 
 
 
 
 
 
 
 
 
4
  import os
5
  import platform
6
 
7
+ import gc
8
+ import torch
9
  import colorama
10
 
11
  from ..index_func import *
 
20
  import torch
21
  from transformers import AutoModel, AutoTokenizer
22
  global CHATGLM_TOKENIZER, CHATGLM_MODEL
23
+ self.deinitialize()
24
  if CHATGLM_TOKENIZER is None or CHATGLM_MODEL is None:
25
  system_name = platform.system()
26
  model_path = None
 
56
  model = model.eval()
57
  CHATGLM_MODEL = model
58
 
59
+ def _get_glm3_style_input(self):
60
+ history = self.history
61
+ query = history.pop()["content"]
62
+ return history, query
63
+
64
+ def _get_glm2_style_input(self):
65
  history = [x["content"] for x in self.history]
66
  query = history.pop()
67
  logging.debug(colorama.Fore.YELLOW +
 
73
  for i in range(0, len(history), 2)]
74
  return history, query
75
 
76
+ def _get_glm_style_input(self):
77
+ if "glm2" in self.model_name:
78
+ return self._get_glm2_style_input()
79
+ else:
80
+ return self._get_glm3_style_input()
81
+
82
  def get_answer_at_once(self):
83
  history, query = self._get_glm_style_input()
84
  response, _ = CHATGLM_MODEL.chat(
 
96
  temperature=self.temperature,
97
  ):
98
  yield response
99
+
100
+ def deinitialize(self):
101
+ # 释放显存
102
+ global CHATGLM_MODEL, CHATGLM_TOKENIZER
103
+ CHATGLM_MODEL = None
104
+ CHATGLM_TOKENIZER = None
105
+ gc.collect()
106
+ torch.cuda.empty_cache()
107
+ logging.info("ChatGLM model deinitialized")
modules/models/ChuanhuAgent.py CHANGED
@@ -13,7 +13,7 @@ from langchain.docstore.document import Document
13
  from langchain.tools import BaseTool, StructuredTool, Tool, tool
14
  from langchain.callbacks.stdout import StdOutCallbackHandler
15
  from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
16
- from langchain.callbacks.manager import BaseCallbackManager
17
  from duckduckgo_search import DDGS
18
  from itertools import islice
19
 
@@ -23,7 +23,7 @@ from langchain.callbacks.base import BaseCallbackHandler
23
  from langchain.input import print_text
24
  from langchain.schema import AgentAction, AgentFinish, LLMResult
25
 
26
- from pydantic import BaseModel, Field
27
 
28
  import requests
29
  from bs4 import BeautifulSoup
 
13
  from langchain.tools import BaseTool, StructuredTool, Tool, tool
14
  from langchain.callbacks.stdout import StdOutCallbackHandler
15
  from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
16
+ from langchain.callbacks.base import BaseCallbackManager
17
  from duckduckgo_search import DDGS
18
  from itertools import islice
19
 
 
23
  from langchain.input import print_text
24
  from langchain.schema import AgentAction, AgentFinish, LLMResult
25
 
26
+ from pydantic.v1 import BaseModel, Field
27
 
28
  import requests
29
  from bs4 import BeautifulSoup
modules/models/DALLE3.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ from .base_model import BaseLLMModel
3
+ from .. import shared
4
+ import requests
5
+ from ..presets import *
6
+ from ..config import retrieve_proxy, sensitive_id
7
+
8
+ class OpenAI_DALLE3_Client(BaseLLMModel):
9
+ def __init__(self, model_name, api_key, user_name="") -> None:
10
+ super().__init__(model_name=model_name, user=user_name)
11
+ self.api_key = api_key
12
+ self._refresh_header()
13
+
14
+ def _get_dalle3_prompt(self):
15
+ prompt = self.history[-1]["content"]
16
+ if prompt.endswith("--raw"):
17
+ prompt = "I NEED to test how the tool works with extremely simple prompts. DO NOT add any detail, just use it AS-IS:" + prompt
18
+ return prompt
19
+
20
+ def get_answer_at_once(self, stream=False):
21
+ prompt = self._get_dalle3_prompt()
22
+ headers = {
23
+ "Content-Type": "application/json",
24
+ "Authorization": f"Bearer {self.api_key}"
25
+ }
26
+ payload = {
27
+ "model": "dall-e-3",
28
+ "prompt": prompt,
29
+ "n": 1,
30
+ "size": "1024x1024",
31
+ "quality": "standard",
32
+ }
33
+ if stream:
34
+ timeout = TIMEOUT_STREAMING
35
+ else:
36
+ timeout = TIMEOUT_ALL
37
+
38
+ if shared.state.images_completion_url != IMAGES_COMPLETION_URL:
39
+ logging.debug(f"使用自定义API URL: {shared.state.images_completion_url}")
40
+
41
+ with retrieve_proxy():
42
+ try:
43
+ response = requests.post(
44
+ shared.state.images_completion_url,
45
+ headers=headers,
46
+ json=payload,
47
+ stream=stream,
48
+ timeout=timeout,
49
+ )
50
+ response.raise_for_status() # 根据HTTP状态码引发异常
51
+ response_data = response.json()
52
+ image_url = response_data['data'][0]['url']
53
+ img_tag = f'<!-- S O PREFIX --><a data-fancybox="gallery" target="_blank" href="{image_url}"><img src="{image_url}" /></a><!-- E O PREFIX -->'
54
+ revised_prompt = response_data['data'][0].get('revised_prompt', '')
55
+ return img_tag + revised_prompt, 0
56
+ except requests.exceptions.RequestException as e:
57
+ return str(e), 0
58
+
59
+ def _refresh_header(self):
60
+ self.headers = {
61
+ "Content-Type": "application/json",
62
+ "Authorization": f"Bearer {sensitive_id}",
63
+ }
modules/models/GoogleGemini.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import logging
3
+ import textwrap
4
+ import uuid
5
+
6
+ import google.generativeai as genai
7
+ import gradio as gr
8
+ import PIL
9
+ import requests
10
+
11
+ from modules.presets import i18n
12
+
13
+ from ..index_func import construct_index
14
+ from ..utils import count_token
15
+ from .base_model import BaseLLMModel
16
+
17
+
18
+ class GoogleGeminiClient(BaseLLMModel):
19
+ def __init__(self, model_name, api_key, user_name="") -> None:
20
+ super().__init__(model_name=model_name, user=user_name)
21
+ self.api_key = api_key
22
+ if "vision" in model_name.lower():
23
+ self.multimodal = True
24
+ else:
25
+ self.multimodal = False
26
+ self.image_paths = []
27
+
28
+ def _get_gemini_style_input(self):
29
+ self.history.extend([{"role": "image", "content": i} for i in self.image_paths])
30
+ self.image_paths = []
31
+ messages = []
32
+ for item in self.history:
33
+ if item["role"] == "image":
34
+ messages.append(PIL.Image.open(item["content"]))
35
+ else:
36
+ messages.append(item["content"])
37
+ return messages
38
+
39
+ def to_markdown(self, text):
40
+ text = text.replace("•", " *")
41
+ return textwrap.indent(text, "> ", predicate=lambda _: True)
42
+
43
+ def handle_file_upload(self, files, chatbot, language):
44
+ if files:
45
+ if self.multimodal:
46
+ for file in files:
47
+ if file.name:
48
+ self.image_paths.append(file.name)
49
+ chatbot = chatbot + [((file.name,), None)]
50
+ return None, chatbot, None
51
+ else:
52
+ construct_index(self.api_key, file_src=files)
53
+ status = i18n("索引构建完成")
54
+ return gr.Files.update(), chatbot, status
55
+
56
+ def get_answer_at_once(self):
57
+ genai.configure(api_key=self.api_key)
58
+ messages = self._get_gemini_style_input()
59
+ model = genai.GenerativeModel(self.model_name)
60
+ response = model.generate_content(messages)
61
+ try:
62
+ return self.to_markdown(response.text), len(response.text)
63
+ except ValueError:
64
+ return (
65
+ i18n("由于下面的原因,Google 拒绝返回 Gemini 的回答:\n\n")
66
+ + str(response.prompt_feedback),
67
+ 0,
68
+ )
69
+
70
+ def get_answer_stream_iter(self):
71
+ genai.configure(api_key=self.api_key)
72
+ messages = self._get_gemini_style_input()
73
+ model = genai.GenerativeModel(self.model_name)
74
+ response = model.generate_content(messages, stream=True)
75
+ partial_text = ""
76
+ for i in response:
77
+ response = i.text
78
+ partial_text += response
79
+ yield partial_text
80
+ self.all_token_counts[-1] = count_token(partial_text)
81
+ yield partial_text
modules/models/GoogleGemma.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ from threading import Thread
3
+
4
+ import torch
5
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
6
+
7
+ from ..presets import *
8
+ from .base_model import BaseLLMModel
9
+
10
+
11
+ class GoogleGemmaClient(BaseLLMModel):
12
+ def __init__(self, model_name, api_key, user_name="") -> None:
13
+ super().__init__(model_name=model_name, user=user_name)
14
+
15
+ global GEMMA_TOKENIZER, GEMMA_MODEL
16
+ # self.deinitialize()
17
+ self.default_max_generation_token = self.token_upper_limit
18
+ self.max_generation_token = self.token_upper_limit
19
+ if GEMMA_TOKENIZER is None or GEMMA_MODEL is None:
20
+ model_path = None
21
+ if os.path.exists("models"):
22
+ model_dirs = os.listdir("models")
23
+ if model_name in model_dirs:
24
+ model_path = f"models/{model_name}"
25
+ if model_path is not None:
26
+ model_source = model_path
27
+ else:
28
+ if os.path.exists(
29
+ os.path.join("models", MODEL_METADATA[model_name]["model_name"])
30
+ ):
31
+ model_source = os.path.join(
32
+ "models", MODEL_METADATA[model_name]["model_name"]
33
+ )
34
+ else:
35
+ try:
36
+ model_source = MODEL_METADATA[model_name]["repo_id"]
37
+ except:
38
+ model_source = model_name
39
+ dtype = torch.bfloat16
40
+ GEMMA_TOKENIZER = AutoTokenizer.from_pretrained(
41
+ model_source, use_auth_token=os.environ["HF_AUTH_TOKEN"]
42
+ )
43
+ GEMMA_MODEL = AutoModelForCausalLM.from_pretrained(
44
+ model_source,
45
+ device_map="auto",
46
+ torch_dtype=dtype,
47
+ trust_remote_code=True,
48
+ resume_download=True,
49
+ use_auth_token=os.environ["HF_AUTH_TOKEN"],
50
+ )
51
+
52
+ def deinitialize(self):
53
+ global GEMMA_TOKENIZER, GEMMA_MODEL
54
+ GEMMA_TOKENIZER = None
55
+ GEMMA_MODEL = None
56
+ self.clear_cuda_cache()
57
+ logging.info("GEMMA deinitialized")
58
+
59
+ def _get_gemma_style_input(self):
60
+ global GEMMA_TOKENIZER
61
+ # messages = [{"role": "system", "content": self.system_prompt}, *self.history] # system prompt is not supported
62
+ messages = self.history
63
+ prompt = GEMMA_TOKENIZER.apply_chat_template(
64
+ messages, tokenize=False, add_generation_prompt=True
65
+ )
66
+ inputs = GEMMA_TOKENIZER.encode(
67
+ prompt, add_special_tokens=True, return_tensors="pt"
68
+ )
69
+ return inputs
70
+
71
+ def get_answer_at_once(self):
72
+ global GEMMA_TOKENIZER, GEMMA_MODEL
73
+ inputs = self._get_gemma_style_input()
74
+ outputs = GEMMA_MODEL.generate(
75
+ input_ids=inputs.to(GEMMA_MODEL.device),
76
+ max_new_tokens=self.max_generation_token,
77
+ )
78
+ generated_token_count = outputs.shape[1] - inputs.shape[1]
79
+ outputs = GEMMA_TOKENIZER.decode(outputs[0], skip_special_tokens=True)
80
+ outputs = outputs.split("<start_of_turn>model\n")[-1][:-5]
81
+ self.clear_cuda_cache()
82
+ return outputs, generated_token_count
83
+
84
+ def get_answer_stream_iter(self):
85
+ global GEMMA_TOKENIZER, GEMMA_MODEL
86
+ inputs = self._get_gemma_style_input()
87
+ streamer = TextIteratorStreamer(
88
+ GEMMA_TOKENIZER, timeout=10.0, skip_prompt=True, skip_special_tokens=True
89
+ )
90
+ input_kwargs = dict(
91
+ input_ids=inputs.to(GEMMA_MODEL.device),
92
+ max_new_tokens=self.max_generation_token,
93
+ streamer=streamer,
94
+ )
95
+ t = Thread(target=GEMMA_MODEL.generate, kwargs=input_kwargs)
96
+ t.start()
97
+
98
+ partial_text = ""
99
+ for new_text in streamer:
100
+ partial_text += new_text
101
+ yield partial_text
102
+ self.clear_cuda_cache()
modules/models/LLaMA.py CHANGED
@@ -2,14 +2,12 @@ from __future__ import annotations
2
 
3
  import json
4
  import os
5
-
6
- from huggingface_hub import hf_hub_download
7
  from llama_cpp import Llama
8
 
9
  from ..index_func import *
10
  from ..presets import *
11
  from ..utils import *
12
- from .base_model import BaseLLMModel
13
 
14
  SYS_PREFIX = "<<SYS>>\n"
15
  SYS_POSTFIX = "\n<</SYS>>\n\n"
@@ -19,34 +17,6 @@ OUTPUT_PREFIX = "[/INST] "
19
  OUTPUT_POSTFIX = "</s>"
20
 
21
 
22
- def download(repo_id, filename, retry=10):
23
- if os.path.exists("./models/downloaded_models.json"):
24
- with open("./models/downloaded_models.json", "r") as f:
25
- downloaded_models = json.load(f)
26
- if repo_id in downloaded_models:
27
- return downloaded_models[repo_id]["path"]
28
- else:
29
- downloaded_models = {}
30
- while retry > 0:
31
- try:
32
- model_path = hf_hub_download(
33
- repo_id=repo_id,
34
- filename=filename,
35
- cache_dir="models",
36
- resume_download=True,
37
- )
38
- downloaded_models[repo_id] = {"path": model_path}
39
- with open("./models/downloaded_models.json", "w") as f:
40
- json.dump(downloaded_models, f)
41
- break
42
- except:
43
- print("Error downloading model, retrying...")
44
- retry -= 1
45
- if retry == 0:
46
- raise Exception("Error downloading model, please try again later.")
47
- return model_path
48
-
49
-
50
  class LLaMA_Client(BaseLLMModel):
51
  def __init__(self, model_name, lora_path=None, user_name="") -> None:
52
  super().__init__(model_name=model_name, user=user_name)
@@ -115,7 +85,7 @@ class LLaMA_Client(BaseLLMModel):
115
  iter = self.model(
116
  context,
117
  max_tokens=self.max_generation_token,
118
- stop=[SYS_PREFIX, SYS_POSTFIX, INST_PREFIX, OUTPUT_PREFIX,OUTPUT_POSTFIX],
119
  echo=False,
120
  stream=True,
121
  )
 
2
 
3
  import json
4
  import os
 
 
5
  from llama_cpp import Llama
6
 
7
  from ..index_func import *
8
  from ..presets import *
9
  from ..utils import *
10
+ from .base_model import BaseLLMModel, download
11
 
12
  SYS_PREFIX = "<<SYS>>\n"
13
  SYS_POSTFIX = "\n<</SYS>>\n\n"
 
17
  OUTPUT_POSTFIX = "</s>"
18
 
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  class LLaMA_Client(BaseLLMModel):
21
  def __init__(self, model_name, lora_path=None, user_name="") -> None:
22
  super().__init__(model_name=model_name, user=user_name)
 
85
  iter = self.model(
86
  context,
87
  max_tokens=self.max_generation_token,
88
+ stop=[SYS_PREFIX, SYS_POSTFIX, INST_PREFIX, OUTPUT_PREFIX, OUTPUT_POSTFIX],
89
  echo=False,
90
  stream=True,
91
  )
modules/models/Ollama.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import logging
3
+ import textwrap
4
+ import uuid
5
+
6
+ from ollama import Client
7
+
8
+ from modules.presets import i18n
9
+
10
+ from ..index_func import construct_index
11
+ from ..utils import count_token
12
+ from .base_model import BaseLLMModel
13
+
14
+
15
+ class OllamaClient(BaseLLMModel):
16
+ def __init__(self, model_name, user_name="", ollama_host="", backend_model="") -> None:
17
+ super().__init__(model_name=model_name, user=user_name)
18
+ self.backend_model = backend_model
19
+ self.ollama_host = ollama_host
20
+ self.update_token_limit()
21
+
22
+ def get_model_list(self):
23
+ client = Client(host=self.ollama_host)
24
+ return client.list()
25
+
26
+ def update_token_limit(self):
27
+ lower_model_name = self.backend_model.lower()
28
+ if "mistral" in lower_model_name:
29
+ self.token_upper_limit = 8*1024
30
+ elif "gemma" in lower_model_name:
31
+ self.token_upper_limit = 8*1024
32
+ elif "codellama" in lower_model_name:
33
+ self.token_upper_limit = 4*1024
34
+ elif "llama2-chinese" in lower_model_name:
35
+ self.token_upper_limit = 4*1024
36
+ elif "llama2" in lower_model_name:
37
+ self.token_upper_limit = 4*1024
38
+ elif "mixtral" in lower_model_name:
39
+ self.token_upper_limit = 32*1024
40
+ elif "llava" in lower_model_name:
41
+ self.token_upper_limit = 4*1024
42
+
43
+ def get_answer_stream_iter(self):
44
+ if self.backend_model == "":
45
+ return i18n("请先选择Ollama后端模型\n\n")
46
+ client = Client(host=self.ollama_host)
47
+ response = client.chat(model=self.backend_model, messages=self.history,stream=True)
48
+ partial_text = ""
49
+ for i in response:
50
+ response = i['message']['content']
51
+ partial_text += response
52
+ yield partial_text
53
+ self.all_token_counts[-1] = count_token(partial_text)
54
+ yield partial_text
modules/models/OpenAI.py CHANGED
@@ -37,6 +37,8 @@ class OpenAIClient(BaseLLMModel):
37
  self._refresh_header()
38
 
39
  def get_answer_stream_iter(self):
 
 
40
  response = self._get_response(stream=True)
41
  if response is not None:
42
  iter = self._decode_chat_response(response)
@@ -48,6 +50,8 @@ class OpenAIClient(BaseLLMModel):
48
  yield STANDARD_ERROR_MSG + GENERAL_ERROR_MSG
49
 
50
  def get_answer_at_once(self):
 
 
51
  response = self._get_response()
52
  response = json.loads(response.text)
53
  content = response["choices"][0]["message"]["content"]
@@ -105,9 +109,6 @@ class OpenAIClient(BaseLLMModel):
105
  logging.error(i18n("获取API使用情况失败:") + str(e))
106
  return STANDARD_ERROR_MSG + ERROR_RETRIEVE_MSG
107
 
108
- def set_token_upper_limit(self, new_upper_limit):
109
- pass
110
-
111
  @shared.state.switching_api_key # 在不开启多账号模式的时候,这个装饰器不会起作用
112
  def _get_response(self, stream=False):
113
  openai_api_key = self.api_key
@@ -139,7 +140,7 @@ class OpenAIClient(BaseLLMModel):
139
  if self.stop_sequence is not None:
140
  payload["stop"] = self.stop_sequence
141
  if self.logit_bias is not None:
142
- payload["logit_bias"] = self.logit_bias
143
  if self.user_identifier:
144
  payload["user"] = self.user_identifier
145
 
@@ -252,7 +253,7 @@ class OpenAIClient(BaseLLMModel):
252
  return response
253
 
254
 
255
- def auto_name_chat_history(self, name_chat_method, user_question, chatbot, user_name, single_turn_checkbox):
256
  if len(self.history) == 2 and not single_turn_checkbox and not hide_history_when_not_logged_in:
257
  user_question = self.history[0]["content"]
258
  if name_chat_method == i18n("模型自动总结(消耗tokens)"):
@@ -269,10 +270,10 @@ class OpenAIClient(BaseLLMModel):
269
  except Exception as e:
270
  logging.info(f"自动命名失败。{e}")
271
  filename = replace_special_symbols(user_question)[:16] + ".json"
272
- return self.rename_chat_history(filename, chatbot, user_name)
273
  elif name_chat_method == i18n("第一条提问"):
274
  filename = replace_special_symbols(user_question)[:16] + ".json"
275
- return self.rename_chat_history(filename, chatbot, user_name)
276
  else:
277
  return gr.update()
278
  else:
 
37
  self._refresh_header()
38
 
39
  def get_answer_stream_iter(self):
40
+ if not self.api_key:
41
+ raise Exception(NO_APIKEY_MSG)
42
  response = self._get_response(stream=True)
43
  if response is not None:
44
  iter = self._decode_chat_response(response)
 
50
  yield STANDARD_ERROR_MSG + GENERAL_ERROR_MSG
51
 
52
  def get_answer_at_once(self):
53
+ if not self.api_key:
54
+ raise Exception(NO_APIKEY_MSG)
55
  response = self._get_response()
56
  response = json.loads(response.text)
57
  content = response["choices"][0]["message"]["content"]
 
109
  logging.error(i18n("获取API使用情况失败:") + str(e))
110
  return STANDARD_ERROR_MSG + ERROR_RETRIEVE_MSG
111
 
 
 
 
112
  @shared.state.switching_api_key # 在不开启多账号模式的时候,这个装饰器不会起作用
113
  def _get_response(self, stream=False):
114
  openai_api_key = self.api_key
 
140
  if self.stop_sequence is not None:
141
  payload["stop"] = self.stop_sequence
142
  if self.logit_bias is not None:
143
+ payload["logit_bias"] = self.encoded_logit_bias()
144
  if self.user_identifier:
145
  payload["user"] = self.user_identifier
146
 
 
253
  return response
254
 
255
 
256
+ def auto_name_chat_history(self, name_chat_method, user_question, chatbot, single_turn_checkbox):
257
  if len(self.history) == 2 and not single_turn_checkbox and not hide_history_when_not_logged_in:
258
  user_question = self.history[0]["content"]
259
  if name_chat_method == i18n("模型自动总结(消耗tokens)"):
 
270
  except Exception as e:
271
  logging.info(f"自动命名失败。{e}")
272
  filename = replace_special_symbols(user_question)[:16] + ".json"
273
+ return self.rename_chat_history(filename, chatbot)
274
  elif name_chat_method == i18n("第一条提问"):
275
  filename = replace_special_symbols(user_question)[:16] + ".json"
276
+ return self.rename_chat_history(filename, chatbot)
277
  else:
278
  return gr.update()
279
  else:
modules/models/OpenAIInstruct.py CHANGED
@@ -1,4 +1,6 @@
1
- import openai
 
 
2
  from .base_model import BaseLLMModel
3
  from .. import shared
4
  from ..config import retrieve_proxy
@@ -16,12 +18,10 @@ class OpenAI_Instruct_Client(BaseLLMModel):
16
  def get_answer_at_once(self):
17
  prompt = self._get_instruct_style_input()
18
  with retrieve_proxy():
19
- response = openai.Completion.create(
20
- api_key=self.api_key,
21
- api_base=shared.state.openai_api_base,
22
  model=self.model_name,
23
  prompt=prompt,
24
  temperature=self.temperature,
25
  top_p=self.top_p,
26
- )
27
- return response.choices[0].text.strip(), response.usage["total_tokens"]
 
1
+ from openai import OpenAI
2
+
3
+ client = OpenAI()
4
  from .base_model import BaseLLMModel
5
  from .. import shared
6
  from ..config import retrieve_proxy
 
18
  def get_answer_at_once(self):
19
  prompt = self._get_instruct_style_input()
20
  with retrieve_proxy():
21
+ response = client.completions.create(
 
 
22
  model=self.model_name,
23
  prompt=prompt,
24
  temperature=self.temperature,
25
  top_p=self.top_p,
26
+ )
27
+ return response.choices[0].text.strip(), response.usage.total_tokens
modules/models/OpenAIVision.py CHANGED
@@ -4,6 +4,7 @@ import json
4
  import logging
5
  import traceback
6
  import base64
 
7
 
8
  import colorama
9
  import requests
@@ -38,6 +39,7 @@ class OpenAIVisionClient(BaseLLMModel):
38
  system_prompt=system_prompt,
39
  user=user_name
40
  )
 
41
  self.api_key = api_key
42
  self.need_api_key = True
43
  self.max_generation_token = 4096
@@ -82,9 +84,11 @@ class OpenAIVisionClient(BaseLLMModel):
82
 
83
  if scale_ratio < 1:
84
  # 按压缩比例调整图片大小
85
- new_width = int(width * scale_ratio)
86
- new_height = int(height * scale_ratio)
87
- img = img.resize((new_width, new_height), Image.LANCZOS)
 
 
88
 
89
  # 将图片转换为jpg格式的二进制数据
90
  buffer = BytesIO()
@@ -132,6 +136,13 @@ class OpenAIVisionClient(BaseLLMModel):
132
  return input_token_count + system_prompt_token_count
133
  return input_token_count
134
 
 
 
 
 
 
 
 
135
  def billing_info(self):
136
  try:
137
  curr_time = datetime.datetime.now()
@@ -174,9 +185,6 @@ class OpenAIVisionClient(BaseLLMModel):
174
  logging.error(i18n("获取API使用情况失败:") + str(e))
175
  return STANDARD_ERROR_MSG + ERROR_RETRIEVE_MSG
176
 
177
- def set_token_upper_limit(self, new_upper_limit):
178
- pass
179
-
180
  @shared.state.switching_api_key # 在不开启多账号模式的时候,这个装饰器不会起作用
181
  def _get_response(self, stream=False):
182
  openai_api_key = self.api_key
@@ -188,6 +196,10 @@ class OpenAIVisionClient(BaseLLMModel):
188
  *[{"type": "image_url", "image_url": "data:image/jpeg;base64,"+image["base64"]} for image in self.images]
189
  ]
190
  self.images = []
 
 
 
 
191
  logging.debug(colorama.Fore.YELLOW +
192
  f"{history}" + colorama.Fore.RESET)
193
  headers = {
@@ -207,14 +219,13 @@ class OpenAIVisionClient(BaseLLMModel):
207
  "stream": stream,
208
  "presence_penalty": self.presence_penalty,
209
  "frequency_penalty": self.frequency_penalty,
 
210
  }
211
 
212
- if self.max_generation_token is not None:
213
- payload["max_tokens"] = self.max_generation_token
214
  if self.stop_sequence is not None:
215
  payload["stop"] = self.stop_sequence
216
  if self.logit_bias is not None:
217
- payload["logit_bias"] = self.logit_bias
218
  if self.user_identifier:
219
  payload["user"] = self.user_identifier
220
 
@@ -280,6 +291,8 @@ class OpenAIVisionClient(BaseLLMModel):
280
  if chunk_length > 6 and "delta" in chunk["choices"][0]:
281
  if "finish_details" in chunk["choices"][0]:
282
  finish_reason = chunk["choices"][0]["finish_details"]
 
 
283
  else:
284
  finish_reason = chunk["finish_details"]
285
  if finish_reason == "stop":
 
4
  import logging
5
  import traceback
6
  import base64
7
+ from math import ceil
8
 
9
  import colorama
10
  import requests
 
39
  system_prompt=system_prompt,
40
  user=user_name
41
  )
42
+ self.image_token = 0
43
  self.api_key = api_key
44
  self.need_api_key = True
45
  self.max_generation_token = 4096
 
84
 
85
  if scale_ratio < 1:
86
  # 按压缩比例调整图片大小
87
+ width = int(width * scale_ratio)
88
+ height = int(height * scale_ratio)
89
+ img = img.resize((width, height), Image.LANCZOS)
90
+ # 使用新的宽度和高度计算图片的token数量
91
+ self.image_token = self.count_image_tokens(width, height)
92
 
93
  # 将图片转换为jpg格式的二进制数据
94
  buffer = BytesIO()
 
136
  return input_token_count + system_prompt_token_count
137
  return input_token_count
138
 
139
+ def count_image_tokens(self, width: int, height: int):
140
+ h = ceil(height / 512)
141
+ w = ceil(width / 512)
142
+ n = w * h
143
+ total = 85 + 170 * n
144
+ return total
145
+
146
  def billing_info(self):
147
  try:
148
  curr_time = datetime.datetime.now()
 
185
  logging.error(i18n("获取API使用情况失败:") + str(e))
186
  return STANDARD_ERROR_MSG + ERROR_RETRIEVE_MSG
187
 
 
 
 
188
  @shared.state.switching_api_key # 在不开启多账号模式的时候,这个装饰器不会起作用
189
  def _get_response(self, stream=False):
190
  openai_api_key = self.api_key
 
196
  *[{"type": "image_url", "image_url": "data:image/jpeg;base64,"+image["base64"]} for image in self.images]
197
  ]
198
  self.images = []
199
+ # 添加图片token到总计数中
200
+ self.all_token_counts[-1] += self.image_token
201
+ self.image_token = 0
202
+
203
  logging.debug(colorama.Fore.YELLOW +
204
  f"{history}" + colorama.Fore.RESET)
205
  headers = {
 
219
  "stream": stream,
220
  "presence_penalty": self.presence_penalty,
221
  "frequency_penalty": self.frequency_penalty,
222
+ "max_tokens": 4096
223
  }
224
 
 
 
225
  if self.stop_sequence is not None:
226
  payload["stop"] = self.stop_sequence
227
  if self.logit_bias is not None:
228
+ payload["logit_bias"] = self.encoded_logit_bias()
229
  if self.user_identifier:
230
  payload["user"] = self.user_identifier
231
 
 
291
  if chunk_length > 6 and "delta" in chunk["choices"][0]:
292
  if "finish_details" in chunk["choices"][0]:
293
  finish_reason = chunk["choices"][0]["finish_details"]
294
+ elif "finish_reason" in chunk["choices"][0]:
295
+ finish_reason = chunk["choices"][0]["finish_reason"]
296
  else:
297
  finish_reason = chunk["finish_details"]
298
  if finish_reason == "stop":
modules/models/Qwen.py CHANGED
@@ -1,4 +1,5 @@
1
  from transformers import AutoModelForCausalLM, AutoTokenizer
 
2
  from transformers.generation import GenerationConfig
3
  import logging
4
  import colorama
@@ -9,8 +10,18 @@ from ..presets import MODEL_METADATA
9
  class Qwen_Client(BaseLLMModel):
10
  def __init__(self, model_name, user_name="") -> None:
11
  super().__init__(model_name=model_name, user=user_name)
12
- self.tokenizer = AutoTokenizer.from_pretrained(MODEL_METADATA[model_name]["repo_id"], trust_remote_code=True, resume_download=True)
13
- self.model = AutoModelForCausalLM.from_pretrained(MODEL_METADATA[model_name]["repo_id"], device_map="auto", trust_remote_code=True, resume_download=True).eval()
 
 
 
 
 
 
 
 
 
 
14
 
15
  def generation_config(self):
16
  return GenerationConfig.from_dict({
 
1
  from transformers import AutoModelForCausalLM, AutoTokenizer
2
+ import os
3
  from transformers.generation import GenerationConfig
4
  import logging
5
  import colorama
 
10
  class Qwen_Client(BaseLLMModel):
11
  def __init__(self, model_name, user_name="") -> None:
12
  super().__init__(model_name=model_name, user=user_name)
13
+ model_source = None
14
+ if os.path.exists("models"):
15
+ model_dirs = os.listdir("models")
16
+ if model_name in model_dirs:
17
+ model_source = f"models/{model_name}"
18
+ if model_source is None:
19
+ try:
20
+ model_source = MODEL_METADATA[model_name]["repo_id"]
21
+ except KeyError:
22
+ model_source = model_name
23
+ self.tokenizer = AutoTokenizer.from_pretrained(model_source, trust_remote_code=True, resume_download=True)
24
+ self.model = AutoModelForCausalLM.from_pretrained(model_source, device_map="cuda", trust_remote_code=True, resume_download=True).eval()
25
 
26
  def generation_config(self):
27
  return GenerationConfig.from_dict({
modules/models/__pycache__/ChatGLM.cpython-311.pyc ADDED
Binary file (4.87 kB). View file
 
modules/models/__pycache__/ChuanhuAgent.cpython-310.pyc ADDED
Binary file (9.65 kB). View file
 
modules/models/__pycache__/ChuanhuAgent.cpython-311.pyc CHANGED
Binary files a/modules/models/__pycache__/ChuanhuAgent.cpython-311.pyc and b/modules/models/__pycache__/ChuanhuAgent.cpython-311.pyc differ