diff --git a/apps/web/app/(app)/[emailAccountId]/assistant/group/LearnedPatterns.tsx b/apps/web/app/(app)/[emailAccountId]/assistant/group/LearnedPatterns.tsx index be362ff2b2..6b9460f27d 100644 --- a/apps/web/app/(app)/[emailAccountId]/assistant/group/LearnedPatterns.tsx +++ b/apps/web/app/(app)/[emailAccountId]/assistant/group/LearnedPatterns.tsx @@ -3,7 +3,7 @@ import { useState } from "react"; import { useAction } from "next-safe-action/hooks"; import { BrainIcon } from "lucide-react"; -import { ViewGroup } from "@/app/(app)/[emailAccountId]/assistant/group/ViewGroup"; +import { ViewLearnedPatterns } from "@/app/(app)/[emailAccountId]/assistant/group/ViewLearnedPatterns"; import { Dialog, DialogContent, @@ -83,7 +83,9 @@ export function LearnedPatternsDialog({ {isExecuting ? ( ) : ( - learnedPatternGroupId && + learnedPatternGroupId && ( + + ) )} diff --git a/apps/web/app/(app)/[emailAccountId]/assistant/group/ViewGroup.tsx b/apps/web/app/(app)/[emailAccountId]/assistant/group/ViewLearnedPatterns.tsx similarity index 98% rename from apps/web/app/(app)/[emailAccountId]/assistant/group/ViewGroup.tsx rename to apps/web/app/(app)/[emailAccountId]/assistant/group/ViewLearnedPatterns.tsx index db17f28866..890509c836 100644 --- a/apps/web/app/(app)/[emailAccountId]/assistant/group/ViewGroup.tsx +++ b/apps/web/app/(app)/[emailAccountId]/assistant/group/ViewLearnedPatterns.tsx @@ -47,9 +47,9 @@ import { prefixPath } from "@/utils/path"; import { Toggle } from "@/components/Toggle"; import { ErrorBoundary } from "@/components/ErrorBoundary"; -export function ViewGroup({ groupId }: { groupId: string }) { +export function ViewLearnedPatterns({ groupId }: { groupId: string }) { return ( - + ); diff --git a/apps/web/app/(app)/[emailAccountId]/assistant/group/[groupId]/page.tsx b/apps/web/app/(app)/[emailAccountId]/assistant/group/[groupId]/page.tsx deleted file mode 100644 index 5023437934..0000000000 --- a/apps/web/app/(app)/[emailAccountId]/assistant/group/[groupId]/page.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { ViewGroup } from "@/app/(app)/[emailAccountId]/assistant/group/ViewGroup"; -import { Container } from "@/components/Container"; - -// Not in use anymore. Could delete this. -export default async function GroupPage(props: { - params: Promise<{ groupId: string }>; -}) { - const params = await props.params; - return ( -
- - - -
- ); -} diff --git a/apps/web/app/(app)/[emailAccountId]/assistant/settings/LearnedPatternsSetting.tsx b/apps/web/app/(app)/[emailAccountId]/assistant/settings/LearnedPatternsSetting.tsx new file mode 100644 index 0000000000..305ea1d2f2 --- /dev/null +++ b/apps/web/app/(app)/[emailAccountId]/assistant/settings/LearnedPatternsSetting.tsx @@ -0,0 +1,79 @@ +"use client"; + +import useSWR from "swr"; +import { Button } from "@/components/ui/button"; +import { SettingCard } from "@/components/SettingCard"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { TypographyP } from "@/components/Typography"; +import { ViewLearnedPatterns } from "@/app/(app)/[emailAccountId]/assistant/group/ViewLearnedPatterns"; +import type { GroupsResponse } from "@/app/api/user/group/route"; +import { LoadingContent } from "@/components/LoadingContent"; + +export function LearnedPatternsSetting() { + return ( + + + + + + + Learned Patterns + + When the AI processes your emails, it learns which senders or + email types consistently match the same rules. For example, it + might learn that emails from newsletter@example.com always match + your "Newsletter" rule. These learned patterns help the AI make + faster, more accurate decisions over time. You can view, edit, + or remove patterns that have been learned. + + + + + + } + /> + ); +} + +function Content() { + const { data, isLoading, error } = useSWR("/api/user/group"); + + return ( + + {data?.groups.length === 0 ? ( + + + No learned patterns found yet. + + + ) : ( +
+ {data?.groups.map((group) => ( + + + {group.rule?.name || "No rule"} + + + + + + ))} +
+ )} +
+ ); +} diff --git a/apps/web/app/(app)/[emailAccountId]/assistant/settings/SettingsTab.tsx b/apps/web/app/(app)/[emailAccountId]/assistant/settings/SettingsTab.tsx index ced74cff9c..989ef32953 100644 --- a/apps/web/app/(app)/[emailAccountId]/assistant/settings/SettingsTab.tsx +++ b/apps/web/app/(app)/[emailAccountId]/assistant/settings/SettingsTab.tsx @@ -4,6 +4,7 @@ import { DraftReplies } from "@/app/(app)/[emailAccountId]/assistant/settings/Dr import { DraftKnowledgeSetting } from "@/app/(app)/[emailAccountId]/assistant/settings/DraftKnowledgeSetting"; import { AwaitingReplySetting } from "@/app/(app)/[emailAccountId]/assistant/settings/AwaitingReplySetting"; import { ReferralSignatureSetting } from "@/app/(app)/[emailAccountId]/assistant/settings/ReferralSignatureSetting"; +import { LearnedPatternsSetting } from "@/app/(app)/[emailAccountId]/assistant/settings/LearnedPatternsSetting"; export function SettingsTab() { return ( @@ -14,6 +15,7 @@ export function SettingsTab() { + ); } diff --git a/apps/web/app/(app)/[emailAccountId]/debug/learned/page.tsx b/apps/web/app/(app)/[emailAccountId]/debug/learned/page.tsx deleted file mode 100644 index 85a29fd1a6..0000000000 --- a/apps/web/app/(app)/[emailAccountId]/debug/learned/page.tsx +++ /dev/null @@ -1,41 +0,0 @@ -"use client"; - -import useSWR from "swr"; -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; -import { PageHeading, TypographyP } from "@/components/Typography"; -import { ViewGroup } from "@/app/(app)/[emailAccountId]/assistant/group/ViewGroup"; -import type { GroupsResponse } from "@/app/api/user/group/route"; -import { LoadingContent } from "@/components/LoadingContent"; - -export default function DebugLearnedPage() { - const { data, isLoading, error } = useSWR("/api/user/group"); - - return ( -
- Learned Patterns - - - {data?.groups.length === 0 ? ( - - - No learned patterns found yet. - - - ) : ( -
- {data?.groups.map((group) => ( - - - {group.rule?.name || "No rule"} - - - - - - ))} -
- )} -
-
- ); -} diff --git a/apps/web/app/(app)/[emailAccountId]/debug/page.tsx b/apps/web/app/(app)/[emailAccountId]/debug/page.tsx index f2daf5e549..863911a2aa 100644 --- a/apps/web/app/(app)/[emailAccountId]/debug/page.tsx +++ b/apps/web/app/(app)/[emailAccountId]/debug/page.tsx @@ -13,11 +13,6 @@ export default async function DebugPage(props: { Debug
-