feat: add conversation history feature to AI assistant

- Add ConversationHistory dropdown component with list of past conversations
- Add useConversations hook for fetching and managing conversations via React Query
- Implement conversation switching with proper state management
- Fix bug where reopening panel showed new greeting instead of resuming conversation
- Fix bug where selecting from history caused conversation ID to revert
- Add server-side history context loading for resumed conversations
- Add Playwright E2E tests for conversation history feature
- Add logging for debugging conversation flow

Key changes:
- AssistantPanel: manages conversation state with localStorage persistence
- AssistantChat: header with [+] New Chat and [History] buttons
- Server: skips greeting for resumed conversations, loads history context on first message
- Fixed race condition in onConversationCreated callback
This commit is contained in:
liri
2026-01-16 21:47:58 +00:00
parent 91cc00a9d0
commit 7d761cb8d0
12 changed files with 1291 additions and 44 deletions

View File

@@ -269,18 +269,23 @@ async def assistant_chat_websocket(websocket: WebSocket, project_name: str):
elif msg_type == "start":
# Get optional conversation_id to resume
conversation_id = message.get("conversation_id")
logger.info(f"Processing start message with conversation_id={conversation_id}")
try:
# Create a new session
logger.info(f"Creating session for {project_name}")
session = await create_session(
project_name,
project_dir,
conversation_id=conversation_id,
)
logger.info(f"Session created, starting...")
# Stream the initial greeting
async for chunk in session.start():
logger.info(f"Sending chunk: {chunk.get('type')}")
await websocket.send_json(chunk)
logger.info("Session start complete")
except Exception as e:
logger.exception(f"Error starting assistant session for {project_name}")
await websocket.send_json({