mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04:00
Improve the chat prompt design
This commit is contained in:
parent
139e2f0ab4
commit
23f94f559a
@ -258,7 +258,7 @@ if args.chat or args.cai_chat:
|
|||||||
while i >= 0 and len(encode(''.join(rows), tokens)[0]) < 2048-tokens:
|
while i >= 0 and len(encode(''.join(rows), tokens)[0]) < 2048-tokens:
|
||||||
rows.insert(1, f"{name2}: {history[i][1].strip()}\n")
|
rows.insert(1, f"{name2}: {history[i][1].strip()}\n")
|
||||||
count += 1
|
count += 1
|
||||||
if not (i == 0 and len(history[i][0]) == 0):
|
if not (history[i][0] == '<|BEGIN-VISIBLE-CHAT|>'):
|
||||||
rows.insert(1, f"{name1}: {history[i][0].strip()}\n")
|
rows.insert(1, f"{name1}: {history[i][0].strip()}\n")
|
||||||
count += 1
|
count += 1
|
||||||
i -= 1
|
i -= 1
|
||||||
@ -272,7 +272,6 @@ if args.chat or args.cai_chat:
|
|||||||
rows.pop(1)
|
rows.pop(1)
|
||||||
|
|
||||||
question = ''.join(rows)
|
question = ''.join(rows)
|
||||||
question = question.replace('<|BEGIN-VISIBLE-CHAT|>', '')
|
|
||||||
return question
|
return question
|
||||||
|
|
||||||
def remove_example_dialogue_from_history(history):
|
def remove_example_dialogue_from_history(history):
|
||||||
|
Loading…
Reference in New Issue
Block a user