mirror of
https://github.com/smkrv/ha-text-ai.git
synced 2026-07-25 00:24:00 +08:00
fix: HA 2024.11+ compatibility and deprecation fixes
CRITICAL: - Remove OptionsFlowHandler.__init__ (deprecated HA 2024.11+) - Replace FlowResult with ConfigFlowResult (deprecated HA 2024.4+) Compatibility: - Reorder async_unload_entry: unload platforms before coordinator cleanup - Clean up hass.data[DOMAIN] when last entry removed - Remove aiohttp from manifest requirements (provided by HA core) - Replace blocking file I/O in const.py with hardcoded VERSION - Remove unused os, json, logging imports from const.py - Fix f-string logger calls in api_client.py to use %s formatting
This commit is contained in:
@@ -216,7 +216,7 @@ class APIClient:
|
||||
}
|
||||
_LOGGER.debug("DeepSeek structured output enabled with schema")
|
||||
except json.JSONDecodeError as e:
|
||||
_LOGGER.warning(f"Invalid JSON schema provided: {e}. Falling back to json_object mode.")
|
||||
_LOGGER.warning("Invalid JSON schema provided: %s. Falling back to json_object mode.", e)
|
||||
payload["response_format"] = {"type": "json_object"}
|
||||
|
||||
data = await self._make_request(url, payload)
|
||||
@@ -266,7 +266,7 @@ class APIClient:
|
||||
}
|
||||
_LOGGER.debug("OpenAI structured output enabled with schema")
|
||||
except json.JSONDecodeError as e:
|
||||
_LOGGER.warning(f"Invalid JSON schema provided: {e}. Falling back to json_object mode.")
|
||||
_LOGGER.warning("Invalid JSON schema provided: %s. Falling back to json_object mode.", e)
|
||||
payload["response_format"] = {"type": "json_object"}
|
||||
|
||||
data = await self._make_request(url, payload)
|
||||
@@ -407,7 +407,7 @@ class APIClient:
|
||||
parsed_schema = json.loads(json_schema)
|
||||
_LOGGER.debug("Gemini structured output enabled with schema")
|
||||
except json.JSONDecodeError as e:
|
||||
_LOGGER.warning(f"Invalid JSON schema provided: {e}. Structured output disabled.")
|
||||
_LOGGER.warning("Invalid JSON schema provided: %s. Structured output disabled.", e)
|
||||
|
||||
# Create configuration
|
||||
def create_config():
|
||||
|
||||
Reference in New Issue
Block a user