You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Using string instead of tokens to check for antiprompt,
549
+
# It is more reliable than tokens for interactive mode.
550
+
generated_str=""
535
551
whileself.params.interactive:
536
552
self.set_color(util.CONSOLE_COLOR_USER_INPUT)
537
553
if (self.params.instruct):
@@ -546,6 +562,10 @@ def interact(self):
546
562
try:
547
563
foriinself.output():
548
564
print(i,end="",flush=True)
565
+
generated_str+=i
566
+
forapinself.params.antiprompt:
567
+
ifgenerated_str.endswith(ap):
568
+
raiseKeyboardInterrupt
549
569
exceptKeyboardInterrupt:
550
570
self.set_color(util.CONSOLE_COLOR_DEFAULT)
551
571
ifnotself.params.instruct:
@@ -561,7 +581,7 @@ def interact(self):
561
581
time_now=datetime.now()
562
582
prompt=f"""Text transcript of a never ending dialog, where {USER_NAME} interacts with an AI assistant named {AI_NAME}.
563
583
{AI_NAME} is helpful, kind, honest, friendly, good at writing and never fails to answer {USER_NAME}’s requests immediately and with details and precision.
564
-
There are no annotations like (30 seconds passed...) or (to himself), just what {USER_NAME} and {AI_NAME} say aloud to each other.
584
+
Transcript below contains only the recorded dialog between two, without any annotations like (30 seconds passed...) or (to himself), just what {USER_NAME} and {AI_NAME} say aloud to each other.
565
585
The dialog lasts for years, the entirety of it is shared below. It's 10000 pages long.
566
586
The transcript only includes text, it does not include markup like HTML and Markdown.
567
587
@@ -575,8 +595,11 @@ def interact(self):
575
595
{AI_NAME}: A cat is a domestic species of small carnivorous mammal. It is the only domesticated species in the family Felidae.
0 commit comments