2026-03-27 21:02:36 +02:00
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
|
|
|
|
|
2026-03-29 00:07:08 +02:00
|
|
|
class PromptCreate(BaseModel):
|
2026-03-27 21:02:36 +02:00
|
|
|
name: str = Field(..., min_length=1, max_length=200)
|
|
|
|
|
prompt: str = Field(..., min_length=1)
|
|
|
|
|
mode: str = Field(..., pattern="^(transform|explore)$")
|
|
|
|
|
search_space_id: int | None = None
|
2026-03-30 19:33:16 +02:00
|
|
|
is_public: bool = False
|
2026-03-27 21:02:36 +02:00
|
|
|
|
|
|
|
|
|
2026-03-29 00:07:08 +02:00
|
|
|
class PromptUpdate(BaseModel):
|
2026-03-27 21:02:36 +02:00
|
|
|
name: str | None = Field(None, min_length=1, max_length=200)
|
|
|
|
|
prompt: str | None = Field(None, min_length=1)
|
|
|
|
|
mode: str | None = Field(None, pattern="^(transform|explore)$")
|
2026-03-30 19:33:16 +02:00
|
|
|
is_public: bool | None = None
|
2026-03-27 21:02:36 +02:00
|
|
|
|
|
|
|
|
|
2026-03-29 00:07:08 +02:00
|
|
|
class PromptRead(BaseModel):
|
2026-03-31 18:05:42 +02:00
|
|
|
id: int
|
2026-03-27 21:02:36 +02:00
|
|
|
name: str
|
|
|
|
|
prompt: str
|
|
|
|
|
mode: str
|
2026-03-31 18:05:42 +02:00
|
|
|
search_space_id: int | None
|
|
|
|
|
is_public: bool
|
|
|
|
|
version: int
|
|
|
|
|
created_at: datetime
|
2026-03-27 21:02:36 +02:00
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
from_attributes = True
|
2026-03-30 19:33:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class PublicPromptRead(PromptRead):
|
|
|
|
|
author_name: str | None = None
|