Enable opt-in telemetry

This commit is contained in:
Will Chen
2025-04-21 12:49:54 -07:00
parent 497a3b7dac
commit 16d5320485
18 changed files with 299 additions and 81 deletions

View File

@@ -36,8 +36,9 @@ import type { Message } from "@/ipc/ipc_types";
import { isPreviewOpenAtom } from "@/atoms/viewAtoms";
import { useRunApp } from "@/hooks/useRunApp";
import { AutoApproveSwitch } from "../AutoApproveSwitch";
import { usePostHog } from "posthog-js/react";
export function ChatInput({ chatId }: { chatId?: number }) {
const { capture } = usePostHog();
const [inputValue, setInputValue] = useAtom(chatInputValueAtom);
const textareaRef = useRef<HTMLTextAreaElement>(null);
const { settings, updateSettings, isAnyProviderSetup } = useSettings();
@@ -104,6 +105,7 @@ export function ChatInput({ chatId }: { chatId?: number }) {
const currentInput = inputValue;
setInputValue("");
await streamMessage({ prompt: currentInput, chatId });
capture("chat:submit");
};
const handleCancel = () => {
@@ -124,6 +126,7 @@ export function ChatInput({ chatId }: { chatId?: number }) {
`Approving proposal for chatId: ${chatId}, messageId: ${messageId}`
);
setIsApproving(true);
capture("chat:approve");
try {
const result = await IpcClient.getInstance().approveProposal({
chatId,
@@ -157,6 +160,7 @@ export function ChatInput({ chatId }: { chatId?: number }) {
`Rejecting proposal for chatId: ${chatId}, messageId: ${messageId}`
);
setIsRejecting(true);
capture("chat:reject");
try {
const result = await IpcClient.getInstance().rejectProposal({
chatId,