增强意图识别API,添加槽位填充状态的返回信息,更新数据模型以提供软件名称的可选值提示
This commit is contained in:
@@ -54,6 +54,7 @@ def intent_recognize():
|
||||
"sub_classification": classification["sub_classification"],
|
||||
"rewrite_query": result["rewrite"]["rewrite"],
|
||||
"keywords": keywords_str,
|
||||
"has_slot_filling": len(slot_filling)!=0,
|
||||
"slot_filling": {
|
||||
"is_complete": slot_filling.get("is_complete", False),
|
||||
"missing_slots": slot_filling.get("missing_slots", {}),
|
||||
|
||||
@@ -68,7 +68,7 @@ class SoftwareFunction(BaseModel):
|
||||
"""检查必填槽位是否都存在"""
|
||||
missing_slots = {}
|
||||
if not self.software_name:
|
||||
missing_slots["software_name"] = SoftwareFunction.model_fields["software_name"].description
|
||||
missing_slots["software_name"] = f"{SoftwareFunction.model_fields['software_name'].description},可选值:{', '.join([name.value for name in SoftwareName if name not in [SoftwareName.UNKNOWN, SoftwareName.ALIASES]])}"
|
||||
if not self.function_name:
|
||||
missing_slots["function_name"] = SoftwareFunction.model_fields["function_name"].description
|
||||
if not self.operation:
|
||||
@@ -88,7 +88,7 @@ class TroubleShooting(BaseModel):
|
||||
"""检查必填槽位是否都存在"""
|
||||
missing_slots = {}
|
||||
if not self.software_name:
|
||||
missing_slots["software_name"] = TroubleShooting.model_fields["software_name"].description
|
||||
missing_slots["software_name"] = f"{TroubleShooting.model_fields['software_name'].description},可选值:{', '.join([name.value for name in SoftwareName if name not in [SoftwareName.UNKNOWN, SoftwareName.ALIASES]])}"
|
||||
if not self.function_name:
|
||||
missing_slots["function_name"] = TroubleShooting.model_fields["function_name"].description
|
||||
if not self.error_message:
|
||||
@@ -172,7 +172,8 @@ class InstallationDownload(BaseModel):
|
||||
"""检查必填槽位是否都存在"""
|
||||
missing_slots = {}
|
||||
if not self.software_name and not self.file_name:
|
||||
missing_slots["software_name"] = InstallationDownload.model_fields["software_name"].description
|
||||
missing_slots["software_name"] = f"{InstallationDownload.model_fields['software_name'].description},"
|
||||
f"可选值:{', '.join([name.value for name in SoftwareName if name not in [SoftwareName.UNKNOWN, SoftwareName.ALIASES]])}"
|
||||
missing_slots["file_name"] = InstallationDownload.model_fields["file_name"].description
|
||||
if not self.operation_stage:
|
||||
missing_slots["operation_stage"] = InstallationDownload.model_fields["operation_stage"].description
|
||||
|
||||
Reference in New Issue
Block a user