From 74938607a7fd9ad3b91c9306dc849ea9bde3e7cc Mon Sep 17 00:00:00 2001 From: ouyangyouzhang Date: Tue, 3 Jun 2025 14:38:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E6=84=8F=E5=9B=BE=E8=AF=86?= =?UTF-8?q?=E5=88=ABAPI=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=A7=BD=E4=BD=8D?= =?UTF-8?q?=E5=A1=AB=E5=85=85=E7=8A=B6=E6=80=81=E7=9A=84=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8C=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E4=BB=A5=E6=8F=90=E4=BE=9B=E8=BD=AF=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E7=9A=84=E5=8F=AF=E9=80=89=E5=80=BC=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rag2_0/dify/intent_recognition_api.py | 1 + rag2_0/intent_recognition/DataModels.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/rag2_0/dify/intent_recognition_api.py b/rag2_0/dify/intent_recognition_api.py index 4e3a072..02e1278 100644 --- a/rag2_0/dify/intent_recognition_api.py +++ b/rag2_0/dify/intent_recognition_api.py @@ -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", {}), diff --git a/rag2_0/intent_recognition/DataModels.py b/rag2_0/intent_recognition/DataModels.py index 38795bd..4fe8040 100644 --- a/rag2_0/intent_recognition/DataModels.py +++ b/rag2_0/intent_recognition/DataModels.py @@ -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