forked from Rockachopa/Timmy-time-dashboard
feat: persistent chat history with clear button
- Add dashboard/store.py: MessageLog dataclass singleton tracking user/agent/error messages for the lifetime of the server process - agents.py: write each chat turn to MessageLog; add GET and DELETE /agents/timmy/history routes returning the history.html partial - partials/history.html: render stored messages by role (YOU / TIMMY / SYSTEM); falls back to the Mission Control init message when empty - index.html: chat-log loads history via hx-get on page start; new CLEAR button in panel header sends hx-delete to reset the log - style.css: add .mc-btn-clear (muted, red-on-hover for the header) - tests: autouse reset_message_log fixture in conftest; 5 new history tests covering empty state, recording, offline errors, clear, and post-clear state → 32 tests total, all passing https://claude.ai/code/session_01KZMfwBpLuiv6x9GbzTqbys
This commit is contained in:
@@ -18,6 +18,15 @@ for _mod in [
|
||||
sys.modules.setdefault(_mod, MagicMock())
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def reset_message_log():
|
||||
"""Clear the in-memory chat log before and after every test."""
|
||||
from dashboard.store import message_log
|
||||
message_log.clear()
|
||||
yield
|
||||
message_log.clear()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
from dashboard.app import app
|
||||
|
||||
Reference in New Issue
Block a user