Add per-feature Cursor channel toggles for admin and runtime.
Memind CI / Test, build, and release guards (push) Has been cancelled

Expose page/data/scheduled-task/chat-bridge switches in the智趣体验通道 config so Tang can roll out Cursor paths independently with DeepSeek fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-31 09:40:52 +08:00
parent ac2c87be43
commit 617ff0d1dd
21 changed files with 915 additions and 127 deletions
+15 -7
View File
@@ -2179,9 +2179,9 @@ export function createWechatMpService({
throw notifyFailure ? markWechatUserNotified(error) : error;
};
const ensureSessionProvider = async (sessionId) => {
const ensureSessionProvider = async (sessionId, userId = null) => {
if (!applySessionLlmProvider || !sessionId) return;
const applied = await applySessionLlmProvider(sessionId);
const applied = await applySessionLlmProvider(sessionId, { userId });
if (applied && applied.ok === false) {
throw new Error(applied.message || '专属 Agent Provider 未配置');
}
@@ -2539,6 +2539,9 @@ export function createWechatMpService({
void refreshWechatSessionSnapshot(sessionId, userId);
};
/** Cursor channel writes the assistant turn via respondDeterministically; goose stays empty. */
const shouldRefreshWechatSessionSnapshot = (reply) => !isWechatCursorChannelReply(reply);
const rememberWechatUserContext = async (sessionId, user, { forceBootstrap = false } = {}) => {
const addressName = resolveWechatAddressName(user);
if (!addressName) return;
@@ -2820,7 +2823,7 @@ export function createWechatMpService({
});
let sessionId = route.sessionId;
let carriedSessionContent = String(route.carriedSessionContent ?? '').trim();
await ensureSessionProvider(sessionId);
await ensureSessionProvider(sessionId, user.userId);
if (wechatIntent.kind === 'session.reset') {
await sendCustomerServiceText(
inbound.fromUserName,
@@ -2847,7 +2850,7 @@ export function createWechatMpService({
if (pollutionRotation.carriedSessionContent) {
carriedSessionContent = pollutionRotation.carriedSessionContent;
}
await ensureSessionProvider(sessionId);
await ensureSessionProvider(sessionId, user.userId);
await rememberWechatUserContext(sessionId, user, { forceBootstrap: true });
}
if (
@@ -2964,6 +2967,7 @@ export function createWechatMpService({
displayText: String(intent?.displayText ?? intent?.agentText ?? '').trim(),
agentPrompt: activeAgentPrompt,
intentKind: wechatIntent.kind,
policy: wechatCursorPolicy,
timeoutMs: agentReplyTimeoutMs,
logger,
});
@@ -3279,7 +3283,9 @@ export function createWechatMpService({
finalizedReply = appendGeneratedImageFallbackLink(finalizedReply, generatedImages[0]);
}
}
scheduleWechatSessionSnapshotRefresh(sessionId, user.userId);
if (shouldRefreshWechatSessionSnapshot(finalizedReply)) {
scheduleWechatSessionSnapshotRefresh(sessionId, user.userId);
}
const delivery = await sendCustomerServiceText(
inbound.fromUserName,
await guardScheduleReply(finalizedReply),
@@ -3386,7 +3392,7 @@ export function createWechatMpService({
userContext: user,
});
sessionId = route.sessionId;
await ensureSessionProvider(sessionId);
await ensureSessionProvider(sessionId, user.userId);
await rememberWechatUserContext(sessionId, user, { forceBootstrap: route.isNewSession });
if (historicalImageError) {
prepareWechatIntentForHistoricalImageRetry(intent, {
@@ -3668,7 +3674,9 @@ export function createWechatMpService({
finalizedReply = appendGeneratedImageFallbackLink(finalizedReply, generatedImages[0]);
}
}
scheduleWechatSessionSnapshotRefresh(sessionId, user.userId);
if (shouldRefreshWechatSessionSnapshot(finalizedReply)) {
scheduleWechatSessionSnapshotRefresh(sessionId, user.userId);
}
const retryDelivery = await sendCustomerServiceText(
inbound.fromUserName,
await guardScheduleReply(finalizedReply),