Repository navigation
fix(console): the AI chat user bubble shows the person's words and attached files, not the model note - #39263
Merged
objectstack-fleet[bot] merged 4 commits intoDec 3, 2026
Conversation
… not the model note Claude-Session: https://claude.ai/code/session_012dn2AcfwnfHMghyeNLFvob Co-authored-by: Claude <noreply@anthropic.com>
…el note Claude-Session: https://claude.ai/code/session_012dn2AcfwnfHMghyeNLFvob Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012dn2AcfwnfHMghyeNLFvob Co-authored-by: Claude <noreply@anthropic.com>
… drop stray stored-answer lines Claude-Session: https://claude.ai/code/session_012dn2AcfwnfHMghyeNLFvob Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob 维护者速读
席位意见:接受。返工 1 后气泡只画带 席位核对 — ACCEPT · repo:objectstack@os-bob · head
|
objectstack-fleet
Bot
deleted the
claude/issue-39249-chat-bubble-attachments
branch
December 3, 2026 05:58
This was referenced Dec 3, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #39249
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
The AI chat user bubble now shows the person's own words and the files sent with the turn. It no longer shows the note written for the model.
The turn's parts (
ui/packages/plugin-chatbot/src/chat/userTurn.ts, new). A user turn carries:providerMetadata.objectstack.modelNote;data-local-attachmentspart listing the attachments that are not file parts.The mark is set where the note is made. Nothing strips text from the drawn string by pattern.
The mapper (
mapMessages.ts). A marked text part is not part of the message'scontent. File parts becomeattachments, and the data part becomeslocalAttachments. Both are new optional keys onChatbotEnhancedMessage.The bubble (
chat/userAttachments.tsx, new). A stored image is a thumbnail and any other stored file is a chip with its name; each is a link that opens the stored file in a new tab. A spreadsheet read in the page is a chip with no link, because its bytes never leave the page. A file that was not sent is a muted chip, with one sentence per reason in the console's language:chatbot.composer.fileTooLarge;fields.file.typeNotAccepted;chatbot.attachment.uploadFailed;chatbot.attachment.notRead.Both new keys are added to all 11 language packs.
ChatbotEnhanced.tsxgets only an import and oneUserAttachmentsblock in the user branch ofrenderMessage.The send.
useObjectChat().sendMessagetakes an optional fourth argument,ChatTurnExtras(modelNote,localAttachments). A turn with no words now sends when it carries a file part or a model note.ChatPane.tsxprepareTurnreturns the words and these extras, and no longer appends notes to the text.What the model receives (a change). The "sent as files" lines (
filesSent, English and Chinese) are gone. The server already names each stored file part to the model:chatFileReferenceLinein cloudpackages/service-ai/src/chat-files/chat-file-parts.ts, plus the per-file read status block inchat-file-turn.ts(statusText). I measured this by reading both files at cloudc3ed329. A file that was not sent never reaches the server, and a spreadsheet is never uploaded, so their lines still reach the model, now inside the marked model-note part. The chat route joins a message's text parts as they are (cloudroutes/message-utils.tsnormalizeMessage), so the model reads the words followed by the note, separated by a blank line.Remainder of the card, not in this PR (item 3: the same display after a reload or reopening history). Measured, not reachable in this surface. The stored user row is the text parts joined plus one
[Attached file "NAME", fileId ID]line per file. After this PR the text parts are the words plus the marked note. The file parts themselves are not kept. A reload therefore draws the note and the reference lines as text. Two halves are needed:modelNote, and keep each file'sfileId,filename,mediaTypeand governedurlstructured on the row.ui/packages/app-shell/src/hooks/useChatConversation.ts, the surface of the conversation-history card console AI drawer: the conversation history defaults to the current app, has an All switch, and navigates to a conversation's app before opening it (#35014 item 4, after cloud#4835) #35081, rebuilds file parts from those fields.Once both halves land, this PR's mapper and bubble draw a reloaded turn unchanged. The seat files the follow-up cards.
Serial constraints:
ChatbotEnhanced.tsxandindex.tsxtoo. It is ACCEPTed and in the merge queue (head6d72c69, not merged when this PR opened);overlap-check --pr=39257readsmerges cleanly. This PR'sindex.tsxexports are in their own lines below theChatFilePartexport.ChatbotEnhanced.tsxhunk allowed (option A).Tests
ui/packages/plugin-chatbot/src/__tests__/ChatbotEnhanced.userAttachments-39249.test.tsx(realuserTurnParts, mapper and bubble):objectstack.fileId, or whose url isdata:,blob:,javascript:, protocol-relative (//or slash-backslash), another scheme or a bare relative path, draws nothing; a same-origin path and anhttpsurl do (control).ui/packages/app-shell/src/console/ai/__tests__/AiChatPage.bubbleAttachments-39249.test.tsx(realChatPanesend path anduseObjectChattransport):localAttachments;AiChatPage.attachmentNotesLanguage-34461.test.tsxasserted that the "Files the user attached … sent as files" line and its Chinese form are in the turn. Those lines no longer exist, because the server names sent files itself. The pins now assert they are absent. The "no words, thread language" case used an uploaded image, which now carries no note at all, so it uses an over-cap file whose not-read line still follows the thread's language.AiChatPage.attachmentsUpload-32749.test.tsxasserted that the turn text contains the sent file names (receipt.png, invoice.pdf) from the same removed line. It now asserts that the text is exactly the person's words.Runs at the head of this PR
vitest run packages/plugin-chatbot/ packages/i18n/ packages/app-shell/src/console/ai/: Test Files 240 passed (240), Tests 3008 passed, 13 skipped (3021).8a96d7a77(REWORK 1):vitest run packages/plugin-chatbot/ packages/app-shell/src/console/ai/: Test Files 130 passed (130), Tests 1143 passed; the bubble file alone 16 passed (7 earlier, 9 new). Turbotype-checkfor@object-ui/plugin-chatbotand@object-ui/app-shell, 74/74 successful.type-checkfor@object-ui/plugin-chatbotand@object-ui/i18n, 55/55 successful; for@object-ui/app-shell, 73/73 successful.mapMessages.ts, the anchorp.type === 'text' && !isModelNotePart(p)was replaced byp.type === 'text' && true. Result: 4 failed, 8 passed across the two new files (each bubble and note assertion went red). Restored: blob equals HEAD, andgit diff HEADis empty.dispatch-gates --commands), 41 in all: 39 ran with exit 0. Two were not measured:check:query-options-erasure(killed by a local 240 s per-command timeout) and the ui rootvitest run scripts/(not run). Both are left to CI.Acceptance notes
ChatPane.tsxgrows from 1000 to 1016 lines. The change stays insideprepareTurn,doSendand the import list; no new concern was added there.app-shellandplugin-chatbot. The server ignoresproviderMetadataon text parts and thedata-local-attachmentspart.Verification
Files to read first, in risk order:
ui/packages/plugin-chatbot/src/chat/userTurn.ts: the part shapes and the mark.ui/packages/app-shell/src/console/ai/ChatPane.tsx,prepareTurn: what the model still receives.ui/packages/plugin-chatbot/src/mapMessages.ts,extractText: the one line that keeps the note out of the bubble.Two-minute check: open the console AI chat, attach a PNG, and send with no text. The bubble shows the image thumbnail and no "(Files the user attached …)" line. Clicking the thumbnail opens the image.
Generated by Claude Code