File tree Expand file tree Collapse file tree
clients/search-component/src/TrieveModal/Chat Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,26 +17,24 @@ export const FollowupQueries = () => {
1717 }
1818
1919 const handleFollowupQuery = async ( q : string ) => {
20- const requestId = messages [ messages . length - 1 ] . queryId ;
21-
22- if ( requestId ) {
23- await trieveSDK . sendAnalyticsEvent ( {
24- event_name : `site-followup_query` ,
25- event_type : "click" ,
26- user_id : fingerprint ,
27- location : window . location . href ,
28- metadata : {
29- followup_query : q ,
30- component_props : props ,
31- } ,
32- request : {
33- request_id : requestId ,
34- request_type : "rag" ,
35- } ,
36- } ) ;
37- } ;
3820 askQuestion ( q ) ;
3921
22+ const requestId = messages [ messages . length - 1 ] ?. queryId ?? "00000000-0000-0000-0000-000000000000" ;
23+
24+ await trieveSDK . sendAnalyticsEvent ( {
25+ event_name : `site-followup_query` ,
26+ event_type : "click" ,
27+ user_id : fingerprint ,
28+ location : window . location . href ,
29+ metadata : {
30+ followup_query : q ,
31+ component_props : props ,
32+ } ,
33+ request : {
34+ request_id : requestId ,
35+ request_type : "rag" ,
36+ } ,
37+ } ) ;
4038 }
4139
4240 return (
Original file line number Diff line number Diff line change @@ -24,27 +24,27 @@ export const SuggestedQuestions = ({
2424 }
2525
2626 const handleSuggestedQuestion = async ( q : string ) => {
27- const requestId = messages [ messages . length - 1 ] . queryId ;
2827
29- if ( requestId ) {
30- await trieveSDK . sendAnalyticsEvent ( {
31- event_name : `site-followup_query` ,
32- event_type : "click" ,
33- user_id : fingerprint ,
34- location : window . location . href ,
35- metadata : {
36- followup_query : q ,
37- component_props : props ,
38- } ,
39- request : {
40- request_id : requestId ,
41- request_type : "rag" ,
42- } ,
43- } ) ;
44- } ;
4528
4629 setCurrentQuestion ( q ) ;
4730 askQuestion ( q ) ;
31+
32+ const requestId = messages [ messages . length - 1 ] ?. queryId ?? "00000000-0000-0000-0000-000000000000" ;
33+
34+ await trieveSDK . sendAnalyticsEvent ( {
35+ event_name : `site-followup_query` ,
36+ event_type : "click" ,
37+ user_id : fingerprint ,
38+ location : window . location . href ,
39+ metadata : {
40+ followup_query : q ,
41+ component_props : props ,
42+ } ,
43+ request : {
44+ request_id : requestId ,
45+ request_type : "rag" ,
46+ } ,
47+ } ) ;
4848 if ( onMessageSend ) {
4949 onMessageSend ( ) ;
5050 }
You can’t perform that action at this time.
0 commit comments