Fixes #2331, IndexError: string index out of range (#2383)

This commit is contained in:
matatonic 2023-05-30 21:07:40 -04:00 committed by GitHub
parent b984a44f47
commit e5b756ecfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -346,7 +346,7 @@ class Handler(BaseHTTPRequestHandler):
# can't really truncate the system messages # can't really truncate the system messages
system_msg = '\n'.join(system_msgs) system_msg = '\n'.join(system_msgs)
if system_msg[-1] != '\n': if system_msg and system_msg[-1] != '\n':
system_msg = system_msg + '\n' system_msg = system_msg + '\n'
system_token_count = len(encode(system_msg)[0]) system_token_count = len(encode(system_msg)[0])