
hughhuangandClaude Sonnet 4.5
1f08977ca7
fix: 修复 kbs-text 系统数据结构兼容性问题
问题描述:
- kbs-text 系统的所有评估指标评分异常(检索上下文数量为 0)
- kbs-excel 系统工作正常
- 根本原因是数据结构差异导致检索上下文提取失败
技术细节:
- kbs-text: {question_id, response: {data: [{fileSource}]}}
- kbs-excel: {question_id, data: [{fileSource}]}
修复内容:
1. 修改 extract_retrieved_contexts 方法
- 增加对 kbs-text 数据格式的兼容处理
- 当顶层没有 data 键时,尝试从 response.data 获取
2. 修改 convert_to_ragas_format 方法
- 增加对 kbs-text 数据格式的兼容处理
- 确保能正确提取问题和答案内容
验证结果:
- kbs-text 检索上下文数量:0 -> 12 ✅
- kbs-text response 长度:0 -> 449 ✅
- kbs-excel 兼容性保持正常 ✅
影响范围:
- src/transformers/data_converter.py (94-136, 182-211)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>