diff --git a/.project-docs/30-worklog/tasks/20260929-teacher-composer-files-4d46a1a9.md b/.project-docs/30-worklog/tasks/20260929-teacher-composer-files-4d46a1a9.md new file mode 100644 index 00000000..8f0ead5f --- /dev/null +++ b/.project-docs/30-worklog/tasks/20260929-teacher-composer-files-4d46a1a9.md @@ -0,0 +1,73 @@ +# Task: Align teacher composer height and add file attachments + +## Identity + +- Task ID: 20260929-teacher-composer-files-4d46a1a9 +- Mode: Feature +- Branch: codex/20260929-teacher-composer-files-4d46a1a9-teacher-composer-files +- Worktree: /Users/chillishark/Makelore 麦洛/.codex-worktrees/makelore/20260929-merge-composer-actions-23414dc2 +- Base commit: 72218e0c79018a79e81cfb28eabb91cfae8f7d8b +- Owner: codex +- Status: Ready for Integration + +## Scope + +- Align the teacher input box height with the operation Agent composer, including multiline sizing. The user explicitly cancelled the initially requested plus/file-attachment feature; do not add it. + +## Intent And Constraints + +- Preserve microphone/send/stop, hidden model details, shortcuts, draft/history, streaming and keyboard/IME behavior. Keep the teacher's visual colors. No API/backend/attachment changes. The latest user follow-up authorizes updating the running temporary trial with this completed change; main merge and remote push remain outside scope. + +## Outcome + +- Teacher composer now uses the same 42px minimum textarea, one-to-six row growth, 32px control row and classroom bottom spacing as the operation composer. Matching bottom border width keeps the complete input boxes equal in height. Teacher color and 13px input font remain; desktop/mobile line heights match the operation textarea. +- Retained microphone/send and 32px stop controls, keyboard/IME behavior, hidden model details and existing data flow. Added no plus button, file picker, attachment handling or backend contract, as explicitly cancelled by the user. README describes the resulting layout. + +## Verification + +- 91 relevant unit tests across coding-teacher-ui, teacher-composer-voice and teacher-conversation-panel passed. Standard typecheck, scoped ESLint, production build:vite and git diff --check passed; logs /tmp/teacher-composer-height-{typecheck,unit,lint,build,electron}.log. +- Two existing real-component Chrome browser scenarios now compare TeacherChatPanel against CodingComposer at 319px and 508px, with empty/one/three/six/eight-line input. Textarea and surface heights plus bottom edges match within 1px, growth stops at six rows with internal scrolling, and there is no horizontal overflow. Microphone/send-only UI and stored-model send behavior remain verified. Latest narrow/wide empty/eight-line screenshots visually reviewed by the test agent. +- Existing Electron draft/retry scenario passed with actual side-by-side surfaces equal in height and bottom position, no model/file controls, and both drafts retained after retry. Used an isolated mocked Host API and a temporary generated-entry show/focus guard, restored in finally; no running user application or real model calls were involved. +- Initial Electron size assertion ran while opening the teacher had selected the existing Work tab and hidden the operation composer; corrected the scenario to select Operation Chat before measuring. Independent review caught inherited desktop font sizing; preserving the original 13px font exposed a 12px three-line difference in browser tests, fixed by matching the desktop 20px line height, then reran successfully. A fixture-only Fast Refresh lint warning was fixed by exporting its test component. + +## Follow-ups + +- Source change `66cad87` is committed on this feature branch and now applied to the running temporary trial. Main-branch integration remains pending; no merge or remote push was requested in this follow-up. + +## Project Context Loaded + +- Task ID 20260929-teacher-composer-files-4d46a1a9; feature mode, branch/worktree/base as recorded. Reused the clean completed merge checkout after official release; old branch/commits remain. Official start/status confirmed ownership and task reservation. +- Read current AGENTS, entry/memory-index/planning-gate and own task record. Positioning, current-state, teacher ADR/decisions, architecture, domain/success criteria and evidence/reflection/commitments were loaded during the immediately preceding integration and verified byte-identical in this base. README and explicit current user instructions govern the approved hidden-picker UI. +- Goal: support student project creation with cloud-defined teachers; Main retains execution, billing, frozen requests and project conversations. This is a small presentation correction. +- Read-only peer review covered 27 other registered tasks; none missing, no concrete semantic conflict. Child-language has unspecified old scope but no dependency. Current Code navigation work is separate. Preserve existing introduction grouping and streaming. +- Diagnosis: teacher textarea has a 60px minimum and fixed two rows, followed by a 68px footer and 8px gap. Operation composer uses a 42px textarea, dynamic one-to-six rows and a 32px footer. Align sizing and classroom bottom spacing, retaining teacher colors and controls. +- File support assessment found the operation plus accepts images while teacher references are text-only. User cancelled that addition after clarification; no attachment code was written. +- Files: TeacherChatPanel, classroom workspace styles, existing composer browser fixture/spec, README and this record. No cloud or Main contracts change. +- Gate: Passed. + +## Plan + +1. Match teacher textarea/footer and classroom bottom spacing to the operation composer. +2. Extend existing browser checks to compare both real composer components at narrow/wide widths and with multiline input; run relevant UI/voice regressions, typecheck, lint and build. +3. Inspect the resulting screenshots, record evidence and commit the isolated change. + +## Promotion Candidates + +- None recorded. + +## Live Update Resume — 2026-09-30 + +- User requests updating the running application. Resumed the same task with official start/status; task/feature mode/worktree/branch ownership matches. The established planning context remains applicable; Gate Passed. +- Exact target: PID 32583, temporary profile `makelore-trial-tdq_nuah/user-data`; installed `/Applications/Makelore.app` is excluded. Main and its legacy teacher API remain unchanged. Source commit to apply: `66cad87`. +- Read-only inspection found concurrent sidebar and teacher prompt color updates. Final combined candidate `sidebar-icon-top-33d87a81/source-with-text-colors` preserves both. Its renderer entry is `index-CKAsiRqM.js`; stage only the two product-file deltas from this task on that combined source. Wait for the other publication to finish and recheck actual served/loaded assets before switching. +- Plan: independently compile the compatible staged renderer; publish with baseline checks and private state preservation, refresh only when generation and inputs are idle, then verify height/control state and preserved conversation/drafts/navigation. Keep rollback index/assets and merge metadata fields without overwriting peer fields. + +### Live Update Outcome + +- Updated the existing temporary application in place. PID 32583/Main launcher/profile stayed unchanged; renderer loaded `index-CEjIKC5e.js` from the existing served directory. Staged compatibility source: `/var/folders/mx/ltbgwsks5_n8zllj69p_wbcw0000gn/T/makelore-trial-tdq_nuah/teacher-composer-height-4d46a1a9/source`. Only TeacherChatPanel and classroom-workspace.css differ from the latest combined sidebar/color source; independent SHA review confirmed all other product files identical. +- Pinned pnpm 10.33.4 typecheck, scoped ESLint and production build passed. Product behavior tests are the 91 unit tests and browser/Electron checks documented above; this deployment additionally measured the actual running application. +- Before switching, checked the exact served index hash, process/profile, inactive window, empty visible textareas, in-memory drafts, attachments and generation. A short DOM input freeze closed the check/refresh input race. Kept a Main-memory private snapshot and original index/manifest backups, restored the selected conversation, exact selected teacher, teacher panel, original Work tab, drafts and scroll positions. Did not replace localStorage. Finally removed input freeze, released the lifecycle lease and restored background throttling; no window focus change. +- Live verification: teacher and operation composer surfaces both 102px high, with bottom coordinates both 901px. Teacher textarea rows=1; only microphone and send controls. Route/account/selected conversation/teacher text/all persisted teacher drafts/in-memory coding drafts/visible input/tab/panel visibility/window focus were preserved. All 13 non-runtime-prompt history files in the established history set retained their hashes. Virtualized message DOM count changed after refresh, while its visible message suffix matched and durable history remained unchanged. +- Preserved top-row sidebar icons and alignment, grouped introductions, and transparent colored semibold teacher shortcuts. launch.json and guidance-preview.json now identify the actual loaded/next asset and source, new route stylesheet and task-specific composer-height metadata while retaining peer fields. Verification and build-source records are stored in the temporary stage. Main process, installed application, main branch and remote were not changed. +- An optional post-verification background screenshot capture timed out after normal background throttling was restored. It is not used as evidence; live DOM dimensions, control checks, source screenshots from the earlier implementation, and durable-state verification establish the result. +- Updater includes conditional index/metadata rollback and state restoration on failure; no rollback was needed. Retained temporary backups for review. No further product changes or promotion candidates. diff --git a/README.md b/README.md index 5fdf15e3..6398491e 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 输入框保持相同的默认高度、底部对齐和一至六行的多行伸展规则。复用操作 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 84aefaa0..6f642539 100644 --- a/src/pages/Chat/TeacherChatPanel.tsx +++ b/src/pages/Chat/TeacherChatPanel.tsx @@ -17,6 +17,7 @@ import { MessageTimestamp } from './MessageTimestamp'; import { ComposerVoiceButton } from './ComposerVoiceButton'; import { useWorksVoiceInput } from '@/hooks/use-works-voice-input'; import { useTeacherModelChoice } from '@/hooks/use-teacher-model-choice'; +import { Textarea } from '@/components/ui/textarea'; // Preserve loaded pages and the reading anchor while moving between contacts. // Durable messages remain Main-owned; this is only the current window's view. @@ -629,13 +630,13 @@ function ProjectTeacherChatPanel({ >{shortcut.label})} }
-