84 lines
1.5 KiB
Python
84 lines
1.5 KiB
Python
from datetime import datetime
|
|
|
|
from ninja import Schema
|
|
|
|
|
|
class KnowledgeBaseIn(Schema):
|
|
name: str
|
|
description: str = ""
|
|
scope: str = ""
|
|
enabled: bool = True
|
|
|
|
|
|
class KnowledgeBaseOut(Schema):
|
|
id: int
|
|
name: str
|
|
description: str
|
|
scope: str
|
|
enabled: bool
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class KnowledgeDocumentIn(Schema):
|
|
knowledge_base_id: int
|
|
file_name: str
|
|
file_type: str = ""
|
|
content: str
|
|
|
|
|
|
class KnowledgeDocumentOut(Schema):
|
|
id: int
|
|
knowledge_base_id: int
|
|
file_name: str
|
|
file_type: str
|
|
parse_status: str
|
|
parse_error: str
|
|
created_at: datetime
|
|
|
|
|
|
class KnowledgeItemIn(Schema):
|
|
knowledge_base_id: int
|
|
title: str
|
|
problem: str
|
|
applicable_scope: str = ""
|
|
error_code: str = ""
|
|
root_cause: str = ""
|
|
troubleshooting_steps: str = ""
|
|
solution: str
|
|
risk_note: str = ""
|
|
status: str = "draft"
|
|
|
|
|
|
class KnowledgeItemOut(Schema):
|
|
id: int
|
|
knowledge_base_id: int
|
|
title: str
|
|
problem: str
|
|
applicable_scope: str
|
|
error_code: str
|
|
root_cause: str
|
|
troubleshooting_steps: str
|
|
solution: str
|
|
risk_note: str
|
|
status: str
|
|
source_type: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class KnowledgeSearchIn(Schema):
|
|
query: str
|
|
knowledge_base_id: int | None = None
|
|
limit: int = 5
|
|
|
|
|
|
class KnowledgeSearchResultOut(Schema):
|
|
id: int
|
|
knowledge_base_id: int
|
|
title: str
|
|
source_type: str
|
|
content: str
|
|
score: float
|
|
metadata: dict
|