diff --git a/.project-docs/30-worklog/tasks/20260929-teacher-composer-actions-e819c3d7.md b/.project-docs/30-worklog/tasks/20260929-teacher-composer-actions-e819c3d7.md new file mode 100644 index 00000000..beaa4ff1 --- /dev/null +++ b/.project-docs/30-worklog/tasks/20260929-teacher-composer-actions-e819c3d7.md @@ -0,0 +1,71 @@ +# Task: Hide teacher model selector from the composer + +## Identity + +- Task ID: 20260929-teacher-composer-actions-e819c3d7 +- Mode: Feature +- Branch: codex/20260929-teacher-composer-actions-e819c3d7-teacher-composer-actions +- Worktree: /Users/chillishark/Makelore 麦洛/.codex-worktrees/makelore/20260929-teacher-composer-actions-e819c3d7 +- Base commit: a77ddbd6813bb71d490544edfef6e1f35240070f +- Owner: codex +- Status: Ready for Integration + +## Scope + +- Hide the teacher composer's model picker, model name and configuration details; retain the microphone, send and in-flight stop controls. + +## Intent And Constraints + +- User explicitly requests a presentation change to the screenshot's teacher input controls and subsequently authorizes updating the running application. Preserve existing voice, model choice/request/retry semantics, cloud configuration, drafts/history, shortcuts and billing. Do not merge main, push, replace the formal installation or discard concurrent renderer updates. + +## Outcome + +- Removed TeacherModelSelect from TeacherChatPanel (one import and its rendered element). Idle footer now contains only microphone and send; the running reply still exposes stop. Model names, dropdown and configuration messages are no longer rendered there. +- Existing stored model preferences, published defaults, frozen retries, voice transcription, shortcuts, drafts/history and backend contracts remain unchanged. The hidden selector no longer makes its model-directory request. README now describes the visible controls accurately. +- Source changes are isolated on this task branch. At the user's subsequent request, updated the running temporary trial (PID 32583) with an immediate scoped display change and a compiled renderer for its next load. No main merge, push, cloud change or formal installation replacement was performed. + +## Verification + +- 88 relevant tests passed across coding-teacher-ui, teacher-composer-voice and teacher-conversation-panel. Updated the existing model-picker test to seed an old preference and verify unchanged send/remount behavior without a picker or model-directory call. +- Updated two existing browser scenarios: 319px and 508px panels show exactly microphone/send buttons with no model/config text or horizontal overflow; default and previously saved model sends preserve their original parameters. Both passed (4.8 seconds); both generated screenshots were visually inspected. +- Browser tests use the existing isolated Vite/mock-API fixture and installed Chrome in headless mode (MAKELORE_LAYOUT_BROWSER_CHANNEL=chrome). Initial default launch could not find Playwright's bundled Chromium; no app behavior ran in that attempt, and no browser installation was needed. No real model calls or user application interactions. +- Standard typecheck, scoped ESLint, build:vite and git diff --check passed. Build log: /tmp/makelore-teacher-composer-actions-build.log. Project-doc structure and task-aware drift checks passed. + +## Follow-ups + +- Merge the source branch when requested. The running trial now includes this UI update; its older Main and the formal installed app remain unchanged. + +## Promotion Candidates + +- Target: canonical teacher UI/current-state at next integration. Proposal: hide model picker and details from the teacher composer while retaining microphone/send/stop and existing model execution/retry semantics. Evidence: explicit screenshot-based user instruction, 88 unit tests, two narrow/wide browser cases and inspected screenshots. This supersedes the prior visible-picker UI requirement only; user confirmation is already supplied, and no cloud-model ownership decision changes. + +## Project Context Loaded + +- Identity: feature task, branch/worktree/base as above; task_context start/status passed with exact ownership and reservation. Main base a77ddbd already contains the window-close fix and merged teacher composer/compact shortcuts. +- Read: AGENTS, entry/memory-index/planning-gate, active task, positioning, current-state, decision index and teacher ADR, architecture, domain/success criteria, evidence/reflection/commitment context. Canonical current-state retains historical UI descriptions; current README and user instruction govern this small presentation change. +- Goal: child-friendly project creation with cloud-defined teachers. Main/cloud own model execution and billing; this change only hides the picker UI. Existing pending requests retain their frozen model and idempotency identity. +- Peers: all registered Scope/Intent/Promotion sections inspected. Teacher composer/model and shortcut tasks supply already-merged behavior; the latest user request explicitly narrows visible controls. Grouped teacher introductions and Code back-entry touch separate surfaces. Child-language has incomplete scope but no concrete dependency. No blocking semantic conflict; peer worktrees stay untouched. +- Files: TeacherChatPanel, existing teacher-reply-layout tests, README and this record. No server/API contract changes or new design system. +- Gate: Passed. + +## Plan + +1. Remove only the model picker import/render from the teacher composer. +2. Adapt existing narrow/wide browser cases and run voice/send regressions, typecheck, scoped lint and build; inspect screenshot. +3. Record verification and prepare a clean feature commit. + +## Live Update Resume + +- Same-task start/status passed. Project context and source remain the completed 8af0ca7; source tests/build already passed. Peer group-intro and code-back-entry update the same trial and must be preserved; no cross-thread messages were sent. +- Actual trial is PID 32583 with isolated makelore-trial-tdq_nuah/user-data. Served dist is teacher-composer-4f829ac1/source/dist, a real directory; its latest index matches code-back-entry-33d87a81/source-with-group-intro/dist (index-Dh1e8q7U.js). launch/guidance metadata initially lags those renderer updates, so the actual loaded/served asset hashes are authoritative. +- Gate: Passed for scoped update, preserving peer task checkouts and their staged source. Create an independent copy of the latest combined build source and apply only the tested three-line picker removal. Verify/build it before publication; re-check live baseline and process/profile immediately before swapping hashed assets and index atomically. +- Apply a narrowly scoped CSS hide to the existing renderer via Electron insertCSS, closing only an already-open model dropdown if necessary. This makes the requested display change immediately without reloading user conversations or disrupting active state. The same change is compiled into the next renderer entry so it survives reload/restart. Keep old assets/index for rollback, verify actual controls and process/state preservation, and record accurate loaded-versus-next source metadata. + +## Live Update Result + +- Completed 2026-09-29 23:22 Asia/Shanghai. Independent stage: `/var/folders/mx/ltbgwsks5_n8zllj69p_wbcw0000gn/T/makelore-trial-tdq_nuah/teacher-composer-actions-e819c3d7`. Product sources differ from the latest combined renderer only by the three-line picker removal; preserved grouped teacher introductions, Code return entry, shortcuts and the old Main-compatible teacher conversation API. +- Staged typecheck, focused saved-model unit regression and build:vite passed. Both 319px/508px browser cases passed (6.1 seconds), and both screenshots were visually inspected. The initial staged browser attempt failed because the current repository test fixture imported a newer API export absent from the older trial; adapted only that staged test fixture and reran successfully. +- PID/profile and served-index checks passed before publication. Copied new hashed assets, retained old assets, and atomically replaced the served index with `index-DcnlEkIE.js` (SHA256 `1c35dc1bc65bf70893c85e95fc5bd62628cd7bc09bca82a0d6538a412523947f`). Existing loaded asset remains `index-Dh1e8q7U.js` with the scoped CSS overlay; no reload/restart occurred. launch.json and guidance-preview.json distinguish loaded versus next renderer and preserve previous overlay metadata. +- Teacher panel was already closed immediately before publication and remained closed. Before/after hashes confirm unchanged inputs, selected conversation, drafts, operation messages, teacher messages and local storage; route, focus and panel state also match. A temporary offscreen DOM probe verified the live stylesheet hides only the model trigger while microphone/send remain displayed, then removed itself. Full composer appearance was verified in the isolated browser screenshots, not by opening the user's closed panel. +- The first attempts stopped before publication because another task had closed the inspector, the equivalent macOS `/var` and `/private/var` paths needed canonical comparison, and the panel had since been closed. Reopened only this trial's diagnostic connection, canonicalized profile validation and allowed the already-closed panel without changing its state. No user-state repair was required. +- Read-only subagent review identified metadata rollback/concurrency checks; added conditional metadata rollback and a final served-index comparison before publication metadata. `verification.json` records the successful update and state checks. Existing trial Main and the separately running installed app (PID 49184) were untouched. diff --git a/README.md b/README.md index b70434cb..1d1e3a55 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ Pi 正式包必须继续运行 `pnpm run verify:artifact:pi`、`pnpm run smoke:p - 智能体输入裁剪区分两种计量:本地模型以约每 2 个 UTF-8 字节估算 1 Token,并计入工具与读取预留;这不是精确分词或扣费依据,模型上限与实际 usage 仍由服务端拥有。云端沿用 query 字节上限,以完整 JSON 转义后的大小裁剪来源节选。智能体指令、当前问题和明确引用不会被静默裁掉;固定配置或回复协议超限时明确提示调整配置,避免让学生反复缩短短问题或新建话题。完整来源仍可由只读工具按需读取。 - `tests/fixtures/teacher-guidance-examples.json` 保留人工样例作为旧回复的读取兼容资料,仅验证正文和快捷回复投影,不加载到运行时,也不代表真实模型教学效果已验收。云端定义由 Yuxi 维护并由运营显式同步下发;本地代码修改不会自动改写云端配置或学生已接受问题的固定发布版本。 - 下发智能体的图标随发布版本保存,顶栏、咨询面板、欢迎区和消息使用定义中的 `icon_url`;未设置或图片加载失败时使用内置头像。运营在 Yuxi 更换图标后需同步下发配置,联系人使用当前下发的名称和图标;每轮执行仍记录实际发布版本。相对图片地址由服务端使用 Yuxi 公网入口补全。 -- 老师输入框复用操作 Agent 的麦克风,语音识别只追加当前草稿,不自动发送;切换账号、老师、项目或来源、关闭面板时丢弃过期识别。模型选择按账号和老师记忆,默认跟随老师配置;显式模型仅用于后续手动提问,思考使用模型默认设置。每轮冻结选择及幂等身份,保留发布人设、资源、版本与学生计费;主动检查继续遵循云端老师配置。模型目录与准入由 Main/云端验证,旧云服务显示待更新,不静默忽略选择。需先更新 WS 模型授权接口,再更新 Yuxi API/worker,客户端不会修改或发布云端配置。 +- 老师输入框复用操作 Agent 的麦克风,语音识别只追加当前草稿,不自动发送;切换账号、老师、项目或来源、关闭面板时丢弃过期识别。底部控制区只显示麦克风和发送按钮,回复中保留停止操作,不展示模型名称、选择入口或配置说明。默认跟随老师配置,已有按账号和老师保存的模型选择及请求重试保持原有行为,思考使用模型默认设置。每轮冻结选择及幂等身份,保留发布人设、资源、版本与学生计费;主动检查继续遵循云端老师配置。已有模型选择仍由 Main/云端验证,不会静默忽略。需先更新 WS 模型授权接口,再更新 Yuxi API/worker,客户端不会修改或发布云端配置。 - 咨询聊天和文字草稿按当前云端账号、项目、已下发智能体保存;不同项目分别恢复各自聊天,同项目切换操作对话仍延续同一个聊天,每轮发送冻结当时的项目、来源和发布版本并检查启停。引用保留原项目/来源,切换后必须移除失配引用再发送;旧组件仅保留原始归档,不恢复交互。历史按50轮分页,流式事件只传当前轮;本机每轮独立原子落盘,索引保存消息摘要,旧轮次可通过只读工具按ID读取。可确认归属的旧话题按来源ID幂等迁入,原文件保留;“旧记录”入口只读查看升级前项目/来源话题。同项目Pi来源或版本变化,以及首次从旧组件协议升级时,切换内部云线程并带入有预算的近期正文和快捷回复,同一段由Yuxi原生历史压缩管理上下文。此版聊天历史在本机保存,不提供跨设备同步。关闭面板或切换会话不取消已接受的问题,退出账号会中止。请求先落盘再调用模型,同一请求标识不重复发送,重启后未完成请求标记中断。云端断线按游标和持久状态恢复;停止或退出账号会取消原云端问题,下次提问先停止旧的未完成问题再绑定新上下文。只接收云端主线程回答,子智能体文本不混入正文。没有操作对话时也可咨询,但无操作文本上下文。 - 删除操作对话会停止正在使用该来源的回复,保留项目级咨询历史;归档来源需先恢复后才能引用。原有来源会话级智能体 API 与存储保持兼容,原路径历史不自动迁移到新项目级咨询栏。运营草稿试聊仍使用 `niancode://coding-teacher/preview?draft_revision=N` 打开独立示例上下文,不读取学生项目,要求桌面当前账号具有运营权限。 diff --git a/src/pages/Chat/TeacherChatPanel.tsx b/src/pages/Chat/TeacherChatPanel.tsx index 2ba5ad1c..84aefaa0 100644 --- a/src/pages/Chat/TeacherChatPanel.tsx +++ b/src/pages/Chat/TeacherChatPanel.tsx @@ -16,7 +16,6 @@ import { TeacherReply } from './TeacherReply'; import { MessageTimestamp } from './MessageTimestamp'; import { ComposerVoiceButton } from './ComposerVoiceButton'; import { useWorksVoiceInput } from '@/hooks/use-works-voice-input'; -import { TeacherModelSelect } from './TeacherModelSelect'; import { useTeacherModelChoice } from '@/hooks/use-teacher-model-choice'; // Preserve loaded pages and the reading anchor while moving between contacts. @@ -635,8 +634,6 @@ function ProjectTeacherChatPanel({ className="min-h-[60px] w-full resize-none border-0 bg-transparent text-[13px] leading-6 outline-none placeholder:text-muted-foreground/65" />