extract images of attachments uploaded during conversations
修复描述:因为返回值类型改变,导致原本接收单个值的变量报错,通过解包后修复
修复前:
修复后:
实现的功能:提取对话时上传的附件的图片,并输出用户指定的图片
实现思路: 1.采用已有的图片提取功能 2.在文件分析工具中,识别文件类型,获取sdk层返回的图片信息,图片本身存入minio,图片元数据和纯文本合并后统一传给llm分析 3.llm提取图片url并是用图片分析工具分析,最终在对话部分输出用户指定的图片。来源部分可以显示图片元数据、图片部分可以显示提取到的图片
实现效果展示:
The image extraction logic from PDF files is a useful addition. Please ensure edge cases (corrupted images, unsupported formats) are handled gracefully and covered by tests.
Bug 3: chunks_count assertion is now wrong
test/backend/services/test_data_process_service.py line 2123 — the test asserts result["chunks_count"] == 3, but the implementation now returns len(text_chunks) + len(images_chunks). With the mock returning text_chunks=2 and images_chunks=3, the assertion should be 5, not 3. The comment includes chunk without 'content' is now stale and misleading.
Fix: update the assertion to self.assertEqual(result["chunks_count"], 5) and update the comment to reflect the new logic.
解决了已存在的问题,修改内容如下: 1.调用detect_file_type()进行了类型验证,保证传入的是bytes类型; 2.加入MinIO上传失败处理; 3.chunks_count拆分为文本chunk和图片元数据chunk; 4.chunks, _ = data_process.file_process(...)已修改,后续也使用了图片信息; 5.图片上传加入了尺寸验证; 6.将原来硬编码的文件夹名称作为了常量; 7.process_uploaded_text_file()中的image_descriptions格式改为使用——分隔符; 8._build_search_results方法使用的索引值来源已修改; 9.单元测试已修改,已通过。
#3078 问题已解决。 修改方式:保留输入过滤作为安全层
#2720 问题已解决。 修改方式:加入MinIO上传失败处理
#3176
问题已解决。
存在的问题:
无法解析在知识库中上传的.epub类型文件
失败原因:
未安装pandoc
解决方式: 构建data-process镜像时安装pandoc
解决后的效果:
1.安装了pandoc
2.成功解析.epub文件
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:loudspeaker: Thoughts on this report? Let us know!