File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -39,20 +39,12 @@ def main():
3939 os .system (clear_command )
4040 print ("欢迎使用 ChatGLM-6B 模型,输入内容即可进行对话,clear 清空对话历史,stop 终止程序" )
4141 continue
42- count = 0
42+ prev_response = ""
43+ print ("ChatGLM-6B:" , end = "" , flush = True )
4344 for response , history in model .stream_chat (tokenizer , query , history = history ):
44- if stop_stream :
45- stop_stream = False
46- break
47- else :
48- count += 1
49- if count % 8 == 0 :
50- os .system (clear_command )
51- print (build_prompt (history ), flush = True )
52- signal .signal (signal .SIGINT , signal_handler )
53- os .system (clear_command )
54- print (build_prompt (history ), flush = True )
55-
45+ print (response [len (prev_response ):], end = "" , flush = True )
46+ prev_response = response
47+ print ("\n " , end = "" , flush = True )
5648
5749if __name__ == "__main__" :
5850 main ()
You can’t perform that action at this time.
0 commit comments