diff --git a/custom_components/gigachain/__init__.py b/custom_components/gigachain/__init__.py index f4647a6..77c5de9 100644 --- a/custom_components/gigachain/__init__.py +++ b/custom_components/gigachain/__init__.py @@ -15,7 +15,7 @@ from homeassistant.util import ulid from .const import ( DOMAIN, - CONF_AUTH_DATA, + CONF_API_KEY, CONF_CHAT_MODEL, DEFAULT_CHAT_MODEL, CONF_PROMPT, @@ -27,7 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Initialize GigaChain.""" - client = GigaChat(credentials=entry.data[CONF_AUTH_DATA], verify_ssl_certs=False) + client = GigaChat(credentials=entry.data[CONF_API_KEY], verify_ssl_certs=False) hass.data.setdefault(DOMAIN, {})[entry.entry_id] = client conversation.async_set_agent(hass, entry, GigaChatAI(hass, entry)) return True diff --git a/custom_components/gigachain/config_flow.py b/custom_components/gigachain/config_flow.py index d1571ed..56f6e81 100644 --- a/custom_components/gigachain/config_flow.py +++ b/custom_components/gigachain/config_flow.py @@ -15,7 +15,7 @@ TemplateSelector, ) from .const import ( - CONF_AUTH_DATA, + CONF_API_KEY, CONF_CHAT_MODEL, CONF_PROMPT, DEFAULT_CHAT_MODEL, @@ -25,7 +25,7 @@ STEP_USER_DATA_SCHEMA = vol.Schema( { - vol.Required(CONF_AUTH_DATA): str + vol.Required(CONF_API_KEY): str } ) diff --git a/custom_components/gigachain/const.py b/custom_components/gigachain/const.py index 36b9bc6..ac1a5c3 100644 --- a/custom_components/gigachain/const.py +++ b/custom_components/gigachain/const.py @@ -1,7 +1,7 @@ """Constants for the GigaChain integration.""" DOMAIN = "gigachain" -CONF_AUTH_DATA = "auth_data" +CONF_API_KEY = "api_key" CONF_PROMPT = "prompt" DEFAULT_PROMPT = """Ты HAL 9000, компьютер из цикла произведений «Космическая одиссея» Артура Кларка, обладающий способностью к самообучению. Мы находимся в умном доме под управлением системы Home Assistant. diff --git a/custom_components/gigachain/manifest.json b/custom_components/gigachain/manifest.json index 52321d5..026400e 100644 --- a/custom_components/gigachain/manifest.json +++ b/custom_components/gigachain/manifest.json @@ -10,6 +10,8 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/gritaro/gigachain/issues", "requirements": [ + "gigachat", + "langchain", "gigachain-community==0.0.16", "yandexcloud==0.259.0" ], diff --git a/custom_components/gigachain/translations/en.json b/custom_components/gigachain/translations/en.json index cd4bc14..fca91c9 100644 --- a/custom_components/gigachain/translations/en.json +++ b/custom_components/gigachain/translations/en.json @@ -4,7 +4,7 @@ "user": { "title": "GigaChain configuration", "data": { - "auth_data": "Authorization data" + "api_key": "Authorization data" } } }, diff --git a/custom_components/gigachain/translations/ru.json b/custom_components/gigachain/translations/ru.json index 4ff4e76..08c70c0 100644 --- a/custom_components/gigachain/translations/ru.json +++ b/custom_components/gigachain/translations/ru.json @@ -4,7 +4,7 @@ "user": { "title": "GigaChain конфигурация", "data": { - "auth_data": "Авторизационные данные" + "api_key": "Авторизационные данные" } } },