@@ -60,6 +60,14 @@ func getSystemPrompt(apiType string, model string, isBuilder bool) []string {
6060 return []string {basePrompt }
6161}
6262
63+ func isLocalEndpoint (endpoint string ) bool {
64+ if endpoint == "" {
65+ return false
66+ }
67+ endpointLower := strings .ToLower (endpoint )
68+ return strings .Contains (endpointLower , "localhost" ) || strings .Contains (endpointLower , "127.0.0.1" )
69+ }
70+
6371func getWaveAISettings (premium bool , builderMode bool , rtInfo waveobj.ObjRTInfo ) (* uctypes.AIOptsType , error ) {
6472 maxTokens := DefaultMaxTokens
6573 if builderMode {
@@ -353,6 +361,11 @@ func RunAIChat(ctx context.Context, sseHandler *sse.SSEHandlerCh, backend UseCha
353361 defer activeChats .Delete (chatOpts .ChatId )
354362
355363 stepNum := chatstore .DefaultChatStore .CountUserMessages (chatOpts .ChatId )
364+ aiProvider := chatOpts .Config .Provider
365+ if aiProvider == "" {
366+ aiProvider = uctypes .AIProvider_Custom
367+ }
368+ isLocal := isLocalEndpoint (chatOpts .Config .Endpoint )
356369 metrics := & uctypes.AIMetrics {
357370 ChatId : chatOpts .ChatId ,
358371 StepNum : stepNum ,
@@ -364,6 +377,8 @@ func RunAIChat(ctx context.Context, sseHandler *sse.SSEHandlerCh, backend UseCha
364377 ToolDetail : make (map [string ]int ),
365378 ThinkingLevel : chatOpts .Config .ThinkingLevel ,
366379 AIMode : chatOpts .Config .AIMode ,
380+ AIProvider : aiProvider ,
381+ IsLocal : isLocal ,
367382 }
368383 firstStep := true
369384 var cont * uctypes.WaveContinueResponse
@@ -563,6 +578,8 @@ func sendAIMetricsTelemetry(ctx context.Context, metrics *uctypes.AIMetrics) {
563578 WaveAIWidgetAccess : metrics .WidgetAccess ,
564579 WaveAIThinkingLevel : metrics .ThinkingLevel ,
565580 WaveAIMode : metrics .AIMode ,
581+ WaveAIProvider : metrics .AIProvider ,
582+ WaveAIIsLocal : metrics .IsLocal ,
566583 })
567584 _ = telemetry .RecordTEvent (ctx , event )
568585}
0 commit comments