瀏覽代碼

Fix: docx parse error. (#8600)

### What problem does this PR solve?

docx parse error.

![image](https://github.com/user-attachments/assets/efbe6d1b-10c8-415e-b693-a86f73e1ffa6)

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

### What problem does this PR solve?

Some docx parse with naive cause error. `block.style.name` in Function
`__get_nearest_title` will be None in some case.

### Type of change

- [ ] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: wenxuan.zhang <wenxuan.zhang@chinacreator.com>
tags/v0.20.0
wenxuan.zhang 4 月之前
父節點
當前提交
f586dd0a96
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. 1
    1
      rag/app/naive.py

+ 1
- 1
rag/app/naive.py 查看文件

if block_type != 'p': if block_type != 'p':
continue continue
if block.style and re.search(r"Heading\s*(\d+)", block.style.name, re.I):
if block.style and block.style.name and re.search(r"Heading\s*(\d+)", block.style.name, re.I):
try: try:
level_match = re.search(r"(\d+)", block.style.name) level_match = re.search(r"(\d+)", block.style.name)
if level_match: if level_match:

Loading…
取消
儲存