整合 dsAiTeachingModel 接口
This commit is contained in:
@@ -6,6 +6,7 @@ import uuid
|
||||
from PIL import Image
|
||||
import os
|
||||
|
||||
from networkx.algorithms.bipartite.centrality import betweenness_centrality
|
||||
|
||||
# 或者如果你想更详细地控制日志输出
|
||||
logger = logging.getLogger('DocxUtil')
|
||||
@@ -114,8 +115,20 @@ def get_docx_content_by_pandoc(docx_file):
|
||||
pos = line.find(")")
|
||||
q = line[:pos + 1]
|
||||
q = q.replace("./static", ".")
|
||||
# q = q[4:-1]
|
||||
# q='<img src="'+q+'" alt="我是图片">'
|
||||
# Modify by Kalman.CHENG ☆: 增加逻辑对图片路径处理,在(和static之间加上/
|
||||
left_idx = line.find("(")
|
||||
static_idx = line.find("static")
|
||||
if left_idx == -1 or static_idx == -1 or left_idx > static_idx:
|
||||
print("路径中不包含(+~+static的已知格式")
|
||||
else:
|
||||
between_content = q[left_idx+1:static_idx].strip()
|
||||
if between_content:
|
||||
q = q[:left_idx+1] + '\\' + q[static_idx:]
|
||||
else:
|
||||
q = q[:static_idx] + '\\' + q[static_idx:]
|
||||
print(f"q3:{q}")
|
||||
#q = q[4:-1]
|
||||
#q='<img src="'+q+'" alt="我是图片">'
|
||||
img_idx += 1
|
||||
content += q + "\n"
|
||||
else:
|
||||
@@ -126,4 +139,4 @@ def get_docx_content_by_pandoc(docx_file):
|
||||
f.write(content)
|
||||
# 删除临时文件 output_file
|
||||
# os.remove(temp_markdown)
|
||||
return content.replace("\n\n", "\n").replace("\\", "")
|
||||
return content.replace("\n\n", "\n").replace("\\", "/")
|
||||
|
Reference in New Issue
Block a user