2026-02-27 07:57:22 +00:00
|
|
|
from typing import Optional
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
class HotwordBase(BaseModel):
|
|
|
|
|
word: str
|
|
|
|
|
weight: Optional[float] = 1.0
|
2026-03-02 10:26:22 +00:00
|
|
|
scope: Optional[str] = "personal"
|
2026-02-27 07:57:22 +00:00
|
|
|
|
|
|
|
|
class HotwordCreate(HotwordBase):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
class HotwordUpdate(HotwordBase):
|
|
|
|
|
word: Optional[str] = None
|
2026-03-02 10:26:22 +00:00
|
|
|
scope: Optional[str] = None
|
2026-02-27 07:57:22 +00:00
|
|
|
|
|
|
|
|
class Hotword(HotwordBase):
|
|
|
|
|
id: int
|
|
|
|
|
pinyin: Optional[str] = None
|
|
|
|
|
scope: str
|
2026-03-02 10:26:22 +00:00
|
|
|
creator_id: Optional[int] = None
|
|
|
|
|
creator_name: Optional[str] = None
|
|
|
|
|
creator_username: Optional[str] = None
|
2026-02-27 07:57:22 +00:00
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
from_attributes = True
|