mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-01 05:35:09 +03:00
feat: add prompt and brain change tracking (#1058)
This commit is contained in:
parent
04e9f572a4
commit
1b63141b26
@ -13,9 +13,9 @@ import {
|
||||
MentionTriggerType,
|
||||
} from "@/app/chat/[chatId]/components/ActionsBar/types";
|
||||
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
|
||||
|
||||
import "@draft-js-plugins/mention/lib/plugin.css";
|
||||
import "draft-js/dist/Draft.css";
|
||||
import { useJune } from "@/services/analytics/useJune";
|
||||
|
||||
import { useMentionPlugin } from "./helpers/MentionPlugin";
|
||||
import { useMentionState } from "./helpers/MentionState";
|
||||
@ -41,6 +41,7 @@ export const useMentionInput = ({
|
||||
setCurrentPromptId,
|
||||
} = useBrainContext();
|
||||
|
||||
const analytics = useJune();
|
||||
const {
|
||||
editorState,
|
||||
setEditorState,
|
||||
@ -65,10 +66,12 @@ export const useMentionInput = ({
|
||||
|
||||
const onAddMention = (mention: MentionData) => {
|
||||
if (mention.trigger === "#") {
|
||||
void analytics?.track("CHANGE_PROMPT");
|
||||
setCurrentPromptId(mention.id as UUID);
|
||||
}
|
||||
|
||||
if (mention.trigger === "@") {
|
||||
void analytics?.track("CHANGE_BRAIN");
|
||||
setCurrentBrainId(mention.id as UUID);
|
||||
}
|
||||
|
||||
|
@ -81,9 +81,8 @@ export const useBrainProvider = () => {
|
||||
const newActiveBrain = { id, name };
|
||||
saveBrainInLocalStorage(newActiveBrain);
|
||||
setCurrentBrainId(id);
|
||||
void track("CHANGE_BRAIN");
|
||||
},
|
||||
[track]
|
||||
[]
|
||||
);
|
||||
|
||||
const setDefaultBrain = useCallback(async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user