mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-08-31 12:46:38 +00:00
fix prediction import serialization typing
This commit is contained in:
@@ -993,7 +993,11 @@ def fastapi_prediction_import_provider(
|
|||||||
if not provider.enabled() and not force_enable:
|
if not provider.enabled() and not force_enable:
|
||||||
raise HTTPException(status_code=404, detail=f"Provider '{provider_id}' not enabled.")
|
raise HTTPException(status_code=404, detail=f"Provider '{provider_id}' not enabled.")
|
||||||
try:
|
try:
|
||||||
provider.import_from_json(json_str=data.model_dump_json() if hasattr(data, "model_dump_json") else json.dumps(data))
|
if isinstance(data, (PydanticDateTimeDataFrame, PydanticDateTimeData)):
|
||||||
|
json_str = data.model_dump_json()
|
||||||
|
else:
|
||||||
|
json_str = json.dumps(data)
|
||||||
|
provider.import_from_json(json_str=json_str)
|
||||||
provider.update_datetime = to_datetime(in_timezone=get_config().general.timezone)
|
provider.update_datetime = to_datetime(in_timezone=get_config().general.timezone)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
@@ -1662,4 +1666,4 @@ def main() -> None:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
Reference in New Issue
Block a user