code dem fix

This commit is contained in:
binary-husky 2024-01-13 18:23:06 +08:00
parent 28eae2f80e
commit 9643e1c25f
3 changed files with 49 additions and 4 deletions

View File

@ -7,6 +7,7 @@ protobuf==3.18
transformers>=4.27.1
scipdf_parser>=0.52
python-markdown-math
pymdown-extensions
websocket-client
beautifulsoup4
prompt_toolkit

View File

@ -195,11 +195,11 @@ def markdown_convertion(txt):
find_equation_pattern = r'<script type="math/tex(?:.*?)>(.*?)</script>'
txt = fix_markdown_indent(txt)
txt = fix_code_segment_indent(txt)
# txt = fix_code_segment_indent(txt)
if is_equation(txt): # 有$标识的公式符号,且没有代码段```的标识
# convert everything to html format
split = markdown.markdown(text='---')
convert_stage_1 = markdown.markdown(text=txt, extensions=['sane_lists', 'tables', 'mdx_math', 'fenced_code'],
convert_stage_1 = markdown.markdown(text=txt, extensions=['sane_lists', 'tables', 'mdx_math', 'pymdownx.superfences'],
extension_configs=markdown_extension_configs)
convert_stage_1 = markdown_bug_hunt(convert_stage_1)
# 1. convert to easy-to-copy tex (do not render math)
@ -209,7 +209,7 @@ def markdown_convertion(txt):
# cat them together
return pre + convert_stage_2_1 + f'{split}' + convert_stage_2_2 + suf
else:
return pre + markdown.markdown(txt, extensions=['sane_lists', 'tables', 'fenced_code', 'codehilite']) + suf
return pre + markdown.markdown(txt, extensions=['sane_lists', 'tables', 'pymdownx.superfences', 'codehilite']) + suf
def close_up_code_segment_during_stream(gpt_reply):
@ -250,7 +250,7 @@ def format_io(self, y):
if gpt_reply is not None: gpt_reply = close_up_code_segment_during_stream(gpt_reply)
# process
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.markdown(i_ask, extensions=['pymdownx.superfences', 'tables']),
None if gpt_reply is None else markdown_convertion(gpt_reply)
)
return y

View File

@ -73,6 +73,50 @@ md = """
"""
md = """
要将NTFS格式转换为ext4格式需要执行以下步骤
1. 首先确保你的NTFS分区已经挂载可以使用`df -lh`命令来检查
2. 创建一个ext4文件系统打开终端并执行以下命令
```
sudo mkfs.ext4 /dev/sdc1
```
注意将`/dev/sdc1`替换为你要转换的NTFS分区的设备名称
3. 等待文件系统创建完成这可能需要一些时间
4. 将新的ext4文件系统挂载到指定的挂载点执行以下命令
```
sudo mkdir /mnt/mydrive
sudo mount -t ext4 /dev/sdc1 /mnt/mydrive
```
注意将`/mnt/mydrive`替换为你要挂载的目录
5. 现在可以将数据从原始NTFS分区复制到新的ext4分区执行以下命令
```
sudo rsync -avxP /media/fuqingxu/eb63a8fa-cee9-48a5-9f05-b1388c3fda9e /mnt/mydrive
```
注意将`/media/fuqingxu/eb63a8fa-cee9-48a5-9f05-b1388c3fda9e`替换为你的原始NTFS分区的挂载点
6. 等待数据复制完成这可能需要一些时间具体取决于数据量
7. 确认数据已经成功复制到新的ext4分区后可以卸载原始NTFS分区执行以下命令
```
sudo umount /media/fuqingxu/eb63a8fa-cee9-48a5-9f05-b1388c3fda9e
```
8. 现在你可以将新的ext4分区重新挂载到原来的位置执行以下命令
```
sudo umount /mnt/mydrive
sudo mount -t ext4 /dev/sdc1 /media/fuqingxu/eb63a8fa-cee9-48a5-9f05-b1388c3fda9e
```
完成上述步骤后NTFS分区将被转换为ext4格式并且数据将被复制到新的分区中请确保在执行任何操作之前备份重要数据
"""
def validate_path():
import os, sys