From 66cad870743e10e54d1770db99cefa80ee5bd38d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=A8=E9=B1=BC=E8=BE=A3=E6=A4=92?= Date: Wed, 30 Sep 2026 00:04:40 +0800 Subject: [PATCH 1/2] fix: align teacher and operation composer heights --- ...0260929-teacher-composer-files-4d46a1a9.md | 56 +++++++++++++++++++ README.md | 2 +- src/pages/Chat/TeacherChatPanel.tsx | 9 +-- src/pages/Chat/classroom-workspace.css | 5 +- tests/e2e/fixtures/teacher-reply-layout.tsx | 26 ++++++++- tests/e2e/pi-coding-first-chat.spec.ts | 11 ++++ tests/e2e/teacher-reply-layout.spec.ts | 45 ++++++++++++++- 7 files changed, 141 insertions(+), 13 deletions(-) create mode 100644 .project-docs/30-worklog/tasks/20260929-teacher-composer-files-4d46a1a9.md 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..267563a4 --- /dev/null +++ b/.project-docs/30-worklog/tasks/20260929-teacher-composer-files-4d46a1a9.md @@ -0,0 +1,56 @@ +# 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, live-app update, main merge or remote push is part of this implementation request. + +## 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 + +- Changes are committed on this feature branch for later integration/application update when requested. Main and the running temporary application are unchanged by this task. + +## 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. diff --git a/README.md b/README.md index 1d1e3a55..fd430be7 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})} }
-