Skip to content

Commit

Permalink
Merge pull request #1256 from DalgoT4D/traker-llmanaylsis
Browse files Browse the repository at this point in the history
tracking buttons on llm page
  • Loading branch information
himanshudube97 authored Oct 7, 2024
2 parents 9953636 + 7b710c2 commit 86341ec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 14 additions & 3 deletions src/components/DataAnalysis/OverwriteBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Box, Button, TextField, Typography, DialogActions } from '@mui/material
import CustomDialog from '../Dialog/CustomDialog';
import { useForm, Controller } from 'react-hook-form';
import { MODALS } from './LLMSummary';
import { useTracking } from '@/contexts/TrackingContext';
// Define the form data type
interface FormData {
sessionName: string;
Expand Down Expand Up @@ -30,6 +31,7 @@ export const OverWriteDialog = ({
handleNewSession: (x: boolean) => void;
oldSessionName: string;
}) => {
const trackAmplitudeEvent: any = useTracking();
const {
control,
handleSubmit,
Expand Down Expand Up @@ -73,7 +75,10 @@ export const OverWriteDialog = ({
padding: '8px 0',
borderRadius: '5px',
},
onClick: handleSubmit((data) => onSubmit(data.sessionName, false)), // Use handleSubmit from react-hook-form
onClick: () => {
trackAmplitudeEvent(`[Save-LLMSummary] Button Clicked`);
handleSubmit((data) => onSubmit(data.sessionName, false))(); // Use handleSubmit from react-hook-form
},
},
{
label: 'Cancel',
Expand All @@ -100,7 +105,10 @@ export const OverWriteDialog = ({
padding: '8px 0',
borderRadius: '5px',
},
onClick: handleSubmit((data) => onSubmit(data.sessionName, true)), // Handle form submission
onClick: () => {
trackAmplitudeEvent(`[Overwrite-LLMSummary] Button Clicked`);
handleSubmit((data) => onSubmit(data.sessionName, true))(); // Handle form submission
},
},
{
label: 'Save as new',
Expand Down Expand Up @@ -143,7 +151,10 @@ export const OverWriteDialog = ({
padding: '8px 0',
borderRadius: '5px',
},
onClick: handleSubmit((data) => onSubmit(data.sessionName, false)), // Use handleSubmit from react-hook-form
onClick: () => {
trackAmplitudeEvent(`[Save-LLMSummary] Button Clicked`);
handleSubmit((data) => onSubmit(data.sessionName, false))(); // Use handleSubmit from react-hook-form
},
},
{
label: 'Cancel',
Expand Down
4 changes: 3 additions & 1 deletion src/components/DataAnalysis/SqlWrite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { errorToast } from '../ToastMessage/ToastHelper';
import { httpGet } from '@/helpers/http';
import { useSession } from 'next-auth/react';
import InfoTooltip from '../UI/Tooltip/Tooltip';
import { useTracking } from '@/contexts/TrackingContext';
interface Prompt {
id: string;
label: string;
Expand Down Expand Up @@ -35,7 +36,7 @@ export const SqlWrite = memo(
const globalContext = useContext(GlobalContext);
const [tempLoading, setTempLoading] = useState(false);
const [sqlQueryLimit, setSqlQueryLimit] = useState<number>(500); //deafult value

const trackAmplitudeEvent: any = useTracking();
const { control, setValue, watch, handleSubmit, reset } = useForm({
defaultValues: {
prompt: '',
Expand Down Expand Up @@ -73,6 +74,7 @@ export const SqlWrite = memo(
);
return;
}
trackAmplitudeEvent(`[Get-LLMSummary] Button Clicked`);
getLLMSummary({
sqlText,
user_prompt: prompt,
Expand Down

0 comments on commit 86341ec

Please sign in to comment.