mirror of
https://github.com/StanGirard/quivr.git
synced 2024-11-28 13:42:41 +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,
|
MentionTriggerType,
|
||||||
} from "@/app/chat/[chatId]/components/ActionsBar/types";
|
} from "@/app/chat/[chatId]/components/ActionsBar/types";
|
||||||
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
|
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
|
||||||
|
|
||||||
import "@draft-js-plugins/mention/lib/plugin.css";
|
import "@draft-js-plugins/mention/lib/plugin.css";
|
||||||
import "draft-js/dist/Draft.css";
|
import "draft-js/dist/Draft.css";
|
||||||
|
import { useJune } from "@/services/analytics/useJune";
|
||||||
|
|
||||||
import { useMentionPlugin } from "./helpers/MentionPlugin";
|
import { useMentionPlugin } from "./helpers/MentionPlugin";
|
||||||
import { useMentionState } from "./helpers/MentionState";
|
import { useMentionState } from "./helpers/MentionState";
|
||||||
@ -41,6 +41,7 @@ export const useMentionInput = ({
|
|||||||
setCurrentPromptId,
|
setCurrentPromptId,
|
||||||
} = useBrainContext();
|
} = useBrainContext();
|
||||||
|
|
||||||
|
const analytics = useJune();
|
||||||
const {
|
const {
|
||||||
editorState,
|
editorState,
|
||||||
setEditorState,
|
setEditorState,
|
||||||
@ -65,10 +66,12 @@ export const useMentionInput = ({
|
|||||||
|
|
||||||
const onAddMention = (mention: MentionData) => {
|
const onAddMention = (mention: MentionData) => {
|
||||||
if (mention.trigger === "#") {
|
if (mention.trigger === "#") {
|
||||||
|
void analytics?.track("CHANGE_PROMPT");
|
||||||
setCurrentPromptId(mention.id as UUID);
|
setCurrentPromptId(mention.id as UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mention.trigger === "@") {
|
if (mention.trigger === "@") {
|
||||||
|
void analytics?.track("CHANGE_BRAIN");
|
||||||
setCurrentBrainId(mention.id as UUID);
|
setCurrentBrainId(mention.id as UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,9 +81,8 @@ export const useBrainProvider = () => {
|
|||||||
const newActiveBrain = { id, name };
|
const newActiveBrain = { id, name };
|
||||||
saveBrainInLocalStorage(newActiveBrain);
|
saveBrainInLocalStorage(newActiveBrain);
|
||||||
setCurrentBrainId(id);
|
setCurrentBrainId(id);
|
||||||
void track("CHANGE_BRAIN");
|
|
||||||
},
|
},
|
||||||
[track]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
const setDefaultBrain = useCallback(async () => {
|
const setDefaultBrain = useCallback(async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user