整合 dsAiTeachingModel 接口

This commit is contained in:
chengminglong
2025-08-18 10:20:16 +08:00
parent 7b149f0f51
commit b2d5069d79
39 changed files with 1705 additions and 3 deletions

View File

@@ -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("\\", "/")