555e282cc4
pi-agent-plugin checks / lint (push) Has been cancelled
pi-agent-plugin checks / test (20) (push) Has been cancelled
pi-agent-plugin checks / test (22) (push) Has been cancelled
pi-agent-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / check_changes (push) Has been cancelled
TypeScript SDK CI / changelog_check (push) Has been cancelled
ci / changelog_check (push) Has been cancelled
ci / check_changes (push) Has been cancelled
ci / build_mem0 (3.10) (push) Has been cancelled
ci / build_mem0 (3.11) (push) Has been cancelled
ci / build_mem0 (3.12) (push) Has been cancelled
CLI Node CI / lint (push) Has been cancelled
CLI Node CI / test (20) (push) Has been cancelled
CLI Node CI / test (22) (push) Has been cancelled
CLI Node CI / build (push) Has been cancelled
CLI Python CI / lint (push) Has been cancelled
CLI Python CI / test (3.10) (push) Has been cancelled
CLI Python CI / test (3.11) (push) Has been cancelled
CLI Python CI / test (3.12) (push) Has been cancelled
CLI Python CI / build (push) Has been cancelled
openclaw checks / lint (push) Has been cancelled
openclaw checks / test (20) (push) Has been cancelled
openclaw checks / test (22) (push) Has been cancelled
openclaw checks / build (push) Has been cancelled
opencode-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (22) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (22) (push) Has been cancelled
66 lines
1.3 KiB
Python
66 lines
1.3 KiB
Python
from datetime import datetime
|
|
from typing import List, Optional
|
|
from uuid import UUID
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field, validator
|
|
|
|
|
|
class MemoryBase(BaseModel):
|
|
content: str
|
|
metadata_: Optional[dict] = Field(default_factory=dict)
|
|
|
|
class MemoryCreate(MemoryBase):
|
|
user_id: UUID
|
|
app_id: UUID
|
|
|
|
|
|
class Category(BaseModel):
|
|
name: str
|
|
|
|
|
|
class App(BaseModel):
|
|
id: UUID
|
|
name: str
|
|
|
|
|
|
class Memory(MemoryBase):
|
|
id: UUID
|
|
user_id: UUID
|
|
app_id: UUID
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
state: str
|
|
categories: Optional[List[Category]] = None
|
|
app: App
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
class MemoryUpdate(BaseModel):
|
|
content: Optional[str] = None
|
|
metadata_: Optional[dict] = None
|
|
state: Optional[str] = None
|
|
|
|
|
|
class MemoryResponse(BaseModel):
|
|
id: UUID
|
|
content: str
|
|
created_at: int
|
|
state: str
|
|
app_id: UUID
|
|
app_name: str
|
|
categories: List[str]
|
|
metadata_: Optional[dict] = None
|
|
|
|
@validator('created_at', pre=True)
|
|
def convert_to_epoch(cls, v):
|
|
if isinstance(v, datetime):
|
|
return int(v.timestamp())
|
|
return v
|
|
|
|
class PaginatedMemoryResponse(BaseModel):
|
|
items: List[MemoryResponse]
|
|
total: int
|
|
page: int
|
|
size: int
|
|
pages: int
|