26 lines
576 B
Python
26 lines
576 B
Python
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
class HotwordBase(BaseModel):
|
|
word: str
|
|
weight: Optional[float] = 1.0
|
|
scope: Optional[str] = "personal"
|
|
|
|
class HotwordCreate(HotwordBase):
|
|
pass
|
|
|
|
class HotwordUpdate(HotwordBase):
|
|
word: Optional[str] = None
|
|
scope: Optional[str] = None
|
|
|
|
class Hotword(HotwordBase):
|
|
id: int
|
|
pinyin: Optional[str] = None
|
|
scope: str
|
|
creator_id: Optional[int] = None
|
|
creator_name: Optional[str] = None
|
|
creator_username: Optional[str] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|