291 lines
7.7 KiB
TypeScript
291 lines
7.7 KiB
TypeScript
import type {
|
|
DesignCapabilities,
|
|
DesignForm,
|
|
DesignGenerationQuote,
|
|
DesignSpecificationValues,
|
|
DesignWorkspace,
|
|
DesignWorkspaceBootstrap,
|
|
DesignWorkspaceSummary,
|
|
} from '../../shared/image-workspace';
|
|
|
|
export const designCapabilitiesFixture: DesignCapabilities = {
|
|
conversation: true,
|
|
generation: true,
|
|
image: true,
|
|
video: true,
|
|
generationOptions: {
|
|
image: {
|
|
available: true,
|
|
supportedAspectRatios: ['1:1', '3:4', '9:16', '4:3', '16:9'],
|
|
supportedDurationSeconds: [],
|
|
maxOutputCount: 4,
|
|
requiresFirstFrame: false,
|
|
supportedReferenceRoles: ['inspiration', 'subject_identity'],
|
|
},
|
|
video: {
|
|
available: true,
|
|
supportedAspectRatios: ['1:1', '3:4', '9:16', '4:3', '16:9'],
|
|
supportedDurationSeconds: Array.from({ length: 30 }, (_, index) => index + 1),
|
|
maxOutputCount: 4,
|
|
requiresFirstFrame: true,
|
|
supportedReferenceRoles: ['first_frame'],
|
|
},
|
|
},
|
|
};
|
|
|
|
export const designValuesFixture: DesignSpecificationValues = {
|
|
intent: {
|
|
media: 'image',
|
|
creation_intent: 'create',
|
|
purpose: '新品发布主视觉',
|
|
channel: '小红书首图',
|
|
audience: '关注便携咖啡设备的年轻消费者',
|
|
intended_response: null,
|
|
communication_goal: null,
|
|
success_definition: null,
|
|
related_direction_id: null,
|
|
related_asset_id: null,
|
|
},
|
|
content: {
|
|
concept: '把便携咖啡机呈现为城市通勤中的精密工具',
|
|
narrative: null,
|
|
subjects: [],
|
|
action: null,
|
|
environment: null,
|
|
emotional_tone: null,
|
|
exact_content: [],
|
|
},
|
|
visual: {
|
|
art_direction: null,
|
|
cultural_cues: null,
|
|
composition: null,
|
|
viewpoint: null,
|
|
lighting: null,
|
|
palette: null,
|
|
materials: null,
|
|
finish: null,
|
|
},
|
|
layout: {
|
|
regions: [],
|
|
subject_placement: null,
|
|
text_placement: null,
|
|
logo_placement: null,
|
|
safe_areas: null,
|
|
crop_behavior: null,
|
|
typography: null,
|
|
exact_rendering: null,
|
|
},
|
|
references: [],
|
|
image: {
|
|
operation_intent: 'new_generation',
|
|
source_asset_id: null,
|
|
mask_asset_id: null,
|
|
preserve_instructions: [],
|
|
change_instructions: [],
|
|
background_behavior: null,
|
|
transparency_required: null,
|
|
edge_crop_behavior: null,
|
|
variant_relationship: null,
|
|
},
|
|
video: {
|
|
total_duration_seconds: null,
|
|
pacing: null,
|
|
first_frame_asset_id: null,
|
|
last_frame_asset_id: null,
|
|
shots: [],
|
|
rhythm: null,
|
|
speed_behavior: null,
|
|
stillness: null,
|
|
loop_behavior: null,
|
|
end_state: null,
|
|
continuity: null,
|
|
audio_intent: null,
|
|
},
|
|
output: {
|
|
aspect_ratio: '3:4',
|
|
orientation: 'portrait',
|
|
quality_intent: null,
|
|
delivery_format: 'PNG',
|
|
variant_count: 1,
|
|
variant_purposes: [],
|
|
crop_requirements: null,
|
|
export_requirements: null,
|
|
safe_areas: null,
|
|
},
|
|
constraints: {
|
|
must_include: [],
|
|
must_preserve: [],
|
|
must_avoid: [],
|
|
brand_constraints: [],
|
|
flexible_preferences: [],
|
|
acceptance_criteria: [],
|
|
},
|
|
};
|
|
|
|
export function designQuoteFixture(): DesignGenerationQuote {
|
|
return {
|
|
quoteId: 'quote-1',
|
|
status: 'offered',
|
|
specificationRevision: 3,
|
|
specificationRevisionId: 'specification-revision-3',
|
|
specificationDigest: 'a'.repeat(64),
|
|
medium: 'image',
|
|
compilerVersion: 'design-compiler-v2',
|
|
outputSummary: {
|
|
medium: 'image',
|
|
strategy: 'direct',
|
|
aspectRatio: '3:4',
|
|
outputCount: 1,
|
|
deliveryFormat: 'PNG',
|
|
durationSeconds: null,
|
|
requiredOutputRoles: ['primary'],
|
|
},
|
|
warnings: [],
|
|
quotedDesignPoints: 12,
|
|
maximumCustomerChargeAtoms: 1200,
|
|
expiresAt: '2030-01-02T03:04:05.000Z',
|
|
};
|
|
}
|
|
|
|
export function designSummaryFixture(
|
|
overrides: Partial<DesignWorkspaceSummary> = {},
|
|
): DesignWorkspaceSummary {
|
|
return {
|
|
workspaceId: 'workspace-1',
|
|
clientWorkspaceId: 'client-workspace-1',
|
|
title: '咖啡机新品主视觉',
|
|
directionId: 'direction-1',
|
|
sessionId: 'session-1',
|
|
directionRevision: 4,
|
|
specificationRevision: 3,
|
|
workspaceViewRevision: 6,
|
|
updatedAt: '2026-08-30T10:00:00.000Z',
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
export function designFormFixture(overrides: Partial<DesignForm> = {}): DesignForm {
|
|
return {
|
|
schemaVersion: 1,
|
|
workspaceId: 'workspace-1',
|
|
directionId: 'direction-1',
|
|
directionRevision: 4,
|
|
rawTurnSequence: 1,
|
|
specificationRevision: 3,
|
|
workspaceViewRevision: 6,
|
|
specificationRevisionId: 'specification-revision-3',
|
|
specificationDigest: 'a'.repeat(64),
|
|
specification: {
|
|
schema_version: 1,
|
|
values: structuredClone(designValuesFixture),
|
|
field_decisions: {
|
|
'intent.media': {
|
|
resolution: 'resolved',
|
|
provenance: 'user',
|
|
locked: true,
|
|
changed_by: 'interaction-1',
|
|
origin_turn_id: 'turn-1',
|
|
},
|
|
'intent.creation_intent': {
|
|
resolution: 'resolved',
|
|
provenance: 'extracted_user',
|
|
locked: false,
|
|
changed_by: 'interaction-1',
|
|
origin_turn_id: 'turn-1',
|
|
},
|
|
'intent.purpose': {
|
|
resolution: 'resolved',
|
|
provenance: 'extracted_user',
|
|
locked: false,
|
|
changed_by: 'interaction-1',
|
|
origin_turn_id: 'turn-1',
|
|
},
|
|
'intent.channel': {
|
|
resolution: 'resolved',
|
|
provenance: 'extracted_user',
|
|
locked: false,
|
|
changed_by: 'interaction-1',
|
|
origin_turn_id: 'turn-1',
|
|
},
|
|
'intent.audience': {
|
|
resolution: 'resolved',
|
|
provenance: 'extracted_user',
|
|
locked: false,
|
|
changed_by: 'interaction-1',
|
|
origin_turn_id: 'turn-1',
|
|
},
|
|
'content.concept': {
|
|
resolution: 'proposed',
|
|
provenance: 'agent_proposal',
|
|
locked: false,
|
|
changed_by: 'interaction-1',
|
|
origin_turn_id: 'turn-1',
|
|
},
|
|
'image.operation_intent': {
|
|
resolution: 'resolved',
|
|
provenance: 'deterministic',
|
|
locked: false,
|
|
changed_by: 'interaction-1',
|
|
origin_turn_id: null,
|
|
},
|
|
'output.aspect_ratio': {
|
|
resolution: 'resolved',
|
|
provenance: 'user',
|
|
locked: false,
|
|
changed_by: 'interaction-1',
|
|
origin_turn_id: 'turn-1',
|
|
},
|
|
'output.orientation': {
|
|
resolution: 'resolved',
|
|
provenance: 'deterministic',
|
|
locked: false,
|
|
changed_by: 'interaction-1',
|
|
origin_turn_id: null,
|
|
},
|
|
'output.delivery_format': {
|
|
resolution: 'resolved',
|
|
provenance: 'deterministic',
|
|
locked: false,
|
|
changed_by: 'interaction-1',
|
|
origin_turn_id: null,
|
|
},
|
|
'output.variant_count': {
|
|
resolution: 'resolved',
|
|
provenance: 'deterministic',
|
|
locked: false,
|
|
changed_by: 'interaction-1',
|
|
origin_turn_id: null,
|
|
},
|
|
},
|
|
},
|
|
decisionPrompts: [],
|
|
activeQuotes: [],
|
|
recentChangeSet: { interaction_id: 'interaction-1', changes: [] },
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
export function designWorkspaceFixture(
|
|
overrides: Partial<DesignWorkspace> = {},
|
|
): DesignWorkspace {
|
|
return {
|
|
workspace: designSummaryFixture(),
|
|
form: designFormFixture(),
|
|
turns: [{
|
|
turnId: 'turn-1',
|
|
rawTurnSequence: 1,
|
|
userMessage: '做一张便携咖啡机的小红书主视觉',
|
|
assistantMessage: '我已经整理了用途、受众和初步概念,请确认右侧建议。',
|
|
}],
|
|
tasks: [],
|
|
assets: [],
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
export function designBootstrapFixture(
|
|
workspace = designSummaryFixture(),
|
|
): DesignWorkspaceBootstrap {
|
|
return { capabilities: designCapabilitiesFixture, workspaces: [workspace] };
|
|
}
|