Fix Chat UI ordering, left panel updates, and add debug tools#78
Fix Chat UI ordering, left panel updates, and add debug tools#78ToolchainLab wants to merge 4 commits intomainfrom
Conversation
- **Backend**: - Injected scheduler tools (`list_schedules`, `schedule_nudge`, `delete_schedule`) into the `COACH` agent in `api/app/agents/engine.py`. - Updated `process_turn` to return `tools_used`. - Updated `SendMessageResponse` in `api/app/routes.py` to optionally include `debug_info` (agent, tools, reason). - **Frontend**: - Fixed message ordering in `ChatThread.tsx` by using `map` instead of filtering/pushing, ensuring the user message stays above the streaming assistant response. - Added `queryClient.invalidateQueries` to update the Dashboard chat list preview immediately upon sending/receiving messages. - Implemented "Chat Debug Mode" toggle in Admin panel (`web/src/pages/Admin.tsx`). - Updated `MessageBubble` to render debug info (Agent, Tools, Reason) when enabled by admin. - Regenerated OpenAPI types. - **Verification**: - Added integration tests for backend engine logic. - Validated frontend via E2E tests (`chat.spec.ts`). Co-authored-by: ToolchainLab <263750431+ToolchainLab@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- **Frontend**: - Exported `SendMessageResponse` from `web/src/api/types.ts` to satisfy TS compiler errors in `MessageBubble.tsx` and `ChatThread.tsx`. - **Backend**: - Fixed unused `membership_id` variable in `api/app/routes.py` by using it in `process_turn`. - Updated integration tests in `api/tests/test_engine_integration.py` to match the new `process_turn` return signature (3 values). (Previous changes preserved) - **Backend**: - Injected scheduler tools (`list_schedules`, `schedule_nudge`, `delete_schedule`) into the `COACH` agent. - Updated `process_turn` to return `tools_used`. - Updated `SendMessageResponse` to include `debug_info`. - **Frontend**: - Fixed message ordering in `ChatThread.tsx` (user message stays above streaming assistant). - Added dynamic dashboard updates via `queryClient.invalidateQueries`. - Implemented "Chat Debug Mode" toggle in Admin panel. - Updated `MessageBubble` to render debug info. Co-authored-by: ToolchainLab <263750431+ToolchainLab@users.noreply.github.com>
- **Frontend**: - Regenerated `web/src/api/openapi.ts` via `npm run gen:api` to ensure all schema definitions (including `SendMessageResponse` and `DebugInfo`) are present. - Exported `SendMessageResponse` in `web/src/api/types.ts`. - Updated imports in `MessageBubble.tsx` and `ChatThread.tsx` to use `types.ts`. - Verified with `npm run typecheck`. - **Backend**: - Fixed unused variable in `api/app/routes.py`. - Updated integration tests in `api/tests/test_engine_integration.py`. - Injected scheduler tools into Coach agent in `api/app/agents/engine.py`. - **UI Improvements**: - Fixed message ordering in ChatThread. - Added left panel invalidation on message send. - Added Debug Info footer to messages (admin only). Co-authored-by: ToolchainLab <263750431+ToolchainLab@users.noreply.github.com>
- Fix: Prevent user message from jumping below streaming assistant message in ChatThread. - Fix: Invalidate dashboard query to update sidebar previews. - Feat: Inject `schedule_nudge` tools into Coach agent. - Feat: Return agent routing and tool usage debug info in API. - Feat: Add Admin toggle for Chat Debug Mode to visualize agent internals. Co-authored-by: ToolchainLab <263750431+ToolchainLab@users.noreply.github.com>
This PR addresses the user's request to fix Chat UI issues (message ordering, left panel updates) and implements a debugging framework.
Key Changes:
Chat UI Fixes:
setMessagesto update the placeholder in-place.dashboardquery.Debugging Framework:
process_turnengine now returns metadata about the agent used (INTAKE,FEEDBACK,COACH) and the tools available to it. This is exposed in the API response.Agent Capabilities:
COACHagent now has access toscheduler_tools(schedule_nudge, etc.) when running in LLM mode.Verification:
uv run pytest).npm run test:e2e) to verify chat flows.MessageBubbleandChatThread.PR created automatically by Jules for task 984019606552281263 started by @ToolchainLab