Spaces:
Runtime error
Runtime error
fix: 修复_truncate_and_close_json从零构建JSON,避免无效前缀
Browse files- modeling_agent.py: 重构JSON时不再使用cleaned[:schemes_match.start()]
- recommendation_agent.py: 同样修复indicators匹配的前缀问题
- 防止修复后的JSON以非法字符开头
Files changed (2)
554 unmodified lines555556557558559560561562563564554 unmodified lineselse:break# 重构JSONif complete_objects:schemes_str = ',\n'.join(complete_objects)repaired = cleaned[:schemes_match.start()] + '{\n "schemes": [\n' + schemes_str + '\n ]\n}'logger.info(f"✅ 截断修复:保留了 {len(complete_objects)} 个完整方案")return repaired554 unmodified lines555556557558559560561562563564554 unmodified lineselse:break# 重构JSON - 从零构建,避免不完整的前缀if complete_objects:schemes_str = ',\n'.join(complete_objects)repaired = '{\n "schemes": [\n' + schemes_str + '\n ]\n}'logger.info(f"✅ 截断修复:保留了 {len(complete_objects)} 个完整方案")return repaired
534 unmodified lines535536537538539540541542543534 unmodified lineselse:breakif complete_objects:indicators_str = ',\n'.join(complete_objects)repaired = cleaned[:indicators_match.start()] + '{\n "indicators": [\n' + indicators_str + '\n ]\n}'logger.info(f"✅ 截断修复:保留了 {len(complete_objects)} 个完整指标")return repaired534 unmodified lines535536537538539540541542543544534 unmodified lineselse:break# 重构JSON - 从零构建,避免不完整的前缀if complete_objects:indicators_str = ',\n'.join(complete_objects)repaired = '{\n "indicators": [\n' + indicators_str + '\n ]\n}'logger.info(f"✅ 截断修复:保留了 {len(complete_objects)} 个完整指标")return repaired
agents/modeling_agent.py+2-2
agents/recommendation_agent.py+2-1