code dem fix

这个提交包含在:
binary-husky
2024-01-13 18:23:06 +08:00
父节点 28eae2f80e
当前提交 9643e1c25f
共有 3 个文件被更改,包括 49 次插入4 次删除

查看文件

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

查看文件

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

查看文件

@@ -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(): def validate_path():
import os, sys import os, sys