mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Only clean up chat log if it was stored (#137399)
This commit is contained in:
parent
eded99a059
commit
417a595b73
@ -43,13 +43,6 @@ def async_get_chat_log(
|
||||
else:
|
||||
history = ChatLog(hass, session.conversation_id)
|
||||
|
||||
@callback
|
||||
def do_cleanup() -> None:
|
||||
"""Handle cleanup."""
|
||||
all_history.pop(session.conversation_id)
|
||||
|
||||
session.async_on_cleanup(do_cleanup)
|
||||
|
||||
if user_input is not None:
|
||||
history.async_add_user_content(UserContent(content=user_input.text))
|
||||
|
||||
@ -63,6 +56,15 @@ def async_get_chat_log(
|
||||
)
|
||||
return
|
||||
|
||||
if session.conversation_id not in all_history:
|
||||
|
||||
@callback
|
||||
def do_cleanup() -> None:
|
||||
"""Handle cleanup."""
|
||||
all_history.pop(session.conversation_id)
|
||||
|
||||
session.async_on_cleanup(do_cleanup)
|
||||
|
||||
all_history[session.conversation_id] = history
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user