Skip to content

fix(ai): the app AI page's first question box takes pasted and attached files - #39257

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-39239-ask-home-attachments
Dec 3, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-39239-ask-home-attachments

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #39239

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:应用的 AI 问询页首屏提问框可以粘贴截图、拖入或点回形针按钮添加图片、PDF 和表格文件,发送前能看到并删除,随第一个问题一起发出;不支持的文件会和对话框里一样提示原因。
  • 为什么做:AI 问询页首问只能发文字,带图或 PDF 必须先随便问一句再到对话里粘贴,这张卡补齐首问的附件能力。
  • 出错会怎样:最坏是首屏提问框附件发不出去或提示文字不对,文字提问照常可用;这是界面改动,撤回本次合并即可恢复原样。
  • 要你做什么:无

What changes

  • The home-state box is now the conversation composer's own PromptInput (AskHome in ui/packages/app-shell/src/console/ai/AppAskPage.tsx). It accepts the composer's list and size limit, by paste (the composer's handlePaste), drop, or a new attach button beside the send button. Attached files show as the composer's chips, each with a remove button. The send is live once there is text or a file (as in the composer). The files go with the first question, and with a suggested question picked while files are attached. Test ids app-ask-input, app-ask-send, app-ask-scope are kept.
  • One list, one refusal (mechanism assumption C). The accepted types, the 10 MiB limit and the refusal notice did not live in prompt-input.tsx or chatAttachments.ts: they were ChatbotEnhanced's default props and its private handlePromptInputError. They move, unchanged, into a new sibling module ui/packages/plugin-chatbot/src/chat/composerAttachments.tsx (CHAT_COMPOSER_ACCEPTED_FILE_TYPES, CHAT_COMPOSER_MAX_FILE_SIZE, useAttachmentRefusalNotice, AttachmentRefusedNotice, promptMessageFiles). ChatbotEnhanced now reads them from there (its defaults, its wording and its chat-attachment-refused notice are byte-for-byte the same), and the package index exports them so the home box uses the same ones. No second list of MIME types is written. prompt-input.tsx needed no edit: PromptInput and its parts are already exported through AIElements.
  • One inline default corrected on the way. Moved out of ChatbotEnhanced, the size refusal's inline defaultValue was read by check:i18n-keys for the first time (the aliased tCount had hidden it) and contradicted the en pack value that actually renders. The call site now carries the en value byte for byte; what users read is unchanged.
  • The ask path carries files (mechanism assumption B). useDeferredFirstSend already holds and replays files, and ChatPane.tsx is untouched. The ask callback the home state receives is minted in ui/packages/app-shell/src/layout/ChatDockConversation.tsx (askFirst), which stored only { content }. It now takes (text, files?) and stores the files in the same pendingFirstMessageRef the composer's first send uses; a file-only first question is accepted there too.

Files outside the claim's declared surface, and why

The claim's File surface: names AppAskPage.tsx for "the ask path to the first send", EmptyConversation.tsx and prompt-input.tsx. Measured on origin/main 1fe9c62, the fix needed three other files:

  • ui/packages/app-shell/src/layout/ChatDockConversation.tsx: the ask path itself is defined here (renderEmptyState and askFirst), not in AppAskPage.tsx. Two lines change.
  • ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx and ui/packages/plugin-chatbot/src/index.tsx: the one source of the accepted list and the refusal wording is here; reusing it without a second list means moving it to a shared module and exporting it.

EmptyConversation.tsx and prompt-input.tsx were not edited. ChatPane.tsx and chatAttachments.ts were not touched. overlap-check.mjs before each push: clean against origin/main, #39250 (which shares ChatDockConversation.tsx) and #39063 (which shares ChatbotEnhanced.tsx).

Tests

New file ui/packages/app-shell/src/console/ai/__tests__/AskHome.attachments-39239.test.tsx (real AppAskPage, real PromptInput, real ChatDockConversation; ChatPane stubbed to record the held first message and its files):

  • a pasted image is attached, shown, and removable;
  • the attach button opens the file picker, and a picked PDF is attached;
  • the send carries the question and its files (a pasted PNG and a picked CSV) into the first send;
  • a file alone can be sent, and the send button is live only once something is in the box;
  • a suggestion sends the files attached when it is picked;
  • an unsupported type gets the composer's chat-attachment-refused notice naming it and the accepted list, while the supported file of the same paste attaches;
  • CONTROL: text alone still asks, with no files held.

Acceptance notes

  • The home box now draws the composer's InputGroup frame (rounded and shadowed to keep the large look) instead of a hand-styled textarea; the scope badge and the round send button stay.
  • The attach control is a direct button (paperclip) rather than the composer's one-item menu; it calls the same openFileDialog of the same attachment context.
  • What happens to each file after the send is unchanged and is the conversation's: images and PDFs are uploaded and sent as file parts, spreadsheets are read as text, and a .doc/.docx the composer admits is named in the turn as not read.
  • The tests went into a new file as the dispatch asked. Root AGENTS.md asks for a new pin of a component with a shared harness to go into that harness as a top-level describe; that harness (AppAskPage-37788.test.tsx) is being edited by an in-flight PR on another branch, so this is reported as a conflict for the seat rather than decided here.

Verification

Local runs (tests on head a66e26c; the derived gate list on b9a3723 plus the changeset commit)
  • vitest run of AskHome.attachments-39239.test.tsx + AppAskPage-37788.test.tsx: 2 files, 37 tests passed.
  • vitest run packages/plugin-chatbot/ (includes the existing ChatbotEnhanced refusal pins): 88 files, 852 tests passed.
  • vitest run packages/app-shell/src/console/ai packages/app-shell/src/layout: 223 files, 1919 tests passed. The rest of app-shell is left to Test UI.
  • turbo run type-check --filter=@object-ui/plugin-chatbot and --filter=@object-ui/app-shell (each runs tsc --noEmit and the test project): both green.
  • Derived gate list (dispatch-gates.mjs --commands, 38 commands): all exit 0; --ran reconciliation: 38 derived, 38 run, 0 NOT-MEASURED, every line with its exit code. Also check:i18n-keys, check:i18n-drift, check:phantom-deps, check:new-line-citations: exit 0.
  • Ablation: askFirst storing { content } only (the pre-fix line) turns 3 of the 7 new pins red (send with files, file-only send, suggestion with files); restored, git diff HEAD empty.

Read first

  1. ui/packages/app-shell/src/console/ai/AppAskPage.tsx (AskHome, AskHomeSend): the box, the send condition and the suggestion hand-off of attached files.
  2. ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx with chat/composerAttachments.tsx: the move must be behaviour-neutral for the composer.
  3. ui/packages/app-shell/src/layout/ChatDockConversation.tsx (askFirst).

Two-minute check

Open an app's ai:chat page, paste a screenshot into the question box: a thumbnail chip appears. Type a question and send: the conversation opens with the question and the image attached. Paste a .zip: the amber notice names it and the accepted types.


Generated by Claude Code

@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 3, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob

维护者速读

  • 用户能看到什么变化:应用 AI 问数页首页的提问框现在能粘贴截图、拖入或点附件按钮添加文件(与对话框同一套接受清单和 10 MiB 上限),发送前可见可删,随第一个问题(含点建议问题)一起发出;不接受的文件会提示原因。
  • 为什么做:之前首页框只收文字,粘贴的图片被静默丢掉,只能先问一句再到对话里传文件(AI inquiry page (ai:chat): the home-state question box does not take a pasted image or any attachment #39239)。
  • 出错会怎样:只影响首页提问框;对话框的接受清单与拒绝文案原样搬到共享模块,行为不变(plugin-chatbot 88 个测试文件全绿)。
  • 要你做什么:无。非受管面、无收窄,席位按常规落地(ready + auto-merge)。

席位核对 — ACCEPT · repo:objectstack@os-bob · head 6d72c69819dc08fc8879a2c4f7c56fbda17b9c2e

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 3, 2026 04:59
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 55f73f0 Dec 3, 2026
55 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-39239-ask-home-attachments branch December 3, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI inquiry page (ai:chat): the home-state question box does not take a pasted image or any attachment

2 participants