35 lines
716 B
Python
35 lines
716 B
Python
"""Knowledge base schemas."""
|
|
from pydantic import BaseModel, Field
|
|
from typing import Optional, List
|
|
from datetime import datetime
|
|
|
|
|
|
class KnowledgeCreate(BaseModel):
|
|
title: str = Field(..., min_length=1, max_length=500)
|
|
content: str = ""
|
|
doc_type: str = "text"
|
|
source: str = ""
|
|
tags: str = ""
|
|
project_id: Optional[int] = None
|
|
|
|
|
|
class KnowledgeResponse(BaseModel):
|
|
id: int
|
|
project_id: Optional[int] = None
|
|
title: str
|
|
content: str
|
|
doc_type: str
|
|
source: str
|
|
tags: str
|
|
tenant_id: int
|
|
created_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class KnowledgeSearchResult(BaseModel):
|
|
doc_id: int
|
|
title: str
|
|
snippet: str
|
|
score: float
|