Skip to content
Merged
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
13 changes: 10 additions & 3 deletions xtuner/tools/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def get_input():
sentinel = '' # ends when this string is seen
result = None
while result is None:
print('\ndouble enter to end input >>> ', end='')
print(('\ndouble enter to end input (EXIT: exit chat, '
'RESET: reset history) >>> '),
end='')
try:
result = '\n'.join(iter(input, sentinel))
except UnicodeDecodeError:
Expand Down Expand Up @@ -171,8 +173,13 @@ def main():
inputs = ''
while True:
text = get_input()

if text == 'exit':
while text.strip() == 'RESET':
print('Log: History responses have been removed!')
n_turn = 0
inputs = ''
text = get_input()
if text.strip() == 'EXIT':
print('Log: Exit!')
exit(0)
if args.prompt_template is not None:
template = PROMPT_TEMPLATE[args.prompt_template]
Expand Down