This commit is contained in:
commit
46af290db3
100 files changed
+16663
No files matched your search
@@ -0,0 +1,95 @@
|
||||
from typing import Any, Dict, List, Literal, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from models.bible import StoryBible
|
||||
|
||||
|
||||
class GenerateRequest(BaseModel):
|
||||
prompt: str
|
||||
provider: Literal["ollama", "openrouter"] = "ollama"
|
||||
model: Optional[str] = None
|
||||
api_key: Optional[str] = None # Опционально, обычно берется из .env
|
||||
preset: Literal["creative_draft", "editor", "brainstorm"] = "creative_draft"
|
||||
options: Optional[Dict[str, Any]] = None
|
||||
story_bible: Optional[StoryBible] = None # Story Bible для контекста
|
||||
selected_text: Optional[str] = None # Текст, который будет обрабатываться
|
||||
|
||||
|
||||
class GenerateResponse(BaseModel):
|
||||
generated_text: str
|
||||
provider: str
|
||||
model: str
|
||||
preset: str
|
||||
|
||||
|
||||
class ExtractedEntities(BaseModel):
|
||||
new_characters: List[Dict[str, Any]] = []
|
||||
new_locations: List[Dict[str, Any]] = []
|
||||
new_events: List[Dict[str, Any]] = []
|
||||
updated_traits: List[Dict[str, Any]] = []
|
||||
|
||||
|
||||
class ExtractEntitiesRequest(BaseModel):
|
||||
text: str
|
||||
existing_bible: Optional[StoryBible] = None
|
||||
task_type: str = "background"
|
||||
|
||||
|
||||
class ExtractEntitiesResponse(BaseModel):
|
||||
entities: ExtractedEntities
|
||||
model_used: str
|
||||
provider: str
|
||||
|
||||
|
||||
class AutoUpdateBibleRequest(BaseModel):
|
||||
project_id: str
|
||||
scene_text: str
|
||||
auto_update_enabled: bool = True
|
||||
|
||||
|
||||
class AutoUpdateBibleResponse(BaseModel):
|
||||
updated: bool
|
||||
new_characters: int = 0
|
||||
new_locations: int = 0
|
||||
new_events: int = 0
|
||||
message: str = ""
|
||||
|
||||
|
||||
class CleanupDuplicatesResponse(BaseModel):
|
||||
removed_characters: int = 0
|
||||
removed_locations: int = 0
|
||||
removed_events: int = 0
|
||||
message: str = ""
|
||||
|
||||
|
||||
class PreviewContextRequest(BaseModel):
|
||||
text: str
|
||||
story_bible: StoryBible
|
||||
|
||||
|
||||
class PreviewContextResponse(BaseModel):
|
||||
context_string: str
|
||||
mentioned_characters: List[str]
|
||||
mentioned_locations: List[str]
|
||||
mentioned_events: List[str]
|
||||
|
||||
|
||||
class GenerateImageRequest(BaseModel):
|
||||
prompt: str
|
||||
project_id: str
|
||||
document_id: str # ID документа (книги или главы)
|
||||
document_type: str # 'book' или 'chapter'
|
||||
model: Optional[str] = None
|
||||
size: str = "1024x1024"
|
||||
|
||||
|
||||
class GenerateImageResponse(BaseModel):
|
||||
image_id: str
|
||||
filename: str
|
||||
path: str
|
||||
prompt: str
|
||||
model: str
|
||||
data_url: str # base64 изображение для немедленного отображения
|
||||
document_id: str # ID документа, к которому привязано изображение
|
||||
document_type: str # 'book' или 'chapter'
|
||||
Reference in new issue
Block a user