Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions models/chatglm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ def chat(self) -> str:
history = []
while True:
text = input("用户输入:")
last_response = ""
for response, history in self.model.stream_chat(self.tokenizer, text, history=history):
print(response, end='\r')
print(response[len(last_response):], end='')
last_response = response
print(flush=True)

def run_web_demo(self, input_text, history=[]):
Expand All @@ -45,4 +47,4 @@ def run(self, text, history=[]):
return self.model.chat(self.tokenizer, text, history=history)

def get_model(args):
return ChatGLMMdoel(args)
return ChatGLMMdoel(args)