# Task: 支持 AI Design 图生图选图交互 ## Identity - Task ID: 20260812-design-image-to-image-client-c91e - Mode: Feature - Branch: codex/20260812-design-image-to-image-client-c91e-design-image-to-image - Worktree: D:\Datas\OthersProjects\makelore-design-image-to-image-client-c91e - Base commit: 3a80625fe2fb74ab4e0a883188a52eade8cd23b9 - Owner: codex - Status: Completed ## Scope - Generalize the existing video-first-frame picker into a single-image source picker that supports both image reference generation and video first frames. - Reuse existing workspace generated-image selection, local upload and `attachmentAssetIds` transport without adding a parallel upload path. - Send medium-correct user intent text to the Design Agent and cover both interactions with focused page tests. ## Intent And Constraints - Image-to-image accepts exactly one image from the current workspace or one local upload; task and asset ownership remain Workspace-scoped. - Do not alter Workspace / Conversation / Task ownership or event routing. - Preserve the currently deployed string quick-reply trigger for compatibility, while removing video-only labels and submission semantics from the picker. - A structured picker action is preferable long-term, but is outside this server-compatible increment and is recorded as a follow-up. ## Outcome - The former video-only first-frame dialog is now a reusable single-image source picker. For an image Brief it presents “选择图生图参考图” and sends one selected Workspace result Asset or one uploaded Asset through the existing `attachmentAssetIds` Turn transport; for a video Brief it retains the original first-frame wording and behavior. - The picker closes as soon as a completed work is selected and after a local upload succeeds, while request failures continue to surface through the existing design-conversation error path. - Only an explicit `brief.medium === 'image'` selects image-reference semantics; `video`, null and missing medium values default to the historical video behavior for compatibility with delayed or older server snapshots. - The deployed exact quick reply “从作品列表选择图片” remains supported. README now documents text-to-image, single-reference image-to-image, project-work selection and local upload; no parallel upload API or client state model was introduced. ## Verification - `pnpm exec vitest run tests/unit/image-canvas-page.test.tsx`: `25 passed`. - `pnpm run typecheck`: passed. - `pnpm exec eslint src/pages/ImageCanvas/index.tsx tests/unit/image-canvas-page.test.tsx`: passed. - `pnpm run build:vite`: passed; only the repository's existing dynamic-import and chunk-size warnings were emitted. - `git diff --check`: passed. - Independent read-only Sol review: `PASS`, with no P0-P3 findings after inspecting both the client and matching server diffs; the reviewer reran this 25-test page suite. - No packaged desktop smoke or live Works Square provider request was performed. ## Follow-ups - Evolve `DesignMessage.quickReplies` from display-only strings to structured entries such as `select_image_asset` plus `image_reference | video_first_frame`. The current release preserves the deployed exact Chinese string for compatibility, but localization or wording changes remain coupled to behavior until the protocol evolves. - Add a first-class “remove reference image” control if the server introduces an explicit clear-source action; omission of an attachment must not implicitly clear a Conversation's frozen reference. ## Promotion Candidates - Target canonical documents: `20-architecture/system-overview.md`, `20-architecture/module-map.md`, `20-architecture/data-flow.md`, and `40-domain/business-rules.md`. Proposal: record the generalized single-image source picker, its single-Asset attachment boundary, medium-specific intent, and null-medium video compatibility fallback. Evidence: the 25 focused page tests plus typecheck, scoped ESLint and production build listed above. Future impact: future picker redesigns must preserve Workspace ownership and attach one real Asset ID rather than relying on a visual description. No semantic conflict; canonical promotion belongs to a serialized Integration task. - Target canonical ADR/protocol documentation: the accepted AI Design Conversation/Gateway contract. Proposal: replace localized quick-reply string matching with a structured picker action before adding more asset-input purposes. Evidence: one display string now intentionally opens both image and video source flows, with purpose inferred from current Brief medium. Future impact: removes localization and delayed-state coupling. This is a future protocol change and requires coordinated server/client design confirmation.