mirror of
https://github.com/smkrv/ha-text-ai.git
synced 2026-07-22 07:03:58 +08:00
Add support for Google Gemini (thanks to @Azzedde) #5
This commit is contained in:
@@ -106,12 +106,13 @@ Transform your smart home experience with powerful AI assistance powered by mult
|
|||||||
|
|
||||||
## 📋 Prerequisites
|
## 📋 Prerequisites
|
||||||
|
|
||||||
- Home Assistant 2024.11 or later
|
- Home Assistant 2024.2.2 or later
|
||||||
- Active API key from:
|
- Active API key from:
|
||||||
- OpenAI ([Get key](https://platform.openai.com/account/api-keys))
|
- OpenAI ([Get key](https://platform.openai.com/account/api-keys))
|
||||||
- Anthropic ([Get key](https://console.anthropic.com/))
|
- Anthropic ([Get key](https://console.anthropic.com/))
|
||||||
- DeepSeek 🆕 ([Get key](https://platform.deepseek.com/api_keys))
|
- DeepSeek ([Get key](https://platform.deepseek.com/api_keys))
|
||||||
- OpenRouter ([Get key](https://openrouter.ai/keys))
|
- OpenRouter ([Get key](https://openrouter.ai/keys))
|
||||||
|
- Google Gemini 🆕 ([Get key](https://ai.google.dev/gemini-api/docs/api-key)) thanks to ([@Azzedde](https://github.com/Azzedde))
|
||||||
- Any OpenAI-compatible API provider
|
- Any OpenAI-compatible API provider
|
||||||
- Python 3.9 or newer
|
- Python 3.9 or newer
|
||||||
- Stable internet connection
|
- Stable internet connection
|
||||||
@@ -159,6 +160,9 @@ To be compatible, a provider should support:
|
|||||||
## ⚡ Installation
|
## ⚡ Installation
|
||||||
|
|
||||||
### HACS Installation (Recommended)
|
### HACS Installation (Recommended)
|
||||||
|
>[!TIP]
|
||||||
|
>HA Text AI is available in the default HACS repository. You can install it directly through HACS or click the button below to open it there.
|
||||||
|
|
||||||
<a href="https://my.home-assistant.io/redirect/hacs_repository/?owner=smkrv&repository=ha-text-ai&category=Integration"><img src="https://my.home-assistant.io/badges/hacs_repository.svg" width="170" height="auto"></a>
|
<a href="https://my.home-assistant.io/redirect/hacs_repository/?owner=smkrv&repository=ha-text-ai&category=Integration"><img src="https://my.home-assistant.io/badges/hacs_repository.svg" width="170" height="auto"></a>
|
||||||
1. Open HACS in Home Assistant
|
1. Open HACS in Home Assistant
|
||||||
2. Click on "Integrations"
|
2. Click on "Integrations"
|
||||||
@@ -169,8 +173,6 @@ To be compatible, a provider should support:
|
|||||||
7. Click "Download"
|
7. Click "Download"
|
||||||
8. Restart Home Assistant
|
8. Restart Home Assistant
|
||||||
|
|
||||||
Note: Also Integration has been submitted to HACS store and is currently pending review in [pull request #2896](https://github.com/hacs/default/pull/2896).
|
|
||||||
|
|
||||||
### Manual Installation
|
### Manual Installation
|
||||||
1. Download the latest release
|
1. Download the latest release
|
||||||
2. Extract and copy `custom_components/ha_text_ai` to your `custom_components` directory
|
2. Extract and copy `custom_components/ha_text_ai` to your `custom_components` directory
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class HATextAIConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
self._errors = {}
|
self._errors = {}
|
||||||
|
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
# Выбор endpoint по провайдеру
|
# Selecting an endpoint by provider
|
||||||
default_endpoint = {
|
default_endpoint = {
|
||||||
API_PROVIDER_OPENAI: DEFAULT_OPENAI_ENDPOINT,
|
API_PROVIDER_OPENAI: DEFAULT_OPENAI_ENDPOINT,
|
||||||
API_PROVIDER_ANTHROPIC: DEFAULT_ANTHROPIC_ENDPOINT,
|
API_PROVIDER_ANTHROPIC: DEFAULT_ANTHROPIC_ENDPOINT,
|
||||||
@@ -102,7 +102,7 @@ class HATextAIConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
API_PROVIDER_GEMINI: DEFAULT_GEMINI_ENDPOINT,
|
API_PROVIDER_GEMINI: DEFAULT_GEMINI_ENDPOINT,
|
||||||
}.get(self._provider, DEFAULT_OPENAI_ENDPOINT)
|
}.get(self._provider, DEFAULT_OPENAI_ENDPOINT)
|
||||||
|
|
||||||
# Выбор модели по умолчанию по провайдеру
|
# Selecting the default model by provider
|
||||||
default_model = (
|
default_model = (
|
||||||
DEFAULT_DEEPSEEK_MODEL if self._provider == API_PROVIDER_DEEPSEEK else
|
DEFAULT_DEEPSEEK_MODEL if self._provider == API_PROVIDER_DEEPSEEK else
|
||||||
DEFAULT_GEMINI_MODEL if self._provider == API_PROVIDER_GEMINI else
|
DEFAULT_GEMINI_MODEL if self._provider == API_PROVIDER_GEMINI else
|
||||||
|
|||||||
@@ -24,6 +24,6 @@
|
|||||||
"single_config_entry": false,
|
"single_config_entry": false,
|
||||||
"ssdp": [],
|
"ssdp": [],
|
||||||
"usb": [],
|
"usb": [],
|
||||||
"version": "2.1.1",
|
"version": "2.1.3",
|
||||||
"zeroconf": []
|
"zeroconf": []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,12 +88,13 @@
|
|||||||
"selector": {
|
"selector": {
|
||||||
"api_provider": {
|
"api_provider": {
|
||||||
"options": {
|
"options": {
|
||||||
"openai": "OpenAI (kompatibel)",
|
"openai": "OpenAI (compatible)",
|
||||||
"anthropic": "Anthropic (kompatibel)",
|
"anthropic": "Anthropic (compatible)",
|
||||||
"deepseek": "DeepSeek"
|
"deepseek": "DeepSeek",
|
||||||
}
|
"gemini": "Google Gemini"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"ask_question": {
|
"ask_question": {
|
||||||
"name": "Frage stellen (HA Text AI)",
|
"name": "Frage stellen (HA Text AI)",
|
||||||
|
|||||||
@@ -86,12 +86,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"selector": {
|
"selector": {
|
||||||
"api_provider": {
|
"api_provider": {
|
||||||
"options": {
|
"options": {
|
||||||
"openai": "OpenAI (compatible)",
|
"openai": "OpenAI (compatible)",
|
||||||
"anthropic": "Anthropic (compatible)",
|
"anthropic": "Anthropic (compatible)",
|
||||||
"deepseek": "DeepSeek",
|
"deepseek": "DeepSeek",
|
||||||
"gemini": "Google Gemini"
|
"gemini": "Google Gemini"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -90,10 +90,11 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"openai": "OpenAI (compatible)",
|
"openai": "OpenAI (compatible)",
|
||||||
"anthropic": "Anthropic (compatible)",
|
"anthropic": "Anthropic (compatible)",
|
||||||
"deepseek": "DeepSeek"
|
"deepseek": "DeepSeek",
|
||||||
}
|
"gemini": "Google Gemini"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"ask_question": {
|
"ask_question": {
|
||||||
"name": "Hacer Pregunta (HA Text AI)",
|
"name": "Hacer Pregunta (HA Text AI)",
|
||||||
|
|||||||
@@ -90,7 +90,8 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"openai": "OpenAI (अनुकूलित)",
|
"openai": "OpenAI (अनुकूलित)",
|
||||||
"anthropic": "Anthropic (अनुकूलित)",
|
"anthropic": "Anthropic (अनुकूलित)",
|
||||||
"deepseek": "DeepSeek"
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -90,7 +90,8 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"openai": "OpenAI (compatibile)",
|
"openai": "OpenAI (compatibile)",
|
||||||
"anthropic": "Anthropic (compatibile)",
|
"anthropic": "Anthropic (compatibile)",
|
||||||
"deepseek": "DeepSeek"
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -90,7 +90,8 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"openai": "OpenAI (совместимый)",
|
"openai": "OpenAI (совместимый)",
|
||||||
"anthropic": "Anthropic (совместимый)",
|
"anthropic": "Anthropic (совместимый)",
|
||||||
"deepseek": "DeepSeek"
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -90,7 +90,8 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"openai": "OpenAI (компатибилан)",
|
"openai": "OpenAI (компатибилан)",
|
||||||
"anthropic": "Anthropic (компатибилан)",
|
"anthropic": "Anthropic (компатибилан)",
|
||||||
"deepseek": "DeepSeek"
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -90,7 +90,8 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"openai": "OpenAI(兼容)",
|
"openai": "OpenAI(兼容)",
|
||||||
"anthropic": "Anthropic(兼容)",
|
"anthropic": "Anthropic(兼容)",
|
||||||
"deepseek": "DeepSeek "
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user