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;
|
||||
};
|
||||
Reference in New Issue
Block a user