优化适配器
This commit is contained in:
parent
0efe02fafc
commit
a1eb5917a2
@ -281,24 +281,6 @@ class ApiAdapter:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return {'success': False, 'error': f"删除记录异常: {str(e)}"}
|
return {'success': False, 'error': f"删除记录异常: {str(e)}"}
|
||||||
|
|
||||||
def map_fields_by_labels(self, field_map: List[Dict[str, Any]], ai_outputs: Dict[str, Any], label_to_fieldname: Dict[str, str]) -> Dict[str, Any]:
|
|
||||||
record_data: Dict[str, Any] = {}
|
|
||||||
fieldname_set = set(label_to_fieldname.values())
|
|
||||||
for mapping in field_map or []:
|
|
||||||
source_key = mapping.get('from')
|
|
||||||
to_raw = mapping.get('to')
|
|
||||||
if not source_key or to_raw is None:
|
|
||||||
continue
|
|
||||||
value = ai_outputs.get(source_key)
|
|
||||||
if value is None:
|
|
||||||
continue
|
|
||||||
to_field = label_to_fieldname.get(str(to_raw).strip())
|
|
||||||
if not to_field and str(to_raw).strip() in fieldname_set:
|
|
||||||
to_field = str(to_raw).strip()
|
|
||||||
if not to_field:
|
|
||||||
continue
|
|
||||||
record_data[to_field] = value
|
|
||||||
return record_data
|
|
||||||
|
|
||||||
def get_pg_list(self, pagetype: str, filters: Optional[List[List[Any]]] = None,
|
def get_pg_list(self, pagetype: str, filters: Optional[List[List[Any]]] = None,
|
||||||
fields: Optional[List[str]] = None, limit: Optional[int] = None) -> Dict[str, Any]:
|
fields: Optional[List[str]] = None, limit: Optional[int] = None) -> Dict[str, Any]:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user