Tuchuanhuhuhu commited on
Commit
3b2bedf
1 Parent(s): 2af553a

用语调整

Browse files
ChuanhuChatbot.py CHANGED
@@ -101,7 +101,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
101
  multiselect=False,
102
  value=REPLY_LANGUAGES[0],
103
  )
104
- index_files = gr.Files(label=i18n("上传索引文件"), type="file")
105
  two_column = gr.Checkbox(label=i18n("双栏pdf"), value=advance_docs["pdf"].get("two_column", False))
106
  # TODO: 公式ocr
107
  # formula_ocr = gr.Checkbox(label=i18n("识别公式"), value=advance_docs["pdf"].get("formula_ocr", False))
 
101
  multiselect=False,
102
  value=REPLY_LANGUAGES[0],
103
  )
104
+ index_files = gr.Files(label=i18n("上传"), type="file")
105
  two_column = gr.Checkbox(label=i18n("双栏pdf"), value=advance_docs["pdf"].get("two_column", False))
106
  # TODO: 公式ocr
107
  # formula_ocr = gr.Checkbox(label=i18n("识别公式"), value=advance_docs["pdf"].get("formula_ocr", False))
locale/en_US.json CHANGED
@@ -14,7 +14,7 @@
14
  "单轮对话": "Single-turn dialogue",
15
  "使用在线搜索": "Use online search",
16
  "选择回复语言(针对搜索&索引功能)": "Select reply language (for search & index)",
17
- "上传索引文件": "Upload index file",
18
  "双栏pdf": "Two-column pdf",
19
  "识别公式": "formula OCR",
20
  "在这里输入System Prompt...": "Type in System Prompt here...",
 
14
  "单轮对话": "Single-turn dialogue",
15
  "使用在线搜索": "Use online search",
16
  "选择回复语言(针对搜索&索引功能)": "Select reply language (for search & index)",
17
+ "上传索引文件": "Upload",
18
  "双栏pdf": "Two-column pdf",
19
  "识别公式": "formula OCR",
20
  "在这里输入System Prompt...": "Type in System Prompt here...",
locale/ja_JP.json CHANGED
@@ -14,7 +14,7 @@
14
  "单轮对话": "単発会話",
15
  "使用在线搜索": "オンライン検索を使用",
16
  "选择回复语言(针对搜索&索引功能)": "回答言語を選択(検索とインデックス機能に対して)",
17
- "上传索引文件": "インデックスファイルをアップロード",
18
  "双栏pdf": "2カラムpdf",
19
  "识别公式": "formula OCR",
20
  "在这里输入System Prompt...": "System Promptを入力してください...",
 
14
  "单轮对话": "単発会話",
15
  "使用在线搜索": "オンライン検索を使用",
16
  "选择回复语言(针对搜索&索引功能)": "回答言語を選択(検索とインデックス機能に対して)",
17
+ "上传索引文件": "アップロード",
18
  "双栏pdf": "2カラムpdf",
19
  "识别公式": "formula OCR",
20
  "在这里输入System Prompt...": "System Promptを入力してください...",
modules/base_model.py CHANGED
@@ -29,7 +29,7 @@ class ModelType(Enum):
29
  OpenAI = 0
30
  ChatGLM = 1
31
  LLaMA = 2
32
- XMBot = 3
33
 
34
  @classmethod
35
  def get_type(cls, model_name: str):
@@ -41,8 +41,8 @@ class ModelType(Enum):
41
  model_type = ModelType.ChatGLM
42
  elif "llama" in model_name_lower or "alpaca" in model_name_lower:
43
  model_type = ModelType.LLaMA
44
- elif "xmbot" in model_name_lower:
45
- model_type = ModelType.XMBot
46
  else:
47
  model_type = ModelType.Unknown
48
  return model_type
 
29
  OpenAI = 0
30
  ChatGLM = 1
31
  LLaMA = 2
32
+ XMChat = 3
33
 
34
  @classmethod
35
  def get_type(cls, model_name: str):
 
41
  model_type = ModelType.ChatGLM
42
  elif "llama" in model_name_lower or "alpaca" in model_name_lower:
43
  model_type = ModelType.LLaMA
44
+ elif "xmchat" in model_name_lower:
45
+ model_type = ModelType.XMChat
46
  else:
47
  model_type = ModelType.Unknown
48
  return model_type
modules/config.py CHANGED
@@ -67,8 +67,8 @@ if os.environ.get("dockerrun") == "yes":
67
  my_api_key = config.get("openai_api_key", "")
68
  my_api_key = os.environ.get("my_api_key", my_api_key)
69
 
70
- xmbot_api_key = config.get("xmbot_api_key", "")
71
- os.environ["XMBOT_API_KEY"] = xmbot_api_key
72
 
73
  ## 多账户机制
74
  multi_api_key = config.get("multi_api_key", False) # 是否开启多账户机制
 
67
  my_api_key = config.get("openai_api_key", "")
68
  my_api_key = os.environ.get("my_api_key", my_api_key)
69
 
70
+ xmchat_api_key = config.get("xmchat_api_key", "")
71
+ os.environ["XMCHAT_API_KEY"] = xmchat_api_key
72
 
73
  ## 多账户机制
74
  multi_api_key = config.get("multi_api_key", False) # 是否开启多账户机制
modules/models.py CHANGED
@@ -385,9 +385,9 @@ class LLaMA_Client(BaseLLMModel):
385
  yield partial_text
386
 
387
 
388
- class XMBot_Client(BaseLLMModel):
389
  def __init__(self, api_key):
390
- super().__init__(model_name="xmbot")
391
  self.api_key = api_key
392
  self.session_id = None
393
  self.reset()
@@ -541,10 +541,10 @@ def get_model(
541
  else:
542
  msg += f" + {lora_model_path}"
543
  model = LLaMA_Client(model_name, lora_model_path)
544
- elif model_type == ModelType.XMBot:
545
- if os.environ.get("XMBOT_API_KEY") != "":
546
- access_key = os.environ.get("XMBOT_API_KEY")
547
- model = XMBot_Client(api_key=access_key)
548
  elif model_type == ModelType.Unknown:
549
  raise ValueError(f"未知模型: {model_name}")
550
  logging.info(msg)
 
385
  yield partial_text
386
 
387
 
388
+ class XMChat(BaseLLMModel):
389
  def __init__(self, api_key):
390
+ super().__init__(model_name="xmchat")
391
  self.api_key = api_key
392
  self.session_id = None
393
  self.reset()
 
541
  else:
542
  msg += f" + {lora_model_path}"
543
  model = LLaMA_Client(model_name, lora_model_path)
544
+ elif model_type == ModelType.XMChat:
545
+ if os.environ.get("XMCHAT_API_KEY") != "":
546
+ access_key = os.environ.get("XMCHAT_API_KEY")
547
+ model = XMChat(api_key=access_key)
548
  elif model_type == ModelType.Unknown:
549
  raise ValueError(f"未知模型: {model_name}")
550
  logging.info(msg)
modules/presets.py CHANGED
@@ -67,7 +67,7 @@ ONLINE_MODELS = [
67
  "gpt-4-0314",
68
  "gpt-4-32k",
69
  "gpt-4-32k-0314",
70
- "xmbot",
71
  ]
72
 
73
  LOCAL_MODELS = [
 
67
  "gpt-4-0314",
68
  "gpt-4-32k",
69
  "gpt-4-32k-0314",
70
+ "xmchat",
71
  ]
72
 
73
  LOCAL_MODELS = [