update:更新自定义写作风格模块
This commit is contained in:
@@ -54,4 +54,9 @@ class ChapterResponse(BaseModel):
|
||||
class ChapterListResponse(BaseModel):
|
||||
"""章节列表响应模型"""
|
||||
total: int
|
||||
items: list[ChapterResponse]
|
||||
items: list[ChapterResponse]
|
||||
|
||||
|
||||
class ChapterGenerateRequest(BaseModel):
|
||||
"""AI生成章节内容的请求模型"""
|
||||
style_id: Optional[int] = Field(None, description="写作风格ID,不提供则不使用任何风格")
|
||||
@@ -0,0 +1,54 @@
|
||||
"""写作风格 Schema"""
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class WritingStyleBase(BaseModel):
|
||||
"""写作风格基础模型"""
|
||||
name: str = Field(..., description="风格名称")
|
||||
style_type: str = Field(..., description="风格类型:preset/custom")
|
||||
preset_id: Optional[str] = Field(None, description="预设风格ID")
|
||||
description: Optional[str] = Field(None, description="风格描述")
|
||||
prompt_content: str = Field(..., description="风格提示词内容")
|
||||
|
||||
|
||||
class WritingStyleCreate(WritingStyleBase):
|
||||
"""创建写作风格(仅用于创建项目自定义风格)"""
|
||||
project_id: str = Field(..., description="所属项目ID")
|
||||
|
||||
|
||||
class WritingStyleUpdate(BaseModel):
|
||||
"""更新写作风格"""
|
||||
name: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
prompt_content: Optional[str] = None
|
||||
|
||||
|
||||
class SetDefaultStyleRequest(BaseModel):
|
||||
"""设置默认风格请求"""
|
||||
project_id: str = Field(..., description="项目ID")
|
||||
|
||||
|
||||
class WritingStyleResponse(BaseModel):
|
||||
"""写作风格响应"""
|
||||
id: int
|
||||
project_id: Optional[str] = None # NULL 表示全局预设风格
|
||||
name: str
|
||||
style_type: str
|
||||
preset_id: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
prompt_content: str
|
||||
is_default: bool
|
||||
order_index: int
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class WritingStyleListResponse(BaseModel):
|
||||
"""写作风格列表响应"""
|
||||
total: int
|
||||
styles: list[WritingStyleResponse]
|
||||
Reference in New Issue
Block a user