Critical bug fix: Project background was being sent with EVERY message,
causing AI to respond to background instead of follow-up questions.
Problem:
- First message: User asks A, AI answers A 鉁?- Second message: User asks B, but prompt includes background again
- AI responds to background content, ignores question B 鉂?
Solution:
- Only send full prompt template (with project background) on FIRST message
- For follow-up messages, send ONLY user input (+ knowledge base if exists)
- Maintain conversation history properly
Updated: conversationService.assembleContext()
- Check if historyMessages.length === 0 (first message)
- First message: use renderUserPrompt() with all variables
- Follow-up: send userInput directly (optionally with knowledge base)
This ensures multi-turn conversations work correctly.
Major layout optimizations to increase chat area:
1. MainLayout improvements:
- Remove Content padding/margin (was 24px + 24px = 48px wasted)
- Reduce Sider width from 280px to 240px
- Set Content overflow:hidden and flex layout
2. AgentChatPage improvements:
- Replace large Card header with compact toolbar (saved ~40px)
- Remove Card wrapper (saved border/padding)
- Direct div layout for chat area
3. Other pages:
- Added padding:24px to HomePage/KnowledgePage/HistoryPage
- Maintain consistent spacing for non-chat pages
Result: Chat window now occupies ~85% of screen height instead of ~33%
Verified working: AI responses, scrolling, and UI display
1. Fixed double data unwrapping in AgentChatPage
2. Fixed API URL in sendMessageStream (use relative path /api/v1)
Verified working: AI can now respond to messages
Changed userId from '1' to 'user-mock-001' in all conversation controller methods to match the actual mock user created in database.
This fixes the 400 error when creating conversations.
Issue: projectApi and agentApi were unwrapping response.data twice:
1. request interceptor returns response.data
2. API functions returned response.data again (undefined)
This caused all API calls to fail silently with 'response.success' being undefined.
Fixed:
- projectApi: Removed redundant .data access
- agentApi: Removed redundant .data access
All API functions now correctly return the backend response:
{ success: true, data: [...] }
This fixes:
- '鑾峰彇椤圭洰鍒楄〃澶辫触' error on page load
- '鍒涘缓椤圭洰澶辫触' error when creating projects
- Any other API call failures
Issues fixed:
1. Frontend port is 3000 (not 5173)
2. Projects API returns 500 due to missing user
3. Foreign key constraint violation on projects_user_id_fkey
Solutions:
- Created create-mock-user.ts script
- Added user-mock-001 to database
- Created startup guide (娴嬭瘯鍜屽惎鍔?md)
- Created one-click launcher (涓€閿惎鍔?bat)
- Created diagnostic tool (璇婃柇闂.bat)
New files:
- backend/src/scripts/create-mock-user.ts
- 娴嬭瘯鍜屽惎鍔?md
- 涓€閿惎鍔?bat
- 璇婃柇闂.bat
- Create Day10-11-Agent Configuration System completion document
- Update development milestone, mark Day 10-11 as completed
- Update overall progress: Milestone 1 reached 80%
- Document detailed agent config features and API endpoints
Backend:
- Create project routes (GET, POST, PUT, DELETE)
- Implement projectController with CRUD operations
- Create projectService for database operations
- Add validation middleware for request validation
- Update Prisma schema (add background, researchType, deletedAt fields)
- Implement soft delete for projects
Frontend:
- Create projectApi service module
- Update useProjectStore with fetchProjects and loading state
- Connect ProjectSelector to real API with loading indicator
- Connect CreateProjectDialog to real API with error handling
- Connect EditProjectDialog to real API with loading state
- Add comprehensive error handling and user feedback
Build: Both frontend and backend build successfully