mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
chore(ask_sb): Add PostHog telemetry event for new chat thread creation (#418)
This commit is contained in:
parent
163e558b9a
commit
48269781b7
3 changed files with 9 additions and 1 deletions
|
|
@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Fixed
|
||||
- [ask sb] Fixed "413 content too large" error when starting a new chat with many repos selected. [#416](https://github.com/sourcebot-dev/sourcebot/pull/416)
|
||||
|
||||
### Added
|
||||
- [ask sb] PostHog telemetry for chat thread creation. [#418](https://github.com/sourcebot-dev/sourcebot/pull/418)
|
||||
|
||||
## [4.6.1] - 2025-07-29
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -12,12 +12,14 @@ import { isServiceError } from "@/lib/utils";
|
|||
import { createPathWithQueryParams } from "@/lib/utils";
|
||||
import { SearchScope, SET_CHAT_STATE_SESSION_STORAGE_KEY, SetChatStatePayload } from "./types";
|
||||
import { useSessionStorage } from "usehooks-ts";
|
||||
import useCaptureEvent from "@/hooks/useCaptureEvent";
|
||||
|
||||
export const useCreateNewChatThread = () => {
|
||||
const domain = useDomain();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const { toast } = useToast();
|
||||
const router = useRouter();
|
||||
const captureEvent = useCaptureEvent();
|
||||
|
||||
const [, setChatState] = useSessionStorage<SetChatStatePayload | null>(SET_CHAT_STATE_SESSION_STORAGE_KEY, null);
|
||||
|
||||
|
|
@ -38,6 +40,8 @@ export const useCreateNewChatThread = () => {
|
|||
return;
|
||||
}
|
||||
|
||||
captureEvent('wa_chat_thread_created', {});
|
||||
|
||||
setChatState({
|
||||
inputMessage,
|
||||
selectedSearchScopes,
|
||||
|
|
@ -47,7 +51,7 @@ export const useCreateNewChatThread = () => {
|
|||
|
||||
router.push(url);
|
||||
router.refresh();
|
||||
}, [domain, router, toast, setChatState]);
|
||||
}, [domain, router, toast, setChatState, captureEvent]);
|
||||
|
||||
return {
|
||||
createNewChatThread,
|
||||
|
|
|
|||
|
|
@ -282,6 +282,7 @@ export type PosthogEventMap = {
|
|||
chatId: string,
|
||||
messageId: string,
|
||||
},
|
||||
wa_chat_thread_created: {},
|
||||
//////////////////////////////////////////////////////////////////
|
||||
wa_demo_docs_link_pressed: {},
|
||||
wa_demo_search_context_card_pressed: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue