适配手机端1.0,
This commit is contained in:
15
toolbox.py
15
toolbox.py
@ -292,11 +292,14 @@ def markdown_convertion(txt):
|
||||
"""
|
||||
pre = '<div class="md-message">'
|
||||
suf = '</div>'
|
||||
raw_hide = f'<div class="raw-message hideM">%s</div>'
|
||||
raw_pre = '<div class="raw-message hideM">'
|
||||
raw_suf = '</div>'
|
||||
if txt.startswith(pre) and txt.endswith(suf):
|
||||
# print('警告,输入了已经经过转化的字符串,二次转化可能出问题')
|
||||
return txt # 已经被转化过,不需要再次转化
|
||||
|
||||
if txt.startswith(raw_pre) and txt.endswith(raw_suf):
|
||||
return txt # 已经被转化过,不需要再次转化
|
||||
raw_hide = raw_pre + txt + raw_suf
|
||||
markdown_extension_configs = {
|
||||
'mdx_math': {
|
||||
'enable_dollar_delimiter': True,
|
||||
@ -357,10 +360,10 @@ def markdown_convertion(txt):
|
||||
convert_stage_2_2, n = re.subn(find_equation_pattern, replace_math_render, convert_stage_1_resp, flags=re.DOTALL)
|
||||
# cat them together
|
||||
context = pre + convert_stage_2_1 + f'{split}' + convert_stage_2_2 + suf
|
||||
return raw_hide.replace('%s', func_box.pattern_html(context)) + context
|
||||
return raw_hide + context # 破坏html 结构,并显示源码
|
||||
else:
|
||||
context = pre + markdown.markdown(txt, extensions=['fenced_code', 'codehilite', 'tables', 'sane_lists']) + suf
|
||||
return raw_hide.replace('%s', func_box.pattern_html(context)) + context
|
||||
return raw_hide + context # 破坏html 结构,并显示源码
|
||||
|
||||
|
||||
def close_up_code_segment_during_stream(gpt_reply):
|
||||
@ -514,8 +517,8 @@ def get_user_upload(chatbot, ipaddr: gr.Request):
|
||||
file_link = "<br>".join([f'{func_box.html_view_blank(f"{root}/{i}")}' for i in file])
|
||||
history += f'| {count_num} | {root} | {file_link} |\n'
|
||||
count_num += 1
|
||||
chatbot.append(['Loading....',
|
||||
f'[Local Message] 请自行复制以下目录 or 目录+文件, 填入输入框以供函数区高亮按钮使用,'
|
||||
chatbot.append(['Load Submission History....',
|
||||
f'[Local Message] 请自行复制以下目录 or 目录+文件, 填入输入框以供函数区高亮按钮使用\n\n'
|
||||
f'{func_box.html_tag_color("提交前记得请检查头尾空格哦~")}\n\n'
|
||||
f'{history}'
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user