fix:dms api
This commit is contained in:
@@ -738,7 +738,7 @@ class InputParser:
|
||||
|
||||
# Create Endpoint (POST)
|
||||
create_path = f"/api/dms/{dms_instance_code}/v1/{name}"
|
||||
create_request_body_schema = {"type": "object", "properties": {"version": {"type": "string", "example": version}, "act": {"type": "integer", "example": 0}, "data": {"type": "array", "items": model}}, "required": ["data"]}
|
||||
create_request_body_schema = {"type": "object", "properties": {"version": {"type": "string", "example": version}, "act": {"type": "integer", "example": -1}, "data": {"type": "array", "items": model}}, "required": ["data"]}
|
||||
endpoints.append(DMSEndpoint(path=create_path, method='post', title=f"Create {name}", request_body={'content': {'application/json': {'schema': create_request_body_schema}}}, responses=success_response, test_mode='scenario_only', operation_id=f"create_{name}", category_name=category_name, raw_record=item, model_pk_name=pk_name, identity_id_list=identity_id_list))
|
||||
|
||||
# List Endpoint (POST) - 🔧 添加pageNo和pageSize查询参数
|
||||
@@ -748,7 +748,22 @@ class InputParser:
|
||||
{'name': 'pageNo', 'in': 'query', 'required': False, 'description': '页码(从1开始)', 'schema': {'type': 'integer', 'default': 1}},
|
||||
{'name': 'pageSize', 'in': 'query', 'required': False, 'description': '分页大小(最大值200)', 'schema': {'type': 'integer', 'default': 1000}}
|
||||
]
|
||||
endpoints.append(DMSEndpoint(path=list_path, method='post', title=f"List {name}", request_body={'content': {'application/json': {'schema': {}}}}, responses={'200': {'description': 'Successful Operation', 'content': {'application/json': {'schema': list_response_schema}}}}, parameters=list_parameters, test_mode='standalone', operation_id=f"list_{name}", category_name=category_name, raw_record=item, model_pk_name=pk_name, identity_id_list=identity_id_list))
|
||||
# List请求体Schema(包含version字段,但不包含act字段)
|
||||
list_request_body_schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"version": {"type": "string", "example": version},
|
||||
"isSearchCount": {"type": "boolean", "example": True},
|
||||
"query": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fields": {"type": "array", "items": {"type": "string"}},
|
||||
"filter": {"type": "object"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
endpoints.append(DMSEndpoint(path=list_path, method='post', title=f"List {name}", request_body={'content': {'application/json': {'schema': list_request_body_schema}}}, responses={'200': {'description': 'Successful Operation', 'content': {'application/json': {'schema': list_response_schema}}}}, parameters=list_parameters, test_mode='standalone', operation_id=f"list_{name}", category_name=category_name, raw_record=item, model_pk_name=pk_name, identity_id_list=identity_id_list))
|
||||
|
||||
# Read Endpoint (GET) - 🔧 只为单主键模型生成查询详情接口
|
||||
if isinstance(identity_id_list, list) and len(identity_id_list) > 1:
|
||||
@@ -764,7 +779,8 @@ class InputParser:
|
||||
|
||||
# Update Endpoint (PUT)
|
||||
update_path = f"/api/dms/{dms_instance_code}/v1/{name}"
|
||||
endpoints.append(DMSEndpoint(path=update_path, method='put', title=f"Update {name}", request_body={'content': {'application/json': {'schema': create_request_body_schema}}}, responses=success_response, test_mode='scenario_only', operation_id=f"update_{name}", category_name=category_name, raw_record=item, model_pk_name=pk_name, identity_id_list=identity_id_list))
|
||||
update_request_body_schema = {"type": "object", "properties": {"version": {"type": "string", "example": version}, "act": {"type": "integer", "example": -1}, "data": {"type": "array", "items": model}}, "required": ["data"]}
|
||||
endpoints.append(DMSEndpoint(path=update_path, method='put', title=f"Update {name}", request_body={'content': {'application/json': {'schema': update_request_body_schema}}}, responses=success_response, test_mode='scenario_only', operation_id=f"update_{name}", category_name=category_name, raw_record=item, model_pk_name=pk_name, identity_id_list=identity_id_list))
|
||||
|
||||
# Delete Endpoint (DELETE)
|
||||
delete_path = f"/api/dms/{dms_instance_code}/v1/{name}"
|
||||
@@ -800,6 +816,7 @@ class InputParser:
|
||||
delete_request_body_schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"version": {"type": "string", "example": version},
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"}
|
||||
|
||||
@@ -82,6 +82,9 @@ class DataGenerator:
|
||||
llm_data = self._generate_with_llm(schema, llm_service, context_name, operation_id)
|
||||
if llm_data is not None:
|
||||
self.logger.debug(f"{log_prefix}LLM successfully generated data for{context_log}")
|
||||
# 🔑 关键修复:LLM生成的数据也需要井数据增强
|
||||
if self.well_data_manager and isinstance(llm_data, dict):
|
||||
llm_data = self.well_data_manager.enhance_data_with_well_values(llm_data)
|
||||
return llm_data
|
||||
except Exception as e:
|
||||
self.logger.debug(f"{log_prefix}LLM generation failed for{context_log}: {e}, falling back to traditional generation")
|
||||
|
||||
Reference in New Issue
Block a user