JunchuanYu commited on
Commit
dcd4379
1 Parent(s): 91d2638

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +16 -16
utils.py CHANGED
@@ -25,27 +25,25 @@ model_select_dropdown="gpt-3.5-turbo"
25
  dockerflag = True
26
  authflag = False
27
 
28
- # ChatGPT 设置
29
  initial_prompt = "You are a helpful assistant."
30
  API_URL = "https://api.openai.com/v1/chat/completions"
31
  HISTORY_DIR = "history"
32
  TEMPLATES_DIR = "./"
33
 
34
- # 错误信息
35
- standard_error_msg = "Error:" # 错误信息的标准前缀
36
- error_retrieve_prompt = "Please check the network connection and the API-Key" # 获取对话时发生错误
37
- connection_timeout_prompt = "Time out" # 连接超时
38
- read_timeout_prompt = "Time out" # 读取超时
39
- proxy_error_prompt = "Proxy error" # 代理错误
40
- ssl_error_prompt = "SSL error" # SSL 错误
41
- no_apikey_msg = "please check whether the input is correct" # API key 长度不足 51 位
42
-
43
- max_token_streaming = 3500 # 流式对话时的最大 token 数
44
- timeout_streaming = 5 # 流式对话时的超时时间
45
- max_token_all = 3500 # 非流式对话时的最大 token 数
46
- timeout_all = 200 # 非流式对话时的超时时间
47
- enable_streaming_option = True # 是否启用选择选择是否实时显示回答的勾选框
48
- HIDE_MY_KEY = True # 如果你想在UI中隐藏你的 API 密钥,将此值设置为 True
49
 
50
  SIM_K = 5
51
  INDEX_QUERY_TEMPRATURE = 1.0
@@ -157,6 +155,8 @@ def convert_mdtext(md_text):
157
  else:
158
  result.append(mdtex2html.convert(non_code, extensions=["tables"]))
159
  if code.strip():
 
 
160
  code = f"```{code}\n\n```"
161
  code = markdown_to_html_with_syntax_highlight(code)
162
  result.append(code)
 
25
  dockerflag = True
26
  authflag = False
27
 
 
28
  initial_prompt = "You are a helpful assistant."
29
  API_URL = "https://api.openai.com/v1/chat/completions"
30
  HISTORY_DIR = "history"
31
  TEMPLATES_DIR = "./"
32
 
33
+ standard_error_msg = "Error:"
34
+ error_retrieve_prompt = "Please check the network connection and the API-Key"
35
+ connection_timeout_prompt = "Time out"
36
+ read_timeout_prompt = "Time out"
37
+ proxy_error_prompt = "Proxy error"
38
+ ssl_error_prompt = "SSL error"
39
+ no_apikey_msg = "please check whether the input is correct"
40
+
41
+ max_token_streaming = 3500
42
+ timeout_streaming = 10
43
+ max_token_all = 3500
44
+ timeout_all = 200
45
+ enable_streaming_option = True
46
+ HIDE_MY_KEY = True
 
47
 
48
  SIM_K = 5
49
  INDEX_QUERY_TEMPRATURE = 1.0
 
155
  else:
156
  result.append(mdtex2html.convert(non_code, extensions=["tables"]))
157
  if code.strip():
158
+ # _, code = detect_language(code) # 暂时去除代码高亮功能,因为在大段代码的情况下会出现问题
159
+ # code = code.replace("\n\n", "\n") # 暂时去除代码中的空行,因为在大段代码的情况下会出现问题
160
  code = f"```{code}\n\n```"
161
  code = markdown_to_html_with_syntax_highlight(code)
162
  result.append(code)