上传
This commit is contained in:
@@ -123,8 +123,8 @@ class CodeExecutor:
|
||||
sys.stdout = old_stdout
|
||||
output = redirected_output.getvalue().strip()
|
||||
|
||||
if not isinstance(result_dict, dict) or len(result_dict) != 4:
|
||||
raise ValueError("函数应返回包含4个元素的字典(status, data, error, helper_info)")
|
||||
if not isinstance(result_dict, dict) or len(result_dict) < 3:
|
||||
raise ValueError("函数应返回至少包含3个元素的字典(status, message, data)")
|
||||
|
||||
logger.debug(f"执行结果: {result_dict}")
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@ class ProjectToolkit(ABC):
|
||||
def __init__(self, config: Any):
|
||||
pass
|
||||
|
||||
# 项目划分查询方法
|
||||
|
||||
@abstractmethod
|
||||
def get_division_by_name(self, name_part):
|
||||
"""
|
||||
@@ -71,7 +69,6 @@ class ProjectToolkit(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
# 工程量查询方法
|
||||
@abstractmethod
|
||||
def get_quantities_by_paths(self, paths_str):
|
||||
"""
|
||||
@@ -128,7 +125,6 @@ class ProjectToolkit(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
# 材机查询方法
|
||||
@abstractmethod
|
||||
def get_material_equipment_by_path(self, paths_str):
|
||||
"""
|
||||
@@ -164,7 +160,6 @@ class ProjectToolkit(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
# 取费查询方法
|
||||
@abstractmethod
|
||||
def get_fee_template_by_path(self, paths_str):
|
||||
"""
|
||||
@@ -202,7 +197,6 @@ class ProjectToolkit(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
# 费用表查询方法
|
||||
@abstractmethod
|
||||
def get_fee_schedule_on_auxiliary_expense_table(self, table_name, fee_name, fee_attribute: str):
|
||||
"""
|
||||
@@ -298,7 +292,6 @@ class ProjectToolkit(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
# 工程属性查询方法
|
||||
@abstractmethod
|
||||
def get_project_property(self, property_name):
|
||||
"""
|
||||
@@ -316,7 +309,6 @@ class ProjectToolkit(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
# 项目划分查找取费表
|
||||
@abstractmethod
|
||||
def get_fee_table_by_project_division(self, project_division_path, fee_name):
|
||||
"""
|
||||
@@ -335,7 +327,6 @@ class ProjectToolkit(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
# 清单查找取费表
|
||||
@abstractmethod
|
||||
def get_fee_table_by_list(self, parent_path, list_code, list_unit, fee_name):
|
||||
"""
|
||||
@@ -356,7 +347,6 @@ class ProjectToolkit(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
# 定额节点查找合价
|
||||
@abstractmethod
|
||||
def get_fee_table_by_quoto_code(self, parent_path, quantity_type, code, fee_name):
|
||||
"""
|
||||
@@ -377,7 +367,6 @@ class ProjectToolkit(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
# 工程量节点查找合价
|
||||
@abstractmethod
|
||||
def get_fee_table_by_quantities_name(self, parent_path, quantity_type, quantity_name, fee_name):
|
||||
"""
|
||||
@@ -398,7 +387,6 @@ class ProjectToolkit(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
# 材机节点查找市场价
|
||||
@abstractmethod
|
||||
def get_fee_by_material_equipment_code(self, parent_path, material_equipment_code, fee_name):
|
||||
"""
|
||||
@@ -418,7 +406,6 @@ class ProjectToolkit(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
# 查找清单节点
|
||||
@abstractmethod
|
||||
def get_fee_table_by_list_name(self, parent_path, list_code, unit):
|
||||
"""
|
||||
|
||||
+18
-6
@@ -66,19 +66,31 @@ def project_get_calculate_function():
|
||||
result_dict = project.[SELECTED_METHOD]([PARAMETERS])
|
||||
status = result_dict.get('status', False)
|
||||
message = result_dict.get('message', '')
|
||||
code = result_dict.get('data', '')
|
||||
data = result_dict.get('data', [])
|
||||
quantity = 0.0
|
||||
if isinstance(result_dict, dict) and '数量' in result_dict:
|
||||
quantity = result_dict['数量']
|
||||
|
||||
if status:
|
||||
return result_dict
|
||||
return {
|
||||
"code": 200,
|
||||
"message": 'ok',
|
||||
"status": True,
|
||||
"data": quantity
|
||||
}
|
||||
else:
|
||||
return result_dict
|
||||
return {
|
||||
"code": 500,
|
||||
"message": message,
|
||||
"status": False,
|
||||
"data": quantity
|
||||
}
|
||||
|
||||
# 执行规则
|
||||
- 参数必须从用户问题或上下文信息中提取。
|
||||
- 在代码函数内部生成功能说明,在函数外禁止生成任何注释或解释或非代码内容。
|
||||
- 输出代码中必须以def project_get_calculate_function() -> dict函数作为入口函数,该函数成功时返回的'data'通常是浮点或整型值,除非用户要求返回其他类型。
|
||||
- 输出代码中必须以def project_get_calculate_function() -> dict函数作为入口函数,该函数返回字典包含:'code'、'status'、'message'、'data'四个字段。
|
||||
- 必须确保生成的代码可以直接执行,代码要注意进行各类容错检查。
|
||||
- 如果project_get_calculate_function函数需要返回浮点整形数,函数中间发生错误或找不到对象也必须返回成功,data为0,并在message说明错误原因。
|
||||
- 'data'字段通常要求是浮点或整型值,除非用户要求返回其他类型,同时函数执行过程中发生错误,'data'字段也必须为0,并在message说明错误原因。
|
||||
- ProjectToolkit 类中涉及项目划分的函数已考虑在其及其子孙项目划分下查找,所以无需生成递归子项目划分的代码。
|
||||
- 如果文本中包含范围编码格式则需要进行编码展开,如'YX2-1~7'展开为‘YX2-1/YX2-2/YX2-3/YX2-4/YX2-5/YX2-6/YX2-7’
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user