feat(threshold): Implement customer loss threshold configuration and notification system

- Added `ThresholdRepository` for managing customer loss threshold configurations and notifications.
- Introduced `threshold_service` to handle loss threshold alerts based on customer portfolio performance.
- Enhanced `customer_prompts` to include new intent for querying product net values.
- Updated `customer_service` to integrate new threshold alert functionality into existing workflows.
- Implemented `sanitize_postprocess` for improved compliance handling in customer interactions.
- Enhanced course documentation to reflect updates in advisor training modules and interactive elements.

This update significantly improves the customer experience by providing proactive loss threshold notifications and enhancing the overall service framework.
This commit is contained in:
2026-09-10 10:57:40 +08:00
parent 6f222f1c56
commit 4b8e11c9bd
102 changed files with 4054 additions and 445 deletions
@@ -23,18 +23,18 @@
</div>
</div>
<div class="callout callout-accent">
<strong>指挥 AI 改功能时:</strong> 要表格和 SQL 就改 <code>analyst.py</code> / <code>analyst_agent.py</code>;
<strong>指挥 AI 改功能时:</strong> 要表格和 SQL 就改 问数 REST(<code>analyst.py</code>) / NL→SQL 编排(<code>analyst_agent.py</code>);
要聊天体验才碰 <code>analytics/chat</code> 占位页,别和问数混成一个接口。
</div>
<div class="callout callout-warning">
<strong>customer self 域:</strong> 客户 token 进问数 → <code>domain=self</code>,
<code>sql_guard</code> 强制 SQL 带本人 <code>customer_id</code>;免责声明追加 <code>CUSTOMER_AI_RISK_NOTE</code>。
SQL 安全校验(<code>sql_guard.py</code>)强制 SQL 带本人 <code>customer_id</code>;免责声明追加 <code>CUSTOMER_AI_RISK_NOTE</code>。
</div>
</div>
<div class="screen animate-in">
<h2>后端「四件套」路由</h2>
<p>全部挂在 <code>app/api/analyst.py</code>,前缀 <code>/api/analyst</code>:</p>
<p>全部挂在 问数 REST(<code>app/api/analyst.py</code>),前缀 <code>/api/analyst</code>:</p>
<div class="file-tree animate-in">
<div class="tree-item tree-folder">POST /chat</div>
<div class="tree-item tree-indent">问数主入口 → AnalystAgent.run()</div>
@@ -63,7 +63,7 @@
<div class="chat-message" data-msg="1" data-sender="api" style="display:none">
<div class="chat-avatar" style="background:#5A9DB8">API</div>
<div class="chat-bubble">
<span class="chat-sender" style="color:#5A9DB8">analyst.py</span>
<span class="chat-sender" style="color:#5A9DB8">问数 REST(analyst.py)</span>
<p>get_platform_auth_context → analyst_auth_from_deps</p>
</div>
</div>
@@ -71,7 +71,7 @@
<div class="chat-avatar" style="background:#1F6280">Agent</div>
<div class="chat-bubble">
<span class="chat-sender" style="color:#1F6280">AnalystAgent</span>
<p>消歧 → 生成 SQL → sql_guard → 执行 → 解读</p>
<p>消歧 → 生成 SQL → SQL 安全校验(sql_guard.py) → 执行 → 解读</p>
</div>
</div>
<div class="chat-message" data-msg="3" data-sender="browser" style="display:none">