Files
NianAIGC/task_plan.md
2026-07-03 11:25:25 +08:00

27 KiB

Task Plan: EvoLink Image Engine Settings

Goal

Add EvoLink GPT Image 2 as a selectable image creation engine in the settings flow, while preserving the existing Jimeng/Volcengine image engine and the current task/asset workflow.

Current Phase

Phase 39 - Task Module Width and Preview Polish complete

Phases

Phase 1: Trace Current Settings and Provider Flow

  • Restore project planning context
  • Inspect settings API and settings panel
  • Inspect image generation submission/sync flow
  • Status: complete
  • Create EvoLink image client with submit/query helpers
  • Add provider selection helpers and payload mapping
  • Route image job submission/sync through selected provider
  • Status: complete

Phase 3: Expose Engine Settings

  • Add settings fields for image engine and EvoLink credentials/model options
  • Update settings status/capability display
  • Document new env vars
  • Status: complete

Phase 4: Verification

  • Add or update focused tests
  • Run relevant tests/build checks
  • Browser-check the settings UI
  • Status: complete

Phase 5: Full Product UI/UX and Motion Polish

  • Add GSAP as the frontend motion dependency
  • Add a scoped client motion utility layer with reduced-motion handling and cleanup
  • Refresh global design tokens, focus states, navigation, mobile layout, and core page hierarchy
  • Polish /create, /assets, /settings, and image editing flows without changing backend APIs
  • Status: complete

Phase 6: Header and Module Cleanup

  • Compact the top title bar
  • Remove visible English module eyebrows and helper descriptions
  • Remove right-side title badges from modules
  • Reduce mobile horizontal scrolling in the lower create controls
  • Status: complete

Phase 7: Seedance API Limits Alignment

  • Verify official Seedance docs for current duration, ratio, and resolution constraints
  • Change video duration from free numeric input to official 4 to 15 second choices
  • Add server-side normalization for duration, ratio, and resolution
  • Document Seedance duration, ratio, and fast-model resolution restrictions
  • Status: complete

Phase 8: Product Branding

  • Replace generated text mark with logo assets from /Users/inmanx/Documents/icon/logo
  • Rename product surfaces to 智念AIGC平台
  • Remove logo frame/background after visual feedback
  • Verify desktop and mobile header rendering
  • Status: complete

Phase 9: Server Deployment Support

  • Add Dockerfile for production image builds
  • Add Docker Compose service with runtime persistence and healthcheck
  • Add setup/deploy scripts
  • Document one-command server deployment in Chinese README
  • Verify shell syntax, unit tests, production build, and local health
  • Status: complete

Phase 10: Task Management and Public API v1

  • Extend generation job fields for task ownership, idempotency, locking, retry, timing, and webhook delivery
  • Split task creation from provider execution so page/API submits enqueue only
  • Add task management service, worker loop, API key auth, webhook delivery, and OpenAPI output
  • Add /api/v1 capabilities, assets, jobs, cancel, and openapi routes
  • Add Docker Compose worker service, npm worker script, docs, and env examples
  • Add focused tests and run verification commands
  • Status: complete

Phase 11: Deployable Handoff and Integration Surface

  • Add operations-facing deployment documentation
  • Add partner-facing API integration documentation
  • Expand OpenAPI output for task, asset, upload, download, and webhook flows
  • Add authenticated public asset detail and download endpoints
  • Tag API-generated assets by client for stable follow-up access
  • Verify real HTTP API calls, Worker task processing, tests, and production build
  • Status: complete

Phase 12: Engine-Aware Image Tuning

  • Replace the free text-influence slider with user-facing option presets
  • Detect the active image generation engine from /api/health
  • Send Jimeng scale only when the active engine is Jimeng
  • Send EvoLink quality only when the active engine is EvoLink
  • Verify tests, production build, and desktop/mobile create-page layout
  • Status: complete

Phase 13: Account Login and SSO Protection

  • Trace existing page/API access and data ownership boundaries
  • Add OAuth2 Authorization Code login, callback, logout, and current-user session helpers
  • Verify JWT locally with JWKS and validate issuer/client/scope claims
  • Protect browser pages and first-party UI APIs while preserving public API key and worker endpoints
  • Thread authenticated owner IDs through assets and generation jobs
  • Add focused tests, docs, env examples, and run verification
  • Status: complete

Phase 14: Password Captcha Login

  • Verify auth captcha endpoint and password grant response shape without printing tokens
  • Add /api/auth/captcha proxy and /api/auth/password session-issuing login endpoint
  • Add account/password/captcha form to /auth/login
  • Verify login creates a session and logout returns to the login page
  • Status: complete

Phase 15: Standalone Login Page Polish

  • Remove the shared top bar from /auth/* pages
  • Keep only the logo, platform name, and account login form on the login page
  • Remove the visible unified-auth/SSO login entry from the login page
  • Apply the existing GSAP motion helper layer to the standalone login layout
  • Verify desktop and mobile login layout has no horizontal overflow
  • Status: complete

Phase 16: Repository Sync and Local Startup Status

  • Overwrite local workspace with the latest origin/main
  • Confirm the repository is clean at d98e58a docs: update public api docs
  • Verify the Next.js dev server can start locally on an alternate port
  • Record current process/port status after the dev session ended
  • Status: complete

Phase 17: Account ID Data Partitioning for Public API

  • Trace current owner/client/account boundaries
  • Add stable account-owner mapping for API clients
  • Route public API jobs/assets through the account owner
  • Add focused isolation tests and docs
  • Status: complete

Phase 18: Internal RBAC and Account Management Integration

  • Inspect current auth/session/nav/admin page boundaries
  • Attempt to read operations organization external API guide
  • Add admin/ordinary user permission model
  • Protect admin pages and admin APIs
  • Add account-management integration from the updated organization/user API guide
  • Verify tests/build and local behavior
  • Status: complete

Phase 19: Account Management Route Compatibility

  • Trace /accounts 404 from local logs to the upstream member-list route
  • Add configurable organization/member path overrides
  • Degrade missing member-list routes to page warnings instead of API 404
  • Update docs and focused tests
  • Status: complete

Phase 20: Account-Scoped Image Generation Templates

  • Trace current image generation, settings, auth owner, and data persistence paths
  • Design account-scoped template data with prompt presets and preview metadata
  • Add backend storage helpers and first-party template API routes
  • Add template configuration to settings and template selection to image generation
  • Add focused tests and run verification
  • Status: complete

Phase 21: Account Management Upstream Permission Degradation

  • Confirm the updated member-list path reaches hotelStaff
  • Identify the current failure as upstream administrator-role denial, not route/configuration miss
  • Degrade member-list permission denial to an account-page warning with an empty member list
  • Keep organization, role, group, account creation, and password maintenance flows available when configured
  • Add focused permission-denial classification test and run verification
  • Status: complete

Phase 22: Image Template Placement and In-Module Configuration

  • Remove template management from the global settings page
  • Move image template selection to the right side of the image generation console
  • Add template configuration flow inside the image generation module
  • Verify desktop/mobile layout, tests, and build
  • Status: complete
  • Trace new-account login loop from /api/auth/password success back to /auth/login
  • Add chunked session cookie helpers for large JWT/authority payloads
  • Read chunked session cookies in middleware and server-side current-user helpers
  • Write chunked cookies from password and OAuth login, and clear all chunks on logout
  • Add focused session-cookie reassembly test and run verification
  • Status: complete

Phase 24: Left Template Rail for Image Generation

  • Move template selection into a left vertical scroll rail
  • Put the add-template icon button under the template rail heading
  • Keep template cards to thumbnail plus name with selected state
  • Apply selected template parameters into the right generation console
  • Verify layout, tests, and build
  • Status: complete

Phase 25: Independent Template Column for Image Generation

  • Split template selection out of the generation panel frame
  • Render templates as an independent left column panel
  • Keep the right panel dedicated to generation inputs and settings
  • Verify desktop and narrow viewport geometry
  • Run tests and production build
  • Status: complete

Phase 26: Generation Console Owns Mode Switch

  • Move the image/video/edit mode switch into the generation console panel
  • Keep the template module as the far-left independent module
  • Remove global/sticky mode-switch styling that visually spans modules
  • Verify the mode switch is contained by the generation panel, not the template panel
  • Run tests and production build
  • Status: complete

Phase 27: Template Upload Placeholders

  • Reuse the existing asset upload/OSS flow for template preview images
  • Remove template category/remark UI and expose an intro field instead
  • Parse @图片1 style prompt placeholders into visible required upload slots
  • Keep selected-template parameters flowing into the generation console
  • Verify tests, build, and local server restart
  • Status: complete

Phase 28: Add Template Modal UX Polish

  • Apply UI/UX skill recommendations to the add-template modal
  • Reorganize the modal into preview, form, and action regions
  • Show parsed placeholder chips while editing preset prompt
  • Verify responsive layout, tests, build, and local server status
  • Status: complete

Phase 29: Template Engine-Specific Parameters

  • Add image generation engine and engine-specific parameters to template settings
  • Allow per-request image engine override when submitting image jobs
  • Add engine selection and conditional parameter controls to the add-template modal
  • Apply selected template engine/parameters into the generation console
  • Verify tests, build, browser layout, and local server restart
  • Status: complete

Phase 30: Template Rail Editing and Placeholder Confirmation

  • Tighten material placeholder parsing so unfinished @图片 text is not treated as a completed token
  • Add explicit placeholder insertion controls in template prompt editing
  • Support editing existing templates through the in-module modal and PATCH API
  • Widen the left template module and split image preview, selection, and edit actions
  • Verify tests, build, browser layout, and local server restart
  • Status: complete

Phase 31: Confirmed Material Draft Slot

  • Open a temporary material slot when a user types @
  • Confirm the slot into prompt text only on Enter/explicit selection
  • Keep invalid long text out of the prompt body and placeholder chips
  • Render confirmed tokens through the existing independent token/chip UI
  • Verify tests, build, browser interaction, mobile layout, and local server restart
  • Status: complete

Phase 32: Inline Floating Material Draft Slot

  • Float the temporary material draft slot inside the prompt editor surface
  • Add the same token overlay to template preset prompts
  • Keep confirmed @图片1 / @视频1 placeholders visibly colored inside the input area
  • Verify main prompt and template prompt interactions in the browser
  • Run tests, production build, and normal server restart checks
  • Status: complete

Phase 33: Wider Template Rail and Explicit Select Button

  • Widen the image template selection column another 1.5x on desktop and tablet layouts
  • Keep 9:16 and 16:9 template reference images visible without cropping
  • Make template application require a dedicated 选择模板 button instead of clicking the card text
  • Verify desktop/mobile geometry, click behavior, focused tests, and production build
  • Status: complete

Phase 34: Fixed Template Cards and Internal Rail Scroll

  • Make each template card a smaller fixed-size item
  • Match the template rail height to the right generation panel height
  • Keep the 模板选择 header and 添加模板 button fixed while only the template list scrolls
  • Verify desktop/mobile geometry, internal scroll behavior, focused tests, and production build
  • Status: complete

Phase 35: Full-Bleed Glass Template Cards

  • Use the template image as the full-card visual surface
  • Move title, description, and select action into a translucent glass panel floating at the card bottom
  • Remove the zoom icon while keeping the edit action at the top right
  • Add a stronger elevated selected-card shadow
  • Verify browser geometry, focused tests, and production build
  • Status: complete

Phase 36: Template Toggle Cancel and No Intro Field

  • Remove the template intro field from the template card and editor UI
  • Move the template edit icon into the frosted-glass card overlay
  • Make the selected template button toggle off on a second click
  • Restore the right-side generation prompt and image parameters when canceling template selection
  • Verify browser interaction, focused tests, and production build
  • Status: complete

Phase 37: Template Card UI Density Polish

  • Reduce the fixed template card size while preserving full-bleed image previews
  • Let the widened desktop rail fit three compact template cards per row
  • Reflow the frosted-glass footer so the title owns the first row and select/edit controls share the second row
  • Remove the remaining frontend template description field from the create-studio type surface
  • Verify geometry, focused tests, and production build
  • Status: complete

Phase 38: Right-Side Create Task Module

  • Add an independent right-side task module to the creation console
  • Show generated asset thumbnail, task name, status, elapsed time, and detail entry
  • Link detail entry to the results task page with the matching task expanded
  • Add responsive desktop/tablet/mobile layout behavior
  • Verify focused tests, TypeScript, production build, and browser layout
  • Status: complete

Phase 39: Task Module Width and Preview Polish

  • Widen the right-side task module up to roughly double the original width on wide screens
  • Keep task card information on one horizontal row without wrapping status/time/action
  • Show a 生成中 placeholder thumbnail for queued/running tasks without output assets
  • Allow completed image thumbnails to open a large preview directly from the create page
  • Verify TypeScript, build, focused tests, and browser desktop/mobile behavior
  • Status: complete

Key Questions

  1. How should the selected image engine be stored and exposed in settings?
  2. Which current capabilities should EvoLink handle first?
  3. How do EvoLink task statuses map to the local GenerationJob statuses?
  4. How can the fallback/mock behavior remain friendly for local development?

Decisions Made

Decision Rationale
Keep planning files in the project root for this exploration The planning-with-files skill requires persistent context for multi-step repository research
Keep Jimeng as the default image engine Preserves current behavior unless the user opts into EvoLink
Treat EvoLink as a provider inside the existing async job/asset pipeline EvoLink returns async task ids and result URLs, matching the current job sync architecture
Use GSAP through local helpers instead of scattering animation calls in components Keeps motion cleanup, reduced-motion behavior, and animation timing consistent
Keep UI polish scoped to frontend surfaces and avoid backend API/schema changes Matches the requested product polish while preserving current workflows
Follow official Seedance 2.0 duration range 4~15 seconds in the UI Prevents the user from selecting values the API rejects
Preserve -1 Seedance auto duration only in backend/env normalization, not in the default UI dropdown Keeps the UI predictable while still supporting advanced configuration
Use the black/blue transparent NIANXX logo on the light top bar Makes the logo visible without adding a frame that changes the brand feel
Use Docker Compose as the primary server deployment path Gives server operators one command, persistent local runtime data, and a restart policy
Implement multi-task support as task management, not an external message queue Matches user preference and keeps deployment simpler for this server product
Use API Key auth for public API v1 Fastest stable server-to-server integration model for other AI systems
Use OAuth2 Authorization Code for the browser UI login Matches the provided SSO guide and keeps client_secret on the server
Derive first-party owner ids from verified JWT claims as auth:<clientId>:<user_id/sub> Gives logged-in users isolated assets and jobs without changing the storage schema
Keep /api/v1/* outside SSO middleware Existing partner integrations authenticate with API keys and must not be redirected to browser login
Add password grant login as a first-class browser login path The provided auth service currently accepts customPC password login with image captcha while /oauth2/authorize returns 400 for the local callback
Hide the unified-auth/SSO entry from the login page The user wants a focused branded login screen with only logo, platform name, and the account login form
Use an alternate local dev port when 3000 is occupied Existing local Next processes may already bind common ports; startup verification should use a free port and record the actual URL
Partition public API records by an owner id derived from the API account id Avoids storing all partner API jobs/assets under demo-merchant and makes account boundaries explicit in the data layer
Use JWT authorities as the RBAC source of truth Auth center already issues authorities; this keeps ordinary/admin access controlled by the organization identity system
Add image templates as account-owned app data instead of environment settings Templates include business prompts and preview metadata, so they should follow the authenticated owner boundary rather than global deployment config
Keep image template configuration inside the image generation module instead of global settings Templates are part of the image creation workflow, and users should configure them where they select and apply them
Split oversized auth sessions across multiple cookies Some real accounts can receive larger JWT/authority payloads; chunking avoids successful password login immediately losing the browser session
Use a left template rail for image mode The user expects template selection to behave like a vertical picker beside the generation console, with the generation controls on the right reflecting the selected template
Make the image template rail its own panel The user clarified the template picker should be an independent column, not merged inside the generation console frame
Keep the mode switch inside the generation console The user clarified the image/video filter belongs to the generation console, while templates should remain a separate far-left module
Reuse /api/assets/upload for template preview images The existing upload route already stores assets through the configured OSS/local storage layer under the authenticated owner boundary
Treat @图片N as a required upload placeholder Template prompts should make missing source images visible in the generation console before users submit a job
Use a preview-first add-template modal layout UI/UX skill guidance favors a focused form with a strong preview and clear submit action for this kind of template creation flow
Store engine-specific image template parameters in template settings Jimeng and EvoLink Image2 use different request parameters, so templates must preserve the intended engine and the matching tuning option
Require numbered material placeholder tokens @图片1 is an explicit completed placeholder; bare @图片 remains ordinary text/search state so later Chinese input is not swallowed as the placeholder name
Keep the temporary material draft slot inside prompt editor bounds The user expects @ entry to feel like an inline input affordance, while confirmed placeholders should remain visually distinct inside the same input surface

Errors Encountered

Error Attempt Resolution
git status --short failed because this is not a Git repository 1 Continue as a plain project folder and inspect files directly
zsh expanded unquoted [id] route paths 1 Quote bracketed route paths
Initial curl requests hit a local proxy and returned 502/empty output 1 Re-ran direct requests with curl --noproxy '*'
Browser text wait hit a transient detached element after clicking the EvoLink tab 1 Re-read page body and confirmed the EvoLink settings tab rendered correctly
npm start failed when .next contained only dev cache and no production BUILD_ID 1 Added prestart to build automatically and pinned next start to 127.0.0.1:3000
Settings page briefly showed a client exception after rebuilding while the old production server was still running 1 Restarted the production server on the fresh build and confirmed the status page rendered
npm run build failed after Seedance settings update because TypeScript narrowed fast-model resolution choices too aggressively 1 Changed resolution includes checks to readonly string arrays and rebuilt successfully
Running npm run build while an old dev server was active caused stale Next dev chunks in prior verification 1 Stop dev server before production builds, then restart it afterward
White transparent logo was invisible on the light top bar unless wrapped in a dark frame 1 Switched to the black/blue logo variant, generated a cropped transparent PNG, and removed frame/background styling
Current local machine does not expose Docker CLI 1 Verified script syntax, Next build, tests, and health locally; Docker build should be run on the deployment server
Docker CLI is still unavailable while validating Phase 10 1 Verified npm tests, production build, local health, API v1 calls, and worker tick locally; Compose container startup should be validated on the deployment server
Local ports 3000, 3001, and 3002 were already occupied during startup verification 1 Started the current project on 127.0.0.1:3003 and verified it redirected to /auth/login?next=%2F
zsh expanded unquoted [id] API route paths during Phase 17 inspection 1 Re-read those dynamic route files with quoted paths
/Users/inmanx/Desktop/organization-external-api.md was not present 1 User provided updated /Users/inmanx/Desktop/organization-external-api(1).md; wired the account-management endpoints from that version
Logged-in /api/admin/accounts returned 404 for organizationMember/organizationMemberList 1 Added ZHINIAN_ORG_MEMBER_LIST_PATH override support and degraded missing member-list routes to a warning so /accounts returns 200
Running npm run build while the dev server was active caused the dev server to miss .next/server/vendor-chunks/next.js for the new dynamic template route 1 Restarted the dev server, confirmed it rebuilt the route, deleted the temporary verification template, then restarted the server under the normal auth-enabled environment
Updated hotelStaff member-list proxy returned 仅管理员角色允许调用 for the current token 1 Classified the upstream permission denial and degraded only the member list to a warning/empty page instead of failing the whole accounts screen
New account login returned 200 from /api/auth/password but was redirected back to /auth/login?next=/create 1 Added chunked session cookies so larger JWT/authority payloads are preserved across the browser redirect

Notes

  • EvoLink docs: submit POST /v1/images/generations, query GET /v1/tasks/{task_id}, completed task exposes results[].
  • EvoLink resolution is only effective when size is a ratio, so the adapter maps current UI dimensions to supported ratio values where possible.
  • Engine selection now lives in the settings status tab as per-capability assignments: image generate and inpaint are configurable, upscale and video are fixed to their current engines.
  • Current local dev server convention: screen session zhinian-dev-ui, 127.0.0.1:3000, logs at /tmp/zhinian-dev-server.log.
  • Before production build verification, stop the dev server first to avoid stale .next dev chunk references.
  • Latest product name is 智念AIGC平台.
  • Current header logo asset is public/logo/zhinian-logo.png, generated from /Users/inmanx/Documents/icon/logo/2d5b992caa14db16f594c4933e92e37e.png.
  • Server one-command deployment entrypoint is bash scripts/deploy.sh.
  • Docker Compose persists local uploads/results/state through the bind mount ./.runtime:/app/.runtime.
  • Public API v1 endpoints are under /api/v1 and require ZHINIAN_API_KEYS.
  • Public API account data is partitioned by the API key account id as ownerId = api:<accountId>.
  • Task processing is handled by npm run worker or the zhinian-worker Compose service through /api/internal/worker/tick.
  • Latest repository sync status: main tracks origin/main and is clean at d98e58a docs: update public api docs.
  • Latest local startup verification used npm run dev -- --hostname 127.0.0.1 --port 3003; the server reached Ready and / returned a login redirect.
  • Current status check on 2026-06-09: no next dev / next-server process is listening on 3003, so the dev server is not currently running.
  • Image templates are now account-scoped records exposed through /api/image-templates; the image creation page shows and manages them inside the image module.