Skip to content

Commit e988d44

Browse files
author
SMKRV
committed
- Fixed version reading from manifest.json implementation
1 parent f9bfb9a commit e988d44

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

custom_components/ha_text_ai/const.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@github: https://github.com/smkrv/ha-text-ai
77
@source: https://github.com/smkrv/ha-text-ai
88
"""
9+
import os
910
from typing import Final
1011
import voluptuous as vol
1112
from homeassistant.const import Platform, CONF_API_KEY, CONF_NAME
@@ -25,6 +26,15 @@
2526
API_PROVIDER_ANTHROPIC
2627
]
2728

29+
# Read version from manifest.json
30+
MANIFEST_PATH = os.path.join(os.path.dirname(__file__), "manifest.json")
31+
try:
32+
with open(MANIFEST_PATH) as manifest_file:
33+
manifest = json.load(manifest_file)
34+
VERSION = manifest.get("version", "unknown")
35+
except Exception:
36+
VERSION = "unknown"
37+
2838
# Default endpoints
2939
DEFAULT_OPENAI_ENDPOINT: Final = "https://api.openai.com/v1"
3040
DEFAULT_ANTHROPIC_ENDPOINT: Final = "https://api.anthropic.com"

0 commit comments

Comments
 (0)