A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
feat: add customizable tag styles (#2312)
Mohamed Bassemaf3010abaa37
diff --git a/apps/web/components/settings/AISettings.tsx b/apps/web/components/settings/AISettings.tsxindex d8adcb76..48c45633 100644--- a/apps/web/components/settings/AISettings.tsx+++ b/apps/web/components/settings/AISettings.tsx@@ -1,17 +1,33 @@"use client";import { ActionButton } from "@/components/ui/action-button";+import { Badge } from "@/components/ui/badge";+import {+ Card,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+} from "@/components/ui/card";+import {+ Field,+ FieldContent,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,+ FieldTitle,+} from "@/components/ui/field";import {Form,FormControl,- FormDescription,FormField,FormItem,- FormLabel,FormMessage,} from "@/components/ui/form";import { FullPageSpinner } from "@/components/ui/full-page-spinner";import { Input } from "@/components/ui/input";+import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";import {Select,SelectContent,@@ -26,9 +42,10 @@ import { useClientConfig } from "@/lib/clientConfig";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { useUserSettings } from "@/lib/userSettings";+import { cn } from "@/lib/utils";import { zodResolver } from "@hookform/resolvers/zod";-import { Plus, Save, Trash2 } from "lucide-react";-import { useForm } from "react-hook-form";+import { Info, Plus, Save, Trash2 } from "lucide-react";+import { Controller, useForm } from "react-hook-form";import { z } from "zod";import { useUpdateUserSettings } from "@karakeep/shared-react/hooks/users";@@ -44,12 +61,33 @@ import {} from "@karakeep/shared/types/prompts";import { zUpdateUserSettingsSchema } from "@karakeep/shared/types/users";+function SettingsSection({+ title,+ description,+ children,+}: {+ title?: string;+ description?: string;+ children: React.ReactNode;+ className?: string;+}) {+ return (+ <Card>+ <CardHeader>+ {title && <CardTitle>{title}</CardTitle>}+ {description && <CardDescription>{description}</CardDescription>}+ </CardHeader>+ <CardContent>{children}</CardContent>+ </Card>+ );+}+export function AIPreferences() {const { t } = useTranslation();const clientConfig = useClientConfig();const settings = useUserSettings();- const { mutate: updateSettings } = useUpdateUserSettings({+ const { mutate: updateSettings, isPending } = useUpdateUserSettings({onSuccess: () => {toast({description: "Settings updated successfully!",@@ -67,6 +105,7 @@ export function AIPreferences() {resolver: zodResolver(zUpdateUserSettingsSchema),values: settings? {+ inferredTagLang: settings.inferredTagLang ?? "",autoTaggingEnabled: settings.autoTaggingEnabled,autoSummarizationEnabled: settings.autoSummarizationEnabled,}@@ -76,72 +115,227 @@ export function AIPreferences() {const showAutoTagging = clientConfig.inference.enableAutoTagging;const showAutoSummarization = clientConfig.inference.enableAutoSummarization;- // Don't show the section if neither feature is enabled on the server- if (!showAutoTagging && !showAutoSummarization) {- return null;- }+ const onSubmit = (data: z.infer<typeof zUpdateUserSettingsSchema>) => {+ updateSettings(data);+ };return (- <div className="mt-2 flex flex-col gap-2">- <p className="mb-1 text-xs italic text-muted-foreground">- {t("settings.ai.ai_preferences_description")}- </p>- <Form {...form}>- <form className="space-y-4">+ <SettingsSection title="AI preferences">+ <form onSubmit={form.handleSubmit(onSubmit)}>+ <FieldGroup className="gap-3">+ <Controller+ name="inferredTagLang"+ control={form.control}+ render={({ field, fieldState }) => (+ <Field+ className="rounded-lg border p-3"+ data-invalid={fieldState.invalid}+ >+ <FieldContent>+ <FieldLabel htmlFor="inferredTagLang">+ {t("settings.ai.inference_language")}+ </FieldLabel>+ <FieldDescription>+ {t("settings.ai.inference_language_description")}+ </FieldDescription>+ </FieldContent>+ <Input+ {...field}+ id="inferredTagLang"+ value={field.value ?? ""}+ onChange={(e) =>+ field.onChange(+ e.target.value.length > 0 ? e.target.value : null,+ )+ }+ aria-invalid={fieldState.invalid}+ placeholder={`Default (${clientConfig.inference.inferredTagLang})`}+ type="text"+ />+ {fieldState.invalid && (+ <FieldError errors={[fieldState.error]} />+ )}+ </Field>+ )}+ />+{showAutoTagging && (- <FormField- control={form.control}+ <Controllername="autoTaggingEnabled"- render={({ field }) => (- <FormItem className="flex flex-row items-center justify-between rounded-lg border p-3">- <div className="space-y-0.5">- <FormLabel>{t("settings.ai.auto_tagging")}</FormLabel>- <FormDescription>+ control={form.control}+ render={({ field, fieldState }) => (+ <Field+ orientation="horizontal"+ className="rounded-lg border p-3"+ data-invalid={fieldState.invalid}+ >+ <FieldContent>+ <FieldLabel htmlFor="autoTaggingEnabled">+ {t("settings.ai.auto_tagging")}+ </FieldLabel>+ <FieldDescription>{t("settings.ai.auto_tagging_description")}- </FormDescription>- </div>- <FormControl>- <Switch- checked={field.value ?? true}- onCheckedChange={(checked) => {- field.onChange(checked);- updateSettings({ autoTaggingEnabled: checked });- }}- />- </FormControl>- </FormItem>+ </FieldDescription>+ </FieldContent>+ <Switch+ id="autoTaggingEnabled"+ name={field.name}+ checked={field.value ?? true}+ onCheckedChange={field.onChange}+ aria-invalid={fieldState.invalid}+ />+ {fieldState.invalid && (+ <FieldError errors={[fieldState.error]} />+ )}+ </Field>)}/>)}{showAutoSummarization && (- <FormField- control={form.control}+ <Controllername="autoSummarizationEnabled"- render={({ field }) => (- <FormItem className="flex flex-row items-center justify-between rounded-lg border p-3">- <div className="space-y-0.5">- <FormLabel>{t("settings.ai.auto_summarization")}</FormLabel>- <FormDescription>+ control={form.control}+ render={({ field, fieldState }) => (+ <Field+ orientation="horizontal"+ className="rounded-lg border p-3"+ data-invalid={fieldState.invalid}+ >+ <FieldContent>+ <FieldLabel htmlFor="autoSummarizationEnabled">+ {t("settings.ai.auto_summarization")}+ </FieldLabel>+ <FieldDescription>{t("settings.ai.auto_summarization_description")}- </FormDescription>- </div>- <FormControl>- <Switch- checked={field.value ?? true}- onCheckedChange={(checked) => {- field.onChange(checked);- updateSettings({ autoSummarizationEnabled: checked });- }}- />- </FormControl>- </FormItem>+ </FieldDescription>+ </FieldContent>+ <Switch+ id="autoSummarizationEnabled"+ name={field.name}+ checked={field.value ?? true}+ onCheckedChange={field.onChange}+ aria-invalid={fieldState.invalid}+ />+ {fieldState.invalid && (+ <FieldError errors={[fieldState.error]} />+ )}+ </Field>)}/>)}- </form>- </Form>- </div>++ <div className="flex justify-end pt-4">+ <ActionButton type="submit" loading={isPending} variant="default">+ <Save className="mr-2 size-4" />+ {t("actions.save")}+ </ActionButton>+ </div>+ </FieldGroup>+ </form>+ </SettingsSection>+ );+}++export function TagStyleSelector() {+ const { t } = useTranslation();+ const settings = useUserSettings();++ const { mutate: updateSettings, isPending: isUpdating } =+ useUpdateUserSettings({+ onSuccess: () => {+ toast({+ description: "Tag style updated successfully!",+ });+ },+ onError: () => {+ toast({+ description: "Failed to update tag style",+ variant: "destructive",+ });+ },+ });++ const tagStyleOptions = [+ {+ value: "lowercase-hyphens",+ label: t("settings.ai.lowercase_hyphens"),+ examples: ["machine-learning", "web-development"],+ },+ {+ value: "lowercase-spaces",+ label: t("settings.ai.lowercase_spaces"),+ examples: ["machine learning", "web development"],+ },+ {+ value: "lowercase-underscores",+ label: t("settings.ai.lowercase_underscores"),+ examples: ["machine_learning", "web_development"],+ },+ {+ value: "titlecase-spaces",+ label: t("settings.ai.titlecase_spaces"),+ examples: ["Machine Learning", "Web Development"],+ },+ {+ value: "titlecase-hyphens",+ label: t("settings.ai.titlecase_hyphens"),+ examples: ["Machine-Learning", "Web-Development"],+ },+ {+ value: "camelCase",+ label: t("settings.ai.camelCase"),+ examples: ["machineLearning", "webDevelopment"],+ },+ {+ value: "as-generated",+ label: t("settings.ai.no_preference"),+ examples: ["Machine Learning", "web development", "AI_generated"],+ },+ ] as const;++ const selectedStyle = settings?.tagStyle ?? "as-generated";++ return (+ <SettingsSection+ title={t("settings.ai.tag_style")}+ description={t("settings.ai.tag_style_description")}+ >+ <RadioGroup+ value={selectedStyle}+ onValueChange={(value) => {+ updateSettings({ tagStyle: value as typeof selectedStyle });+ }}+ disabled={isUpdating}+ className="grid gap-3 sm:grid-cols-2"+ >+ {tagStyleOptions.map((option) => (+ <FieldLabel+ key={option.value}+ htmlFor={option.value}+ className={cn(selectedStyle === option.value && "ring-1")}+ >+ <Field orientation="horizontal">+ <FieldContent>+ <FieldTitle>{option.label}</FieldTitle>+ <div className="flex flex-wrap gap-1">+ {option.examples.map((example) => (+ <Badge+ key={example}+ variant="secondary"+ className="text-xs font-light"+ >+ {example}+ </Badge>+ ))}+ </div>+ </FieldContent>+ <RadioGroupItem value={option.value} id={option.value} />+ </Field>+ </FieldLabel>+ ))}+ </RadioGroup>+ </SettingsSection>);}@@ -384,89 +578,116 @@ export function TaggingRules() {const { data: prompts, isLoading } = api.prompts.list.useQuery();return (- <div className="mt-2 flex flex-col gap-2">- <div className="w-full text-xl font-medium sm:w-1/3">- {t("settings.ai.tagging_rules")}- </div>- <p className="mb-1 text-xs italic text-muted-foreground">- {t("settings.ai.tagging_rule_description")}- </p>- {isLoading && <FullPageSpinner />}+ <SettingsSection+ title={t("settings.ai.tagging_rules")}+ description={t("settings.ai.tagging_rule_description")}+ >{prompts && prompts.length == 0 && (- <p className="rounded-md bg-muted p-2 text-sm text-muted-foreground">- You don't have any custom prompts yet.- </p>+ <div className="flex items-start gap-2 rounded-md bg-muted p-4 text-sm text-muted-foreground">+ <Info className="size-4 flex-shrink-0" />+ <p>You don't have any custom prompts yet.</p>+ </div>)}- {prompts &&- prompts.map((prompt) => <PromptRow key={prompt.id} prompt={prompt} />)}- <PromptEditor />- </div>+ <div className="flex flex-col gap-2">+ {isLoading && <FullPageSpinner />}+ {prompts &&+ prompts.map((prompt) => (+ <PromptRow key={prompt.id} prompt={prompt} />+ ))}+ <PromptEditor />+ </div>+ </SettingsSection>);}export function PromptDemo() {const { t } = useTranslation();const { data: prompts } = api.prompts.list.useQuery();+ const settings = useUserSettings();const clientConfig = useClientConfig();+ const tagStyle = settings?.tagStyle ?? "as-generated";+ const inferredTagLang =+ settings?.inferredTagLang ?? clientConfig.inference.inferredTagLang;+return (- <div className="flex flex-col gap-2">- <div className="mb-4 w-full text-xl font-medium sm:w-1/3">- {t("settings.ai.prompt_preview")}+ <SettingsSection+ title={t("settings.ai.prompt_preview")}+ description="Preview the actual prompts sent to AI based on your settings"+ >+ <div className="space-y-4">+ <div>+ <p className="mb-2 text-sm font-medium">+ {t("settings.ai.text_prompt")}+ </p>+ <code className="block whitespace-pre-wrap rounded-md bg-muted p-3 text-sm text-muted-foreground">+ {buildTextPromptUntruncated(+ inferredTagLang,+ (prompts ?? [])+ .filter(+ (p) => p.appliesTo == "text" || p.appliesTo == "all_tagging",+ )+ .map((p) => p.text),+ "\n<CONTENT_HERE>\n",+ tagStyle,+ ).trim()}+ </code>+ </div>+ <div>+ <p className="mb-2 text-sm font-medium">+ {t("settings.ai.images_prompt")}+ </p>+ <code className="block whitespace-pre-wrap rounded-md bg-muted p-3 text-sm text-muted-foreground">+ {buildImagePrompt(+ inferredTagLang,+ (prompts ?? [])+ .filter(+ (p) =>+ p.appliesTo == "images" || p.appliesTo == "all_tagging",+ )+ .map((p) => p.text),+ tagStyle,+ ).trim()}+ </code>+ </div>+ <div>+ <p className="mb-2 text-sm font-medium">+ {t("settings.ai.summarization_prompt")}+ </p>+ <code className="block whitespace-pre-wrap rounded-md bg-muted p-3 text-sm text-muted-foreground">+ {buildSummaryPromptUntruncated(+ inferredTagLang,+ (prompts ?? [])+ .filter((p) => p.appliesTo == "summary")+ .map((p) => p.text),+ "\n<CONTENT_HERE>\n",+ ).trim()}+ </code>+ </div></div>- <p>{t("settings.ai.text_prompt")}</p>- <code className="whitespace-pre-wrap rounded-md bg-muted p-3 text-sm text-muted-foreground">- {buildTextPromptUntruncated(- clientConfig.inference.inferredTagLang,- (prompts ?? [])- .filter(- (p) => p.appliesTo == "text" || p.appliesTo == "all_tagging",- )- .map((p) => p.text),- "\n<CONTENT_HERE>\n",- ).trim()}- </code>- <p>{t("settings.ai.images_prompt")}</p>- <code className="whitespace-pre-wrap rounded-md bg-muted p-3 text-sm text-muted-foreground">- {buildImagePrompt(- clientConfig.inference.inferredTagLang,- (prompts ?? [])- .filter(- (p) => p.appliesTo == "images" || p.appliesTo == "all_tagging",- )- .map((p) => p.text),- ).trim()}- </code>- <p>{t("settings.ai.summarization_prompt")}</p>- <code className="whitespace-pre-wrap rounded-md bg-muted p-3 text-sm text-muted-foreground">- {buildSummaryPromptUntruncated(- clientConfig.inference.inferredTagLang,- (prompts ?? [])- .filter((p) => p.appliesTo == "summary")- .map((p) => p.text),- "\n<CONTENT_HERE>\n",- ).trim()}- </code>- </div>+ </SettingsSection>);}export default function AISettings() {const { t } = useTranslation();return (- <>- <div className="rounded-md border bg-background p-4">- <div className="mb-2 flex flex-col gap-3">- <div className="w-full text-2xl font-medium sm:w-1/3">- {t("settings.ai.ai_settings")}- </div>- <AIPreferences />- <TaggingRules />- </div>- </div>- <div className="mt-4 rounded-md border bg-background p-4">- <PromptDemo />- </div>- </>+ <div className="space-y-6">+ <h2 className="text-3xl font-bold tracking-tight">+ {t("settings.ai.ai_settings")}+ </h2>++ {/* AI Preferences */}+ <AIPreferences />++ {/* Tag Style */}+ <TagStyleSelector />++ {/* Tagging Rules */}+ <TaggingRules />++ {/* Prompt Preview */}+ <PromptDemo />+ </div>);}diff --git a/apps/web/components/ui/field.tsx b/apps/web/components/ui/field.tsxnew file mode 100644index 00000000..a52897f5--- /dev/null+++ b/apps/web/components/ui/field.tsx@@ -0,0 +1,244 @@+"use client";++import type { VariantProps } from "class-variance-authority";+import { useMemo } from "react";+import { Label } from "@/components/ui/label";+import { Separator } from "@/components/ui/separator";+import { cn } from "@/lib/utils";+import { cva } from "class-variance-authority";++function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {+ return (+ <fieldset+ data-slot="field-set"+ className={cn(+ "flex flex-col gap-6",+ "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",+ className,+ )}+ {...props}+ />+ );+}++function FieldLegend({+ className,+ variant = "legend",+ ...props+}: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {+ return (+ <legend+ data-slot="field-legend"+ data-variant={variant}+ className={cn(+ "mb-3 font-medium",+ "data-[variant=legend]:text-base",+ "data-[variant=label]:text-sm",+ className,+ )}+ {...props}+ />+ );+}++function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {+ return (+ <div+ data-slot="field-group"+ className={cn(+ "group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",+ className,+ )}+ {...props}+ />+ );+}++const fieldVariants = cva(+ "group/field flex w-full gap-3 data-[invalid=true]:text-destructive",+ {+ variants: {+ orientation: {+ vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],+ horizontal: [+ "flex-row items-center",+ "[&>[data-slot=field-label]]:flex-auto",+ "has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start",+ ],+ responsive: [+ "@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto",+ "@md/field-group:[&>[data-slot=field-label]]:flex-auto",+ "@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",+ ],+ },+ },+ defaultVariants: {+ orientation: "vertical",+ },+ },+);++function Field({+ className,+ orientation = "vertical",+ ...props+}: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {+ return (+ <div+ role="group"+ data-slot="field"+ data-orientation={orientation}+ className={cn(fieldVariants({ orientation }), className)}+ {...props}+ />+ );+}++function FieldContent({ className, ...props }: React.ComponentProps<"div">) {+ return (+ <div+ data-slot="field-content"+ className={cn(+ "group/field-content flex flex-1 flex-col gap-1.5 leading-snug",+ className,+ )}+ {...props}+ />+ );+}++function FieldLabel({+ className,+ ...props+}: React.ComponentProps<typeof Label>) {+ return (+ <Label+ data-slot="field-label"+ className={cn(+ "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",+ "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4",+ "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",+ className,+ )}+ {...props}+ />+ );+}++function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {+ return (+ <div+ data-slot="field-label"+ className={cn(+ "flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled=true]/field:opacity-50",+ className,+ )}+ {...props}+ />+ );+}++function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {+ return (+ <p+ data-slot="field-description"+ className={cn(+ "text-sm font-normal leading-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance",+ "nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5",+ "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",+ className,+ )}+ {...props}+ />+ );+}++function FieldSeparator({+ children,+ className,+ ...props+}: React.ComponentProps<"div"> & {+ children?: React.ReactNode;+}) {+ return (+ <div+ data-slot="field-separator"+ data-content={!!children}+ className={cn(+ "relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",+ className,+ )}+ {...props}+ >+ <Separator className="absolute inset-0 top-1/2" />+ {children && (+ <span+ className="relative mx-auto block w-fit bg-background px-2 text-muted-foreground"+ data-slot="field-separator-content"+ >+ {children}+ </span>+ )}+ </div>+ );+}++function FieldError({+ className,+ children,+ errors,+ ...props+}: React.ComponentProps<"div"> & {+ errors?: ({ message?: string } | undefined)[];+}) {+ const content = useMemo(() => {+ if (children) {+ return children;+ }++ if (!errors) {+ return null;+ }++ if (errors?.length === 1 && errors[0]?.message) {+ return errors[0].message;+ }++ return (+ <ul className="ml-4 flex list-disc flex-col gap-1">+ {errors.map(+ (error, index) =>+ error?.message && <li key={index}>{error.message}</li>,+ )}+ </ul>+ );+ }, [children, errors]);++ if (!content) {+ return null;+ }++ return (+ <div+ role="alert"+ data-slot="field-error"+ className={cn("text-sm font-normal text-destructive", className)}+ {...props}+ >+ {content}+ </div>+ );+}++export {+ Field,+ FieldLabel,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLegend,+ FieldSeparator,+ FieldSet,+ FieldContent,+ FieldTitle,+};diff --git a/apps/web/components/ui/radio-group.tsx b/apps/web/components/ui/radio-group.tsxnew file mode 100644index 00000000..0da1136e--- /dev/null+++ b/apps/web/components/ui/radio-group.tsx@@ -0,0 +1,43 @@+"use client";++import * as React from "react";+import { cn } from "@/lib/utils";+import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";+import { Circle } from "lucide-react";++const RadioGroup = React.forwardRef<+ React.ElementRef<typeof RadioGroupPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>+>(({ className, ...props }, ref) => {+ return (+ <RadioGroupPrimitive.Root+ className={cn("grid gap-2", className)}+ {...props}+ ref={ref}+ />+ );+});+RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;++const RadioGroupItem = React.forwardRef<+ React.ElementRef<typeof RadioGroupPrimitive.Item>,+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>+>(({ className, ...props }, ref) => {+ return (+ <RadioGroupPrimitive.Item+ ref={ref}+ className={cn(+ "aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",+ className,+ )}+ {...props}+ >+ <RadioGroupPrimitive.Indicator className="flex items-center justify-center">+ <Circle className="h-2.5 w-2.5 fill-current text-current" />+ </RadioGroupPrimitive.Indicator>+ </RadioGroupPrimitive.Item>+ );+});+RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;++export { RadioGroup, RadioGroupItem };diff --git a/apps/web/lib/i18n/locales/en/translation.json b/apps/web/lib/i18n/locales/en/translation.jsonindex af9b2748..03aaa645 100644--- a/apps/web/lib/i18n/locales/en/translation.json+++ b/apps/web/lib/i18n/locales/en/translation.json@@ -236,7 +236,6 @@},"ai": {"ai_settings": "AI Settings",- "ai_preferences_description": "Control which AI features are enabled for your account.","auto_tagging": "Auto-tagging","auto_tagging_description": "Automatically generate tags for your bookmarks using AI.","auto_summarization": "Auto-summarization",@@ -250,7 +249,18 @@"all_tagging": "All Tagging","text_tagging": "Text Tagging","image_tagging": "Image Tagging",- "summarization": "Summarization"+ "summarization": "Summarization",+ "tag_style": "Tag Style",+ "tag_style_description": "Choose how your auto-generated tags should be formatted.",+ "lowercase_hyphens": "Lowercase with hyphens",+ "lowercase_spaces": "Lowercase with spaces",+ "lowercase_underscores": "Lowercase with underscores",+ "titlecase_spaces": "Title case with spaces",+ "titlecase_hyphens": "Title case with hyphens",+ "camelCase": "camelCase",+ "no_preference": "No preference",+ "inference_language": "Inference Language",+ "inference_language_description": "Choose language for AI-generated tags and summaries."},"feeds": {"rss_subscriptions": "RSS Subscriptions",diff --git a/apps/web/lib/userSettings.tsx b/apps/web/lib/userSettings.tsxindex d35c9e56..4789e2ba 100644--- a/apps/web/lib/userSettings.tsx+++ b/apps/web/lib/userSettings.tsx@@ -18,6 +18,8 @@ export const UserSettingsContext = createContext<ZUserSettings>({readerFontFamily: null,autoTaggingEnabled: null,autoSummarizationEnabled: null,+ tagStyle: "as-generated",+ inferredTagLang: null,});export function UserSettingsContextProvider({diff --git a/apps/web/package.json b/apps/web/package.jsonindex 5f8eff0d..0400bc5c 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -40,6 +40,7 @@"@radix-ui/react-label": "^2.1.7","@radix-ui/react-popover": "^1.1.14","@radix-ui/react-progress": "^1.1.7",+ "@radix-ui/react-radio-group": "^1.3.8","@radix-ui/react-scroll-area": "^1.2.9","@radix-ui/react-select": "^2.2.5","@radix-ui/react-separator": "^1.1.7",diff --git a/apps/workers/workers/inference/summarize.ts b/apps/workers/workers/inference/summarize.tsindex 460c3328..560bb5a2 100644--- a/apps/workers/workers/inference/summarize.ts+++ b/apps/workers/workers/inference/summarize.ts@@ -61,6 +61,7 @@ export async function runSummarization(where: eq(users.id, bookmarkData.userId),columns: {autoSummarizationEnabled: true,+ inferredTagLang: true,},});@@ -121,7 +122,7 @@ URL: ${link.url ?? ""}});const summaryPrompt = await buildSummaryPrompt(- serverConfig.inference.inferredTagLang,+ userSettings?.inferredTagLang ?? serverConfig.inference.inferredTagLang,prompts.map((p) => p.text),textToSummarize,serverConfig.inference.contextLength,diff --git a/apps/workers/workers/inference/tagging.ts b/apps/workers/workers/inference/tagging.tsindex 6d20b953..ace426a1 100644--- a/apps/workers/workers/inference/tagging.ts+++ b/apps/workers/workers/inference/tagging.ts@@ -7,6 +7,7 @@ import type {InferenceClient,InferenceResponse,} from "@karakeep/shared/inference";+import type { ZTagStyle } from "@karakeep/shared/types/users";import { db } from "@karakeep/db";import {bookmarks,@@ -79,6 +80,8 @@ function tagNormalizer() {}async function buildPrompt(bookmark: NonNullable<Awaited<ReturnType<typeof fetchBookmark>>>,+ tagStyle: ZTagStyle,+ inferredTagLang: string,): Promise<string | null> {const prompts = await fetchCustomPrompts(bookmark.userId, "text");if (bookmark.link) {@@ -96,22 +99,24 @@ async function buildPrompt(return null;}return await buildTextPrompt(- serverConfig.inference.inferredTagLang,+ inferredTagLang,prompts,`URL: ${bookmark.link.url}Title: ${bookmark.link.title ?? ""}Description: ${bookmark.link.description ?? ""}Content: ${content ?? ""}`,serverConfig.inference.contextLength,+ tagStyle,);}if (bookmark.text) {return await buildTextPrompt(- serverConfig.inference.inferredTagLang,+ inferredTagLang,prompts,bookmark.text.text ?? "",serverConfig.inference.contextLength,+ tagStyle,);}@@ -123,6 +128,8 @@ async function inferTagsFromImage(bookmark: NonNullable<Awaited<ReturnType<typeof fetchBookmark>>>,inferenceClient: InferenceClient,abortSignal: AbortSignal,+ tagStyle: ZTagStyle,+ inferredTagLang: string,): Promise<InferenceResponse | null> {const { asset, metadata } = await readAsset({userId: bookmark.userId,@@ -144,8 +151,9 @@ async function inferTagsFromImage(const base64 = asset.toString("base64");return inferenceClient.inferFromImage(buildImagePrompt(- serverConfig.inference.inferredTagLang,+ inferredTagLang,await fetchCustomPrompts(bookmark.userId, "images"),+ tagStyle,),metadata.contentType,base64,@@ -215,12 +223,15 @@ async function inferTagsFromPDF(bookmark: NonNullable<Awaited<ReturnType<typeof fetchBookmark>>>,inferenceClient: InferenceClient,abortSignal: AbortSignal,+ tagStyle: ZTagStyle,+ inferredTagLang: string,) {const prompt = await buildTextPrompt(- serverConfig.inference.inferredTagLang,+ inferredTagLang,await fetchCustomPrompts(bookmark.userId, "text"),`Content: ${bookmark.asset.content}`,serverConfig.inference.contextLength,+ tagStyle,);return inferenceClient.inferFromText(prompt, {schema: openAIResponseSchema,@@ -232,8 +243,10 @@ async function inferTagsFromText(bookmark: NonNullable<Awaited<ReturnType<typeof fetchBookmark>>>,inferenceClient: InferenceClient,abortSignal: AbortSignal,+ tagStyle: ZTagStyle,+ inferredTagLang: string,) {- const prompt = await buildPrompt(bookmark);+ const prompt = await buildPrompt(bookmark, tagStyle, inferredTagLang);if (!prompt) {return null;}@@ -248,10 +261,18 @@ async function inferTags(bookmark: NonNullable<Awaited<ReturnType<typeof fetchBookmark>>>,inferenceClient: InferenceClient,abortSignal: AbortSignal,+ tagStyle: ZTagStyle,+ inferredTagLang: string,) {let response: InferenceResponse | null;if (bookmark.link || bookmark.text) {- response = await inferTagsFromText(bookmark, inferenceClient, abortSignal);+ response = await inferTagsFromText(+ bookmark,+ inferenceClient,+ abortSignal,+ tagStyle,+ inferredTagLang,+ );} else if (bookmark.asset) {switch (bookmark.asset.assetType) {case "image":@@ -260,6 +281,8 @@ async function inferTags(bookmark,inferenceClient,abortSignal,+ tagStyle,+ inferredTagLang,);break;case "pdf":@@ -268,6 +291,8 @@ async function inferTags(bookmark,inferenceClient,abortSignal,+ tagStyle,+ inferredTagLang,);break;default:@@ -443,6 +468,8 @@ export async function runTagging(where: eq(users.id, bookmark.userId),columns: {autoTaggingEnabled: true,+ tagStyle: true,+ inferredTagLang: true,},});@@ -462,6 +489,8 @@ export async function runTagging(bookmark,inferenceClient,job.abortSignal,+ userSettings?.tagStyle ?? "as-generated",+ userSettings?.inferredTagLang ?? serverConfig.inference.inferredTagLang,);if (tags === null) {diff --git a/packages/db/drizzle/0073_ai_tag_style.sql b/packages/db/drizzle/0073_ai_tag_style.sqlnew file mode 100644index 00000000..6348d2a1--- /dev/null+++ b/packages/db/drizzle/0073_ai_tag_style.sql@@ -0,0 +1,3 @@+ALTER TABLE `user` ADD `tagStyle` text DEFAULT 'lowercase-hyphens';--> statement-breakpoint+ALTER TABLE `user` ADD `inferredTagLang` text;--> statement-breakpoint+UPDATE `user` SET `tagStyle` = 'as-generated';diff --git a/packages/db/drizzle/meta/0073_snapshot.json b/packages/db/drizzle/meta/0073_snapshot.jsonnew file mode 100644index 00000000..29660a78--- /dev/null+++ b/packages/db/drizzle/meta/0073_snapshot.json@@ -0,0 +1,3016 @@+{+ "version": "6",+ "dialect": "sqlite",+ "id": "52bf703a-60db-4de2-8f8e-9d4d941517cc",+ "prevId": "83311234-d840-43f7-9e09-a19a401c3ee8",+ "tables": {+ "account": {+ "name": "account",+ "columns": {+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "providerAccountId": {+ "name": "providerAccountId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "token_type": {+ "name": "token_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "session_state": {+ "name": "session_state",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "account_userId_user_id_fk": {+ "name": "account_userId_user_id_fk",+ "tableFrom": "account",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "account_provider_providerAccountId_pk": {+ "columns": [+ "provider",+ "providerAccountId"+ ],+ "name": "account_provider_providerAccountId_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "apiKey": {+ "name": "apiKey",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "keyId": {+ "name": "keyId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "keyHash": {+ "name": "keyHash",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "apiKey_keyId_unique": {+ "name": "apiKey_keyId_unique",+ "columns": [+ "keyId"+ ],+ "isUnique": true+ },+ "apiKey_name_userId_unique": {+ "name": "apiKey_name_userId_unique",+ "columns": [+ "name",+ "userId"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "apiKey_userId_user_id_fk": {+ "name": "apiKey_userId_user_id_fk",+ "tableFrom": "apiKey",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "assets": {+ "name": "assets",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "assetType": {+ "name": "assetType",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "size": {+ "name": "size",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "contentType": {+ "name": "contentType",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "fileName": {+ "name": "fileName",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "bookmarkId": {+ "name": "bookmarkId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "assets_bookmarkId_idx": {+ "name": "assets_bookmarkId_idx",+ "columns": [+ "bookmarkId"+ ],+ "isUnique": false+ },+ "assets_assetType_idx": {+ "name": "assets_assetType_idx",+ "columns": [+ "assetType"+ ],+ "isUnique": false+ },+ "assets_userId_idx": {+ "name": "assets_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "assets_bookmarkId_bookmarks_id_fk": {+ "name": "assets_bookmarkId_bookmarks_id_fk",+ "tableFrom": "assets",+ "tableTo": "bookmarks",+ "columnsFrom": [+ "bookmarkId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "assets_userId_user_id_fk": {+ "name": "assets_userId_user_id_fk",+ "tableFrom": "assets",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "backups": {+ "name": "backups",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "assetId": {+ "name": "assetId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "size": {+ "name": "size",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "bookmarkCount": {+ "name": "bookmarkCount",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'pending'"+ },+ "errorMessage": {+ "name": "errorMessage",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "backups_userId_idx": {+ "name": "backups_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "backups_createdAt_idx": {+ "name": "backups_createdAt_idx",+ "columns": [+ "createdAt"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "backups_userId_user_id_fk": {+ "name": "backups_userId_user_id_fk",+ "tableFrom": "backups",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "backups_assetId_assets_id_fk": {+ "name": "backups_assetId_assets_id_fk",+ "tableFrom": "backups",+ "tableTo": "assets",+ "columnsFrom": [+ "assetId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "bookmarkAssets": {+ "name": "bookmarkAssets",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "assetType": {+ "name": "assetType",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "assetId": {+ "name": "assetId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "metadata": {+ "name": "metadata",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "fileName": {+ "name": "fileName",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "sourceUrl": {+ "name": "sourceUrl",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "bookmarkAssets_id_bookmarks_id_fk": {+ "name": "bookmarkAssets_id_bookmarks_id_fk",+ "tableFrom": "bookmarkAssets",+ "tableTo": "bookmarks",+ "columnsFrom": [+ "id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "bookmarkLinks": {+ "name": "bookmarkLinks",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "author": {+ "name": "author",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "publisher": {+ "name": "publisher",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "datePublished": {+ "name": "datePublished",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "dateModified": {+ "name": "dateModified",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "imageUrl": {+ "name": "imageUrl",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "favicon": {+ "name": "favicon",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "htmlContent": {+ "name": "htmlContent",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "contentAssetId": {+ "name": "contentAssetId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "crawledAt": {+ "name": "crawledAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "crawlStatus": {+ "name": "crawlStatus",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'pending'"+ },+ "crawlStatusCode": {+ "name": "crawlStatusCode",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": 200+ }+ },+ "indexes": {+ "bookmarkLinks_url_idx": {+ "name": "bookmarkLinks_url_idx",+ "columns": [+ "url"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "bookmarkLinks_id_bookmarks_id_fk": {+ "name": "bookmarkLinks_id_bookmarks_id_fk",+ "tableFrom": "bookmarkLinks",+ "tableTo": "bookmarks",+ "columnsFrom": [+ "id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "bookmarkLists": {+ "name": "bookmarkLists",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "query": {+ "name": "query",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "parentId": {+ "name": "parentId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "rssToken": {+ "name": "rssToken",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "public": {+ "name": "public",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ }+ },+ "indexes": {+ "bookmarkLists_userId_idx": {+ "name": "bookmarkLists_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "bookmarkLists_userId_id_idx": {+ "name": "bookmarkLists_userId_id_idx",+ "columns": [+ "userId",+ "id"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "bookmarkLists_userId_user_id_fk": {+ "name": "bookmarkLists_userId_user_id_fk",+ "tableFrom": "bookmarkLists",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "bookmarkLists_parentId_bookmarkLists_id_fk": {+ "name": "bookmarkLists_parentId_bookmarkLists_id_fk",+ "tableFrom": "bookmarkLists",+ "tableTo": "bookmarkLists",+ "columnsFrom": [+ "parentId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "bookmarkTags": {+ "name": "bookmarkTags",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "normalizedName": {+ "name": "normalizedName",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "generated": {+ "as": "(lower(replace(replace(replace(\"name\", ' ', ''), '-', ''), '_', '')))",+ "type": "virtual"+ }+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "bookmarkTags_name_idx": {+ "name": "bookmarkTags_name_idx",+ "columns": [+ "name"+ ],+ "isUnique": false+ },+ "bookmarkTags_userId_idx": {+ "name": "bookmarkTags_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "bookmarkTags_normalizedName_idx": {+ "name": "bookmarkTags_normalizedName_idx",+ "columns": [+ "normalizedName"+ ],+ "isUnique": false+ },+ "bookmarkTags_userId_name_unique": {+ "name": "bookmarkTags_userId_name_unique",+ "columns": [+ "userId",+ "name"+ ],+ "isUnique": true+ },+ "bookmarkTags_userId_id_idx": {+ "name": "bookmarkTags_userId_id_idx",+ "columns": [+ "userId",+ "id"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "bookmarkTags_userId_user_id_fk": {+ "name": "bookmarkTags_userId_user_id_fk",+ "tableFrom": "bookmarkTags",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "bookmarkTexts": {+ "name": "bookmarkTexts",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "text": {+ "name": "text",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "sourceUrl": {+ "name": "sourceUrl",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "bookmarkTexts_id_bookmarks_id_fk": {+ "name": "bookmarkTexts_id_bookmarks_id_fk",+ "tableFrom": "bookmarkTexts",+ "tableTo": "bookmarks",+ "columnsFrom": [+ "id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "bookmarks": {+ "name": "bookmarks",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "modifiedAt": {+ "name": "modifiedAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "archived": {+ "name": "archived",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "favourited": {+ "name": "favourited",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "taggingStatus": {+ "name": "taggingStatus",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'pending'"+ },+ "summarizationStatus": {+ "name": "summarizationStatus",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'pending'"+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "note": {+ "name": "note",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "bookmarks_userId_idx": {+ "name": "bookmarks_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "bookmarks_createdAt_idx": {+ "name": "bookmarks_createdAt_idx",+ "columns": [+ "createdAt"+ ],+ "isUnique": false+ },+ "bookmarks_userId_createdAt_id_idx": {+ "name": "bookmarks_userId_createdAt_id_idx",+ "columns": [+ "userId",+ "createdAt",+ "id"+ ],+ "isUnique": false+ },+ "bookmarks_userId_archived_createdAt_id_idx": {+ "name": "bookmarks_userId_archived_createdAt_id_idx",+ "columns": [+ "userId",+ "archived",+ "createdAt",+ "id"+ ],+ "isUnique": false+ },+ "bookmarks_userId_favourited_createdAt_id_idx": {+ "name": "bookmarks_userId_favourited_createdAt_id_idx",+ "columns": [+ "userId",+ "favourited",+ "createdAt",+ "id"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "bookmarks_userId_user_id_fk": {+ "name": "bookmarks_userId_user_id_fk",+ "tableFrom": "bookmarks",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "bookmarksInLists": {+ "name": "bookmarksInLists",+ "columns": {+ "bookmarkId": {+ "name": "bookmarkId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "listId": {+ "name": "listId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "addedAt": {+ "name": "addedAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "listMembershipId": {+ "name": "listMembershipId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "bookmarksInLists_bookmarkId_idx": {+ "name": "bookmarksInLists_bookmarkId_idx",+ "columns": [+ "bookmarkId"+ ],+ "isUnique": false+ },+ "bookmarksInLists_listId_idx": {+ "name": "bookmarksInLists_listId_idx",+ "columns": [+ "listId"+ ],+ "isUnique": false+ },+ "bookmarksInLists_listId_bookmarkId_idx": {+ "name": "bookmarksInLists_listId_bookmarkId_idx",+ "columns": [+ "listId",+ "bookmarkId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "bookmarksInLists_bookmarkId_bookmarks_id_fk": {+ "name": "bookmarksInLists_bookmarkId_bookmarks_id_fk",+ "tableFrom": "bookmarksInLists",+ "tableTo": "bookmarks",+ "columnsFrom": [+ "bookmarkId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "bookmarksInLists_listId_bookmarkLists_id_fk": {+ "name": "bookmarksInLists_listId_bookmarkLists_id_fk",+ "tableFrom": "bookmarksInLists",+ "tableTo": "bookmarkLists",+ "columnsFrom": [+ "listId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "bookmarksInLists_listMembershipId_listCollaborators_id_fk": {+ "name": "bookmarksInLists_listMembershipId_listCollaborators_id_fk",+ "tableFrom": "bookmarksInLists",+ "tableTo": "listCollaborators",+ "columnsFrom": [+ "listMembershipId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "bookmarksInLists_bookmarkId_listId_pk": {+ "columns": [+ "bookmarkId",+ "listId"+ ],+ "name": "bookmarksInLists_bookmarkId_listId_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "config": {+ "name": "config",+ "columns": {+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "customPrompts": {+ "name": "customPrompts",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "text": {+ "name": "text",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "enabled": {+ "name": "enabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "appliesTo": {+ "name": "appliesTo",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "customPrompts_userId_idx": {+ "name": "customPrompts_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "customPrompts_userId_user_id_fk": {+ "name": "customPrompts_userId_user_id_fk",+ "tableFrom": "customPrompts",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "highlights": {+ "name": "highlights",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "bookmarkId": {+ "name": "bookmarkId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "startOffset": {+ "name": "startOffset",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "endOffset": {+ "name": "endOffset",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'yellow'"+ },+ "text": {+ "name": "text",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "note": {+ "name": "note",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "highlights_bookmarkId_idx": {+ "name": "highlights_bookmarkId_idx",+ "columns": [+ "bookmarkId"+ ],+ "isUnique": false+ },+ "highlights_userId_idx": {+ "name": "highlights_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "highlights_bookmarkId_bookmarks_id_fk": {+ "name": "highlights_bookmarkId_bookmarks_id_fk",+ "tableFrom": "highlights",+ "tableTo": "bookmarks",+ "columnsFrom": [+ "bookmarkId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "highlights_userId_user_id_fk": {+ "name": "highlights_userId_user_id_fk",+ "tableFrom": "highlights",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "importSessionBookmarks": {+ "name": "importSessionBookmarks",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "importSessionId": {+ "name": "importSessionId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "bookmarkId": {+ "name": "bookmarkId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "importSessionBookmarks_sessionId_idx": {+ "name": "importSessionBookmarks_sessionId_idx",+ "columns": [+ "importSessionId"+ ],+ "isUnique": false+ },+ "importSessionBookmarks_bookmarkId_idx": {+ "name": "importSessionBookmarks_bookmarkId_idx",+ "columns": [+ "bookmarkId"+ ],+ "isUnique": false+ },+ "importSessionBookmarks_importSessionId_bookmarkId_unique": {+ "name": "importSessionBookmarks_importSessionId_bookmarkId_unique",+ "columns": [+ "importSessionId",+ "bookmarkId"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "importSessionBookmarks_importSessionId_importSessions_id_fk": {+ "name": "importSessionBookmarks_importSessionId_importSessions_id_fk",+ "tableFrom": "importSessionBookmarks",+ "tableTo": "importSessions",+ "columnsFrom": [+ "importSessionId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "importSessionBookmarks_bookmarkId_bookmarks_id_fk": {+ "name": "importSessionBookmarks_bookmarkId_bookmarks_id_fk",+ "tableFrom": "importSessionBookmarks",+ "tableTo": "bookmarks",+ "columnsFrom": [+ "bookmarkId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "importSessions": {+ "name": "importSessions",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "message": {+ "name": "message",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "rootListId": {+ "name": "rootListId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "modifiedAt": {+ "name": "modifiedAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "importSessions_userId_idx": {+ "name": "importSessions_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "importSessions_userId_user_id_fk": {+ "name": "importSessions_userId_user_id_fk",+ "tableFrom": "importSessions",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "importSessions_rootListId_bookmarkLists_id_fk": {+ "name": "importSessions_rootListId_bookmarkLists_id_fk",+ "tableFrom": "importSessions",+ "tableTo": "bookmarkLists",+ "columnsFrom": [+ "rootListId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "invites": {+ "name": "invites",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "usedAt": {+ "name": "usedAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "invitedBy": {+ "name": "invitedBy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "invites_token_unique": {+ "name": "invites_token_unique",+ "columns": [+ "token"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "invites_invitedBy_user_id_fk": {+ "name": "invites_invitedBy_user_id_fk",+ "tableFrom": "invites",+ "tableTo": "user",+ "columnsFrom": [+ "invitedBy"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "listCollaborators": {+ "name": "listCollaborators",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "listId": {+ "name": "listId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "addedBy": {+ "name": "addedBy",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "listCollaborators_listId_idx": {+ "name": "listCollaborators_listId_idx",+ "columns": [+ "listId"+ ],+ "isUnique": false+ },+ "listCollaborators_userId_idx": {+ "name": "listCollaborators_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "listCollaborators_listId_userId_unique": {+ "name": "listCollaborators_listId_userId_unique",+ "columns": [+ "listId",+ "userId"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "listCollaborators_listId_bookmarkLists_id_fk": {+ "name": "listCollaborators_listId_bookmarkLists_id_fk",+ "tableFrom": "listCollaborators",+ "tableTo": "bookmarkLists",+ "columnsFrom": [+ "listId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "listCollaborators_userId_user_id_fk": {+ "name": "listCollaborators_userId_user_id_fk",+ "tableFrom": "listCollaborators",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "listCollaborators_addedBy_user_id_fk": {+ "name": "listCollaborators_addedBy_user_id_fk",+ "tableFrom": "listCollaborators",+ "tableTo": "user",+ "columnsFrom": [+ "addedBy"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "listInvitations": {+ "name": "listInvitations",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "listId": {+ "name": "listId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'pending'"+ },+ "invitedAt": {+ "name": "invitedAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "invitedEmail": {+ "name": "invitedEmail",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "invitedBy": {+ "name": "invitedBy",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "listInvitations_listId_idx": {+ "name": "listInvitations_listId_idx",+ "columns": [+ "listId"+ ],+ "isUnique": false+ },+ "listInvitations_userId_idx": {+ "name": "listInvitations_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "listInvitations_status_idx": {+ "name": "listInvitations_status_idx",+ "columns": [+ "status"+ ],+ "isUnique": false+ },+ "listInvitations_listId_userId_unique": {+ "name": "listInvitations_listId_userId_unique",+ "columns": [+ "listId",+ "userId"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "listInvitations_listId_bookmarkLists_id_fk": {+ "name": "listInvitations_listId_bookmarkLists_id_fk",+ "tableFrom": "listInvitations",+ "tableTo": "bookmarkLists",+ "columnsFrom": [+ "listId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "listInvitations_userId_user_id_fk": {+ "name": "listInvitations_userId_user_id_fk",+ "tableFrom": "listInvitations",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "listInvitations_invitedBy_user_id_fk": {+ "name": "listInvitations_invitedBy_user_id_fk",+ "tableFrom": "listInvitations",+ "tableTo": "user",+ "columnsFrom": [+ "invitedBy"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "passwordResetToken": {+ "name": "passwordResetToken",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "passwordResetToken_token_unique": {+ "name": "passwordResetToken_token_unique",+ "columns": [+ "token"+ ],+ "isUnique": true+ },+ "passwordResetTokens_userId_idx": {+ "name": "passwordResetTokens_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "passwordResetToken_userId_user_id_fk": {+ "name": "passwordResetToken_userId_user_id_fk",+ "tableFrom": "passwordResetToken",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "rssFeedImports": {+ "name": "rssFeedImports",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "entryId": {+ "name": "entryId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "rssFeedId": {+ "name": "rssFeedId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "bookmarkId": {+ "name": "bookmarkId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "rssFeedImports_feedIdIdx_idx": {+ "name": "rssFeedImports_feedIdIdx_idx",+ "columns": [+ "rssFeedId"+ ],+ "isUnique": false+ },+ "rssFeedImports_entryIdIdx_idx": {+ "name": "rssFeedImports_entryIdIdx_idx",+ "columns": [+ "entryId"+ ],+ "isUnique": false+ },+ "rssFeedImports_rssFeedId_bookmarkId_idx": {+ "name": "rssFeedImports_rssFeedId_bookmarkId_idx",+ "columns": [+ "rssFeedId",+ "bookmarkId"+ ],+ "isUnique": false+ },+ "rssFeedImports_rssFeedId_entryId_unique": {+ "name": "rssFeedImports_rssFeedId_entryId_unique",+ "columns": [+ "rssFeedId",+ "entryId"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "rssFeedImports_rssFeedId_rssFeeds_id_fk": {+ "name": "rssFeedImports_rssFeedId_rssFeeds_id_fk",+ "tableFrom": "rssFeedImports",+ "tableTo": "rssFeeds",+ "columnsFrom": [+ "rssFeedId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rssFeedImports_bookmarkId_bookmarks_id_fk": {+ "name": "rssFeedImports_bookmarkId_bookmarks_id_fk",+ "tableFrom": "rssFeedImports",+ "tableTo": "bookmarks",+ "columnsFrom": [+ "bookmarkId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "rssFeeds": {+ "name": "rssFeeds",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "enabled": {+ "name": "enabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ },+ "importTags": {+ "name": "importTags",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "lastFetchedAt": {+ "name": "lastFetchedAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "lastFetchedStatus": {+ "name": "lastFetchedStatus",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'pending'"+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "rssFeeds_userId_idx": {+ "name": "rssFeeds_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "rssFeeds_userId_user_id_fk": {+ "name": "rssFeeds_userId_user_id_fk",+ "tableFrom": "rssFeeds",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "ruleEngineActions": {+ "name": "ruleEngineActions",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ruleId": {+ "name": "ruleId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "listId": {+ "name": "listId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "tagId": {+ "name": "tagId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "ruleEngineActions_userId_idx": {+ "name": "ruleEngineActions_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "ruleEngineActions_ruleId_idx": {+ "name": "ruleEngineActions_ruleId_idx",+ "columns": [+ "ruleId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "ruleEngineActions_userId_user_id_fk": {+ "name": "ruleEngineActions_userId_user_id_fk",+ "tableFrom": "ruleEngineActions",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ruleEngineActions_ruleId_ruleEngineRules_id_fk": {+ "name": "ruleEngineActions_ruleId_ruleEngineRules_id_fk",+ "tableFrom": "ruleEngineActions",+ "tableTo": "ruleEngineRules",+ "columnsFrom": [+ "ruleId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ruleEngineActions_userId_tagId_fk": {+ "name": "ruleEngineActions_userId_tagId_fk",+ "tableFrom": "ruleEngineActions",+ "tableTo": "bookmarkTags",+ "columnsFrom": [+ "userId",+ "tagId"+ ],+ "columnsTo": [+ "userId",+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ruleEngineActions_userId_listId_fk": {+ "name": "ruleEngineActions_userId_listId_fk",+ "tableFrom": "ruleEngineActions",+ "tableTo": "bookmarkLists",+ "columnsFrom": [+ "userId",+ "listId"+ ],+ "columnsTo": [+ "userId",+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "ruleEngineRules": {+ "name": "ruleEngineRules",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "enabled": {+ "name": "enabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "event": {+ "name": "event",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "condition": {+ "name": "condition",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "listId": {+ "name": "listId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "tagId": {+ "name": "tagId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "ruleEngine_userId_idx": {+ "name": "ruleEngine_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "ruleEngineRules_userId_user_id_fk": {+ "name": "ruleEngineRules_userId_user_id_fk",+ "tableFrom": "ruleEngineRules",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ruleEngineRules_userId_tagId_fk": {+ "name": "ruleEngineRules_userId_tagId_fk",+ "tableFrom": "ruleEngineRules",+ "tableTo": "bookmarkTags",+ "columnsFrom": [+ "userId",+ "tagId"+ ],+ "columnsTo": [+ "userId",+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ruleEngineRules_userId_listId_fk": {+ "name": "ruleEngineRules_userId_listId_fk",+ "tableFrom": "ruleEngineRules",+ "tableTo": "bookmarkLists",+ "columnsFrom": [+ "userId",+ "listId"+ ],+ "columnsTo": [+ "userId",+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "session": {+ "name": "session",+ "columns": {+ "sessionToken": {+ "name": "sessionToken",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "session_userId_user_id_fk": {+ "name": "session_userId_user_id_fk",+ "tableFrom": "session",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "subscriptions": {+ "name": "subscriptions",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "stripeCustomerId": {+ "name": "stripeCustomerId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "stripeSubscriptionId": {+ "name": "stripeSubscriptionId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "tier": {+ "name": "tier",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'free'"+ },+ "priceId": {+ "name": "priceId",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "cancelAtPeriodEnd": {+ "name": "cancelAtPeriodEnd",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "startDate": {+ "name": "startDate",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "endDate": {+ "name": "endDate",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "modifiedAt": {+ "name": "modifiedAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "subscriptions_userId_unique": {+ "name": "subscriptions_userId_unique",+ "columns": [+ "userId"+ ],+ "isUnique": true+ },+ "subscriptions_userId_idx": {+ "name": "subscriptions_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "subscriptions_stripeCustomerId_idx": {+ "name": "subscriptions_stripeCustomerId_idx",+ "columns": [+ "stripeCustomerId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "subscriptions_userId_user_id_fk": {+ "name": "subscriptions_userId_user_id_fk",+ "tableFrom": "subscriptions",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "tagsOnBookmarks": {+ "name": "tagsOnBookmarks",+ "columns": {+ "bookmarkId": {+ "name": "bookmarkId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "tagId": {+ "name": "tagId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "attachedAt": {+ "name": "attachedAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "attachedBy": {+ "name": "attachedBy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "tagsOnBookmarks_tagId_idx": {+ "name": "tagsOnBookmarks_tagId_idx",+ "columns": [+ "tagId"+ ],+ "isUnique": false+ },+ "tagsOnBookmarks_bookmarkId_idx": {+ "name": "tagsOnBookmarks_bookmarkId_idx",+ "columns": [+ "bookmarkId"+ ],+ "isUnique": false+ },+ "tagsOnBookmarks_tagId_bookmarkId_idx": {+ "name": "tagsOnBookmarks_tagId_bookmarkId_idx",+ "columns": [+ "tagId",+ "bookmarkId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "tagsOnBookmarks_bookmarkId_bookmarks_id_fk": {+ "name": "tagsOnBookmarks_bookmarkId_bookmarks_id_fk",+ "tableFrom": "tagsOnBookmarks",+ "tableTo": "bookmarks",+ "columnsFrom": [+ "bookmarkId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "tagsOnBookmarks_tagId_bookmarkTags_id_fk": {+ "name": "tagsOnBookmarks_tagId_bookmarkTags_id_fk",+ "tableFrom": "tagsOnBookmarks",+ "tableTo": "bookmarkTags",+ "columnsFrom": [+ "tagId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "tagsOnBookmarks_bookmarkId_tagId_pk": {+ "columns": [+ "bookmarkId",+ "tagId"+ ],+ "name": "tagsOnBookmarks_bookmarkId_tagId_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "user": {+ "name": "user",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "emailVerified": {+ "name": "emailVerified",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "image": {+ "name": "image",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "salt": {+ "name": "salt",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'user'"+ },+ "bookmarkQuota": {+ "name": "bookmarkQuota",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "storageQuota": {+ "name": "storageQuota",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "browserCrawlingEnabled": {+ "name": "browserCrawlingEnabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "bookmarkClickAction": {+ "name": "bookmarkClickAction",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'open_original_link'"+ },+ "archiveDisplayBehaviour": {+ "name": "archiveDisplayBehaviour",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'show'"+ },+ "timezone": {+ "name": "timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'UTC'"+ },+ "backupsEnabled": {+ "name": "backupsEnabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "backupsFrequency": {+ "name": "backupsFrequency",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'weekly'"+ },+ "backupsRetentionDays": {+ "name": "backupsRetentionDays",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 30+ },+ "readerFontSize": {+ "name": "readerFontSize",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "readerLineHeight": {+ "name": "readerLineHeight",+ "type": "real",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "readerFontFamily": {+ "name": "readerFontFamily",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "autoTaggingEnabled": {+ "name": "autoTaggingEnabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "autoSummarizationEnabled": {+ "name": "autoSummarizationEnabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "tagStyle": {+ "name": "tagStyle",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'lowercase-hyphens'"+ },+ "inferredTagLang": {+ "name": "inferredTagLang",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "user_email_unique": {+ "name": "user_email_unique",+ "columns": [+ "email"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "verificationToken": {+ "name": "verificationToken",+ "columns": {+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "verificationToken_identifier_token_pk": {+ "columns": [+ "identifier",+ "token"+ ],+ "name": "verificationToken_identifier_token_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "webhooks": {+ "name": "webhooks",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "events": {+ "name": "events",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "webhooks_userId_idx": {+ "name": "webhooks_userId_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "webhooks_userId_user_id_fk": {+ "name": "webhooks_userId_user_id_fk",+ "tableFrom": "webhooks",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ }+ },+ "views": {},+ "enums": {},+ "_meta": {+ "schemas": {},+ "tables": {},+ "columns": {}+ },+ "internal": {+ "indexes": {}+ }+}\ No newline at end of filediff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.jsonindex 971d1cf8..7752ec4d 100644--- a/packages/db/drizzle/meta/_journal.json+++ b/packages/db/drizzle/meta/_journal.json@@ -512,6 +512,13 @@"when": 1766414953855,"tag": "0072_add_user_ai_preferences","breakpoints": true+ },+ {+ "idx": 73,+ "version": "6",+ "when": 1766843938658,+ "tag": "0073_ai_tag_style",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/db/schema.ts b/packages/db/schema.tsindex ae7c3103..8b0385c3 100644--- a/packages/db/schema.ts+++ b/packages/db/schema.ts@@ -83,6 +83,18 @@ export const users = sqliteTable("user", {autoSummarizationEnabled: integer("autoSummarizationEnabled", {mode: "boolean",}),+ tagStyle: text("tagStyle", {+ enum: [+ "lowercase-hyphens",+ "lowercase-spaces",+ "lowercase-underscores",+ "titlecase-spaces",+ "titlecase-hyphens",+ "camelCase",+ "as-generated",+ ],+ }).default("lowercase-hyphens"),+ inferredTagLang: text("inferredTagLang"),});export const accounts = sqliteTable(diff --git a/packages/shared/prompts.ts b/packages/shared/prompts.tsindex 5a6a705e..af2f07f1 100644--- a/packages/shared/prompts.ts+++ b/packages/shared/prompts.ts@@ -1,5 +1,8 @@import type { Tiktoken } from "js-tiktoken";+import type { ZTagStyle } from "./types/users";+import { getTagStylePrompt } from "./utils/tag";+let encoding: Tiktoken | null = null;/**@@ -40,15 +43,22 @@ async function truncateContent(return enc.decode(truncatedTokens);}-export function buildImagePrompt(lang: string, customPrompts: string[]) {+export function buildImagePrompt(+ lang: string,+ customPrompts: string[],+ tagStyle: ZTagStyle,+) {+ const tagStyleInstruction = getTagStylePrompt(tagStyle);+return `-You are an expert whose responsibility is to help with automatic text tagging for a read-it-later app.+You are an expert whose responsibility is to help with automatic text tagging for a read-it-later/bookmarking app.Please analyze the attached image and suggest relevant tags that describe its key themes, topics, and main ideas. The rules are:- Aim for a variety of tags, including broad categories, specific keywords, and potential sub-genres.- The tags must be in ${lang}.- If the tag is not generic enough, don't include it.- Aim for 10-15 tags.- If there are no good tags, don't emit any.+${tagStyleInstruction}${customPrompts && customPrompts.map((p) => `- ${p}`).join("\n")}You must respond in valid JSON with the key "tags" and the value is list of tags. Don't wrap the response in a markdown code.`;}@@ -60,9 +70,12 @@ function constructTextTaggingPrompt(lang: string,customPrompts: string[],content: string,+ tagStyle: ZTagStyle,): string {+ const tagStyleInstruction = getTagStylePrompt(tagStyle);+return `-You are an expert whose responsibility is to help with automatic tagging for a read-it-later app.+You are an expert whose responsibility is to help with automatic tagging for a read-it-later/bookmarking app.Please analyze the TEXT_CONTENT below and suggest relevant tags that describe its key themes, topics, and main ideas. The rules are:- Aim for a variety of tags, including broad categories, specific keywords, and potential sub-genres.- The tags must be in ${lang}.@@ -70,6 +83,7 @@ Please analyze the TEXT_CONTENT below and suggest relevant tags that describe it- The content can include text for cookie consent and privacy policy, ignore those while tagging.- Aim for 3-5 tags.- If there are no good tags, leave the array empty.+${tagStyleInstruction}${customPrompts && customPrompts.map((p) => `- ${p}`).join("\n")}<TEXT_CONTENT>@@ -101,11 +115,13 @@ export function buildTextPromptUntruncated(lang: string,customPrompts: string[],content: string,+ tagStyle: ZTagStyle,): string {return constructTextTaggingPrompt(lang,customPrompts,preprocessContent(content),+ tagStyle,);}@@ -114,15 +130,26 @@ export async function buildTextPrompt(customPrompts: string[],content: string,contextLength: number,+ tagStyle: ZTagStyle,): Promise<string> {content = preprocessContent(content);- const promptTemplate = constructTextTaggingPrompt(lang, customPrompts, "");+ const promptTemplate = constructTextTaggingPrompt(+ lang,+ customPrompts,+ "",+ tagStyle,+ );const promptSize = await calculateNumTokens(promptTemplate);const truncatedContent = await truncateContent(content,contextLength - promptSize,);- return constructTextTaggingPrompt(lang, customPrompts, truncatedContent);+ return constructTextTaggingPrompt(+ lang,+ customPrompts,+ truncatedContent,+ tagStyle,+ );}export async function buildSummaryPrompt(diff --git a/packages/shared/types/users.ts b/packages/shared/types/users.tsindex 7338ee15..3ba56583 100644--- a/packages/shared/types/users.ts+++ b/packages/shared/types/users.ts@@ -5,6 +5,17 @@ import { zBookmarkSourceSchema } from "./bookmarks";export const PASSWORD_MIN_LENGTH = 8;export const PASSWORD_MAX_LENGTH = 100;+export const zTagStyleSchema = z.enum([+ "lowercase-hyphens",+ "lowercase-spaces",+ "lowercase-underscores",+ "titlecase-spaces",+ "titlecase-hyphens",+ "camelCase",+ "as-generated",+]);+export type ZTagStyle = z.infer<typeof zTagStyleSchema>;+export const zSignUpSchema = z.object({name: z.string().min(1, { message: "Name can't be empty" }),@@ -123,6 +134,8 @@ export const zUserSettingsSchema = z.object({// AI settings (nullable = opt-in, null means use server default)autoTaggingEnabled: z.boolean().nullable(),autoSummarizationEnabled: z.boolean().nullable(),+ tagStyle: zTagStyleSchema,+ inferredTagLang: z.string().nullable(),});export type ZUserSettings = z.infer<typeof zUserSettingsSchema>;@@ -139,6 +152,8 @@ export const zUpdateUserSettingsSchema = zUserSettingsSchema.partial().pick({readerFontFamily: true,autoTaggingEnabled: true,autoSummarizationEnabled: true,+ tagStyle: true,+ inferredTagLang: true,});export const zUpdateBackupSettingsSchema = zUpdateUserSettingsSchema.pick({diff --git a/packages/shared/utils/tag.ts b/packages/shared/utils/tag.tsindex 8e1bd105..4dc7c696 100644--- a/packages/shared/utils/tag.ts+++ b/packages/shared/utils/tag.ts@@ -1,6 +1,30 @@+import type { ZTagStyle } from "../types/users";+/*** Ensures exactly ONE leading #*/export function normalizeTagName(raw: string): string {return raw.trim().replace(/^#+/, ""); // strip every leading #}++export type TagStyle = ZTagStyle;++export function getTagStylePrompt(style: TagStyle): string {+ switch (style) {+ case "lowercase-hyphens":+ return "- Use lowercase letters with hyphens between words (e.g., 'machine-learning', 'web-development')";+ case "lowercase-spaces":+ return "- Use lowercase letters with spaces between words (e.g., 'machine learning', 'web development')";+ case "lowercase-underscores":+ return "- Use lowercase letters with underscores between words (e.g., 'machine_learning', 'web_development')";+ case "titlecase-spaces":+ return "- Use title case with spaces between words (e.g., 'Machine Learning', 'Web Development')";+ case "titlecase-hyphens":+ return "- Use title case with hyphens between words (e.g., 'Machine-Learning', 'Web-Development')";+ case "camelCase":+ return "- Use camelCase format (e.g., 'machineLearning', 'webDevelopment')";+ case "as-generated":+ default:+ return "";+ }+}diff --git a/packages/trpc/models/users.ts b/packages/trpc/models/users.tsindex 0653349b..d8a84ffa 100644--- a/packages/trpc/models/users.ts+++ b/packages/trpc/models/users.ts@@ -439,6 +439,8 @@ export class User {readerFontFamily: true,autoTaggingEnabled: true,autoSummarizationEnabled: true,+ tagStyle: true,+ inferredTagLang: true,},});@@ -461,6 +463,8 @@ export class User {readerFontFamily: settings.readerFontFamily,autoTaggingEnabled: settings.autoTaggingEnabled,autoSummarizationEnabled: settings.autoSummarizationEnabled,+ tagStyle: settings.tagStyle ?? "as-generated",+ inferredTagLang: settings.inferredTagLang,};}@@ -488,6 +492,8 @@ export class User {readerFontFamily: input.readerFontFamily,autoTaggingEnabled: input.autoTaggingEnabled,autoSummarizationEnabled: input.autoSummarizationEnabled,+ tagStyle: input.tagStyle,+ inferredTagLang: input.inferredTagLang,}).where(eq(users.id, this.user.id));}diff --git a/packages/trpc/routers/users.test.ts b/packages/trpc/routers/users.test.tsindex 21f05f5b..38ce2353 100644--- a/packages/trpc/routers/users.test.ts+++ b/packages/trpc/routers/users.test.ts@@ -167,6 +167,8 @@ describe("User Routes", () => {// AI SettingsautoSummarizationEnabled: null,autoTaggingEnabled: null,+ inferredTagLang: null,+ tagStyle: "lowercase-hyphens",});// Update settings@@ -184,6 +186,8 @@ describe("User Routes", () => {// AI SettingsautoSummarizationEnabled: true,autoTaggingEnabled: true,+ inferredTagLang: "en",+ tagStyle: "lowercase-underscores",});// Verify updated settings@@ -204,6 +208,8 @@ describe("User Routes", () => {// AI SettingsautoSummarizationEnabled: true,autoTaggingEnabled: true,+ inferredTagLang: "en",+ tagStyle: "lowercase-underscores",});// Test invalid update (e.g., empty input, if schema enforces it)diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 8a8d55e0..719a4472 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -561,6 +561,9 @@ importers:'@radix-ui/react-progress':specifier: ^1.1.7version: 1.1.7(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@radix-ui/react-radio-group':+ specifier: ^1.3.8+ version: 1.3.8(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])'@radix-ui/react-scroll-area':specifier: ^1.2.9version: 1.2.9(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])@@ -4421,6 +4424,9 @@ packages:'@radix-ui/[email protected]':resolution: {integrity: sha512-XnbHrrprsNqZKQhStrSwgRUQzoCI1glLzdw79xiZPoofhGICeZRSQ3dIxAKH1gb3OHfNf4d6f+vAv3kil2eggA==}+ '@radix-ui/[email protected]':+ resolution: {integrity: sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==}+'@radix-ui/[email protected]':resolution: {integrity: sha512-F+M1tLhO+mlQaOWspE8Wstg+z6PwxwRd8oQ8IXceWz92kfAmalTRf0EjrouQeo7QssEPfCn05B4Ihs1K9WQ/7w==}peerDependencies:@@ -4657,6 +4663,19 @@ packages:'@types/react-dom':optional: true+ '@radix-ui/[email protected]':+ resolution: {integrity: sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+'@radix-ui/[email protected]':resolution: {integrity: sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==}peerDependencies:@@ -4696,6 +4715,19 @@ packages:'@types/react-dom':optional: true+ '@radix-ui/[email protected]':+ resolution: {integrity: sha512-VBKYIYImA5zsxACdisNQ3BjCBfmbGH3kQlnFVqlWU4tXwjy7cGX8ta80BcrO+WJXIn5iBylEH3K6ZTlee//lgQ==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+'@radix-ui/[email protected]':resolution: {integrity: sha512-dT9aOXUen9JSsxnMPv/0VqySQf5eDQ6LCk5Sw28kamz8wSOW2bJdlX2Bg5VUIIcV+6XlHpWTIuTPCf/UNIyq8Q==}peerDependencies:@@ -4709,6 +4741,19 @@ packages:'@types/react-dom':optional: true+ '@radix-ui/[email protected]':+ resolution: {integrity: sha512-7A6S9jSgm/S+7MdtNDSb+IU859vQqJ/QAtcYQcfFC6W8RS4IxIZDldLR0xqCFZ6DCyrQLjLPsxtTNch5jVA4lA==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+'@radix-ui/[email protected]':resolution: {integrity: sha512-YSjEfBXnhUELsO2VzjdtYYD4CfQjvao+lhhrX5XsHD7/cyUNzljF1FHEbgTPN7LH2MClfwRMIsYlqTYpKTTe2A==}peerDependencies:@@ -19636,6 +19681,8 @@ snapshots:'@radix-ui/[email protected]': {}+ '@radix-ui/[email protected]': {}+'@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':dependencies:'@radix-ui/react-primitive': 2.1.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])@@ -19880,6 +19927,16 @@ snapshots:'@types/react': 19.1.8'@types/react-dom': 19.1.6(@types/[email protected])+ '@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':+ dependencies:+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])+ '@radix-ui/react-use-layout-effect': 1.1.1(@types/[email protected])([email protected])+ react: 19.1.0+ react-dom: 19.1.0([email protected])+ optionalDependencies:+ '@types/react': 19.1.8+ '@types/react-dom': 19.1.6(@types/[email protected])+'@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':dependencies:'@radix-ui/react-slot': 1.2.3(@types/[email protected])([email protected])@@ -19908,6 +19965,24 @@ snapshots:'@types/react': 19.1.8'@types/react-dom': 19.1.6(@types/[email protected])+ '@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':+ dependencies:+ '@radix-ui/primitive': 1.1.3+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])+ '@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])+ '@radix-ui/react-presence': 1.1.5(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@radix-ui/react-primitive': 2.1.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@radix-ui/react-roving-focus': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])+ '@radix-ui/react-use-previous': 1.1.1(@types/[email protected])([email protected])+ '@radix-ui/react-use-size': 1.1.1(@types/[email protected])([email protected])+ react: 19.1.0+ react-dom: 19.1.0([email protected])+ optionalDependencies:+ '@types/react': 19.1.8+ '@types/react-dom': 19.1.6(@types/[email protected])+'@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':dependencies:'@radix-ui/primitive': 1.1.2@@ -19925,6 +20000,23 @@ snapshots:'@types/react': 19.1.8'@types/react-dom': 19.1.6(@types/[email protected])+ '@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':+ dependencies:+ '@radix-ui/primitive': 1.1.3+ '@radix-ui/react-collection': 1.1.7(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])+ '@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])+ '@radix-ui/react-id': 1.1.1(@types/[email protected])([email protected])+ '@radix-ui/react-primitive': 2.1.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@radix-ui/react-use-callback-ref': 1.1.1(@types/[email protected])([email protected])+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])+ react: 19.1.0+ react-dom: 19.1.0([email protected])+ optionalDependencies:+ '@types/react': 19.1.8+ '@types/react-dom': 19.1.6(@types/[email protected])+'@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':dependencies:'@radix-ui/number': 1.1.1