init
This commit is contained in:
@@ -0,0 +1,304 @@
|
||||
// 用户类型定义
|
||||
export interface User {
|
||||
user_id: string;
|
||||
username: string;
|
||||
display_name: string;
|
||||
avatar_url?: string;
|
||||
trust_level: number;
|
||||
is_admin: boolean;
|
||||
linuxdo_id: string;
|
||||
created_at: string;
|
||||
last_login: string;
|
||||
}
|
||||
|
||||
// LinuxDO 授权 URL 响应
|
||||
export interface AuthUrlResponse {
|
||||
auth_url: string;
|
||||
state: string;
|
||||
}
|
||||
|
||||
// 项目类型定义
|
||||
export interface Project {
|
||||
id: string; // UUID字符串
|
||||
title: string;
|
||||
description?: string;
|
||||
theme?: string;
|
||||
genre?: string;
|
||||
target_words?: number;
|
||||
current_words: number;
|
||||
status: 'planning' | 'writing' | 'revising' | 'completed';
|
||||
wizard_status?: 'incomplete' | 'completed';
|
||||
wizard_step?: number;
|
||||
world_time_period?: string;
|
||||
world_location?: string;
|
||||
world_atmosphere?: string;
|
||||
world_rules?: string;
|
||||
chapter_count?: number;
|
||||
narrative_perspective?: string;
|
||||
character_count?: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface ProjectCreate {
|
||||
title: string;
|
||||
description?: string;
|
||||
theme?: string;
|
||||
genre?: string;
|
||||
target_words?: number;
|
||||
wizard_status?: 'incomplete' | 'completed';
|
||||
wizard_step?: number;
|
||||
world_time_period?: string;
|
||||
world_location?: string;
|
||||
world_atmosphere?: string;
|
||||
world_rules?: string;
|
||||
}
|
||||
|
||||
export interface ProjectUpdate {
|
||||
title?: string;
|
||||
description?: string;
|
||||
theme?: string;
|
||||
genre?: string;
|
||||
target_words?: number;
|
||||
status?: 'planning' | 'writing' | 'revising' | 'completed';
|
||||
world_time_period?: string;
|
||||
world_location?: string;
|
||||
world_atmosphere?: string;
|
||||
world_rules?: string;
|
||||
chapter_count?: number;
|
||||
narrative_perspective?: string;
|
||||
character_count?: number;
|
||||
// current_words 由章节内容自动计算,不在此接口中
|
||||
}
|
||||
|
||||
// 向导专用的项目更新接口,包含向导流程控制字段
|
||||
export interface ProjectWizardUpdate extends ProjectUpdate {
|
||||
wizard_status?: 'incomplete' | 'completed';
|
||||
wizard_step?: number;
|
||||
}
|
||||
|
||||
// 项目创建向导
|
||||
export interface ProjectWizardRequest {
|
||||
title: string;
|
||||
theme: string;
|
||||
genre?: string;
|
||||
chapter_count: number;
|
||||
narrative_perspective: string;
|
||||
character_count?: number;
|
||||
target_words?: number;
|
||||
world_building?: {
|
||||
time_period: string;
|
||||
location: string;
|
||||
atmosphere: string;
|
||||
rules: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface WorldBuildingResponse {
|
||||
project_id: string;
|
||||
time_period: string;
|
||||
location: string;
|
||||
atmosphere: string;
|
||||
rules: string;
|
||||
}
|
||||
|
||||
// 大纲类型定义
|
||||
export interface Outline {
|
||||
id: string;
|
||||
project_id: string;
|
||||
title: string;
|
||||
content: string;
|
||||
structure?: string;
|
||||
order_index: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface OutlineCreate {
|
||||
project_id: string;
|
||||
title: string;
|
||||
content: string;
|
||||
structure?: string;
|
||||
order_index: number;
|
||||
}
|
||||
|
||||
export interface OutlineUpdate {
|
||||
title?: string;
|
||||
content?: string;
|
||||
// structure 暂不支持修改
|
||||
// order_index 只能通过 reorder 接口批量调整
|
||||
}
|
||||
|
||||
// 角色类型定义
|
||||
export interface Character {
|
||||
id: string;
|
||||
project_id: string;
|
||||
name: string;
|
||||
age?: string;
|
||||
gender?: string;
|
||||
is_organization: boolean;
|
||||
role_type?: string;
|
||||
personality?: string;
|
||||
background?: string;
|
||||
appearance?: string;
|
||||
relationships?: string;
|
||||
organization_type?: string;
|
||||
organization_purpose?: string;
|
||||
organization_members?: string;
|
||||
traits?: string;
|
||||
avatar_url?: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface CharacterUpdate {
|
||||
name?: string;
|
||||
age?: string;
|
||||
gender?: string;
|
||||
is_organization?: boolean;
|
||||
role_type?: string;
|
||||
personality?: string;
|
||||
background?: string;
|
||||
appearance?: string;
|
||||
relationships?: string;
|
||||
organization_type?: string;
|
||||
organization_purpose?: string;
|
||||
organization_members?: string;
|
||||
traits?: string;
|
||||
}
|
||||
|
||||
// 章节类型定义
|
||||
export interface Chapter {
|
||||
id: string;
|
||||
project_id: string;
|
||||
title: string;
|
||||
content?: string;
|
||||
summary?: string;
|
||||
chapter_number: number;
|
||||
word_count: number;
|
||||
status: 'draft' | 'writing' | 'completed';
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface ChapterCreate {
|
||||
project_id: string;
|
||||
title: string;
|
||||
chapter_number: number;
|
||||
content?: string;
|
||||
summary?: string;
|
||||
status?: 'draft' | 'writing' | 'completed';
|
||||
}
|
||||
|
||||
export interface ChapterUpdate {
|
||||
title?: string;
|
||||
content?: string;
|
||||
// chapter_number 不允许修改,由大纲顺序决定
|
||||
summary?: string;
|
||||
// word_count 自动计算,不允许手动修改
|
||||
status?: 'draft' | 'writing' | 'completed';
|
||||
}
|
||||
|
||||
// 章节生成检查响应
|
||||
export interface ChapterCanGenerateResponse {
|
||||
can_generate: boolean;
|
||||
reason: string;
|
||||
previous_chapters: {
|
||||
id: string;
|
||||
chapter_number: number;
|
||||
title: string;
|
||||
has_content: boolean;
|
||||
word_count: number;
|
||||
}[];
|
||||
chapter_number: number;
|
||||
}
|
||||
|
||||
// AI生成请求类型
|
||||
export interface GenerateOutlineRequest {
|
||||
project_id: string;
|
||||
genre?: string;
|
||||
theme: string;
|
||||
chapter_count: number;
|
||||
narrative_perspective: string;
|
||||
world_context?: Record<string, unknown>;
|
||||
characters_context?: Character[];
|
||||
target_words?: number;
|
||||
requirements?: string;
|
||||
provider?: string;
|
||||
model?: string;
|
||||
// 续写功能新增字段
|
||||
mode?: 'auto' | 'new' | 'continue';
|
||||
story_direction?: string;
|
||||
plot_stage?: 'development' | 'climax' | 'ending';
|
||||
keep_existing?: boolean;
|
||||
}
|
||||
|
||||
// 大纲重排序请求类型
|
||||
export interface OutlineReorderItem {
|
||||
id: string;
|
||||
order_index: number;
|
||||
}
|
||||
|
||||
export interface OutlineReorderRequest {
|
||||
orders: OutlineReorderItem[];
|
||||
}
|
||||
|
||||
export interface GenerateCharacterRequest {
|
||||
project_id: string;
|
||||
name?: string;
|
||||
role_type?: string;
|
||||
background?: string;
|
||||
requirements?: string;
|
||||
provider?: string;
|
||||
model?: string;
|
||||
}
|
||||
|
||||
export interface PolishTextRequest {
|
||||
text: string;
|
||||
style?: string;
|
||||
}
|
||||
|
||||
// 向导API响应类型
|
||||
export interface GenerateCharactersResponse {
|
||||
characters: Character[];
|
||||
}
|
||||
|
||||
export interface GenerateOutlineResponse {
|
||||
outlines: Outline[];
|
||||
}
|
||||
|
||||
// API响应类型
|
||||
export interface ApiResponse<T> {
|
||||
data: T;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface PaginationResponse<T> {
|
||||
items: T[];
|
||||
total: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
total_pages: number;
|
||||
}
|
||||
|
||||
// 向导表单数据类型
|
||||
export interface WizardBasicInfo {
|
||||
title: string;
|
||||
description: string;
|
||||
theme: string;
|
||||
genre: string | string[];
|
||||
chapter_count: number;
|
||||
narrative_perspective: string;
|
||||
character_count?: number;
|
||||
target_words?: number;
|
||||
}
|
||||
|
||||
// API 错误响应类型
|
||||
export interface ApiError {
|
||||
response?: {
|
||||
data?: {
|
||||
detail?: string;
|
||||
};
|
||||
};
|
||||
message?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user