feat(mindspace): add opt-in local analytics

This commit is contained in:
john
2026-07-16 21:06:28 +08:00
parent 6e460336f7
commit 320945a485
9 changed files with 412 additions and 6 deletions
+13
View File
@@ -888,6 +888,9 @@ function resolveHtmlPublishArtifacts({
workingDir,
publicBaseUrl,
requestStartedAt,
userId = '',
sessionId = '',
onPageGenerated = null,
}) {
materializeMissingPublicHtmlWrites({
messages: reply?.messages ?? [],
@@ -918,6 +921,9 @@ function resolveHtmlPublishArtifacts({
recentArtifacts,
replyText: reply?.text,
});
if (typeof onPageGenerated === 'function' && confirmedArtifacts.length > 0) {
void onPageGenerated({ userId, sessionId, artifacts: confirmedArtifacts });
}
return {
publishedArtifacts,
expectedArtifacts,
@@ -1406,6 +1412,7 @@ export function createWechatMpService({
scheduleService = null,
wechatScheduleLlmConfigService = null,
llmProviderService = null,
onPageGenerated = null,
applySessionLlmProvider = null,
refreshSessionSnapshot = null,
pageDataFinishGuard = null,
@@ -1979,6 +1986,9 @@ export function createWechatMpService({
workingDir,
publicBaseUrl: config.publicBaseUrl,
requestStartedAt,
userId: user.userId,
sessionId,
onPageGenerated,
});
const hasValidLinkInReply = await hasAnyValidPublishedHtmlLink(reply?.text, linkExistsForRequest, {
confirmedArtifacts,
@@ -2135,6 +2145,9 @@ export function createWechatMpService({
workingDir,
publicBaseUrl: config.publicBaseUrl,
requestStartedAt: retryStartedAt,
userId: user.userId,
sessionId,
onPageGenerated,
});
const hasValidLinkInReply = await hasAnyValidPublishedHtmlLink(reply?.text, linkExistsForRequest, {
confirmedArtifacts,