diff --git a/dsRag/Test/T1.py b/dsRag/Test/T1_extract_images_from_docx.py similarity index 59% rename from dsRag/Test/T1.py rename to dsRag/Test/T1_extract_images_from_docx.py index d23cfb1c..72c9a75a 100644 --- a/dsRag/Test/T1.py +++ b/dsRag/Test/T1_extract_images_from_docx.py @@ -1,11 +1,8 @@ -import os - from Util.WordImageUtil import extract_images_from_docx # 使用示例 if __name__ == "__main__": - word_path = "d:\\dsWork\\dsProject\\dsRag\\Test\\带图的WORD文档.docx" + word_path = "d:\\dsWork\\dsProject\\dsRag\\static\\Test\\带图的WORD文档_MATH_3.docx" output_dir = "../static/Images" # 图片输出目录 - os.makedirs(output_dir, exist_ok=True) extract_images_from_docx(word_path, output_dir) diff --git a/dsRag/Test/T2.py b/dsRag/Test/T2_read_word_content.py similarity index 77% rename from dsRag/Test/T2.py rename to dsRag/Test/T2_read_word_content.py index b4b22ca0..06bf627a 100644 --- a/dsRag/Test/T2.py +++ b/dsRag/Test/T2_read_word_content.py @@ -1,5 +1,3 @@ -import os - import docx @@ -32,10 +30,5 @@ def read_word_content(docx_path): if __name__ == "__main__": - # 示例用法 - # 请将 'your_document.docx' 替换为你的Word文档路径 word_document_path = "d:\\dsWork\\dsProject\\dsRag\\static\\Test\\带图的WORD文档_MATH_3.docx" - if os.path.exists(word_document_path): - read_word_content(word_document_path) - else: - print(f"文件不存在: {word_document_path}") + read_word_content(word_document_path) diff --git a/dsRag/Test/带图的WORD文档.docx b/dsRag/Test/带图的WORD文档.docx index d65d78e4..4c081e2c 100644 Binary files a/dsRag/Test/带图的WORD文档.docx and b/dsRag/Test/带图的WORD文档.docx differ diff --git a/dsRag/static/Images/2.png b/dsRag/static/Images/2.png new file mode 100644 index 00000000..73c7f205 Binary files /dev/null and b/dsRag/static/Images/2.png differ