|
@@ -18,7 +18,7 @@ class QueryTaskStatus:
|
|
class KnowledgeSuggestQuery:
|
|
class KnowledgeSuggestQuery:
|
|
"""知识查询建议模型"""
|
|
"""知识查询建议模型"""
|
|
|
|
|
|
- def __init__(self, task_id: int, question: str, querys: Optional[List[str]] = None, status: int = QueryTaskStatus.PENDING):
|
|
|
|
|
|
+ def __init__(self, task_id: int, question: str, querys: Optional[List[str]] = None, status: int = QueryTaskStatus.PENDING, knowledgeType: str = ""):
|
|
"""
|
|
"""
|
|
初始化查询任务
|
|
初始化查询任务
|
|
|
|
|
|
@@ -32,6 +32,7 @@ class KnowledgeSuggestQuery:
|
|
self.question = question
|
|
self.question = question
|
|
self.querys = querys or []
|
|
self.querys = querys or []
|
|
self.status = status
|
|
self.status = status
|
|
|
|
+ self.knowledgeType = knowledgeType
|
|
|
|
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
"""转换为字典"""
|
|
"""转换为字典"""
|
|
@@ -39,7 +40,8 @@ class KnowledgeSuggestQuery:
|
|
'task_id': self.task_id,
|
|
'task_id': self.task_id,
|
|
'question': self.question,
|
|
'question': self.question,
|
|
'querys': json.dumps(self.querys, ensure_ascii=False) if self.querys else None,
|
|
'querys': json.dumps(self.querys, ensure_ascii=False) if self.querys else None,
|
|
- 'status': self.status
|
|
|
|
|
|
+ 'status': self.status,
|
|
|
|
+ 'knowledgeType': self.knowledgeType
|
|
}
|
|
}
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
@@ -56,7 +58,8 @@ class KnowledgeSuggestQuery:
|
|
task_id=data['task_id'],
|
|
task_id=data['task_id'],
|
|
question=data['question'],
|
|
question=data['question'],
|
|
querys=querys,
|
|
querys=querys,
|
|
- status=data['status']
|
|
|
|
|
|
+ status=data['status'],
|
|
|
|
+ knowledgeType=data['knowledgeType']
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|