refactor(stage): infer conversation analytics surface
Centralize conversation event surface detection inside useAnalytics and keep chat UI call sites focused on business fields. Signed-off-by: RainbowBird <git@luoling.moe> Commit-Message-Assisted-by: Codex
This commit is contained in:
@@ -115,6 +115,7 @@
|
||||
- 前端 `posthog-js` 通过 `packages/stage-ui/src/stores/analytics/posthog.ts` 初始化,三个 app(web / desktop / pocket)按 `isStageTamagotchi()` 等选 project key
|
||||
- Server 不接入 `posthog-node`。后端产品事件写 `product_events`,Grafana 展示低基数聚合;需要 PostHog revenue/person analytics 时优先用 PostHog Stripe source connector 或离线导入,不允许在 API 请求路径同步发 PostHog。
|
||||
- 前端 identity:`useSharedAnalyticsStore.initialize()` watch `authStore.isAuthenticated` 自动调 `posthog.identify(user.id)` / `reset()`
|
||||
- Conversation controls 事件的 `surface` 由 `packages/stage-ui/src/composables/use-analytics.ts` 统一按 runtime 推断,UI 调用点只传业务字段。
|
||||
|
||||
已埋点:
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ const {
|
||||
trackChatMessageRetried,
|
||||
trackChatMessagesCleared,
|
||||
} = useAnalytics()
|
||||
const { showStopSpeakingButton, stopSpeakingFromChat } = useStopSpeakingButton('electron')
|
||||
const { showStopSpeakingButton, stopSpeakingFromChat } = useStopSpeakingButton()
|
||||
|
||||
const latestImageEntries = computed(() => {
|
||||
if (!activeCardId.value)
|
||||
@@ -207,7 +207,6 @@ async function handleDeleteMessage(index: number) {
|
||||
const message = messages.value[index]
|
||||
await chatSyncStore.requestDeleteMessage({ index })
|
||||
trackChatMessageDeleted({
|
||||
surface: 'electron',
|
||||
source: 'history',
|
||||
message_role: message?.role ?? 'unknown',
|
||||
})
|
||||
@@ -223,7 +222,6 @@ async function handleRetryMessage(index: number) {
|
||||
index,
|
||||
})
|
||||
trackChatMessageRetried({
|
||||
surface: 'electron',
|
||||
source: 'history',
|
||||
})
|
||||
}
|
||||
@@ -232,7 +230,6 @@ async function handleCleanupMessages() {
|
||||
const messageCount = messages.value.filter(message => message.role !== 'system').length
|
||||
await chatSyncStore.requestCleanup()
|
||||
trackChatMessagesCleared({
|
||||
surface: 'electron',
|
||||
source: 'chat_controls',
|
||||
message_count: messageCount,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user