更新最新代码

This commit is contained in:
2025-07-04 13:52:08 +08:00
parent af64d962eb
commit be98bb1495
52 changed files with 139981 additions and 5788 deletions
+46
View File
@@ -0,0 +1,46 @@
{"name": "杆塔总基数", "query": "从【架空输电线路本体工程/基础工程】及其子孙项目划分中查找编码中包含【YX2-1~7】的所有【定额】的【数量】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n path = '架空输电线路本体工程/基础工程'\n quantity_type = '定额'\n code = 'YX2-1/YX2-2/YX2-3/YX2-4/YX2-5/YX2-6/YX2-7'\n result_dict = project.get_quantities_node_by_parent_and_code(path, quantity_type, code)\n status = result_dict.get('status', False)\n if not status:\n return result_dict\n data = result_dict.get('data', [])\n total_quantity = 0.0\n for item in data:\n if isinstance(item, dict) and '数量' in item:\n try:\n total_quantity += float(item['数量'])\n except (ValueError, TypeError):\n continue\n return {'code': 200, 'message': 'Ok', 'status': True, 'data': total_quantity}"}
{"name": "角钢塔_塔材量", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【角钢】的所有【主材】的【数量】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_quantities_node_by_parent_and_name(\n parent_path=\"架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立\",\n partial_name=\"角钢\",\n quantity_type=\"主材\"\n )\n status = result_dict.get('status', False)\n if not status:\n return result_dict\n \n data = result_dict.get('data', [])\n total_quantity = 0.0\n \n for item in data:\n if isinstance(item, dict) and item.get('类型') == '主材' and '角钢' in item.get('name', ''):\n try:\n quantity = float(item.get('数量', 0))\n total_quantity += quantity\n except (ValueError, TypeError):\n continue\n \n return {\n 'code': 200,\n 'message': 'Ok',\n 'status': True,\n 'data': total_quantity\n }"}
{"name": "角钢塔_其中:高强钢塔材量", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【角钢、高强】的所有【主材】的【数量】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n path = \"架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立\"\n result = project.get_quantities_node_by_parent_and_name(path, \"角钢、高强\", \"主材\")\n if not result.get('status', False):\n return result\n \n total_quantity = 0.0\n for item in result.get('data', []):\n if isinstance(item, dict) and item.get('类型') == '主材' and '数量' in item:\n try:\n total_quantity += float(item['数量'])\n except (ValueError, TypeError):\n continue\n \n return {\n 'code': 200,\n 'message': 'Ok',\n 'status': True,\n 'data': total_quantity\n }"}
{"name": "角钢塔_塔材装材费_元", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【角钢】的所有【主材】的【单价】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n \n parent_path = \"架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立\"\n quantity_type = \"主材\"\n partial_name = \"角钢\"\n \n result_dict = project.get_quantities_node_by_parent_and_name(parent_path, partial_name, quantity_type)\n status = result_dict.get('status', False)\n data = result_dict.get('data', [])\n \n if not status:\n return {'code': 201, 'message': '查询失败: ' + result_dict.get('message', ''), 'status': False, 'data': []}\n \n total_price = 0.0\n for item in data:\n if isinstance(item, Material) and '单价含税' in item.__dict__:\n try:\n price = float(item.单价含税)\n total_price += price\n except (ValueError, TypeError):\n continue\n \n return {'code': 200, 'message': 'Ok', 'status': True, 'data': total_price}"}
{"name": "角钢塔_其中:高强钢塔材费用_元", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【角钢、高强】的所有【主材】的【单价】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n \n parent_path = \"架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立\"\n quantity_type = \"主材\"\n partial_name = \"角钢、高强\"\n \n result_dict = project.get_quantities_node_by_parent_and_name(parent_path, partial_name, quantity_type)\n status = result_dict.get('status', False)\n data = result_dict.get('data', [])\n \n if not status:\n return {'code': 201, 'message': '查询失败: ' + result_dict.get('message', ''), 'status': False, 'data': []}\n \n total_price = 0.0\n for item in data:\n if isinstance(item, dict) and '单价含税' in item:\n try:\n price = float(item['单价含税'])\n total_price += price\n except (ValueError, TypeError):\n continue\n \n return {'code': 200, 'message': 'Ok', 'status': True, 'data': total_price}"}
{"name": "钢管塔_塔材量", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【钢管塔】的所有【主材】的【数量】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_quantities_node_by_parent_and_name(\n parent_path=\"架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立\",\n partial_name=\"钢管塔\",\n quantity_type=\"主材\"\n )\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n data = result_dict.get('data', [])\n \n if not status:\n return {'code': 201, 'message': message, 'status': False, 'data': 0}\n \n total_quantity = 0\n for item in data:\n if isinstance(item, dict) and item.get('类型') == '主材' and '钢管塔' in item.get('name', ''):\n try:\n quantity = float(item.get('数量', 0))\n total_quantity += quantity\n except (ValueError, TypeError):\n continue\n \n return {'code': 200, 'message': 'Ok', 'status': True, 'data': total_quantity}"}
{"name": "钢管塔_钢管价格_元", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【钢管塔】的所有【主材】的【单价】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n parent_path = \"架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立\"\n result_dict = project.get_quantities_node_by_parent_and_name(parent_path, \"钢管塔\", \"主材\")\n status = result_dict.get('status', False)\n data = result_dict.get('data', [])\n if not status:\n return result_dict\n \n total_price = 0.0\n for item in data:\n if isinstance(item, Material) and \"钢管塔\" in item.name:\n try:\n price = float(item.单价含税) if item.单价含税 else 0.0\n total_price += price\n except (ValueError, AttributeError):\n continue\n \n return {\n 'code': 200,\n 'message': 'Ok',\n 'status': True,\n 'data': total_price\n }"}
{"name": "钢管杆_塔材量", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【钢管杆】的所有【主材】的【数量】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n path = \"架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立\"\n result_dict = project.get_quantities_node_by_parent_and_name(path, \"钢管杆\", \"主材\")\n status = result_dict.get('status', False)\n data = result_dict.get('data', [])\n if not status:\n return result_dict\n \n total_quantity = 0.0\n for item in data:\n if isinstance(item, Material) and \"钢管杆\" in item.name:\n try:\n quantity = float(item.数量) if item.数量 else 0.0\n total_quantity += quantity\n except (ValueError, TypeError):\n continue\n \n return {\n 'code': 200,\n 'message': 'Ok',\n 'status': True,\n 'data': total_quantity\n }"}
{"name": "钢管杆_钢管价格_元", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【钢管杆】的所有【主材】的【单价】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result = project.get_division_node_by_parent_and_name(\n parent_path=\"架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立\",\n partial_name=\"钢管杆\"\n )\n if not result.get('status', False):\n return result\n \n total_price = 0.0\n for division in result.get('data', []):\n materials_result = project.get_quantities_node_by_parent_and_name(\n parent_path=division['constraints']['path'],\n partial_name=\"主材\",\n quantity_type=\"主材\"\n )\n if not materials_result.get('status', False):\n continue\n \n for material in materials_result.get('data', []):\n if \"钢管杆\" in material.get('name', ''):\n price = float(material.get('单价含税', 0)) if material.get('单价含税') else 0.0\n total_price += price\n \n return {\n 'code': 200,\n 'message': 'Ok',\n 'status': True,\n 'data': total_price\n }"}
{"name": "导线及线材_分裂数", "query": "从【架空输电线路本体工程/架线工程】及其子孙项目划分中查找编码中包含【['YX5-67', 'YX5-68', 'YX5-69', 'YX5-78', 'YX5-79', 'YX5-59', 'YX5-60', 'YX5-61', 'YX5-62', 'YX5-63', 'YX5-64', 'YX5-65', 'YX5-66', 'YX5-74', 'YX5-75', 'YX5-76', 'YX5-77', 'YX5-52', 'YX5-53', 'YX5-54', 'YX5-55', 'YX5-56', 'YX5-57', 'YX5-58', 'YX5-70', 'YX5-71', 'YX5-72', 'YX5-73', 'YX5-14', 'YX5-15', 'YX5-16', 'YX5-17', 'YX5-43', 'YX5-44', 'YX5-45', 'YX5-46', 'YX5-47', 'YX5-48', 'YX5-49', 'YX5-50', 'YX5-51', 'YX5-10', 'YX5-11', 'YX5-12', 'YX5-13', 'YX5-38', 'YX5-39', 'YX5-40', 'YX5-41', 'YX5-42', 'YX5-8', 'YX5-9']】的所有【定额】的【参数】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n target_codes = ['YX5-67', 'YX5-68', 'YX5-69', 'YX5-78', 'YX5-79', 'YX5-59', 'YX5-60', 'YX5-61', 'YX5-62', 'YX5-63', 'YX5-64', 'YX5-65', 'YX5-66', 'YX5-74', 'YX5-75', 'YX5-76', 'YX5-77', 'YX5-52', 'YX5-53', 'YX5-54', 'YX5-55', 'YX5-56', 'YX5-57', 'YX5-58', 'YX5-70', 'YX5-71', 'YX5-72', 'YX5-73', 'YX5-14', 'YX5-15', 'YX5-16', 'YX5-17', 'YX5-43', 'YX5-44', 'YX5-45', 'YX5-46', 'YX5-47', 'YX5-48', 'YX5-49', 'YX5-50', 'YX5-51', 'YX5-10', 'YX5-11', 'YX5-12', 'YX5-13', 'YX5-38', 'YX5-39', 'YX5-40', 'YX5-41', 'YX5-42', 'YX5-8', 'YX5-9']\n parent_path = '架空输电线路本体工程/架线工程'\n quantity_type = '定额'\n total_parameter = 0.0\n \n for code in target_codes:\n result_dict = project.get_quantities_node_by_parent_and_code(parent_path, quantity_type, code)\n status = result_dict.get('status', False)\n if not status:\n continue\n data = result_dict.get('data', [])\n if isinstance(data, list):\n for item in data:\n if isinstance(item, dict) and '参数' in item:\n try:\n total_parameter += float(item['参数'])\n except (ValueError, TypeError):\n pass\n elif isinstance(data, dict) and '参数' in data:\n try:\n total_parameter += float(data['参数'])\n except (ValueError, TypeError):\n pass\n \n return {\n 'code': 200,\n 'message': 'Ok',\n 'status': True,\n 'data': total_parameter\n }"}
{"name": "导线及线材_其中:节能导线量", "query": "从【架空输电线路本体工程/架线工程/导地线架设@@架空输电线路本体工程/架线工程/导地线跨越架设】及其子孙项目划分中查找名称中包含【高导电率】的所有【主材】的【数量】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n total_quantity = 0.0\n \n paths = [\n \"架空输电线路本体工程/架线工程/导地线架设\",\n \"架空输电线路本体工程/架线工程/导地线跨越架设\"\n ]\n \n for path in paths:\n result = project.get_quantities_node_by_parent_and_name(\n parent_path=path,\n partial_name=\"高导电率\",\n quantity_type=\"主材\"\n )\n \n if not result.get('status', False):\n continue\n \n materials = result.get('data', [])\n if not isinstance(materials, list):\n materials = [materials]\n \n for material in materials:\n if not isinstance(material, dict):\n continue\n if '数量' in material:\n try:\n total_quantity += float(material['数量'])\n except (ValueError, TypeError):\n pass\n \n return {\n 'code': 200 if total_quantity > 0 else 201,\n 'message': 'Ok' if total_quantity > 0 else 'No matching materials found',\n 'status': total_quantity > 0,\n 'data': total_quantity\n }"}
{"name": "导线及线材_导线装材费_元", "query": "从【架空输电线路本体工程/架线工程/导地线架设@@架空输电线路本体工程/架线工程/导地线跨越架设】及其子孙项目划分中查找名称中包含【线】的所有【主材】的【单价】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n total_price = 0.0\n \n paths = [\n \"架空输电线路本体工程/架线工程/导地线架设\",\n \"架空输电线路本体工程/架线工程/导地线跨越架设\"\n ]\n \n for path in paths:\n result = project.get_quantities_node_by_parent_and_name(\n parent_path=path,\n partial_name=\"线\",\n quantity_type=\"主材\"\n )\n \n if not result.get('status', False):\n continue\n \n materials = result.get('data', [])\n for material in materials:\n if isinstance(material, dict):\n price_str = material.get('单价含税', '0')\n try:\n price = float(price_str) if price_str else 0.0\n total_price += price\n except ValueError:\n continue\n \n return {\n 'code': 200,\n 'message': 'Ok',\n 'status': True,\n 'data': total_price\n }"}
{"name": "导线及线材_其中:节能导线费用_元", "query": "从【架空输电线路本体工程/架线工程/导地线架设@@架空输电线路本体工程/架线工程/导地线跨越架设】及其子孙项目划分中查找名称中包含【高导电率】的所有【主材】的【单价】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n total_price = 0.0\n \n paths = [\n \"架空输电线路本体工程/架线工程/导地线架设\",\n \"架空输电线路本体工程/架线工程/导地线跨越架设\"\n ]\n \n for path in paths:\n result = project.get_quantities_node_by_parent_and_name(\n parent_path=path,\n partial_name=\"高导电率\",\n quantity_type=\"主材\"\n )\n \n if not result.get('status', False):\n continue\n \n materials = result.get('data', [])\n for material in materials:\n if not isinstance(material, dict):\n continue\n \n price_str = material.get('单价含税', '0')\n try:\n price = float(price_str)\n total_price += price\n except ValueError:\n continue\n \n return {\n 'code': 200,\n 'message': 'Ok',\n 'status': True,\n 'data': total_price\n }"}
{"name": "导线及线材_导线类型", "query": "从【架空输电线路本体工程/架线工程/导地线架设@@架空输电线路本体工程/架线工程/导地线跨越架设@@架空输电线路本体工程/架线工程/其他架线工程】及其子孙项目划分中查找名称中包含【['钢芯铝绞线', '铝包钢芯铝绞线', '中强度铝合金绞线', '铝合金芯铝绞线', '铝合金芯高导电率铝绞线', '钢芯高导电率铝绞线', '特高强度钢芯铝合金绞线', '扩径导线', '耐热导线', '碳纤维导线']】的所有【主材】的【参数】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n parent_paths = [\n \"架空输电线路本体工程/架线工程/导地线架设\",\n \"架空输电线路本体工程/架线工程/导地线跨越架设\",\n \"架空输电线路本体工程/架线工程/其他架线工程\"\n ]\n material_names = [\n '钢芯铝绞线', '铝包钢芯铝绞线', '中强度铝合金绞线', '铝合金芯铝绞线', \n '铝合金芯高导电率铝绞线', '钢芯高导电率铝绞线', '特高强度钢芯铝合金绞线', \n '扩径导线', '耐热导线', '碳纤维导线'\n ]\n total_params = 0.0\n\n for parent_path in parent_paths:\n for material_name in material_names:\n result_dict = project.get_quantities_node_by_parent_and_name(\n parent_path=parent_path,\n partial_name=material_name,\n quantity_type='主材'\n )\n if not result_dict.get('status', False):\n continue\n materials = result_dict.get('data', [])\n for material in materials:\n if isinstance(material, dict) and '参数' in material:\n try:\n param_value = float(material['参数'])\n total_params += param_value\n except (ValueError, TypeError):\n continue\n\n return {\n 'code': 200,\n 'message': 'Ok',\n 'status': True,\n 'data': total_params\n }"}
{"name": "基础钢材量", "query": "从【架空输电线路本体工程/基础工程/基础砌筑】及其子孙项目划分中查找名称中包含【圆钢】的所有【主材】的【数量】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_quantities_node_by_parent_and_name(\n parent_path=\"架空输电线路本体工程/基础工程/基础砌筑\",\n partial_name=\"圆钢\",\n quantity_type=\"主材\"\n )\n status = result_dict.get('status', False)\n if not status:\n return result_dict\n \n data = result_dict.get('data', [])\n total_quantity = 0.0\n \n for item in data:\n if isinstance(item, dict) and item.get(\"类型\") == \"主材\" and \"圆钢\" in item.get(\"name\", \"\"):\n try:\n quantity = float(item.get(\"数量\", 0))\n total_quantity += quantity\n except (ValueError, TypeError):\n continue\n \n return {\n 'code': 200,\n 'message': 'Ok',\n 'status': True,\n 'data': total_quantity\n }"}
{"name": "基础钢材价格", "query": "从【架空输电线路本体工程/基础工程/基础砌筑】及其子孙项目划分中查找名称中包含【圆钢】的所有【主材】的【单价】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n base_path = \"架空输电线路本体工程/基础工程/基础砌筑\"\n total_price = 0.0\n \n def process_division(path):\n nonlocal total_price\n quantities_result = project.get_quantities_node_by_parent_and_name(path, \"圆钢\", \"主材\")\n if quantities_result.get('status'):\n for material_data in quantities_result.get('data', []):\n material = Material()\n material.__dict__.update(material_data)\n if \"单价含税\" in material.__dict__ and material.单价含税:\n try:\n total_price += float(material.单价含税)\n except (ValueError, TypeError):\n pass\n \n children_result = project.get_division_node_by_parent_and_name(path, \"\")\n if children_result.get('status'):\n for child_data in children_result.get('data', []):\n if 'path' in child_data:\n process_division(child_data['path'])\n \n process_division(base_path)\n \n return {\n 'code': 200,\n 'message': 'Ok',\n 'status': True,\n 'data': total_price\n }"}
{"name": "本体费用合计_元", "query": "从【工程费用】中获取【架空输电线路本体工程.合计费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_Engineering_Cost_table(\"工程费用\", \"架空输电线路本体工程.合计费\", \"合计费\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "本体工程人工费_本体_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程人工费_本体_元】的费用", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_division_node_by_parent_and_name('架空输电线路本体工程', '本体工程人工费_本体_元')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', [])\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "本体工程人工费_调试_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程人工费_调试_元】的费用", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_division_node_by_parent_and_name('架空输电线路本体工程', '本体工程人工费_调试_元')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', [])\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "本体工程机械费_本体_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程机械费_本体_元】的费用", "code": "根据用户问题和上下文信息,我将生成对应的Python代码:\n\n```python\ndef project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_table_by_project_division(\n project_division_path=\"架空输电线路本体工程\",\n fee_name=\"本体工程机械费_本体_元\"\n )\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('data', '')\n data = result_dict.get('data', [])\n if status:\n return result_dict\n else:\n return result_dict\n```"}
{"name": "本体工程机械费_调试_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程机械费_调试_元】的费用", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_division_node_by_parent_and_name('架空输电线路本体工程', '本体工程机械费_调试_元')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', [])\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "基础工程费用_元", "query": "从【架空输电线路本体工程/基础工程】项目划分中获取名称属于【基础工程费用_元】的费用", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_table_by_project_division(\"架空输电线路本体工程/基础工程\", \"基础工程费用_元\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "杆塔工程费用_元", "query": "从【架空输电线路本体工程/杆塔工程】项目划分中获取名称属于【杆塔工程费用_元】的费用", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_table_by_project_division(\"架空输电线路本体工程/杆塔工程\", \"杆塔工程费用_元\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "接地工程费用_元", "query": "从【架空输电线路本体工程/接地工程】项目划分中获取名称属于【接地工程费用_元】的费用", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_table_by_project_division(\"架空输电线路本体工程/接地工程\", \"接地工程费用_元\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "架线工程费用_元", "query": "从【架空输电线路本体工程/架线工程】项目划分中获取名称属于【架线工程费用_元】的费用", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_table_by_project_division(\"架空输电线路本体工程/架线工程\", \"架线工程费用_元\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "附件工程费用_元", "query": "从【架空输电线路本体工程/附件安装工程】项目划分中获取名称属于【附件工程费用_元】的费用", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_table_by_project_division(\"架空输电线路本体工程/附件安装工程\", \"附件工程费用_元\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "辅助工程费用_元", "query": "从【架空输电线路本体工程/辅助工程】项目划分中获取名称属于【辅助工程费用_元】的费用", "code": "根据用户问题和上下文信息,我们需要从\"架空输电线路本体工程/辅助工程\"项目划分中获取名称为\"辅助工程费用_元\"的费用。根据工程数据访问库,最匹配的方法是`get_fee_table_by_project_division`。\n\ndef project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_table_by_project_division(\n project_division_path=\"架空输电线路本体工程/辅助工程\",\n fee_name=\"辅助工程费用_元\"\n )\n status = result_dict.get('status', False)\n if not status:\n raise Exception(f\"获取费用失败: {result_dict.get('message', '未知错误')}\")\n return result_dict"}
{"name": "辅助工程费用_调试_元", "query": "从【架空输电线路本体工程/辅助工程】项目划分中获取名称属于【辅助工程费用_调试_元】的费用", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_table_by_project_division(\"架空输电线路本体工程/辅助工程\", \"辅助工程费用_调试_元\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "辅助设施工程_元", "query": "从【工程费用】中获取【辅助设施工程.合计费】的属性", "code": "根据用户问题和上下文信息,我们需要从工程费用表中获取\"辅助设施工程.合计费\"的属性。根据工程数据访问库,最匹配的方法是`get_fee_schedule_on_Engineering_Cost_table`。\n\n```python\ndef project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_Engineering_Cost_table(\"工程费用\", \"辅助设施工程.合计费\", \"合计费\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict\n```"}
{"name": "其他费用合计_元", "query": "从【工程费用】中获取【其他费用.合计费】的属性", "code": "根据用户问题和上下文信息,我们需要从\"工程费用\"中获取\"其他费用.合计费\"的属性。根据上下文信息,\"工程费用\"的类型是\"FeeScheduleItem\",而\"其他费用.合计费\"的类型是\"Fee\"。\n\n最匹配的方法是`get_fee_schedule_on_Engineering_Cost_table`,因为它专门用于在工程费用表中查找费用。\n\n```python\ndef project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_Engineering_Cost_table(\n table_name=\"工程费用表\",\n fee_name=\"合计费\",\n fee=\"其他费用\"\n )\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('data', '')\n data = result_dict.get('data', [])\n if status:\n return result_dict\n else:\n return result_dict\n```"}
{"name": "建场费合计_元", "query": "从【其他费用】中获取【建设场地征用及清理费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_other_expense_table('其他费用表', '建设场地征用及清理费', 'amount')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "项目建设管理费合计_元", "query": "从【其他费用】中获取【项目建设管理费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_other_expense_table('其他费用表', '项目建设管理费', 'amount')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "其中:工程监理费_元", "query": "从【其他费用】中获取【工程监理费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_other_expense_table('其他费用表', '工程监理费', 'rate')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "项目建设技术服务费合计_元", "query": "从【其他费用】中获取【项目建设技术服务费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_other_expense_table('其他费用表', '项目建设技术服务费', 'amount')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "其中:项目前期工作费_元", "query": "从【其他费用】中获取【项目前期工作费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_other_expense_table('其他费用表', '项目前期工作费', 'amount')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "其中:勘察费_元", "query": "从【其他费用】中获取【勘察费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_other_expense_table('其他费用表', '勘察费', 'rate')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "其中:设计费_元", "query": "从【其他费用】中获取【设计费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_other_expense_table('其他费用表', '设计费', 'rate')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "其中:工程建设检测费_元", "query": "从【其他费用】中获取【工程建设检测费】的属性", "code": "根据用户问题和上下文信息,我们需要从\"其他费用\"表中获取\"工程建设检测费\"的属性。根据上下文信息,\"其他费用\"是一个FeeScheduleItem类型,而\"工程建设检测费\"是一个Fee类型。\n\n最匹配的方法是`get_fee_schedule_on_other_expense_table`,因为它专门用于在其他费用表中查找费用。\n\n```python\ndef project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_other_expense_table(\n table_name=\"其他费用\",\n fee_name=\"工程建设检测费\",\n fee=\"*\"\n )\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict\n```"}
{"name": "生产准备费_元", "query": "从【其他费用】中获取【生产准备费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_other_expense_table(table_name='其他费用表', fee_name='生产准备费', fee='amount')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "其中:安全文明施工费_线路_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【其中:安全文明施工费_线路_元】的费用", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_division_node_by_parent_and_name('架空输电线路本体工程', '其中:安全文明施工费_线路_元')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', [])\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "其中:安全文明施工费_调试_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【其中:安全文明施工费_调试_元】的费用", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_division_node_by_parent_and_name('架空输电线路本体工程', '其中:安全文明施工费_调试_元')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', [])\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "基本预备费_元", "query": "从【工程费用】中获取【基本预备费.合计费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_Engineering_Cost_table(\"工程费用\", \"基本预备费.合计费\", \"合计费\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "静态投资_元", "query": "从【工程费用】中获取【工程静态投资(一~七项合计).合计费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_Engineering_Cost_table(\"工程费用表\", \"工程静态投资(一~七项合计).合计费\", \"合计费\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "建设期利息_元", "query": "从【工程费用】中获取【建设期贷款利息.合计费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_Engineering_Cost_table(\"工程费用\", \"建设期贷款利息.合计费\", \"合计费\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
{"name": "动态投资_元", "query": "从【工程费用】中获取【工程动态投资(一~八项合计).合计费】的属性", "code": "根据用户问题和上下文信息,我们需要从\"工程费用\"表中获取\"工程动态投资(一~八项合计).合计费\"的属性。根据工程数据访问库,最匹配的方法是`get_fee_schedule_on_Engineering_Cost_table`。\n\n```python\ndef project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_Engineering_Cost_table(\n table_name=\"工程费用\",\n fee_name=\"工程动态投资(一~八项合计)\",\n fee=\"合计费\"\n )\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict\n```"}
{"name": "增值税抵扣税额_元", "query": "从【工程费用】中获取【其中:可抵扣增值税额.合计费】的属性", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_Engineering_Cost_table('工程费用表', '其中:可抵扣增值税额.合计费', '合计费')\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', '')\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"}
View File
+42 -22
View File
@@ -2,9 +2,25 @@ import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import logging
def setup_logger(logger_name):
"""
设置指定名称的logger,将其级别设置为WARNING并禁用传播
:param logger_name: logger的名称
"""
logger = logging.getLogger(logger_name)
logger.setLevel(logging.WARNING) # 设置httpcore及其子模块的级别
logger.propagate = False # 可选:禁用传播(防止被根logger处理)
return logger
logger_names = ["httpx", "openai", "langsmith.client", "neo4j", "urllib3", "httpcore"]
for name in logger_names:
setup_logger(name)
import json
from src.dialog_manager import DialogManager
from src.llm_client import LLMClient
from src.multi_llm_client import MultiAPIKeyChatOpenAI
from src.code_executor import CodeExecutor
from src.neo4j_raw_retriever import Neo4jRawRetriever
from src.prompt_manager import PromptManager
@@ -13,18 +29,25 @@ from src.config import Config
from src.document_loader import load_file
from src.embedding_client import EmbeddingClient
from project import ProjectBuilder, ProjectToolkit
from project_implementation import ProjectToolkitNeo4j
from src.project import ProjectBuilder, ProjectToolkit
from src.project_implementation import ProjectToolkitNeo4j
success_count = 0
fail_count = 0
questions = []
error_list = []
def main():
global fail_count, success_count, questions, error_list
config = Config()
business_structure = load_file(config.business_object_structure_path)
bowei_api_docs = load_file(config.bowei_api_docs_path)
llm_client = LLMClient(config.openai)
llm_client = MultiAPIKeyChatOpenAI(config.openai)
llm_client_coder = LLMClient(config.openai_coder)
llm_client_coder = MultiAPIKeyChatOpenAI(config.openai_coder)
prompt_manager = PromptManager()
@@ -38,7 +61,7 @@ def main():
ProjectBuilder.register(ProjectToolkitNeo4j, knowledge_retriever.driver)
code_executor = CodeExecutor(prompt_manager.prompts, llm_client_coder)
code_executor = CodeExecutor(prompt_manager.prompts, llm_client_coder, config.max_retries)
dialog_manager = DialogManager(
llm_client,
@@ -55,37 +78,34 @@ def main():
# 提取指标映射关系并批量执行
for item in zhibiao_data:
datasource = item['数据来源']
if datasource == '报表指标' or datasource == '指标库':
continue
query = item['指标描述']['指标映射']
rewritten_results = dialog_manager.understand_user_question_stream(query)
#rewritten_results = dialog_manager.understand_user_question(query)
rewritten_results = []
if rewritten_results is None or rewritten_results == []:
print('问题: {} 没有找到符合要求的数据'.format(query))
fail_count += 1
error_list.append(f"问题 {query} 调用 understand_user_question 返回空结果")
continue
selected_rewritten, selected_knowledge = rewritten_results[0]
questions = []
success_count = 0
fail_count = 0
error_list = []
# 检查 understand_user_question_stream 方法调用结果,假设存在该方法调用
# 示例调用,实际使用时请替换为真实调用
# stream_result = dialog_manager.understand_user_question_stream(query)
# if stream_result is None or stream_result == []:
# questions.append(query)
# fail_count += 1
# error_list.append(f"问题 {query} 调用 understand_user_question_stream 返回空结果")
result = dialog_manager.execute_generated_code(selected_rewritten, selected_knowledge)
if result is None or result == []:
questions.append(selected_rewritten)
fail_count += 1
error_list.append(f"问题 {selected_rewritten} 调用 execute_generated_code 返回空结果")
error_list.append(f"问题 {query} {selected_rewritten} 调用 execute_generated_code 返回空结果")
else:
success_count += 1
print(result)
#print(result)
if __name__ == "__main__":
main()
total = success_count + fail_count
if total > 0:
success_rate = success_count / total
@@ -98,5 +118,5 @@ if __name__ == "__main__":
print("错误列表:")
for error in error_list:
print(error)
main()
+171
View File
@@ -0,0 +1,171 @@
import os
import sys
import logging
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from datetime import datetime
# 获取当前时间,格式化为字符串
now_str = datetime.now().strftime("%Y%m%d%H%M%S")
log_filename = f"test_code1{now_str}.log"
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
handlers=[
logging.FileHandler(os.path.join("logs", log_filename), encoding="utf-8"),
logging.StreamHandler()
],
)
logger = logging.getLogger("test_code1")
import logging
def setup_logger(logger_name):
"""
设置指定名称的logger,将其级别设置为WARNING并禁用传播
:param logger_name: logger的名称
"""
logger = logging.getLogger(logger_name)
logger.setLevel(logging.WARNING) # 设置httpcore及其子模块的级别
logger.propagate = False # 可选:禁用传播(防止被根logger处理)
return logger
logger_names = ["httpx", "openai", "langsmith.client", "neo4j", "urllib3", "httpcore"]
for name in logger_names:
setup_logger(name)
import json
import os
from src.dialog_manager import DialogManager
from src.multi_llm_client import MultiAPIKeyChatOpenAI
from src.code_executor import CodeExecutor
from src.neo4j_raw_retriever import Neo4jRawRetriever
from src.prompt_manager import PromptManager
import yaml
from src.config import Config
from src.document_loader import load_file
from src.embedding_client import EmbeddingClient
from src.project import ProjectBuilder, ProjectToolkit
from src.project_implementation import ProjectToolkitNeo4j
success_count = 0
fail_count = 0
questions = []
error_list = []
success_results = []
fail_results = []
def main():
global fail_count, success_count, questions, error_list
config = Config()
business_structure = load_file(config.business_object_structure_path)
bowei_api_docs = load_file(config.bowei_api_docs_path)
llm_client = MultiAPIKeyChatOpenAI(config.openai)
llm_client_coder = MultiAPIKeyChatOpenAI(config.openai_coder)
prompt_manager = PromptManager()
neo4j_conf = config.neo4j_conf
embedding_conf = config.embedding
embedding_client = EmbeddingClient(embedding_conf)
# 创建Neo4j检索器
knowledge_retriever = Neo4jRawRetriever(neo4j_conf)
ProjectBuilder.register(ProjectToolkitNeo4j, knowledge_retriever.driver)
code_executor = CodeExecutor(prompt_manager.prompts, llm_client_coder, config.max_retries)
dialog_manager = DialogManager(
llm_client,
business_structure,
bowei_api_docs,
code_executor,
knowledge_retriever,
prompt_manager,
)
# 加载 zhibiao.jsonl
zhibiao_data = []
with open('./tests/zhibiao.jsonl', 'r', encoding='utf-8') as f:
for line in f:
zhibiao_data.append(json.loads(line))
# 提取指标映射关系并批量执行
for item in zhibiao_data:
query = item['query']
selected_knowledge = item['result']
result = dialog_manager.generated_code(query, selected_knowledge)
if isinstance(result, dict) and result.get('status', False):
code = result['data']
result = dialog_manager.execute_code(code)
if isinstance(result, dict) and result.get('status', False):
success_count += 1
success_results.append({
"query": query,
"result": result.get('data', []),
"status": True
})
else:
questions.append(query)
fail_count += 1
error_msg = result.get('message', '调用 execute_code 返回空结果') if isinstance(result, dict) else f"问题 {query} {selected_knowledge} 调用 execute_generated_code 返回空结果"
error_list.append(error_msg)
fail_results.append({
"query": query,
"result": error_msg,
"status": False
})
else:
questions.append(query)
fail_count += 1
error_msg = result.get('message', '调用 generated_code 返回空结果') if isinstance(result, dict) else f"问题 {query} {selected_knowledge} 调用 execute_generated_code 返回空结果"
error_list.append(error_msg)
fail_results.append({
"query": query,
"result": error_msg,
"status": False
})
#print(result)
if __name__ == "__main__":
main()
total = success_count + fail_count
if total > 0:
success_rate = success_count / total
fail_rate = fail_count / total
else:
success_rate = fail_rate = 0
print(f"问题总数: {total}")
print(f"成功比例: {success_rate * 100:.2f}%")
print(f"失败比例: {fail_rate * 100:.2f}%")
print("错误列表:")
for error in error_list:
print(error)
# 保存成功结果到 jsonl 文件
success_filename = f'./tests/success_{now_str}.jsonl'
with open(success_filename, 'w', encoding='utf-8') as f:
for item in success_results:
f.write(json.dumps(item, ensure_ascii=False) + '\n')
# 保存失败结果到 jsonl 文件
fail_filename = f'./tests/fail_{now_str}.jsonl'
with open(fail_filename, 'w', encoding='utf-8') as f:
for item in fail_results:
f.write(json.dumps(item, ensure_ascii=False) + '\n')
+162
View File
@@ -0,0 +1,162 @@
import os
import sys
import logging
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from datetime import datetime
# 获取当前时间,格式化为字符串
now_str = datetime.now().strftime("%Y%m%d%H%M%S")
log_filename = f"test_code1{now_str}.log"
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
handlers=[
logging.FileHandler(os.path.join("logs", log_filename), encoding="utf-8"),
logging.StreamHandler()
],
)
logger = logging.getLogger("test_code1")
import logging
def setup_logger(logger_name):
"""
设置指定名称的logger,将其级别设置为WARNING并禁用传播
:param logger_name: logger的名称
"""
logger = logging.getLogger(logger_name)
logger.setLevel(logging.WARNING) # 设置httpcore及其子模块的级别
logger.propagate = False # 可选:禁用传播(防止被根logger处理)
return logger
logger_names = ["httpx", "openai", "langsmith.client", "neo4j", "urllib3", "httpcore"]
for name in logger_names:
setup_logger(name)
import json
import os
from src.dialog_manager import DialogManager
from src.multi_llm_client import MultiAPIKeyChatOpenAI
from src.code_executor import CodeExecutor
from src.neo4j_raw_retriever import Neo4jRawRetriever
from src.prompt_manager import PromptManager
import yaml
from src.config import Config
from src.document_loader import load_file
from src.embedding_client import EmbeddingClient
from src.project import ProjectBuilder, ProjectToolkit
from src.project_implementation import ProjectToolkitNeo4j
success_count = 0
fail_count = 0
questions = []
error_list = []
success_results = []
fail_results = []
def main():
global fail_count, success_count, questions, error_list
config = Config()
business_structure = load_file(config.business_object_structure_path)
bowei_api_docs = load_file(config.bowei_api_docs_path)
llm_client = MultiAPIKeyChatOpenAI(config.openai)
llm_client_coder = MultiAPIKeyChatOpenAI(config.openai_coder)
prompt_manager = PromptManager()
neo4j_conf = config.neo4j_conf
embedding_conf = config.embedding
embedding_client = EmbeddingClient(embedding_conf)
# 创建Neo4j检索器
knowledge_retriever = Neo4jRawRetriever(neo4j_conf)
ProjectBuilder.register(ProjectToolkitNeo4j, knowledge_retriever.driver)
code_executor = CodeExecutor(prompt_manager.prompts, llm_client_coder, config.max_retries)
dialog_manager = DialogManager(
llm_client,
business_structure,
bowei_api_docs,
code_executor,
knowledge_retriever,
prompt_manager,
)
# 加载 zhibiao.jsonl
zhibiao_data = []
with open('./tests/zhibiao.jsonl', 'r', encoding='utf-8') as f:
for line in f:
zhibiao_data.append(json.loads(line))
# 提取指标映射关系并批量执行
for item in zhibiao_data:
query = item['query']
name = item['name']
selected_knowledge = item['result']
logger.info(f"指标名称 {name} 问题: {query} 开始生成代码")
result = dialog_manager.generated_code(query, selected_knowledge)
if isinstance(result, dict) and result.get('status', False):
code = result['data']
success_count += 1
success_results.append({
"name": name,
"query": query,
"code": code,
})
else:
questions.append(query)
fail_count += 1
error_msg = result.get('message', '调用 generated_code 返回空结果') if isinstance(result, dict) else f"问题 {query} {selected_knowledge} 调用 execute_generated_code 返回空结果"
error_list.append(error_msg)
fail_results.append({
"name": name,
"query": query,
"messages": error_msg,
"selected_knowledge": selected_knowledge,
})
#print(result)
if __name__ == "__main__":
main()
total = success_count + fail_count
if total > 0:
success_rate = success_count / total
fail_rate = fail_count / total
else:
success_rate = fail_rate = 0
print(f"问题总数: {total}")
print(f"成功比例: {success_rate * 100:.2f}%")
print(f"失败比例: {fail_rate * 100:.2f}%")
print("错误列表:")
for error in error_list:
print(error)
# 保存成功结果到 jsonl 文件
success_filename = f'./tests/code_{now_str}.jsonl'
with open(success_filename, 'w', encoding='utf-8') as f:
for item in success_results:
f.write(json.dumps(item, ensure_ascii=False) + '\n')
# 保存失败结果到 jsonl 文件
fail_filename = f'./tests/fail_{now_str}.jsonl'
with open(fail_filename, 'w', encoding='utf-8') as f:
for item in fail_results:
f.write(json.dumps(item, ensure_ascii=False) + '\n')
+6 -6
View File
@@ -8,7 +8,7 @@ import logging
logging.basicConfig(
level=logging.DEBUG, # 生产环境可改为 INFO 或 WARNING
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
handlers=[logging.FileHandler("test.log", encoding="utf-8"), logging.StreamHandler()],
handlers=[logging.FileHandler("logs/test.log", encoding="utf-8"), logging.StreamHandler()],
)
logger = logging.getLogger("test")
@@ -34,7 +34,7 @@ for name in logger_names:
import asyncio
import json
from src.dialog_manager import DialogManager
from src.llm_client import LLMClient
from src.multi_llm_client import MultiAPIKeyChatOpenAI
from src.code_executor import CodeExecutor
from src.neo4j_raw_retriever import Neo4jRawRetriever
from src.prompt_manager import PromptManager
@@ -43,8 +43,8 @@ from src.config import Config
from src.document_loader import load_file
from src.embedding_client import EmbeddingClient
from project import ProjectBuilder, ProjectToolkit
from project_implementation import ProjectToolkitNeo4j
from src.project import ProjectBuilder, ProjectToolkit
from src.project_implementation import ProjectToolkitNeo4j
def main():
@@ -53,9 +53,9 @@ def main():
business_structure = load_file(config.business_object_structure_path)
bowei_api_docs = load_file(config.bowei_api_docs_path)
llm_client = LLMClient(config.openai)
llm_client = MultiAPIKeyChatOpenAI(config.openai)
llm_client_coder = LLMClient(config.openai_coder)
llm_client_coder = MultiAPIKeyChatOpenAI(config.openai_coder)
prompt_manager = PromptManager()
+48 -15
View File
@@ -5,15 +5,15 @@ import logging
import traceback
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from project import ProjectBuilder, ProjectToolkit
from project_implementation import ProjectToolkitNeo4j
from src.project import ProjectBuilder, ProjectToolkit
from src.project_implementation import ProjectToolkitNeo4j
from neo4j import GraphDatabase
from src.config import Config
logging.basicConfig(
level=logging.DEBUG, # 生产环境可改为 INFO 或 WARNING
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
handlers=[logging.FileHandler("test_runcode.log", encoding="utf-8"), logging.StreamHandler()],
handlers=[logging.FileHandler("logs/test_runcode.log", encoding="utf-8"), logging.StreamHandler()],
)
logger = logging.getLogger("test_runcode")
@@ -24,13 +24,27 @@ def main():
neo4j_conf = config.neo4j_conf
code_str = '''
def project_get_calculate_function():
project = ProjectBuilder.build()
status, data, error, helper_info = project.get_division_item_by_path("安装/架空输电线路本体工程")
if status == 'success':
return status, data.get('单位', ''), error, helper_info
return status, None, error, helper_info
'''
def project_get_calculate_function():
project = ProjectBuilder.build()
parent_path = "架空输电线路本体工程/基础工程"
quantity_type = "定额"
code = "YX2-1/YX2-2/YX2-3/YX2-4/YX2-5/YX2-6/YX2-7"
status, data, error, helper_info = project.get_quantities_node_by_parent_and_code(parent_path, quantity_type, code)
if status != "success":
return {
"helper_info": helper_info,
"error": error,
"status": status,
"data": None
}
total_quantity = sum(float(item.get("数量", 0)) for item in data if item.get("数量"))
return {
"helper_info": helper_info,
"error": error,
"status": status,
"data": total_quantity
}
'''
neo4j_driver = GraphDatabase.driver(neo4j_conf.get("uri"), auth=(neo4j_conf.get("username"), neo4j_conf.get("password")))
@@ -53,23 +67,42 @@ def main():
if "project_get_calculate_function" not in namespace:
raise ValueError("代码中未定义project_get_calculate_function函数")
result_tuple = namespace["project_get_calculate_function"]()
result_dict = namespace["project_get_calculate_function"]()
sys.stdout = old_stdout
output = redirected_output.getvalue().strip()
if not isinstance(result_tuple, tuple) or len(result_tuple) != 4:
raise ValueError("函数应返回包含4个元素的元组(status, data, error, helper_info)")
if not isinstance(result_dict, dict) or len(result_dict) != 4:
raise ValueError("函数应返回包含4个元素的字典(status, data, error, helper_info)")
status, data, error, helper_info = result_tuple
logger.debug(f"执行结果: {result_dict}")
logger.info(f"执行结果: status={status}, data={data}, error={error}")
if result_dict["status"] == "success":
return {
"code": 20000,
"message": result_dict["error"] if result_dict["error"] else '',
"status": True,
"data": result_dict["data"] if result_dict["data"] else []
}
else:
return {
"code": 50000,
"message": result_dict["error"] if result_dict["error"] else '',
"status": False,
"data": result_dict["data"] if result_dict["data"] else []
}
except Exception as e:
# 确保恢复stdout
sys.stdout = old_stdout
logger.error(f"执行代码时出错: {e}")
logger.error(traceback.format_exc())
return {
"code": 50000,
"message": str(e),
"status": False,
"data": []
}
if __name__ == "__main__":
+184
View File
@@ -0,0 +1,184 @@
# tests/test_userinteraction.py
import os
import sys
import json
import logging
import os
from datetime import datetime
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
current_file = os.path.splitext(os.path.basename(__file__))[0]
now_str = datetime.now().strftime("%Y%m%d%H%M%S")
log_filename = f"{current_file}_{now_str}.log"
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
handlers=[
logging.FileHandler(os.path.join("logs", log_filename), encoding="utf-8"),
logging.StreamHandler()
],
)
logger = logging.getLogger(current_file)
def setup_logger(logger_name):
"""
设置指定名称的logger,将其级别设置为WARNING并禁用传播
:param logger_name: logger的名称
"""
logger = logging.getLogger(logger_name)
logger.setLevel(logging.WARNING) # 设置httpcore及其子模块的级别
logger.propagate = False # 可选:禁用传播(防止被根logger处理)
return logger
logger_names = ["httpx", "openai", "langsmith.client", "neo4j", "urllib3", "httpcore"]
for name in logger_names:
setup_logger(name)
from src.config import Config
from src.document_loader import load_file
from src.multi_llm_client import MultiAPIKeyChatOpenAI
from src.user_interaction import UserInteraction
import json
from src.dialog_manager import DialogManager
from src.multi_llm_client import MultiAPIKeyChatOpenAI
from src.code_executor import CodeExecutor
from src.neo4j_raw_retriever import Neo4jRawRetriever
from src.prompt_manager import PromptManager
import yaml
from src.config import Config
from src.document_loader import load_file
from src.embedding_client import EmbeddingClient
from src.project import ProjectBuilder, ProjectToolkit
from src.project_implementation import ProjectToolkitNeo4j
success_count = 0
fail_count = 0
questions = []
error_list = []
success_list = []
def main():
global success_count, fail_count, questions, error_list, success_list
config = Config()
business_structure = load_file(config.business_object_structure_path)
bowei_api_docs = load_file(config.bowei_api_docs_path)
llm_client = MultiAPIKeyChatOpenAI(config.openai)
user_interaction = UserInteraction(llm_client.llm, business_structure)
llm_client_coder = MultiAPIKeyChatOpenAI(config.openai_coder)
prompt_manager = PromptManager()
neo4j_conf = config.neo4j_conf
embedding_conf = config.embedding
embedding_client = EmbeddingClient(embedding_conf)
# 创建Neo4j检索器
knowledge_retriever = Neo4jRawRetriever(neo4j_conf)
ProjectBuilder.register(ProjectToolkitNeo4j, knowledge_retriever.driver)
code_executor = CodeExecutor(prompt_manager.prompts, llm_client_coder, config.max_retries)
dialog_manager = DialogManager(
llm_client,
business_structure,
bowei_api_docs,
code_executor,
knowledge_retriever,
prompt_manager,
)
# 读取 zhibiao.json
zhibiao_path = os.path.join(os.path.dirname(__file__), "zhibiao.json")
with open(zhibiao_path, "r", encoding="utf-8") as f:
zhibiao_data = json.load(f)
isTest = True
isTest = False
if isTest:
zhibiao_data = [
{
"指标名称": "杆塔总基数",
"指标描述": {
"指标映射": "从【架空输电线路本体工程/附件安装工程】项目划分中获取名称属于【'合计'】的费用",
"映射规则": "YX2-1~7"
},
"code": "",
"单位": "",
"单价类型": None,
"序号": "1",
"提取方式": None,
"指标类型": "工程量指标",
"数据来源": "定额数量"
}
]
for idx, item in enumerate(zhibiao_data):
name = item.get("指标名称", "")
datasource = item.get("数据来源", "")
if datasource in ("报表指标", "指标库"):
logger.info(f"跳过索引 {idx},数据来源为 {datasource}")
continue
query = item.get("指标描述", {}).get("指标映射", "")
if not query:
logger.warning(f"索引 {idx} 缺少指标映射,跳过")
continue
try:
# 调用用户交互理解接口(同步调用)
result = user_interaction.understand(query)
if not result:
logger.error(f"问题: {query} 没有找到符合要求的数据")
fail_count += 1
error_list.append(f"指标名称 {name} 问题 {query} 调用 understand 返回空结果")
continue
# 这里示例只打印理解结果,你可以根据业务逻辑替换为后续处理
logger.info(
f"指标名称 {name} 问题: {query} 理解结果: "
f"{[{'name': r.get('name'), 'constraints': r.get('constraints')} for r in result]}"
)
success_list.append({
"name": name,
"query": query,
"result": [{'name': r.get('name'), 'constraints': r.get('constraints')} for r in result]
})
success_count += 1
except Exception as e:
logger.error(f"指标名称 {name} 问题: {query} 处理异常: {e}")
fail_count += 1
error_list.append(f"指标名称 {name} 问题 {query} 异常: {e}")
total = success_count + fail_count
success_rate = (success_count / total) * 100 if total > 0 else 0
fail_rate = (fail_count / total) * 100 if total > 0 else 0
print(f"问题总数: {total}")
print(f"成功比例: {success_rate:.2f}%)")
print(f"失败比例: {fail_rate:.2f}%)")
print("错误列表:")
for error in error_list:
print(error)
# 将成功内容保存为 jsonl 文件
success_jsonl_path = os.path.join(os.path.dirname(__file__), f"zhibiao_{now_str}.jsonl")
with open(success_jsonl_path, "w", encoding="utf-8") as f:
for item in success_list:
f.write(json.dumps(item, ensure_ascii=False) + "\n")
if __name__ == "__main__":
main()
+1575 -429
View File
File diff suppressed because it is too large Load Diff
+46
View File
@@ -0,0 +1,46 @@
{"name": "杆塔总基数", "query": "从【架空输电线路本体工程/基础工程】及其子孙项目划分中查找编码中包含【YX2-1~7】的所有【定额】的【数量】之和", "result": [{"name": "基础工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/基础工程", "name": "基础工程"}}, {"name": "定额", "constraints": {"type": "ProjectQuantity", "类型": "定额", "编码": "YX2-1~7"}}]}
{"name": "角钢塔_塔材量", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【角钢】的所有【主材】的【数量】之和", "result": [{"name": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含角钢"}}]}
{"name": "角钢塔_其中:高强钢塔材量", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【角钢、高强】的所有【主材】的【数量】之和", "result": [{"name": "铁塔、钢管杆组立", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "name": "铁塔、钢管杆组立"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含角钢、高强"}}]}
{"name": "角钢塔_塔材装材费_元", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【角钢】的所有【主材】的【单价】之和", "result": [{"name": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含角钢"}}]}
{"name": "角钢塔_其中:高强钢塔材费用_元", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【角钢、高强】的所有【主材】的【单价】之和", "result": [{"name": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含角钢、高强"}}]}
{"name": "钢管塔_塔材量", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【钢管塔】的所有【主材】的【数量】之和", "result": [{"name": "铁塔、钢管杆组立", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "name": "铁塔、钢管杆组立"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含钢管塔"}}]}
{"name": "钢管塔_钢管价格_元", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【钢管塔】的所有【主材】的【单价】之和", "result": [{"name": "铁塔、钢管杆组立", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "name": "铁塔、钢管杆组立"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含钢管塔"}}]}
{"name": "钢管杆_塔材量", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【钢管杆】的所有【主材】的【数量】之和", "result": [{"name": "铁塔、钢管杆组立", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "name": "铁塔、钢管杆组立"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含钢管杆"}}]}
{"name": "钢管杆_钢管价格_元", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【钢管杆】的所有【主材】的【单价】之和", "result": [{"name": "铁塔、钢管杆组立", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "name": "铁塔、钢管杆组立"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含钢管杆"}}]}
{"name": "导线及线材_分裂数", "query": "从【架空输电线路本体工程/架线工程】及其子孙项目划分中查找编码中包含【['YX5-67', 'YX5-68', 'YX5-69', 'YX5-78', 'YX5-79', 'YX5-59', 'YX5-60', 'YX5-61', 'YX5-62', 'YX5-63', 'YX5-64', 'YX5-65', 'YX5-66', 'YX5-74', 'YX5-75', 'YX5-76', 'YX5-77', 'YX5-52', 'YX5-53', 'YX5-54', 'YX5-55', 'YX5-56', 'YX5-57', 'YX5-58', 'YX5-70', 'YX5-71', 'YX5-72', 'YX5-73', 'YX5-14', 'YX5-15', 'YX5-16', 'YX5-17', 'YX5-43', 'YX5-44', 'YX5-45', 'YX5-46', 'YX5-47', 'YX5-48', 'YX5-49', 'YX5-50', 'YX5-51', 'YX5-10', 'YX5-11', 'YX5-12', 'YX5-13', 'YX5-38', 'YX5-39', 'YX5-40', 'YX5-41', 'YX5-42', 'YX5-8', 'YX5-9']】的所有【定额】的【参数】之和", "result": [{"name": "架空输电线路本体工程/架线工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程", "name": "架线工程"}}, {"name": "定额", "constraints": {"type": "ProjectQuantity", "类型": "定额", "编码": ["YX5-67", "YX5-68", "YX5-69", "YX5-78", "YX5-79", "YX5-59", "YX5-60", "YX5-61", "YX5-62", "YX5-63", "YX5-64", "YX5-65", "YX5-66", "YX5-74", "YX5-75", "YX5-76", "YX5-77", "YX5-52", "YX5-53", "YX5-54", "YX5-55", "YX5-56", "YX5-57", "YX5-58", "YX5-70", "YX5-71", "YX5-72", "YX5-73", "YX5-14", "YX5-15", "YX5-16", "YX5-17", "YX5-43", "YX5-44", "YX5-45", "YX5-46", "YX5-47", "YX5-48", "YX5-49", "YX5-50", "YX5-51", "YX5-10", "YX5-11", "YX5-12", "YX5-13", "YX5-38", "YX5-39", "YX5-40", "YX5-41", "YX5-42", "YX5-8", "YX5-9"]}}]}
{"name": "导线及线材_其中:节能导线量", "query": "从【架空输电线路本体工程/架线工程/导地线架设@@架空输电线路本体工程/架线工程/导地线跨越架设】及其子孙项目划分中查找名称中包含【高导电率】的所有【主材】的【数量】之和", "result": [{"name": "架空输电线路本体工程/架线工程/导地线架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线架设"}}, {"name": "架空输电线路本体工程/架线工程/导地线跨越架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线跨越架设"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含高导电率"}}]}
{"name": "导线及线材_导线装材费_元", "query": "从【架空输电线路本体工程/架线工程/导地线架设@@架空输电线路本体工程/架线工程/导地线跨越架设】及其子孙项目划分中查找名称中包含【线】的所有【主材】的【单价】之和", "result": [{"name": "架空输电线路本体工程/架线工程/导地线架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线架设"}}, {"name": "架空输电线路本体工程/架线工程/导地线跨越架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线跨越架设"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "线"}}]}
{"name": "导线及线材_其中:节能导线费用_元", "query": "从【架空输电线路本体工程/架线工程/导地线架设@@架空输电线路本体工程/架线工程/导地线跨越架设】及其子孙项目划分中查找名称中包含【高导电率】的所有【主材】的【单价】之和", "result": [{"name": "架空输电线路本体工程/架线工程/导地线架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线架设"}}, {"name": "架空输电线路本体工程/架线工程/导地线跨越架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线跨越架设"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含高导电率"}}]}
{"name": "导线及线材_导线类型", "query": "从【架空输电线路本体工程/架线工程/导地线架设@@架空输电线路本体工程/架线工程/导地线跨越架设@@架空输电线路本体工程/架线工程/其他架线工程】及其子孙项目划分中查找名称中包含【['钢芯铝绞线', '铝包钢芯铝绞线', '中强度铝合金绞线', '铝合金芯铝绞线', '铝合金芯高导电率铝绞线', '钢芯高导电率铝绞线', '特高强度钢芯铝合金绞线', '扩径导线', '耐热导线', '碳纤维导线']】的所有【主材】的【参数】之和", "result": [{"name": "架空输电线路本体工程/架线工程/导地线架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线架设"}}, {"name": "架空输电线路本体工程/架线工程/导地线跨越架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线跨越架设"}}, {"name": "架空输电线路本体工程/架线工程/其他架线工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/其他架线工程"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": ["钢芯铝绞线", "铝包钢芯铝绞线", "中强度铝合金绞线", "铝合金芯铝绞线", "铝合金芯高导电率铝绞线", "钢芯高导电率铝绞线", "特高强度钢芯铝合金绞线", "扩径导线", "耐热导线", "碳纤维导线"]}}]}
{"name": "基础钢材量", "query": "从【架空输电线路本体工程/基础工程/基础砌筑】及其子孙项目划分中查找名称中包含【圆钢】的所有【主材】的【数量】之和", "result": [{"name": "基础砌筑", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/基础工程/基础砌筑", "name": "基础砌筑"}}, {"name": "圆钢", "constraints": {"type": "ProjectQuantity", "name": "圆钢", "类型": "主材"}}]}
{"name": "基础钢材价格", "query": "从【架空输电线路本体工程/基础工程/基础砌筑】及其子孙项目划分中查找名称中包含【圆钢】的所有【主材】的【单价】之和", "result": [{"name": "基础砌筑", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/基础工程/基础砌筑", "name": "基础砌筑"}}, {"name": "圆钢", "constraints": {"type": "ProjectQuantity", "name": "圆钢", "类型": "主材"}}]}
{"name": "本体费用合计_元", "query": "从【工程费用】中获取【架空输电线路本体工程.合计费】的属性", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "Fee", "name": "架空输电线路本体工程", "code": "BTGC"}}, {"name": "合计费", "constraints": {"type": "Fee", "name": "合计费"}}]}
{"name": "本体工程人工费_本体_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程人工费_本体_元】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "本体工程人工费_本体_元", "constraints": {"type": "CostItem", "name": "本体工程人工费_本体_元"}}]}
{"name": "本体工程人工费_调试_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程人工费_调试_元】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "本体工程人工费_调试_元", "constraints": {"type": "CostItem", "name": "本体工程人工费_调试_元"}}]}
{"name": "本体工程机械费_本体_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程机械费_本体_元】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "本体工程机械费_本体_元", "constraints": {"type": "CostItem", "name": "本体工程机械费_本体_元"}}]}
{"name": "本体工程机械费_调试_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程机械费_调试_元】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "本体工程机械费_调试_元", "constraints": {"type": "CostItem", "name": "本体工程机械费_调试_元"}}]}
{"name": "基础工程费用_元", "query": "从【架空输电线路本体工程/基础工程】项目划分中获取名称属于【基础工程费用_元】的费用", "result": [{"name": "基础工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/基础工程", "name": "基础工程"}}, {"name": "基础工程费用_元", "constraints": {"type": "CostItem", "name": "基础工程费用_元"}}]}
{"name": "杆塔工程费用_元", "query": "从【架空输电线路本体工程/杆塔工程】项目划分中获取名称属于【杆塔工程费用_元】的费用", "result": [{"name": "杆塔工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程", "name": "杆塔工程"}}, {"name": "杆塔工程费用_元", "constraints": {"type": "CostItem", "name": "杆塔工程费用_元"}}]}
{"name": "接地工程费用_元", "query": "从【架空输电线路本体工程/接地工程】项目划分中获取名称属于【接地工程费用_元】的费用", "result": [{"name": "接地工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/接地工程", "name": "接地工程"}}, {"name": "接地工程费用_元", "constraints": {"type": "CostItem", "name": "接地工程费用_元"}}]}
{"name": "架线工程费用_元", "query": "从【架空输电线路本体工程/架线工程】项目划分中获取名称属于【架线工程费用_元】的费用", "result": [{"name": "架线工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程", "name": "架线工程"}}, {"name": "架线工程费用_元", "constraints": {"type": "CostItem", "name": "架线工程费用_元"}}]}
{"name": "附件工程费用_元", "query": "从【架空输电线路本体工程/附件安装工程】项目划分中获取名称属于【附件工程费用_元】的费用", "result": [{"name": "附件安装工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/附件安装工程", "name": "附件安装工程"}}, {"name": "附件工程费用_元", "constraints": {"type": "CostItem", "name": "附件工程费用_元"}}]}
{"name": "辅助工程费用_元", "query": "从【架空输电线路本体工程/辅助工程】项目划分中获取名称属于【辅助工程费用_元】的费用", "result": [{"name": "辅助工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/辅助工程", "name": "辅助工程"}}, {"name": "辅助工程费用_元", "constraints": {"type": "CostItem", "name": "辅助工程费用_元"}}]}
{"name": "辅助工程费用_调试_元", "query": "从【架空输电线路本体工程/辅助工程】项目划分中获取名称属于【辅助工程费用_调试_元】的费用", "result": [{"name": "辅助工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/辅助工程", "name": "辅助工程"}}, {"name": "辅助工程费用_调试_元", "constraints": {"type": "CostItem", "name": "辅助工程费用_调试_元"}}]}
{"name": "辅助设施工程_元", "query": "从【工程费用】中获取【辅助设施工程.合计费】的属性", "result": [{"name": "辅助设施工程", "constraints": {"type": "ProjectDivisionItem", "name": "辅助设施工程"}}, {"name": "合计费", "constraints": {"type": "CostItem", "name": "合计费"}}]}
{"name": "其他费用合计_元", "query": "从【工程费用】中获取【其他费用.合计费】的属性", "result": [{"name": "工程费用", "constraints": {"type": "FeeScheduleItem", "name": "工程费用表"}}, {"name": "其他费用.合计费", "constraints": {"type": "Fee", "name": "合计费", "code": "其他费用"}}]}
{"name": "建场费合计_元", "query": "从【其他费用】中获取【建设场地征用及清理费】的属性", "result": [{"name": "其他费用", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "建设场地征用及清理费", "constraints": {"type": "Fee", "name": "建设场地征用及清理费"}}]}
{"name": "项目建设管理费合计_元", "query": "从【其他费用】中获取【项目建设管理费】的属性", "result": [{"name": "其他费用", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "项目建设管理费", "constraints": {"type": "Fee", "name": "项目建设管理费"}}]}
{"name": "其中:工程监理费_元", "query": "从【其他费用】中获取【工程监理费】的属性", "result": [{"name": "其他费用表", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "工程监理费", "constraints": {"type": "Fee", "name": "工程监理费"}}]}
{"name": "项目建设技术服务费合计_元", "query": "从【其他费用】中获取【项目建设技术服务费】的属性", "result": [{"name": "其他费用", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "项目建设技术服务费", "constraints": {"type": "Fee", "name": "项目建设技术服务费"}}]}
{"name": "其中:项目前期工作费_元", "query": "从【其他费用】中获取【项目前期工作费】的属性", "result": [{"name": "其他费用表", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "项目前期工作费", "constraints": {"type": "Fee", "name": "项目前期工作费"}}]}
{"name": "其中:勘察费_元", "query": "从【其他费用】中获取【勘察费】的属性", "result": [{"name": "其他费用表", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "勘察费", "constraints": {"type": "Fee", "name": "勘察费"}}]}
{"name": "其中:设计费_元", "query": "从【其他费用】中获取【设计费】的属性", "result": [{"name": "其他费用", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "设计费", "constraints": {"type": "Fee", "name": "设计费"}}]}
{"name": "其中:工程建设检测费_元", "query": "从【其他费用】中获取【工程建设检测费】的属性", "result": [{"name": "其他费用", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "工程建设检测费", "constraints": {"type": "Fee", "name": "工程建设检测费"}}]}
{"name": "生产准备费_元", "query": "从【其他费用】中获取【生产准备费】的属性", "result": [{"name": "其他费用表", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "生产准备费", "constraints": {"type": "Fee", "name": "生产准备费"}}]}
{"name": "其中:安全文明施工费_线路_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【其中:安全文明施工费_线路_元】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "其中:安全文明施工费_线路_元", "constraints": {"type": "CostItem", "name": "其中:安全文明施工费_线路_元"}}]}
{"name": "其中:安全文明施工费_调试_元", "query": "从【架空输电线路本体工程】项目划分中获取名称属于【其中:安全文明施工费_调试_元】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "其中:安全文明施工费_调试_元", "constraints": {"type": "CostItem", "name": "其中:安全文明施工费_调试_元"}}]}
{"name": "基本预备费_元", "query": "从【工程费用】中获取【基本预备费.合计费】的属性", "result": [{"name": "基本预备费.合计费", "constraints": {"type": "Fee", "name": "基本预备费.合计费"}}]}
{"name": "静态投资_元", "query": "从【工程费用】中获取【工程静态投资(一~七项合计).合计费】的属性", "result": [{"name": "工程费用表", "constraints": {"type": "FeeScheduleItem", "name": "工程费用表"}}, {"name": "工程静态投资(一~七项合计).合计费", "constraints": {"type": "Fee", "name": "工程静态投资(一~七项合计).合计费"}}]}
{"name": "建设期利息_元", "query": "从【工程费用】中获取【建设期贷款利息.合计费】的属性", "result": [{"name": "建设期贷款利息", "constraints": {"type": "Fee", "name": "建设期贷款利息", "code": "DKLX"}}, {"name": "合计费", "constraints": {"type": "Fee", "name": "合计费"}}]}
{"name": "动态投资_元", "query": "从【工程费用】中获取【工程动态投资(一~八项合计).合计费】的属性", "result": [{"name": "工程费用", "constraints": {"type": "FeeScheduleItem", "name": "工程费用表"}}, {"name": "工程动态投资(一~八项合计).合计费", "constraints": {"type": "Fee", "name": "工程动态投资(一~八项合计).合计费"}}]}
{"name": "增值税抵扣税额_元", "query": "从【工程费用】中获取【其中:可抵扣增值税额.合计费】的属性", "result": [{"name": "工程费用", "constraints": {"type": "FeeScheduleItem", "name": "工程费用表"}}, {"name": "其中:可抵扣增值税额.合计费", "constraints": {"type": "Fee", "name": "其中:可抵扣增值税额.合计费"}}]}