feat:用户画像功能
This commit is contained in:
@@ -6,22 +6,24 @@
|
||||
"enabled": true,
|
||||
"aliases": ["基金产品", "产品", "基金", "基金名称", "产品名称"],
|
||||
"tables": ["fin_product"],
|
||||
"fields": ["product_code", "product_name", "product_type", "risk_level", "status"]
|
||||
"fields": ["product_code", "product_name", "product_type", "risk_level", "status"],
|
||||
"value_hint": "product_type 实际枚举值为:货币型/债券型/混合型/股票型/指数型/QDII(注意是'XX型',不是 Schema 注释里的'股票基金');status 实际枚举值为:在售/暂停/到期/清盘,查在售产品用 status = '在售'"
|
||||
},
|
||||
{
|
||||
"term": "股票型基金",
|
||||
"enabled": true,
|
||||
"aliases": ["股票型", "股票基金", "权益类"],
|
||||
"aliases": ["股票型", "股票基金", "股票型基金", "权益类"],
|
||||
"tables": ["fin_product"],
|
||||
"fields": ["product_type"],
|
||||
"value_hint": "product_type 通常使用业务库中的股票型标准值,不能自行创造枚举值"
|
||||
"value_hint": "fin_product.product_type 实际枚举值为:货币型/债券型/混合型/股票型/指数型/QDII;股票型基金必须用 product_type = '股票型',不要使用 Schema 注释里的'股票基金'"
|
||||
},
|
||||
{
|
||||
"term": "客户",
|
||||
"enabled": true,
|
||||
"aliases": ["客户", "投资人", "持有人"],
|
||||
"tables": ["fin_customer_profile", "fin_holdings", "fin_risk_assessment"],
|
||||
"fields": ["customer_id", "risk_level", "customer_level"]
|
||||
"fields": ["customer_id", "risk_level", "customer_level"],
|
||||
"value_hint": "fin_customer_profile.risk_level / fin_risk_assessment.risk_level 实际枚举值为 R1-R5(R1 最保守,R5 最激进,与产品风险等级同一口径);查'保守型/稳健型客户'对应 R1/R2,'激进型客户'对应 R5"
|
||||
},
|
||||
{
|
||||
"term": "持仓",
|
||||
|
||||
+4
-2
@@ -107,10 +107,12 @@ def resolve_semantics(question: str, *, catalog: dict[str, Any] | None = None) -
|
||||
{
|
||||
"term": item["term"],
|
||||
"field": item["fields"][0],
|
||||
"hint": item.get("metric_hint", item.get("value_hint", "")),
|
||||
"hint": item.get("metric_hint") or item.get("value_hint", ""),
|
||||
}
|
||||
# metric_hint(指标口径)与 value_hint(字段取值口径)都要进入
|
||||
# SQL 生成上下文;只过滤 metric_hint 会让枚举值提示永远丢失。
|
||||
for item in matched
|
||||
if "metric_hint" in item
|
||||
if "metric_hint" in item or "value_hint" in item
|
||||
]
|
||||
return {
|
||||
"terms": [item["term"] for item in matched],
|
||||
|
||||
Reference in New Issue
Block a user