From d1c129c691e117b1199d3a5126edbb7201a698f1 Mon Sep 17 00:00:00 2001 From: paituo <330435863@qq.com> Date: Mon, 7 Jul 2025 08:23:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=AE=8C=E6=95=B4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.yaml | 2 +- data/bowei_api_docs.md | 24 ++-- src/code_executor.py | 104 +++++++++----- src/config.py | 15 -- src/dialog_manager.py | 12 -- src/document_loader.py | 16 --- src/embedding_client.py | 13 +- src/llm_client.py | 14 +- src/multi_llm_client.py | 14 +- src/neo4j_raw_retriever.py | 14 +- src/neo4j_retriever.py | 14 +- src/project.py | 44 +++--- src/project_implementation.py | 256 +++++++++++++++++++++++----------- src/prompt_manager.py | 19 +-- src/user_interaction.py | 12 -- tests/code.jsonl | 86 ++++++------ tests/zhibiao.json | 42 +++--- tests/zhibiao.jsonl | 86 ++++++------ tools/streamlt_showcode.py | 162 +++++++++++---------- tools/xml_to_json.py | 24 +++- 20 files changed, 504 insertions(+), 469 deletions(-) diff --git a/config.yaml b/config.yaml index 1ca24d1..a381138 100644 --- a/config.yaml +++ b/config.yaml @@ -7,7 +7,7 @@ neo4j: keyword_index_name: name_keyword_index # 关键词索引名称,默认 "keyword" business_object_structure_path: ./data/business_object_structure.md -bowei_api_docs_path: ./data/bowei_api_docs.md +bowei_api_docs_path: ./src/project.py max_retries: 0 openai: diff --git a/data/bowei_api_docs.md b/data/bowei_api_docs.md index 66eaaf0..d67c211 100644 --- a/data/bowei_api_docs.md +++ b/data/bowei_api_docs.md @@ -19,7 +19,7 @@ class ProjectToolkit(ABC): # 项目划分查询方法 @abstractmethod - def get_division_by_name(self, name): + def get_division_by_name(self, name_part): """ 通过名称获取项目划分对象 @@ -89,7 +89,7 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_quantities_node_by_parent_and_code(self, parent_path, quantity_type=None, code=None): + def get_quantities_node_by_parent_and_code(self, parent_path, quantity_type, code): """ 通过父节点路径和编码获取工程量对象(定额、主材或设备),包括子节点 @@ -108,14 +108,15 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_quantities_node_by_parent_and_name(self, parent_path, partial_name, quantity_type=None): + def get_quantities_node_by_parent_and_name(self, parent_path, quantity_type, partial_name): """ - 通过父节点路径、模糊节点名称和类型获取工程量对象(主材或者设备),包括子节点 + 通过父节点路径、类型和模糊节点名称获取工程量对象(主材或者设备),包括子节点 Args: parent_path (str): 父节点的路径,以'/'分隔的多级节点路径 - partial_name (str): 目标节点的模糊或不完整名称 quantity_type (str): 工程量类型('定额'、'主材'、'设备') + partial_name (str): 目标节点的模糊或不完整名称 + Returns: dict: 返回字典,字段包括: @@ -202,7 +203,7 @@ class ProjectToolkit(ABC): # 费用表查询方法 @abstractmethod - def get_fee_schedule_on_auxiliary_expense_table(self, table_name, fee_name, fee: str): + def get_fee_schedule_on_auxiliary_expense_table(self, table_name, fee_name, fee_attribute: str): """ 在辅助费用表中查找费用 @@ -221,7 +222,7 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_fee_schedule_on_other_expense_table(self, table_name, fee_name, fee): + def get_fee_schedule_on_other_expense_table(self, table_name, fee_name, fee_attribute): """ 在其它费用表中查找费用 @@ -240,7 +241,7 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_fee_schedule_on_land_acquisition_fee_table_table(self, table_name, fee_name, fee): + def get_fee_schedule_on_land_acquisition_fee_table_table(self, table_name, fee_name, fee_attribute): """ 在其中:场地征用费用表中查找费用 @@ -259,7 +260,7 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_fee_schedule_on_installation_price_difference_table(self, table_name, fee_name, fee): + def get_fee_schedule_on_installation_price_difference_table(self, table_name, fee_name, fee_attribute): """ 在安装价差费用表中查找费用 @@ -278,7 +279,7 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_fee_schedule_on_Engineering_Cost_table(self, table_name, fee_name, fee): + def get_fee_schedule_on_Engineering_Cost_table(self, table_name, fee_name, fee_attribute): """ 在工程费用表中查找费用 @@ -687,6 +688,7 @@ class Fee: self.施工费 = None # xsd:string (可选) self.单位投资 = None # xsd:string (可选) + class ProjectBuilder: # 存储注册的工具类 _registry = None @@ -724,5 +726,5 @@ class ProjectBuilder: if cls._registry is None: raise KeyError(f"未注册的类,请先注册类") - return cls._registry(cls._config) + diff --git a/src/code_executor.py b/src/code_executor.py index 59e4caa..533a4d2 100644 --- a/src/code_executor.py +++ b/src/code_executor.py @@ -12,23 +12,11 @@ from src.project import ProjectBuilder, ProjectToolkit import sys import io import traceback +import importlib 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) - class CodeExecutor: def __init__(self, prompts, llm_client, max_retries): self.llm_client = llm_client @@ -36,45 +24,87 @@ class CodeExecutor: self.max_retries = max_retries if max_retries >= 1 else 1 self.output_parser = StrOutputParser() - def generate_code(self, user_request: str, context: str = "", bowei_api_docs: str = "") -> str: + def generate_code(self, user_request: str, context: str = "", bowei_api_docs: str = "") -> dict: logger.info(f"开始生成代码,访问请求:{user_request}") prompt = self.prompts.code_gen_prompt.format_prompt( user_request=user_request, context=context, bowei_api_docs=bowei_api_docs ) - response = self.llm_client.invoke(prompt.to_messages()) - code = self.output_parser.parse(response) - logger.debug(f"生成的代码内容:\n{code}") + try: + response = self.llm_client.invoke(prompt.to_messages()) + parsed_response = self.output_parser.parse(response) + + # 处理 AIMessage 类型的返回值 + if hasattr(parsed_response, 'content'): + code = parsed_response.content + else: + code = str(parsed_response) + + logger.debug(f"生成的代码内容:\n{code}") + return { + "code": 20000, + "message": 'ok', + "status": True, + "data": code + } + except Exception as e: + logger.error(f"大模型调用失败: {str(e)}", exc_info=True) + return { + "code": 50000, + "message": f'大模型调用失败: {str(e)}', + "status": False, + "data": None + } - return { - "code": 20000, - "message": 'ok', - "status": True, - "data": code.content - } - - def fix_code(self, code: str, error: str) -> str: + def fix_code(self, code: str, error: str) -> dict: logger.warning(f"代码执行出错,开始修复。错误信息:{error}") prompt = self.prompts.code_fix_prompt.format_prompt(code=code, error=error) - response = self.llm_client.invoke(prompt.to_messages()) - fixed_code = self.output_parser.parse(response) - logger.debug(f"修复后的代码内容:\n{fixed_code}") - - return { - "code": 20000, - "message": 'ok', - "status": True, - "data": fixed_code.content - } + try: + response = self.llm_client.invoke(prompt.to_messages()) + parsed_response = self.output_parser.parse(response) + + # 处理 AIMessage 类型的返回值 + if hasattr(parsed_response, 'content'): + fixed_code = parsed_response.content + else: + fixed_code = str(parsed_response) + + logger.debug(f"修复后的代码内容:\n{fixed_code}") + return { + "code": 20000, + "message": 'ok', + "status": True, + "data": fixed_code + } + except Exception as e: + logger.error(f"代码修复时大模型调用失败: {str(e)}", exc_info=True) + return { + "code": 50001, + "message": f'代码修复失败: {str(e)}', + "status": False, + "data": None + } def execute_code(self, code_str) -> dict: """封装代码执行逻辑""" logger.debug(f"开始执行代码:\n {code_str}") - + try: + import re + pattern = r'```python(.*?)```' + match = re.search(pattern, code_str, re.DOTALL) + if match: + code_str = match.group(1).strip() + except Exception as e: + logger.warning(f"解析生成代码格式时发生异常: {str(e)}") + old_stdout = None try: namespace = { - "project": __import__("src.project"), + "project": importlib.import_module("src.project"), + "Material": getattr(importlib.import_module("src.project"), "Material", None), + "Ration": getattr(importlib.import_module("src.project"), "Ration", None), + "Equipment": getattr(importlib.import_module("src.project"), "Equipment", None), + "MaterialOrEquipment": getattr(importlib.import_module("src.project"), "MaterialOrEquipment", None), "ProjectBuilder": ProjectBuilder, } diff --git a/src/config.py b/src/config.py index 8dec8f9..188f0e1 100644 --- a/src/config.py +++ b/src/config.py @@ -5,21 +5,6 @@ import os import logging from datetime import datetime -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) - class Config: def __init__(self, path="config.yaml"): with open(path, "r", encoding="utf-8") as f: diff --git a/src/dialog_manager.py b/src/dialog_manager.py index a49a6c8..2ab3001 100644 --- a/src/dialog_manager.py +++ b/src/dialog_manager.py @@ -8,18 +8,6 @@ from langchain.schema import SystemMessage, HumanMessage import asyncio 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) class QuestionProcessor: diff --git a/src/document_loader.py b/src/document_loader.py index 64729eb..af3d29c 100644 --- a/src/document_loader.py +++ b/src/document_loader.py @@ -1,23 +1,7 @@ # src/document_loader.py import os -import logging -from datetime import datetime -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 load_file(path: str) -> str: try: diff --git a/src/embedding_client.py b/src/embedding_client.py index 82f361a..da33bcf 100644 --- a/src/embedding_client.py +++ b/src/embedding_client.py @@ -6,20 +6,9 @@ from datetime import datetime from langchain_openai import OpenAIEmbeddings 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) + class EmbeddingClient: def __init__(self, embedding_config: dict): api_key = embedding_config.get("api_key") diff --git a/src/llm_client.py b/src/llm_client.py index 6b83d25..c90f329 100644 --- a/src/llm_client.py +++ b/src/llm_client.py @@ -8,21 +8,11 @@ import getpass from langchain_openai import ChatOpenAI from langchain_core.rate_limiters import InMemoryRateLimiter + 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) + class LLMClient: def __init__(self, openai_config: dict): api_key = openai_config.get("api_key") diff --git a/src/multi_llm_client.py b/src/multi_llm_client.py index 9db1ac7..da8814f 100644 --- a/src/multi_llm_client.py +++ b/src/multi_llm_client.py @@ -9,19 +9,8 @@ import itertools from langchain_openai import ChatOpenAI from langchain_core.rate_limiters import InMemoryRateLimiter + 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) class MultiAPIKeyChatOpenAI: @@ -63,6 +52,7 @@ class MultiAPIKeyChatOpenAI: # 轮询器,用于循环调用不同的 llm 实例 self._llm_cycle = itertools.cycle(self.llms) + self.llm = next(self._llm_cycle) def invoke(self, messages): llm = next(self._llm_cycle) diff --git a/src/neo4j_raw_retriever.py b/src/neo4j_raw_retriever.py index bdced7f..e794f37 100644 --- a/src/neo4j_raw_retriever.py +++ b/src/neo4j_raw_retriever.py @@ -7,21 +7,11 @@ from typing import List from langchain.schema import Document from neo4j import GraphDatabase + 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) + class Neo4jRawRetriever: def __init__(self, neo4j_conf: dict): self.uri = neo4j_conf.get("uri") diff --git a/src/neo4j_retriever.py b/src/neo4j_retriever.py index e43418d..1ef7efd 100644 --- a/src/neo4j_retriever.py +++ b/src/neo4j_retriever.py @@ -6,21 +6,11 @@ from datetime import datetime from langchain_neo4j import Neo4jVector from langchain_openai import OpenAIEmbeddings + 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) + class Neo4jKnowledgeRetriever: def __init__(self, neo4j_conf: dict, embedding_client): neo4j_uri = neo4j_conf.get("uri") diff --git a/src/project.py b/src/project.py index 66eaaf0..b759691 100644 --- a/src/project.py +++ b/src/project.py @@ -5,6 +5,7 @@ from abc import ABC, abstractmethod import json +from typing import Any, Type class ProjectToolkit(ABC): @@ -13,13 +14,13 @@ class ProjectToolkit(ABC): 描述: 代表整个项目结构的顶层容器 """ - def __init__(self): - self.project_division_set = ProjectDivisionItem() # 项目划分集对象 + def __init__(self, config: Any): + pass # 项目划分查询方法 @abstractmethod - def get_division_by_name(self, name): + def get_division_by_name(self, name_part): """ 通过名称获取项目划分对象 @@ -89,7 +90,7 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_quantities_node_by_parent_and_code(self, parent_path, quantity_type=None, code=None): + def get_quantities_node_by_parent_and_code(self, parent_path, quantity_type, code): """ 通过父节点路径和编码获取工程量对象(定额、主材或设备),包括子节点 @@ -108,14 +109,15 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_quantities_node_by_parent_and_name(self, parent_path, partial_name, quantity_type=None): + def get_quantities_node_by_parent_and_name(self, parent_path, quantity_type, partial_name): """ - 通过父节点路径、模糊节点名称和类型获取工程量对象(主材或者设备),包括子节点 + 通过父节点路径、类型和模糊节点名称获取工程量对象(主材或者设备),包括子节点 Args: parent_path (str): 父节点的路径,以'/'分隔的多级节点路径 - partial_name (str): 目标节点的模糊或不完整名称 quantity_type (str): 工程量类型('定额'、'主材'、'设备') + partial_name (str): 目标节点的模糊或不完整名称 + Returns: dict: 返回字典,字段包括: @@ -202,7 +204,7 @@ class ProjectToolkit(ABC): # 费用表查询方法 @abstractmethod - def get_fee_schedule_on_auxiliary_expense_table(self, table_name, fee_name, fee: str): + def get_fee_schedule_on_auxiliary_expense_table(self, table_name, fee_name, fee_attribute: str): """ 在辅助费用表中查找费用 @@ -221,7 +223,7 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_fee_schedule_on_other_expense_table(self, table_name, fee_name, fee): + def get_fee_schedule_on_other_expense_table(self, table_name, fee_name, fee_attribute): """ 在其它费用表中查找费用 @@ -240,7 +242,7 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_fee_schedule_on_land_acquisition_fee_table_table(self, table_name, fee_name, fee): + def get_fee_schedule_on_land_acquisition_fee_table_table(self, table_name, fee_name, fee_attribute): """ 在其中:场地征用费用表中查找费用 @@ -259,7 +261,7 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_fee_schedule_on_installation_price_difference_table(self, table_name, fee_name, fee): + def get_fee_schedule_on_installation_price_difference_table(self, table_name, fee_name, fee_attribute): """ 在安装价差费用表中查找费用 @@ -278,7 +280,7 @@ class ProjectToolkit(ABC): pass @abstractmethod - def get_fee_schedule_on_Engineering_Cost_table(self, table_name, fee_name, fee): + def get_fee_schedule_on_Engineering_Cost_table(self, table_name, fee_name, fee_attribute): """ 在工程费用表中查找费用 @@ -687,18 +689,19 @@ class Fee: self.施工费 = None # xsd:string (可选) self.单位投资 = None # xsd:string (可选) -class ProjectBuilder: - # 存储注册的工具类 - _registry = None - _config = {} +class ProjectBuilder: """项目工具工厂类""" + + # 存储注册的工具类 + _registry: Type[ProjectToolkit] | None = None + _config: Any = None def __init__(self): pass @classmethod - def register(cls, toolkit_class: type, config: dict): + def register(cls, toolkit_class: Type[ProjectToolkit], config: Any): """ 注册工具类到工厂 @@ -716,13 +719,10 @@ class ProjectBuilder: """ 创建工具实例 - 参数: - 返回: 实例化的工具对象 """ if cls._registry is None: - raise KeyError(f"未注册的类,请先注册类") + raise KeyError("未注册的类,请先注册类") - - return cls._registry(cls._config) + return cls._registry(cls._config) \ No newline at end of file diff --git a/src/project_implementation.py b/src/project_implementation.py index d06af78..dd9ac97 100644 --- a/src/project_implementation.py +++ b/src/project_implementation.py @@ -25,7 +25,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): if neo4j_driver is None: raise ValueError("必须提供Neo4j驱动实例") - super().__init__() + super().__init__(neo4j_driver) # 保存驱动实例 self.driver = neo4j_driver @@ -164,7 +164,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): if not node_data: code = 201 status_flag = False - error = f"找不到路径: {path} 上的ProjectDivisionItem节点" + error = f"错误信息:找不到路径: {path} 上的ProjectDivisionItem节点" # 提取父路径 path_parts = path.split("/") @@ -190,7 +190,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): if record["name"]: helper_info.append(record["name"]) except Exception as e: - helper_info = [f"查询父节点下的子节点时出错: {str(e)}"] + helper_info = [f"错误信息:查询父节点下的子节点时出错: {str(e)}"] # 拼接 message message = f"错误信息:{error}; 辅助信息: {helper_info}" @@ -246,7 +246,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): if not partial_name: code = 201 status_flag = False - message = "节点名称不能为空" + message = "错误信息:partial_name参数错误,参数不能为空" else: try: # 第一步:找到父节点 @@ -385,7 +385,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): if not name_part or name_part.strip() == "": code = 201 status_flag = False - message = "输入的名称部分不能为空" + message = "错误信息:name_part参数错误,参数不能为空" else: try: # 直接查询所有类型为ProjectDivisionItem且name包含输入名称的节点 @@ -482,7 +482,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): if not paths_str: code = 201 status_flag = False - message = "路径不能为空" + message = "错误信息:paths_str参数错误,参数不能为空" else: try: # 使用通用方法获取节点,考虑所有可能的工程量类型 @@ -547,7 +547,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): # 最终统一返回格式包装成列表 return {"code": code, "message": message, "status": status_flag, "data": data} - def get_quantities_node_by_parent_and_code(self, parent_path, quantity_type=None, code=None) -> dict: + def get_quantities_node_by_parent_and_code(self, parent_path, quantity_type, code) -> dict: """ 通过父节点路径和编码获取工程量对象(定额、主材或设备),包括子节点 @@ -579,13 +579,13 @@ class ProjectToolkitNeo4j(ProjectToolkit): if not code or code.strip() == "": code_status = 201 status_flag = False - message = "编码不能为空" + message = "错误信息:code参数错误,参数不能为空" valid_types = ["定额", "主材", "设备", None] if quantity_type not in valid_types: code_status = 201 status_flag = False - message = f"无效的工程量类型: '{quantity_type}';有效类型为 {valid_types}" + message = f"错误信息:quantity_type参数错误,有效类型为 {valid_types},当前值是'{quantity_type}'" elif code_status == 200: try: @@ -701,7 +701,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): def get_quantities_node_by_parent_and_name(self, parent_path, quantity_type, partial_name) -> dict: """ - 通过父节点路径、模糊节点名称和类型获取工程量对象(主材或者设备),包括子节点 + 通过父节点路径、类型和模糊节点名称获取工程量对象(主材或者设备),包括子节点 执行三步查询: 1. 找到对应路径的父节点 @@ -714,7 +714,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): quantity_type (str): 工程量类型('定额'、'主材'、'设备') Returns: - dict: 返回字典,字段包括: + dict: 包含一个字典,字段包括: - code (int): 状态码,固定为 200(成功)或 201(失败) - message (str): 成功时为 "Ok",失败时包含错误信息和辅助信息 - status (bool): 成功为 True,失败为 False @@ -825,30 +825,59 @@ class ProjectToolkitNeo4j(ProjectToolkit): matching_nodes = [] available_names = [] + # 统一处理 partial_name 为列表形式 + if isinstance(partial_name, str): + if partial_name.strip() == "": + code_status = 201 + status_flag = False + message = "partial_name 不能为空" + else: + # 支持中文逗号、英文逗号、空格分隔 + import re + + keywords = re.split(r"[,,、\s]+", partial_name.strip()) + else: + keywords = partial_name or [] + + if not keywords: + code_status = 201 + status_flag = False + message = "未提供有效的关键词" + + if code_status != 200: + return {"code": code_status, "message": message, "status": status_flag, "data": data} + + # 尝试用 Python 端过滤 for node in child_nodes: node_name = node.get("name", "") - if node_name: - available_names.append(node_name) + available_names.append(node_name) - if partial_name in str(node_name): - matching_nodes.append(node) + for keyword in keywords: + if keyword in str(node_name): + matching_nodes.append(node) + break + # 如果 Python 端没找到,尝试数据库端模糊搜索 if not matching_nodes: + # 构建动态查询语句 + where_clauses = " OR ".join([f"q.name CONTAINS '{keyword}'" for keyword in keywords]) direct_query = f""" MATCH (q) - WHERE q.name CONTAINS $partial_name AND {type_condition} + WHERE ({where_clauses}) AND {type_condition} RETURN q LIMIT 20 """ - direct_params = {"partial_name": partial_name} - - direct_result = self.session.run(direct_query, **direct_params) - matching_nodes = [record["q"] for record in direct_result] + try: + direct_result = self.session.run(direct_query) + matching_nodes = [record["q"] for record in direct_result] + except Exception as e: + code_status = 201 + status_flag = False + message = f"数据库模糊查询失败: {str(e)}" if not matching_nodes: code_status = 201 status_flag = False - message = f"错误信息:在父节点路径'{parent_path}' 下找不到名称包含 '{partial_name}' 的节点;辅助信息:{available_names}" - + message = f"错误信息:在父节点路径'{parent_path}' 下找不到包含关键词 {keywords} 的节点;辅助信息:{available_names}" else: result_data = [] for node in matching_nodes: @@ -1008,7 +1037,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): if not parent_path or not code: code_status = 201 status_flag = False - message = "父节点路径或要查找的编码不能为空" + message = "错误信息:parent_path或code参数错误,参数不能为空" else: try: @@ -1323,7 +1352,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): fee_attribute (str): 费用值属性名 Returns: - dict: 返回字典,字段包括: + dict: 包含一个字典,字段包括: - code (int): 状态码,固定为 200(成功)或 201(失败) - message (str): 成功时为 "Ok",失败时包含错误信息和辅助信息 - status (bool): 成功为 True,失败为 False @@ -1344,6 +1373,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): else: # 第一步:查找父节点(费用表节点) + table_name = table_name.replace("表", "") parent_path = f"工程/工程费用/{table_name}" parent_node_data = self.get_node_by_path(parent_path) @@ -1417,17 +1447,28 @@ class ProjectToolkitNeo4j(ProjectToolkit): else: # 第三步:获取费用节点的属性值 try: - if fee_node and hasattr(fee_node, "get"): - fee_value = fee_node.get(fee_attribute) - elif fee_node and isinstance(fee_node, dict): - fee_value = fee_node.get(fee_attribute) + if hasattr(fee_node, "keys"): + all_attrs = list(fee_node.keys()) + elif isinstance(fee_node, dict): + all_attrs = list(fee_node.keys()) else: - # 如果fee_node是Neo4j Node对象,尝试直接访问属性 - fee_value = ( - getattr(fee_node, fee_attribute, None) - if hasattr(fee_node, fee_attribute) - else fee_node.get(fee_attribute) if hasattr(fee_node, "get") else None - ) + all_attrs = list(fee_node.keys()) if hasattr(fee_node, "keys") else [] + + # 过滤掉私有属性 + all_attrs = [attr for attr in all_attrs if not attr.startswith("_")] + + # 使用“包含”逻辑模糊匹配属性名 + matched_attrs = [] + for attr in all_attrs: + if fee_attribute.lower() in attr.lower() or attr.lower() in fee_attribute.lower(): + matched_attrs.append(attr) + + if matched_attrs: + # 优先返回第一个匹配项的值 + best_match = matched_attrs[0] + fee_value = fee_node.get(best_match) + else: + fee_value = None if fee_value is None: code_status = 201 @@ -1487,7 +1528,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): fee_attribute (str): 费用值属性名 Returns: - dict: 返回字典,字段包括: + dict: 包含一个字典,字段包括: - code (int): 状态码,固定为 200(成功)或 201(失败) - message (str): 成功时为 "Ok",失败时包含错误信息和辅助信息 - status (bool): 成功为 True,失败为 False @@ -1508,6 +1549,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): else: # 第一步:查找父节点(费用表节点) + table_name = table_name.replace("表", "") parent_path = f"工程/工程费用/{table_name}" parent_node_data = self.get_node_by_path(parent_path) @@ -1541,7 +1583,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): # 递归查找费用节点,最多查找3级深度 query = """ - MATCH (p)-[*1..3]->(f) + MATCH (p)-[*1..]->(f) WHERE p.name = $table_name AND f.name = $fee_name RETURN f LIMIT 1 """ @@ -1581,17 +1623,28 @@ class ProjectToolkitNeo4j(ProjectToolkit): else: # 第三步:获取费用节点的属性值 try: - if fee_node and hasattr(fee_node, "get"): - fee_value = fee_node.get(fee_attribute) - elif fee_node and isinstance(fee_node, dict): - fee_value = fee_node.get(fee_attribute) + if hasattr(fee_node, "keys"): + all_attrs = list(fee_node.keys()) + elif isinstance(fee_node, dict): + all_attrs = list(fee_node.keys()) else: - # 如果fee_node是Neo4j Node对象,尝试直接访问属性 - fee_value = ( - getattr(fee_node, fee_attribute, None) - if hasattr(fee_node, fee_attribute) - else fee_node.get(fee_attribute) if hasattr(fee_node, "get") else None - ) + all_attrs = list(fee_node.keys()) if hasattr(fee_node, "keys") else [] + + # 过滤掉私有属性 + all_attrs = [attr for attr in all_attrs if not attr.startswith("_")] + + # 使用“包含”逻辑模糊匹配属性名 + matched_attrs = [] + for attr in all_attrs: + if fee_attribute.lower() in attr.lower() or attr.lower() in fee_attribute.lower(): + matched_attrs.append(attr) + + if matched_attrs: + # 优先返回第一个匹配项的值 + best_match = matched_attrs[0] + fee_value = fee_node.get(best_match) + else: + fee_value = None if fee_value is None: code_status = 201 @@ -1653,7 +1706,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): fee_attribute (str): 费用值属性名 Returns: - dict: 返回字典,字段包括: + dict: 包含一个字典,字段包括: - code (int): 状态码,固定为 200(成功)或 201(失败) - message (str): 成功时为 "Ok",失败时包含错误信息和辅助信息 - status (bool): 成功为 True,失败为 False @@ -1674,6 +1727,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): else: # 第一步:查找父节点(费用表节点) + table_name = table_name.replace("表", "") parent_path = f"工程/工程费用/{table_name}" parent_node_data = self.get_node_by_path(parent_path) @@ -1747,17 +1801,28 @@ class ProjectToolkitNeo4j(ProjectToolkit): else: # 第三步:获取费用节点的属性值 try: - if fee_node and hasattr(fee_node, "get"): - fee_value = fee_node.get(fee_attribute) - elif fee_node and isinstance(fee_node, dict): - fee_value = fee_node.get(fee_attribute) + if hasattr(fee_node, "keys"): + all_attrs = list(fee_node.keys()) + elif isinstance(fee_node, dict): + all_attrs = list(fee_node.keys()) else: - # 如果fee_node是Neo4j Node对象,尝试直接访问属性 - fee_value = ( - getattr(fee_node, fee_attribute, None) - if hasattr(fee_node, fee_attribute) - else fee_node.get(fee_attribute) if hasattr(fee_node, "get") else None - ) + all_attrs = list(fee_node.keys()) if hasattr(fee_node, "keys") else [] + + # 过滤掉私有属性 + all_attrs = [attr for attr in all_attrs if not attr.startswith("_")] + + # 使用“包含”逻辑模糊匹配属性名 + matched_attrs = [] + for attr in all_attrs: + if fee_attribute.lower() in attr.lower() or attr.lower() in fee_attribute.lower(): + matched_attrs.append(attr) + + if matched_attrs: + # 优先返回第一个匹配项的值 + best_match = matched_attrs[0] + fee_value = fee_node.get(best_match) + else: + fee_value = None if fee_value is None: code_status = 201 @@ -1819,7 +1884,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): fee_attribute (str): 费用值属性名 Returns: - dict: 返回字典,字段包括: + dict: 包含一个字典,字段包括: - code (int): 状态码,固定为 200(成功)或 201(失败) - message (str): 成功时为 "Ok",失败时包含错误信息和辅助信息 - status (bool): 成功为 True,失败为 False @@ -1840,6 +1905,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): else: # 第一步:查找父节点(费用表节点) + table_name = table_name.replace("表", "") parent_path = f"工程/工程费用/{table_name}" parent_node_data = self.get_node_by_path(parent_path) @@ -1913,17 +1979,28 @@ class ProjectToolkitNeo4j(ProjectToolkit): else: # 第三步:获取费用节点的属性值 try: - if fee_node and hasattr(fee_node, "get"): - fee_value = fee_node.get(fee_attribute) - elif fee_node and isinstance(fee_node, dict): - fee_value = fee_node.get(fee_attribute) + if hasattr(fee_node, "keys"): + all_attrs = list(fee_node.keys()) + elif isinstance(fee_node, dict): + all_attrs = list(fee_node.keys()) else: - # 如果fee_node是Neo4j Node对象,尝试直接访问属性 - fee_value = ( - getattr(fee_node, fee_attribute, None) - if hasattr(fee_node, fee_attribute) - else fee_node.get(fee_attribute) if hasattr(fee_node, "get") else None - ) + all_attrs = list(fee_node.keys()) if hasattr(fee_node, "keys") else [] + + # 过滤掉私有属性 + all_attrs = [attr for attr in all_attrs if not attr.startswith("_")] + + # 使用“包含”逻辑模糊匹配属性名 + matched_attrs = [] + for attr in all_attrs: + if fee_attribute.lower() in attr.lower() or attr.lower() in fee_attribute.lower(): + matched_attrs.append(attr) + + if matched_attrs: + # 优先返回第一个匹配项的值 + best_match = matched_attrs[0] + fee_value = fee_node.get(best_match) + else: + fee_value = None if fee_value is None: code_status = 201 @@ -1983,7 +2060,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): fee_attribute (str): 费用值属性名 Returns: - dict: 返回字典,字段包括: + dict: 包含一个字典,字段包括: - code (int): 状态码,固定为 200(成功)或 201(失败) - message (str): 成功时为 "Ok",失败时包含错误信息和辅助信息 - status (bool): 成功为 True,失败为 False @@ -2004,6 +2081,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): else: # 第一步:查找父节点(费用表节点) + table_name = table_name.replace("表", "") parent_path = f"工程/工程费用/{table_name}" parent_node_data = self.get_node_by_path(parent_path) @@ -2077,17 +2155,28 @@ class ProjectToolkitNeo4j(ProjectToolkit): else: # 第三步:获取费用节点的属性值 try: - if fee_node and hasattr(fee_node, "get"): - fee_value = fee_node.get(fee_attribute) - elif fee_node and isinstance(fee_node, dict): - fee_value = fee_node.get(fee_attribute) + if hasattr(fee_node, "keys"): + all_attrs = list(fee_node.keys()) + elif isinstance(fee_node, dict): + all_attrs = list(fee_node.keys()) else: - # 如果fee_node是Neo4j Node对象,尝试直接访问属性 - fee_value = ( - getattr(fee_node, fee_attribute, None) - if hasattr(fee_node, fee_attribute) - else fee_node.get(fee_attribute) if hasattr(fee_node, "get") else None - ) + all_attrs = list(fee_node.keys()) if hasattr(fee_node, "keys") else [] + + # 过滤掉私有属性 + all_attrs = [attr for attr in all_attrs if not attr.startswith("_")] + + # 使用“包含”逻辑模糊匹配属性名 + matched_attrs = [] + for attr in all_attrs: + if fee_attribute.lower() in attr.lower() or attr.lower() in fee_attribute.lower(): + matched_attrs.append(attr) + + if matched_attrs: + # 优先返回第一个匹配项的值 + best_match = matched_attrs[0] + fee_value = fee_node.get(best_match) + else: + fee_value = None if fee_value is None: code_status = 201 @@ -2223,7 +2312,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): fee_name (str): 取费名称 Returns: - dict: 返回字典,字段包括: + dict: 包含一个字典,字段包括: - code (int): 状态码,固定为 200(成功)或 201(失败) - message (str): 成功时为 "Ok",失败时包含错误信息和辅助信息 - status (bool): 成功为 True,失败为 False @@ -2308,10 +2397,10 @@ class ProjectToolkitNeo4j(ProjectToolkit): else: cost_set_node = record["c"] - # 第三步:在CostSet节点的子节点中查找名称为fee_name的CostItem节点 + # 第三步:在CostSet节点的子节点中查找名称为fee_name的CostItem节点(模糊匹配) query = """ MATCH (c:CostSet)-[*1..1]->(i:CostItem) - WHERE id(c) = $cost_set_id AND i.name = $fee_name + WHERE id(c) = $cost_set_id AND (i.name CONTAINS $fee_name OR $fee_name CONTAINS i.name) RETURN i LIMIT 1 """ @@ -2324,7 +2413,7 @@ class ProjectToolkitNeo4j(ProjectToolkit): if not record: code_status = 201 status_flag = False - error = f"在CostSet节点下找不到名称为 {fee_name} 的CostItem节点" + error = f"在CostSet节点下找不到与 {fee_name} 模糊匹配的CostItem节点" # 查询该CostSet下所有CostItem节点名称作为辅助信息 helper_query = """ @@ -3033,3 +3122,4 @@ class ProjectToolkitNeo4j(ProjectToolkit): # 统一返回格式包装成列表 return {"code": code_status, "message": message, "status": status_flag, "data": data} + diff --git a/src/prompt_manager.py b/src/prompt_manager.py index f046a68..116d803 100644 --- a/src/prompt_manager.py +++ b/src/prompt_manager.py @@ -75,9 +75,9 @@ def project_get_calculate_function(): # 执行规则 - 参数必须从用户问题或上下文信息中提取 +- 禁止在代码函数范围外添加任何注释或解释或非代码内容 - 输出代码中必须以def project_get_calculate_function() -> dict函数作为入口函数 -- 必须确保生成的代码可以直接执行,代码要注意进行各类错误检查,出错采用抛出异常方式,说明详细信息 -- 禁止添加任何注释或解释 +- 必须确保生成的代码可以直接执行,如果函数功能求取数值,project的函数返回结果为空或出错则算成功,data为0,并在message说明错误原因,代码要注意进行各类容错检查 - ProjectToolkit 类中涉及项目划分的函数已考虑在其及其子孙项目划分下查找,所以无需生成递归子项目划分的代码 - 如果文本中包含范围编码格式则需要进行编码展开,如'YX2-1~7'展开为‘YX2-1/YX2-2/YX2-3/YX2-4/YX2-5/YX2-6/YX2-7’ """ @@ -172,21 +172,6 @@ Cypher查询语句:MATCH (item:ProjectDivisionItem)\nWHERE item.name CONTAINS cypher_conversion_prompt=cypher_conversion_prompt, ) -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) - @dataclass class CodeExecutorPrompts: understand_prompt: ChatPromptTemplate diff --git a/src/user_interaction.py b/src/user_interaction.py index e6da9eb..d8b9e32 100644 --- a/src/user_interaction.py +++ b/src/user_interaction.py @@ -12,18 +12,6 @@ from typing import List, Dict, Any import asyncio 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) class BusinessObject(BaseModel): diff --git a/tests/code.jsonl b/tests/code.jsonl index 918ee93..ec2e28d 100644 --- a/tests/code.jsonl +++ b/tests/code.jsonl @@ -1,46 +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": "从【架空输电线路本体工程/基础工程】及其子孙项目划分中查找编码中包含【YX2-1~7】的所有【定额】的【数量】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n \n def expand_code_range(code_range):\n if '~' not in code_range:\n return code_range\n prefix, range_part = code_range.split('-')\n start, end = map(int, range_part.split('~'))\n return '/'.join([f\"{prefix}-{i}\" for i in range(start, end + 1)])\n \n expanded_codes = expand_code_range('YX2-1~7')\n \n result_dict = project.get_quantities_node_by_parent_and_code(\n parent_path='架空输电线路本体工程/基础工程',\n quantity_type='定额',\n code=expanded_codes\n )\n \n status = result_dict.get('status', False)\n if not status:\n return result_dict\n \n data = result_dict.get('data', [])\n if not isinstance(data, list):\n data = [data]\n \n total_quantity = 0.0\n for item in data:\n if isinstance(item, dict) and '数量' in item:\n try:\n quantity = float(item['数量'])\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_dict = project.get_quantities_node_by_parent_and_name(\n parent_path='架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立',\n quantity_type='主材',\n partial_name='角钢'\n )\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n data = result_dict.get('data', [])\n if not status:\n return {'code': 201, 'message': message, 'status': False, 'data': 0}\n total_quantity = 0.0\n for item in data:\n if isinstance(item, Material) and '数量' in item.__dict__:\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 path = \"架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立\"\n result_dict = project.get_quantities_node_by_parent_and_name(path, \"主材\", \"角钢、高强\")\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n data = result_dict.get('data', [])\n if not status:\n return {'code': 201, 'message': message, 'status': False, 'data': 0}\n total = 0.0\n for item in data:\n if isinstance(item, dict) and item.get('类型') == '主材' and '数量' in item:\n try:\n total += float(item['数量'])\n except (ValueError, TypeError):\n continue\n return {'code': 200, 'message': 'Ok', 'status': True, 'data': total}"} +{"name": "角钢塔_塔材装材费_元", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【角钢】的所有【主材】的【单价】之和", "code": "def project_get_calculate_function():\n project = ProjectBuilder.build()\n parent_path = \"架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立\"\n quantity_type = \"主材\"\n partial_name = \"角钢\"\n \n result_dict = project.get_quantities_node_by_parent_and_name(parent_path, quantity_type, partial_name)\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 hasattr(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 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 {'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 result_dict = project.get_quantities_node_by_parent_and_name(\n parent_path=\"架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立\",\n quantity_type=\"主材\",\n partial_name=\"钢管塔\"\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 '数量' in item:\n try:\n total_quantity += float(item['数量'])\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 result_dict = project.get_quantities_node_by_parent_and_name(\n parent_path='架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立',\n quantity_type='主材',\n partial_name='钢管塔'\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 not status:\n return {'status': False, 'message': message, 'code': code, '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 {'status': True, 'message': 'Ok', 'code': 200, '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 quantity_type='主材',\n partial_name='钢管杆'\n )\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n data = result_dict.get('data', [])\n if not status:\n return {'code': 201, 'message': message, 'status': False, 'data': []}\n \n total_quantity = 0.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 result_dict = project.get_quantities_node_by_parent_and_name(\n parent_path='架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立',\n quantity_type='主材',\n partial_name='钢管杆'\n )\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n data = result_dict.get('data', [])\n if not status:\n return {'code': 201, 'message': message, 'status': False, 'data': []}\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 {'code': 200, 'message': 'Ok', 'status': True, 'data': total_price}"} +{"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 parent_path = \"架空输电线路本体工程/架线工程\"\n quantity_type = \"定额\"\n 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 code_str = '/'.join(codes)\n result_dict = project.get_quantities_node_by_parent_and_code(parent_path, quantity_type, code_str)\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n data = result_dict.get('data', [])\n if status:\n total = 0.0\n for item in data:\n if isinstance(item, dict) and '参数' in item:\n try:\n total += float(item['参数'])\n except (ValueError, TypeError):\n pass\n return {'code': 200, 'message': 'Ok', 'status': True, 'data': total}\n else:\n return {'code': 201, 'message': message, 'status': False, 'data': 0.0}"} +{"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 quantity_type=\"主材\",\n partial_name=\"高导电率\"\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 material.get('类型') != '主材':\n continue\n if '高导电率' not in material.get('name', ''):\n continue\n \n try:\n quantity = float(material.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 total_price = 0.0\n \n paths = [\n \"架空输电线路本体工程/架线工程/导地线架设\",\n \"架空输电线路本体工程/架线工程/导地线跨越架设\"\n ]\n \n for path in paths:\n quantities_result = project.get_quantities_node_by_parent_and_name(path, \"主材\", \"线\")\n if not quantities_result.get('status', False):\n continue\n \n materials = quantities_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 total_price = 0.0\n \n paths = [\n \"架空输电线路本体工程/架线工程/导地线架设\",\n \"架空输电线路本体工程/架线工程/导地线跨越架设\"\n ]\n \n for path in paths:\n quantities_result = project.get_quantities_node_by_parent_and_name(\n parent_path=path,\n quantity_type=\"主材\",\n partial_name=\"高导电率\"\n )\n \n if not quantities_result.get('status', False):\n continue\n \n materials = quantities_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 \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 if total_price > 0 else 201,\n 'message': 'Ok' if total_price > 0 else 'No matching materials found',\n 'status': total_price > 0,\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 quantity_type='主材',\n partial_name=material_name\n )\n if not result_dict.get('status', False):\n continue\n \n materials = result_dict.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 param_value = float(material['参数'])\n total_params += param_value\n except (ValueError, TypeError):\n pass\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 base_path = \"架空输电线路本体工程/基础工程/基础砌筑\"\n \n result = project.get_quantities_node_by_parent_and_name(\n parent_path=base_path,\n quantity_type=\"主材\",\n partial_name=\"圆钢\"\n )\n \n if not result.get('status', False):\n return {\n 'code': 201,\n 'message': f\"查询失败: {result.get('message', '未知错误')}\",\n 'status': False,\n 'data': []\n }\n \n materials = result.get('data', [])\n total_quantity = 0.0\n \n for material in materials:\n if isinstance(material, dict) and material.get('类型') == '主材' and '圆钢' in material.get('name', ''):\n try:\n quantity = float(material.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': {\n 'total_quantity': total_quantity,\n 'unit': '根据具体主材单位确定'\n }\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 materials = quantities_result.get('data', [])\n for material in materials:\n if isinstance(material, dict):\n material_obj = Material()\n material_obj.__dict__.update(material)\n if \"单价含税\" in material 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 children = children_result.get('data', [])\n for child in children:\n if isinstance(child, dict) and \"path\" in child:\n process_division(child[\"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(\"工程费用表\", \"架空输电线路本体工程.合计费\", \"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_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_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_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_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_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_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": "根据用户问题和上下文信息,我们需要从\"其他费用\"中获取\"项目建设管理费\"的属性。根据上下文信息,\"其他费用\"是一个FeeScheduleItem类型,而\"项目建设管理费\"是一个Fee类型,且其父节点是\"其他费用\"。\n\n最匹配的方法是使用`get_fee_schedule_on_other_expense_table`方法,因为:\n1. \"其他费用\"对应的是其他费用表\n2. 我们需要获取的是费用属性\n\n以下是生成的Python代码:\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_attribute=\"*\" # 获取所有属性\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": "根据用户问题和上下文信息,我们需要从\"其他费用\"中获取\"项目建设技术服务费\"的属性。根据上下文信息,\"项目建设技术服务费\"是\"其他费用\"的子节点,类型为\"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_attribute=\"amount\"\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('其他费用表', '项目前期工作费', '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_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": "根据用户问题和上下文信息,我们需要从\"其他费用\"表中获取\"设计费\"的属性。根据上下文信息,\"其他费用表\"是父节点,\"设计费\"是其子节点。工程数据访问库中提供了`get_fee_schedule_on_other_expense_table`方法专门用于在其他费用表中查找费用。\n\ndef project_get_calculate_function():\n project = ProjectBuilder.build()\n result_dict = project.get_fee_schedule_on_other_expense_table(table_name=\"其他费用表\", fee_name=\"设计费\", fee_attribute=None)\n status = result_dict.get('status', False)\n message = result_dict.get('message', '')\n code = result_dict.get('code', 201)\n data = result_dict.get('data', {})\n if status:\n return result_dict\n else:\n return result_dict"} +{"name": "其中:工程建设检测费_元", "query": "从【其他费用】中获取【工程建设检测费】的属性", "code": "根据用户问题和上下文信息,我们需要从\"其他费用\"中获取\"工程建设检测费\"的属性。根据上下文信息,\"工程建设检测费\"是一个Fee类型节点,其父节点是\"其他费用\"(FeeScheduleItem类型)。因此,我们可以使用`get_fee_schedule_on_other_expense_table`方法来获取该费用的属性。\n\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_attribute=\"*\"\n )\n status = result_dict.get('status', False)\n if not status:\n return result_dict\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_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"} +{"name": "建设期利息_元", "query": "从【工程费用】中获取【建设期贷款利息.合计费】的属性", "code": "根据用户问题和上下文信息,我们需要从工程费用表中获取\"建设期贷款利息.合计费\"的属性。根据上下文信息,这是一个三级结构:工程费用表 -> 建设期贷款利息 -> 合计费。\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_attribute=\"合计费\"\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_Engineering_Cost_table(\n table_name=\"工程费用表\",\n fee_name=\"工程动态投资(一~八项合计).合计费\",\n fee_attribute=\"合计费\"\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"} +{"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"} diff --git a/tests/zhibiao.json b/tests/zhibiao.json index 23abffb..13cda14 100644 --- a/tests/zhibiao.json +++ b/tests/zhibiao.json @@ -1879,7 +1879,7 @@ "指标类型": "造价指标", "数据来源": "工程费用", "指标描述": { - "指标映射": "从【工程费用】中获取【架空输电线路本体工程.合计费】的属性", + "指标映射": "从【工程费用】中获取【架空输电线路本体工程】的【合计费】的属性", "映射规则": "@工程费用.架空输电线路本体工程.合计费" } }, @@ -1893,7 +1893,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程人工费_本体_元】的费用", + "指标映射": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【人工费】的费用", "映射规则": "人工费" } }, @@ -1907,7 +1907,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程人工费_调试_元】的费用", + "指标映射": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【人工费】的费用", "映射规则": "人工费" } }, @@ -1921,7 +1921,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程机械费_本体_元】的费用", + "指标映射": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【施工机械使用费】的费用", "映射规则": "施工机械使用费" } }, @@ -1935,7 +1935,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程】项目划分中获取名称属于【本体工程机械费_调试_元】的费用", + "指标映射": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【施工机械使用费】的费用", "映射规则": "施工机械使用费" } }, @@ -1949,7 +1949,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程/基础工程】项目划分中获取名称属于【基础工程费用_元】的费用", + "指标映射": "从【架空输电线路本体工程/基础工程】项目划分中获取取费费用名称属于【合计】的费用", "映射规则": "合计" } }, @@ -1963,7 +1963,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程/杆塔工程】项目划分中获取名称属于【杆塔工程费用_元】的费用", + "指标映射": "从【架空输电线路本体工程/杆塔工程】项目划分中获取取费费用名称属于【合计】的费用", "映射规则": "合计" } }, @@ -1977,7 +1977,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程/接地工程】项目划分中获取名称属于【接地工程费用_元】的费用", + "指标映射": "从【架空输电线路本体工程/接地工程】项目划分中获取取费费用名称属于【合计】的费用", "映射规则": "合计" } }, @@ -1991,7 +1991,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程/架线工程】项目划分中获取名称属于【架线工程费用_元】的费用", + "指标映射": "从【架空输电线路本体工程/架线工程】项目划分中获取取费费用名称属于【合计】的费用", "映射规则": "合计" } }, @@ -2005,7 +2005,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程/附件安装工程】项目划分中获取名称属于【附件工程费用_元】的费用", + "指标映射": "从【架空输电线路本体工程/附件安装工程】项目划分中获取取费费用名称属于【合计】的费用", "映射规则": "合计" } }, @@ -2019,7 +2019,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程/辅助工程】项目划分中获取名称属于【辅助工程费用_元】的费用", + "指标映射": "从【架空输电线路本体工程/辅助工程】项目划分中获取取费费用名称属于【合计】的费用", "映射规则": "合计" } }, @@ -2033,7 +2033,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程/辅助工程】项目划分中获取名称属于【辅助工程费用_调试_元】的费用", + "指标映射": "从【架空输电线路本体工程/辅助工程】项目划分中获取取费费用名称属于【合计】的费用", "映射规则": "合计" } }, @@ -2047,7 +2047,7 @@ "指标类型": "造价指标", "数据来源": "工程费用", "指标描述": { - "指标映射": "从【工程费用】中获取【辅助设施工程.合计费】的属性", + "指标映射": "从【工程费用】中获取【辅助设施工程】的【合计费】的属性", "映射规则": "@工程费用.辅助设施工程.合计费" } }, @@ -2061,7 +2061,7 @@ "指标类型": "造价指标", "数据来源": "工程费用", "指标描述": { - "指标映射": "从【工程费用】中获取【其他费用.合计费】的属性", + "指标映射": "从【工程费用】中获取【其他费用】的【合计费】的属性", "映射规则": "@工程费用.其他费用.合计费" } }, @@ -2201,7 +2201,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程】项目划分中获取名称属于【其中:安全文明施工费_线路_元】的费用", + "指标映射": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【安全文明施工费】的费用", "映射规则": "安全文明施工费" } }, @@ -2215,7 +2215,7 @@ "指标类型": "造价指标", "数据来源": "项目划分费用", "指标描述": { - "指标映射": "从【架空输电线路本体工程】项目划分中获取名称属于【其中:安全文明施工费_调试_元】的费用", + "指标映射": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【安全文明施工费】的费用", "映射规则": "安全文明施工费" } }, @@ -2229,7 +2229,7 @@ "指标类型": "造价指标", "数据来源": "工程费用", "指标描述": { - "指标映射": "从【工程费用】中获取【基本预备费.合计费】的属性", + "指标映射": "从【工程费用】中获取【基本预备费】的【合计费】的属性", "映射规则": "@工程费用.基本预备费.合计费" } }, @@ -2243,7 +2243,7 @@ "指标类型": "造价指标", "数据来源": "工程费用", "指标描述": { - "指标映射": "从【工程费用】中获取【工程静态投资(一~七项合计).合计费】的属性", + "指标映射": "从【工程费用】中获取【工程静态投资(一~七项合计)】的【合计费】的属性", "映射规则": "@工程费用.工程静态投资(一~七项合计).合计费" } }, @@ -2257,7 +2257,7 @@ "指标类型": "造价指标", "数据来源": "工程费用", "指标描述": { - "指标映射": "从【工程费用】中获取【建设期贷款利息.合计费】的属性", + "指标映射": "从【工程费用】中获取【建设期贷款利息】的【合计费】的属性", "映射规则": "@工程费用.建设期贷款利息.合计费" } }, @@ -2271,7 +2271,7 @@ "指标类型": "造价指标", "数据来源": "工程费用", "指标描述": { - "指标映射": "从【工程费用】中获取【工程动态投资(一~八项合计).合计费】的属性", + "指标映射": "从【工程费用】中获取【工程动态投资(一~八项合计)】的【合计费】的属性", "映射规则": "@工程费用.工程动态投资(一~八项合计).合计费" } }, @@ -2285,7 +2285,7 @@ "指标类型": "造价指标", "数据来源": "工程费用", "指标描述": { - "指标映射": "从【工程费用】中获取【其中:可抵扣增值税额.合计费】的属性", + "指标映射": "从【工程费用】中获取【其中:可抵扣增值税额】的【合计费】的属性", "映射规则": "@工程费用.其中:可抵扣增值税额.合计费" } } diff --git a/tests/zhibiao.jsonl b/tests/zhibiao.jsonl index 1281a20..a6d4a94 100644 --- a/tests/zhibiao.jsonl +++ b/tests/zhibiao.jsonl @@ -1,46 +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": "从【架空输电线路本体工程/基础工程】及其子孙项目划分中查找编码中包含【YX2-1~7】的所有【定额】的【数量】之和", "result": [{"name": "基础工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/基础工程", "name": "基础工程"}}, {"name": "定额", "constraints": {"parent": "基础工程", "type": "ProjectQuantity", "类型": "定额", "编码": "YX2-1~7"}}]} +{"name": "角钢塔_塔材量", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【角钢】的所有【主材】的【数量】之和", "result": [{"name": "铁塔、钢管杆组立", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "name": "铁塔、钢管杆组立"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "parent": "铁塔、钢管杆组立", "类型": "主材", "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", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "类型": "主材", "name": "包含角钢"}}]} +{"name": "角钢塔_其中:高强钢塔材费用_元", "query": "从【架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立】及其子孙项目划分中查找名称中包含【角钢、高强】的所有【主材】的【单价】之和", "result": [{"name": "铁塔、钢管杆组立", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "name": "铁塔、钢管杆组立"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "parent": "铁塔、钢管杆组立", "类型": "主材", "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": "主材", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "name_contains": "钢管塔"}}]} {"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": "铁塔、钢管杆组立"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "name": "主材", "path": "架空输电线路本体工程/杆塔工程/杆塔组立/铁塔、钢管杆组立", "name_contains": "钢管杆"}}]} +{"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": {"parent": "架空输电线路本体工程/架线工程", "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": "导地线架设"}}, {"name": "架空输电线路本体工程/架线工程/导地线跨越架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线跨越架设", "name": "导地线跨越架设"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含高导电率"}}]} +{"name": "导线及线材_导线装材费_元", "query": "从【架空输电线路本体工程/架线工程/导地线架设@@架空输电线路本体工程/架线工程/导地线跨越架设】及其子孙项目划分中查找名称中包含【线】的所有【主材】的【单价】之和", "result": [{"name": "架空输电线路本体工程/架线工程/导地线架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线架设", "name": "导地线架设"}}, {"name": "架空输电线路本体工程/架线工程/导地线跨越架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线跨越架设", "name": "导地线跨越架设"}}, {"name": "主材", "constraints": {"type": "ProjectQuantity", "类型": "主材", "name": "包含线"}}]} +{"name": "导线及线材_其中:节能导线费用_元", "query": "从【架空输电线路本体工程/架线工程/导地线架设@@架空输电线路本体工程/架线工程/导地线跨越架设】及其子孙项目划分中查找名称中包含【高导电率】的所有【主材】的【单价】之和", "result": [{"name": "架空输电线路本体工程/架线工程/导地线架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线架设", "name": "导地线架设"}}, {"name": "架空输电线路本体工程/架线工程/导地线跨越架设", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程/导地线跨越架设", "name": "导地线跨越架设"}}, {"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": "其中:可抵扣增值税额.合计费"}}]} +{"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", "path": "架空输电线路本体工程/基础工程/基础砌筑", "类型": "主材", "name": "包含圆钢"}}]} +{"name": "本体费用合计_元", "query": "从【工程费用】中获取【架空输电线路本体工程】的【合计费】的属性", "result": [{"name": "工程费用表", "constraints": {"type": "FeeScheduleItem", "name": "工程费用表"}}, {"name": "架空输电线路本体工程", "constraints": {"parent": "工程费用表", "type": "Fee", "name": "架空输电线路本体工程", "code": "BTGC"}}, {"name": "合计费", "constraints": {"parent": "架空输电线路本体工程", "type": "Fee", "name": "合计费"}}]} +{"name": "本体工程人工费_本体_元", "query": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【人工费】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "人工费", "constraints": {"parent": "架空输电线路本体工程", "type": "FeeCollection", "name": "人工费"}}]} +{"name": "本体工程人工费_调试_元", "query": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【人工费】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "人工费", "constraints": {"parent": "架空输电线路本体工程", "type": "FeeCollection", "name": "人工费"}}]} +{"name": "本体工程机械费_本体_元", "query": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【施工机械使用费】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "施工机械使用费", "constraints": {"parent": "架空输电线路本体工程", "type": "Fee", "name": "施工机械使用费"}}]} +{"name": "本体工程机械费_调试_元", "query": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【施工机械使用费】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "施工机械使用费", "constraints": {"parent": "架空输电线路本体工程", "type": "Fee", "name": "施工机械使用费"}}]} +{"name": "基础工程费用_元", "query": "从【架空输电线路本体工程/基础工程】项目划分中获取取费费用名称属于【合计】的费用", "result": [{"name": "基础工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/基础工程", "name": "基础工程"}}, {"name": "合计", "constraints": {"parent": "基础工程", "type": "CostItem", "name": "合计"}}]} +{"name": "杆塔工程费用_元", "query": "从【架空输电线路本体工程/杆塔工程】项目划分中获取取费费用名称属于【合计】的费用", "result": [{"name": "杆塔工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/杆塔工程", "name": "杆塔工程"}}, {"name": "合计", "constraints": {"parent": "杆塔工程", "type": "CostItem", "name": "合计"}}]} +{"name": "接地工程费用_元", "query": "从【架空输电线路本体工程/接地工程】项目划分中获取取费费用名称属于【合计】的费用", "result": [{"name": "接地工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/接地工程", "name": "接地工程"}}, {"name": "合计", "constraints": {"parent": "接地工程", "type": "CostItem", "name": "合计"}}]} +{"name": "架线工程费用_元", "query": "从【架空输电线路本体工程/架线工程】项目划分中获取取费费用名称属于【合计】的费用", "result": [{"name": "架线工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/架线工程", "name": "架线工程"}}, {"name": "合计", "constraints": {"parent": "架线工程", "type": "CostItem", "name": "合计"}}]} +{"name": "附件工程费用_元", "query": "从【架空输电线路本体工程/附件安装工程】项目划分中获取取费费用名称属于【合计】的费用", "result": [{"name": "附件安装工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/附件安装工程", "name": "附件安装工程"}}, {"name": "合计", "constraints": {"parent": "附件安装工程", "type": "CostItem", "name": "合计"}}]} +{"name": "辅助工程费用_元", "query": "从【架空输电线路本体工程/辅助工程】项目划分中获取取费费用名称属于【合计】的费用", "result": [{"name": "辅助工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/辅助工程", "name": "辅助工程"}}, {"name": "合计", "constraints": {"parent": "辅助工程", "type": "CostItem", "name": "合计"}}]} +{"name": "辅助工程费用_调试_元", "query": "从【架空输电线路本体工程/辅助工程】项目划分中获取取费费用名称属于【合计】的费用", "result": [{"name": "辅助工程", "constraints": {"type": "ProjectDivisionItem", "path": "架空输电线路本体工程/辅助工程", "name": "辅助工程"}}, {"name": "合计", "constraints": {"parent": "辅助工程", "type": "CostItem", "name": "合计"}}]} +{"name": "辅助设施工程_元", "query": "从【工程费用】中获取【辅助设施工程】的【合计费】的属性", "result": [{"name": "辅助设施工程", "constraints": {"type": "ProjectDivisionItem", "name": "辅助设施工程"}}, {"name": "合计费", "constraints": {"type": "CostItem", "name": "合计费", "parent": "辅助设施工程"}}]} +{"name": "其他费用合计_元", "query": "从【工程费用】中获取【其他费用】的【合计费】的属性", "result": [{"name": "工程费用表", "constraints": {"type": "FeeScheduleItem", "name": "工程费用表"}}, {"name": "其他费用", "constraints": {"parent": "工程费用表", "type": "Fee", "name": "其他费用"}}, {"name": "合计费", "constraints": {"parent": "其他费用", "type": "Fee", "name": "合计费"}}]} +{"name": "建场费合计_元", "query": "从【其他费用】中获取【建设场地征用及清理费】的属性", "result": [{"name": "其他费用", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "建设场地征用及清理费", "constraints": {"parent": "其他费用", "type": "Fee", "name": "建设场地征用及清理费"}}]} +{"name": "项目建设管理费合计_元", "query": "从【其他费用】中获取【项目建设管理费】的属性", "result": [{"name": "其他费用", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "项目建设管理费", "constraints": {"parent": "其他费用", "type": "Fee", "name": "项目建设管理费"}}]} +{"name": "其中:工程监理费_元", "query": "从【其他费用】中获取【工程监理费】的属性", "result": [{"name": "其他费用表", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "工程监理费", "constraints": {"parent": "其他费用表", "type": "Fee", "name": "工程监理费"}}]} +{"name": "项目建设技术服务费合计_元", "query": "从【其他费用】中获取【项目建设技术服务费】的属性", "result": [{"name": "其他费用", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "项目建设技术服务费", "constraints": {"parent": "其他费用", "type": "Fee", "name": "项目建设技术服务费"}}]} +{"name": "其中:项目前期工作费_元", "query": "从【其他费用】中获取【项目前期工作费】的属性", "result": [{"name": "其他费用表", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "项目前期工作费", "constraints": {"parent": "其他费用表", "type": "Fee", "name": "项目前期工作费"}}]} +{"name": "其中:勘察费_元", "query": "从【其他费用】中获取【勘察费】的属性", "result": [{"name": "其他费用表", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "勘察费", "constraints": {"parent": "其他费用表", "type": "Fee", "name": "勘察费"}}]} +{"name": "其中:设计费_元", "query": "从【其他费用】中获取【设计费】的属性", "result": [{"name": "其他费用表", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "设计费", "constraints": {"parent": "其他费用表", "type": "Fee", "name": "设计费"}}]} +{"name": "其中:工程建设检测费_元", "query": "从【其他费用】中获取【工程建设检测费】的属性", "result": [{"name": "其他费用表", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "工程建设检测费", "constraints": {"parent": "其他费用表", "type": "Fee", "name": "工程建设检测费"}}]} +{"name": "生产准备费_元", "query": "从【其他费用】中获取【生产准备费】的属性", "result": [{"name": "其他费用表", "constraints": {"type": "FeeScheduleItem", "name": "其他费用表"}}, {"name": "生产准备费", "constraints": {"parent": "其他费用表", "type": "Fee", "name": "生产准备费"}}]} +{"name": "其中:安全文明施工费_线路_元", "query": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【安全文明施工费】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "安全文明施工费", "constraints": {"parent": "架空输电线路本体工程", "type": "Fee", "name": "安全文明施工费"}}]} +{"name": "其中:安全文明施工费_调试_元", "query": "从【架空输电线路本体工程】项目划分中获取取费费用名称属于【安全文明施工费】的费用", "result": [{"name": "架空输电线路本体工程", "constraints": {"type": "ProjectDivisionItem", "name": "架空输电线路本体工程"}}, {"name": "安全文明施工费", "constraints": {"parent": "架空输电线路本体工程", "type": "Fee", "name": "安全文明施工费"}}]} +{"name": "基本预备费_元", "query": "从【工程费用】中获取【基本预备费】的【合计费】的属性", "result": [{"name": "基本预备费", "constraints": {"type": "Fee", "name": "基本预备费"}}, {"name": "合计费", "constraints": {"parent": "基本预备费", "type": "Fee", "name": "合计费"}}]} +{"name": "静态投资_元", "query": "从【工程费用】中获取【工程静态投资(一~七项合计)】的【合计费】的属性", "result": [{"name": "工程费用表", "constraints": {"type": "FeeScheduleItem", "name": "工程费用表"}}, {"name": "工程静态投资(一~七项合计)", "constraints": {"parent": "工程费用表", "type": "Fee", "name": "工程静态投资(一~七项合计)"}}, {"name": "合计费", "constraints": {"parent": "工程静态投资(一~七项合计)", "type": "Fee", "name": "合计费"}}]} +{"name": "建设期利息_元", "query": "从【工程费用】中获取【建设期贷款利息】的【合计费】的属性", "result": [{"name": "工程费用", "constraints": {"type": "FeeScheduleItem", "name": "工程费用表"}}, {"name": "建设期贷款利息", "constraints": {"parent": "工程费用", "type": "Fee", "name": "建设期贷款利息", "code": "DKLX"}}, {"name": "合计费", "constraints": {"parent": "建设期贷款利息", "type": "Fee", "name": "合计费"}}]} +{"name": "动态投资_元", "query": "从【工程费用】中获取【工程动态投资(一~八项合计)】的【合计费】的属性", "result": [{"name": "工程费用", "constraints": {"type": "FeeScheduleItem", "name": "工程费用表"}}, {"name": "工程动态投资(一~八项合计)", "constraints": {"parent": "工程费用", "type": "Fee", "name": "工程动态投资(一~八项合计)"}}, {"name": "合计费", "constraints": {"parent": "工程动态投资(一~八项合计)", "type": "Fee", "name": "合计费"}}]} +{"name": "增值税抵扣税额_元", "query": "从【工程费用】中获取【其中:可抵扣增值税额】的【合计费】的属性", "result": [{"name": "工程费用", "constraints": {"type": "FeeScheduleItem", "name": "工程费用表"}}, {"name": "其中:可抵扣增值税额", "constraints": {"parent": "工程费用", "type": "Fee", "name": "其中:可抵扣增值税额"}}, {"name": "合计费", "constraints": {"parent": "其中:可抵扣增值税额", "type": "Fee", "name": "合计费"}}]} diff --git a/tools/streamlt_showcode.py b/tools/streamlt_showcode.py index f7a2531..f73d3b0 100644 --- a/tools/streamlt_showcode.py +++ b/tools/streamlt_showcode.py @@ -5,6 +5,7 @@ import json import logging import os from datetime import datetime + sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # 获取当前时间,格式化为字符串 @@ -21,14 +22,12 @@ 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() - ], + 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并禁用传播 @@ -55,34 +54,45 @@ from src.project import ProjectBuilder, ProjectToolkit from src.project_implementation import ProjectToolkitNeo4j from src.code_executor import CodeExecutor -config = Config() -business_structure = load_file(config.business_object_structure_path) -bowei_api_docs = load_file(config.bowei_api_docs_path) +# 初始化资源和客户端的函数,使用缓存避免重复加载 +@st.cache_resource +def initialize_resources(): + config = Config() + business_structure = load_file(config.business_object_structure_path) + bowei_api_docs = load_file(config.bowei_api_docs_path) + llm_client_coder = MultiAPIKeyChatOpenAI(config.openai_coder) + prompt_manager = PromptManager() -#llm_client = MultiAPIKeyChatOpenAI(config.openai) + # 创建Neo4j检索器 + neo4j_conf = config.neo4j_conf + embedding_conf = config.embedding + embedding_client = EmbeddingClient(embedding_conf) + knowledge_retriever = Neo4jRawRetriever(neo4j_conf) -llm_client_coder = MultiAPIKeyChatOpenAI(config.openai_coder) + ProjectBuilder.register(ProjectToolkitNeo4j, knowledge_retriever.driver) -prompt_manager = PromptManager() + code_executor = CodeExecutor(prompt_manager.prompts, llm_client_coder, config.max_retries) -neo4j_conf = config.neo4j_conf -embedding_conf = config.embedding + return { + "config": config, + "business_structure": business_structure, + "bowei_api_docs": bowei_api_docs, + "llm_client_coder": llm_client_coder, + "prompt_manager": prompt_manager, + "knowledge_retriever": knowledge_retriever, + "embedding_client": embedding_client, + "code_executor": code_executor, + } -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) +# 使用缓存加载JSONL文件 +@st.cache_data def load_jsonl(file_path): - """加载JSONL文件并返回JSON记录列表""" + """加载JSONL文件并返回JSON指标列表""" records = [] try: - with open(file_path, 'r', encoding='utf-8') as file: + with open(file_path, "r", encoding="utf-8") as file: for line in file: if line.strip(): records.append(json.loads(line)) @@ -91,82 +101,86 @@ def load_jsonl(file_path): st.error(f"加载文件失败: {str(e)}") return [] -def run_code(data): - global code_executor - """运行JSON记录中的代码并返回结果""" - if not data or 'code' not in data: - return { - "code": 40000, - "message": "没有可执行的代码", - "status": False, - "data": None - } - - return code_executor.execute_code(data['code']) +def run_code(data, code_executor): + """运行JSON指标中的代码并返回结果""" + if not data or "code" not in data: + return {"code": 40000, "message": "没有可执行的代码", "status": False, "data": None} + + return code_executor.execute_code(data["code"]) + def main(): - st.set_page_config(layout="wide", page_title="JSONL查看器") - - st.title("JSONL文件查看器") - + st.set_page_config(layout="wide", page_title="工程指标查看器") + + st.title("工程指标查看器") + + # 初始化资源 + resources = initialize_resources() + code_executor = resources["code_executor"] + # 设置默认文件路径 default_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../tests", "code.jsonl") - + # 文件路径输入 file_path = st.text_input("JSONL文件路径", value=default_file_path) - + if not os.path.exists(file_path): st.warning(f"文件不存在: {file_path}") return - + # 加载JSONL文件 records = load_jsonl(file_path) - + if not records: - st.warning("没有找到有效的记录") + st.warning("没有找到有效的指标") return - + + # 初始化会话状态 + if "selected_index" not in st.session_state: + st.session_state.selected_index = 0 + + if "execution_results" not in st.session_state: + st.session_state.execution_results = {} + # 创建两列布局 col1, col2 = st.columns([1, 3]) - + # 左侧列表 with col1: - st.subheader("记录列表") - selected_index = None - + st.subheader("指标列表") + for i, record in enumerate(records): - if st.button(record.get('name', f"记录 {i+1}"), key=f"btn_{i}"): - selected_index = i - + if st.button(record.get("name", f"指标 {i+1}"), key=f"btn_{i}"): + st.session_state.selected_index = i + # 右侧详细信息 with col2: - if 'selected_index' not in st.session_state: - st.session_state.selected_index = 0 - - if selected_index is not None: - st.session_state.selected_index = selected_index - if st.session_state.selected_index < len(records): selected_record = records[st.session_state.selected_index] - - st.subheader(f"查询问题: {selected_record.get('name', '无名称')}") + record_id = selected_record.get("id", str(st.session_state.selected_index)) + + st.subheader(f"指标名称: {selected_record.get('name', '无名称指标')}") st.info(selected_record.get('query', '无查询信息')) - - st.subheader("代码") + + # 将指标代码标题、运行代码按钮、执行结果放在同一行 + run_btn_col, title_col, result_col = st.columns([1, 1, 4]) + with title_col: + st.subheader("执行结果:") + with result_col: + title_code_result = st.subheader("") + with run_btn_col: + if st.button("执行指标代码"): + with st.spinner('正在执行代码...'): + result = run_code(selected_record, code_executor) + if result.get('status'): + #st.success("执行成功") + title_code_result.info(result.get('data')) + else: + title_code_result.error(f"执行失败: {result.get('message', '未知错误')}") + st.code(selected_record.get('code', '无代码'), language='python') - - # 运行代码按钮 - if st.button("运行代码"): - with st.spinner('正在执行代码...'): - result = run_code(selected_record) - - st.subheader("运行结果") - if result.get('status'): - st.success("执行成功") - st.info(result.get('data')) - else: - st.error(f"执行失败: {result.get('message', '未知错误')}") if __name__ == "__main__": - main() \ No newline at end of file + main() + diff --git a/tools/xml_to_json.py b/tools/xml_to_json.py index bde305d..af37f19 100644 --- a/tools/xml_to_json.py +++ b/tools/xml_to_json.py @@ -3,6 +3,26 @@ import xml.etree.ElementTree as ET import json import re + +def transform_string(input_str: str) -> str: + + # 提取所有【】中的内容 + matches = re.findall(r'【(.*?)】', input_str) + if len(matches) < 2: + return input_str # 不符合格式,直接返回 + + first_block = matches[0] # 第一个块,如“工程费用” + second_block = matches[1] # 第二个块,可能是“基本预备费.合计费”或“基本预备费” + suffix = input_str.split('】')[-1] # 获取末尾部分,如“的属性” + + # 判断第二个块是否包含点号 + if '.' in second_block: + nested_parts = second_block.split('.') + nested_str = ''.join(f'【{part}】的' for part in nested_parts).rstrip('的') + return f'从【{first_block}】中获取{nested_str}{suffix}' + else: + return input_str + def clean_bracketed_strings(input_str: str) -> str: # 替换【'xxx'】为【xxx】 result = re.sub(r"【'([^']+)'】", r"【\1】", input_str) @@ -125,7 +145,7 @@ def xml_to_json(xml_content, output_path): result.append(base_item) elif data_sources in project_division: - mapping_desc = f"从【{index_extraction_scope}】项目划分中获取名称属于【{indicator_name}】的费用" + mapping_desc = f"从【{index_extraction_scope}】项目划分中获取取费费用名称属于【{keyword}】的费用" base_item["指标描述"] = { "指标映射": mapping_desc, "映射规则": parsed["映射规则"] @@ -191,6 +211,7 @@ def xml_to_json(xml_content, output_path): if isinstance(indicator_map, str): new_mapping = clean_bracketed_strings(indicator_map) + new_mapping = transform_string(new_mapping) item["指标描述"]["指标映射"] = new_mapping # 保存为 JSON 文件 @@ -199,7 +220,6 @@ def xml_to_json(xml_content, output_path): return "结果已保存" - xml_content = read_xml_as_string('dataset/主网架空线路造价分析指标.xml') json_output = xml_to_json(xml_content, output_path= "./tests/zhibiao.json") print("转换完毕!")