增强意图识别API,添加槽位填充状态的返回信息,更新数据模型以提供软件名称的可选值提示

This commit is contained in:
2025-06-03 14:38:28 +08:00
parent 38b6f66925
commit 74938607a7
2 changed files with 5 additions and 3 deletions
+4 -3
View File
@@ -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