feat(wechat): add admin-pluggable LLM intent router separate from H5.
Memind CI / Test, build, and release guards (push) Failing after 8s

Give WeChat MP its own chat.general→page.generate LLM refinement layer with memindadm toggles, shadow mode, and canary openids so service account routing stays independent of the H5 chatIntentRouter.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-01 20:57:41 +08:00
parent cdc265d7e0
commit 91e140d402
14 changed files with 1145 additions and 4 deletions
+23 -3
View File
@@ -1487,6 +1487,7 @@ export function createWechatMpService({
wechatScheduleLlmConfigService = null,
llmProviderService = null,
chatIntentRouter = null,
wechatIntentRouter = null,
systemDisclosurePolicyService = null,
onPageGenerated = null,
applySessionLlmProvider = null,
@@ -2433,7 +2434,7 @@ export function createWechatMpService({
};
const runIntentMessage = async ({ inbound, intent, user }) => {
const wechatIntent = await resolveWechatIntent(intent);
const wechatIntent = await resolveWechatIntent(intent, { openid: inbound.fromUserName });
const mediaAnalysisEnabled = isWechatMediaGrayUser(user, config.mediaAnalysisGrayUsers);
const reliabilityEnabled = isWechatMediaGrayUser(user, config.reliabilityGrayUsers);
const agentReplyTimeoutMs = reliabilityEnabled ? config.agentReplyTimeoutMs : 0;
@@ -3066,7 +3067,7 @@ export function createWechatMpService({
}
};
const resolveWechatIntent = async (intent) => {
const resolveWechatIntent = async (intent, { openid = null } = {}) => {
const wechatIntent = classifyWechatIntent(intent);
if (intent.msgType !== 'text' && intent.msgType !== 'voice') return wechatIntent;
const sessionActionResult = await resolveWechatSessionAction(intent.agentText, {
@@ -3080,7 +3081,26 @@ export function createWechatMpService({
if (sessionActionResult.action === 'ignore_previous') {
intent.sessionAction = sessionActionResult.action;
}
return { ...wechatIntent, sessionActionResult };
const withSession = {
...wechatIntent,
sessionActionResult,
};
if (!wechatIntentRouter?.refineIntent) {
return withSession;
}
try {
return await wechatIntentRouter.refineIntent({
ruleIntent: withSession,
text: intent.agentText,
openid,
});
} catch (err) {
logger.warn?.(
'WeChat MP intent router refine skipped:',
err instanceof Error ? err.message : err,
);
return withSession;
}
};
const handleInboundMessage = async (bodyText, query = {}) => {