Clean up small changes from OpenAI conversation entity change (#116395)

Small cleanups in OpenAI conversation
This commit is contained in:
Allen Porter 2024-05-02 17:38:12 -07:00 committed by GitHub
parent c07f02534b
commit 897794f53b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View file

@ -5,7 +5,6 @@ from __future__ import annotations
import openai import openai
import voluptuous as vol import voluptuous as vol
from homeassistant.components import conversation
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, Platform from homeassistant.const import CONF_API_KEY, Platform
from homeassistant.core import ( from homeassistant.core import (
@ -115,5 +114,4 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
return False return False
hass.data[DOMAIN].pop(entry.entry_id) hass.data[DOMAIN].pop(entry.entry_id)
conversation.async_unset_agent(hass, entry)
return True return True

View file

@ -3,7 +3,7 @@
import logging import logging
DOMAIN = "openai_conversation" DOMAIN = "openai_conversation"
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__package__)
CONF_PROMPT = "prompt" CONF_PROMPT = "prompt"
DEFAULT_PROMPT = """This smart home is controlled by Home Assistant. DEFAULT_PROMPT = """This smart home is controlled by Home Assistant.

View file

@ -44,6 +44,8 @@ class OpenAIConversationEntity(
): ):
"""OpenAI conversation agent.""" """OpenAI conversation agent."""
_attr_has_entity_name = True
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Initialize the agent.""" """Initialize the agent."""
self.hass = hass self.hass = hass