From 3c0ddbdbd98e0a04369d98f45b5139d4ae405ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=96=8C=E5=BC=BA?= Date: Mon, 14 Sep 2026 20:51:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BF=AE=E5=A4=8D=E6=8A=95=E9=A1=BEagent?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/advisor_agent/intent/classifier.py | 8 +++++++- agent/advisor_agent/intent/recognizer.py | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/agent/advisor_agent/intent/classifier.py b/agent/advisor_agent/intent/classifier.py index b4a6057..8f94778 100644 --- a/agent/advisor_agent/intent/classifier.py +++ b/agent/advisor_agent/intent/classifier.py @@ -38,11 +38,17 @@ class IntentClassification: _CLASSIFIER_PROMPT = """你是基金投顾工作台的意图分类器,只负责分类,不回答用户问题。 只能从以下分类中选择一个: - recommend:基金推荐、组合配置或投资方案 + 例:“帮我推荐两只适合稳健型客户的基金”“给客户生成一份组合配置建议”“该买什么基金” - rebalance:组合偏离、调仓、再平衡、仓位调整 + 例:“该客户组合偏离目标配置,请给出调仓方案”“组合需要再平衡,降低股票类仓位” - fund_analysis:单只基金分析、净值、收益、回撤、波动率、夏普比率 + 例:“分析华夏回报近一年的净值走势和最大回撤”“这只基金的夏普比率和波动率如何” - dialogue-script:给客户准备沟通话术、解释、安抚、投诉或风险提醒 -- data_query:查询客户持仓、资产、余额、收益、交易、账户明细 + 例:“市场波动时怎么和客户解释”“帮我准备安抚客户的沟通话术”“客户投诉了,话术怎么准备” +- data_query:查询客户持仓、资产、余额、收益、交易、账户明细、客户名册 + 例:“查询客户48当前持仓和账户余额”“我名下有哪些客户”“统计名下客户数量” - casual_chat:问候、闲聊、感谢、身份询问或无法归入业务分类的内容 + 例:“你好”“谢谢”“你是谁” 只输出 JSON,不要 Markdown,不要额外文字: {"intent":"分类值","confidence":0到1之间的数字,"reason":"不超过30字的原因"} diff --git a/agent/advisor_agent/intent/recognizer.py b/agent/advisor_agent/intent/recognizer.py index 99e0317..88cd180 100644 --- a/agent/advisor_agent/intent/recognizer.py +++ b/agent/advisor_agent/intent/recognizer.py @@ -41,6 +41,7 @@ _FUND_ANALYSIS_TERMS = ("基金分析", "分析基金", "基金表现", "净值 _DIALOGUE_TERMS = ("话术", "沟通", "怎么跟客户说", "如何向客户解释", "安抚客户", "投诉处理") _RECOMMEND_TERMS = ("推荐", "组合建议", "配置建议", "买什么", "适合配置", "筛选基金", "投资方案") _CUSTOMER_IDENTITY_TERMS = ("是谁", "姓名", "实名", "基本信息", "联系方式", "手机号") +_CUSTOMER_ROSTER_TERMS = ("名单", "列表", "几个") _SCOPE_ERROR_MESSAGE = "投顾范围查询仅支持客户数据查询" @@ -79,6 +80,14 @@ def recognize_advisor_intent(query: str | None, explicit_intent: str | None = No ) if has_customer_identity: return AGENT_INTENT_DATA_QUERY + # 客户名册类提问(我名下有哪些客户/客户名单)也属于数据查询。 + has_customer_roster = ( + "客户" in text + and (has_action or _contains_any(text, _CUSTOMER_ROSTER_TERMS)) + and not _contains_any(text, _RECOMMEND_TERMS) + ) + if has_customer_roster: + return AGENT_INTENT_DATA_QUERY if has_data and (has_action or "客户" in text or "近一年" in text or "本月" in text): return AGENT_INTENT_DATA_QUERY if _contains_any(text, _RECOMMEND_TERMS): -- 2.54.0