1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-29 11:45:35 +01:00

Replace duplicate constants in olama with homeassistant.const imports (#171949)

Co-authored-by: Jan-Philipp Benecke <jan-philipp@bnck.me>
This commit is contained in:
Max Michels
2026-05-23 17:03:44 +02:00
committed by GitHub
parent 05009871aa
commit f88b7bcdf6
5 changed files with 18 additions and 13 deletions
+7 -3
View File
@@ -8,7 +8,13 @@ import httpx
import ollama
from homeassistant.config_entries import ConfigEntry, ConfigSubentry
from homeassistant.const import CONF_API_KEY, CONF_URL, Platform
from homeassistant.const import (
CONF_API_KEY,
CONF_MODEL,
CONF_PROMPT,
CONF_URL,
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import (
ConfigEntryAuthFailed,
@@ -26,9 +32,7 @@ from homeassistant.util.ssl import get_default_context
from .const import (
CONF_KEEP_ALIVE,
CONF_MAX_HISTORY,
CONF_MODEL,
CONF_NUM_CTX,
CONF_PROMPT,
CONF_THINK,
DEFAULT_AI_TASK_NAME,
DEFAULT_NAME,
@@ -18,7 +18,14 @@ from homeassistant.config_entries import (
ConfigSubentryFlow,
SubentryFlowResult,
)
from homeassistant.const import CONF_API_KEY, CONF_LLM_HASS_API, CONF_NAME, CONF_URL
from homeassistant.const import (
CONF_API_KEY,
CONF_LLM_HASS_API,
CONF_MODEL,
CONF_NAME,
CONF_PROMPT,
CONF_URL,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv, llm
from homeassistant.helpers.selector import (
@@ -40,9 +47,7 @@ from . import OllamaConfigEntry
from .const import (
CONF_KEEP_ALIVE,
CONF_MAX_HISTORY,
CONF_MODEL,
CONF_NUM_CTX,
CONF_PROMPT,
CONF_THINK,
DEFAULT_AI_TASK_NAME,
DEFAULT_CONVERSATION_NAME,
-4
View File
@@ -4,10 +4,6 @@ DOMAIN = "ollama"
DEFAULT_NAME = "Ollama"
# pylint: disable-next=home-assistant-duplicate-const
CONF_MODEL = "model"
# pylint: disable-next=home-assistant-duplicate-const
CONF_PROMPT = "prompt"
CONF_THINK = "think"
CONF_KEEP_ALIVE = "keep_alive"
@@ -4,12 +4,12 @@ from typing import Literal
from homeassistant.components import conversation
from homeassistant.config_entries import ConfigSubentry
from homeassistant.const import CONF_LLM_HASS_API, MATCH_ALL
from homeassistant.const import CONF_LLM_HASS_API, CONF_PROMPT, MATCH_ALL
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from . import OllamaConfigEntry
from .const import CONF_PROMPT, DOMAIN
from .const import DOMAIN
from .entity import OllamaBaseLLMEntity
+1 -1
View File
@@ -11,6 +11,7 @@ from voluptuous_openapi import convert
from homeassistant.components import conversation
from homeassistant.config_entries import ConfigSubentry
from homeassistant.const import CONF_MODEL
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import device_registry as dr, llm
from homeassistant.helpers.entity import Entity
@@ -20,7 +21,6 @@ from . import OllamaConfigEntry
from .const import (
CONF_KEEP_ALIVE,
CONF_MAX_HISTORY,
CONF_MODEL,
CONF_NUM_CTX,
CONF_THINK,
DEFAULT_KEEP_ALIVE,