Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76c5629fa0 | ||
|
|
7958bd010b | ||
|
|
8cd876195a | ||
|
|
376753e001 | ||
|
|
b6e73e847d | ||
|
|
440c734214 | ||
|
|
73788373cd | ||
|
|
4bfc96019b | ||
|
|
2138fc7654 | ||
|
|
95bd2ebb41 | ||
|
|
cad0fd7031 | ||
|
|
c003b258f6 | ||
|
|
65a10c77f4 | ||
|
|
e1463828c9 | ||
|
|
5ebb9c9c66 | ||
|
|
f17c631a79 | ||
|
|
0e06794384 | ||
|
|
d8a924909b | ||
|
|
29f1659a02 | ||
|
|
5b7905de80 | ||
|
|
cf9ac6dcea | ||
|
|
568eb3e16c | ||
|
|
53fb150389 | ||
|
|
acbb53d2af | ||
|
|
e19db29441 | ||
|
|
bfd64d1122 | ||
|
|
82e1f0c4f9 | ||
|
|
5c16eee6e4 | ||
|
|
e988d445a4 | ||
|
|
f9bfb9ab7f | ||
|
|
92dd1bc110 | ||
|
|
17d547325a | ||
|
|
b8cb70217c | ||
|
|
530d04f25d | ||
|
|
b71083b9bf | ||
|
|
f9f7d10f7f | ||
|
|
9f7cb20621 | ||
|
|
6fc3b23365 | ||
|
|
15c717fcb0 | ||
|
|
be06fddce1 | ||
|
|
5f0bd861a7 | ||
|
|
428aee46c8 | ||
|
|
561bcf0b1d | ||
|
|
2b1e42c665 | ||
|
|
2d68f29ab5 | ||
|
|
19d4a93bca | ||
|
|
fb75c5f44e | ||
|
|
52af987985 | ||
|
|
162a30acdd | ||
|
|
898a6fc638 | ||
|
|
38e2362be4 | ||
|
|
cea912d0b5 | ||
|
|
5ec00040c2 | ||
|
|
8d28fc4a0d | ||
|
|
7cc6587724 | ||
|
|
bacf76e0a9 | ||
|
|
f86c7bfd57 | ||
|
|
2aaf340575 | ||
|
|
bae11ba85c | ||
|
|
9eb7d8912c | ||
|
|
d29535245f | ||
|
|
ca3ae982b0 | ||
|
|
0c4399b46c | ||
|
|
c13ef1921d | ||
|
|
0fb9acfa8f | ||
|
|
2ac4389e1a | ||
|
|
de194e425c | ||
|
|
95f3d6506e | ||
|
|
3e877243b9 | ||
|
|
fd795c9e90 | ||
|
|
5f5dc041b9 | ||
|
|
3d3885d43d | ||
|
|
b059744716 | ||
|
|
f2a41aaa2c | ||
|
|
1fcf751d0d | ||
|
|
a45c9407fd | ||
|
|
21fdf108cf | ||
|
|
c7ec2b3ea4 | ||
|
|
6c4da6cea5 | ||
|
|
3029c5dd26 | ||
|
|
3e97028094 | ||
|
|
1194c87134 | ||
|
|
e03b5315c2 | ||
|
|
fad887492f | ||
|
|
f26df29937 | ||
|
|
69b54a08ba | ||
|
|
7ce77eb18e | ||
|
|
1480669dc8 | ||
|
|
f397bbffe7 | ||
|
|
5709bce1ae | ||
|
|
d549a36c3a | ||
|
|
e9ba480e95 | ||
|
|
8ac7154399 |
@@ -1,40 +0,0 @@
|
|||||||
# Python
|
|
||||||
__pycache__/
|
|
||||||
*.py[cod]
|
|
||||||
*$py.class
|
|
||||||
*.so
|
|
||||||
.Python
|
|
||||||
build/
|
|
||||||
develop-eggs/
|
|
||||||
dist/
|
|
||||||
downloads/
|
|
||||||
eggs/
|
|
||||||
.eggs/
|
|
||||||
lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
wheels/
|
|
||||||
*.egg-info/
|
|
||||||
.installed.cfg
|
|
||||||
*.egg
|
|
||||||
|
|
||||||
# Home Assistant
|
|
||||||
.storage
|
|
||||||
.cloud
|
|
||||||
.google.token
|
|
||||||
|
|
||||||
# IDE
|
|
||||||
.idea/
|
|
||||||
.vscode/
|
|
||||||
*.swp
|
|
||||||
*.swo
|
|
||||||
*~
|
|
||||||
|
|
||||||
# OS
|
|
||||||
.DS_Store
|
|
||||||
Thumbs.db
|
|
||||||
*.psd
|
|
||||||
*.zip
|
|
||||||
*.txt
|
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
|
nationality, personal appearance, race, religion, or sexual identity
|
||||||
|
and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment for our
|
||||||
|
community include:
|
||||||
|
|
||||||
|
* Demonstrating empathy and kindness toward other people
|
||||||
|
* Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
* Giving and gracefully accepting constructive feedback
|
||||||
|
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
|
and learning from the experience
|
||||||
|
* Focusing on what is best not just for us as individuals, but for the
|
||||||
|
overall community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery, and sexual attention or
|
||||||
|
advances of any kind
|
||||||
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or email
|
||||||
|
address, without their explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
|
decisions when appropriate.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
|
an individual is officially representing the community in public spaces.
|
||||||
|
Examples of representing our community include using an official e-mail address,
|
||||||
|
posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported to the community leaders responsible for enforcement at
|
||||||
|
issue tracker.
|
||||||
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series
|
||||||
|
of actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or
|
||||||
|
permanent ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
|
the community.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
|
version 2.0, available at
|
||||||
|
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||||
|
enforcement ladder](https://github.com/mozilla/diversity).
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
|
https://www.contributor-covenant.org/faq. Translations are available at
|
||||||
|
https://www.contributor-covenant.org/translations.
|
||||||
@@ -2,124 +2,167 @@
|
|||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
  [](https://opensource.org/licenses/MIT) [](https://github.com/hacs/integration)   
|
  [](https://creativecommons.org/licenses/by-nc-sa/4.0/) [](https://github.com/hacs/integration)
|
||||||
|
       
|
||||||
|
|
||||||
<img src="https://github.com/smkrv/ha-text-ai/blob/524849f6a945ec62c2cf6a6b7ecd9a28b37bf0fa/misc/icons/logo.jpg" alt="HA Text AI" height="160"/>
|
|
||||||
|
<img src="https://github.com/smkrv/ha-text-ai/blob/15c717fcb0204bf4a0d4b4b4c6f0bb93e9f6c9a9/custom_components/ha_text_ai/icons/logo%402x.png" alt="HA Text AI" style="width: 50%; max-width: 256px; max-height: 128px; aspect-ratio: 2/1; object-fit: contain;"/>
|
||||||
|
|
||||||
### Advanced AI Integration for [Home Assistant](https://www.home-assistant.io/) with LLM multi-provider support
|
### Advanced AI Integration for [Home Assistant](https://www.home-assistant.io/) with LLM multi-provider support
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
Transform your smart home experience with powerful AI assistance powered by multiple AI providers including OpenAI GPT and Anthropic Claude models. Get intelligent responses, automate complex scenarios, and enhance your home automation with advanced natural language processing.
|
Transform your smart home experience with powerful AI assistance powered by multiple AI providers including OpenAI GPT, DeepSeek and Anthropic Claude models. Get intelligent responses, automate complex scenarios, and enhance your home automation with advanced natural language processing.
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> 🚧 ALPHA VERSION 🚧
|
> 🤝 Community Driven: for more details on the integration,
|
||||||
> Expect: potential bugs, frequent changes, incomplete features.
|
> check out the discussion on the **[Home Assistant Community forum](https://community.home-assistant.io/t/ha-text-ai-transforming-home-automation-through-multi-llm-integration/799741)**
|
||||||
> 🤝 Community Driven
|
|
||||||
>
|
>
|
||||||
> <a href="https://community.home-assistant.io/t/ha-text-ai-transforming-home-automation-with-multi-provider-language-models/799741"><img src="https://img.shields.io/badge/Community-blue?style=for-the-badge&logo=homeassistant&logoColor=white&color=03a9f4"/></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="210" height="auto"></a>
|
||||||
>
|
>
|
||||||
> [Screenshots](misc/screenshots/screenshot.jpg)
|
> [Screenshots](assets/images/screenshots/screenshot.jpg)
|
||||||
|
|
||||||
## 🌟 Features
|
## 🌟 Features
|
||||||
|
|
||||||
- 🧠 **Multi-Provider AI Integration**:
|
- 🧠 **Multi-Provider AI Integration**: Support for OpenAI GPT, DeepSeek and Anthropic Claude models
|
||||||
- Support for OpenAI GPT models
|
- 💬 **Advanced Language Processing**: Context-aware, multi-turn conversations
|
||||||
- Anthropic Claude integration
|
- 📝 **Enhanced Memory Management**: Secure file-based history storage
|
||||||
- Custom API endpoints
|
- ⚡ **Performance Optimization**: Efficient token usage and smart rate limiting
|
||||||
- Flexible model selection
|
- 🎯 **Advanced Customization**: Per-request model and parameter selection
|
||||||
|
- 🔒 **Enhanced Security**: Secure API key management and usage monitoring
|
||||||
|
- 🎨 **Improved User Experience**: Intuitive configuration and rich interfaces
|
||||||
|
- 🔄 **Automation Integration**: Event-driven responses and template compatibility
|
||||||
|
|
||||||
- 💬 **Advanced Language Processing**:
|
<details>
|
||||||
- Context-aware responses
|
<summary>📦 Detailed Feature Breakdown</summary>
|
||||||
- Multi-turn conversations
|
|
||||||
- Custom system instructions
|
|
||||||
- Natural conversation flow
|
|
||||||
|
|
||||||
- 📝 **Enhanced Memory Management**:
|
### 🧠 **Multi-Provider AI Integration**
|
||||||
- Persistent conversation history
|
- Support for OpenAI GPT models
|
||||||
- Context-aware responses
|
- Anthropic Claude integration
|
||||||
- Customizable history limits
|
- DeepSeek integration
|
||||||
- Model-specific filtering
|
- Custom API endpoints
|
||||||
|
- Flexible model selection
|
||||||
|
|
||||||
- ⚡ **Performance Optimization**:
|
### 💬 **Advanced Language Processing**
|
||||||
- Efficient token usage
|
- Context-aware responses
|
||||||
- Smart rate limiting
|
- Multi-turn conversations
|
||||||
- Response caching
|
- Custom system instructions
|
||||||
- Request interval control
|
- Natural conversation flow
|
||||||
|
|
||||||
- 🎯 **Advanced Customization**:
|
### 📝 **Enhanced Memory Management**
|
||||||
- Per-request model selection
|
- File-based conversation history storage
|
||||||
- Adjustable parameters
|
- Automatic history rotation
|
||||||
- Custom system prompts
|
- Configurable history size limits
|
||||||
- Temperature control
|
- Secure storage in Home Assistant
|
||||||
|
|
||||||
- 🔒 **Enhanced Security**:
|
### ⚡ **Performance Optimization**
|
||||||
- Secure API key storage
|
- Efficient token usage
|
||||||
- Rate limiting protection
|
- Smart rate limiting
|
||||||
- Error handling
|
- Response caching
|
||||||
- Usage monitoring
|
- Request interval control
|
||||||
|
|
||||||
- 🎨 **Improved User Experience**:
|
### 🎯 **Advanced Customization**
|
||||||
- Intuitive configuration UI
|
- Per-request model selection
|
||||||
- Detailed sensor attributes
|
- Adjustable parameters
|
||||||
- Rich service interface
|
- Custom system prompts
|
||||||
- Model selection UI
|
- Temperature control
|
||||||
|
|
||||||
- 🔄 **Automation Integration**:
|
### 🔒 **Enhanced Security**
|
||||||
- Event-driven responses
|
- Secure API key storage
|
||||||
- Conditional logic support
|
- Rate limiting protection
|
||||||
- Template compatibility
|
- Error handling
|
||||||
- Model-specific automation
|
- Usage monitoring
|
||||||
|
|
||||||
|
### 🎨 **Improved User Experience**
|
||||||
|
- Intuitive configuration UI
|
||||||
|
- Detailed sensor attributes
|
||||||
|
- Rich service interface
|
||||||
|
- Model selection UI
|
||||||
|
|
||||||
|
### 🔄 **Automation Integration**
|
||||||
|
- Event-driven responses
|
||||||
|
- Conditional logic support
|
||||||
|
- Template compatibility
|
||||||
|
- Model-specific automation
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
#### 🌐 Translations
|
||||||
|
|
||||||
|
| Code | Language | Status |
|
||||||
|
|------|----------|--------|
|
||||||
|
| 🇩🇪 de | Deutsch | Full |
|
||||||
|
| 🇬🇧 en | English | Primary |
|
||||||
|
| 🇪🇸 es | Español | Full |
|
||||||
|
| 🇮🇳 hi | हिन्दी | Full |
|
||||||
|
| 🇮🇹 it | Italiano | Full |
|
||||||
|
| 🇷🇺 ru | Русский | Full |
|
||||||
|
| 🇷🇸 sr | Српски | Full |
|
||||||
|
| 🇨🇳 zh | 中文 | Full |
|
||||||
|
|
||||||
## 📋 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))
|
||||||
- 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
|
||||||
- Python 3.9 or newer
|
- Python 3.9 or newer
|
||||||
- Stable internet connection
|
- Stable internet connection
|
||||||
|
|
||||||
### Configuration Options
|
## Configuration Options
|
||||||
- API Provider (OpenAI/Anthropic)
|
|
||||||
- API Key (provider-specific)
|
|
||||||
- Model Selection (flexible, provider-specific models)
|
|
||||||
- Temperature (Creativity control, 0.0-2.0)
|
|
||||||
- Max Tokens (Response length limit)
|
|
||||||
- Request Interval (API call throttling)
|
|
||||||
- Custom API Endpoint (optional)
|
|
||||||
|
|
||||||
#### ⓘ Potentially Compatible Providers
|
### 🔧 **Core Configuration Settings**
|
||||||
The integration is designed to be flexible and may work with other providers offering OpenAI-compatible APIs:
|
- 🌐 **API Provider**: OpenAI/Anthropic/DeepSeek
|
||||||
- Groq
|
- 🔑 **API Key**: Provider-specific authentication
|
||||||
- Together AI
|
- 🤖 **Model Selection**: Flexible, provider-specific models
|
||||||
- Perplexity AI
|
- 🌡️ **Temperature**: Creativity control (0.0-2.0)
|
||||||
- Mistral AI
|
- 📏 **Max Tokens**: Response length limit (passed directly to the LLM API to control the maximum length of the response)
|
||||||
- Google AI
|
- ⏱️ **Request Interval**: API call throttling
|
||||||
- Local AI servers (like Ollama)
|
- 💾 **History Size**: Number of messages to retain
|
||||||
- Custom OpenAI-compatible endpoints
|
- 🌍 **Custom API Endpoint**: Optional advanced configuration
|
||||||
|
|
||||||
#### Additional Notes
|
<details>
|
||||||
- Not all providers guarantee full compatibility
|
<summary>🌐 Potentially Compatible Providers</summary>
|
||||||
- Performance may vary between providers
|
|
||||||
- Check individual provider's documentation
|
#### Flexible Provider Ecosystem
|
||||||
|
The integration is designed to be flexible and may work with other providers offering OpenAI-compatible APIs:
|
||||||
|
- Groq
|
||||||
|
- Together AI
|
||||||
|
- Perplexity AI
|
||||||
|
- Mistral AI
|
||||||
|
- Google AI
|
||||||
|
- Local AI servers (like Ollama)
|
||||||
|
- Custom OpenAI-compatible endpoints
|
||||||
|
|
||||||
|
#### 🚨 Compatibility Notes
|
||||||
|
- Not all providers guarantee full compatibility
|
||||||
|
- Performance may vary between providers
|
||||||
|
- Check individual provider's documentation
|
||||||
- Ensure your API key has sufficient credits/quota
|
- Ensure your API key has sufficient credits/quota
|
||||||
|
|
||||||
#### Provider Compatibility Requirements
|
#### 🔍 Provider Compatibility Requirements
|
||||||
To be compatible, a provider should support:
|
To be compatible, a provider should support:
|
||||||
- OpenAI-like REST API structure
|
- OpenAI-like REST API structure
|
||||||
- JSON request/response format
|
- JSON request/response format
|
||||||
- Standard authentication method
|
- Standard authentication method
|
||||||
- Similar model parameter handling
|
- Similar model parameter handling
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## ⚡ 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"
|
||||||
@@ -144,7 +187,8 @@ To be compatible, a provider should support:
|
|||||||
3. Search for "HA Text AI"
|
3. Search for "HA Text AI"
|
||||||
4. Follow the configuration steps
|
4. Follow the configuration steps
|
||||||
|
|
||||||
### Via YAML
|
<details>
|
||||||
|
<summary>📦 Via YAML (Advanced)</summary>
|
||||||
|
|
||||||
### Platform Configuration (Global Settings)
|
### Platform Configuration (Global Settings)
|
||||||
|
|
||||||
@@ -188,6 +232,8 @@ sensor:
|
|||||||
| `request_interval` | Float | ❌ | 1.0 | Delay between API requests |
|
| `request_interval` | Float | ❌ | 1.0 | Delay between API requests |
|
||||||
| `api_endpoint` | URL | ⚠️ | Provider default | Custom API endpoint |
|
| `api_endpoint` | URL | ⚠️ | Provider default | Custom API endpoint |
|
||||||
| `system_prompt` | String | ❌ | - | Default context for AI interactions |
|
| `system_prompt` | String | ❌ | - | Default context for AI interactions |
|
||||||
|
| `max_history_size` | Integer | ❌ | 100 | Maximum number of conversation entries to store |
|
||||||
|
| `history_file_size` | Integer | ⚠️ | 1 | Maximum history file size in MB |
|
||||||
|
|
||||||
#### Sensor Configuration
|
#### Sensor Configuration
|
||||||
|
|
||||||
@@ -200,6 +246,8 @@ sensor:
|
|||||||
| `temperature` | Float | ❌ | Platform setting | Override global temperature |
|
| `temperature` | Float | ❌ | Platform setting | Override global temperature |
|
||||||
| `max_tokens` | Integer | ❌ | Platform setting | Override global max tokens |
|
| `max_tokens` | Integer | ❌ | Platform setting | Override global max tokens |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## 🛠️ Available Services
|
## 🛠️ Available Services
|
||||||
|
|
||||||
### ask_question
|
### ask_question
|
||||||
@@ -212,12 +260,14 @@ data:
|
|||||||
max_tokens: 500 # optional
|
max_tokens: 500 # optional
|
||||||
context_messages: 10 #optional, number of previous messages to include in context, default: 5
|
context_messages: 10 #optional, number of previous messages to include in context, default: 5
|
||||||
system_prompt: "You are a sleep optimization expert" # optional
|
system_prompt: "You are a sleep optimization expert" # optional
|
||||||
|
instance: sensor.ha_text_ai_gpt
|
||||||
```
|
```
|
||||||
|
|
||||||
### set_system_prompt
|
### set_system_prompt
|
||||||
```yaml
|
```yaml
|
||||||
service: ha_text_ai.set_system_prompt
|
service: ha_text_ai.set_system_prompt
|
||||||
data:
|
data:
|
||||||
|
instance: sensor.ha_text_ai_gpt
|
||||||
prompt: |
|
prompt: |
|
||||||
You are a home automation expert focused on:
|
You are a home automation expert focused on:
|
||||||
1. Energy efficiency
|
1. Energy efficiency
|
||||||
@@ -229,6 +279,8 @@ data:
|
|||||||
### clear_history
|
### clear_history
|
||||||
```yaml
|
```yaml
|
||||||
service: ha_text_ai.clear_history
|
service: ha_text_ai.clear_history
|
||||||
|
data:
|
||||||
|
instance: sensor.ha_text_ai_gpt
|
||||||
```
|
```
|
||||||
|
|
||||||
### get_history
|
### get_history
|
||||||
@@ -237,6 +289,7 @@ service: ha_text_ai.get_history
|
|||||||
data:
|
data:
|
||||||
limit: 5 # optional
|
limit: 5 # optional
|
||||||
filter_model: "gpt-4o" # optional
|
filter_model: "gpt-4o" # optional
|
||||||
|
instance: sensor.ha_text_ai_gpt
|
||||||
```
|
```
|
||||||
|
|
||||||
### 🏷️ HA Text AI Sensor Naming Convention
|
### 🏷️ HA Text AI Sensor Naming Convention
|
||||||
@@ -256,7 +309,7 @@ sensor.ha_text_ai_YOUR_UNIQUE_SUFFIX
|
|||||||
# Examples:
|
# Examples:
|
||||||
sensor.ha_text_ai_gpt # GPT-based sensor
|
sensor.ha_text_ai_gpt # GPT-based sensor
|
||||||
sensor.ha_text_ai_claude # Claude-based sensor
|
sensor.ha_text_ai_claude # Claude-based sensor
|
||||||
sensor.ha_text_ai_gpt # Custom suffix
|
sensor.ha_text_ai_abc # Custom suffix
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Response Retrieval
|
#### Response Retrieval
|
||||||
@@ -273,6 +326,7 @@ automation:
|
|||||||
- service: ha_text_ai.ask_question
|
- service: ha_text_ai.ask_question
|
||||||
data:
|
data:
|
||||||
question: "Home automation advice"
|
question: "Home automation advice"
|
||||||
|
instance: sensor.ha_text_ai_gpt
|
||||||
- service: notify.mobile
|
- service: notify.mobile
|
||||||
data:
|
data:
|
||||||
message: >
|
message: >
|
||||||
@@ -289,6 +343,16 @@ automation:
|
|||||||
|
|
||||||
### 🔍 HA Text AI Sensor Attributes
|
### 🔍 HA Text AI Sensor Attributes
|
||||||
|
|
||||||
|
- 🤖 **Model and Provider Information**: Tracking current AI model and service provider
|
||||||
|
- 🚦 **System Status**: Real-time API and processing readiness
|
||||||
|
- 📊 **Performance Metrics**: Request success rates and response times
|
||||||
|
- 💬 **Conversation Tracking**: Token usage and interaction history are estimated using a heuristic method based on word count and specific word characteristics, which may differ from actual token usage.
|
||||||
|
- 🕒 **Last Interaction Details**: Recent query and response tracking
|
||||||
|
- ❤️ **System Health**: Error monitoring and service uptime
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>📦 Detailed Sensor Attributes</summary>
|
||||||
|
|
||||||
#### Model and Provider Information
|
#### Model and Provider Information
|
||||||
```yaml
|
```yaml
|
||||||
# Name of the AI model currently in use (e.g., latest version of GPT)
|
# Name of the AI model currently in use (e.g., latest version of GPT)
|
||||||
@@ -344,6 +408,12 @@ automation:
|
|||||||
|
|
||||||
# Tokens used in the AI's generated responses
|
# Tokens used in the AI's generated responses
|
||||||
{{ state_attr('sensor.ha_text_ai_gpt', 'Completion tokens') }} # 0
|
{{ state_attr('sensor.ha_text_ai_gpt', 'Completion tokens') }} # 0
|
||||||
|
|
||||||
|
# Number of entries in current history file
|
||||||
|
{{ state_attr('sensor.ha_text_ai_gpt', 'History size') }} # 0
|
||||||
|
|
||||||
|
# Last few conversation entries (limited to 1 for performance)
|
||||||
|
{{ state_attr('sensor.ha_text_ai_gpt', 'conversation_history') }} # [...]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Last Interaction Details
|
#### Last Interaction Details
|
||||||
@@ -370,11 +440,19 @@ automation:
|
|||||||
{{ state_attr('sensor.ha_text_ai_gpt', 'Uptime') }} # 547,58
|
{{ state_attr('sensor.ha_text_ai_gpt', 'Uptime') }} # 547,58
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### History Storage
|
||||||
|
Conversation history stored in `.storage/ha_text_ai_history/` directory:
|
||||||
|
- Each instance has its own history file (JSON)
|
||||||
|
- Files are automatically rotated when size limit is reached
|
||||||
|
- Archived history files are timestamped
|
||||||
|
- Default maximum file size: 1MB
|
||||||
|
|
||||||
### 💡 Pro Tips
|
### 💡 Pro Tips
|
||||||
- Always check attribute existence
|
- Always check attribute existence
|
||||||
- Use these attributes for monitoring and automation
|
- Use these attributes for monitoring and automation
|
||||||
- Some values might be 0 or empty initially
|
- Some values might be 0 or empty initially
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## 📘 FAQ
|
## 📘 FAQ
|
||||||
|
|
||||||
@@ -402,6 +480,15 @@ A: Yes, your data is secure. The system operates entirely on your local machine,
|
|||||||
**Q: How do context messages work?**
|
**Q: How do context messages work?**
|
||||||
A: Context messages allow the AI to remember and reference previous conversation history. By default, 5 previous messages are included, but you can customize this from 1 to 20 messages to control the conversation depth and token usage.
|
A: Context messages allow the AI to remember and reference previous conversation history. By default, 5 previous messages are included, but you can customize this from 1 to 20 messages to control the conversation depth and token usage.
|
||||||
|
|
||||||
|
**Q: Where is conversation history stored?**
|
||||||
|
A: History is stored in files under the `.storage/ha_text_ai_history/` directory, with automatic rotation and size management.
|
||||||
|
|
||||||
|
**Q: Can I access old conversation history?**
|
||||||
|
A: Yes, archived history files are stored with timestamps and can be accessed manually if needed.
|
||||||
|
|
||||||
|
**Q: How much history is kept?**
|
||||||
|
A: By default, up to 100 conversations are stored, but this can be configured. Files are automatically rotated when they reach 1MB.
|
||||||
|
|
||||||
## 🤝 Contributing
|
## 🤝 Contributing
|
||||||
|
|
||||||
Contributions welcome! Please read our [Contributing Guide](CONTRIBUTING.md).
|
Contributions welcome! Please read our [Contributing Guide](CONTRIBUTING.md).
|
||||||
@@ -428,7 +515,7 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
## 📝 License
|
## 📝 License
|
||||||
|
|
||||||
Author: SMKRV
|
Author: SMKRV
|
||||||
[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) - see [LICENSE](LICENSE) for details.
|
[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) - see [LICENSE](LICENSE) for details.
|
||||||
|
|
||||||
## 💡 Support the Project
|
## 💡 Support the Project
|
||||||
|
|
||||||
@@ -448,9 +535,11 @@ If you want to say thanks financially, you can send a small token of appreciatio
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<div align="center"><img src="https://github.com/smkrv/ha-text-ai/blob/2aaf3405759eb2d97624834594e24ace896131df/assets/images/icons/footer_icon.png" alt="HA Text AI" style="width: 128px; height: auto;"/></div>
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
Made with ❤️ and Claude 3.5 Sonnet for the Home Assistant Community
|
Made with ❤️ for the Home Assistant Community,
|
||||||
|
utilizing Claude 3.5 Sonnet, Gemini Pro 1.5, and Qwen 2.5 Coder 32B Instruct.
|
||||||
|
|
||||||
[Report Bug](https://github.com/smkrv/ha-text-ai/issues) · [Request Feature](https://github.com/smkrv/ha-text-ai/issues)
|
[Report Bug](https://github.com/smkrv/ha-text-ai/issues) · [Request Feature](https://github.com/smkrv/ha-text-ai/issues)
|
||||||
|
|
||||||
|
|||||||
|
After Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 618 KiB After Width: | Height: | Size: 618 KiB |
|
Before Width: | Height: | Size: 923 KiB After Width: | Height: | Size: 923 KiB |
|
After Width: | Height: | Size: 339 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
@@ -11,8 +11,9 @@ from __future__ import annotations
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import hashlib
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict, TypeVar
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from async_timeout import timeout
|
from async_timeout import timeout
|
||||||
@@ -38,11 +39,17 @@ from .const import (
|
|||||||
CONF_CONTEXT_MESSAGES,
|
CONF_CONTEXT_MESSAGES,
|
||||||
API_PROVIDER_OPENAI,
|
API_PROVIDER_OPENAI,
|
||||||
API_PROVIDER_ANTHROPIC,
|
API_PROVIDER_ANTHROPIC,
|
||||||
|
API_PROVIDER_DEEPSEEK,
|
||||||
|
API_PROVIDER_GEMINI,
|
||||||
DEFAULT_MODEL,
|
DEFAULT_MODEL,
|
||||||
|
DEFAULT_DEEPSEEK_MODEL,
|
||||||
|
DEFAULT_GEMINI_MODEL,
|
||||||
DEFAULT_TEMPERATURE,
|
DEFAULT_TEMPERATURE,
|
||||||
DEFAULT_MAX_TOKENS,
|
DEFAULT_MAX_TOKENS,
|
||||||
DEFAULT_OPENAI_ENDPOINT,
|
DEFAULT_OPENAI_ENDPOINT,
|
||||||
DEFAULT_ANTHROPIC_ENDPOINT,
|
DEFAULT_ANTHROPIC_ENDPOINT,
|
||||||
|
DEFAULT_DEEPSEEK_ENDPOINT,
|
||||||
|
DEFAULT_GEMINI_ENDPOINT,
|
||||||
DEFAULT_REQUEST_INTERVAL,
|
DEFAULT_REQUEST_INTERVAL,
|
||||||
DEFAULT_CONTEXT_MESSAGES,
|
DEFAULT_CONTEXT_MESSAGES,
|
||||||
API_TIMEOUT,
|
API_TIMEOUT,
|
||||||
@@ -52,11 +59,13 @@ from .const import (
|
|||||||
SERVICE_SET_SYSTEM_PROMPT,
|
SERVICE_SET_SYSTEM_PROMPT,
|
||||||
DEFAULT_MAX_HISTORY,
|
DEFAULT_MAX_HISTORY,
|
||||||
CONF_MAX_HISTORY_SIZE,
|
CONF_MAX_HISTORY_SIZE,
|
||||||
|
ICONS_SUBDOMAIN,
|
||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
|
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
|
||||||
|
ConfigType = TypeVar("ConfigType", bound=Dict[str, Any])
|
||||||
|
|
||||||
SERVICE_SCHEMA_ASK_QUESTION = vol.Schema({
|
SERVICE_SCHEMA_ASK_QUESTION = vol.Schema({
|
||||||
vol.Required("instance"): cv.string,
|
vol.Required("instance"): cv.string,
|
||||||
@@ -90,19 +99,18 @@ def get_coordinator_by_instance(hass: HomeAssistant, instance: str) -> HATextAIC
|
|||||||
|
|
||||||
raise HomeAssistantError(f"Instance {instance} not found")
|
raise HomeAssistantError(f"Instance {instance} not found")
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: Dict[str, Any]) -> bool:
|
def get_file_hash(file_path: str) -> str:
|
||||||
"""Set up the HA Text AI component."""
|
"""Calculate SHA256 hash of file."""
|
||||||
hass.data.setdefault(DOMAIN, {})
|
sha256_hash = hashlib.sha256()
|
||||||
|
with open(file_path, "rb") as f:
|
||||||
|
for byte_block in iter(lambda: f.read(4096), b""):
|
||||||
|
sha256_hash.update(byte_block)
|
||||||
|
return sha256_hash.hexdigest()
|
||||||
|
|
||||||
try:
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
source = os.path.join(os.path.dirname(__file__), 'icons', 'icon.svg')
|
"""Set up the Home Assistant Text AI component."""
|
||||||
dest_dir = os.path.join(hass.config.path('www'), 'icons')
|
# Initialize domain data storage
|
||||||
os.makedirs(dest_dir, exist_ok=True)
|
hass.data.setdefault(DOMAIN, {})
|
||||||
dest = os.path.join(dest_dir, 'icon.png')
|
|
||||||
if not os.path.exists(dest):
|
|
||||||
shutil.copyfile(source, dest)
|
|
||||||
except Exception as ex:
|
|
||||||
_LOGGER.warning("Failed to copy custom icon: %s", str(ex))
|
|
||||||
|
|
||||||
async def async_ask_question(call: ServiceCall) -> None:
|
async def async_ask_question(call: ServiceCall) -> None:
|
||||||
"""Handle ask_question service."""
|
"""Handle ask_question service."""
|
||||||
@@ -150,6 +158,7 @@ async def async_setup(hass: HomeAssistant, config: Dict[str, Any]) -> bool:
|
|||||||
_LOGGER.error("Error setting system prompt: %s", str(err))
|
_LOGGER.error("Error setting system prompt: %s", str(err))
|
||||||
raise HomeAssistantError(f"Failed to set system prompt: {str(err)}")
|
raise HomeAssistantError(f"Failed to set system prompt: {str(err)}")
|
||||||
|
|
||||||
|
# Register services
|
||||||
hass.services.async_register(
|
hass.services.async_register(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_ASK_QUESTION,
|
SERVICE_ASK_QUESTION,
|
||||||
@@ -178,13 +187,69 @@ async def async_setup(hass: HomeAssistant, config: Dict[str, Any]) -> bool:
|
|||||||
schema=SERVICE_SCHEMA_SET_SYSTEM_PROMPT
|
schema=SERVICE_SCHEMA_SET_SYSTEM_PROMPT
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Handle icons
|
||||||
|
try:
|
||||||
|
source_icon_path = os.path.join(
|
||||||
|
os.path.dirname(__file__),
|
||||||
|
ICONS_SUBDOMAIN,
|
||||||
|
'icon@2x.png'
|
||||||
|
)
|
||||||
|
|
||||||
|
destination_directory = os.path.join(
|
||||||
|
hass.config.path('www'),
|
||||||
|
DOMAIN,
|
||||||
|
ICONS_SUBDOMAIN
|
||||||
|
)
|
||||||
|
|
||||||
|
destination_icon_path = os.path.join(
|
||||||
|
destination_directory,
|
||||||
|
'icon.png'
|
||||||
|
)
|
||||||
|
|
||||||
|
if not os.path.exists(source_icon_path):
|
||||||
|
_LOGGER.error("Source icon not found: %s", source_icon_path)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def create_directory():
|
||||||
|
os.makedirs(destination_directory, exist_ok=True)
|
||||||
|
|
||||||
|
await hass.async_add_executor_job(create_directory)
|
||||||
|
|
||||||
|
should_copy = True
|
||||||
|
|
||||||
|
if os.path.exists(destination_icon_path):
|
||||||
|
source_hash = await hass.async_add_executor_job(get_file_hash, source_icon_path)
|
||||||
|
dest_hash = await hass.async_add_executor_job(get_file_hash, destination_icon_path)
|
||||||
|
should_copy = source_hash != dest_hash
|
||||||
|
|
||||||
|
if should_copy:
|
||||||
|
def copy_file():
|
||||||
|
shutil.copyfile(source_icon_path, destination_icon_path)
|
||||||
|
|
||||||
|
await hass.async_add_executor_job(copy_file)
|
||||||
|
_LOGGER.debug("Icon updated: %s", destination_icon_path)
|
||||||
|
|
||||||
|
except PermissionError as e:
|
||||||
|
_LOGGER.error("Permission denied when managing icons: %s", str(e))
|
||||||
|
except Exception as e:
|
||||||
|
_LOGGER.error("Failed to manage icons: %s", str(e))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
async def async_check_api(session, endpoint: str, headers: dict, provider: str) -> bool:
|
async def async_check_api(session, endpoint: str, headers: dict, provider: str) -> bool:
|
||||||
"""Check API availability for different providers."""
|
"""Check API availability for different providers."""
|
||||||
try:
|
try:
|
||||||
if provider == API_PROVIDER_ANTHROPIC:
|
if provider == API_PROVIDER_GEMINI:
|
||||||
|
# Gemini API does not support GET /models for validation, just check key presence
|
||||||
|
if headers.get("Authorization", "").replace("Bearer ", ""):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
_LOGGER.error("Gemini API key is missing or empty")
|
||||||
|
return False
|
||||||
|
elif provider == API_PROVIDER_ANTHROPIC:
|
||||||
check_url = f"{endpoint}/v1/models"
|
check_url = f"{endpoint}/v1/models"
|
||||||
|
elif provider == API_PROVIDER_DEEPSEEK:
|
||||||
|
check_url = f"{endpoint}/models"
|
||||||
else: # OpenAI
|
else: # OpenAI
|
||||||
check_url = f"{endpoint}/models"
|
check_url = f"{endpoint}/models"
|
||||||
|
|
||||||
@@ -193,7 +258,8 @@ async def async_check_api(session, endpoint: str, headers: dict, provider: str)
|
|||||||
if response.status in [200, 404]:
|
if response.status in [200, 404]:
|
||||||
return True
|
return True
|
||||||
elif response.status == 401:
|
elif response.status == 401:
|
||||||
raise ConfigEntryNotReady("Invalid API key")
|
_LOGGER.error("Invalid API key")
|
||||||
|
return False
|
||||||
elif response.status == 429:
|
elif response.status == 429:
|
||||||
_LOGGER.warning("Rate limit exceeded during API check")
|
_LOGGER.warning("Rate limit exceeded during API check")
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import asyncio
|
|||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
from aiohttp import ClientSession, ClientTimeout
|
from aiohttp import ClientSession, ClientTimeout
|
||||||
from async_timeout import timeout
|
from async_timeout import timeout
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
@@ -18,6 +19,9 @@ from .const import (
|
|||||||
API_TIMEOUT,
|
API_TIMEOUT,
|
||||||
API_RETRY_COUNT,
|
API_RETRY_COUNT,
|
||||||
API_PROVIDER_ANTHROPIC,
|
API_PROVIDER_ANTHROPIC,
|
||||||
|
API_PROVIDER_DEEPSEEK,
|
||||||
|
API_PROVIDER_OPENAI,
|
||||||
|
API_PROVIDER_GEMINI,
|
||||||
MIN_TEMPERATURE,
|
MIN_TEMPERATURE,
|
||||||
MAX_TEMPERATURE,
|
MAX_TEMPERATURE,
|
||||||
MIN_MAX_TOKENS,
|
MIN_MAX_TOKENS,
|
||||||
@@ -109,19 +113,53 @@ class APIClient:
|
|||||||
return await self._create_anthropic_completion(
|
return await self._create_anthropic_completion(
|
||||||
model, messages, temperature, max_tokens
|
model, messages, temperature, max_tokens
|
||||||
)
|
)
|
||||||
|
elif self.api_provider == API_PROVIDER_DEEPSEEK:
|
||||||
|
return await self._create_deepseek_completion(
|
||||||
|
model, messages, temperature, max_tokens
|
||||||
|
)
|
||||||
|
elif self.api_provider == API_PROVIDER_GEMINI:
|
||||||
|
return await self._create_gemini_completion(
|
||||||
|
model, messages, temperature, max_tokens
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
return await self._create_openai_completion(
|
return await self._create_openai_completion(
|
||||||
model, messages, temperature, max_tokens
|
model, messages, temperature, max_tokens
|
||||||
)
|
)
|
||||||
except (KeyError, IndexError) as e:
|
|
||||||
if "'choices'" in str(e) or "'message'" in str(e):
|
|
||||||
raise HomeAssistantError("Failed to get a response from the AI model. Please check your internet connection and try again later.")
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_LOGGER.error("API request failed: %s", str(e))
|
_LOGGER.error("API request failed: %s", str(e))
|
||||||
raise HomeAssistantError(f"API request failed: {str(e)}")
|
raise HomeAssistantError(f"API request failed: {str(e)}")
|
||||||
|
|
||||||
|
async def _create_deepseek_completion(
|
||||||
|
self,
|
||||||
|
model: str,
|
||||||
|
messages: List[Dict[str, str]],
|
||||||
|
temperature: float,
|
||||||
|
max_tokens: int,
|
||||||
|
) -> Dict[str, Any]:
|
||||||
|
"""Create completion using DeepSeek API."""
|
||||||
|
url = f"{self.endpoint}/chat/completions"
|
||||||
|
payload = {
|
||||||
|
"model": model,
|
||||||
|
"messages": messages,
|
||||||
|
"temperature": temperature,
|
||||||
|
"max_tokens": max_tokens,
|
||||||
|
"stream": False
|
||||||
|
}
|
||||||
|
|
||||||
|
data = await self._make_request(url, payload)
|
||||||
|
return {
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"message": {"content": data["choices"][0]["message"]["content"]},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"usage": {
|
||||||
|
"prompt_tokens": data["usage"]["prompt_tokens"],
|
||||||
|
"completion_tokens": data["usage"]["completion_tokens"],
|
||||||
|
"total_tokens": data["usage"]["total_tokens"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
async def _create_openai_completion(
|
async def _create_openai_completion(
|
||||||
self,
|
self,
|
||||||
model: str,
|
model: str,
|
||||||
@@ -206,6 +244,143 @@ class APIClient:
|
|||||||
_LOGGER.error(f"Connection check failed: {str(e)}")
|
_LOGGER.error(f"Connection check failed: {str(e)}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
async def _create_gemini_completion(
|
||||||
|
self,
|
||||||
|
model: str,
|
||||||
|
messages: List[Dict[str, str]],
|
||||||
|
temperature: float,
|
||||||
|
max_tokens: int,
|
||||||
|
) -> Dict[str, Any]:
|
||||||
|
"""Create completion using Gemini API with google-genai library.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
model: The model name to use
|
||||||
|
messages: List of message dictionaries with role and content
|
||||||
|
temperature: Sampling temperature between 0.0 and 2.0
|
||||||
|
max_tokens: Maximum number of tokens to generate
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Dictionary with response content and token usage
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
def import_genai():
|
||||||
|
from google import genai
|
||||||
|
return genai
|
||||||
|
|
||||||
|
genai = await asyncio.to_thread(import_genai)
|
||||||
|
|
||||||
|
# Extract API key from headers (Bearer token)
|
||||||
|
api_key = self.headers.get("Authorization", "").replace("Bearer ", "")
|
||||||
|
|
||||||
|
def create_client():
|
||||||
|
if self.endpoint and self.endpoint != "https://generativelanguage.googleapis.com/v1beta":
|
||||||
|
return genai.Client(api_key=api_key, transport="rest",
|
||||||
|
client_options={"api_endpoint": self.endpoint})
|
||||||
|
else:
|
||||||
|
return genai.Client(api_key=api_key)
|
||||||
|
|
||||||
|
client = await asyncio.to_thread(create_client)
|
||||||
|
|
||||||
|
# Process messages to extract system instruction and chat history
|
||||||
|
system_instruction = ""
|
||||||
|
contents = []
|
||||||
|
|
||||||
|
for msg in messages:
|
||||||
|
if msg['role'] == 'system':
|
||||||
|
system_instruction += msg['content'] + "\n"
|
||||||
|
else:
|
||||||
|
# For chat history, we need to convert to the format Gemini expects
|
||||||
|
role = "user" if msg['role'] == 'user' else "model"
|
||||||
|
contents.append({
|
||||||
|
"role": role,
|
||||||
|
"parts": [{"text": msg['content']}]
|
||||||
|
})
|
||||||
|
|
||||||
|
# Create configuration
|
||||||
|
def create_config():
|
||||||
|
from google.genai import types
|
||||||
|
config = types.GenerateContentConfig(
|
||||||
|
temperature=temperature,
|
||||||
|
max_output_tokens=max_tokens,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add system instruction if present
|
||||||
|
if system_instruction:
|
||||||
|
config.system_instruction = system_instruction.strip()
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
||||||
|
config = await asyncio.to_thread(create_config)
|
||||||
|
|
||||||
|
def generate_content():
|
||||||
|
# For single message without history, use generate_content
|
||||||
|
if len(contents) <= 1:
|
||||||
|
# If we have no content yet, create a simple prompt
|
||||||
|
if not contents:
|
||||||
|
prompt = "I need your assistance."
|
||||||
|
else:
|
||||||
|
prompt = contents[0]["parts"][0]["text"]
|
||||||
|
|
||||||
|
return client.models.generate_content(
|
||||||
|
model=model,
|
||||||
|
contents=prompt,
|
||||||
|
config=config
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# For multi-turn conversations, use chat
|
||||||
|
chat = client.chats.create(model=model, config=config)
|
||||||
|
|
||||||
|
# Send all messages in sequence
|
||||||
|
for content in contents:
|
||||||
|
if content["role"] == "user":
|
||||||
|
response = chat.send_message(content["parts"][0]["text"])
|
||||||
|
# We don't send assistant messages as they're already part of the history
|
||||||
|
|
||||||
|
return response
|
||||||
|
|
||||||
|
response = await asyncio.to_thread(generate_content)
|
||||||
|
|
||||||
|
# Extract response text
|
||||||
|
def extract_response():
|
||||||
|
response_text = response.text if hasattr(response, 'text') else ""
|
||||||
|
|
||||||
|
# Try to get token usage if available
|
||||||
|
usage = {}
|
||||||
|
if hasattr(response, 'usage_metadata'):
|
||||||
|
usage = {
|
||||||
|
"prompt_tokens": getattr(response.usage_metadata, 'prompt_token_count', 0),
|
||||||
|
"completion_tokens": getattr(response.usage_metadata, 'candidates_token_count', 0),
|
||||||
|
"total_tokens": getattr(response.usage_metadata, 'total_token_count', 0)
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# Estimate token count as fallback
|
||||||
|
usage = {
|
||||||
|
"prompt_tokens": len(" ".join([m["content"] for m in messages]).split()) // 3,
|
||||||
|
"completion_tokens": len(response_text.split()) // 3,
|
||||||
|
"total_tokens": 0 # Will be calculated below
|
||||||
|
}
|
||||||
|
usage["total_tokens"] = usage["prompt_tokens"] + usage["completion_tokens"]
|
||||||
|
|
||||||
|
return response_text, usage
|
||||||
|
|
||||||
|
response_text, usage = await asyncio.to_thread(extract_response)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"choices": [{
|
||||||
|
"message": {
|
||||||
|
"content": response_text
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
"usage": usage
|
||||||
|
}
|
||||||
|
|
||||||
|
except ImportError as e:
|
||||||
|
_LOGGER.error(f"Google Gemini library not installed: {str(e)}")
|
||||||
|
raise HomeAssistantError(f"Missing dependency: {str(e)}. Please install google-genai.")
|
||||||
|
except Exception as e:
|
||||||
|
_LOGGER.error(f"Gemini API error: {str(e)}")
|
||||||
|
raise HomeAssistantError(f"Gemini API error: {str(e)}")
|
||||||
|
|
||||||
async def shutdown(self) -> None:
|
async def shutdown(self) -> None:
|
||||||
"""Shutdown API client."""
|
"""Shutdown API client."""
|
||||||
_LOGGER.debug("Shutting down API client")
|
_LOGGER.debug("Shutting down API client")
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ Config flow for HA text AI integration.
|
|||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
@@ -28,13 +29,19 @@ from .const import (
|
|||||||
CONF_CONTEXT_MESSAGES,
|
CONF_CONTEXT_MESSAGES,
|
||||||
API_PROVIDER_OPENAI,
|
API_PROVIDER_OPENAI,
|
||||||
API_PROVIDER_ANTHROPIC,
|
API_PROVIDER_ANTHROPIC,
|
||||||
|
API_PROVIDER_DEEPSEEK,
|
||||||
|
API_PROVIDER_GEMINI,
|
||||||
API_PROVIDERS,
|
API_PROVIDERS,
|
||||||
DEFAULT_MODEL,
|
DEFAULT_MODEL,
|
||||||
|
DEFAULT_DEEPSEEK_MODEL,
|
||||||
|
DEFAULT_GEMINI_MODEL,
|
||||||
DEFAULT_TEMPERATURE,
|
DEFAULT_TEMPERATURE,
|
||||||
DEFAULT_MAX_TOKENS,
|
DEFAULT_MAX_TOKENS,
|
||||||
DEFAULT_REQUEST_INTERVAL,
|
DEFAULT_REQUEST_INTERVAL,
|
||||||
DEFAULT_OPENAI_ENDPOINT,
|
DEFAULT_OPENAI_ENDPOINT,
|
||||||
DEFAULT_ANTHROPIC_ENDPOINT,
|
DEFAULT_ANTHROPIC_ENDPOINT,
|
||||||
|
DEFAULT_DEEPSEEK_ENDPOINT,
|
||||||
|
DEFAULT_GEMINI_ENDPOINT,
|
||||||
DEFAULT_CONTEXT_MESSAGES,
|
DEFAULT_CONTEXT_MESSAGES,
|
||||||
MIN_TEMPERATURE,
|
MIN_TEMPERATURE,
|
||||||
MAX_TEMPERATURE,
|
MAX_TEMPERATURE,
|
||||||
@@ -90,9 +97,19 @@ class HATextAIConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
self._errors = {}
|
self._errors = {}
|
||||||
|
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
default_endpoint = (
|
# Selecting an endpoint by provider
|
||||||
DEFAULT_OPENAI_ENDPOINT if self._provider == API_PROVIDER_OPENAI
|
default_endpoint = {
|
||||||
else DEFAULT_ANTHROPIC_ENDPOINT
|
API_PROVIDER_OPENAI: DEFAULT_OPENAI_ENDPOINT,
|
||||||
|
API_PROVIDER_ANTHROPIC: DEFAULT_ANTHROPIC_ENDPOINT,
|
||||||
|
API_PROVIDER_DEEPSEEK: DEFAULT_DEEPSEEK_ENDPOINT,
|
||||||
|
API_PROVIDER_GEMINI: DEFAULT_GEMINI_ENDPOINT,
|
||||||
|
}.get(self._provider, DEFAULT_OPENAI_ENDPOINT)
|
||||||
|
|
||||||
|
# Selecting the default model by provider
|
||||||
|
default_model = (
|
||||||
|
DEFAULT_DEEPSEEK_MODEL if self._provider == API_PROVIDER_DEEPSEEK else
|
||||||
|
DEFAULT_GEMINI_MODEL if self._provider == API_PROVIDER_GEMINI else
|
||||||
|
DEFAULT_MODEL
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
@@ -100,7 +117,7 @@ class HATextAIConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
data_schema=vol.Schema({
|
data_schema=vol.Schema({
|
||||||
vol.Required(CONF_NAME, default="my_assistant"): str,
|
vol.Required(CONF_NAME, default="my_assistant"): str,
|
||||||
vol.Required(CONF_API_KEY): str,
|
vol.Required(CONF_API_KEY): str,
|
||||||
vol.Required(CONF_MODEL, default=DEFAULT_MODEL): str,
|
vol.Required(CONF_MODEL, default=default_model): str,
|
||||||
vol.Required(CONF_API_ENDPOINT, default=default_endpoint): str,
|
vol.Required(CONF_API_ENDPOINT, default=default_endpoint): str,
|
||||||
vol.Optional(CONF_TEMPERATURE, default=DEFAULT_TEMPERATURE): vol.All(
|
vol.Optional(CONF_TEMPERATURE, default=DEFAULT_TEMPERATURE): vol.All(
|
||||||
vol.Coerce(float),
|
vol.Coerce(float),
|
||||||
@@ -131,43 +148,173 @@ class HATextAIConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Debug log to identify what's in the input
|
||||||
|
_LOGGER.debug(f"Provider step input data: {user_input}")
|
||||||
|
|
||||||
input_copy = user_input.copy()
|
input_copy = user_input.copy()
|
||||||
|
|
||||||
|
# Check if CONF_NAME exists in input_copy and ensure it's not empty
|
||||||
|
if CONF_NAME not in input_copy or not input_copy[CONF_NAME]:
|
||||||
|
_LOGGER.warning(f"Missing name in configuration input: {input_copy}")
|
||||||
|
input_copy[CONF_NAME] = f"gemini_assistant_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
|
||||||
|
_LOGGER.info(f"Auto-generated name: {input_copy[CONF_NAME]}")
|
||||||
|
|
||||||
|
# Ensure API key is present
|
||||||
|
if CONF_API_KEY not in input_copy or not input_copy[CONF_API_KEY]:
|
||||||
|
self._errors["base"] = "invalid_auth"
|
||||||
|
_LOGGER.error("API validation error: 'api_key'")
|
||||||
|
return self.async_show_form(
|
||||||
|
step_id="provider",
|
||||||
|
data_schema=vol.Schema({
|
||||||
|
vol.Required(CONF_NAME, default=input_copy.get(CONF_NAME, "my_assistant")): str,
|
||||||
|
vol.Required(CONF_API_KEY): str,
|
||||||
|
vol.Required(CONF_MODEL, default=input_copy.get(CONF_MODEL, DEFAULT_GEMINI_MODEL if self._provider == API_PROVIDER_GEMINI else DEFAULT_MODEL)): str,
|
||||||
|
vol.Required(CONF_API_ENDPOINT, default=input_copy.get(CONF_API_ENDPOINT, DEFAULT_GEMINI_ENDPOINT if self._provider == API_PROVIDER_GEMINI else DEFAULT_OPENAI_ENDPOINT)): str,
|
||||||
|
vol.Optional(CONF_TEMPERATURE, default=input_copy.get(CONF_TEMPERATURE, DEFAULT_TEMPERATURE)): vol.All(
|
||||||
|
vol.Coerce(float),
|
||||||
|
vol.Range(min=MIN_TEMPERATURE, max=MAX_TEMPERATURE)
|
||||||
|
),
|
||||||
|
vol.Optional(CONF_MAX_TOKENS, default=input_copy.get(CONF_MAX_TOKENS, DEFAULT_MAX_TOKENS)): vol.All(
|
||||||
|
vol.Coerce(int),
|
||||||
|
vol.Range(min=MIN_MAX_TOKENS, max=MAX_MAX_TOKENS)
|
||||||
|
),
|
||||||
|
vol.Optional(CONF_REQUEST_INTERVAL, default=input_copy.get(CONF_REQUEST_INTERVAL, DEFAULT_REQUEST_INTERVAL)): vol.All(
|
||||||
|
vol.Coerce(float),
|
||||||
|
vol.Range(min=MIN_REQUEST_INTERVAL)
|
||||||
|
),
|
||||||
|
vol.Optional(
|
||||||
|
CONF_CONTEXT_MESSAGES,
|
||||||
|
default=input_copy.get(CONF_CONTEXT_MESSAGES, DEFAULT_CONTEXT_MESSAGES)
|
||||||
|
): vol.All(
|
||||||
|
vol.Coerce(int),
|
||||||
|
vol.Range(min=1, max=20)
|
||||||
|
),
|
||||||
|
vol.Optional(
|
||||||
|
CONF_MAX_HISTORY_SIZE,
|
||||||
|
default=input_copy.get(CONF_MAX_HISTORY_SIZE, DEFAULT_MAX_HISTORY)
|
||||||
|
): vol.All(
|
||||||
|
vol.Coerce(int),
|
||||||
|
vol.Range(min=1, max=100)
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
errors=self._errors
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# Validate and normalize the name
|
||||||
normalized_name = self._validate_and_normalize_name(input_copy[CONF_NAME])
|
normalized_name = self._validate_and_normalize_name(input_copy[CONF_NAME])
|
||||||
input_copy[CONF_NAME] = normalized_name
|
input_copy[CONF_NAME] = normalized_name
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="provider",
|
step_id="provider",
|
||||||
data_schema=vol.Schema({
|
data_schema=vol.Schema({
|
||||||
vol.Required(CONF_NAME, default=input_copy[CONF_NAME]): str,
|
vol.Required(CONF_NAME, default=input_copy.get(CONF_NAME, "my_assistant")): str,
|
||||||
vol.Required(CONF_API_KEY, default=input_copy[CONF_API_KEY]): str,
|
vol.Required(CONF_API_KEY, default=input_copy.get(CONF_API_KEY, "")): str,
|
||||||
vol.Required(CONF_MODEL, default=input_copy[CONF_MODEL]): str,
|
vol.Required(CONF_MODEL, default=input_copy.get(CONF_MODEL, DEFAULT_GEMINI_MODEL if self._provider == API_PROVIDER_GEMINI else DEFAULT_MODEL)): str,
|
||||||
vol.Required(CONF_API_ENDPOINT, default=input_copy[CONF_API_ENDPOINT]): str,
|
vol.Required(CONF_API_ENDPOINT, default=input_copy.get(CONF_API_ENDPOINT, DEFAULT_GEMINI_ENDPOINT if self._provider == API_PROVIDER_GEMINI else DEFAULT_OPENAI_ENDPOINT)): str,
|
||||||
vol.Optional(CONF_TEMPERATURE, default=input_copy.get(CONF_TEMPERATURE, DEFAULT_TEMPERATURE)): vol.All(
|
vol.Optional(CONF_TEMPERATURE, default=input_copy.get(CONF_TEMPERATURE, DEFAULT_TEMPERATURE)): vol.All(
|
||||||
vol.Coerce(float),
|
vol.Coerce(float),
|
||||||
vol.Range(min=MIN_TEMPERATURE, max=MAX_TEMPERATURE)
|
vol.Range(min=MIN_TEMPERATURE, max=MAX_TEMPERATURE)
|
||||||
),
|
),
|
||||||
|
vol.Optional(CONF_MAX_TOKENS, default=input_copy.get(CONF_MAX_TOKENS, DEFAULT_MAX_TOKENS)): vol.All(
|
||||||
|
vol.Coerce(int),
|
||||||
|
vol.Range(min=MIN_MAX_TOKENS, max=MAX_MAX_TOKENS)
|
||||||
|
),
|
||||||
|
vol.Optional(CONF_REQUEST_INTERVAL, default=input_copy.get(CONF_REQUEST_INTERVAL, DEFAULT_REQUEST_INTERVAL)): vol.All(
|
||||||
|
vol.Coerce(float),
|
||||||
|
vol.Range(min=MIN_REQUEST_INTERVAL)
|
||||||
|
),
|
||||||
|
vol.Optional(
|
||||||
|
CONF_CONTEXT_MESSAGES,
|
||||||
|
default=input_copy.get(CONF_CONTEXT_MESSAGES, DEFAULT_CONTEXT_MESSAGES)
|
||||||
|
): vol.All(
|
||||||
|
vol.Coerce(int),
|
||||||
|
vol.Range(min=1, max=20)
|
||||||
|
),
|
||||||
|
vol.Optional(
|
||||||
|
CONF_MAX_HISTORY_SIZE,
|
||||||
|
default=input_copy.get(CONF_MAX_HISTORY_SIZE, DEFAULT_MAX_HISTORY)
|
||||||
|
): vol.All(
|
||||||
|
vol.Coerce(int),
|
||||||
|
vol.Range(min=1, max=100)
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
errors={"name": str(e)}
|
errors={"name": str(e)}
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not await self._async_validate_api(input_copy):
|
# Special handling for Gemini API validation
|
||||||
return self.async_show_form(
|
if self._provider == API_PROVIDER_GEMINI:
|
||||||
step_id="provider",
|
# For Gemini, we just check if API key is present as there's no simple endpoint to validate
|
||||||
data_schema=vol.Schema({
|
if not input_copy.get(CONF_API_KEY):
|
||||||
}),
|
self._errors["base"] = "invalid_auth"
|
||||||
errors=self._errors
|
_LOGGER.error("API validation error: 'api_key'")
|
||||||
)
|
return self.async_show_form(
|
||||||
|
step_id="provider",
|
||||||
|
data_schema=vol.Schema({
|
||||||
|
vol.Required(CONF_NAME, default=input_copy.get(CONF_NAME, "my_assistant")): str,
|
||||||
|
vol.Required(CONF_API_KEY): str,
|
||||||
|
vol.Required(CONF_MODEL, default=input_copy.get(CONF_MODEL, DEFAULT_GEMINI_MODEL)): str,
|
||||||
|
vol.Required(CONF_API_ENDPOINT, default=input_copy.get(CONF_API_ENDPOINT, DEFAULT_GEMINI_ENDPOINT)): str,
|
||||||
|
# Other fields remain the same
|
||||||
|
}),
|
||||||
|
errors=self._errors
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# For other providers, validate API connection
|
||||||
|
if not await self._async_validate_api(input_copy):
|
||||||
|
return self.async_show_form(
|
||||||
|
step_id="provider",
|
||||||
|
data_schema=vol.Schema({
|
||||||
|
vol.Required(CONF_NAME, default=input_copy.get(CONF_NAME, "my_assistant")): str,
|
||||||
|
vol.Required(CONF_API_KEY, default=input_copy.get(CONF_API_KEY, "")): str,
|
||||||
|
vol.Required(CONF_MODEL, default=input_copy.get(CONF_MODEL, DEFAULT_MODEL)): str,
|
||||||
|
vol.Required(CONF_API_ENDPOINT, default=input_copy.get(CONF_API_ENDPOINT, DEFAULT_OPENAI_ENDPOINT)): str,
|
||||||
|
vol.Optional(CONF_TEMPERATURE, default=input_copy.get(CONF_TEMPERATURE, DEFAULT_TEMPERATURE)): vol.All(
|
||||||
|
vol.Coerce(float),
|
||||||
|
vol.Range(min=MIN_TEMPERATURE, max=MAX_TEMPERATURE)
|
||||||
|
),
|
||||||
|
vol.Optional(CONF_MAX_TOKENS, default=input_copy.get(CONF_MAX_TOKENS, DEFAULT_MAX_TOKENS)): vol.All(
|
||||||
|
vol.Coerce(int),
|
||||||
|
vol.Range(min=MIN_MAX_TOKENS, max=MAX_MAX_TOKENS)
|
||||||
|
),
|
||||||
|
vol.Optional(CONF_REQUEST_INTERVAL, default=input_copy.get(CONF_REQUEST_INTERVAL, DEFAULT_REQUEST_INTERVAL)): vol.All(
|
||||||
|
vol.Coerce(float),
|
||||||
|
vol.Range(min=MIN_REQUEST_INTERVAL)
|
||||||
|
),
|
||||||
|
vol.Optional(
|
||||||
|
CONF_CONTEXT_MESSAGES,
|
||||||
|
default=input_copy.get(CONF_CONTEXT_MESSAGES, DEFAULT_CONTEXT_MESSAGES)
|
||||||
|
): vol.All(
|
||||||
|
vol.Coerce(int),
|
||||||
|
vol.Range(min=1, max=20)
|
||||||
|
),
|
||||||
|
vol.Optional(
|
||||||
|
CONF_MAX_HISTORY_SIZE,
|
||||||
|
default=input_copy.get(CONF_MAX_HISTORY_SIZE, DEFAULT_MAX_HISTORY)
|
||||||
|
): vol.All(
|
||||||
|
vol.Coerce(int),
|
||||||
|
vol.Range(min=1, max=100)
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
errors=self._errors
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
# Handle any unexpected exceptions during validation
|
||||||
|
_LOGGER.exception("Unexpected error during API validation")
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="provider",
|
step_id="provider",
|
||||||
data_schema=vol.Schema({
|
data_schema=vol.Schema({
|
||||||
|
vol.Required(CONF_NAME, default=input_copy.get(CONF_NAME, "my_assistant")): str,
|
||||||
|
vol.Required(CONF_API_KEY, default=input_copy.get(CONF_API_KEY, "")): str,
|
||||||
|
vol.Required(CONF_MODEL, default=input_copy.get(CONF_MODEL, DEFAULT_GEMINI_MODEL if self._provider == API_PROVIDER_GEMINI else DEFAULT_MODEL)): str,
|
||||||
|
vol.Required(CONF_API_ENDPOINT, default=input_copy.get(CONF_API_ENDPOINT, DEFAULT_GEMINI_ENDPOINT if self._provider == API_PROVIDER_GEMINI else DEFAULT_OPENAI_ENDPOINT)): str,
|
||||||
|
# Other fields remain the same
|
||||||
}),
|
}),
|
||||||
errors={"base": str(e)}
|
errors={"base": str(e)}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# All validation passed, create the entry
|
||||||
return await self._create_entry(input_copy)
|
return await self._create_entry(input_copy)
|
||||||
|
|
||||||
def _validate_and_normalize_name(self, name: str) -> str:
|
def _validate_and_normalize_name(self, name: str) -> str:
|
||||||
@@ -205,23 +352,34 @@ class HATextAIConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
async def _async_validate_api(self, user_input: Dict[str, Any]) -> bool:
|
async def _async_validate_api(self, user_input: Dict[str, Any]) -> bool:
|
||||||
"""Validate API connection."""
|
"""Validate API connection."""
|
||||||
try:
|
try:
|
||||||
|
if CONF_API_KEY not in user_input:
|
||||||
|
_LOGGER.error("API validation error: 'api_key'")
|
||||||
|
self._errors["base"] = "invalid_auth"
|
||||||
|
return False
|
||||||
|
|
||||||
session = async_get_clientsession(self.hass)
|
session = async_get_clientsession(self.hass)
|
||||||
headers = self._get_api_headers(user_input)
|
headers = self._get_api_headers(user_input)
|
||||||
endpoint = user_input[CONF_API_ENDPOINT].rstrip('/')
|
endpoint = user_input[CONF_API_ENDPOINT].rstrip('/')
|
||||||
|
|
||||||
check_url = (
|
if self._provider == API_PROVIDER_GEMINI:
|
||||||
f"{endpoint}/v1/models" if self._provider == API_PROVIDER_ANTHROPIC
|
if not user_input[CONF_API_KEY]:
|
||||||
else f"{endpoint}/models"
|
|
||||||
)
|
|
||||||
|
|
||||||
async with session.get(check_url, headers=headers) as response:
|
|
||||||
if response.status == 401:
|
|
||||||
self._errors["base"] = "invalid_auth"
|
self._errors["base"] = "invalid_auth"
|
||||||
return False
|
return False
|
||||||
elif response.status not in [200, 404]:
|
|
||||||
self._errors["base"] = "cannot_connect"
|
|
||||||
return False
|
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
|
check_url = (
|
||||||
|
f"{endpoint}/v1/models" if self._provider == API_PROVIDER_ANTHROPIC
|
||||||
|
else f"{endpoint}/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
async with session.get(check_url, headers=headers) as response:
|
||||||
|
if response.status == 401:
|
||||||
|
self._errors["base"] = "invalid_auth"
|
||||||
|
return False
|
||||||
|
elif response.status not in [200, 404]:
|
||||||
|
self._errors["base"] = "cannot_connect"
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
_LOGGER.error("API validation error: %s", str(err))
|
_LOGGER.error("API validation error: %s", str(err))
|
||||||
@@ -230,6 +388,9 @@ class HATextAIConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
def _get_api_headers(self, user_input: Dict[str, Any]) -> Dict[str, str]:
|
def _get_api_headers(self, user_input: Dict[str, Any]) -> Dict[str, str]:
|
||||||
"""Get API headers based on provider."""
|
"""Get API headers based on provider."""
|
||||||
|
if CONF_API_KEY not in user_input:
|
||||||
|
return {"Content-Type": "application/json"}
|
||||||
|
|
||||||
api_key = user_input[CONF_API_KEY]
|
api_key = user_input[CONF_API_KEY]
|
||||||
|
|
||||||
if self._provider == API_PROVIDER_ANTHROPIC:
|
if self._provider == API_PROVIDER_ANTHROPIC:
|
||||||
@@ -238,6 +399,11 @@ class HATextAIConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
"anthropic-version": "2023-06-01",
|
"anthropic-version": "2023-06-01",
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
|
elif self._provider == API_PROVIDER_GEMINI:
|
||||||
|
return {
|
||||||
|
"Authorization": f"Bearer {api_key}",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
"Authorization": f"Bearer {api_key}",
|
"Authorization": f"Bearer {api_key}",
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
@@ -250,6 +416,12 @@ class HATextAIConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
unique_id = f"{DOMAIN}_{normalized_name}_{self._provider}".lower()
|
unique_id = f"{DOMAIN}_{normalized_name}_{self._provider}".lower()
|
||||||
|
|
||||||
|
default_model = (
|
||||||
|
DEFAULT_DEEPSEEK_MODEL if self._provider == API_PROVIDER_DEEPSEEK else
|
||||||
|
DEFAULT_GEMINI_MODEL if self._provider == API_PROVIDER_GEMINI else
|
||||||
|
DEFAULT_MODEL
|
||||||
|
)
|
||||||
|
|
||||||
entry_data = {
|
entry_data = {
|
||||||
CONF_API_PROVIDER: self._provider,
|
CONF_API_PROVIDER: self._provider,
|
||||||
CONF_NAME: instance_name,
|
CONF_NAME: instance_name,
|
||||||
@@ -257,7 +429,7 @@ class HATextAIConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
CONF_API_KEY: user_input.get(CONF_API_KEY),
|
CONF_API_KEY: user_input.get(CONF_API_KEY),
|
||||||
CONF_API_ENDPOINT: user_input.get(CONF_API_ENDPOINT),
|
CONF_API_ENDPOINT: user_input.get(CONF_API_ENDPOINT),
|
||||||
"unique_id": unique_id,
|
"unique_id": unique_id,
|
||||||
CONF_MODEL: user_input.get(CONF_MODEL, DEFAULT_MODEL),
|
CONF_MODEL: user_input.get(CONF_MODEL, default_model),
|
||||||
CONF_TEMPERATURE: user_input.get(CONF_TEMPERATURE, DEFAULT_TEMPERATURE),
|
CONF_TEMPERATURE: user_input.get(CONF_TEMPERATURE, DEFAULT_TEMPERATURE),
|
||||||
CONF_MAX_TOKENS: user_input.get(CONF_MAX_TOKENS, DEFAULT_MAX_TOKENS),
|
CONF_MAX_TOKENS: user_input.get(CONF_MAX_TOKENS, DEFAULT_MAX_TOKENS),
|
||||||
CONF_REQUEST_INTERVAL: user_input.get(CONF_REQUEST_INTERVAL, DEFAULT_REQUEST_INTERVAL),
|
CONF_REQUEST_INTERVAL: user_input.get(CONF_REQUEST_INTERVAL, DEFAULT_REQUEST_INTERVAL),
|
||||||
@@ -296,13 +468,20 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
return self.async_create_entry(title="", data=user_input)
|
return self.async_create_entry(title="", data=user_input)
|
||||||
|
|
||||||
current_data = {**self.config_entry.data, **self.config_entry.options}
|
current_data = {**self.config_entry.data, **self.config_entry.options}
|
||||||
|
provider = current_data.get(CONF_API_PROVIDER)
|
||||||
|
|
||||||
|
default_model = (
|
||||||
|
DEFAULT_DEEPSEEK_MODEL if provider == API_PROVIDER_DEEPSEEK else
|
||||||
|
DEFAULT_GEMINI_MODEL if provider == API_PROVIDER_GEMINI else
|
||||||
|
DEFAULT_MODEL
|
||||||
|
)
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="init",
|
step_id="init",
|
||||||
data_schema=vol.Schema({
|
data_schema=vol.Schema({
|
||||||
vol.Optional(
|
vol.Optional(
|
||||||
CONF_MODEL,
|
CONF_MODEL,
|
||||||
default=current_data.get(CONF_MODEL, DEFAULT_MODEL)
|
default=current_data.get(CONF_MODEL, default_model)
|
||||||
): str,
|
): str,
|
||||||
vol.Optional(
|
vol.Optional(
|
||||||
CONF_TEMPERATURE,
|
CONF_TEMPERATURE,
|
||||||
|
|||||||
@@ -6,10 +6,14 @@ Constants for the HA text AI integration.
|
|||||||
@github: https://github.com/smkrv/ha-text-ai
|
@github: https://github.com/smkrv/ha-text-ai
|
||||||
@source: https://github.com/smkrv/ha-text-ai
|
@source: https://github.com/smkrv/ha-text-ai
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
|
import json
|
||||||
from typing import Final
|
from typing import Final
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from homeassistant.const import Platform, CONF_API_KEY, CONF_NAME
|
from homeassistant.const import Platform, CONF_API_KEY, CONF_NAME
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
|
import logging
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Domain and platforms
|
# Domain and platforms
|
||||||
DOMAIN: Final = "ha_text_ai"
|
DOMAIN: Final = "ha_text_ai"
|
||||||
@@ -19,15 +23,37 @@ PLATFORMS: list[str] = ["sensor"]
|
|||||||
CONF_API_PROVIDER: Final = "api_provider"
|
CONF_API_PROVIDER: Final = "api_provider"
|
||||||
API_PROVIDER_OPENAI: Final = "openai"
|
API_PROVIDER_OPENAI: Final = "openai"
|
||||||
API_PROVIDER_ANTHROPIC: Final = "anthropic"
|
API_PROVIDER_ANTHROPIC: Final = "anthropic"
|
||||||
|
API_PROVIDER_DEEPSEEK: Final = "deepseek"
|
||||||
|
API_PROVIDER_GEMINI: Final = "gemini"
|
||||||
|
|
||||||
API_PROVIDERS: Final = [
|
API_PROVIDERS: Final = [
|
||||||
API_PROVIDER_OPENAI,
|
API_PROVIDER_OPENAI,
|
||||||
API_PROVIDER_ANTHROPIC
|
API_PROVIDER_ANTHROPIC,
|
||||||
|
API_PROVIDER_DEEPSEEK,
|
||||||
|
API_PROVIDER_GEMINI
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Read version from manifest.json
|
||||||
|
MANIFEST_PATH = os.path.join(os.path.dirname(__file__), "manifest.json")
|
||||||
|
try:
|
||||||
|
with open(MANIFEST_PATH) as manifest_file:
|
||||||
|
manifest = json.load(manifest_file)
|
||||||
|
VERSION = manifest.get("version", "unknown")
|
||||||
|
except FileNotFoundError:
|
||||||
|
VERSION = "unknown"
|
||||||
|
_LOGGER.warning("manifest.json not found at %s", MANIFEST_PATH)
|
||||||
|
except json.JSONDecodeError as err:
|
||||||
|
VERSION = "unknown"
|
||||||
|
_LOGGER.error("Error decoding JSON from manifest.json: %s", err)
|
||||||
|
except Exception as err:
|
||||||
|
VERSION = "unknown"
|
||||||
|
_LOGGER.error("Error reading manifest.json: %s", err)
|
||||||
|
|
||||||
# Default endpoints
|
# Default endpoints
|
||||||
DEFAULT_OPENAI_ENDPOINT: Final = "https://api.openai.com/v1"
|
DEFAULT_OPENAI_ENDPOINT: Final = "https://api.openai.com/v1"
|
||||||
DEFAULT_ANTHROPIC_ENDPOINT: Final = "https://api.anthropic.com"
|
DEFAULT_ANTHROPIC_ENDPOINT: Final = "https://api.anthropic.com"
|
||||||
|
DEFAULT_DEEPSEEK_ENDPOINT: Final = "https://api.deepseek.com"
|
||||||
|
DEFAULT_GEMINI_ENDPOINT: Final = "https://generativelanguage.googleapis.com/v1beta"
|
||||||
|
|
||||||
# Configuration constants
|
# Configuration constants
|
||||||
CONF_MODEL: Final = "model"
|
CONF_MODEL: Final = "model"
|
||||||
@@ -40,8 +66,15 @@ CONF_MAX_HISTORY_SIZE: Final = "max_history_size" # Correct constant name
|
|||||||
CONF_IS_ANTHROPIC: Final = "is_anthropic"
|
CONF_IS_ANTHROPIC: Final = "is_anthropic"
|
||||||
CONF_CONTEXT_MESSAGES: Final = "context_messages"
|
CONF_CONTEXT_MESSAGES: Final = "context_messages"
|
||||||
|
|
||||||
|
ABSOLUTE_MAX_HISTORY_SIZE = 500
|
||||||
|
MAX_ATTRIBUTE_SIZE = 4 * 1024
|
||||||
|
MAX_HISTORY_FILE_SIZE = 1 * 1024 * 1024
|
||||||
|
ICONS_SUBDOMAIN = "icons"
|
||||||
|
|
||||||
# Default values
|
# Default values
|
||||||
DEFAULT_MODEL: Final = "gpt-4o-mini"
|
DEFAULT_MODEL: Final = "gpt-4o-mini"
|
||||||
|
DEFAULT_DEEPSEEK_MODEL: Final = "deepseek-chat"
|
||||||
|
DEFAULT_GEMINI_MODEL: Final = "gemini-2.0-flash"
|
||||||
DEFAULT_TEMPERATURE: Final = 0.1
|
DEFAULT_TEMPERATURE: Final = 0.1
|
||||||
DEFAULT_MAX_TOKENS: Final = 1000
|
DEFAULT_MAX_TOKENS: Final = 1000
|
||||||
DEFAULT_REQUEST_INTERVAL: Final = 1.0
|
DEFAULT_REQUEST_INTERVAL: Final = 1.0
|
||||||
@@ -51,11 +84,13 @@ DEFAULT_NAME: Final = "HA Text AI"
|
|||||||
DEFAULT_NAME_PREFIX = "ha_text_ai"
|
DEFAULT_NAME_PREFIX = "ha_text_ai"
|
||||||
DEFAULT_CONTEXT_MESSAGES: Final = 5
|
DEFAULT_CONTEXT_MESSAGES: Final = 5
|
||||||
|
|
||||||
|
TRUNCATION_INDICATOR = " ... "
|
||||||
|
|
||||||
# Parameter constraints
|
# Parameter constraints
|
||||||
MIN_TEMPERATURE: Final = 0.0
|
MIN_TEMPERATURE: Final = 0.0
|
||||||
MAX_TEMPERATURE: Final = 2.0
|
MAX_TEMPERATURE: Final = 2.0
|
||||||
MIN_MAX_TOKENS: Final = 1
|
MIN_MAX_TOKENS: Final = 1
|
||||||
MAX_MAX_TOKENS: Final = 4096
|
MAX_MAX_TOKENS: Final = 100000
|
||||||
MIN_REQUEST_INTERVAL: Final = 0.1
|
MIN_REQUEST_INTERVAL: Final = 0.1
|
||||||
MAX_REQUEST_INTERVAL: Final = 60.0
|
MAX_REQUEST_INTERVAL: Final = 60.0
|
||||||
|
|
||||||
|
|||||||
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 351 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 257 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 325 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 259 KiB |
@@ -16,6 +16,7 @@
|
|||||||
"requirements": [
|
"requirements": [
|
||||||
"openai>=1.12.0",
|
"openai>=1.12.0",
|
||||||
"anthropic>=0.8.0",
|
"anthropic>=0.8.0",
|
||||||
|
"google-genai>=1.16.0",
|
||||||
"aiohttp>=3.8.0",
|
"aiohttp>=3.8.0",
|
||||||
"async-timeout>=4.0.0",
|
"async-timeout>=4.0.0",
|
||||||
"certifi>=2024.2.2"
|
"certifi>=2024.2.2"
|
||||||
@@ -23,6 +24,6 @@
|
|||||||
"single_config_entry": false,
|
"single_config_entry": false,
|
||||||
"ssdp": [],
|
"ssdp": [],
|
||||||
"usb": [],
|
"usb": [],
|
||||||
"version": "2.0.4-beta",
|
"version": "2.1.7",
|
||||||
"zeroconf": []
|
"zeroconf": []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ Sensor platform for HA Text AI.
|
|||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
@@ -67,6 +68,8 @@ from .const import (
|
|||||||
ENTITY_ICON_PROCESSING,
|
ENTITY_ICON_PROCESSING,
|
||||||
DEFAULT_NAME_PREFIX,
|
DEFAULT_NAME_PREFIX,
|
||||||
CONF_MAX_HISTORY_SIZE,
|
CONF_MAX_HISTORY_SIZE,
|
||||||
|
MAX_ATTRIBUTE_SIZE,
|
||||||
|
VERSION,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .coordinator import HATextAICoordinator
|
from .coordinator import HATextAICoordinator
|
||||||
@@ -153,7 +156,7 @@ class HATextAISensor(CoordinatorEntity, SensorEntity):
|
|||||||
name=self._attr_name,
|
name=self._attr_name,
|
||||||
manufacturer="Community",
|
manufacturer="Community",
|
||||||
model=f"{model} ({api_provider} provider)",
|
model=f"{model} ({api_provider} provider)",
|
||||||
sw_version="1.0.0",
|
sw_version=VERSION,
|
||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
@@ -178,12 +181,29 @@ class HATextAISensor(CoordinatorEntity, SensorEntity):
|
|||||||
|
|
||||||
def _sanitize_attributes(self, attributes: Dict[str, Any]) -> Dict[str, Any]:
|
def _sanitize_attributes(self, attributes: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
"""Sanitize all attributes for JSON serialization."""
|
"""Sanitize all attributes for JSON serialization."""
|
||||||
return {
|
sanitized = {
|
||||||
key: self._sanitize_value(value)
|
key: self._sanitize_value(value)
|
||||||
for key, value in attributes.items()
|
for key, value in attributes.items()
|
||||||
if value is not None
|
if value is not None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Log metrics for debugging
|
||||||
|
metrics_keys = [
|
||||||
|
METRIC_TOTAL_TOKENS,
|
||||||
|
METRIC_PROMPT_TOKENS,
|
||||||
|
METRIC_COMPLETION_TOKENS,
|
||||||
|
METRIC_SUCCESSFUL_REQUESTS,
|
||||||
|
METRIC_FAILED_REQUESTS,
|
||||||
|
METRIC_AVERAGE_LATENCY,
|
||||||
|
METRIC_MAX_LATENCY,
|
||||||
|
METRIC_MIN_LATENCY,
|
||||||
|
]
|
||||||
|
|
||||||
|
metrics_values = {k: sanitized.get(k) for k in metrics_keys if k in sanitized}
|
||||||
|
_LOGGER.debug(f"Metrics for {self.entity_id}: {metrics_values}")
|
||||||
|
|
||||||
|
return sanitized
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> StateType:
|
def native_value(self) -> StateType:
|
||||||
"""Return the native value of the sensor."""
|
"""Return the native value of the sensor."""
|
||||||
@@ -212,68 +232,65 @@ class HATextAISensor(CoordinatorEntity, SensorEntity):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
data = self.coordinator.data
|
data = self.coordinator.data
|
||||||
|
metrics = data.get("metrics", {})
|
||||||
|
|
||||||
|
# Base attributes
|
||||||
attributes = {
|
attributes = {
|
||||||
ATTR_MODEL: self._config_entry.data.get(CONF_MODEL, "Unknown"),
|
ATTR_MODEL: self._config_entry.data.get(CONF_MODEL, "Unknown"),
|
||||||
ATTR_API_PROVIDER: self._config_entry.data.get(
|
ATTR_API_PROVIDER: self._config_entry.data.get(CONF_API_PROVIDER, "Unknown"),
|
||||||
CONF_API_PROVIDER, "Unknown"
|
|
||||||
),
|
|
||||||
ATTR_API_STATUS: self._current_state,
|
ATTR_API_STATUS: self._current_state,
|
||||||
ATTR_TOTAL_ERRORS: self._error_count,
|
ATTR_TOTAL_ERRORS: metrics.get("total_errors", 0),
|
||||||
ATTR_LAST_ERROR: self._last_error,
|
|
||||||
"instance_name": self._instance_name,
|
"instance_name": self._instance_name,
|
||||||
"normalized_name": self._normalized_name,
|
"normalized_name": self._normalized_name,
|
||||||
ATTR_SYSTEM_PROMPT: data.get("system_prompt"),
|
ATTR_SYSTEM_PROMPT: (data.get("system_prompt", "")[:MAX_ATTRIBUTE_SIZE]
|
||||||
|
if data.get("system_prompt") else None),
|
||||||
ATTR_IS_PROCESSING: data.get("is_processing", False),
|
ATTR_IS_PROCESSING: data.get("is_processing", False),
|
||||||
ATTR_IS_RATE_LIMITED: data.get("is_rate_limited", False),
|
ATTR_IS_RATE_LIMITED: data.get("is_rate_limited", False),
|
||||||
ATTR_IS_MAINTENANCE: data.get("is_maintenance", False),
|
ATTR_IS_MAINTENANCE: data.get("is_maintenance", False),
|
||||||
ATTR_ENDPOINT_STATUS: data.get("endpoint_status", "unknown"),
|
ATTR_ENDPOINT_STATUS: data.get("endpoint_status", "unknown"),
|
||||||
ATTR_UPTIME: data.get("uptime", 0),
|
ATTR_UPTIME: round(data.get("uptime", 0), 2),
|
||||||
ATTR_HISTORY_SIZE: data.get("history_size", 0),
|
ATTR_HISTORY_SIZE: data.get("history_size", 0),
|
||||||
ATTR_CONVERSATION_HISTORY: data.get("conversation_history", []),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add metrics
|
# History limit
|
||||||
metrics = data.get("metrics", {})
|
conversation_history = data.get("conversation_history", [])
|
||||||
if isinstance(metrics, dict):
|
if conversation_history:
|
||||||
self._metrics = metrics
|
limited_history = []
|
||||||
attributes.update(
|
for entry in conversation_history:
|
||||||
{
|
limited_entry = {
|
||||||
METRIC_TOTAL_TOKENS: metrics.get("total_tokens", 0),
|
"timestamp": entry["timestamp"],
|
||||||
METRIC_PROMPT_TOKENS: metrics.get("prompt_tokens", 0),
|
"question": entry["question"][:MAX_ATTRIBUTE_SIZE],
|
||||||
METRIC_COMPLETION_TOKENS: metrics.get("completion_tokens", 0),
|
"response": entry["response"][:MAX_ATTRIBUTE_SIZE]
|
||||||
METRIC_SUCCESSFUL_REQUESTS: metrics.get(
|
|
||||||
"successful_requests", 0
|
|
||||||
),
|
|
||||||
METRIC_FAILED_REQUESTS: metrics.get("failed_requests", 0),
|
|
||||||
METRIC_AVERAGE_LATENCY: metrics.get("average_latency", 0),
|
|
||||||
METRIC_MAX_LATENCY: metrics.get("max_latency", 0),
|
|
||||||
METRIC_MIN_LATENCY: metrics.get("min_latency", float("inf")),
|
|
||||||
}
|
}
|
||||||
)
|
limited_history.append(limited_entry)
|
||||||
|
attributes[ATTR_CONVERSATION_HISTORY] = limited_history
|
||||||
|
|
||||||
# Add last response
|
# Metrics
|
||||||
|
if isinstance(metrics, dict):
|
||||||
|
attributes.update({
|
||||||
|
METRIC_TOTAL_TOKENS: metrics.get("total_tokens", 0),
|
||||||
|
METRIC_PROMPT_TOKENS: metrics.get("prompt_tokens", 0),
|
||||||
|
METRIC_COMPLETION_TOKENS: metrics.get("completion_tokens", 0),
|
||||||
|
METRIC_SUCCESSFUL_REQUESTS: metrics.get("successful_requests", 0),
|
||||||
|
METRIC_FAILED_REQUESTS: metrics.get("failed_requests", 0),
|
||||||
|
METRIC_AVERAGE_LATENCY: round(metrics.get("average_latency", 0), 2),
|
||||||
|
METRIC_MAX_LATENCY: round(metrics.get("max_latency", 0), 2),
|
||||||
|
METRIC_MIN_LATENCY: (metrics.get("min_latency")
|
||||||
|
if metrics.get("min_latency") != float("inf")
|
||||||
|
else None),
|
||||||
|
})
|
||||||
|
|
||||||
|
# Last response handling
|
||||||
last_response = data.get("last_response", {})
|
last_response = data.get("last_response", {})
|
||||||
if isinstance(last_response, dict):
|
if isinstance(last_response, dict):
|
||||||
self._last_response = last_response
|
attributes.update({
|
||||||
attributes.update(
|
ATTR_RESPONSE: last_response.get("response", "")[:MAX_ATTRIBUTE_SIZE],
|
||||||
{
|
ATTR_QUESTION: last_response.get("question", "")[:MAX_ATTRIBUTE_SIZE],
|
||||||
ATTR_RESPONSE: last_response.get("response", ""),
|
"last_model": last_response.get("model", ""),
|
||||||
ATTR_QUESTION: last_response.get("question", ""),
|
"last_timestamp": last_response.get("timestamp", ""),
|
||||||
"last_model": last_response.get("model", ""),
|
"last_error": (last_response.get("error", "")[:MAX_ATTRIBUTE_SIZE]
|
||||||
"last_timestamp": last_response.get("timestamp", ""),
|
if last_response.get("error") else None),
|
||||||
"last_error": last_response.get("error"),
|
})
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add performance metrics if available
|
|
||||||
if ATTR_PERFORMANCE_METRICS in data:
|
|
||||||
attributes[ATTR_PERFORMANCE_METRICS] = data[
|
|
||||||
ATTR_PERFORMANCE_METRICS
|
|
||||||
]
|
|
||||||
|
|
||||||
# Add API version if available
|
|
||||||
if ATTR_API_VERSION in data:
|
|
||||||
attributes[ATTR_API_VERSION] = data[ATTR_API_VERSION]
|
|
||||||
|
|
||||||
return self._sanitize_attributes(attributes)
|
return self._sanitize_attributes(attributes)
|
||||||
|
|
||||||
@@ -299,6 +316,12 @@ class HATextAISensor(CoordinatorEntity, SensorEntity):
|
|||||||
|
|
||||||
self._is_processing = data.get("is_processing", False)
|
self._is_processing = data.get("is_processing", False)
|
||||||
|
|
||||||
|
# Update metrics
|
||||||
|
metrics = data.get("metrics", {})
|
||||||
|
if isinstance(metrics, dict):
|
||||||
|
self._metrics.update(metrics)
|
||||||
|
_LOGGER.debug(f"Updated metrics for {self.entity_id}: {self._metrics}")
|
||||||
|
|
||||||
# Update conversation history and system prompt
|
# Update conversation history and system prompt
|
||||||
self._conversation_history = data.get("conversation_history", [])
|
self._conversation_history = data.get("conversation_history", [])
|
||||||
self._system_prompt = data.get("system_prompt")
|
self._system_prompt = data.get("system_prompt")
|
||||||
|
|||||||
@@ -63,13 +63,13 @@ ask_question:
|
|||||||
|
|
||||||
max_tokens:
|
max_tokens:
|
||||||
name: Max Tokens
|
name: Max Tokens
|
||||||
description: Maximum length of the response (1-4096 tokens)
|
description: Maximum length of the response (tokens)
|
||||||
required: false
|
required: false
|
||||||
default: 1000
|
default: 1000
|
||||||
selector:
|
selector:
|
||||||
number:
|
number:
|
||||||
min: 1
|
min: 1
|
||||||
max: 4096
|
max: 100000
|
||||||
step: 1
|
step: 1
|
||||||
mode: box
|
mode: box
|
||||||
|
|
||||||
|
|||||||
@@ -2,71 +2,103 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"provider": {
|
"provider": {
|
||||||
"title": "KI-Anbieter auswählen",
|
"title": "Wählen Sie AI-Anbieter",
|
||||||
"description": "Wählen Sie den KI-Dienstanbieter für diese Instanz aus.",
|
"description": "Wählen Sie, welchen AI-Dienstanbieter Sie für diese Instanz verwenden möchten.",
|
||||||
"data": {
|
"data": {
|
||||||
"api_provider": "API-Anbieter",
|
"api_provider": "API-Anbieter",
|
||||||
"context_messages": "Anzahl der zu behaltenden Kontextnachrichten (1-20)"
|
"context_messages": "Anzahl der zu behaltenden Kontextnachrichten (1-20)",
|
||||||
|
"max_history_size": "Maximale Größe des Gesprächsverlaufs (1-100)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provider": {
|
||||||
|
"title": "Anbieter-Einstellungen",
|
||||||
|
"description": "Geben Sie die Verbindungsdetails für Ihren gewählten AI-Anbieter an.",
|
||||||
|
"data": {
|
||||||
|
"name": "Instanzname (z. B. 'GPT Assistant', 'Claude Helper')",
|
||||||
|
"api_key": "API-Schlüssel zur Authentifizierung",
|
||||||
|
"model": "Zu verwendendes AI-Modell",
|
||||||
|
"api_endpoint": "Benutzerdefinierte API-Endpunkt-URL (optional)",
|
||||||
|
"temperature": "Kreativität der Antwort (0-2, niedriger = fokussierter)",
|
||||||
|
"max_tokens": "Maximale Länge der Antwort (1-100000 Token)",
|
||||||
|
"request_interval": "Minimale Zeit zwischen Anfragen (0,1-60 Sekunden)",
|
||||||
|
"context_messages": "Anzahl der zu behaltenden Kontextnachrichten (1-20)",
|
||||||
|
"max_history_size": "Maximale Größe des Gesprächsverlaufs (1-100)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"title": "HA Text AI-Instanz konfigurieren",
|
"title": "HA Text AI Instanz konfigurieren",
|
||||||
"description": "Richten Sie eine neue KI-Assistenteninstanz mit Ihrem ausgewählten Anbieter ein.",
|
"description": "Richten Sie eine neue AI-Assistenteninstanz mit Ihrem ausgewählten Anbieter ein.",
|
||||||
"data": {
|
"data": {
|
||||||
"name": "Instanzname (z. B. 'GPT-Assistent', 'Claude-Helfer')",
|
"name": "Instanzname (z. B. 'GPT Assistant', 'Claude Helper')",
|
||||||
"api_key": "API-Schlüssel zur Authentifizierung",
|
"api_key": "API-Schlüssel zur Authentifizierung",
|
||||||
"model": "Zu verwendendes KI-Modell",
|
"model": "Zu verwendendes AI-Modell",
|
||||||
"temperature": "Antwortkreativität (0-2, niedriger = fokussierter)",
|
"temperature": "Kreativität der Antwort (0-2, niedriger = fokussierter)",
|
||||||
"max_tokens": "Maximale Antwortlänge (1-4096 Token)",
|
"max_tokens": "Maximale Länge der Antwort (1-100000 Token)",
|
||||||
"api_endpoint": "Benutzerdefinierte API-Endpunkt-URL (optional)",
|
"api_endpoint": "Benutzerdefinierte API-Endpunkt-URL (optional)",
|
||||||
"api_provider": "API-Anbieter",
|
"api_provider": "API-Anbieter",
|
||||||
"request_interval": "Mindestzeit zwischen Anfragen (0,1-60 Sekunden)",
|
"request_interval": "Minimale Zeit zwischen Anfragen (0,1-60 Sekunden)",
|
||||||
"context_messages": "Anzahl der zu behaltenden Kontextnachrichten (1-20)",
|
"context_messages": "Anzahl der zu behaltenden Kontextnachrichten (1-20)",
|
||||||
"max_history_size": "Maximale Größe des Konversationsverlaufs (1-100)"
|
"max_history_size": "Maximale Größe des Gesprächsverlaufs (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
|
"history_storage_error": "Fehler beim Initialisieren des Verlaufspeichers. Überprüfen Sie die Berechtigungen.",
|
||||||
|
"history_rotation_error": "Fehler beim Drehen der Verlaufsdatei.",
|
||||||
|
"history_file_access_error": "Zugriff auf das Verzeichnis für den Verlaufsspeicher nicht möglich.",
|
||||||
"name_exists": "Eine Instanz mit diesem Namen existiert bereits",
|
"name_exists": "Eine Instanz mit diesem Namen existiert bereits",
|
||||||
"invalid_name": "Ungültiger Instanzname",
|
"invalid_name": "Ungültiger Instanzname",
|
||||||
"invalid_auth": "Authentifizierung fehlgeschlagen - überprüfen Sie Ihren API-Schlüssel",
|
"invalid_auth": "Authentifizierung fehlgeschlagen - überprüfen Sie Ihren API-Schlüssel",
|
||||||
"invalid_api_key": "Ungültiger API-Schlüssel - überprüfen Sie Ihre Anmeldedaten",
|
"invalid_api_key": "Ungültiger API-Schlüssel - bitte überprüfen Sie Ihre Anmeldeinformationen",
|
||||||
"cannot_connect": "Verbindung zum API-Dienst fehlgeschlagen",
|
"cannot_connect": "Verbindung zum API-Dienst fehlgeschlagen",
|
||||||
"invalid_model": "Das ausgewählte Modell ist nicht verfügbar",
|
"invalid_model": "Ausgewähltes Modell ist nicht verfügbar",
|
||||||
"rate_limit": "Ratenlimit überschritten",
|
"rate_limit": "Rate-Limit überschritten",
|
||||||
"context_length": "Kontextlänge überschritten",
|
"context_length": "Kontextlänge überschritten",
|
||||||
"rate_limit_exceeded": "API-Ratenlimit überschritten",
|
"rate_limit_exceeded": "API-Rate-Limit überschritten",
|
||||||
"maintenance": "Dienst befindet sich in der Wartung",
|
"maintenance": "Dienst ist in Wartung",
|
||||||
"invalid_response": "Ungültige API-Antwort empfangen",
|
"invalid_response": "Ungültige API-Antwort erhalten",
|
||||||
"api_error": "Fehler im API-Dienst aufgetreten",
|
"api_error": "Ein Fehler im API-Dienst ist aufgetreten",
|
||||||
"timeout": "Anfrage ist abgelaufen",
|
"timeout": "Zeitüberschreitung bei der Anfrage",
|
||||||
"invalid_instance": "Ungültige Instanz angegeben",
|
"invalid_instance": "Ungültige Instanz angegeben",
|
||||||
"unknown": "Es ist ein unerwarteter Fehler aufgetreten",
|
"unknown": "Unerwarteter Fehler aufgetreten",
|
||||||
"empty": "Name darf nicht leer sein",
|
"empty": "Name darf nicht leer sein",
|
||||||
"invalid_characters": "Name darf nur Buchstaben, Zahlen, Leerzeichen, Unterstriche und Bindestriche enthalten",
|
"invalid_characters": "Name darf nur Buchstaben, Zahlen, Leerzeichen, Unterstriche und Bindestriche enthalten",
|
||||||
"name_too_long": "Name darf maximal 50 Zeichen lang sein"
|
"name_too_long": "Name darf höchstens 50 Zeichen lang sein"
|
||||||
|
},
|
||||||
|
"abort": {
|
||||||
|
"already_configured": "Instanz bereits konfiguriert"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"title": "Instanzeinstellungen aktualisieren",
|
"title": "Instanzeinstellungen aktualisieren",
|
||||||
"description": "Ändern Sie die Einstellungen für diese KI-Assistenteninstanz.",
|
"description": "Ändern Sie die Einstellungen für diese AI-Assistenteninstanz.",
|
||||||
"data": {
|
"data": {
|
||||||
"model": "KI-Modell",
|
"model": "AI-Modell",
|
||||||
"temperature": "Antwortkreativität (0-2)",
|
"temperature": "Kreativität der Antwort (0-2)",
|
||||||
"max_tokens": "Maximale Antwortlänge (1-4096)",
|
"max_tokens": "Maximale Länge der Antwort (1-100000)",
|
||||||
"request_interval": "Mindestzeitraum zwischen Anfragen (0,1-60 Sekunden)",
|
"request_interval": "Minimale Anfrageintervall (0,1-60 Sekunden)",
|
||||||
"context_messages": "Anzahl der vorherigen Nachrichten, die im Kontext enthalten sein sollen (1-20)",
|
"context_messages": "Anzahl der vorherigen Nachrichten, die im Kontext enthalten sein sollen (1-20)",
|
||||||
"max_history_size": "Maximale Größe des Konversationsverlaufs (1-100)"
|
"max_history_size": "Maximale Größe des Gesprächsverlaufs (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"selector": {
|
||||||
|
"api_provider": {
|
||||||
|
"options": {
|
||||||
|
"openai": "OpenAI (compatible)",
|
||||||
|
"anthropic": "Anthropic (compatible)",
|
||||||
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"ask_question": {
|
"ask_question": {
|
||||||
"name": "Frage stellen (HA Text AI)",
|
"name": "Frage stellen (HA Text AI)",
|
||||||
"description": "Senden Sie eine Frage an das KI-Modell und erhalten Sie eine detaillierte Antwort. Die Antwort wird im Konversationsverlauf gespeichert und kann später abgerufen werden.",
|
"description": "Stellen Sie eine Frage an das AI-Modell und erhalten Sie eine detaillierte Antwort. Die Antwort wird im Gesprächsverlauf gespeichert und kann später abgerufen werden.",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Instanz",
|
"name": "Instanz",
|
||||||
@@ -74,43 +106,43 @@
|
|||||||
},
|
},
|
||||||
"question": {
|
"question": {
|
||||||
"name": "Frage",
|
"name": "Frage",
|
||||||
"description": "Ihre Frage oder Aufforderung an den KI-Assistenten"
|
"description": "Ihre Frage oder Aufforderung für den AI-Assistenten"
|
||||||
},
|
},
|
||||||
"context_messages": {
|
"context_messages": {
|
||||||
"name": "Kontextnachrichten",
|
"name": "Kontextnachrichten",
|
||||||
"description": "Anzahl der vorherigen Nachrichten, die im Kontext enthalten sein sollen (1-20)"
|
"description": "Anzahl der vorherigen Nachrichten, die im Kontext enthalten sein sollen (1-20)"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "Systemprompt",
|
"name": "Systemaufforderung",
|
||||||
"description": "Optionaler Systemprompt, um den Kontext für diese spezielle Frage festzulegen"
|
"description": "Optionale Systemaufforderung zur Festlegung des Kontexts für diese spezifische Frage"
|
||||||
},
|
},
|
||||||
"model": {
|
"model": {
|
||||||
"name": "Modell",
|
"name": "Modell",
|
||||||
"description": "Wählen Sie das zu verwendende KI-Modell aus (optional, überschreibt die Standardeinstellung)"
|
"description": "Wählen Sie das zu verwendende AI-Modell (optional, überschreibt die Standardeinstellung)"
|
||||||
},
|
},
|
||||||
"temperature": {
|
"temperature": {
|
||||||
"name": "Temperatur",
|
"name": "Temperatur",
|
||||||
"description": "Steuert die Antwortkreativität (0.0-2.0)"
|
"description": "Steuert die Kreativität der Antwort (0,0-2,0)"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "Max. Token",
|
"name": "Max Tokens",
|
||||||
"description": "Maximale Länge der Antwort (1-4096 Token)"
|
"description": "Maximale Länge der Antwort (1-100000 Token)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clear_history": {
|
"clear_history": {
|
||||||
"name": "Verlauf löschen",
|
"name": "Verlauf löschen",
|
||||||
"description": "Alle gespeicherten Fragen und Antworten aus dem Konversationsverlauf löschen",
|
"description": "Löschen Sie alle gespeicherten Fragen und Antworten aus dem Gesprächsverlauf",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Instanz",
|
"name": "Instanz",
|
||||||
"description": "Name der HA Text AI-Instanz, deren Verlauf gelöscht werden soll"
|
"description": "Name der HA Text AI-Instanz, für die der Verlauf gelöscht werden soll"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"get_history": {
|
"get_history": {
|
||||||
"name": "Verlauf abrufen",
|
"name": "Verlauf abrufen",
|
||||||
"description": "Konversationsverlauf mit optionalem Filtern und Sortieren abrufen",
|
"description": "Rufen Sie den Gesprächsverlauf mit optionaler Filterung und Sortierung ab",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Instanz",
|
"name": "Instanz",
|
||||||
@@ -118,19 +150,19 @@
|
|||||||
},
|
},
|
||||||
"limit": {
|
"limit": {
|
||||||
"name": "Limit",
|
"name": "Limit",
|
||||||
"description": "Anzahl der zurückzugebenden Konversationen (1-100)"
|
"description": "Anzahl der zurückzugebenden Gespräche (1-100)"
|
||||||
},
|
},
|
||||||
"filter_model": {
|
"filter_model": {
|
||||||
"name": "Modell filtern",
|
"name": "Modell filtern",
|
||||||
"description": "Konversationen nach einem bestimmten KI-Modell filtern"
|
"description": "Gespräche nach spezifischem AI-Modell filtern"
|
||||||
},
|
},
|
||||||
"start_date": {
|
"start_date": {
|
||||||
"name": "Startdatum",
|
"name": "Startdatum",
|
||||||
"description": "Konversationen ab diesem Datum/Uhrzeit filtern"
|
"description": "Gespräche ab diesem Datum/Zeit filtern"
|
||||||
},
|
},
|
||||||
"include_metadata": {
|
"include_metadata": {
|
||||||
"name": "Metadaten einschließen",
|
"name": "Metadaten einbeziehen",
|
||||||
"description": "Zusätzliche Informationen wie verwendete Token, Antwortzeit usw. einschließen"
|
"description": "Zusätzliche Informationen wie verwendete Tokens, Antwortzeit usw. einbeziehen"
|
||||||
},
|
},
|
||||||
"sort_order": {
|
"sort_order": {
|
||||||
"name": "Sortierreihenfolge",
|
"name": "Sortierreihenfolge",
|
||||||
@@ -139,16 +171,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"set_system_prompt": {
|
"set_system_prompt": {
|
||||||
"name": "Systemprompt festlegen",
|
"name": "Systemaufforderung festlegen",
|
||||||
"description": "Legen Sie Standardanweisungen für das Systemverhalten für alle zukünftigen Konversationen fest",
|
"description": "Standardverhaltensanweisungen für alle zukünftigen Gespräche festlegen",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Instanz",
|
"name": "Instanz",
|
||||||
"description": "Name der HA Text AI-Instanz, für die der Systemprompt festgelegt werden soll"
|
"description": "Name der HA Text AI-Instanz, für die die Systemaufforderung festgelegt werden soll"
|
||||||
},
|
},
|
||||||
"prompt": {
|
"prompt": {
|
||||||
"name": "Systemprompt",
|
"name": "Systemaufforderung",
|
||||||
"description": "Anweisungen, die definieren, wie sich die KI verhalten und antworten soll"
|
"description": "Anweisungen, die definieren, wie die AI sich verhalten und antworten soll"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,11 +194,11 @@
|
|||||||
"processing": "Verarbeitung",
|
"processing": "Verarbeitung",
|
||||||
"error": "Fehler",
|
"error": "Fehler",
|
||||||
"disconnected": "Getrennt",
|
"disconnected": "Getrennt",
|
||||||
"rate_limited": "Ratenlimit",
|
"rate_limited": "Rate limitiert",
|
||||||
"maintenance": "Wartung",
|
"maintenance": "Wartung",
|
||||||
"initializing": "Initialisierung",
|
"initializing": "Initialisierung",
|
||||||
"retrying": "Wiederholen",
|
"retrying": "Wiederholen",
|
||||||
"queued": "Warteschlange"
|
"queued": "In der Warteschlange"
|
||||||
},
|
},
|
||||||
"state_attributes": {
|
"state_attributes": {
|
||||||
"question": {
|
"question": {
|
||||||
@@ -182,16 +214,16 @@
|
|||||||
"name": "Temperatur"
|
"name": "Temperatur"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "Max. Token"
|
"name": "Max Tokens"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "Systemprompt"
|
"name": "Systemaufforderung"
|
||||||
},
|
},
|
||||||
"response_time": {
|
"response_time": {
|
||||||
"name": "Letzte Antwortzeit"
|
"name": "Letzte Antwortzeit"
|
||||||
},
|
},
|
||||||
"total_responses": {
|
"total_responses": {
|
||||||
"name": "Gesamtzahl der Antworten"
|
"name": "Gesamtantworten"
|
||||||
},
|
},
|
||||||
"error_count": {
|
"error_count": {
|
||||||
"name": "Fehleranzahl"
|
"name": "Fehleranzahl"
|
||||||
@@ -203,19 +235,19 @@
|
|||||||
"name": "API-Status"
|
"name": "API-Status"
|
||||||
},
|
},
|
||||||
"tokens_used": {
|
"tokens_used": {
|
||||||
"name": "Verwendete Token insgesamt"
|
"name": "Gesamte verwendete Tokens"
|
||||||
},
|
},
|
||||||
"average_response_time": {
|
"average_response_time": {
|
||||||
"name": "Durchschnittliche Antwortzeit"
|
"name": "Durchschnittliche Antwortzeit"
|
||||||
},
|
},
|
||||||
"last_request_time": {
|
"last_request_time": {
|
||||||
"name": "Zeitpunkt der letzten Anfrage"
|
"name": "Letzte Anfragezeit"
|
||||||
},
|
},
|
||||||
"is_processing": {
|
"is_processing": {
|
||||||
"name": "Verarbeitungsstatus"
|
"name": "Verarbeitungsstatus"
|
||||||
},
|
},
|
||||||
"is_rate_limited": {
|
"is_rate_limited": {
|
||||||
"name": "Ratenlimit-Status"
|
"name": "Rate-limitiert Status"
|
||||||
},
|
},
|
||||||
"is_maintenance": {
|
"is_maintenance": {
|
||||||
"name": "Wartungsstatus"
|
"name": "Wartungsstatus"
|
||||||
@@ -224,25 +256,25 @@
|
|||||||
"name": "API-Version"
|
"name": "API-Version"
|
||||||
},
|
},
|
||||||
"endpoint_status": {
|
"endpoint_status": {
|
||||||
"name": "Endpunkt-Status"
|
"name": "Endpunktstatus"
|
||||||
},
|
},
|
||||||
"performance_metrics": {
|
"performance_metrics": {
|
||||||
"name": "Leistungsmetriken"
|
"name": "Leistungskennzahlen"
|
||||||
},
|
},
|
||||||
"history_size": {
|
"history_size": {
|
||||||
"name": "Verlaufsgröße"
|
"name": "Größe des Verlaufs"
|
||||||
},
|
},
|
||||||
"uptime": {
|
"uptime": {
|
||||||
"name": "Betriebszeit"
|
"name": "Betriebszeit"
|
||||||
},
|
},
|
||||||
"total_tokens": {
|
"total_tokens": {
|
||||||
"name": "Gesamtzahl der Token"
|
"name": "Gesamte Tokens"
|
||||||
},
|
},
|
||||||
"prompt_tokens": {
|
"prompt_tokens": {
|
||||||
"name": "Prompt-Token"
|
"name": "Eingabe Tokens"
|
||||||
},
|
},
|
||||||
"completion_tokens": {
|
"completion_tokens": {
|
||||||
"name": "Completion-Token"
|
"name": "Vervollständigungs Tokens"
|
||||||
},
|
},
|
||||||
"successful_requests": {
|
"successful_requests": {
|
||||||
"name": "Erfolgreiche Anfragen"
|
"name": "Erfolgreiche Anfragen"
|
||||||
|
|||||||
@@ -6,7 +6,23 @@
|
|||||||
"description": "Choose which AI service provider to use for this instance.",
|
"description": "Choose which AI service provider to use for this instance.",
|
||||||
"data": {
|
"data": {
|
||||||
"api_provider": "API Provider",
|
"api_provider": "API Provider",
|
||||||
"context_messages": "Number of context messages to retain (1-20)"
|
"context_messages": "Number of context messages to retain (1-20)",
|
||||||
|
"max_history_size": "Maximum conversation history size (1-100)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provider": {
|
||||||
|
"title": "Provider Settings",
|
||||||
|
"description": "Provide connection details for your chosen AI provider.",
|
||||||
|
"data": {
|
||||||
|
"name": "Instance name (e.g., 'GPT Assistant', 'Claude Helper')",
|
||||||
|
"api_key": "API key for authentication",
|
||||||
|
"model": "AI model to use",
|
||||||
|
"api_endpoint": "Custom API endpoint URL (optional)",
|
||||||
|
"temperature": "Response creativity (0-2, lower = more focused)",
|
||||||
|
"max_tokens": "Maximum response length (1-100000 tokens)",
|
||||||
|
"request_interval": "Minimum time between requests (0.1-60 seconds)",
|
||||||
|
"context_messages": "Number of context messages to retain (1-20)",
|
||||||
|
"max_history_size": "Maximum conversation history size (1-100)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
@@ -17,7 +33,7 @@
|
|||||||
"api_key": "API key for authentication",
|
"api_key": "API key for authentication",
|
||||||
"model": "AI model to use",
|
"model": "AI model to use",
|
||||||
"temperature": "Response creativity (0-2, lower = more focused)",
|
"temperature": "Response creativity (0-2, lower = more focused)",
|
||||||
"max_tokens": "Maximum response length (1-4096 tokens)",
|
"max_tokens": "Maximum response length (1-100000 tokens)",
|
||||||
"api_endpoint": "Custom API endpoint URL (optional)",
|
"api_endpoint": "Custom API endpoint URL (optional)",
|
||||||
"api_provider": "API Provider",
|
"api_provider": "API Provider",
|
||||||
"request_interval": "Minimum time between requests (0.1-60 seconds)",
|
"request_interval": "Minimum time between requests (0.1-60 seconds)",
|
||||||
@@ -27,6 +43,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
|
"history_storage_error": "Failed to initialize history storage. Check permissions.",
|
||||||
|
"history_rotation_error": "Error during history file rotation.",
|
||||||
|
"history_file_access_error": "Cannot access history storage directory.",
|
||||||
"name_exists": "An instance with this name already exists",
|
"name_exists": "An instance with this name already exists",
|
||||||
"invalid_name": "Invalid instance name",
|
"invalid_name": "Invalid instance name",
|
||||||
"invalid_auth": "Authentication failed - check your API key",
|
"invalid_auth": "Authentication failed - check your API key",
|
||||||
@@ -45,6 +64,9 @@
|
|||||||
"empty": "Name cannot be empty",
|
"empty": "Name cannot be empty",
|
||||||
"invalid_characters": "Name can only contain letters, numbers, spaces, underscores and hyphens",
|
"invalid_characters": "Name can only contain letters, numbers, spaces, underscores and hyphens",
|
||||||
"name_too_long": "Name must be 50 characters or less"
|
"name_too_long": "Name must be 50 characters or less"
|
||||||
|
},
|
||||||
|
"abort": {
|
||||||
|
"already_configured": "Instance already configured"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
@@ -55,7 +77,7 @@
|
|||||||
"data": {
|
"data": {
|
||||||
"model": "AI model",
|
"model": "AI model",
|
||||||
"temperature": "Response creativity (0-2)",
|
"temperature": "Response creativity (0-2)",
|
||||||
"max_tokens": "Maximum response length (1-4096)",
|
"max_tokens": "Maximum response length (1-100000)",
|
||||||
"request_interval": "Minimum request interval (0.1-60 seconds)",
|
"request_interval": "Minimum request interval (0.1-60 seconds)",
|
||||||
"context_messages": "Number of previous messages to include in context (1-20)",
|
"context_messages": "Number of previous messages to include in context (1-20)",
|
||||||
"max_history_size": "Maximum conversation history size (1-100)"
|
"max_history_size": "Maximum conversation history size (1-100)"
|
||||||
@@ -63,6 +85,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"selector": {
|
||||||
|
"api_provider": {
|
||||||
|
"options": {
|
||||||
|
"openai": "OpenAI (compatible)",
|
||||||
|
"anthropic": "Anthropic (compatible)",
|
||||||
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"ask_question": {
|
"ask_question": {
|
||||||
"name": "Ask Question (HA Text AI)",
|
"name": "Ask Question (HA Text AI)",
|
||||||
@@ -94,7 +126,7 @@
|
|||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "Max Tokens",
|
"name": "Max Tokens",
|
||||||
"description": "Maximum length of the response (1-4096 tokens)"
|
"description": "Maximum length of the response (1-100000 tokens)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,151 +3,183 @@
|
|||||||
"step": {
|
"step": {
|
||||||
"provider": {
|
"provider": {
|
||||||
"title": "Seleccionar proveedor de IA",
|
"title": "Seleccionar proveedor de IA",
|
||||||
"description": "Elige qué proveedor de servicios de IA usar para esta instancia.",
|
"description": "Elige qué proveedor de servicio de IA utilizar para esta instancia.",
|
||||||
"data": {
|
"data": {
|
||||||
"api_provider": "Proveedor de API",
|
"api_provider": "Proveedor de API",
|
||||||
"context_messages": "Número de mensajes de contexto que conservar (1-20)"
|
"context_messages": "Número de mensajes de contexto a retener (1-20)",
|
||||||
|
"max_history_size": "Tamaño máximo del historial de conversación (1-100)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provider": {
|
||||||
|
"title": "Configuración del proveedor",
|
||||||
|
"description": "Proporciona los detalles de conexión para tu proveedor de IA elegido.",
|
||||||
|
"data": {
|
||||||
|
"name": "Nombre de la instancia (por ejemplo, 'Asistente GPT', 'Ayudante Claude')",
|
||||||
|
"api_key": "Clave API para autenticación",
|
||||||
|
"model": "Modelo de IA a utilizar",
|
||||||
|
"api_endpoint": "URL del endpoint de API personalizado (opcional)",
|
||||||
|
"temperature": "Creatividad de la respuesta (0-2, menor = más enfocado)",
|
||||||
|
"max_tokens": "Longitud máxima de la respuesta (1-100000 tokens)",
|
||||||
|
"request_interval": "Tiempo mínimo entre solicitudes (0.1-60 segundos)",
|
||||||
|
"context_messages": "Número de mensajes de contexto a retener (1-20)",
|
||||||
|
"max_history_size": "Tamaño máximo del historial de conversación (1-100)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"title": "Configurar instancia de HA Text AI",
|
"title": "Configurar instancia de IA de texto de HA",
|
||||||
"description": "Configura una nueva instancia de asistente de IA con el proveedor seleccionado.",
|
"description": "Configura una nueva instancia de asistente de IA con tu proveedor seleccionado.",
|
||||||
"data": {
|
"data": {
|
||||||
"name": "Nombre de la instancia (p. ej., 'Asistente GPT', 'Ayudante de Claude')",
|
"name": "Nombre de la instancia (por ejemplo, 'Asistente GPT', 'Ayudante Claude')",
|
||||||
"api_key": "Clave API para la autenticación",
|
"api_key": "Clave API para autenticación",
|
||||||
"model": "Modelo de IA a usar",
|
"model": "Modelo de IA a utilizar",
|
||||||
"temperature": "Creatividad de la respuesta (0-2, cuanto menor, más enfocada)",
|
"temperature": "Creatividad de la respuesta (0-2, menor = más enfocado)",
|
||||||
"max_tokens": "Longitud máxima de la respuesta (1-4096 tokens)",
|
"max_tokens": "Longitud máxima de la respuesta (1-100000 tokens)",
|
||||||
"api_endpoint": "URL del punto final de la API personalizada (opcional)",
|
"api_endpoint": "URL del endpoint de API personalizado (opcional)",
|
||||||
"api_provider": "Proveedor de API",
|
"api_provider": "Proveedor de API",
|
||||||
"request_interval": "Tiempo mínimo entre solicitudes (0,1-60 segundos)",
|
"request_interval": "Tiempo mínimo entre solicitudes (0.1-60 segundos)",
|
||||||
"context_messages": "Número de mensajes de contexto que conservar (1-20)",
|
"context_messages": "Número de mensajes de contexto a retener (1-20)",
|
||||||
"max_history_size": "Tamaño máximo del historial de conversación (1-100)"
|
"max_history_size": "Tamaño máximo del historial de conversación (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
|
"history_storage_error": "Error al inicializar el almacenamiento del historial. Verifica los permisos.",
|
||||||
|
"history_rotation_error": "Error durante la rotación del archivo de historial.",
|
||||||
|
"history_file_access_error": "No se puede acceder al directorio de almacenamiento del historial.",
|
||||||
"name_exists": "Ya existe una instancia con este nombre",
|
"name_exists": "Ya existe una instancia con este nombre",
|
||||||
"invalid_name": "Nombre de instancia no válido",
|
"invalid_name": "Nombre de instancia no válido",
|
||||||
"invalid_auth": "Error de autenticación: comprueba tu clave API",
|
"invalid_auth": "La autenticación falló - verifica tu clave API",
|
||||||
"invalid_api_key": "Clave API no válida: verifica tus credenciales",
|
"invalid_api_key": "Clave API no válida - verifica tus credenciales",
|
||||||
"cannot_connect": "No se pudo conectar al servicio API",
|
"cannot_connect": "Error al conectar con el servicio de API",
|
||||||
"invalid_model": "El modelo seleccionado no está disponible",
|
"invalid_model": "El modelo seleccionado no está disponible",
|
||||||
"rate_limit": "Límite de tasa excedido",
|
"rate_limit": "Límite de tasa excedido",
|
||||||
"context_length": "Longitud de contexto excedida",
|
"context_length": "Longitud del contexto excedida",
|
||||||
"rate_limit_exceeded": "Límite de tasa de API excedido",
|
"rate_limit_exceeded": "Límite de tasa de API excedido",
|
||||||
"maintenance": "El servicio está en mantenimiento",
|
"maintenance": "El servicio está en mantenimiento",
|
||||||
"invalid_response": "Se recibió una respuesta de API no válida",
|
"invalid_response": "Respuesta de API no válida recibida",
|
||||||
"api_error": "Se produjo un error en el servicio API",
|
"api_error": "Ocurrió un error en el servicio de API",
|
||||||
"timeout": "Tiempo de espera de la solicitud agotado",
|
"timeout": "Se agotó el tiempo de la solicitud",
|
||||||
"invalid_instance": "Instancia especificada no válida",
|
"invalid_instance": "Instancia no válida especificada",
|
||||||
"unknown": "Se produjo un error inesperado",
|
"unknown": "Ocurrió un error inesperado",
|
||||||
"empty": "El nombre no puede estar vacío",
|
"empty": "El nombre no puede estar vacío",
|
||||||
"invalid_characters": "El nombre solo puede contener letras, números, espacios, guiones bajos y guiones",
|
"invalid_characters": "El nombre solo puede contener letras, números, espacios, guiones bajos y guiones",
|
||||||
"name_too_long": "El nombre debe tener 50 caracteres o menos"
|
"name_too_long": "El nombre debe tener 50 caracteres o menos"
|
||||||
|
},
|
||||||
|
"abort": {
|
||||||
|
"already_configured": "Instancia ya configurada"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"title": "Actualizar configuración de la instancia",
|
"title": "Actualizar configuración de la instancia",
|
||||||
"description": "Modifica la configuración de esta instancia de asistente de IA.",
|
"description": "Modifica la configuración para esta instancia de asistente de IA.",
|
||||||
"data": {
|
"data": {
|
||||||
"model": "Modelo de IA",
|
"model": "Modelo de IA",
|
||||||
"temperature": "Creatividad de la respuesta (0-2)",
|
"temperature": "Creatividad de la respuesta (0-2)",
|
||||||
"max_tokens": "Longitud máxima de la respuesta (1-4096)",
|
"max_tokens": "Longitud máxima de la respuesta (1-100000)",
|
||||||
"request_interval": "Intervalo mínimo de solicitud (0,1-60 segundos)",
|
"request_interval": "Intervalo mínimo de solicitud (0.1-60 segundos)",
|
||||||
"context_messages": "Número de mensajes anteriores que se incluirán en el contexto (1-20)",
|
"context_messages": "Número de mensajes anteriores a incluir en el contexto (1-20)",
|
||||||
"max_history_size": "Tamaño máximo del historial de conversación (1-100)"
|
"max_history_size": "Tamaño máximo del historial de conversación (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"selector": {
|
||||||
|
"api_provider": {
|
||||||
|
"options": {
|
||||||
|
"openai": "OpenAI (compatible)",
|
||||||
|
"anthropic": "Anthropic (compatible)",
|
||||||
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"ask_question": {
|
"ask_question": {
|
||||||
"name": "Hacer pregunta (HA Text AI)",
|
"name": "Hacer Pregunta (HA Text AI)",
|
||||||
"description": "Envía una pregunta al modelo de IA y recibe una respuesta detallada. La respuesta se almacenará en el historial de conversación y se podrá recuperar más tarde.",
|
"description": "Envía una pregunta al modelo de IA y recibe una respuesta detallada. La respuesta se almacenará en el historial de conversación y se podrá recuperar más tarde.",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Instancia",
|
"name": "Instancia",
|
||||||
"description": "Nombre de la instancia de HA Text AI a utilizar"
|
"description": "Nombre de la instancia de IA de Texto de HA a utilizar"
|
||||||
},
|
},
|
||||||
"question": {
|
"question": {
|
||||||
"name": "Pregunta",
|
"name": "Pregunta",
|
||||||
"description": "Tu pregunta o indicación para el asistente de IA"
|
"description": "Tu pregunta o solicitud para el asistente de IA"
|
||||||
},
|
},
|
||||||
"context_messages": {
|
"context_messages": {
|
||||||
"name": "Mensajes de contexto",
|
"name": "Mensajes de Contexto",
|
||||||
"description": "Número de mensajes anteriores que se incluirán en el contexto (1-20)"
|
"description": "Número de mensajes anteriores a incluir en el contexto (1-20)"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "Indicación del sistema",
|
"name": "Indicaciones del Sistema",
|
||||||
"description": "Indicación del sistema opcional para establecer el contexto de esta pregunta específica"
|
"description": "Indicaciones opcionales para establecer contexto para esta pregunta específica"
|
||||||
},
|
},
|
||||||
"model": {
|
"model": {
|
||||||
"name": "Modelo",
|
"name": "Modelo",
|
||||||
"description": "Selecciona el modelo de IA que se va a utilizar (opcional, anula la configuración predeterminada)"
|
"description": "Selecciona el modelo de IA a utilizar (opcional, anula la configuración predeterminada)"
|
||||||
},
|
},
|
||||||
"temperature": {
|
"temperature": {
|
||||||
"name": "Temperatura",
|
"name": "Temperatura",
|
||||||
"description": "Controla la creatividad de la respuesta (0.0-2.0)"
|
"description": "Controla la creatividad de la respuesta (0.0-2.0)"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "Máx. tokens",
|
"name": "Máx. Tokens",
|
||||||
"description": "Longitud máxima de la respuesta (1-4096 tokens)"
|
"description": "Longitud máxima de la respuesta (1-100000 tokens)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clear_history": {
|
"clear_history": {
|
||||||
"name": "Borrar historial",
|
"name": "Borrar Historial",
|
||||||
"description": "Elimina todas las preguntas y respuestas almacenadas del historial de conversación",
|
"description": "Elimina todas las preguntas y respuestas almacenadas del historial de conversación",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Instancia",
|
"name": "Instancia",
|
||||||
"description": "Nombre de la instancia de HA Text AI para la que se va a borrar el historial"
|
"description": "Nombre de la instancia de IA de Texto de HA para borrar el historial"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"get_history": {
|
"get_history": {
|
||||||
"name": "Obtener historial",
|
"name": "Obtener Historial",
|
||||||
"description": "Recupera el historial de conversaciones con filtrado y ordenación opcionales",
|
"description": "Recupera el historial de conversación con filtrado y ordenación opcionales",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Instancia",
|
"name": "Instancia",
|
||||||
"description": "Nombre de la instancia de HA Text AI de la que se va a obtener el historial"
|
"description": "Nombre de la instancia de IA de Texto de HA para obtener historial"
|
||||||
},
|
},
|
||||||
"limit": {
|
"limit": {
|
||||||
"name": "Límite",
|
"name": "Límite",
|
||||||
"description": "Número de conversaciones que se van a devolver (1-100)"
|
"description": "Número de conversaciones a devolver (1-100)"
|
||||||
},
|
},
|
||||||
"filter_model": {
|
"filter_model": {
|
||||||
"name": "Filtrar modelo",
|
"name": "Filtrar Modelo",
|
||||||
"description": "Filtra las conversaciones por un modelo de IA específico"
|
"description": "Filtrar conversaciones por modelo de IA específico"
|
||||||
},
|
},
|
||||||
"start_date": {
|
"start_date": {
|
||||||
"name": "Fecha de inicio",
|
"name": "Fecha de Inicio",
|
||||||
"description": "Filtra las conversaciones a partir de esta fecha/hora"
|
"description": "Filtrar conversaciones a partir de esta fecha/hora"
|
||||||
},
|
},
|
||||||
"include_metadata": {
|
"include_metadata": {
|
||||||
"name": "Incluir metadatos",
|
"name": "Incluir Metadatos",
|
||||||
"description": "Incluir información adicional como los tokens utilizados, el tiempo de respuesta, etc."
|
"description": "Incluir información adicional como tokens utilizados, tiempo de respuesta, etc."
|
||||||
},
|
},
|
||||||
"sort_order": {
|
"sort_order": {
|
||||||
"name": "Orden de clasificación",
|
"name": "Orden de Clasificación",
|
||||||
"description": "Orden de clasificación de los resultados (más recientes o más antiguos primero)"
|
"description": "Orden de clasificación para los resultados (más recientes o más antiguos primero)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"set_system_prompt": {
|
"set_system_prompt": {
|
||||||
"name": "Establecer indicación del sistema",
|
"name": "Establecer Indicaciones del Sistema",
|
||||||
"description": "Establece instrucciones predeterminadas de comportamiento del sistema para todas las conversaciones futuras",
|
"description": "Establecer instrucciones de comportamiento del sistema predeterminadas para todas las futuras conversaciones",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Instancia",
|
"name": "Instancia",
|
||||||
"description": "Nombre de la instancia de HA Text AI para la que se va a establecer la indicación del sistema"
|
"description": "Nombre de la instancia de IA de Texto de HA para establecer indicaciones del sistema"
|
||||||
},
|
},
|
||||||
"prompt": {
|
"prompt": {
|
||||||
"name": "Indicación del sistema",
|
"name": "Indicaciones del Sistema",
|
||||||
"description": "Instrucciones que definen cómo debe comportarse y responder la IA"
|
"description": "Instrucciones que definen cómo debe comportarse y responder la IA"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,7 +194,7 @@
|
|||||||
"processing": "Procesando",
|
"processing": "Procesando",
|
||||||
"error": "Error",
|
"error": "Error",
|
||||||
"disconnected": "Desconectado",
|
"disconnected": "Desconectado",
|
||||||
"rate_limited": "Límite de tasa alcanzado",
|
"rate_limited": "Limitado por tasa",
|
||||||
"maintenance": "Mantenimiento",
|
"maintenance": "Mantenimiento",
|
||||||
"initializing": "Inicializando",
|
"initializing": "Inicializando",
|
||||||
"retrying": "Reintentando",
|
"retrying": "Reintentando",
|
||||||
@@ -170,94 +202,94 @@
|
|||||||
},
|
},
|
||||||
"state_attributes": {
|
"state_attributes": {
|
||||||
"question": {
|
"question": {
|
||||||
"name": "Última pregunta"
|
"name": "Última Pregunta"
|
||||||
},
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"name": "Última respuesta"
|
"name": "Última Respuesta"
|
||||||
},
|
},
|
||||||
"model": {
|
"model": {
|
||||||
"name": "Modelo actual"
|
"name": "Modelo Actual"
|
||||||
},
|
},
|
||||||
"temperature": {
|
"temperature": {
|
||||||
"name": "Temperatura"
|
"name": "Temperatura"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "Máx. tokens"
|
"name": "Máx. Tokens"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "Indicación del sistema"
|
"name": "Indicaciones del Sistema"
|
||||||
},
|
},
|
||||||
"response_time": {
|
"response_time": {
|
||||||
"name": "Tiempo de la última respuesta"
|
"name": "Último Tiempo de Respuesta"
|
||||||
},
|
},
|
||||||
"total_responses": {
|
"total_responses": {
|
||||||
"name": "Total de respuestas"
|
"name": "Total de Respuestas"
|
||||||
},
|
},
|
||||||
"error_count": {
|
"error_count": {
|
||||||
"name": "Recuento de errores"
|
"name": "Conteo de Errores"
|
||||||
},
|
},
|
||||||
"last_error": {
|
"last_error": {
|
||||||
"name": "Último error"
|
"name": "Último Error"
|
||||||
},
|
},
|
||||||
"api_status": {
|
"api_status": {
|
||||||
"name": "Estado de la API"
|
"name": "Estado de API"
|
||||||
},
|
},
|
||||||
"tokens_used": {
|
"tokens_used": {
|
||||||
"name": "Total de tokens usados"
|
"name": "Total de Tokens Usados"
|
||||||
},
|
},
|
||||||
"average_response_time": {
|
"average_response_time": {
|
||||||
"name": "Tiempo medio de respuesta"
|
"name": "Tiempo de Respuesta Promedio"
|
||||||
},
|
},
|
||||||
"last_request_time": {
|
"last_request_time": {
|
||||||
"name": "Tiempo de la última solicitud"
|
"name": "Último Tiempo de Solicitud"
|
||||||
},
|
},
|
||||||
"is_processing": {
|
"is_processing": {
|
||||||
"name": "Estado de procesamiento"
|
"name": "Estado de Procesamiento"
|
||||||
},
|
},
|
||||||
"is_rate_limited": {
|
"is_rate_limited": {
|
||||||
"name": "Estado de límite de tasa"
|
"name": "Estado Limitado por Tasa"
|
||||||
},
|
},
|
||||||
"is_maintenance": {
|
"is_maintenance": {
|
||||||
"name": "Estado de mantenimiento"
|
"name": "Estado de Mantenimiento"
|
||||||
},
|
},
|
||||||
"api_version": {
|
"api_version": {
|
||||||
"name": "Versión de la API"
|
"name": "Versión de API"
|
||||||
},
|
},
|
||||||
"endpoint_status": {
|
"endpoint_status": {
|
||||||
"name": "Estado del punto final"
|
"name": "Estado del Endpoint"
|
||||||
},
|
},
|
||||||
"performance_metrics": {
|
"performance_metrics": {
|
||||||
"name": "Métricas de rendimiento"
|
"name": "Métricas de Rendimiento"
|
||||||
},
|
},
|
||||||
"history_size": {
|
"history_size": {
|
||||||
"name": "Tamaño del historial"
|
"name": "Tamaño del Historial"
|
||||||
},
|
},
|
||||||
"uptime": {
|
"uptime": {
|
||||||
"name": "Tiempo de actividad"
|
"name": "Tiempo de Actividad"
|
||||||
},
|
},
|
||||||
"total_tokens": {
|
"total_tokens": {
|
||||||
"name": "Total de tokens"
|
"name": "Total de Tokens"
|
||||||
},
|
},
|
||||||
"prompt_tokens": {
|
"prompt_tokens": {
|
||||||
"name": "Tokens de indicación"
|
"name": "Tokens de Solicitud"
|
||||||
},
|
},
|
||||||
"completion_tokens": {
|
"completion_tokens": {
|
||||||
"name": "Tokens de compleción"
|
"name": "Tokens de Finalización"
|
||||||
},
|
},
|
||||||
"successful_requests": {
|
"successful_requests": {
|
||||||
"name": "Solicitudes exitosas"
|
"name": "Solicitudes Exitosas"
|
||||||
},
|
},
|
||||||
"failed_requests": {
|
"failed_requests": {
|
||||||
"name": "Solicitudes fallidas"
|
"name": "Solicitudes Fallidas"
|
||||||
},
|
},
|
||||||
"average_latency": {
|
"average_latency": {
|
||||||
"name": "Latencia media"
|
"name": "Latencia Promedio"
|
||||||
},
|
},
|
||||||
"max_latency": {
|
"max_latency": {
|
||||||
"name": "Latencia máxima"
|
"name": "Latencia Máxima"
|
||||||
},
|
},
|
||||||
"min_latency": {
|
"min_latency": {
|
||||||
"name": "Latencia mínima"
|
"name": "Latencia Mínima"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,79 +2,111 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"provider": {
|
"provider": {
|
||||||
"title": "AI प्रदाता का चयन करें",
|
"title": "एआई प्रदाता चुनें",
|
||||||
"description": "इस उदाहरण के लिए उपयोग करने के लिए AI सेवा प्रदाता चुनें।",
|
"description": "इस उदाहरण के लिए किस एआई सेवा प्रदाता का उपयोग करना है, चुनें।",
|
||||||
"data": {
|
"data": {
|
||||||
"api_provider": "API प्रदाता",
|
"api_provider": "एपीआई प्रदाता",
|
||||||
"context_messages": "बनाए रखने के लिए संदर्भ संदेशों की संख्या (1-20)"
|
"context_messages": "रखने के लिए संदर्भ संदेशों की संख्या (1-20)",
|
||||||
|
"max_history_size": "अधिकतम बातचीत इतिहास आकार (1-100)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provider": {
|
||||||
|
"title": "प्रदाता सेटिंग्स",
|
||||||
|
"description": "आपके द्वारा चुने गए एआई प्रदाता के लिए कनेक्शन विवरण प्रदान करें।",
|
||||||
|
"data": {
|
||||||
|
"name": "उदाहरण का नाम (जैसे, 'जीपीटी सहायक', 'क्लॉड सहायक')",
|
||||||
|
"api_key": "प्रमाणीकरण के लिए एपीआई कुंजी",
|
||||||
|
"model": "उपयोग करने के लिए एआई मॉडल",
|
||||||
|
"api_endpoint": "कस्टम एपीआई एंडपॉइंट यूआरएल (वैकल्पिक)",
|
||||||
|
"temperature": "प्रतिक्रिया की रचनात्मकता (0-2, कम = अधिक केंद्रित)",
|
||||||
|
"max_tokens": "प्रतिक्रिया की अधिकतम लंबाई (1-100000 टोकन)",
|
||||||
|
"request_interval": "अनुरोधों के बीच न्यूनतम समय (0.1-60 सेकंड)",
|
||||||
|
"context_messages": "रखने के लिए संदर्भ संदेशों की संख्या (1-20)",
|
||||||
|
"max_history_size": "अधिकतम बातचीत इतिहास आकार (1-100)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"title": "HA टेक्स्ट AI उदाहरण को कॉन्फ़िगर करें",
|
"title": "एचए टेक्स्ट एआई उदाहरण कॉन्फ़िगर करें",
|
||||||
"description": "अपने चयनित प्रदाता के साथ एक नया AI सहायक उदाहरण सेट करें।",
|
"description": "अपने चुने हुए प्रदाता के साथ एक नया एआई सहायक उदाहरण सेट करें।",
|
||||||
"data": {
|
"data": {
|
||||||
"name": "उदाहरण का नाम (जैसे, 'GPT सहायक', 'क्लाउड सहायक')",
|
"name": "उदाहरण का नाम (जैसे, 'जीपीटी सहायक', 'क्लॉड सहायक')",
|
||||||
"api_key": "प्रमाणीकरण के लिए API कुंजी",
|
"api_key": "प्रमाणीकरण के लिए एपीआई कुंजी",
|
||||||
"model": "उपयोग करने के लिए AI मॉडल",
|
"model": "उपयोग करने के लिए एआई मॉडल",
|
||||||
"temperature": "प्रतिक्रिया रचनात्मकता (0-2, कम = अधिक केंद्रित)",
|
"temperature": "प्रतिक्रिया की रचनात्मकता (0-2, कम = अधिक केंद्रित)",
|
||||||
"max_tokens": "अधिकतम प्रतिक्रिया लंबाई (1-4096 टोकन)",
|
"max_tokens": "प्रतिक्रिया की अधिकतम लंबाई (1-100000 टोकन)",
|
||||||
"api_endpoint": "कस्टम API एंडपॉइंट URL (वैकल्पिक)",
|
"api_endpoint": "कस्टम एपीआई एंडपॉइंट यूआरएल (वैकल्पिक)",
|
||||||
"api_provider": "API प्रदाता",
|
"api_provider": "एपीआई प्रदाता",
|
||||||
"request_interval": "अनुरोधों के बीच न्यूनतम समय (0.1-60 सेकंड)",
|
"request_interval": "अनुरोधों के बीच न्यूनतम समय (0.1-60 सेकंड)",
|
||||||
"context_messages": "बनाए रखने के लिए संदर्भ संदेशों की संख्या (1-20)",
|
"context_messages": "रखने के लिए संदर्भ संदेशों की संख्या (1-20)",
|
||||||
"max_history_size": "अधिकतम वार्तालाप इतिहास आकार (1-100)"
|
"max_history_size": "अधिकतम बातचीत इतिहास आकार (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"name_exists": "इस नाम का एक उदाहरण पहले से मौजूद है",
|
"history_storage_error": "इतिहास भंडारण प्रारंभ करने में विफल। अनुमतियों की जांच करें।",
|
||||||
|
"history_rotation_error": "इतिहास फ़ाइल घुमाने के दौरान त्रुटि।",
|
||||||
|
"history_file_access_error": "इतिहास भंडारण निर्देशिका तक पहुंच नहीं है।",
|
||||||
|
"name_exists": "इस नाम के साथ एक उदाहरण पहले से मौजूद है",
|
||||||
"invalid_name": "अमान्य उदाहरण नाम",
|
"invalid_name": "अमान्य उदाहरण नाम",
|
||||||
"invalid_auth": "प्रमाणीकरण विफल - अपनी API कुंजी जांचें",
|
"invalid_auth": "प्रमाणीकरण विफल - अपनी एपीआई कुंजी की जांच करें",
|
||||||
"invalid_api_key": "अमान्य API कुंजी - कृपया अपनी क्रेडेंशियल सत्यापित करें",
|
"invalid_api_key": "अमान्य एपीआई कुंजी - कृपया अपनी क्रेडेंशियल्स की पुष्टि करें",
|
||||||
"cannot_connect": "API सेवा से कनेक्ट करने में विफल",
|
"cannot_connect": "एपीआई सेवा से कनेक्ट करने में विफल",
|
||||||
"invalid_model": "चयनित मॉडल उपलब्ध नहीं है",
|
"invalid_model": "चुना हुआ मॉडल उपलब्ध नहीं है",
|
||||||
"rate_limit": "दर सीमा पार हो गई",
|
"rate_limit": "रेट सीमा पार",
|
||||||
"context_length": "संदर्भ लंबाई पार हो गई",
|
"context_length": "संदर्भ लंबाई पार",
|
||||||
"rate_limit_exceeded": "API दर सीमा पार हो गई",
|
"rate_limit_exceeded": "एपीआई रेट सीमा पार",
|
||||||
"maintenance": "सेवा रखरखाव के अधीन है",
|
"maintenance": "सेवा रखरखाव में है",
|
||||||
"invalid_response": "अमान्य API प्रतिक्रिया प्राप्त हुई",
|
"invalid_response": "अमान्य एपीआई प्रतिक्रिया प्राप्त हुई",
|
||||||
"api_error": "API सेवा त्रुटि हुई",
|
"api_error": "एपीआई सेवा में त्रुटि हुई",
|
||||||
"timeout": "अनुरोध समय समाप्त हो गया",
|
"timeout": "अनुरोध समय सीमा समाप्त",
|
||||||
"invalid_instance": "अमान्य उदाहरण निर्दिष्ट किया गया",
|
"invalid_instance": "अमान्य उदाहरण निर्दिष्ट किया गया",
|
||||||
"unknown": "अप्रत्याशित त्रुटि हुई",
|
"unknown": "अप्रत्याशित त्रुटि हुई",
|
||||||
"empty": "नाम खाली नहीं हो सकता",
|
"empty": "नाम खाली नहीं हो सकता",
|
||||||
"invalid_characters": "नाम में केवल अक्षर, संख्या, रिक्त स्थान, अंडरस्कोर और हाइफ़न हो सकते हैं",
|
"invalid_characters": "नाम में केवल अक्षर, अंक, रिक्त स्थान, अंडरस्कोर और हाइफन हो सकते हैं",
|
||||||
"name_too_long": "नाम 50 वर्ण या उससे कम होना चाहिए"
|
"name_too_long": "नाम 50 अक्षरों या उससे कम होना चाहिए"
|
||||||
|
},
|
||||||
|
"abort": {
|
||||||
|
"already_configured": "उदाहरण पहले से कॉन्फ़िगर किया गया है"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"title": "उदाहरण सेटिंग्स अपडेट करें",
|
"title": "उदाहरण सेटिंग्स अपडेट करें",
|
||||||
"description": "इस AI सहायक उदाहरण के लिए सेटिंग्स संशोधित करें।",
|
"description": "इस एआई सहायक उदाहरण के लिए सेटिंग्स संशोधित करें।",
|
||||||
"data": {
|
"data": {
|
||||||
"model": "AI मॉडल",
|
"model": "एआई मॉडल",
|
||||||
"temperature": "प्रतिक्रिया रचनात्मकता (0-2)",
|
"temperature": "प्रतिक्रिया की रचनात्मकता (0-2)",
|
||||||
"max_tokens": "अधिकतम प्रतिक्रिया लंबाई (1-4096)",
|
"max_tokens": "प्रतिक्रिया की अधिकतम लंबाई (1-100000)",
|
||||||
"request_interval": "न्यूनतम अनुरोध अंतराल (0.1-60 सेकंड)",
|
"request_interval": "न्यूनतम अनुरोध अंतराल (0.1-60 सेकंड)",
|
||||||
"context_messages": "संदर्भ में शामिल करने के लिए पिछले संदेशों की संख्या (1-20)",
|
"context_messages": "संदर्भ में शामिल करने के लिए पिछले संदेशों की संख्या (1-20)",
|
||||||
"max_history_size": "अधिकतम वार्तालाप इतिहास आकार (1-100)"
|
"max_history_size": "अधिकतम बातचीत इतिहास आकार (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"selector": {
|
||||||
|
"api_provider": {
|
||||||
|
"options": {
|
||||||
|
"openai": "OpenAI (अनुकूलित)",
|
||||||
|
"anthropic": "Anthropic (अनुकूलित)",
|
||||||
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"ask_question": {
|
"ask_question": {
|
||||||
"name": "प्रश्न पूछें (HA टेक्स्ट AI)",
|
"name": "प्रश्न पूछें (HA Text AI)",
|
||||||
"description": "AI मॉडल को एक प्रश्न भेजें और एक विस्तृत प्रतिक्रिया प्राप्त करें। प्रतिक्रिया वार्तालाप इतिहास में संग्रहीत की जाएगी और बाद में पुनर्प्राप्त की जा सकती है।",
|
"description": "एआई मॉडल को एक प्रश्न भेजें और विस्तृत प्रतिक्रिया प्राप्त करें। प्रतिक्रिया बातचीत के इतिहास में संग्रहीत की जाएगी और बाद में पुनर्प्राप्त की जा सकती है।",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "उदाहरण",
|
"name": "उदाहरण",
|
||||||
"description": "उपयोग करने के लिए HA टेक्स्ट AI उदाहरण का नाम"
|
"description": "उपयोग करने के लिए एचए टेक्स्ट एआई उदाहरण का नाम"
|
||||||
},
|
},
|
||||||
"question": {
|
"question": {
|
||||||
"name": "प्रश्न",
|
"name": "प्रश्न",
|
||||||
"description": "AI सहायक के लिए आपका प्रश्न या संकेत"
|
"description": "आपका प्रश्न या एआई सहायक के लिए प्रॉम्प्ट"
|
||||||
},
|
},
|
||||||
"context_messages": {
|
"context_messages": {
|
||||||
"name": "संदर्भ संदेश",
|
"name": "संदर्भ संदेश",
|
||||||
@@ -82,73 +114,73 @@
|
|||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "सिस्टम प्रॉम्प्ट",
|
"name": "सिस्टम प्रॉम्प्ट",
|
||||||
"description": "इस विशिष्ट प्रश्न के लिए संदर्भ सेट करने के लिए वैकल्पिक सिस्टम प्रॉम्प्ट"
|
"description": "इस विशेष प्रश्न के लिए संदर्भ सेट करने के लिए वैकल्पिक सिस्टम प्रॉम्प्ट"
|
||||||
},
|
},
|
||||||
"model": {
|
"model": {
|
||||||
"name": "मॉडल",
|
"name": "मॉडल",
|
||||||
"description": "उपयोग करने के लिए AI मॉडल का चयन करें (वैकल्पिक, डिफ़ॉल्ट सेटिंग को ओवरराइड करता है)"
|
"description": "उपयोग करने के लिए एआई मॉडल का चयन करें (वैकल्पिक, डिफ़ॉल्ट सेटिंग को ओवरराइड करता है)"
|
||||||
},
|
},
|
||||||
"temperature": {
|
"temperature": {
|
||||||
"name": "तापमान",
|
"name": "तापमान",
|
||||||
"description": "प्रतिक्रिया रचनात्मकता को नियंत्रित करता है (0.0-2.0)"
|
"description": "प्रतिक्रिया की रचनात्मकता को नियंत्रित करता है (0.0-2.0)"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "अधिकतम टोकन",
|
"name": "अधिकतम टोकन",
|
||||||
"description": "प्रतिक्रिया की अधिकतम लंबाई (1-4096 टोकन)"
|
"description": "प्रतिक्रिया की अधिकतम लंबाई (1-100000 टोकन)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clear_history": {
|
"clear_history": {
|
||||||
"name": "इतिहास साफ़ करें",
|
"name": "इतिहास साफ करें",
|
||||||
"description": "वार्तालाप इतिहास से सभी संग्रहीत प्रश्न और प्रतिक्रियाएँ हटाएँ",
|
"description": "बातचीत के इतिहास से सभी संग्रहीत प्रश्नों और प्रतिक्रियाओं को हटाएं",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "उदाहरण",
|
"name": "उदाहरण",
|
||||||
"description": "इतिहास साफ़ करने के लिए HA टेक्स्ट AI उदाहरण का नाम"
|
"description": "इतिहास साफ़ करने के लिए एचए टेक्स्ट एआई उदाहरण का नाम"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"get_history": {
|
"get_history": {
|
||||||
"name": "इतिहास प्राप्त करें",
|
"name": "इतिहास प्राप्त करें",
|
||||||
"description": "वैकल्पिक फ़िल्टरिंग और सॉर्टिंग के साथ वार्तालाप इतिहास पुनर्प्राप्त करें",
|
"description": "वैकल्पिक फ़िल्टरिंग और छंटाई के साथ बातचीत का इतिहास प्राप्त करें",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "उदाहरण",
|
"name": "उदाहरण",
|
||||||
"description": "इतिहास प्राप्त करने के लिए HA टेक्स्ट AI उदाहरण का नाम"
|
"description": "इतिहास प्राप्त करने के लिए एचए टेक्स्ट एआई उदाहरण का नाम"
|
||||||
},
|
},
|
||||||
"limit": {
|
"limit": {
|
||||||
"name": "सीमा",
|
"name": "सीमा",
|
||||||
"description": "वापस करने के लिए वार्तालापों की संख्या (1-100)"
|
"description": "वापस करने के लिए बातचीत की संख्या (1-100)"
|
||||||
},
|
},
|
||||||
"filter_model": {
|
"filter_model": {
|
||||||
"name": "फ़िल्टर मॉडल",
|
"name": "फिल्टर मॉडल",
|
||||||
"description": "विशिष्ट AI मॉडल द्वारा वार्तालापों को फ़िल्टर करें"
|
"description": "विशिष्ट एआई मॉडल द्वारा बातचीत को फ़िल्टर करें"
|
||||||
},
|
},
|
||||||
"start_date": {
|
"start_date": {
|
||||||
"name": "प्रारंभ तिथि",
|
"name": "शुरुआत की तारीख",
|
||||||
"description": "इस तिथि/समय से शुरू होने वाले वार्तालापों को फ़िल्टर करें"
|
"description": "इस दिन/समय से शुरू होने वाली बातचीत को फ़िल्टर करें"
|
||||||
},
|
},
|
||||||
"include_metadata": {
|
"include_metadata": {
|
||||||
"name": "मेटाडेटा शामिल करें",
|
"name": "मेटाडेटा शामिल करें",
|
||||||
"description": "उपयोग किए गए टोकन, प्रतिक्रिया समय, आदि जैसी अतिरिक्त जानकारी शामिल करें।"
|
"description": "उपयोग किए गए टोकन, प्रतिक्रिया समय आदि जैसी अतिरिक्त जानकारी शामिल करें।"
|
||||||
},
|
},
|
||||||
"sort_order": {
|
"sort_order": {
|
||||||
"name": "क्रमबद्ध करें",
|
"name": "छंटाई क्रम",
|
||||||
"description": "परिणामों के लिए क्रमबद्ध क्रम (नवीनतम या सबसे पुराना पहले)"
|
"description": "परिणामों के लिए छंटाई क्रम (नवीनतम या सबसे पुराना पहले)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"set_system_prompt": {
|
"set_system_prompt": {
|
||||||
"name": "सिस्टम प्रॉम्प्ट सेट करें",
|
"name": "सिस्टम प्रॉम्प्ट सेट करें",
|
||||||
"description": "सभी भविष्य के वार्तालापों के लिए डिफ़ॉल्ट सिस्टम व्यवहार निर्देश सेट करें",
|
"description": "सभी भविष्य की बातचीत के लिए डिफ़ॉल्ट सिस्टम व्यवहार निर्देश सेट करें",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "उदाहरण",
|
"name": "उदाहरण",
|
||||||
"description": "सिस्टम प्रॉम्प्ट सेट करने के लिए HA टेक्स्ट AI उदाहरण का नाम"
|
"description": "सिस्टम प्रॉम्प्ट सेट करने के लिए एचए टेक्स्ट एआई उदाहरण का नाम"
|
||||||
},
|
},
|
||||||
"prompt": {
|
"prompt": {
|
||||||
"name": "सिस्टम प्रॉम्प्ट",
|
"name": "सिस्टम प्रॉम्प्ट",
|
||||||
"description": "निर्देश जो परिभाषित करते हैं कि AI को कैसे व्यवहार करना चाहिए और जवाब देना चाहिए"
|
"description": "निर्देश जो यह परिभाषित करते हैं कि एआई को कैसे व्यवहार करना चाहिए और प्रतिक्रिया देनी चाहिए"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,14 +191,14 @@
|
|||||||
"name": "{name}",
|
"name": "{name}",
|
||||||
"state": {
|
"state": {
|
||||||
"ready": "तैयार",
|
"ready": "तैयार",
|
||||||
"processing": "प्रक्रियाधीन",
|
"processing": "प्रसंस्करण",
|
||||||
"error": "त्रुटि",
|
"error": "त्रुटि",
|
||||||
"disconnected": "डिस्कनेक्टेड",
|
"disconnected": "असंयुक्त",
|
||||||
"rate_limited": "दर सीमित",
|
"rate_limited": "रेट सीमित",
|
||||||
"maintenance": "रखरखाव",
|
"maintenance": "रखरखाव",
|
||||||
"initializing": "आरंभिकरण",
|
"initializing": "प्रारंभिककरण",
|
||||||
"retrying": "पुनः प्रयास कर रहा है",
|
"retrying": "पुनः प्रयास कर रहा है",
|
||||||
"queued": "कतारबद्ध"
|
"queued": "क्यू में"
|
||||||
},
|
},
|
||||||
"state_attributes": {
|
"state_attributes": {
|
||||||
"question": {
|
"question": {
|
||||||
@@ -188,46 +220,46 @@
|
|||||||
"name": "सिस्टम प्रॉम्प्ट"
|
"name": "सिस्टम प्रॉम्प्ट"
|
||||||
},
|
},
|
||||||
"response_time": {
|
"response_time": {
|
||||||
"name": "अंतिम प्रतिक्रिया समय"
|
"name": "अंतिम प्रतिक्रिया का समय"
|
||||||
},
|
},
|
||||||
"total_responses": {
|
"total_responses": {
|
||||||
"name": "कुल प्रतिक्रियाएँ"
|
"name": "कुल प्रतिक्रियाएं"
|
||||||
},
|
},
|
||||||
"error_count": {
|
"error_count": {
|
||||||
"name": "त्रुटि गणना"
|
"name": "त्रुटियों की संख्या"
|
||||||
},
|
},
|
||||||
"last_error": {
|
"last_error": {
|
||||||
"name": "अंतिम त्रुटि"
|
"name": "अंतिम त्रुटि"
|
||||||
},
|
},
|
||||||
"api_status": {
|
"api_status": {
|
||||||
"name": "API स्थिति"
|
"name": "एपीआई स्थिति"
|
||||||
},
|
},
|
||||||
"tokens_used": {
|
"tokens_used": {
|
||||||
"name": "कुल टोकन उपयोग किए गए"
|
"name": "कुल उपयोग किए गए टोकन"
|
||||||
},
|
},
|
||||||
"average_response_time": {
|
"average_response_time": {
|
||||||
"name": "औसत प्रतिक्रिया समय"
|
"name": "औसत प्रतिक्रिया समय"
|
||||||
},
|
},
|
||||||
"last_request_time": {
|
"last_request_time": {
|
||||||
"name": "अंतिम अनुरोध समय"
|
"name": "अंतिम अनुरोध का समय"
|
||||||
},
|
},
|
||||||
"is_processing": {
|
"is_processing": {
|
||||||
"name": "प्रसंस्करण स्थिति"
|
"name": "प्रसंस्करण स्थिति"
|
||||||
},
|
},
|
||||||
"is_rate_limited": {
|
"is_rate_limited": {
|
||||||
"name": "दर सीमित स्थिति"
|
"name": "रेट सीमित स्थिति"
|
||||||
},
|
},
|
||||||
"is_maintenance": {
|
"is_maintenance": {
|
||||||
"name": "रखरखाव स्थिति"
|
"name": "रखरखाव स्थिति"
|
||||||
},
|
},
|
||||||
"api_version": {
|
"api_version": {
|
||||||
"name": "API संस्करण"
|
"name": "एपीआई संस्करण"
|
||||||
},
|
},
|
||||||
"endpoint_status": {
|
"endpoint_status": {
|
||||||
"name": "एंडपॉइंट स्थिति"
|
"name": "एंडपॉइंट स्थिति"
|
||||||
},
|
},
|
||||||
"performance_metrics": {
|
"performance_metrics": {
|
||||||
"name": "प्रदर्शन मेट्रिक्स"
|
"name": "प्रदर्शन मैट्रिक्स"
|
||||||
},
|
},
|
||||||
"history_size": {
|
"history_size": {
|
||||||
"name": "इतिहास का आकार"
|
"name": "इतिहास का आकार"
|
||||||
@@ -242,13 +274,13 @@
|
|||||||
"name": "प्रॉम्प्ट टोकन"
|
"name": "प्रॉम्प्ट टोकन"
|
||||||
},
|
},
|
||||||
"completion_tokens": {
|
"completion_tokens": {
|
||||||
"name": "पूर्ण टोकन"
|
"name": "पूर्णता टोकन"
|
||||||
},
|
},
|
||||||
"successful_requests": {
|
"successful_requests": {
|
||||||
"name": "सफल अनुरोध"
|
"name": "सफल अनुरोध"
|
||||||
},
|
},
|
||||||
"failed_requests": {
|
"failed_requests": {
|
||||||
"name": "असफल अनुरोध"
|
"name": "विफल अनुरोध"
|
||||||
},
|
},
|
||||||
"average_latency": {
|
"average_latency": {
|
||||||
"name": "औसत विलंबता"
|
"name": "औसत विलंबता"
|
||||||
|
|||||||
@@ -2,86 +2,118 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"provider": {
|
"provider": {
|
||||||
"title": "Seleziona Provider AI",
|
"title": "Seleziona fornitore AI",
|
||||||
"description": "Scegli quale provider di servizio AI utilizzare per questa istanza.",
|
"description": "Scegli quale fornitore di servizi AI utilizzare per questa istanza.",
|
||||||
"data": {
|
"data": {
|
||||||
"api_provider": "Provider API",
|
"api_provider": "Fornitore API",
|
||||||
"context_messages": "Numero di messaggi di contesto da conservare (1-20)"
|
"context_messages": "Numero di messaggi di contesto da mantenere (1-20)",
|
||||||
|
"max_history_size": "Dimensione massima della cronologia delle conversazioni (1-100)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provider": {
|
||||||
|
"title": "Impostazioni fornitore",
|
||||||
|
"description": "Fornisci i dettagli di connessione per il tuo fornitore di AI scelto.",
|
||||||
|
"data": {
|
||||||
|
"name": "Nome dell'istanza (es. 'Assistente GPT', 'Aiuto Claude')",
|
||||||
|
"api_key": "Chiave API per l'autenticazione",
|
||||||
|
"model": "Modello AI da utilizzare",
|
||||||
|
"api_endpoint": "URL dell'endpoint API personalizzato (opzionale)",
|
||||||
|
"temperature": "Creatività della risposta (0-2, più basso = più focalizzato)",
|
||||||
|
"max_tokens": "Lunghezza massima della risposta (1-100000 token)",
|
||||||
|
"request_interval": "Tempo minimo tra le richieste (0.1-60 secondi)",
|
||||||
|
"context_messages": "Numero di messaggi di contesto da mantenere (1-20)",
|
||||||
|
"max_history_size": "Dimensione massima della cronologia delle conversazioni (1-100)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"title": "Configura Istanza HA Text AI",
|
"title": "Configura istanza AI di testo HA",
|
||||||
"description": "Configura una nuova istanza di assistente AI con il provider selezionato.",
|
"description": "Imposta una nuova istanza di assistente AI con il fornitore selezionato.",
|
||||||
"data": {
|
"data": {
|
||||||
"name": "Nome dell'istanza (es. 'Assistente GPT', 'Aiutante Claude')",
|
"name": "Nome dell'istanza (es. 'Assistente GPT', 'Aiuto Claude')",
|
||||||
"api_key": "Chiave API per l'autenticazione",
|
"api_key": "Chiave API per l'autenticazione",
|
||||||
"model": "Modello AI da utilizzare",
|
"model": "Modello AI da utilizzare",
|
||||||
"temperature": "Creatività della risposta (0-2, più basso = più focalizzato)",
|
"temperature": "Creatività della risposta (0-2, più basso = più focalizzato)",
|
||||||
"max_tokens": "Lunghezza massima della risposta (1-4096 token)",
|
"max_tokens": "Lunghezza massima della risposta (1-100000 token)",
|
||||||
"api_endpoint": "URL endpoint API personalizzato (opzionale)",
|
"api_endpoint": "URL dell'endpoint API personalizzato (opzionale)",
|
||||||
"api_provider": "Provider API",
|
"api_provider": "Fornitore API",
|
||||||
"request_interval": "Tempo minimo tra le richieste (0,1-60 secondi)",
|
"request_interval": "Tempo minimo tra le richieste (0.1-60 secondi)",
|
||||||
"context_messages": "Numero di messaggi di contesto da conservare (1-20)",
|
"context_messages": "Numero di messaggi di contesto da mantenere (1-20)",
|
||||||
"max_history_size": "Dimensione massima della cronologia delle conversazioni (1-100)"
|
"max_history_size": "Dimensione massima della cronologia delle conversazioni (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"name_exists": "Un'istanza con questo nome esiste già",
|
"history_storage_error": "Impossibile inizializzare la memorizzazione della cronologia. Controlla i permessi.",
|
||||||
|
"history_rotation_error": "Errore durante la rotazione del file di cronologia.",
|
||||||
|
"history_file_access_error": "Impossibile accedere alla directory di memorizzazione della cronologia.",
|
||||||
|
"name_exists": "Esiste già un'istanza con questo nome",
|
||||||
"invalid_name": "Nome dell'istanza non valido",
|
"invalid_name": "Nome dell'istanza non valido",
|
||||||
"invalid_auth": "Autenticazione fallita - controlla la tua chiave API",
|
"invalid_auth": "Autenticazione fallita - controlla la tua chiave API",
|
||||||
"invalid_api_key": "Chiave API non valida - verifica le tue credenziali",
|
"invalid_api_key": "Chiave API non valida - verifica le tue credenziali",
|
||||||
"cannot_connect": "Impossibile connettersi al servizio API",
|
"cannot_connect": "Impossibile connettersi al servizio API",
|
||||||
"invalid_model": "Il modello selezionato non è disponibile",
|
"invalid_model": "Il modello selezionato non è disponibile",
|
||||||
"rate_limit": "Limite di velocità superato",
|
"rate_limit": "Limite di frequenza superato",
|
||||||
"context_length": "Lunghezza del contesto superata",
|
"context_length": "Lunghezza del contesto superata",
|
||||||
"rate_limit_exceeded": "Limite di velocità API superato",
|
"rate_limit_exceeded": "Limite di frequenza API superato",
|
||||||
"maintenance": "Il servizio è in manutenzione",
|
"maintenance": "Il servizio è in manutenzione",
|
||||||
"invalid_response": "Risposta API non valida ricevuta",
|
"invalid_response": "Risposta API non valida ricevuta",
|
||||||
"api_error": "Si è verificato un errore del servizio API",
|
"api_error": "Si è verificato un errore nel servizio API",
|
||||||
"timeout": "Richiesta scaduta",
|
"timeout": "Richiesta scaduta",
|
||||||
"invalid_instance": "Istanza non valida specificata",
|
"invalid_instance": "Istanze specificata non valida",
|
||||||
"unknown": "Si è verificato un errore imprevisto",
|
"unknown": "Si è verificato un errore imprevisto",
|
||||||
"empty": "Il nome non può essere vuoto",
|
"empty": "Il nome non può essere vuoto",
|
||||||
"invalid_characters": "Il nome può contenere solo lettere, numeri, spazi, trattini bassi e trattini",
|
"invalid_characters": "Il nome può contenere solo lettere, numeri, spazi, trattini bassi e trattini",
|
||||||
"name_too_long": "Il nome non può superare i 50 caratteri"
|
"name_too_long": "Il nome deve essere lungo 50 caratteri o meno"
|
||||||
|
},
|
||||||
|
"abort": {
|
||||||
|
"already_configured": "Istanze già configurata"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"title": "Aggiorna Impostazioni Istanza",
|
"title": "Aggiorna impostazioni dell'istanza",
|
||||||
"description": "Modifica le impostazioni per questa istanza di assistente AI.",
|
"description": "Modifica le impostazioni per questa istanza di assistente AI.",
|
||||||
"data": {
|
"data": {
|
||||||
"model": "Modello AI",
|
"model": "Modello AI",
|
||||||
"temperature": "Creatività della risposta (0-2)",
|
"temperature": "Creatività della risposta (0-2)",
|
||||||
"max_tokens": "Lunghezza massima della risposta (1-4096)",
|
"max_tokens": "Lunghezza massima della risposta (1-100000)",
|
||||||
"request_interval": "Intervallo minimo tra le richieste (0,1-60 secondi)",
|
"request_interval": "Intervallo minimo di richiesta (0.1-60 secondi)",
|
||||||
"context_messages": "Numero di messaggi precedenti da includere nel contesto (1-20)",
|
"context_messages": "Numero di messaggi precedenti da includere nel contesto (1-20)",
|
||||||
"max_history_size": "Dimensione massima della cronologia delle conversazioni (1-100)"
|
"max_history_size": "Dimensione massima della cronologia delle conversazioni (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"selector": {
|
||||||
|
"api_provider": {
|
||||||
|
"options": {
|
||||||
|
"openai": "OpenAI (compatibile)",
|
||||||
|
"anthropic": "Anthropic (compatibile)",
|
||||||
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"ask_question": {
|
"ask_question": {
|
||||||
"name": "Fai una Domanda (HA Text AI)",
|
"name": "Fai una domanda (HA Text AI)",
|
||||||
"description": "Invia una domanda al modello AI e ricevi una risposta dettagliata. La risposta verrà memorizzata nella cronologia delle conversazioni e potrà essere recuperata in seguito.",
|
"description": "Invia una domanda al modello AI e ricevi una risposta dettagliata. La risposta sarà memorizzata nella cronologia delle conversazioni e potrà essere recuperata in seguito.",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Istanza",
|
"name": "Istanze",
|
||||||
"description": "Nome dell'istanza HA Text AI da utilizzare"
|
"description": "Nome dell'istanza HA Text AI da utilizzare"
|
||||||
},
|
},
|
||||||
"question": {
|
"question": {
|
||||||
"name": "Domanda",
|
"name": "Domanda",
|
||||||
"description": "La tua domanda o prompt per l'assistente AI"
|
"description": "La tua domanda o richiesta per l'assistente AI"
|
||||||
},
|
},
|
||||||
"context_messages": {
|
"context_messages": {
|
||||||
"name": "Messaggi di Contesto",
|
"name": "Messaggi di contesto",
|
||||||
"description": "Numero di messaggi precedenti da includere nel contesto (1-20)"
|
"description": "Numero di messaggi precedenti da includere nel contesto (1-20)"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "Prompt di Sistema",
|
"name": "Prompt di sistema",
|
||||||
"description": "Prompt di sistema opzionale per impostare il contesto per questa specifica domanda"
|
"description": "Prompt di sistema opzionale per impostare il contesto per questa specifica domanda"
|
||||||
},
|
},
|
||||||
"model": {
|
"model": {
|
||||||
@@ -93,62 +125,62 @@
|
|||||||
"description": "Controlla la creatività della risposta (0.0-2.0)"
|
"description": "Controlla la creatività della risposta (0.0-2.0)"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "Max Token",
|
"name": "Token massimi",
|
||||||
"description": "Lunghezza massima della risposta (1-4096 token)"
|
"description": "Lunghezza massima della risposta (1-100000 token)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clear_history": {
|
"clear_history": {
|
||||||
"name": "Cancella Cronologia",
|
"name": "Cancella cronologia",
|
||||||
"description": "Elimina tutte le domande e le risposte memorizzate dalla cronologia delle conversazioni",
|
"description": "Elimina tutte le domande e risposte memorizzate dalla cronologia delle conversazioni",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Istanza",
|
"name": "Istanze",
|
||||||
"description": "Nome dell'istanza HA Text AI per cui cancellare la cronologia"
|
"description": "Nome dell'istanza HA Text AI per cui cancellare la cronologia"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"get_history": {
|
"get_history": {
|
||||||
"name": "Ottieni Cronologia",
|
"name": "Ottieni cronologia",
|
||||||
"description": "Recupera la cronologia delle conversazioni con filtro e ordinamento opzionali",
|
"description": "Recupera la cronologia delle conversazioni con opzioni di filtro e ordinamento",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Istanza",
|
"name": "Istanze",
|
||||||
"description": "Nome dell'istanza HA Text AI da cui ottenere la cronologia"
|
"description": "Nome dell'istanza HA Text AI da cui recuperare la cronologia"
|
||||||
},
|
},
|
||||||
"limit": {
|
"limit": {
|
||||||
"name": "Limite",
|
"name": "Limite",
|
||||||
"description": "Numero di conversazioni da restituire (1-100)"
|
"description": "Numero di conversazioni da restituire (1-100)"
|
||||||
},
|
},
|
||||||
"filter_model": {
|
"filter_model": {
|
||||||
"name": "Filtro Modello",
|
"name": "Filtra modello",
|
||||||
"description": "Filtra le conversazioni per specifico modello AI"
|
"description": "Filtra le conversazioni per modello AI specifico"
|
||||||
},
|
},
|
||||||
"start_date": {
|
"start_date": {
|
||||||
"name": "Data di Inizio",
|
"name": "Data di inizio",
|
||||||
"description": "Filtra le conversazioni a partire da questa data/ora"
|
"description": "Filtra le conversazioni a partire da questa data/ora"
|
||||||
},
|
},
|
||||||
"include_metadata": {
|
"include_metadata": {
|
||||||
"name": "Includi Metadati",
|
"name": "Includi metadati",
|
||||||
"description": "Includi informazioni aggiuntive come token utilizzati, tempo di risposta, ecc."
|
"description": "Includi informazioni aggiuntive come token utilizzati, tempo di risposta, ecc."
|
||||||
},
|
},
|
||||||
"sort_order": {
|
"sort_order": {
|
||||||
"name": "Ordine di Ordinamento",
|
"name": "Ordine di ordinamento",
|
||||||
"description": "Ordine di ordinamento per i risultati (più recente o più vecchio per primo)"
|
"description": "Ordine di ordinamento per i risultati (più recenti o più vecchi per primi)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"set_system_prompt": {
|
"set_system_prompt": {
|
||||||
"name": "Imposta Prompt di Sistema",
|
"name": "Imposta prompt di sistema",
|
||||||
"description": "Imposta le istruzioni di comportamento predefinite del sistema per tutte le future conversazioni",
|
"description": "Imposta le istruzioni di comportamento predefinite per tutte le future conversazioni",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Istanza",
|
"name": "Istanze",
|
||||||
"description": "Nome dell'istanza HA Text AI per cui impostare il prompt di sistema"
|
"description": "Nome dell'istanza HA Text AI per cui impostare il prompt di sistema"
|
||||||
},
|
},
|
||||||
"prompt": {
|
"prompt": {
|
||||||
"name": "Prompt di Sistema",
|
"name": "Prompt di sistema",
|
||||||
"description": "Istruzioni che definiscono come l'IA dovrebbe comportarsi e rispondere"
|
"description": "Istruzioni che definiscono come l'AI dovrebbe comportarsi e rispondere"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,108 +191,108 @@
|
|||||||
"name": "{name}",
|
"name": "{name}",
|
||||||
"state": {
|
"state": {
|
||||||
"ready": "Pronto",
|
"ready": "Pronto",
|
||||||
"processing": "In elaborazione",
|
"processing": "Elaborazione",
|
||||||
"error": "Errore",
|
"error": "Errore",
|
||||||
"disconnected": "Disconnesso",
|
"disconnected": "Disconnesso",
|
||||||
"rate_limited": "Limite di Velocità Raggiunto",
|
"rate_limited": "Limite di frequenza",
|
||||||
"maintenance": "Manutenzione",
|
"maintenance": "Manutenzione",
|
||||||
"initializing": "Inizializzazione",
|
"initializing": "Inizializzazione",
|
||||||
"retrying": "Riprovando",
|
"retrying": "Riprova",
|
||||||
"queued": "In coda"
|
"queued": "In coda"
|
||||||
},
|
},
|
||||||
"state_attributes": {
|
"state_attributes": {
|
||||||
"question": {
|
"question": {
|
||||||
"name": "Ultima Domanda"
|
"name": "Ultima domanda"
|
||||||
},
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"name": "Ultima Risposta"
|
"name": "Ultima risposta"
|
||||||
},
|
},
|
||||||
"model": {
|
"model": {
|
||||||
"name": "Modello Attuale"
|
"name": "Modello attuale"
|
||||||
},
|
},
|
||||||
"temperature": {
|
"temperature": {
|
||||||
"name": "Temperatura"
|
"name": "Temperatura"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "Max Token"
|
"name": "Token massimi"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "Prompt di Sistema"
|
"name": "Prompt di sistema"
|
||||||
},
|
},
|
||||||
"response_time": {
|
"response_time": {
|
||||||
"name": "Tempo di Risposta Ultima"
|
"name": "Ultimo tempo di risposta"
|
||||||
},
|
},
|
||||||
"total_responses": {
|
"total_responses": {
|
||||||
"name": "Totale Risposte"
|
"name": "Risposte totali"
|
||||||
},
|
},
|
||||||
"error_count": {
|
"error_count": {
|
||||||
"name": "Numero di Errori"
|
"name": "Conteggio errori"
|
||||||
},
|
},
|
||||||
"last_error": {
|
"last_error": {
|
||||||
"name": "Ultimo Errore"
|
"name": "Ultimo errore"
|
||||||
},
|
},
|
||||||
"api_status": {
|
"api_status": {
|
||||||
"name": "Stato API"
|
"name": "Stato API"
|
||||||
},
|
},
|
||||||
"tokens_used": {
|
"tokens_used": {
|
||||||
"name": "Totale Token Utilizzati"
|
"name": "Token totali utilizzati"
|
||||||
},
|
},
|
||||||
"average_response_time": {
|
"average_response_time": {
|
||||||
"name": "Tempo di Risposta Medio"
|
"name": "Tempo medio di risposta"
|
||||||
},
|
},
|
||||||
"last_request_time": {
|
"last_request_time": {
|
||||||
"name": "Tempo Ultima Richiesta"
|
"name": "Ultimo tempo di richiesta"
|
||||||
},
|
},
|
||||||
"is_processing": {
|
"is_processing": {
|
||||||
"name": "Stato Elaborazione"
|
"name": "Stato di elaborazione"
|
||||||
},
|
},
|
||||||
"is_rate_limited": {
|
"is_rate_limited": {
|
||||||
"name": "Stato Limite Velocità"
|
"name": "Stato limite di frequenza"
|
||||||
},
|
},
|
||||||
"is_maintenance": {
|
"is_maintenance": {
|
||||||
"name": "Stato Manutenzione"
|
"name": "Stato di manutenzione"
|
||||||
},
|
},
|
||||||
"api_version": {
|
"api_version": {
|
||||||
"name": "Versione API"
|
"name": "Versione API"
|
||||||
},
|
},
|
||||||
"endpoint_status": {
|
"endpoint_status": {
|
||||||
"name": "Stato Endpoint"
|
"name": "Stato dell'endpoint"
|
||||||
},
|
},
|
||||||
"performance_metrics": {
|
"performance_metrics": {
|
||||||
"name": "Metriche Prestazioni"
|
"name": "Metriche di prestazione"
|
||||||
},
|
},
|
||||||
"history_size": {
|
"history_size": {
|
||||||
"name": "Dimensione Cronologia"
|
"name": "Dimensione della cronologia"
|
||||||
},
|
},
|
||||||
"uptime": {
|
"uptime": {
|
||||||
"name": "Tempo di Funzionamento"
|
"name": "Tempo di attività"
|
||||||
},
|
},
|
||||||
"total_tokens": {
|
"total_tokens": {
|
||||||
"name": "Totale Token"
|
"name": "Token totali"
|
||||||
},
|
},
|
||||||
"prompt_tokens": {
|
"prompt_tokens": {
|
||||||
"name": "Token Prompt"
|
"name": "Token di prompt"
|
||||||
},
|
},
|
||||||
"completion_tokens": {
|
"completion_tokens": {
|
||||||
"name": "Token Completamento"
|
"name": "Token di completamento"
|
||||||
},
|
},
|
||||||
"successful_requests": {
|
"successful_requests": {
|
||||||
"name": "Richieste Riuscite"
|
"name": "Richieste riuscite"
|
||||||
},
|
},
|
||||||
"failed_requests": {
|
"failed_requests": {
|
||||||
"name": "Richieste Fallite"
|
"name": "Richieste fallite"
|
||||||
},
|
},
|
||||||
"average_latency": {
|
"average_latency": {
|
||||||
"name": "Latency Media"
|
"name": "Latenza media"
|
||||||
},
|
},
|
||||||
"max_latency": {
|
"max_latency": {
|
||||||
"name": "Latency Massima"
|
"name": "Latenza massima"
|
||||||
},
|
},
|
||||||
"min_latency": {
|
"min_latency": {
|
||||||
"name": "Latency Minima"
|
"name": "Latenza minima"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,99 +2,131 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"provider": {
|
"provider": {
|
||||||
"title": "Выбор поставщика ИИ",
|
"title": "Выбор провайдера ИИ",
|
||||||
"description": "Выберите поставщика услуг ИИ для этой инстанции.",
|
"description": "Выберите сервис искусственного интеллекта для этого экземпляра.",
|
||||||
"data": {
|
"data": {
|
||||||
"api_provider": "Поставщик API",
|
"api_provider": "Провайдер API",
|
||||||
"context_messages": "Количество контекстных сообщений для сохранения (1-20)"
|
"context_messages": "Количество сохраняемых контекстных сообщений (1-20)",
|
||||||
|
"max_history_size": "Максимальный размер истории разговора (1-100)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provider": {
|
||||||
|
"title": "Настройки провайдера",
|
||||||
|
"description": "Укажите параметры подключения для выбранного провайдера ИИ.",
|
||||||
|
"data": {
|
||||||
|
"name": "Название экземпляра (например, 'GPT Помощник', 'Клод Ассистент')",
|
||||||
|
"api_key": "API-ключ для аутентификации",
|
||||||
|
"model": "Модель ИИ для использования",
|
||||||
|
"api_endpoint": "Пользовательский URL-адрес конечной точки API (необязательно)",
|
||||||
|
"temperature": "Креативность ответа (0-2, меньше = более сфокусированно)",
|
||||||
|
"max_tokens": "Максимальная длина ответа (1-100000 токенов)",
|
||||||
|
"request_interval": "Минимальный интервал между запросами (0.1-60 секунд)",
|
||||||
|
"context_messages": "Количество сохраняемых контекстных сообщений (1-20)",
|
||||||
|
"max_history_size": "Максимальный размер истории разговора (1-100)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"title": "Настройка инстанции HA Text AI",
|
"title": "Настройка экземпляра текстового ИИ для Home Assistant",
|
||||||
"description": "Настройте новую инстанцию помощника ИИ с выбранным вами поставщиком.",
|
"description": "Настройте новый экземпляр ИИ-помощника с выбранным провайдером.",
|
||||||
"data": {
|
"data": {
|
||||||
"name": "Имя инстанции (например, 'GPT Assistant', 'Claude Helper')",
|
"name": "Название экземпляра (например, 'GPT Помощник', 'Клод Ассистент')",
|
||||||
"api_key": "API-ключ для аутентификации",
|
"api_key": "API-ключ для аутентификации",
|
||||||
"model": "Используемая модель ИИ",
|
"model": "Модель ИИ для использования",
|
||||||
"temperature": "Креативность ответа (0-2, чем ниже, тем больше фокусировки)",
|
"temperature": "Креативность ответа (0-2, меньше = более сфокусированно)",
|
||||||
"max_tokens": "Максимальная длина ответа (1-4096 токенов)",
|
"max_tokens": "Максимальная длина ответа (1-100000 токенов)",
|
||||||
"api_endpoint": "Пользовательский URL-адрес конечной точки API (необязательно)",
|
"api_endpoint": "Пользовательский URL-адрес конечной точки API (необязательно)",
|
||||||
"api_provider": "Поставщик API",
|
"api_provider": "Провайдер API",
|
||||||
"request_interval": "Минимальное время между запросами (0,1-60 секунд)",
|
"request_interval": "Минимальный интервал между запросами (0.1-60 секунд)",
|
||||||
"context_messages": "Количество контекстных сообщений для сохранения (1-20)",
|
"context_messages": "Количество сохраняемых контекстных сообщений (1-20)",
|
||||||
"max_history_size": "Максимальный размер истории разговора (1-100)"
|
"max_history_size": "Максимальный размер истории разговора (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"name_exists": "Инстанция с таким именем уже существует",
|
"history_storage_error": "Не удалось инициализировать хранилище истории. Проверьте разрешения.",
|
||||||
"invalid_name": "Некорректное имя инстанции",
|
"history_rotation_error": "Ошибка при ротации файла истории.",
|
||||||
"invalid_auth": "Аутентификация не удалась - проверьте ваш API-ключ",
|
"history_file_access_error": "Невозможно получить доступ к директории хранения истории.",
|
||||||
"invalid_api_key": "Неверный API-ключ - проверьте ваши учетные данные",
|
"name_exists": "Экземпляр с таким именем уже существует",
|
||||||
"cannot_connect": "Не удалось подключиться к службе API",
|
"invalid_name": "Недопустимое имя экземпляра",
|
||||||
|
"invalid_auth": "Ошибка аутентификации - проверьте API-ключ",
|
||||||
|
"invalid_api_key": "Недопустимый API-ключ - пожалуйста, проверьте учетные данные",
|
||||||
|
"cannot_connect": "Не удалось подключиться к сервису API",
|
||||||
"invalid_model": "Выбранная модель недоступна",
|
"invalid_model": "Выбранная модель недоступна",
|
||||||
"rate_limit": "Превышен лимит запросов",
|
"rate_limit": "Превышен лимит запросов",
|
||||||
"context_length": "Превышена длина контекста",
|
"context_length": "Превышена длина контекста",
|
||||||
"rate_limit_exceeded": "Превышен лимит запросов API",
|
"rate_limit_exceeded": "Превышен лимит запросов API",
|
||||||
"maintenance": "Сервис находится на техническом обслуживании",
|
"maintenance": "Сервис находится на техническом обслуживании",
|
||||||
"invalid_response": "Получен неверный ответ API",
|
"invalid_response": "Получен некорректный ответ API",
|
||||||
"api_error": "Произошла ошибка службы API",
|
"api_error": "Произошла ошибка сервиса API",
|
||||||
"timeout": "Запрос превысил время ожидания",
|
"timeout": "Время ожидания запроса истекло",
|
||||||
"invalid_instance": "Указана неверная инстанция",
|
"invalid_instance": "Указан некорректный экземпляр",
|
||||||
"unknown": "Произошла непредвиденная ошибка",
|
"unknown": "Произошла непредвиденная ошибка",
|
||||||
"empty": "Имя не может быть пустым",
|
"empty": "Имя не может быть пустым",
|
||||||
"invalid_characters": "Имя может содержать только буквы, цифры, пробелы, подчеркивания и дефисы",
|
"invalid_characters": "Имя может содержать только буквы, цифры, пробелы, подчеркивания и дефисы",
|
||||||
"name_too_long": "Имя должно быть не более 50 символов"
|
"name_too_long": "Имя должно быть не длиннее 50 символов"
|
||||||
|
},
|
||||||
|
"abort": {
|
||||||
|
"already_configured": "Экземпляр уже настроен"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"title": "Обновление настроек инстанции",
|
"title": "Обновление настроек экземпляра",
|
||||||
"description": "Измените настройки для этой инстанции помощника ИИ.",
|
"description": "Измените настройки для этого экземпляра ИИ-помощника.",
|
||||||
"data": {
|
"data": {
|
||||||
"model": "Модель ИИ",
|
"model": "Модель ИИ",
|
||||||
"temperature": "Креативность ответа (0-2)",
|
"temperature": "Креативность ответа (0-2)",
|
||||||
"max_tokens": "Максимальная длина ответа (1-4096)",
|
"max_tokens": "Максимальная длина ответа (1-100000)",
|
||||||
"request_interval": "Минимальный интервал между запросами (0,1-60 секунд)",
|
"request_interval": "Минимальный интервал между запросами (0.1-60 секунд)",
|
||||||
"context_messages": "Количество предыдущих сообщений для включения в контекст (1-20)",
|
"context_messages": "Количество предыдущих сообщений для включения в контекст (1-20)",
|
||||||
"max_history_size": "Максимальный размер истории разговора (1-100)"
|
"max_history_size": "Максимальный размер истории разговора (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"selector": {
|
||||||
|
"api_provider": {
|
||||||
|
"options": {
|
||||||
|
"openai": "OpenAI (совместимый)",
|
||||||
|
"anthropic": "Anthropic (совместимый)",
|
||||||
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"ask_question": {
|
"ask_question": {
|
||||||
"name": "Задать вопрос (HA Text AI)",
|
"name": "Задать вопрос (HA Text AI)",
|
||||||
"description": "Отправьте вопрос модели ИИ и получите подробный ответ. Ответ будет сохранен в истории разговора и может быть извлечен позже.",
|
"description": "Отправить вопрос модели ИИ и получить подробный ответ. Ответ будет сохранен в истории разговора и может быть получен позже.",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Инстанция",
|
"name": "Экземпляр",
|
||||||
"description": "Имя используемой инстанции HA Text AI"
|
"description": "Название экземпляра текстового ИИ для использования"
|
||||||
},
|
},
|
||||||
"question": {
|
"question": {
|
||||||
"name": "Вопрос",
|
"name": "Вопрос",
|
||||||
"description": "Ваш вопрос или запрос к помощнику ИИ"
|
"description": "Ваш вопрос или запрос к ИИ-помощнику"
|
||||||
},
|
},
|
||||||
"context_messages": {
|
"context_messages": {
|
||||||
"name": "Контекстные сообщения",
|
"name": "Контекстные сообщения",
|
||||||
"description": "Количество предыдущих сообщений для включения в контекст (1-20)"
|
"description": "Количество предыдущих сообщений для включения в контекст (1-20)"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "Системный запрос",
|
"name": "Системный промпт",
|
||||||
"description": "Необязательный системный запрос для установки контекста для этого конкретного вопроса"
|
"description": "Необязательный системный промпт для установки контекста для этого конкретного вопроса"
|
||||||
},
|
},
|
||||||
"model": {
|
"model": {
|
||||||
"name": "Модель",
|
"name": "Модель",
|
||||||
"description": "Выберите модель ИИ для использования (необязательно, переопределяет настройку по умолчанию)"
|
"description": "Выберите модель ИИ для использования (необязательно, переопределяет настройки по умолчанию)"
|
||||||
},
|
},
|
||||||
"temperature": {
|
"temperature": {
|
||||||
"name": "Температура",
|
"name": "Температура",
|
||||||
"description": "Управляет креативностью ответа (0.0-2.0)"
|
"description": "Управление креативностью ответа (0.0-2.0)"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "Макс. токенов",
|
"name": "Максимум токенов",
|
||||||
"description": "Максимальная длина ответа (1-4096 токенов)"
|
"description": "Максимальная длина ответа (1-100000 токенов)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -103,18 +135,18 @@
|
|||||||
"description": "Удалить все сохраненные вопросы и ответы из истории разговора",
|
"description": "Удалить все сохраненные вопросы и ответы из истории разговора",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Инстанция",
|
"name": "Экземпляр",
|
||||||
"description": "Имя инстанции HA Text AI, для которой нужно очистить историю"
|
"description": "Название экземпляра текстового ИИ для очистки истории"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"get_history": {
|
"get_history": {
|
||||||
"name": "Получить историю",
|
"name": "Получить историю",
|
||||||
"description": "Извлечь историю разговора с возможностью фильтрации и сортировки",
|
"description": "Получить историю разговора с дополнительной фильтрацией и сортировкой",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Инстанция",
|
"name": "Экземпляр",
|
||||||
"description": "Имя инстанции HA Text AI, из которой нужно получить историю"
|
"description": "Название экземпляра текстового ИИ для получения истории"
|
||||||
},
|
},
|
||||||
"limit": {
|
"limit": {
|
||||||
"name": "Лимит",
|
"name": "Лимит",
|
||||||
@@ -122,33 +154,33 @@
|
|||||||
},
|
},
|
||||||
"filter_model": {
|
"filter_model": {
|
||||||
"name": "Фильтр модели",
|
"name": "Фильтр модели",
|
||||||
"description": "Фильтрация разговоров по определенной модели ИИ"
|
"description": "Фильтрация разговоров по конкретной модели ИИ"
|
||||||
},
|
},
|
||||||
"start_date": {
|
"start_date": {
|
||||||
"name": "Дата начала",
|
"name": "Начальная дата",
|
||||||
"description": "Фильтрация разговоров, начиная с этой даты/времени"
|
"description": "Фильтрация разговоров, начиная с указанной даты/времени"
|
||||||
},
|
},
|
||||||
"include_metadata": {
|
"include_metadata": {
|
||||||
"name": "Включить метаданные",
|
"name": "Включить метаданные",
|
||||||
"description": "Включить дополнительную информацию, такую как использованные токены, время ответа и т.д."
|
"description": "Включить дополнительную информацию, например, использованные токены, время ответа и т.д."
|
||||||
},
|
},
|
||||||
"sort_order": {
|
"sort_order": {
|
||||||
"name": "Порядок сортировки",
|
"name": "Порядок сортировки",
|
||||||
"description": "Порядок сортировки результатов (самые новые или самые старые)"
|
"description": "Порядок сортировки результатов (сначала новые или старые)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"set_system_prompt": {
|
"set_system_prompt": {
|
||||||
"name": "Установить системный запрос",
|
"name": "Установить системный промпт",
|
||||||
"description": "Установить инструкции по умолчанию для поведения системы для всех будущих разговоров",
|
"description": "Установить инструкции по умолчанию для поведения ИИ во всех будущих разговорах",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Инстанция",
|
"name": "Экземпляр",
|
||||||
"description": "Имя инстанции HA Text AI, для которой нужно установить системный запрос"
|
"description": "Название экземпляра текстового ИИ для установки системного промпта"
|
||||||
},
|
},
|
||||||
"prompt": {
|
"prompt": {
|
||||||
"name": "Системный запрос",
|
"name": "Системный промпт",
|
||||||
"description": "Инструкции, определяющие, как ИИ должен себя вести и отвечать"
|
"description": "Инструкции, определяющие, как ИИ должен вести себя и отвечать"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,10 +214,10 @@
|
|||||||
"name": "Температура"
|
"name": "Температура"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "Макс. токенов"
|
"name": "Максимум токенов"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "Системный запрос"
|
"name": "Системный промпт"
|
||||||
},
|
},
|
||||||
"response_time": {
|
"response_time": {
|
||||||
"name": "Время последнего ответа"
|
"name": "Время последнего ответа"
|
||||||
@@ -203,7 +235,7 @@
|
|||||||
"name": "Статус API"
|
"name": "Статус API"
|
||||||
},
|
},
|
||||||
"tokens_used": {
|
"tokens_used": {
|
||||||
"name": "Использовано токенов всего"
|
"name": "Всего использовано токенов"
|
||||||
},
|
},
|
||||||
"average_response_time": {
|
"average_response_time": {
|
||||||
"name": "Среднее время ответа"
|
"name": "Среднее время ответа"
|
||||||
@@ -215,10 +247,10 @@
|
|||||||
"name": "Статус обработки"
|
"name": "Статус обработки"
|
||||||
},
|
},
|
||||||
"is_rate_limited": {
|
"is_rate_limited": {
|
||||||
"name": "Статус ограничения запросов"
|
"name": "Статус лимита запросов"
|
||||||
},
|
},
|
||||||
"is_maintenance": {
|
"is_maintenance": {
|
||||||
"name": "Статус технического обслуживания"
|
"name": "Статус обслуживания"
|
||||||
},
|
},
|
||||||
"api_version": {
|
"api_version": {
|
||||||
"name": "Версия API"
|
"name": "Версия API"
|
||||||
@@ -227,7 +259,7 @@
|
|||||||
"name": "Статус конечной точки"
|
"name": "Статус конечной точки"
|
||||||
},
|
},
|
||||||
"performance_metrics": {
|
"performance_metrics": {
|
||||||
"name": "Метрики производительности"
|
"name": "Показатели производительности"
|
||||||
},
|
},
|
||||||
"history_size": {
|
"history_size": {
|
||||||
"name": "Размер истории"
|
"name": "Размер истории"
|
||||||
@@ -239,16 +271,16 @@
|
|||||||
"name": "Всего токенов"
|
"name": "Всего токенов"
|
||||||
},
|
},
|
||||||
"prompt_tokens": {
|
"prompt_tokens": {
|
||||||
"name": "Токены запроса"
|
"name": "Токены промпта"
|
||||||
},
|
},
|
||||||
"completion_tokens": {
|
"completion_tokens": {
|
||||||
"name": "Токены завершения"
|
"name": "Токены завершения"
|
||||||
},
|
},
|
||||||
"successful_requests": {
|
"successful_requests": {
|
||||||
"name": "Успешных запросов"
|
"name": "Успешные запросы"
|
||||||
},
|
},
|
||||||
"failed_requests": {
|
"failed_requests": {
|
||||||
"name": "Неудачных запросов"
|
"name": "Неудачные запросы"
|
||||||
},
|
},
|
||||||
"average_latency": {
|
"average_latency": {
|
||||||
"name": "Средняя задержка"
|
"name": "Средняя задержка"
|
||||||
|
|||||||
@@ -2,153 +2,185 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"provider": {
|
"provider": {
|
||||||
"title": "Изаберите добављача вештачке интелигенције",
|
"title": "Изаберите AI провајдера",
|
||||||
"description": "Изаберите добављача услуга вештачке интелигенције који ћете користити за ову инстанцу.",
|
"description": "Изаберите који AI сервис провајдер да користите за ову инстанцу.",
|
||||||
"data": {
|
"data": {
|
||||||
"api_provider": "Добављач API-ја",
|
"api_provider": "API провајдер",
|
||||||
"context_messages": "Број порука контекста које треба задржати (1-20)"
|
"context_messages": "Број контекстуалних порука које треба задржати (1-20)",
|
||||||
|
"max_history_size": "Максимална величина историје разговора (1-100)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provider": {
|
||||||
|
"title": "Подешавања провајдера",
|
||||||
|
"description": "Обезбедите детаље о вези за изабраног AI провајдера.",
|
||||||
|
"data": {
|
||||||
|
"name": "Име инстанце (нпр. 'GPT Асистент', 'Claude Помоћник')",
|
||||||
|
"api_key": "API кључ за аутентификацију",
|
||||||
|
"model": "AI модел који ће се користити",
|
||||||
|
"api_endpoint": "Прилагођени URL API крајње тачке (опционо)",
|
||||||
|
"temperature": "Креативност одговора (0-2, нижа = фокусираније)",
|
||||||
|
"max_tokens": "Максимална дужина одговора (1-100000 токена)",
|
||||||
|
"request_interval": "Минимално време између захтева (0.1-60 секунди)",
|
||||||
|
"context_messages": "Број контекстуалних порука које треба задржати (1-20)",
|
||||||
|
"max_history_size": "Максимална величина историје разговора (1-100)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"title": "Конфигуришите инстанцу HA Text AI",
|
"title": "Конфигуришите HA Text AI инстанцу",
|
||||||
"description": "Поставите нову инстанцу асистента вештачке интелигенције са изабраним добављачем.",
|
"description": "Подесите нову AI асистент инстанцу са изабраним провајдером.",
|
||||||
"data": {
|
"data": {
|
||||||
"name": "Назив инстанце (нпр. 'GPT Assistant', 'Claude Helper')",
|
"name": "Име инстанце (нпр. 'GPT Асистент', 'Claude Помоћник')",
|
||||||
"api_key": "API кључ за аутентификацију",
|
"api_key": "API кључ за аутентификацију",
|
||||||
"model": "Модел вештачке интелигенције који треба користити",
|
"model": "AI модел који ће се користити",
|
||||||
"temperature": "Креативност одговора (0-2, нижа = више фокусирана)",
|
"temperature": "Креативност одговора (0-2, нижа = фокусираније)",
|
||||||
"max_tokens": "Максимална дужина одговора (1-4096 токена)",
|
"max_tokens": "Максимална дужина одговора (1-100000 токена)",
|
||||||
"api_endpoint": "Прилагођени URL завршног тачка API-ја (опционо)",
|
"api_endpoint": "Прилагођени URL API крајње тачке (опционо)",
|
||||||
"api_provider": "Добављач API-ја",
|
"api_provider": "API провајдер",
|
||||||
"request_interval": "Минимално време између захтева (0.1-60 секунди)",
|
"request_interval": "Минимално време између захтева (0.1-60 секунди)",
|
||||||
"context_messages": "Број порука контекста које треба задржати (1-20)",
|
"context_messages": "Број контекстуалних порука које треба задржати (1-20)",
|
||||||
"max_history_size": "Максимална величина историје разговора (1-100)"
|
"max_history_size": "Максимална величина историје разговора (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"name_exists": "Инстанца са овим називом већ постоји",
|
"history_storage_error": "Неуспела инициализација складишта историје. Проверите дозволе.",
|
||||||
"invalid_name": "Неважећи назив инстанце",
|
"history_rotation_error": "Грешка током ротације историјских датотека.",
|
||||||
"invalid_auth": "Аутентификација није успела - проверите свој API кључ",
|
"history_file_access_error": "Немогуће приступити директоријуму складишта историје.",
|
||||||
"invalid_api_key": "Неважећи API кључ - проверите своје податке о верификацији",
|
"name_exists": "Инстанца са овим именом већ постоји",
|
||||||
"cannot_connect": "Није могуће успоставити везу са услугом API-ја",
|
"invalid_name": "Неважеће име инстанце",
|
||||||
|
"invalid_auth": "Аутентификација није успела - проверите ваш API кључ",
|
||||||
|
"invalid_api_key": "Неважећи API кључ - молимо проверите ваше акредитиве",
|
||||||
|
"cannot_connect": "Неуспело повезивање са API сервисом",
|
||||||
"invalid_model": "Изабрани модел није доступан",
|
"invalid_model": "Изабрани модел није доступан",
|
||||||
"rate_limit": "Прекорачен је лимит стопе",
|
"rate_limit": "Пређена граница захтева",
|
||||||
"context_length": "Прекорачена је дужина контекста",
|
"context_length": "Дужина контекста пређена",
|
||||||
"rate_limit_exceeded": "Прекорачен је лимит стопе API-ја",
|
"rate_limit_exceeded": "Пређена граница API захтева",
|
||||||
"maintenance": "Услуга је у фази одржавања",
|
"maintenance": "Сервис је у одржавању",
|
||||||
"invalid_response": "Примљен је неважећи одговор API-ја",
|
"invalid_response": "Примљен неважећи API одговор",
|
||||||
"api_error": "Догодила се грешка у услузи API-ја",
|
"api_error": "Дошло је до грешке у API сервису",
|
||||||
"timeout": "Захтев је истекао",
|
"timeout": "Време захтева је истекло",
|
||||||
"invalid_instance": "Наведена је неважећа инстанца",
|
"invalid_instance": "Неважећа инстанца је назначена",
|
||||||
"unknown": "Догодила се неочекивана грешка",
|
"unknown": "Дошло је до неочекиване грешке",
|
||||||
"empty": "Назив не може бити празан",
|
"empty": "Име не може бити празно",
|
||||||
"invalid_characters": "Назив може да садржи само слова, бројеве, размаке, цртице и цртице",
|
"invalid_characters": "Име може садржавати само слова, цифре, размаке, подцрта и цртице",
|
||||||
"name_too_long": "Назив мора бити 50 карактера или мање"
|
"name_too_long": "Име мора бити 50 знакова или мање"
|
||||||
|
},
|
||||||
|
"abort": {
|
||||||
|
"already_configured": "Инстанца је већ конфигурисана"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"title": "Ажурирајте подешавања инстанце",
|
"title": "Ажурирајте подешавања инстанце",
|
||||||
"description": "Измените подешавања за ову инстанцу асистента вештачке интелигенције.",
|
"description": "Измените подешавања за ову AI асистент инстанцу.",
|
||||||
"data": {
|
"data": {
|
||||||
"model": "Модел вештачке интелигенције",
|
"model": "AI модел",
|
||||||
"temperature": "Креативност одговора (0-2)",
|
"temperature": "Креативност одговора (0-2)",
|
||||||
"max_tokens": "Максимална дужина одговора (1-4096)",
|
"max_tokens": "Максимална дужина одговора (1-100000)",
|
||||||
"request_interval": "Минимални интервал захтева (0.1-60 секунди)",
|
"request_interval": "Минимално време између захтева (0.1-60 секунди)",
|
||||||
"context_messages": "Број претходних порука које треба укључити у контекст (1-20)",
|
"context_messages": "Број претходних порука које треба укључити у контекст (1-20)",
|
||||||
"max_history_size": "Максимална величина историје разговора (1-100)"
|
"max_history_size": "Максимална величина историје разговора (1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"selector": {
|
||||||
|
"api_provider": {
|
||||||
|
"options": {
|
||||||
|
"openai": "OpenAI (компатибилан)",
|
||||||
|
"anthropic": "Anthropic (компатибилан)",
|
||||||
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"ask_question": {
|
"ask_question": {
|
||||||
"name": "Поставите питање (HA Text AI)",
|
"name": "Поставите питање (HA Text AI)",
|
||||||
"description": "Пошаљите питање моделу вештачке интелигенције и добијте детаљан одговор. Одговор ће бити сачуван у историји разговора и може се касније преузети.",
|
"description": "Пошаљите питање AI моделу и примите детаљан одговор. Одговор ће бити сачуван у историји разговора и може се касније повратити.",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Инстанца",
|
"name": "Инстанца",
|
||||||
"description": "Назив инстанце HA Text AI коју треба користити"
|
"description": "Име HA Text AI инстанце коју ћете користити"
|
||||||
},
|
},
|
||||||
"question": {
|
"question": {
|
||||||
"name": "Питање",
|
"name": "Питање",
|
||||||
"description": "Ваше питање или наговештај за асистента вештачке интелигенције"
|
"description": "Ваше питање или упит за AI асистента"
|
||||||
},
|
},
|
||||||
"context_messages": {
|
"context_messages": {
|
||||||
"name": "Поруке контекста",
|
"name": "Контекстуалне поруке",
|
||||||
"description": "Број претходних порука које треба укључити у контекст (1-20)"
|
"description": "Број претходних порука које треба укључити у контекст (1-20)"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "Системски наговештај",
|
"name": "Системски упит",
|
||||||
"description": "Опциони системски наговештај за постављање контекста за ово одређено питање"
|
"description": "Опционални системски упит за постављање контекста за ово конкретно питање"
|
||||||
},
|
},
|
||||||
"model": {
|
"model": {
|
||||||
"name": "Модел",
|
"name": "Модел",
|
||||||
"description": "Изаберите модел вештачке интелигенције који треба користити (опционо, преклапа подразумевано подешавање)"
|
"description": "Изаберите AI модел који ћете користити (опционо, надмашује подразумевану поставку)"
|
||||||
},
|
},
|
||||||
"temperature": {
|
"temperature": {
|
||||||
"name": "Температура",
|
"name": "Температура",
|
||||||
"description": "Контролише креативност одговора (0.0-2.0)"
|
"description": "Контролише креативност одговора (0.0-2.0)"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "Макс. токени",
|
"name": "Максимални токени",
|
||||||
"description": "Максимална дужина одговора (1-4096 токена)"
|
"description": "Максимална дужина одговора (1-100000 токена)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clear_history": {
|
"clear_history": {
|
||||||
"name": "Обриши историју",
|
"name": "Обриши историју",
|
||||||
"description": "Обришите сва сачувана питања и одговоре из историје разговора",
|
"description": "Избришите све сачуване питања и одговоре из историје разговора",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Инстанца",
|
"name": "Инстанца",
|
||||||
"description": "Назив инстанце HA Text AI за коју треба очистити историју"
|
"description": "Име HA Text AI инстанце за коју желите да обришете историју"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"get_history": {
|
"get_history": {
|
||||||
"name": "Добиј историју",
|
"name": "Добијте историју",
|
||||||
"description": "Преузмите историју разговора са опционом филтрацијом и сортирањем",
|
"description": "Повратите историју разговора уз опционално филтрирање и сортирање",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Инстанца",
|
"name": "Инстанца",
|
||||||
"description": "Назив инстанце HA Text AI из које треба добити историју"
|
"description": "Име HA Text AI инстанце из које желите да добијете историју"
|
||||||
},
|
},
|
||||||
"limit": {
|
"limit": {
|
||||||
"name": "Лимит",
|
"name": "Лимит",
|
||||||
"description": "Број разговора који треба вратити (1-100)"
|
"description": "Број разговора које треба вратити (1-100)"
|
||||||
},
|
},
|
||||||
"filter_model": {
|
"filter_model": {
|
||||||
"name": "Филтер модела",
|
"name": "Филтер модел",
|
||||||
"description": "Филтрирајте разговоре по одређеном моделу вештачке интелигенције"
|
"description": "Филтрирајте разговоре по одређеном AI моделу"
|
||||||
},
|
},
|
||||||
"start_date": {
|
"start_date": {
|
||||||
"name": "Почетни датум",
|
"name": "Датум почетка",
|
||||||
"description": "Филтрирајте разговоре почев од овог датума/времена"
|
"description": "Филтрирајте разговоре који почињу од овог датума/времена"
|
||||||
},
|
},
|
||||||
"include_metadata": {
|
"include_metadata": {
|
||||||
"name": "Укључи метаподатке",
|
"name": "Укључи метаподатке",
|
||||||
"description": "Укључите додатне информације попут коришћених токена, времена одговора и слично."
|
"description": "Укључите додатне информације као што су коришћени токени, време одговора итд."
|
||||||
},
|
},
|
||||||
"sort_order": {
|
"sort_order": {
|
||||||
"name": "Редослед сортирања",
|
"name": "Редослед сортирања",
|
||||||
"description": "Редослед сортирања за резултате (најновији или најстарији прво)"
|
"description": "Редослед сортирања за резултате (најновији или најстарији први)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"set_system_prompt": {
|
"set_system_prompt": {
|
||||||
"name": "Поставите системски наговештај",
|
"name": "Поставите системски упит",
|
||||||
"description": "Поставите подразумевана упутства за понашање система за све будуће разговоре",
|
"description": "Поставите подразумеване инструкције за системско понашање за све будуће разговоре",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "Инстанца",
|
"name": "Инстанца",
|
||||||
"description": "Назив инстанце HA Text AI за коју треба поставити системски наговештај"
|
"description": "Име HA Text AI инстанце за коју желите да поставите системски упит"
|
||||||
},
|
},
|
||||||
"prompt": {
|
"prompt": {
|
||||||
"name": "Системски наговештај",
|
"name": "Системски упит",
|
||||||
"description": "Упутства која дефинишу како би се вештачка интелигенција требала понашати и одговарати"
|
"description": "Инструкције које дефинишу како AI треба да се понаша и одговара"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,12 +193,12 @@
|
|||||||
"ready": "Спремно",
|
"ready": "Спремно",
|
||||||
"processing": "Обрада",
|
"processing": "Обрада",
|
||||||
"error": "Грешка",
|
"error": "Грешка",
|
||||||
"disconnected": "Искључено",
|
"disconnected": "Прекључено",
|
||||||
"rate_limited": "Лимит стопе",
|
"rate_limited": "Ограничење захтева",
|
||||||
"maintenance": "Одржавање",
|
"maintenance": "Одржавање",
|
||||||
"initializing": "Иницијализација",
|
"initializing": "Инициализује се",
|
||||||
"retrying": "Понављање",
|
"retrying": "Покушава поново",
|
||||||
"queued": "У реду чекања"
|
"queued": "У реду"
|
||||||
},
|
},
|
||||||
"state_attributes": {
|
"state_attributes": {
|
||||||
"question": {
|
"question": {
|
||||||
@@ -182,16 +214,16 @@
|
|||||||
"name": "Температура"
|
"name": "Температура"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "Макс. токени"
|
"name": "Максимални токени"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "Системски наговештај"
|
"name": "Системски упит"
|
||||||
},
|
},
|
||||||
"response_time": {
|
"response_time": {
|
||||||
"name": "Време последњег одговора"
|
"name": "Време последњег одговора"
|
||||||
},
|
},
|
||||||
"total_responses": {
|
"total_responses": {
|
||||||
"name": "Укупан број одговора"
|
"name": "Укупно одговора"
|
||||||
},
|
},
|
||||||
"error_count": {
|
"error_count": {
|
||||||
"name": "Број грешака"
|
"name": "Број грешака"
|
||||||
@@ -200,10 +232,10 @@
|
|||||||
"name": "Последња грешка"
|
"name": "Последња грешка"
|
||||||
},
|
},
|
||||||
"api_status": {
|
"api_status": {
|
||||||
"name": "Статус API-ја"
|
"name": "Статус API"
|
||||||
},
|
},
|
||||||
"tokens_used": {
|
"tokens_used": {
|
||||||
"name": "Укупно коришћених токена"
|
"name": "Укупно коришћени токени"
|
||||||
},
|
},
|
||||||
"average_response_time": {
|
"average_response_time": {
|
||||||
"name": "Просечно време одговора"
|
"name": "Просечно време одговора"
|
||||||
@@ -215,34 +247,34 @@
|
|||||||
"name": "Статус обраде"
|
"name": "Статус обраде"
|
||||||
},
|
},
|
||||||
"is_rate_limited": {
|
"is_rate_limited": {
|
||||||
"name": "Статус ограничења стопе"
|
"name": "Статус ограничења захтева"
|
||||||
},
|
},
|
||||||
"is_maintenance": {
|
"is_maintenance": {
|
||||||
"name": "Статус одржавања"
|
"name": "Статус одржавања"
|
||||||
},
|
},
|
||||||
"api_version": {
|
"api_version": {
|
||||||
"name": "Верзија API-ја"
|
"name": "Верзија API"
|
||||||
},
|
},
|
||||||
"endpoint_status": {
|
"endpoint_status": {
|
||||||
"name": "Статус завршне тачке"
|
"name": "Статус крајње тачке"
|
||||||
},
|
},
|
||||||
"performance_metrics": {
|
"performance_metrics": {
|
||||||
"name": "Метрике перформанси"
|
"name": "Перформансне метрике"
|
||||||
},
|
},
|
||||||
"history_size": {
|
"history_size": {
|
||||||
"name": "Величина историје"
|
"name": "Величина историје"
|
||||||
},
|
},
|
||||||
"uptime": {
|
"uptime": {
|
||||||
"name": "Време рада"
|
"name": "Уптиме"
|
||||||
},
|
},
|
||||||
"total_tokens": {
|
"total_tokens": {
|
||||||
"name": "Укупан број токена"
|
"name": "Укупно токена"
|
||||||
},
|
},
|
||||||
"prompt_tokens": {
|
"prompt_tokens": {
|
||||||
"name": "Токени наговештаја"
|
"name": "Токени упита"
|
||||||
},
|
},
|
||||||
"completion_tokens": {
|
"completion_tokens": {
|
||||||
"name": "Токени довршетака"
|
"name": "Токени завршетка"
|
||||||
},
|
},
|
||||||
"successful_requests": {
|
"successful_requests": {
|
||||||
"name": "Успешни захтеви"
|
"name": "Успешни захтеви"
|
||||||
|
|||||||
@@ -2,153 +2,185 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"provider": {
|
"provider": {
|
||||||
"title": "选择 AI 提供商",
|
"title": "选择AI提供者",
|
||||||
"description": "选择要用于此实例的 AI 服务提供商。",
|
"description": "选择要用于此实例的AI服务提供者。",
|
||||||
"data": {
|
"data": {
|
||||||
"api_provider": "API 提供商",
|
"api_provider": "API提供者",
|
||||||
"context_messages": "要保留的上下文消息数量 (1-20)"
|
"context_messages": "保留的上下文消息数量(1-20)",
|
||||||
|
"max_history_size": "最大对话历史大小(1-100)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provider": {
|
||||||
|
"title": "提供者设置",
|
||||||
|
"description": "提供所选AI提供者的连接详细信息。",
|
||||||
|
"data": {
|
||||||
|
"name": "实例名称(例如,'GPT助手','Claude助手')",
|
||||||
|
"api_key": "用于身份验证的API密钥",
|
||||||
|
"model": "要使用的AI模型",
|
||||||
|
"api_endpoint": "自定义API端点URL(可选)",
|
||||||
|
"temperature": "响应创造力(0-2,越低越专注)",
|
||||||
|
"max_tokens": "最大响应长度(1-100000个标记)",
|
||||||
|
"request_interval": "请求之间的最小时间(0.1-60秒)",
|
||||||
|
"context_messages": "保留的上下文消息数量(1-20)",
|
||||||
|
"max_history_size": "最大对话历史大小(1-100)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"title": "配置 HA Text AI 实例",
|
"title": "配置HA文本AI实例",
|
||||||
"description": "使用您选择的提供商设置新的 AI 助手实例。",
|
"description": "使用所选提供者设置新的AI助手实例。",
|
||||||
"data": {
|
"data": {
|
||||||
"name": "实例名称(例如,“GPT 助手”、“Claude 助手”)",
|
"name": "实例名称(例如,'GPT助手','Claude助手')",
|
||||||
"api_key": "用于身份验证的 API 密钥",
|
"api_key": "用于身份验证的API密钥",
|
||||||
"model": "要使用的 AI 模型",
|
"model": "要使用的AI模型",
|
||||||
"temperature": "回复创意度 (0-2,数值越低,回复越聚焦)",
|
"temperature": "响应创造力(0-2,越低越专注)",
|
||||||
"max_tokens": "最大回复长度(1-4096 个 Token)",
|
"max_tokens": "最大响应长度(1-100000个标记)",
|
||||||
"api_endpoint": "自定义 API 端点 URL(可选)",
|
"api_endpoint": "自定义API端点URL(可选)",
|
||||||
"api_provider": "API 提供商",
|
"api_provider": "API提供者",
|
||||||
"request_interval": "请求之间的最短时间间隔(0.1-60 秒)",
|
"request_interval": "请求之间的最小时间(0.1-60秒)",
|
||||||
"context_messages": "要保留的上下文消息数量 (1-20)",
|
"context_messages": "保留的上下文消息数量(1-20)",
|
||||||
"max_history_size": "最大对话历史记录大小 (1-100)"
|
"max_history_size": "最大对话历史大小(1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"name_exists": "已存在具有此名称的实例",
|
"history_storage_error": "无法初始化历史存储。检查权限。",
|
||||||
|
"history_rotation_error": "历史文件轮换时出错。",
|
||||||
|
"history_file_access_error": "无法访问历史存储目录。",
|
||||||
|
"name_exists": "具有此名称的实例已存在",
|
||||||
"invalid_name": "无效的实例名称",
|
"invalid_name": "无效的实例名称",
|
||||||
"invalid_auth": "身份验证失败 - 请检查您的 API 密钥",
|
"invalid_auth": "身份验证失败 - 检查您的API密钥",
|
||||||
"invalid_api_key": "无效的 API 密钥 - 请验证您的凭据",
|
"invalid_api_key": "无效的API密钥 - 请验证您的凭据",
|
||||||
"cannot_connect": "无法连接到 API 服务",
|
"cannot_connect": "无法连接到API服务",
|
||||||
"invalid_model": "所选模型不可用",
|
"invalid_model": "所选模型不可用",
|
||||||
"rate_limit": "超出速率限制",
|
"rate_limit": "超出速率限制",
|
||||||
"context_length": "上下文长度超出限制",
|
"context_length": "上下文长度超出限制",
|
||||||
"rate_limit_exceeded": "API 速率限制已超出",
|
"rate_limit_exceeded": "API速率限制超出",
|
||||||
"maintenance": "服务正在维护中",
|
"maintenance": "服务正在维护中",
|
||||||
"invalid_response": "收到无效的 API 响应",
|
"invalid_response": "收到无效的API响应",
|
||||||
"api_error": "发生 API 服务错误",
|
"api_error": "发生API服务错误",
|
||||||
"timeout": "请求超时",
|
"timeout": "请求超时",
|
||||||
"invalid_instance": "指定的实例无效",
|
"invalid_instance": "指定的实例无效",
|
||||||
"unknown": "发生意外错误",
|
"unknown": "发生意外错误",
|
||||||
"empty": "名称不能为空",
|
"empty": "名称不能为空",
|
||||||
"invalid_characters": "名称只能包含字母、数字、空格、下划线和连字符",
|
"invalid_characters": "名称只能包含字母、数字、空格、下划线和连字符",
|
||||||
"name_too_long": "名称必须为 50 个字符或更少"
|
"name_too_long": "名称必须少于50个字符"
|
||||||
|
},
|
||||||
|
"abort": {
|
||||||
|
"already_configured": "实例已配置"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"title": "更新实例设置",
|
"title": "更新实例设置",
|
||||||
"description": "修改此 AI 助手实例的设置。",
|
"description": "修改此AI助手实例的设置。",
|
||||||
"data": {
|
"data": {
|
||||||
"model": "AI 模型",
|
"model": "AI模型",
|
||||||
"temperature": "回复创意度 (0-2)",
|
"temperature": "响应创造力(0-2)",
|
||||||
"max_tokens": "最大回复长度 (1-4096)",
|
"max_tokens": "最大响应长度(1-100000)",
|
||||||
"request_interval": "最短请求间隔 (0.1-60 秒)",
|
"request_interval": "最小请求间隔(0.1-60秒)",
|
||||||
"context_messages": "包含在上下文中的先前消息数 (1-20)",
|
"context_messages": "要包含在上下文中的先前消息数量(1-20)",
|
||||||
"max_history_size": "最大对话历史记录大小 (1-100)"
|
"max_history_size": "最大对话历史大小(1-100)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"selector": {
|
||||||
|
"api_provider": {
|
||||||
|
"options": {
|
||||||
|
"openai": "OpenAI(兼容)",
|
||||||
|
"anthropic": "Anthropic(兼容)",
|
||||||
|
"deepseek": "DeepSeek",
|
||||||
|
"gemini": "Google Gemini"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"ask_question": {
|
"ask_question": {
|
||||||
"name": "提问 (HA Text AI)",
|
"name": "提问 (HA Text AI)",
|
||||||
"description": "向 AI 模型发送问题并接收详细的回复。回复将存储在对话历史记录中,以后可以检索。",
|
"description": "向AI模型发送问题并接收详细响应。响应将存储在对话历史中,可以稍后检索。",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "实例",
|
"name": "实例",
|
||||||
"description": "要使用的 HA Text AI 实例的名称"
|
"description": "要使用的HA文本AI实例名称"
|
||||||
},
|
},
|
||||||
"question": {
|
"question": {
|
||||||
"name": "问题",
|
"name": "问题",
|
||||||
"description": "您要向 AI 助手提出的问题或提示"
|
"description": "您对AI助手的问题或提示"
|
||||||
},
|
},
|
||||||
"context_messages": {
|
"context_messages": {
|
||||||
"name": "上下文消息",
|
"name": "上下文消息",
|
||||||
"description": "包含在上下文中的先前消息数 (1-20)"
|
"description": "要包含在上下文中的先前消息数量(1-20)"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "系统提示",
|
"name": "系统提示",
|
||||||
"description": "可选系统提示,用于为特定问题设置上下文"
|
"description": "可选的系统提示,用于为此特定问题设置上下文"
|
||||||
},
|
},
|
||||||
"model": {
|
"model": {
|
||||||
"name": "模型",
|
"name": "模型",
|
||||||
"description": "选择要使用的 AI 模型(可选,覆盖默认设置)"
|
"description": "选择要使用的AI模型(可选,覆盖默认设置)"
|
||||||
},
|
},
|
||||||
"temperature": {
|
"temperature": {
|
||||||
"name": "温度",
|
"name": "温度",
|
||||||
"description": "控制回复创意度 (0.0-2.0)"
|
"description": "控制响应创造力(0.0-2.0)"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "最大 Token 数",
|
"name": "最大标记数",
|
||||||
"description": "回复的最大长度(1-4096 个 Token)"
|
"description": "响应的最大长度(1-100000个标记)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clear_history": {
|
"clear_history": {
|
||||||
"name": "清除历史记录",
|
"name": "清除历史",
|
||||||
"description": "删除对话历史记录中所有存储的问题和回复",
|
"description": "删除对话历史中存储的所有问题和响应",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "实例",
|
"name": "实例",
|
||||||
"description": "要清除历史记录的 HA Text AI 实例的名称"
|
"description": "要清除历史的HA文本AI实例名称"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"get_history": {
|
"get_history": {
|
||||||
"name": "获取历史记录",
|
"name": "获取历史",
|
||||||
"description": "检索对话历史记录,并可选择进行过滤和排序",
|
"description": "检索对话历史,可选的过滤和排序",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "实例",
|
"name": "实例",
|
||||||
"description": "要从中获取历史记录的 HA Text AI 实例的名称"
|
"description": "要获取历史的HA文本AI实例名称"
|
||||||
},
|
},
|
||||||
"limit": {
|
"limit": {
|
||||||
"name": "限制",
|
"name": "限制",
|
||||||
"description": "要返回的对话数量 (1-100)"
|
"description": "要返回的对话数量(1-100)"
|
||||||
},
|
},
|
||||||
"filter_model": {
|
"filter_model": {
|
||||||
"name": "筛选模型",
|
"name": "过滤模型",
|
||||||
"description": "按特定 AI 模型筛选对话"
|
"description": "按特定AI模型过滤对话"
|
||||||
},
|
},
|
||||||
"start_date": {
|
"start_date": {
|
||||||
"name": "开始日期",
|
"name": "开始日期",
|
||||||
"description": "从该日期/时间开始筛选对话"
|
"description": "过滤从此日期/时间开始的对话"
|
||||||
},
|
},
|
||||||
"include_metadata": {
|
"include_metadata": {
|
||||||
"name": "包含元数据",
|
"name": "包含元数据",
|
||||||
"description": "包含其他信息,例如使用的 Token 数、响应时间等。"
|
"description": "包括额外信息,如使用的标记、响应时间等。"
|
||||||
},
|
},
|
||||||
"sort_order": {
|
"sort_order": {
|
||||||
"name": "排序顺序",
|
"name": "排序顺序",
|
||||||
"description": "结果的排序顺序(最新的或最早的优先)"
|
"description": "结果的排序顺序(最新或最旧优先)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"set_system_prompt": {
|
"set_system_prompt": {
|
||||||
"name": "设置系统提示",
|
"name": "设置系统提示",
|
||||||
"description": "为所有将来的对话设置默认系统行为说明",
|
"description": "为所有未来的对话设置默认的系统行为指令",
|
||||||
"fields": {
|
"fields": {
|
||||||
"instance": {
|
"instance": {
|
||||||
"name": "实例",
|
"name": "实例",
|
||||||
"description": "要为其设置系统提示的 HA Text AI 实例的名称"
|
"description": "要设置系统提示的HA文本AI实例名称"
|
||||||
},
|
},
|
||||||
"prompt": {
|
"prompt": {
|
||||||
"name": "系统提示",
|
"name": "系统提示",
|
||||||
"description": "定义 AI 如何行为和响应的说明"
|
"description": "定义AI应如何行为和响应的指令"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -158,22 +190,22 @@
|
|||||||
"ha_text_ai": {
|
"ha_text_ai": {
|
||||||
"name": "{name}",
|
"name": "{name}",
|
||||||
"state": {
|
"state": {
|
||||||
"ready": "就绪",
|
"ready": "准备就绪",
|
||||||
"processing": "处理中",
|
"processing": "处理中",
|
||||||
"error": "错误",
|
"error": "错误",
|
||||||
"disconnected": "已断开连接",
|
"disconnected": "已断开连接",
|
||||||
"rate_limited": "速率限制",
|
"rate_limited": "速率限制",
|
||||||
"maintenance": "维护",
|
"maintenance": "维护中",
|
||||||
"initializing": "初始化中",
|
"initializing": "初始化中",
|
||||||
"retrying": "重试中",
|
"retrying": "重试中",
|
||||||
"queued": "排队中"
|
"queued": "排队中"
|
||||||
},
|
},
|
||||||
"state_attributes": {
|
"state_attributes": {
|
||||||
"question": {
|
"question": {
|
||||||
"name": "最后一个问题"
|
"name": "最后问题"
|
||||||
},
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"name": "最后一个回复"
|
"name": "最后响应"
|
||||||
},
|
},
|
||||||
"model": {
|
"model": {
|
||||||
"name": "当前模型"
|
"name": "当前模型"
|
||||||
@@ -182,34 +214,34 @@
|
|||||||
"name": "温度"
|
"name": "温度"
|
||||||
},
|
},
|
||||||
"max_tokens": {
|
"max_tokens": {
|
||||||
"name": "最大 Token 数"
|
"name": "最大标记数"
|
||||||
},
|
},
|
||||||
"system_prompt": {
|
"system_prompt": {
|
||||||
"name": "系统提示"
|
"name": "系统提示"
|
||||||
},
|
},
|
||||||
"response_time": {
|
"response_time": {
|
||||||
"name": "上次回复时间"
|
"name": "最后响应时间"
|
||||||
},
|
},
|
||||||
"total_responses": {
|
"total_responses": {
|
||||||
"name": "总回复次数"
|
"name": "总响应数"
|
||||||
},
|
},
|
||||||
"error_count": {
|
"error_count": {
|
||||||
"name": "错误计数"
|
"name": "错误计数"
|
||||||
},
|
},
|
||||||
"last_error": {
|
"last_error": {
|
||||||
"name": "上次错误"
|
"name": "最后错误"
|
||||||
},
|
},
|
||||||
"api_status": {
|
"api_status": {
|
||||||
"name": "API 状态"
|
"name": "API状态"
|
||||||
},
|
},
|
||||||
"tokens_used": {
|
"tokens_used": {
|
||||||
"name": "已使用的 Token 总数"
|
"name": "总使用标记数"
|
||||||
},
|
},
|
||||||
"average_response_time": {
|
"average_response_time": {
|
||||||
"name": "平均回复时间"
|
"name": "平均响应时间"
|
||||||
},
|
},
|
||||||
"last_request_time": {
|
"last_request_time": {
|
||||||
"name": "上次请求时间"
|
"name": "最后请求时间"
|
||||||
},
|
},
|
||||||
"is_processing": {
|
"is_processing": {
|
||||||
"name": "处理状态"
|
"name": "处理状态"
|
||||||
@@ -221,7 +253,7 @@
|
|||||||
"name": "维护状态"
|
"name": "维护状态"
|
||||||
},
|
},
|
||||||
"api_version": {
|
"api_version": {
|
||||||
"name": "API 版本"
|
"name": "API版本"
|
||||||
},
|
},
|
||||||
"endpoint_status": {
|
"endpoint_status": {
|
||||||
"name": "端点状态"
|
"name": "端点状态"
|
||||||
@@ -230,19 +262,19 @@
|
|||||||
"name": "性能指标"
|
"name": "性能指标"
|
||||||
},
|
},
|
||||||
"history_size": {
|
"history_size": {
|
||||||
"name": "历史记录大小"
|
"name": "历史大小"
|
||||||
},
|
},
|
||||||
"uptime": {
|
"uptime": {
|
||||||
"name": "正常运行时间"
|
"name": "正常运行时间"
|
||||||
},
|
},
|
||||||
"total_tokens": {
|
"total_tokens": {
|
||||||
"name": "总 Token 数"
|
"name": "总标记数"
|
||||||
},
|
},
|
||||||
"prompt_tokens": {
|
"prompt_tokens": {
|
||||||
"name": "提示 Token 数"
|
"name": "提示标记数"
|
||||||
},
|
},
|
||||||
"completion_tokens": {
|
"completion_tokens": {
|
||||||
"name": "完成 Token 数"
|
"name": "完成标记数"
|
||||||
},
|
},
|
||||||
"successful_requests": {
|
"successful_requests": {
|
||||||
"name": "成功请求数"
|
"name": "成功请求数"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "HA text AI",
|
"name": "HA Text AI",
|
||||||
"render_readme": true,
|
"render_readme": true,
|
||||||
"homeassistant": "2024.11.0"
|
"homeassistant": "2024.11.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,30 @@
|
|||||||
```
|
```
|
||||||
ha-text-ai/
|
ha_text_ai/
|
||||||
│
|
├── __init__.py
|
||||||
├── custom_components/
|
├── api_client.py
|
||||||
├── ha_text_ai/
|
├── config_flow.py
|
||||||
│ ├── __init__.py
|
├── const.py
|
||||||
│ ├── config_flow.py
|
├── coordinator.py
|
||||||
│ ├── coordinator.py
|
├── icons
|
||||||
│ ├── manifest.json
|
│ ├── dark_icon.png
|
||||||
│ ├── sensor.py
|
│ ├── dark_icon@2x.png
|
||||||
│ ├── services.yaml
|
│ ├── dark_logo.png
|
||||||
│ ├── const.py
|
│ ├── dark_logo@2x.png
|
||||||
│ └── api_client.py
|
│ ├── icon.png
|
||||||
│
|
│ ├── icon@2x.png
|
||||||
├── translations/
|
│ ├── logo.png
|
||||||
│ ├── en.json
|
│ └── logo@2x.png
|
||||||
│ ├── de.json
|
├── manifest.json
|
||||||
│ └── ru.json
|
├── sensor.py
|
||||||
│
|
├── services.yaml
|
||||||
└── icons/
|
└── translations
|
||||||
├── icon.png
|
├── de.json
|
||||||
├── icon@2x.png
|
├── en.json
|
||||||
├── logo.png
|
├── es.json
|
||||||
└── logo@2x.png
|
├── hi.json
|
||||||
|
├── it.json
|
||||||
|
├── ru.json
|
||||||
|
├── sr.json
|
||||||
|
└── zh.json
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||