default trim_stop to true, which trims any tokens after a stop sequence and the stop sequence itself. This is potentially a breaking change.

This commit is contained in:
Concedo 2024-12-03 22:44:10 +08:00
parent 7d11d2946c
commit 52cc908f7f
3 changed files with 18 additions and 14 deletions

View file

@ -976,7 +976,7 @@ def generate(genparams, is_quiet=False, stream_flag=False):
grammar = genparams.get('grammar', '')
grammar_retain_state = genparams.get('grammar_retain_state', False)
genkey = genparams.get('genkey', '')
trimstop = genparams.get('trim_stop', False)
trimstop = genparams.get('trim_stop', True)
quiet = is_quiet
dynatemp_range = genparams.get('dynatemp_range', 0.0)
dynatemp_exponent = genparams.get('dynatemp_exponent', 1.0)
@ -1723,7 +1723,7 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
if tokenStr!="" or streamDone:
sseq = genparams.get('stop_sequence', [])
trimstop = genparams.get('trim_stop', False)
trimstop = genparams.get('trim_stop', True)
if trimstop and not streamDone and string_contains_or_overlaps_sequence_substring(tokenStr,sseq):
tokenReserve += tokenStr
await asyncio.sleep(async_sleep_short) #if a stop sequence could trigger soon, do not send output