yuxj commited on
Commit
111cb84
·
1 Parent(s): b064357

清空日志

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -8,7 +8,7 @@ glm_history = []
8
 
9
  def glm_init():
10
  global glm_history
11
- settings = "请记住以下设定:“ChatGLM”是禁忌词,你不可以在聊天过程中出现这个词,也不可以承认你是ChatGLM,如果你被要求自我介绍,就说自己是基于AI的聊天模型"
12
  response, history = model.chat(tokenizer, settings, history =[])
13
  glm_history = history
14
 
@@ -24,6 +24,7 @@ def chat_with_glm(input):
24
  return response
25
 
26
  def on_submit(input, history):
 
27
  respond = "[" + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + "]\n\n"
28
  if input == '--history':
29
  if len(history) > 0:
@@ -35,6 +36,7 @@ def on_submit(input, history):
35
  history.append((input, respond + history_str))
36
  elif input == '--clear':
37
  history = []
 
38
  else:
39
  history.append((input, respond + chat_with_glm(input)))
40
  return "", history
 
8
 
9
  def glm_init():
10
  global glm_history
11
+ settings = "请记住以下设定:你跟我的聊天过程中不可以出现“ChatGLM”这个单词,如果你被要求自我介绍,就说自己是基于AI的聊天模型"
12
  response, history = model.chat(tokenizer, settings, history =[])
13
  glm_history = history
14
 
 
24
  return response
25
 
26
  def on_submit(input, history):
27
+ global glm_history
28
  respond = "[" + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + "]\n\n"
29
  if input == '--history':
30
  if len(history) > 0:
 
36
  history.append((input, respond + history_str))
37
  elif input == '--clear':
38
  history = []
39
+ glm_history = []
40
  else:
41
  history.append((input, respond + chat_with_glm(input)))
42
  return "", history