优化意图识别示例,新增命令行参数解析功能,支持输入输出文件路径和调试模式,增强代码可读性和灵活性。同时更新Dify工具,调整检索信息获取逻辑,确保重排得分信息的正确传递。

This commit is contained in:
2025-06-18 14:53:24 +08:00
parent 08a7a5812a
commit 139d0cffef
8 changed files with 229 additions and 88 deletions
+3 -4
View File
@@ -160,7 +160,7 @@ class SoftwareFunctionSlots(SlotBase):
self.project_type="单工程"
missing_slots = {}
if not self.software_name:
missing_slots["software_name"] = f"{SoftwareFunctionSlots.model_fields['software_name'].description}可选值{', '.join([name.value for name in SoftwareName if name not in [SoftwareName.UNKNOWN, SoftwareName.ALIASES]])}"
missing_slots["software_name"] = f"{SoftwareFunctionSlots.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"] = SoftwareFunctionSlots.model_fields["function_name"].description
if not self.operation:
@@ -181,7 +181,7 @@ class SoftwareTroubleShootingSlots(SlotBase):
"""检查必填槽位是否都存在"""
missing_slots = {}
if not self.software_name:
missing_slots["software_name"] = f"{SoftwareTroubleShootingSlots.model_fields['software_name'].description}可选值{', '.join([name.value for name in SoftwareName if name not in [SoftwareName.UNKNOWN, SoftwareName.ALIASES]])}"
missing_slots["software_name"] = f"{SoftwareTroubleShootingSlots.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"] = SoftwareTroubleShootingSlots.model_fields["function_name"].description
if not self.error_message:
@@ -191,7 +191,7 @@ class SoftwareTroubleShootingSlots(SlotBase):
# 2. 业务问题
# 2.1 专业咨询
class ProfessionalConsultingSlots(SlotBase):
scene_subject: str = Field(default="", description="场景主体")
scene_subject: str = Field(default="", description="业务主体。即询问的业务对象(规范、标准、费用等)")
business_scene: str = Field(default="", description="业务场景描述")
software_name: Optional[str] = Field(default="", description="软件名称")
@@ -266,7 +266,6 @@ class InstallationDownloadSlots(SlotBase):
missing_slots = {}
if not self.software_name and not self.file_name:
missing_slots["software_name"] = f"{InstallationDownloadSlots.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"] = InstallationDownloadSlots.model_fields["file_name"].description
if not self.operation_stage:
missing_slots["operation_stage"] = InstallationDownloadSlots.model_fields["operation_stage"].description