mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-25 09:19:23 +01:00
Prevent <ul> lists from flickering during streaming
This commit is contained in:
parent
8b56fc993a
commit
9a202f7fb2
@ -66,14 +66,14 @@ def convert_to_markdown(string):
|
||||
result = result.strip()
|
||||
|
||||
# Unfinished list, like "\n1.". A |delete| string is added and then
|
||||
# removed to force a <ol> to be generated instead of a <p>.
|
||||
if re.search(r'(\d+\.?)$', result):
|
||||
# removed to force a <ol> or <ul> to be generated instead of a <p>.
|
||||
if re.search(r'(\n\d+\.?|\n\*\s*)$', result):
|
||||
delete_str = '|delete|'
|
||||
|
||||
if not result.endswith('.'):
|
||||
if re.search(r'(\d+\.?)$', result) and not result.endswith('.'):
|
||||
result += '.'
|
||||
|
||||
result = re.sub(r'(\d+\.)$', r'\g<1> ' + delete_str, result)
|
||||
result = re.sub(r'(\n\d+\.?|\n\*\s*)$', r'\g<1> ' + delete_str, result)
|
||||
|
||||
html_output = markdown.markdown(result, extensions=['fenced_code', 'tables'])
|
||||
pos = html_output.rfind(delete_str)
|
||||
|
Loading…
Reference in New Issue
Block a user