156 lines
4.3 KiB
Python
156 lines
4.3 KiB
Python
"""
|
||
报告生成测试辅助函数
|
||
"""
|
||
import json
|
||
|
||
|
||
def create_mock_section1():
|
||
"""创建模拟的章节一数据"""
|
||
return {
|
||
"enterprise_background": {
|
||
"description": "企业背景描述"
|
||
},
|
||
"informatization_status": {
|
||
"overview": "概述",
|
||
"private_cloud": {
|
||
"title": "私有云",
|
||
"description": "描述"
|
||
},
|
||
"public_cloud": {
|
||
"title": "公有云",
|
||
"description": "描述"
|
||
}
|
||
},
|
||
"business_data_flow": {
|
||
"overview": "概述",
|
||
"manufacturing": {
|
||
"title": "制造",
|
||
"description": "描述"
|
||
},
|
||
"logistics": {
|
||
"title": "物流",
|
||
"description": "描述"
|
||
},
|
||
"retail": {
|
||
"title": "零售",
|
||
"description": "描述"
|
||
},
|
||
"data_aggregation": {
|
||
"title": "数据聚合",
|
||
"description": "描述"
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
def create_mock_section2(data_source_structured=70, data_source_semi_structured=30):
|
||
"""创建模拟的章节二数据"""
|
||
return {
|
||
"summary": {
|
||
"total_data_volume": "100TB",
|
||
"total_data_objects": {
|
||
"tables": "50 张表",
|
||
"fields": "300 个字段"
|
||
}
|
||
},
|
||
"storage_distribution": [
|
||
{
|
||
"category": "交易数据",
|
||
"volume": "50TB",
|
||
"storage_type": "MySQL",
|
||
"color": "blue"
|
||
}
|
||
],
|
||
"data_source_structure": {
|
||
"structured": data_source_structured,
|
||
"semi_structured": data_source_semi_structured
|
||
}
|
||
}
|
||
|
||
|
||
def create_mock_section3():
|
||
"""创建模拟的章节三数据"""
|
||
return {
|
||
"overview": {
|
||
"asset_count": 1,
|
||
"high_value_assets": ["测试资产"],
|
||
"description": "概述描述"
|
||
},
|
||
"assets": [
|
||
{
|
||
"id": "asset_001",
|
||
"title": "测试资产",
|
||
"subtitle": "测试副标题",
|
||
"composition": {
|
||
"description": "构成描述",
|
||
"core_tables": ["test_table_01"]
|
||
},
|
||
"application_scenarios": {
|
||
"description": "应用场景描述"
|
||
},
|
||
"compliance_risks": {
|
||
"warnings": [
|
||
{
|
||
"type": "PII风险",
|
||
"content": "测试警告",
|
||
"highlights": []
|
||
}
|
||
]
|
||
}
|
||
}
|
||
]
|
||
}
|
||
|
||
|
||
def create_mock_section4():
|
||
"""创建模拟的章节四数据"""
|
||
return {
|
||
"compliance_remediation": {
|
||
"title": "合规整改",
|
||
"items": [
|
||
{
|
||
"order": 1,
|
||
"category": "分类",
|
||
"description": "详细建议",
|
||
"code_references": []
|
||
}
|
||
]
|
||
},
|
||
"technical_evolution": {
|
||
"title": "技术演进",
|
||
"description": "技术建议描述",
|
||
"technologies": ["技术1", "技术2"]
|
||
},
|
||
"value_deepening": {
|
||
"title": "价值深化",
|
||
"items": [
|
||
{
|
||
"description": "建议描述",
|
||
"scenarios": []
|
||
}
|
||
]
|
||
}
|
||
}
|
||
|
||
|
||
def create_mock_llm_response_1_2(data_source_structured=70, data_source_semi_structured=30):
|
||
"""创建模拟的LLM响应(章节1和2)"""
|
||
return json.dumps({
|
||
"section1": create_mock_section1(),
|
||
"section2": create_mock_section2(data_source_structured, data_source_semi_structured)
|
||
}, ensure_ascii=False)
|
||
|
||
|
||
def create_mock_llm_response_3():
|
||
"""创建模拟的LLM响应(章节3)"""
|
||
return json.dumps({
|
||
"section3": create_mock_section3()
|
||
}, ensure_ascii=False)
|
||
|
||
|
||
def create_mock_llm_response_4():
|
||
"""创建模拟的LLM响应(章节4)"""
|
||
return json.dumps({
|
||
"section4": create_mock_section4()
|
||
}, ensure_ascii=False)
|