mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Use default title for migrated Google Generative AI entries (#147551)
This commit is contained in:
parent
6290facffb
commit
0f95fe566c
@ -37,6 +37,7 @@ from homeassistant.helpers.typing import ConfigType
|
|||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_PROMPT,
|
CONF_PROMPT,
|
||||||
|
DEFAULT_TITLE,
|
||||||
DEFAULT_TTS_NAME,
|
DEFAULT_TTS_NAME,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
FILE_POLLING_INTERVAL_SECONDS,
|
FILE_POLLING_INTERVAL_SECONDS,
|
||||||
@ -289,6 +290,7 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
|
|||||||
else:
|
else:
|
||||||
hass.config_entries.async_update_entry(
|
hass.config_entries.async_update_entry(
|
||||||
entry,
|
entry,
|
||||||
|
title=DEFAULT_TITLE,
|
||||||
options={},
|
options={},
|
||||||
version=2,
|
version=2,
|
||||||
)
|
)
|
||||||
|
@ -47,6 +47,7 @@ from .const import (
|
|||||||
CONF_TOP_P,
|
CONF_TOP_P,
|
||||||
CONF_USE_GOOGLE_SEARCH_TOOL,
|
CONF_USE_GOOGLE_SEARCH_TOOL,
|
||||||
DEFAULT_CONVERSATION_NAME,
|
DEFAULT_CONVERSATION_NAME,
|
||||||
|
DEFAULT_TITLE,
|
||||||
DEFAULT_TTS_NAME,
|
DEFAULT_TTS_NAME,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
RECOMMENDED_CHAT_MODEL,
|
RECOMMENDED_CHAT_MODEL,
|
||||||
@ -116,7 +117,7 @@ class GoogleGenerativeAIConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
data=user_input,
|
data=user_input,
|
||||||
)
|
)
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title="Google Generative AI",
|
title=DEFAULT_TITLE,
|
||||||
data=user_input,
|
data=user_input,
|
||||||
subentries=[
|
subentries=[
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ from homeassistant.const import CONF_LLM_HASS_API
|
|||||||
from homeassistant.helpers import llm
|
from homeassistant.helpers import llm
|
||||||
|
|
||||||
DOMAIN = "google_generative_ai_conversation"
|
DOMAIN = "google_generative_ai_conversation"
|
||||||
|
DEFAULT_TITLE = "Google Generative AI"
|
||||||
LOGGER = logging.getLogger(__package__)
|
LOGGER = logging.getLogger(__package__)
|
||||||
CONF_PROMPT = "prompt"
|
CONF_PROMPT = "prompt"
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ from requests.exceptions import Timeout
|
|||||||
from syrupy.assertion import SnapshotAssertion
|
from syrupy.assertion import SnapshotAssertion
|
||||||
|
|
||||||
from homeassistant.components.google_generative_ai_conversation.const import (
|
from homeassistant.components.google_generative_ai_conversation.const import (
|
||||||
|
DEFAULT_TITLE,
|
||||||
DEFAULT_TTS_NAME,
|
DEFAULT_TTS_NAME,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
RECOMMENDED_TTS_OPTIONS,
|
RECOMMENDED_TTS_OPTIONS,
|
||||||
@ -473,6 +474,7 @@ async def test_migration_from_v1_to_v2(
|
|||||||
entry = entries[0]
|
entry = entries[0]
|
||||||
assert entry.version == 2
|
assert entry.version == 2
|
||||||
assert not entry.options
|
assert not entry.options
|
||||||
|
assert entry.title == DEFAULT_TITLE
|
||||||
assert len(entry.subentries) == 3
|
assert len(entry.subentries) == 3
|
||||||
conversation_subentries = [
|
conversation_subentries = [
|
||||||
subentry
|
subentry
|
||||||
@ -609,6 +611,7 @@ async def test_migration_from_v1_to_v2_with_multiple_keys(
|
|||||||
for entry in entries:
|
for entry in entries:
|
||||||
assert entry.version == 2
|
assert entry.version == 2
|
||||||
assert not entry.options
|
assert not entry.options
|
||||||
|
assert entry.title == DEFAULT_TITLE
|
||||||
assert len(entry.subentries) == 2
|
assert len(entry.subentries) == 2
|
||||||
subentry = list(entry.subentries.values())[0]
|
subentry = list(entry.subentries.values())[0]
|
||||||
assert subentry.subentry_type == "conversation"
|
assert subentry.subentry_type == "conversation"
|
||||||
@ -702,6 +705,7 @@ async def test_migration_from_v1_to_v2_with_same_keys(
|
|||||||
entry = entries[0]
|
entry = entries[0]
|
||||||
assert entry.version == 2
|
assert entry.version == 2
|
||||||
assert not entry.options
|
assert not entry.options
|
||||||
|
assert entry.title == DEFAULT_TITLE
|
||||||
assert len(entry.subentries) == 3
|
assert len(entry.subentries) == 3
|
||||||
conversation_subentries = [
|
conversation_subentries = [
|
||||||
subentry
|
subentry
|
||||||
|
Loading…
x
Reference in New Issue
Block a user