From 862477f9d43a12c6dfc13ebf45c4aa89ca341e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=A8=E9=B1=BC=E8=BE=A3=E6=A4=92?= Date: Mon, 28 Sep 2026 12:43:39 +0800 Subject: [PATCH] feat(chat): simplify teacher pane and color follow-up cards --- .../20260928-teacher-hover-intro-a73f6e29.md | 16 ++++++++++++-- README.md | 2 +- src/pages/Chat/TeacherChatPanel.tsx | 16 ++++++-------- src/pages/Chat/classroom-workspace.css | 12 +++++++---- tests/e2e/pi-coding-first-chat.spec.ts | 7 ++++--- tests/unit/coding-chat-panel.test.tsx | 3 ++- tests/unit/coding-teacher-ui.test.tsx | 21 +++++++++---------- tests/unit/teacher-companion.test.tsx | 12 +++++------ 8 files changed, 51 insertions(+), 38 deletions(-) diff --git a/.project-docs/30-worklog/tasks/20260928-teacher-hover-intro-a73f6e29.md b/.project-docs/30-worklog/tasks/20260928-teacher-hover-intro-a73f6e29.md index e8ea0168..ffd72a12 100644 --- a/.project-docs/30-worklog/tasks/20260928-teacher-hover-intro-a73f6e29.md +++ b/.project-docs/30-worklog/tasks/20260928-teacher-hover-intro-a73f6e29.md @@ -28,10 +28,16 @@ - Gate: Passed. Plan: implement tooltip and preview clearance, simplify the panel while preserving navigation, verify relevant unit tests, browser layout and isolated Electron interactions, then document delivery. No live teacher requests, remote publication or app restart in this task. - Trial-update resume: matching start/status ownership restored to planning; prior product context rechecked, all peer scopes reviewed and unchanged. Gate passed. Existing trial metadata points to an exited process and an older checkout; installed production is a distinct running application. Plan: reuse the verified 772da4f build in the isolated trial, add a local background startup wrapper, preserve the profile/port, and verify runtime and foreground ownership read-only. Earlier no-restart constraint is superseded only for the explicitly requested trial update. +## Follow-up Plan: Reply Cards And Header Removal + +- User approved the proposed pale blue/cream/lavender follow-up cards with 16px text and requests removing the entire duplicate avatar/name header. Update the same trial afterward; the earlier no-focus constraint persists. +- Same task/worktree resumed via start/status; prior project context and peer scopes remain unchanged. Design search recommends soft playful cards; adapt only the approved colors/typography without adding fonts or unrelated layout. Gate passed. +- Change Renderer styles/header only, preserve generated suggestions, submission and per-agent drafts. Update affected existing tests, visually inspect in a headless fixture, and refresh the running trial in the background where feasible. + ## Outcome - Added a cream, rounded introduction card using the published teacher name, avatar and description. Hover or keyboard focus opens one card at a time outside the scrolling topbar; empty descriptions do not create a card. The pointer can enter the card to read long descriptions. Leaving, Escape or clicking the entry closes it; moving inside the clicked entry does not reopen it until a fresh entry. -- Removed the introduction and add/expand/close icon group from the consultation header. Clicking the selected topbar entry toggles its panel; switching entries selects that teacher. Escape restores focus to the selected teacher, per-agent drafts remain intact, drag resizing remains available, and the new-topic text action sits in expanded history. +- Removed the introduction and add/expand/close icon group initially; the approved follow-up removes the entire duplicate avatar/name header. Identity remains in the topbar and individual reply attribution. Clicking the selected topbar entry toggles its panel; switching entries selects that teacher. Escape restores focus to the selected teacher, per-agent drafts remain intact, drag resizing remains available, and the new-topic text action sits in expanded history. - Extended native work preview clearance to include the introduction and any real unread speech bubble, using the maximum overlapping clearance. Hover does not create topics, send requests or acknowledge unread messages. README describes the final behavior. - Independent review caught immediate entry-switch overlap and selected-entry focus restoration issues; both were fixed and covered. Final screenshot review prompted a second pointer-move opening-path regression, now fixed by keeping pointer-enter as the sole mouse opening path. - During delivery, the peer teacher-focus task completed and a separate read-only agent-refresh task was registered. Its task record was reviewed; it changes no presentation/runtime code and has no semantic conflict. @@ -39,6 +45,9 @@ - Trial update completed: existing `Makelore Teacher Trial.app` (bundle `cn.makelore.teacher-presence.trial`, Electron 43.4.0) now runs this checkout's verified 772da4f build as PID 27713. Reused `/var/folders/mx/ltbgwsks5_n8zllj69p_wbcw0000gn/T/makelore-trial-tdq_nuah/user-data` and port 54599. The prior recorded trial PID had already exited, so no running application was stopped. - A machine-local `dist-electron/main/trial-background.cjs` bootstrap, excluded from Git, guards startup show/focus calls and launches through `open -g -j`. It leaves the window hidden until the user activates it; normal window behavior is restored upon user activation. Metadata backups and startup/focus evidence are kept beside the existing trial. Production code and the installed application were not modified. +- Reply-card follow-up: generated follow-up questions now use pale blue, cream and lavender cards in order, 16px text and 1.8 line-height, dark readable text, responsive wrapping, hover/focus and disabled states. Both suggestion-generation and ordinary follow-up groups share the style. Removed unused header/icon styles and kept admin preview identification outside a header. +- Updated the current trial presentation through Electron insertCSS after verifying the exact PID/path/window. Renderer/Main were not restarted: operation drafts are held in memory, so this avoids losing them or authentication. The current page receives equivalent selectors for its existing markup; the rebuilt source removes the header and uses the new card markup on the next normal load. No fake cards or messages were added to the real profile. + ## Verification - Passed: 98 tests across teacher-companion, coding-teacher-ui, coding-chat-panel and preview-clearance suites on the final changes. @@ -48,10 +57,13 @@ - Independent code review passed. Electron interaction tests use isolated profiles and fixture responses; no real-model interaction or production installation was exercised. - Background trial verification: exact process path and Host API listener confirmed; OPTIONS runtime-info returned 204. Loaded Renderer URL points to this checkout and `index-PjM22P-Y.js`; the document is complete and React root is mounted. Startup status recorded one blocked show, a loaded hidden/unfocused window, and the original isolated profile. A 12-second NSWorkspace foreground monitor recorded no trial activation and retained the previously foreground application's PID throughout. Verification performed no UI click, activation or test message. +- Reply-card follow-up passed 91 existing unit tests, typecheck, changed-file ESLint, production build and whitespace checks. Existing Electron assertions were updated for the removed header but not launched during this follow-up. A headless visual sample using the supplied text verified the actual card CSS at 540px and 320px: 16px font, 28.8px line-height, three expected colors and no horizontal overflow. +- Live update retained PID 27713 and all current input values; the window remained unfocused and the foreground app PID stayed unchanged. Subsequent read-only DOM inspection confirmed the open consultation header had zero height. No generated follow-up cards were mounted at inspection, so their rendering was verified in the headless sample rather than claimed as a live conversation check. The temporary loopback Node inspector was closed after verification. + ## Follow-ups - Integrate this branch when requested; retain this worktree because the updated trial now runs its compiled output. The user can activate the existing `Makelore Teacher Trial` Dock entry to review the interface. ## Promotion Candidates -- Target: `.project-docs/30-worklog/current-state.md` and the canonical classroom interaction description. Proposal: published teacher introductions live in transient topbar hover/focus cards, and consultation headers contain identity only; the selected entry toggles the panel and new topics remain available inside expanded history. Evidence: explicit user request, changed components, 98 unit tests, 9 browser layout checks and 2 Electron scenarios. Future impact: preserves the consultation capability while simplifying the teacher selection surface. Semantic conflicts: none with generic distributed identities, pinned topic versions or true proactive messages. Human confirmation: already supplied for this interaction; canonical promotion remains an integration-mode step. +- Target: `.project-docs/30-worklog/current-state.md` and the canonical classroom interaction description. Proposal: published teacher introductions live in transient topbar hover/focus cards, and the duplicated consultation header is removed; generated follow-up questions use three alternating pastel cards with 16px text; the selected entry toggles the panel and new topics remain available inside expanded history. Evidence: explicit user request, changed components, 98 unit tests, 9 browser layout checks and 2 Electron scenarios. Future impact: preserves the consultation capability while simplifying the teacher selection surface. Semantic conflicts: none with generic distributed identities, pinned topic versions or true proactive messages. Human confirmation: already supplied for this interaction; canonical promotion remains an integration-mode step. diff --git a/README.md b/README.md index f6353a5d..6d4af5b0 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ Pi 正式包必须继续运行 `pnpm run verify:artifact:pi`、`pnpm run smoke:p - Code 课堂左侧项目栏默认宽 171px,可拖动右边缘在 128–256px 间调整,双击恢复默认并在本机记住宽度;标题栏同步对齐。项目名与会话名超长省略并可悬停查看;右侧咨询栏默认宽 508px,可拖动至 640px,紧凑窗口仍使用覆盖式咨询。 - 客户端没有内置老师/朋友角色。已下发智能体以头像和名称并排显示在标题栏,点击后打开对应智能体的讨论;数量较多时横向滚动,咨询面板不再提供智能体下拉框。名称、头像、简介、欢迎语和推荐问题均由服务端提供。首次使用默认选择运营指定项,各智能体的未发送草稿分别保存,已有话题保持绑定的版本;旧的未分配项目草稿可展开查看,不自动转给其他智能体。打开或切换只读取配置和历史,不触发模型;咨询栏支持调整宽度和重新打开。 -- 鼠标悬停或键盘聚焦顶部智能体入口时,以奶油色圆角卡片显示该智能体的发布介绍;离开、Escape 或点击入口后收起,没有介绍则不显示空卡片。咨询标题区只保留头像和名称,移除介绍及新话题、展开、关闭三个图标。再次点击当前入口或在咨询栏按 Escape 可收起,切换其他入口仍直接打开对应讨论;拖动边缘调宽保留,新话题文字入口收在展开的“以往讨论”中。悬浮介绍不会创建话题、调用模型或确认未读消息,作品原生预览同时避让介绍卡和真实主动气泡。 +- 鼠标悬停或键盘聚焦顶部智能体入口时,以奶油色圆角卡片显示该智能体的发布介绍;离开、Escape 或点击入口后收起,没有介绍则不显示空卡片。咨询栏不再显示重复的头像、名称标题条,也不显示介绍及新话题、展开、关闭三个图标;老师身份保留在顶部入口及消息署名中。智能体生成的追加问题以淡蓝、奶油黄、淡紫卡片依次承载,正文 16px、行高 1.8,保留整卡点击发送与忙碌时禁用。再次点击当前入口或在咨询栏按 Escape 可收起,切换其他入口仍直接打开对应讨论;拖动边缘调宽保留,新话题文字入口收在展开的“以往讨论”中。悬浮介绍不会创建话题、调用模型或确认未读消息,作品原生预览同时避让介绍卡和真实主动气泡。 - 主动发言采用紧贴小头像的短气泡;只有存在真实主动消息或运营欢迎语时才显示这组浮层,收起消息时头像和气泡一起消失,顶部入口仍保留。长消息在气泡中最多显示三行,点击接回原智能体对话查看全文。不提供“智能体偶尔来看看”开关或本地模拟巡看控制,既有自动跟进与真实消息接收逻辑保留。作品原生预览对整组气泡和头像测量避让,避免图片被原生页面遮住。 - 学生在当前项目创作时,前端每 5 分钟请求一次智能体跟进;窗口隐藏、来源归档、主对话正在执行、智能体正在回复或学生正在智能体栏写草稿时延后。Main 再检查在线启停、来源归属、项目级冷却和已完成文本指纹,未变上下文按下述十五分钟冷却处理。跟进沿用运营模型、已发布 Skills 与当前智能体话题,生成简短的具体建议或引导;以主动智能体发言持久化,不伪造学生消息。模型调用沿用智能体计费规则。 - 进入项目时,智能体头像旁先显示运营发布的欢迎语气泡,不调用模型、不声称已检查项目;每个账号/项目主动收起后不重复弹出。真实的未读主动建议优先替换欢迎语。主动发言在头像旁直接显示气泡,不抢焦点、不盖住作品;作品区按气泡与原生预览的实际交叠范围避让,已有工具栏高度计入计算,气泡位于独立智能体栏时不额外留白,窗口/分栏尺寸变化和收起气泡时实时归还空间;“和智能体聊聊”接回同一段咨询,“等会儿聊”收起并保留历史。已有未处理气泡时不堆叠新邀请;咨询已展开时也显示气泡,直到学生主动点击查看或收起,期间的其他回复不会吞掉未读邀请。五分钟检查计时在刷新和项目切换后保留;智能体咨询里的新讨论也算进展,即使操作对话没有变化也会继续跟进;上下文完全未变时放缓到十五分钟一次,不永久停止。事件连接丢失时,每十五秒只读同步未完成回复,收到结果后停止轮询,不重复调用模型。失败如实提示,不以本地文案替代模型回复。已接受请求恢复使用原身份,退出账号和来源删除仍沿用 Main 中止边界。 diff --git a/src/pages/Chat/TeacherChatPanel.tsx b/src/pages/Chat/TeacherChatPanel.tsx index 7a8323a6..b21415f2 100644 --- a/src/pages/Chat/TeacherChatPanel.tsx +++ b/src/pages/Chat/TeacherChatPanel.tsx @@ -374,12 +374,8 @@ export function TeacherChatPanel({ const questions = definition?.suggested_questions ?? []; return (