mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add devices to OpenRouter (#148888)
This commit is contained in:
parent
3e465da892
commit
412035b970
@ -16,6 +16,7 @@ from homeassistant.const import CONF_LLM_HASS_API, CONF_MODEL, MATCH_ALL
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers import intent
|
from homeassistant.helpers import intent
|
||||||
|
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||||
|
|
||||||
from . import OpenRouterConfigEntry
|
from . import OpenRouterConfigEntry
|
||||||
@ -61,13 +62,20 @@ def _convert_content_to_chat_message(
|
|||||||
class OpenRouterConversationEntity(conversation.ConversationEntity):
|
class OpenRouterConversationEntity(conversation.ConversationEntity):
|
||||||
"""OpenRouter conversation agent."""
|
"""OpenRouter conversation agent."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, entry: OpenRouterConfigEntry, subentry: ConfigSubentry) -> None:
|
def __init__(self, entry: OpenRouterConfigEntry, subentry: ConfigSubentry) -> None:
|
||||||
"""Initialize the agent."""
|
"""Initialize the agent."""
|
||||||
self.entry = entry
|
self.entry = entry
|
||||||
self.subentry = subentry
|
self.subentry = subentry
|
||||||
self.model = subentry.data[CONF_MODEL]
|
self.model = subentry.data[CONF_MODEL]
|
||||||
self._attr_name = subentry.title
|
|
||||||
self._attr_unique_id = subentry.subentry_id
|
self._attr_unique_id = subentry.subentry_id
|
||||||
|
self._attr_device_info = DeviceInfo(
|
||||||
|
identifiers={(DOMAIN, subentry.subentry_id)},
|
||||||
|
name=subentry.title,
|
||||||
|
entry_type=DeviceEntryType.SERVICE,
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_languages(self) -> list[str] | Literal["*"]:
|
def supported_languages(self) -> list[str] | Literal["*"]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user