feat(kb-routing): expand 5-way keyword routing coverage

This commit is contained in:
User
2026-03-20 10:56:29 +08:00
parent d13084cc0f
commit 93b8135d51
4 changed files with 1195 additions and 171 deletions

View File

@@ -3,18 +3,14 @@
* 记忆最近的产品/主题关键词,用于追问理解
*/
const { TRACKER_KEYWORD_GROUPS, buildKeywordRegex } = require('./knowledgeKeywords');
class ContextKeywordTracker {
constructor() {
this.sessionKeywords = new Map();
this.TTL = 30 * 60 * 1000;
this.MAX_KEYWORDS = 8;
this.keywordPatterns = [
/(一成系统|Ai众享|AI众享|数字化工作室|盛咖学愿|数字化运营|数字化经营|数字化营销|数字化创业|数字化事业)/gi,
/(PM-FitLine|PM细胞营养素|细胞营养素|德国PM|PM公司)/gi,
/(小红产品|大白产品|小白产品|Activize Oxyplus|Activize|Basics|Restorate|儿童倍适|Basic Power|CitrusCare|NutriSunny|Omega)/gi,
/(肽美|艾特维|德丽|德维|宝丽|美固健|葡萄籽|白藜芦醇|益生菌|胶原蛋白肽|Q10)/gi,
/(NTC营养保送系统|火炉原理|阿育吠陀|招商|加盟|代理|事业机会|招商加盟|合作加盟|事业合作)/gi,
];
this.keywordPatterns = TRACKER_KEYWORD_GROUPS.map((group) => buildKeywordRegex(group, 'gi'));
this.cleanupTimer = setInterval(() => this.cleanup(), this.TTL);
if (typeof this.cleanupTimer.unref === 'function') {
this.cleanupTimer.unref();