优化界面显示|将say也转换为markdwon 格式,并且不做多处理|增强user 和 bot 的对比
This commit is contained in:
10
toolbox.py
10
toolbox.py
@ -249,10 +249,10 @@ def text_divide_paragraph(text):
|
||||
return text
|
||||
else:
|
||||
# wtf input
|
||||
lines = text.split("\n")
|
||||
# lines = text.split("\n")
|
||||
# for i, line in enumerate(lines):
|
||||
# lines[i] = lines[i].replace(" ", " ")
|
||||
text = "</br>".join(lines)
|
||||
# text = "</br>".join(lines)
|
||||
return text
|
||||
|
||||
@lru_cache(maxsize=128) # 使用 lru缓存 加快转换速度
|
||||
@ -365,11 +365,11 @@ def format_io(self, y):
|
||||
if y is None or y == []:
|
||||
return []
|
||||
i_ask, gpt_reply = y[-1]
|
||||
i_ask = text_divide_paragraph(i_ask) # 输入部分太自由,预处理一波
|
||||
# i_ask = text_divide_paragraph(i_ask) # 输入部分太自由,预处理一波
|
||||
gpt_reply = close_up_code_segment_during_stream(gpt_reply) # 当代码输出半截的时候,试着补上后个```
|
||||
y[-1] = (
|
||||
None if i_ask is None else markdown.markdown(i_ask, extensions=['fenced_code', 'tables']),
|
||||
#None if i_ask is None else markdown_convertion(i_ask),
|
||||
# None if i_ask is None else markdown.markdown(i_ask, extensions=['fenced_code', 'tables']),
|
||||
None if i_ask is None else markdown_convertion(i_ask),
|
||||
None if gpt_reply is None else markdown_convertion(gpt_reply)
|
||||
)
|
||||
return y
|
||||
|
||||
Reference in New Issue
Block a user