feat: 完善图像工作区与创作工具体验
This commit is contained in:
114
shared/image-prompt-museum.ts
Normal file
114
shared/image-prompt-museum.ts
Normal file
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* Shared contract for the server-backed Prompt Museum.
|
||||
*
|
||||
* The renderer never bundles the museum dataset. It only receives these
|
||||
* records through the Main-owned Host API boundary.
|
||||
*/
|
||||
|
||||
export const IMAGE_PROMPT_MUSEUM_API_PATH = '/api/works/image-prompt-museum';
|
||||
|
||||
export const PROMPT_MUSEUM_CATEGORY_GROUPS = [
|
||||
'use_case',
|
||||
'style',
|
||||
'subject',
|
||||
] as const;
|
||||
|
||||
export type PromptMuseumCategoryGroup = typeof PROMPT_MUSEUM_CATEGORY_GROUPS[number];
|
||||
|
||||
export type PromptMuseumCategory = {
|
||||
id: string;
|
||||
name: string;
|
||||
group: PromptMuseumCategoryGroup;
|
||||
};
|
||||
|
||||
export type PromptMuseumFacet = {
|
||||
id: string;
|
||||
name: string;
|
||||
count?: number;
|
||||
};
|
||||
|
||||
export type PromptMuseumFacets = {
|
||||
useCases: PromptMuseumFacet[];
|
||||
styles: PromptMuseumFacet[];
|
||||
subjects: PromptMuseumFacet[];
|
||||
};
|
||||
|
||||
export type PromptMuseumAuthor = {
|
||||
name: string;
|
||||
url?: string | null;
|
||||
};
|
||||
|
||||
export type PromptMuseumSource = {
|
||||
name: string;
|
||||
url: string;
|
||||
};
|
||||
|
||||
export type PromptMuseumLicense = {
|
||||
name: string;
|
||||
url?: string | null;
|
||||
attributionText: string;
|
||||
};
|
||||
|
||||
export type PromptMuseumAttribution = {
|
||||
author: PromptMuseumAuthor;
|
||||
source: PromptMuseumSource;
|
||||
license: PromptMuseumLicense;
|
||||
};
|
||||
|
||||
export type PromptMuseumModel = {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type PromptMuseumImage = {
|
||||
url: string;
|
||||
width: number;
|
||||
height: number;
|
||||
alt: string;
|
||||
};
|
||||
|
||||
export type PromptMuseumVariable = {
|
||||
name: string;
|
||||
label: string;
|
||||
defaultValue?: string | null;
|
||||
required: boolean;
|
||||
};
|
||||
|
||||
export type PromptMuseumCard = {
|
||||
id: string;
|
||||
slug: string;
|
||||
title: string;
|
||||
summary: string;
|
||||
thumbnail: PromptMuseumImage;
|
||||
categories: PromptMuseumCategory[];
|
||||
model: PromptMuseumModel;
|
||||
language: string;
|
||||
attribution: PromptMuseumAttribution;
|
||||
publishedAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type PromptMuseumEntry = PromptMuseumCard & {
|
||||
prompt: string;
|
||||
variables: PromptMuseumVariable[];
|
||||
images: PromptMuseumImage[];
|
||||
requiresReferenceImages: boolean;
|
||||
};
|
||||
|
||||
export type PromptMuseumListQuery = {
|
||||
q?: string;
|
||||
useCase?: string;
|
||||
style?: string;
|
||||
subject?: string;
|
||||
language?: string;
|
||||
model?: string;
|
||||
cursor?: string;
|
||||
limit?: number;
|
||||
};
|
||||
|
||||
export type PromptMuseumPage = {
|
||||
items: PromptMuseumCard[];
|
||||
facets: PromptMuseumFacets;
|
||||
nextCursor: string | null;
|
||||
total?: number;
|
||||
};
|
||||
@@ -23,12 +23,45 @@ export type DesignBrief = {
|
||||
missingDecision: string | null;
|
||||
};
|
||||
|
||||
export type DesignGenerationOption<TValue extends string | number> = {
|
||||
value: TValue;
|
||||
label: string;
|
||||
default: boolean;
|
||||
disabled: boolean;
|
||||
multiplier: number;
|
||||
};
|
||||
|
||||
export type DesignGenerationParameters = {
|
||||
model: string;
|
||||
resolution: string;
|
||||
aspectRatio: string;
|
||||
durationSeconds: number | null;
|
||||
};
|
||||
|
||||
export type DesignGenerationOptions = {
|
||||
models: DesignGenerationOption<string>[];
|
||||
resolutions: DesignGenerationOption<string>[];
|
||||
durations: DesignGenerationOption<number>[];
|
||||
aspectRatios: DesignGenerationOption<string>[];
|
||||
};
|
||||
|
||||
export type DesignGenerationPricing = {
|
||||
schema: string;
|
||||
amount: number;
|
||||
rounding: string;
|
||||
};
|
||||
|
||||
export type DesignGenerationQuote = {
|
||||
quoteId: string;
|
||||
status: DesignQuoteStatus;
|
||||
medium: DesignMedium;
|
||||
briefVersion: number;
|
||||
briefSummary: string;
|
||||
finalPrompt: string;
|
||||
promptMode: string;
|
||||
generationParameters: DesignGenerationParameters;
|
||||
generationOptions: DesignGenerationOptions;
|
||||
pricing: DesignGenerationPricing;
|
||||
quotedDesignPoints: number;
|
||||
expiresAt: string;
|
||||
};
|
||||
@@ -159,6 +192,11 @@ export type DesignCreateWorkspaceInput = {
|
||||
title: string;
|
||||
};
|
||||
|
||||
export type DesignDeleteWorkspaceResult = {
|
||||
workspaceId: string;
|
||||
deleted: true;
|
||||
};
|
||||
|
||||
export type DesignCreateConversationInput = {
|
||||
workspaceId: string;
|
||||
clientConversationId: string;
|
||||
@@ -179,12 +217,21 @@ export type DesignSubmitMessageInput = {
|
||||
attachmentAssetIds?: string[];
|
||||
};
|
||||
|
||||
export type DesignGenerationQuoteUpdateInput = {
|
||||
workspaceId: string;
|
||||
quoteId: string;
|
||||
finalPrompt: string;
|
||||
generationParameters: DesignGenerationParameters;
|
||||
};
|
||||
|
||||
export type DesignConfirmGenerationInput = {
|
||||
workspaceId: string;
|
||||
conversationId: string;
|
||||
clientTurnId: string;
|
||||
expectedTurnRevision: number;
|
||||
quoteId: string;
|
||||
finalPrompt: string;
|
||||
generationParameters: DesignGenerationParameters;
|
||||
};
|
||||
|
||||
export function designAssetContentPath(workspaceId: string, assetId: string): string {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const SUPPORTED_LANGUAGE_CODES = ['en', 'zh', 'ja', 'ru'] as const;
|
||||
export const SUPPORTED_LANGUAGE_CODES = ['zh'] as const;
|
||||
|
||||
export type LanguageCode = (typeof SUPPORTED_LANGUAGE_CODES)[number];
|
||||
|
||||
@@ -10,7 +10,7 @@ function normalizeLocale(locale: string | null | undefined): string {
|
||||
|
||||
export function resolveSupportedLanguage(
|
||||
locale: string | null | undefined,
|
||||
fallback: LanguageCode = 'en',
|
||||
fallback: LanguageCode = 'zh',
|
||||
): LanguageCode {
|
||||
const normalizedLocale = normalizeLocale(locale);
|
||||
if (!normalizedLocale) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export const BUNDLED_OPENCODE_SKILL_IDS = [
|
||||
'agent-browser',
|
||||
'frontend-slides',
|
||||
'game-engine',
|
||||
'grilling',
|
||||
'planning-with-files',
|
||||
] as const;
|
||||
|
||||
Reference in New Issue
Block a user