21 lines
387 B
Python
21 lines
387 B
Python
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
class HotwordBase(BaseModel):
|
|
word: str
|
|
weight: Optional[float] = 1.0
|
|
|
|
class HotwordCreate(HotwordBase):
|
|
pass
|
|
|
|
class HotwordUpdate(HotwordBase):
|
|
word: Optional[str] = None
|
|
|
|
class Hotword(HotwordBase):
|
|
id: int
|
|
pinyin: Optional[str] = None
|
|
scope: str
|
|
|
|
class Config:
|
|
from_attributes = True
|