mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-26 17:38:36 +00:00
fix(agent): avoid overwriting manual session titles
This commit is contained in:
parent
46d16f4c28
commit
f725cf830f
2 changed files with 24 additions and 0 deletions
|
|
@ -245,6 +245,23 @@ class TestAutoTitleSession:
|
|||
auto_title_session(db, "sess-1", "hi", "hello")
|
||||
db.set_session_title.assert_called_once_with("sess-1", "New Title")
|
||||
|
||||
def test_does_not_overwrite_title_set_while_generation_was_in_flight(self):
|
||||
db = MagicMock()
|
||||
db.get_session_title.side_effect = [None, "Manual Title"]
|
||||
seen = []
|
||||
|
||||
with patch("agent.title_generator.generate_title", return_value="Auto Title"):
|
||||
auto_title_session(
|
||||
db,
|
||||
"sess-1",
|
||||
"hi",
|
||||
"hello",
|
||||
title_callback=seen.append,
|
||||
)
|
||||
|
||||
db.set_session_title.assert_not_called()
|
||||
assert seen == []
|
||||
|
||||
def test_invokes_title_callback_after_setting_title(self):
|
||||
db = MagicMock()
|
||||
db.get_session_title.return_value = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue