File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
web/src/app/api/v1/chat/completions Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export enum AnalyticsEvent {
3636
3737 // Web
3838 SIGNUP = 'web.signup' ,
39+ SSE_ENDPOINT_REQUEST = 'web.sse_endpoint_request' ,
3940
4041 // Web - Authentication
4142 AUTH_LOGIN_STARTED = 'auth.login_started' ,
Original file line number Diff line number Diff line change 11import { getUserUsageData } from '@codebuff/billing/usage-service'
2+ import { trackEvent } from '@codebuff/common/analytics'
3+ import { AnalyticsEvent } from '@codebuff/common/constants/analytics-events'
24import { getErrorObject } from '@codebuff/common/util/error'
35import { NextResponse } from 'next/server'
46
@@ -29,6 +31,16 @@ export async function POST(req: NextRequest) {
2931 }
3032
3133 const userId = userInfo . id
34+
35+ trackEvent ( {
36+ event : AnalyticsEvent . SSE_ENDPOINT_REQUEST ,
37+ properties : {
38+ body,
39+ } ,
40+ userId,
41+ logger,
42+ } )
43+
3244 const {
3345 balance : { totalRemaining } ,
3446 nextQuotaReset,
You can’t perform that action at this time.
0 commit comments