mirror of
https://github.com/smkrv/ha-text-ai.git
synced 2026-07-23 23:54:02 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34e93e0045 | ||
|
|
34bfd7dfe1 | ||
|
|
e3487a48cb | ||
|
|
72a98d0076 |
@@ -53,7 +53,7 @@ cd ~/.homeassistant
|
|||||||
mkdir -p custom_components
|
mkdir -p custom_components
|
||||||
|
|
||||||
# 3. Clone the repository
|
# 3. Clone the repository
|
||||||
git clone https://github.com/smkrv/ha-text-ai.git custom_components/ha-text-ai
|
git clone https://github.com/smkrv/ha-text-ai.git custom_components/ha_text_ai
|
||||||
|
|
||||||
# 4. Restart Home Assistant
|
# 4. Restart Home Assistant
|
||||||
```
|
```
|
||||||
@@ -63,14 +63,14 @@ git clone https://github.com/smkrv/ha-text-ai.git custom_components/ha-text-ai
|
|||||||
|
|
||||||
### Basic Configuration
|
### Basic Configuration
|
||||||
```yaml
|
```yaml
|
||||||
ha-text-ai:
|
ha_text_ai:
|
||||||
api_key: your_openai_api_key
|
api_key: your_openai_api_key
|
||||||
model: gpt-3.5-turbo
|
model: gpt-3.5-turbo
|
||||||
```
|
```
|
||||||
|
|
||||||
### Advanced Configuration
|
### Advanced Configuration
|
||||||
```yaml
|
```yaml
|
||||||
ha-text-ai:
|
ha_text_ai:
|
||||||
api_key: your_openai_api_key
|
api_key: your_openai_api_key
|
||||||
model: gpt-4
|
model: gpt-4
|
||||||
temperature: 0.8
|
temperature: 0.8
|
||||||
@@ -83,7 +83,7 @@ ha-text-ai:
|
|||||||
|
|
||||||
### Ask Question
|
### Ask Question
|
||||||
```yaml
|
```yaml
|
||||||
service: ha-text-ai.ask_question
|
service: ha_text_ai.ask_question
|
||||||
data:
|
data:
|
||||||
question: "What's the weather like today?"
|
question: "What's the weather like today?"
|
||||||
model: "gpt-4" # optional
|
model: "gpt-4" # optional
|
||||||
@@ -91,9 +91,9 @@ data:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### More Services
|
### More Services
|
||||||
- `ha-text-ai.clear_history`: Reset conversation history
|
- `ha_text_ai.clear_history`: Reset conversation history
|
||||||
- `ha-text-ai.get_history`: Retrieve past interactions
|
- `ha_text_ai.get_history`: Retrieve past interactions
|
||||||
- `ha-text-ai.set_system_prompt`: Configure AI behavior
|
- `ha_text_ai.set_system_prompt`: Configure AI behavior
|
||||||
|
|
||||||
## 🔍 Advanced Usage
|
## 🔍 Advanced Usage
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ automation:
|
|||||||
entity_id: binary_sensor.motion
|
entity_id: binary_sensor.motion
|
||||||
to: 'on'
|
to: 'on'
|
||||||
action:
|
action:
|
||||||
service: ha-text-ai.ask_question
|
service: ha_text_ai.ask_question
|
||||||
data:
|
data:
|
||||||
question: "What should I do when motion is detected?"
|
question: "What should I do when motion is detected?"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"""Constants for the HA text AI integration."""
|
"""Constants for the HA text AI integration."""
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
DOMAIN = "ha-text-ai"
|
DOMAIN = "ha_text_ai"
|
||||||
PLATFORMS = [Platform.SENSOR]
|
PLATFORMS = [Platform.SENSOR]
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|||||||
@@ -10,6 +10,6 @@
|
|||||||
"homekit": {},
|
"homekit": {},
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": ["@smkrv"],
|
"codeowners": ["@smkrv"],
|
||||||
"version": "1.0.0",
|
"version": "1.0.1b",
|
||||||
"iot_class": "cloud_polling"
|
"iot_class": "cloud_polling"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# Service to ask a question
|
|
||||||
ask_question:
|
ask_question:
|
||||||
name: Ask Question
|
name: Ask Question
|
||||||
description: Send a question to the AI and get a response
|
description: Send a question to the AI and get a response
|
||||||
@@ -47,13 +46,11 @@ ask_question:
|
|||||||
max: 4000
|
max: 4000
|
||||||
step: 1
|
step: 1
|
||||||
|
|
||||||
# Service to clear response history
|
|
||||||
clear_history:
|
clear_history:
|
||||||
name: Clear History
|
name: Clear History
|
||||||
description: Clear the stored question and response history
|
description: Clear the stored question and response history
|
||||||
fields: {}
|
fields: {}
|
||||||
|
|
||||||
# Service to get response history
|
|
||||||
get_history:
|
get_history:
|
||||||
name: Get History
|
name: Get History
|
||||||
description: Get the history of questions and responses
|
description: Get the history of questions and responses
|
||||||
@@ -69,7 +66,6 @@ get_history:
|
|||||||
max: 100
|
max: 100
|
||||||
step: 1
|
step: 1
|
||||||
|
|
||||||
# Service to set system prompt
|
|
||||||
set_system_prompt:
|
set_system_prompt:
|
||||||
name: Set System Prompt
|
name: Set System Prompt
|
||||||
description: Set a system prompt that will be used for all future questions
|
description: Set a system prompt that will be used for all future questions
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user