feat: add knowledge base core api
This commit is contained in:
67
backend/apps/knowledge/schemas.py
Normal file
67
backend/apps/knowledge/schemas.py
Normal file
@@ -0,0 +1,67 @@
|
||||
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
|
||||
Reference in New Issue
Block a user