fix: Resolve production issues — history dir creation and sensor attributes > 16KB

History:
- Add defensive os.makedirs in _sync_test_directory_write to ensure
  directory exists before write test (fixes ERRNO 2 on fresh install)

Sensor attributes (fixes Recorder 16KB limit violation):
- Reduce conversation_history preview: 3 entries × 256 chars (was 5 × 4096)
- Reduce last response/question truncation to 2048 chars (was 4096)
- Reduce system_prompt in attributes to 512 chars (was 4096)
- Full data remains accessible via ha_text_ai.get_history service
This commit is contained in:
SMKRV
2026-03-12 12:43:03 +03:00
parent c45828953d
commit 4e3b4cfdb7
2 changed files with 19 additions and 14 deletions
+1
View File
@@ -123,6 +123,7 @@ class HistoryManager:
@staticmethod
def _sync_test_directory_write(test_file_path: str) -> None:
try:
os.makedirs(os.path.dirname(test_file_path), mode=0o755, exist_ok=True)
with open(test_file_path, "w") as f:
f.write("Permission test")
os.remove(test_file_path)