Skip to content

Commit 167a6eb

Browse files
committed
fix: avoid mutating frozen chat log content
1 parent 670dda1 commit 167a6eb

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

custom_components/ai_hub/conversation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from __future__ import annotations
1212

13+
from dataclasses import replace
1314
import logging
1415
from typing import Any, Literal
1516

@@ -252,7 +253,7 @@ async def _async_handle_message(
252253
original_content[:50] if len(original_content) > 50 else original_content,
253254
filtered_content[:50] if len(filtered_content) > 50 else filtered_content
254255
)
255-
last_content.content = filtered_content
256+
chat_log.content[-1] = replace(last_content, content=filtered_content)
256257

257258
# Return result from chat log
258259
return conversation.async_get_result_from_chat_log(user_input, chat_log)

custom_components/ai_hub/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"iot_class": "cloud_polling",
1010
"issue_tracker": "https://github.com/ha-china/ai_hub/issues",
1111
"requirements": ["edge-tts==7.2.7", "aiofiles", "aiohttp"],
12-
"version": "v2026.3.2"
12+
"version": "v2026.3.3"
1313
}

0 commit comments

Comments
 (0)