feat(server): KB prompt优化、字幕修复、S2S重连、助手配置API
- assistantProfileConfig: KB answer prompt改为分层策略(严格产品信息+灵活常识补充) - nativeVoiceGateway: S2S upstream自动重连(最多50次)、event 351字幕debounce(800ms取最长文本) - toolExecutor: 确定性query改写增强、KB查询传递session上下文 - contextKeywordTracker: 支持KB话题记忆优先enrichment - contentSafeGuard: 新增品牌安全内容过滤服务 - assistantProfileService: 新增助手配置CRUD服务 - routes/assistantProfile: 新增助手配置API路由 - knowledgeKeywords: 扩展KB关键词词典 - fastAsrCorrector: ASR纠错规则更新 - tests/: KB prompt测试、保护窗口测试、Viking性能测试 - docs/: 助手配置API文档、系统提示词目录
This commit is contained in:
@@ -0,0 +1,570 @@
|
||||
{
|
||||
"generatedAt": "2026-03-20T07:49:07.093Z",
|
||||
"mockMode": false,
|
||||
"summary": {
|
||||
"latency": {
|
||||
"Product Query - Xiaohong": {
|
||||
"avg": "0.15",
|
||||
"p95": "0.22",
|
||||
"hitRate": "100.0%"
|
||||
},
|
||||
"Product Query - Dabai": {
|
||||
"avg": "0.15",
|
||||
"p95": "0.17",
|
||||
"hitRate": "100.0%"
|
||||
},
|
||||
"Company Info": {
|
||||
"avg": "0.13",
|
||||
"p95": "0.15",
|
||||
"hitRate": "100.0%"
|
||||
},
|
||||
"NTC Technology": {
|
||||
"avg": "0.13",
|
||||
"p95": "0.19",
|
||||
"hitRate": "100.0%"
|
||||
},
|
||||
"Hot Answer": {
|
||||
"avg": "0.13",
|
||||
"p95": "0.14",
|
||||
"hitRate": "100.0%"
|
||||
},
|
||||
"No Hit Query": {
|
||||
"avg": "0.66",
|
||||
"p95": "0.87",
|
||||
"hitRate": "100.0%"
|
||||
}
|
||||
},
|
||||
"cache": [
|
||||
{
|
||||
"name": "Product Query - Xiaohong",
|
||||
"speedup": "1.11x"
|
||||
},
|
||||
{
|
||||
"name": "Product Query - Dabai",
|
||||
"speedup": "0.99x"
|
||||
},
|
||||
{
|
||||
"name": "Company Info",
|
||||
"speedup": "1.25x"
|
||||
}
|
||||
],
|
||||
"concurrency": {
|
||||
"1": {
|
||||
"throughput": "6016.85 req/s",
|
||||
"successRate": "100.0%"
|
||||
},
|
||||
"3": {
|
||||
"throughput": "6426.74 req/s",
|
||||
"successRate": "100.0%"
|
||||
},
|
||||
"5": {
|
||||
"throughput": "6439.15 req/s",
|
||||
"successRate": "100.0%"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"type": "latency",
|
||||
"timestamp": "2026-03-20T07:49:07.084Z",
|
||||
"iterations": 10,
|
||||
"mockMode": false,
|
||||
"results": {
|
||||
"Product Query - Xiaohong": {
|
||||
"query": "小红产品有什么功效",
|
||||
"latencies": [
|
||||
0.2159999999998945,
|
||||
0.17509999999992942,
|
||||
0.1505000000001928,
|
||||
0.14269999999987704,
|
||||
0.15470000000004802,
|
||||
0.1368999999999687,
|
||||
0.12730000000010477,
|
||||
0.13599999999996726,
|
||||
0.13009999999985666,
|
||||
0.15689999999995052
|
||||
],
|
||||
"hits": [
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
],
|
||||
"avgLatency": 0.15261999999997897,
|
||||
"minLatency": 0.12730000000010477,
|
||||
"maxLatency": 0.2159999999998945,
|
||||
"p50Latency": 0.14269999999987704,
|
||||
"p95Latency": 0.2159999999998945,
|
||||
"p99Latency": 0.2159999999998945,
|
||||
"hitRate": 1
|
||||
},
|
||||
"Product Query - Dabai": {
|
||||
"query": "大白产品怎么吃",
|
||||
"latencies": [
|
||||
0.15099999999983993,
|
||||
0.14449999999987995,
|
||||
0.1378999999997177,
|
||||
0.13919999999961874,
|
||||
0.171100000000024,
|
||||
0.14480000000003201,
|
||||
0.14390000000003056,
|
||||
0.14840000000003783,
|
||||
0.14489999999977954,
|
||||
0.13879999999971915
|
||||
],
|
||||
"hits": [
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
],
|
||||
"avgLatency": 0.14644999999986794,
|
||||
"minLatency": 0.1378999999997177,
|
||||
"maxLatency": 0.171100000000024,
|
||||
"p50Latency": 0.14449999999987995,
|
||||
"p95Latency": 0.171100000000024,
|
||||
"p99Latency": 0.171100000000024,
|
||||
"hitRate": 1
|
||||
},
|
||||
"Company Info": {
|
||||
"query": "德国PM公司介绍",
|
||||
"latencies": [
|
||||
0.13020000000005894,
|
||||
0.12360000000035143,
|
||||
0.14609999999993306,
|
||||
0.13189999999985957,
|
||||
0.13970000000017535,
|
||||
0.12660000000005311,
|
||||
0.12400000000025102,
|
||||
0.11830000000009022,
|
||||
0.11290000000008149,
|
||||
0.13209999999980937
|
||||
],
|
||||
"hits": [
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
],
|
||||
"avgLatency": 0.12854000000006635,
|
||||
"minLatency": 0.11290000000008149,
|
||||
"maxLatency": 0.14609999999993306,
|
||||
"p50Latency": 0.12660000000005311,
|
||||
"p95Latency": 0.14609999999993306,
|
||||
"p99Latency": 0.14609999999993306,
|
||||
"hitRate": 1
|
||||
},
|
||||
"NTC Technology": {
|
||||
"query": "NTC营养保送系统原理",
|
||||
"latencies": [
|
||||
0.12449999999989814,
|
||||
0.12459999999964566,
|
||||
0.13049999999975626,
|
||||
0.10840000000007421,
|
||||
0.19180000000005748,
|
||||
0.11740000000008877,
|
||||
0.12619999999969878,
|
||||
0.12239999999974316,
|
||||
0.11910000000034415,
|
||||
0.12409999999999854
|
||||
],
|
||||
"hits": [
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
],
|
||||
"avgLatency": 0.12889999999993051,
|
||||
"minLatency": 0.10840000000007421,
|
||||
"maxLatency": 0.19180000000005748,
|
||||
"p50Latency": 0.12409999999999854,
|
||||
"p95Latency": 0.19180000000005748,
|
||||
"p99Latency": 0.19180000000005748,
|
||||
"hitRate": 1
|
||||
},
|
||||
"Hot Answer": {
|
||||
"query": "基础三合一怎么吃",
|
||||
"latencies": [
|
||||
0.13679999999976644,
|
||||
0.13400000000001455,
|
||||
0.13280000000031578,
|
||||
0.13779999999997017,
|
||||
0.12579999999979918,
|
||||
0.13449999999966167,
|
||||
0.14399999999977808,
|
||||
0.13839999999981956,
|
||||
0.125,
|
||||
0.1230000000000473
|
||||
],
|
||||
"hits": [
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
],
|
||||
"avgLatency": 0.13320999999991728,
|
||||
"minLatency": 0.1230000000000473,
|
||||
"maxLatency": 0.14399999999977808,
|
||||
"p50Latency": 0.13400000000001455,
|
||||
"p95Latency": 0.14399999999977808,
|
||||
"p99Latency": 0.14399999999977808,
|
||||
"hitRate": 1
|
||||
},
|
||||
"No Hit Query": {
|
||||
"query": "今天天气怎么样",
|
||||
"latencies": [
|
||||
0.7092999999999847,
|
||||
0.647899999999936,
|
||||
0.869300000000294,
|
||||
0.8305000000000291,
|
||||
0.7291000000000167,
|
||||
0.5709999999999127,
|
||||
0.539299999999912,
|
||||
0.5781999999999243,
|
||||
0.6104999999997744,
|
||||
0.5345000000002074
|
||||
],
|
||||
"hits": [
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
],
|
||||
"avgLatency": 0.6619599999999991,
|
||||
"minLatency": 0.5345000000002074,
|
||||
"maxLatency": 0.869300000000294,
|
||||
"p50Latency": 0.6104999999997744,
|
||||
"p95Latency": 0.869300000000294,
|
||||
"p99Latency": 0.869300000000294,
|
||||
"hitRate": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cache",
|
||||
"timestamp": "2026-03-20T07:49:07.088Z",
|
||||
"cacheHitsIterations": 5,
|
||||
"mockMode": false,
|
||||
"results": [
|
||||
{
|
||||
"name": "Product Query - Xiaohong",
|
||||
"query": "小红产品有什么功效",
|
||||
"firstHitLatency": 0.1477999999997337,
|
||||
"cacheHitLatencies": [
|
||||
0.14179999999987558,
|
||||
0.1406000000001768,
|
||||
0.13950000000022555,
|
||||
0.13410000000021682,
|
||||
0.10729999999966822
|
||||
],
|
||||
"avgCacheLatency": 0.13266000000003259,
|
||||
"speedup": 1.114126338004654,
|
||||
"firstHit": {
|
||||
"query": "小红产品有什么功效",
|
||||
"original_query": "小红产品有什么功效",
|
||||
"rewritten_query": "小红产品有什么功效",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "FitLine小红Activize Oxyplus的核心功效是提升细胞能量。它含有维生素B族、C和辅酶Q10等成分,通过NTC营养保送系统直达细胞。主要作用:1.提升精力和体能。2.促进细胞氧气利用。3.增强免疫力。很多人喝完当天就能感受到精力明显提升。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 0,
|
||||
"hot_answer": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Product Query - Dabai",
|
||||
"query": "大白产品怎么吃",
|
||||
"firstHitLatency": 0.1453999999998814,
|
||||
"cacheHitLatencies": [
|
||||
0.13940000000002328,
|
||||
0.13879999999971915,
|
||||
0.14170000000012806,
|
||||
0.14660000000003492,
|
||||
0.16849999999976717
|
||||
],
|
||||
"avgCacheLatency": 0.14699999999993452,
|
||||
"speedup": 0.9891156462581372,
|
||||
"firstHit": {
|
||||
"query": "大白产品怎么吃",
|
||||
"original_query": "大白产品怎么吃",
|
||||
"rewritten_query": "大白产品怎么吃",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "德国PM大白Basics是基础营养素,为身体提供全面的维生素和矿物质基础。它的核心作用:1.补充每日所需的基础营养。2.为细胞提供全面的营养支持。3.搭配小红和小白形成完整的NTC营养循环。建议早上空腹服用,1平勺兑200-300ml温水。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 0,
|
||||
"hot_answer": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Company Info",
|
||||
"query": "德国PM公司介绍",
|
||||
"firstHitLatency": 0.17620000000033542,
|
||||
"cacheHitLatencies": [
|
||||
0.1550999999999476,
|
||||
0.11990000000014334,
|
||||
0.15079999999989013,
|
||||
0.14349999999967622,
|
||||
0.134900000000016
|
||||
],
|
||||
"avgCacheLatency": 0.14083999999993466,
|
||||
"speedup": 1.2510650383443422,
|
||||
"firstHit": {
|
||||
"query": "德国PM公司介绍",
|
||||
"original_query": "德国PM公司介绍",
|
||||
"rewritten_query": "德国PM公司介绍",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "德国PM-International是1993年创立的国际营养品直销企业。核心品牌FitLine专注细胞营养,拥有独家NTC营养保送系统技术。公司获邓白氏AAA+最高信用认证(99分),业务覆盖全球100多个国家。总部位于德国,在日本、美国、加拿大、香港等地设有分公司。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 0,
|
||||
"hot_answer": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "concurrency",
|
||||
"timestamp": "2026-03-20T07:49:07.090Z",
|
||||
"concurrencyLevels": [
|
||||
1,
|
||||
3,
|
||||
5
|
||||
],
|
||||
"mockMode": false,
|
||||
"results": {
|
||||
"1": {
|
||||
"concurrency": 1,
|
||||
"totalTime": 0.1661999999996624,
|
||||
"throughput": 6016.847172094051,
|
||||
"successRate": 1,
|
||||
"results": [
|
||||
{
|
||||
"query": "小红产品有什么功效",
|
||||
"original_query": "小红产品有什么功效",
|
||||
"rewritten_query": "小红产品有什么功效",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "FitLine小红Activize Oxyplus的核心功效是提升细胞能量。它含有维生素B族、C和辅酶Q10等成分,通过NTC营养保送系统直达细胞。主要作用:1.提升精力和体能。2.促进细胞氧气利用。3.增强免疫力。很多人喝完当天就能感受到精力明显提升。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 0,
|
||||
"hot_answer": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"concurrency": 3,
|
||||
"totalTime": 0.4667999999996937,
|
||||
"throughput": 6426.735218513215,
|
||||
"successRate": 1,
|
||||
"results": [
|
||||
{
|
||||
"query": "小红产品有什么功效",
|
||||
"original_query": "小红产品有什么功效",
|
||||
"rewritten_query": "小红产品有什么功效",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "FitLine小红Activize Oxyplus的核心功效是提升细胞能量。它含有维生素B族、C和辅酶Q10等成分,通过NTC营养保送系统直达细胞。主要作用:1.提升精力和体能。2.促进细胞氧气利用。3.增强免疫力。很多人喝完当天就能感受到精力明显提升。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 0,
|
||||
"hot_answer": true
|
||||
},
|
||||
{
|
||||
"query": "大白产品怎么吃",
|
||||
"original_query": "大白产品怎么吃",
|
||||
"rewritten_query": "大白产品怎么吃",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "德国PM大白Basics是基础营养素,为身体提供全面的维生素和矿物质基础。它的核心作用:1.补充每日所需的基础营养。2.为细胞提供全面的营养支持。3.搭配小红和小白形成完整的NTC营养循环。建议早上空腹服用,1平勺兑200-300ml温水。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 0,
|
||||
"hot_answer": true
|
||||
},
|
||||
{
|
||||
"query": "德国PM公司介绍",
|
||||
"original_query": "德国PM公司介绍",
|
||||
"rewritten_query": "德国PM公司介绍",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "德国PM-International是1993年创立的国际营养品直销企业。核心品牌FitLine专注细胞营养,拥有独家NTC营养保送系统技术。公司获邓白氏AAA+最高信用认证(99分),业务覆盖全球100多个国家。总部位于德国,在日本、美国、加拿大、香港等地设有分公司。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 0,
|
||||
"hot_answer": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"5": {
|
||||
"concurrency": 5,
|
||||
"totalTime": 0.7764999999999418,
|
||||
"throughput": 6439.150032196232,
|
||||
"successRate": 1,
|
||||
"results": [
|
||||
{
|
||||
"query": "小红产品有什么功效",
|
||||
"original_query": "小红产品有什么功效",
|
||||
"rewritten_query": "小红产品有什么功效",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "FitLine小红Activize Oxyplus的核心功效是提升细胞能量。它含有维生素B族、C和辅酶Q10等成分,通过NTC营养保送系统直达细胞。主要作用:1.提升精力和体能。2.促进细胞氧气利用。3.增强免疫力。很多人喝完当天就能感受到精力明显提升。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 1,
|
||||
"hot_answer": true
|
||||
},
|
||||
{
|
||||
"query": "大白产品怎么吃",
|
||||
"original_query": "大白产品怎么吃",
|
||||
"rewritten_query": "大白产品怎么吃",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "德国PM大白Basics是基础营养素,为身体提供全面的维生素和矿物质基础。它的核心作用:1.补充每日所需的基础营养。2.为细胞提供全面的营养支持。3.搭配小红和小白形成完整的NTC营养循环。建议早上空腹服用,1平勺兑200-300ml温水。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 0,
|
||||
"hot_answer": true
|
||||
},
|
||||
{
|
||||
"query": "德国PM公司介绍",
|
||||
"original_query": "德国PM公司介绍",
|
||||
"rewritten_query": "德国PM公司介绍",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "德国PM-International是1993年创立的国际营养品直销企业。核心品牌FitLine专注细胞营养,拥有独家NTC营养保送系统技术。公司获邓白氏AAA+最高信用认证(99分),业务覆盖全球100多个国家。总部位于德国,在日本、美国、加拿大、香港等地设有分公司。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 0,
|
||||
"hot_answer": true
|
||||
},
|
||||
{
|
||||
"query": "小红产品有什么功效",
|
||||
"original_query": "小红产品有什么功效",
|
||||
"rewritten_query": "小红产品有什么功效",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "FitLine小红Activize Oxyplus的核心功效是提升细胞能量。它含有维生素B族、C和辅酶Q10等成分,通过NTC营养保送系统直达细胞。主要作用:1.提升精力和体能。2.促进细胞氧气利用。3.增强免疫力。很多人喝完当天就能感受到精力明显提升。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 0,
|
||||
"hot_answer": true
|
||||
},
|
||||
{
|
||||
"query": "大白产品怎么吃",
|
||||
"original_query": "大白产品怎么吃",
|
||||
"rewritten_query": "大白产品怎么吃",
|
||||
"results": [
|
||||
{
|
||||
"title": "高频问题快速回答",
|
||||
"content": "德国PM大白Basics是基础营养素,为身体提供全面的维生素和矿物质基础。它的核心作用:1.补充每日所需的基础营养。2.为细胞提供全面的营养支持。3.搭配小红和小白形成完整的NTC营养循环。建议早上空腹服用,1平勺兑200-300ml温水。"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"source": "hot_answer_cache",
|
||||
"hit": true,
|
||||
"reason": "hot_answer",
|
||||
"latency_ms": 0,
|
||||
"hot_answer": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user