diff --git a/.coderabbit.yaml b/.coderabbit.yaml index 5db6e093c6..5da3f8f792 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -11,6 +11,7 @@ reviews: - "!**/*.gen.ts" - "!plugins/**/permissions/**" - "!**/README*" + - "!**/.cursor/**" path_instructions: - path: "**/*.{js,ts,tsx,rs}" instructions: | diff --git a/apps/desktop2/src/components/chat/session.tsx b/apps/desktop2/src/components/chat/session.tsx index ec2e93f1ea..168650f1b7 100644 --- a/apps/desktop2/src/components/chat/session.tsx +++ b/apps/desktop2/src/components/chat/session.tsx @@ -2,6 +2,7 @@ import { useChat } from "@ai-sdk/react"; import type { UIMessage } from "ai"; import { type ReactNode, useEffect, useMemo, useRef, useState } from "react"; +import * as internal from "../../store/tinybase/internal"; import * as persisted from "../../store/tinybase/persisted"; import { CustomChatTransport } from "../../transport"; import { id } from "../../utils"; @@ -25,7 +26,7 @@ export function ChatSession({ const [transport] = useState(() => new CustomChatTransport()); const store = persisted.UI.useStore(persisted.STORE_ID); - const { user_id } = persisted.useConfig(); + const { user_id } = internal.UI.useValues(internal.STORE_ID); const createChatMessage = persisted.UI.useSetRowCallback( "chat_messages", diff --git a/apps/desktop2/src/components/chat/view.tsx b/apps/desktop2/src/components/chat/view.tsx index 27414d1456..38b11a6b01 100644 --- a/apps/desktop2/src/components/chat/view.tsx +++ b/apps/desktop2/src/components/chat/view.tsx @@ -1,6 +1,7 @@ import type { UIMessage } from "ai"; import { useCallback, useEffect, useRef, useState } from "react"; +import * as internal from "../../store/tinybase/internal"; import type { ChatMessage, ChatMessageStorage } from "../../store/tinybase/persisted"; import * as persisted from "../../store/tinybase/persisted"; import { id } from "../../utils"; @@ -31,7 +32,7 @@ export function ChatView({ chatGroupIdRef.current = chatGroupId; }, [chatGroupId]); - const { user_id } = persisted.useConfig(); + const { user_id } = internal.UI.useValues(internal.STORE_ID); const createChatGroup = persisted.UI.useSetRowCallback( "chat_groups", diff --git a/apps/desktop2/src/components/human.tsx b/apps/desktop2/src/components/human.tsx index 1e50d5c2cb..b651391397 100644 --- a/apps/desktop2/src/components/human.tsx +++ b/apps/desktop2/src/components/human.tsx @@ -1,4 +1,4 @@ -import { useValidatedRow } from "../hooks/useValidatedRow"; +import { useSafeObjectUpdate } from "../hooks/useSafeObjectUpdate"; import * as persisted from "../store/tinybase/persisted"; export function Human({ id }: { id: string }) { @@ -12,7 +12,7 @@ export function Human({ id }: { id: string }) { persisted.STORE_ID, ); - const { setField, errors } = useValidatedRow(persisted.humanSchema, human, handleUpdate); + const { setField, errors } = useSafeObjectUpdate(persisted.humanSchema, human, handleUpdate); return (
diff --git a/apps/desktop2/src/components/main/body/sessions/outer-header/index.tsx b/apps/desktop2/src/components/main/body/sessions/outer-header/index.tsx index 0df938fe2d..46901eb747 100644 --- a/apps/desktop2/src/components/main/body/sessions/outer-header/index.tsx +++ b/apps/desktop2/src/components/main/body/sessions/outer-header/index.tsx @@ -1,3 +1,4 @@ +import * as internal from "../../../../../store/tinybase/internal"; import * as persisted from "../../../../../store/tinybase/persisted"; import { SessionEvent } from "./event"; @@ -16,9 +17,7 @@ export function OuterHeader( isAudioPlayerVisible: boolean; }, ) { - const currentUserId = persisted.UI.useCell("configs", "singleton", "user_id", persisted.STORE_ID) as - | string - | undefined; + const { user_id } = internal.UI.useValues(internal.STORE_ID); return (
@@ -38,7 +37,7 @@ export function OuterHeader( /> ("transcription"); + + return ( + setActiveTab(v as typeof activeTab)} className="w-full"> + + Transcription + Intelligence + + + + + + + + + ); +} + +function TranscriptionSettings() { + return ( +
+
+ + +
+ +
+ + +
+
+ ); +} + +function IntelligenceSettings() { + return ( +
+ + + + +
+ ); +} + +function Section({ + title, + description, + children, +}: { + title: string; + description: string; + children: React.ReactNode; +}) { + return ( +
+
+

{title}

+

{description}

+
+
{children}
+
+ ); +} + +function ModelCard({ + name, + description, + status, +}: { + name: string; + description: string; + status: "available" | "downloaded"; +}) { + return ( +
+
+
+

{name}

+

{description}

+
+
+ {status === "downloaded" + ? ( + + Model Downloaded + + ) + : ( + + )} +
+
+
+ ); +} + +function ProviderCard({ + name, + configured, + modelInUse, +}: { + name: string; + configured?: boolean; + modelInUse?: string; +}) { + const [isOpen, setIsOpen] = useState(false); + + return ( +
+
setIsOpen(!isOpen)}> +
+
+ {name} + {configured && ( + + + API key configured + + )} +
+ {isOpen ? "−" : "+"} +
+ {modelInUse && ( +

+ Model being used: {modelInUse} +

+ )} +
+ + {isOpen && ( +
+
+ e.stopPropagation()} + /> +
+
+ )} +
+ ); +} diff --git a/apps/desktop2/src/components/settings/billing.tsx b/apps/desktop2/src/components/settings/billing.tsx new file mode 100644 index 0000000000..ec32d688e5 --- /dev/null +++ b/apps/desktop2/src/components/settings/billing.tsx @@ -0,0 +1,3 @@ +export function SettingsBilling() { + return null; +} diff --git a/apps/desktop2/src/components/settings/calendar.tsx b/apps/desktop2/src/components/settings/calendar.tsx new file mode 100644 index 0000000000..ca55f50440 --- /dev/null +++ b/apps/desktop2/src/components/settings/calendar.tsx @@ -0,0 +1,3 @@ +export function SettingsCalendar() { + return null; +} diff --git a/apps/desktop2/src/components/settings/developers.tsx b/apps/desktop2/src/components/settings/developers.tsx new file mode 100644 index 0000000000..72e1d2ee7c --- /dev/null +++ b/apps/desktop2/src/components/settings/developers.tsx @@ -0,0 +1,16 @@ +import { commands as windowsCommands } from "@hypr/plugin-windows/v1"; + +import { useAuth } from "../../auth"; + +export function SettingsDevelopers() { + const s = useAuth(); + + const handleAuth = () => windowsCommands.windowShow({ type: "auth" }); + + return ( +
+
{JSON.stringify(s?.session)}
+ +
+ ); +} diff --git a/apps/desktop2/src/components/settings/feedback.tsx b/apps/desktop2/src/components/settings/feedback.tsx new file mode 100644 index 0000000000..62437b36c6 --- /dev/null +++ b/apps/desktop2/src/components/settings/feedback.tsx @@ -0,0 +1,3 @@ +export function SettingsFeedback() { + return null; +} diff --git a/apps/desktop2/src/components/settings/general.tsx b/apps/desktop2/src/components/settings/general.tsx new file mode 100644 index 0000000000..94445e4ca2 --- /dev/null +++ b/apps/desktop2/src/components/settings/general.tsx @@ -0,0 +1,16 @@ +import { useUpdateGeneral } from "./shared"; + +export function SettingsGeneral() { + const { value, handle } = useUpdateGeneral(); + + return ( +
+
{JSON.stringify(value, null, 2)}
+ handle.setField("save_recordings", e.target.checked)} + /> +
+ ); +} diff --git a/apps/desktop2/src/components/settings/integrations.tsx b/apps/desktop2/src/components/settings/integrations.tsx new file mode 100644 index 0000000000..2aa3aed0ae --- /dev/null +++ b/apps/desktop2/src/components/settings/integrations.tsx @@ -0,0 +1,3 @@ +export function SettingsIntegrations() { + return null; +} diff --git a/apps/desktop2/src/components/settings/notification.tsx b/apps/desktop2/src/components/settings/notification.tsx new file mode 100644 index 0000000000..2c15a91410 --- /dev/null +++ b/apps/desktop2/src/components/settings/notification.tsx @@ -0,0 +1,21 @@ +import { useUpdateGeneral } from "./shared"; + +export function SettingsNotifications() { + const { value, handle } = useUpdateGeneral(); + + return ( +
+
{JSON.stringify(value, null, 2)}
+ handle.setField("notification_event", e.target.checked)} + /> + handle.setField("notification_detect", e.target.checked)} + /> +
+ ); +} diff --git a/apps/desktop2/src/components/settings/shared.ts b/apps/desktop2/src/components/settings/shared.ts new file mode 100644 index 0000000000..698630ecc2 --- /dev/null +++ b/apps/desktop2/src/components/settings/shared.ts @@ -0,0 +1,55 @@ +import * as internal from "../../store/tinybase/internal"; +import * as persisted from "../../store/tinybase/persisted"; + +import { useSafeObjectUpdate } from "../../hooks/useSafeObjectUpdate"; + +export const useUpdateGeneral = () => { + const _value = internal.UI.useValues(internal.STORE_ID); + const value: internal.General = internal.generalSchema.parse(_value); + + const cb = internal.UI.useSetPartialValuesCallback( + ( + row: Partial, + ) => ({ + ...row, + spoken_languages: JSON.stringify(row.spoken_languages), + jargons: JSON.stringify(row.jargons), + } satisfies Partial), + [], + internal.STORE_ID, + ); + + const handle = useSafeObjectUpdate(internal.generalSchema, value, cb); + return { value, handle }; +}; + +export const useUpdateAI = (id: string) => { + const _value = internal.UI.useRow("ai", id, internal.STORE_ID); + const value: internal.AI = internal.aiSchema.parse(_value); + + const cb = internal.UI.useSetPartialValuesCallback( + (row: Partial) => ({ ...row } satisfies Partial), + ); + + const handle = useSafeObjectUpdate(internal.aiSchema, value, cb); + return { value, handle }; +}; + +export const useUpdateTemplate = (id: string) => { + const _value = persisted.UI.useRow("templates", id, persisted.STORE_ID); + const value: persisted.Template = persisted.templateSchema.parse(_value); + + const cb = persisted.UI.useSetPartialRowCallback( + "templates", + id, + (row: Partial) => ({ + ...row, + sections: JSON.stringify(row.sections), + } satisfies Partial), + [id], + persisted.STORE_ID, + ); + + const handle = useSafeObjectUpdate(persisted.templateSchema, value, cb); + return { value, handle }; +}; diff --git a/apps/desktop2/src/components/settings/templates.tsx b/apps/desktop2/src/components/settings/templates.tsx new file mode 100644 index 0000000000..039363d926 --- /dev/null +++ b/apps/desktop2/src/components/settings/templates.tsx @@ -0,0 +1,62 @@ +import { useState } from "react"; +import { createQueries } from "tinybase/with-schemas"; + +import * as internal from "../../store/tinybase/internal"; +import * as persisted from "../../store/tinybase/persisted"; +import { useUpdateTemplate } from "./shared"; + +export function SettingsTemplates() { + const [currentTemplate, setCurrentTemplate] = useState(null); + + const { user_id } = internal.UI.useValues(internal.STORE_ID); + const store = persisted.UI.useStore(persisted.STORE_ID); + + const USER_TEMPLATE_QUERY = "user_templates"; + + const quries = persisted.UI.useCreateQueries( + store, + (store) => + createQueries(store).setQueryDefinition(USER_TEMPLATE_QUERY, "templates", ({ select, where }) => { + select("title"); + select("sections"); + where("user_id", user_id ?? ""); + }), + [user_id], + ); + + const templates = persisted.UI.useResultTable(USER_TEMPLATE_QUERY, quries); + + if (currentTemplate) { + return ; + } + + return ( +
+

Templates

+ {Object.entries(templates).map(([id, template]) => ( +
setCurrentTemplate(id)} + className="cursor-pointer" + > + {template.title} +
+ ))} +
+ ); +} + +function TemplateEditor({ id }: { id: string }) { + const { value, handle } = useUpdateTemplate(id); + + return ( +
+

Template Editor

+
{JSON.stringify(value, null, 2)}
+ handle.setField("title", e.target.value)} + /> +
+ ); +} diff --git a/apps/desktop2/src/hooks/useValidatedRow.ts b/apps/desktop2/src/hooks/useSafeObjectUpdate.ts similarity index 94% rename from apps/desktop2/src/hooks/useValidatedRow.ts rename to apps/desktop2/src/hooks/useSafeObjectUpdate.ts index d06dea3f65..025b540ab6 100644 --- a/apps/desktop2/src/hooks/useValidatedRow.ts +++ b/apps/desktop2/src/hooks/useSafeObjectUpdate.ts @@ -3,7 +3,7 @@ import { z } from "zod"; type FieldErrors = Partial>; -export function useValidatedRow>( +export function useSafeObjectUpdate>( schema: T, currentRow: Partial> | undefined, onUpdate: (row: z.infer) => void, diff --git a/apps/desktop2/src/routes/app/settings/_layout.index.tsx b/apps/desktop2/src/routes/app/settings/_layout.index.tsx index 9bd866fd19..30f7c11dc7 100644 --- a/apps/desktop2/src/routes/app/settings/_layout.index.tsx +++ b/apps/desktop2/src/routes/app/settings/_layout.index.tsx @@ -1,9 +1,14 @@ -import { commands as windowsCommands } from "@hypr/plugin-windows/v1"; import { createFileRoute } from "@tanstack/react-router"; -import { useAuth } from "../../../auth"; -import { useValidatedRow } from "../../../hooks/useValidatedRow"; -import * as persisted from "../../../store/tinybase/persisted"; +import { SettingsAI } from "../../../components/settings/ai"; +import { SettingsBilling } from "../../../components/settings/billing"; +import { SettingsCalendar } from "../../../components/settings/calendar"; +import { SettingsDevelopers } from "../../../components/settings/developers"; +import { SettingsFeedback } from "../../../components/settings/feedback"; +import { SettingsGeneral } from "../../../components/settings/general"; +import { SettingsIntegrations } from "../../../components/settings/integrations"; +import { SettingsNotifications } from "../../../components/settings/notification"; +import { SettingsTemplates } from "../../../components/settings/templates"; export const Route = createFileRoute("/app/settings/_layout/")({ component: Component, @@ -26,81 +31,3 @@ function Component() { ); } - -function SettingsGeneral() { - const res = persisted.useConfig(); - if (!res) { - return null; - } - const { id, config } = res; - - const parsedConfig = persisted.configSchema.parse(config); - - const handleUpdate = persisted.UI.useSetRowCallback( - "configs", - id, - (row: persisted.Config) => ({ - ...row, - spoken_languages: JSON.stringify(row.spoken_languages), - jargons: JSON.stringify(row.jargons), - notification_ignored_platforms: row.notification_ignored_platforms - ? JSON.stringify(row.notification_ignored_platforms) - : undefined, - }), - [id], - persisted.STORE_ID, - ); - - const r = useValidatedRow(persisted.configSchema, parsedConfig, handleUpdate); - - return ( -
-
{JSON.stringify(config, null, 2)}
- r.setField("save_recordings", e.target.checked)} - /> -
- ); -} - -function SettingsCalendar() { - return null; -} - -function SettingsAI() { - return null; -} - -function SettingsNotifications() { - return null; -} - -function SettingsIntegrations() { - return null; -} - -function SettingsTemplates() { - return null; -} - -function SettingsFeedback() { - return null; -} - -function SettingsDevelopers() { - const s = useAuth(); - - const handleAuth = () => windowsCommands.windowShow({ type: "auth" }); - - return ( -
-
{JSON.stringify(s?.session)}
- -
- ); -} - -function SettingsBilling() { - return null; -} diff --git a/apps/desktop2/src/routes/app/settings/_layout.tsx b/apps/desktop2/src/routes/app/settings/_layout.tsx index b81696db17..7333caca74 100644 --- a/apps/desktop2/src/routes/app/settings/_layout.tsx +++ b/apps/desktop2/src/routes/app/settings/_layout.tsx @@ -36,76 +36,62 @@ export const Route = createFileRoute("/app/settings/_layout")({ function Component() { const search = Route.useSearch(); - const navigate = Route.useNavigate(); - const topTabs = TABS.filter((tab) => !info(tab).bottom); - const bottomTabs = TABS.filter((tab) => info(tab).bottom); + const group1Tabs = TABS.filter((tab) => info(tab).group === 1); + const group2Tabs = TABS.filter((tab) => info(tab).group === 2); + const group3Tabs = TABS.filter((tab) => info(tab).group === 3); return ( -
-
-
- -
-
- {topTabs.map((tab) => { - const tabInfo = info(tab); - const Icon = tabInfo.icon; - return ( - - ); - })} -
+
+
+
+ -
- {bottomTabs.map((tab) => { - const tabInfo = info(tab); - const Icon = tabInfo.icon; - return ( - - ); - })} +
+ +
-
+
-

+

{info(search.tab).label}

-
+
@@ -113,61 +99,111 @@ function Component() { ); } +function Group( + { + tabs, + activeTab, + expandHeight = false, + includeTrafficLight = false, + }: { + tabs: (typeof TABS)[number][]; + activeTab: typeof TABS[number]; + expandHeight?: boolean; + includeTrafficLight?: boolean; + }, +) { + const navigate = Route.useNavigate(); + return ( +
+ {includeTrafficLight &&
} + {tabs.map((tab) => { + const tabInfo = info(tab); + const Icon = tabInfo.icon; + + return ( + + ); + })} +
+ ); +} + const info = (tab: typeof TABS[number]) => { switch (tab) { case "general": return { label: "General", icon: Settings2, - bottom: false, + group: 1, }; case "calendar": return { label: "Calendar", icon: CalendarDays, - bottom: false, + group: 1, }; case "ai": return { label: "Hyprnote AI", icon: Sparkles, - bottom: false, + group: 1, }; case "notifications": return { label: "Notifications", icon: Bell, - bottom: false, + group: 1, }; case "integrations": return { label: "Integrations", icon: Puzzle, - bottom: false, + group: 1, }; case "templates": return { label: "Templates", icon: BookText, - bottom: false, + group: 1, }; case "feedback": return { label: "Feedback", icon: MessageCircleQuestion, - bottom: true, + group: 2, }; case "developers": return { label: "Talk to developers", icon: Settings2, - bottom: true, + group: 2, }; case "billing": return { label: "Billing", icon: CreditCard, - bottom: true, + group: 3, }; } }; diff --git a/apps/desktop2/src/store/seed.ts b/apps/desktop2/src/store/seed.ts index 45d179abff..5e65a096d1 100644 --- a/apps/desktop2/src/store/seed.ts +++ b/apps/desktop2/src/store/seed.ts @@ -27,7 +27,7 @@ interface MockConfig { calendarsPerUser: number; } -const USER_ID = id(); +const USER_ID = "4c2c0e44-f674-4c67-87d0-00bcfb78dc8a"; const createOrganization = () => ({ id: id(), diff --git a/apps/desktop2/src/store/tinybase/internal.ts b/apps/desktop2/src/store/tinybase/internal.ts index 985e994ff3..928da687bf 100644 --- a/apps/desktop2/src/store/tinybase/internal.ts +++ b/apps/desktop2/src/store/tinybase/internal.ts @@ -1,17 +1,56 @@ import * as _UI from "tinybase/ui-react/with-schemas"; -import { createMergeableStore, type MergeableStore, type TablesSchema, ValuesSchema } from "tinybase/with-schemas"; +import { createMergeableStore, type MergeableStore, type TablesSchema } from "tinybase/with-schemas"; +import { z } from "zod"; import { createLocalPersister } from "./localPersister"; import { createLocalSynchronizer } from "./localSynchronizer"; +import { type InferTinyBaseSchema, jsonObject, type ToStorageType } from "./shared"; + +export const generalSchema = z.object({ + user_id: z.string(), + autostart: z.boolean().default(false), + telemetry_consent: z.boolean().default(true), + save_recordings: z.boolean().default(true), + notification_event: z.boolean().default(true), + notification_detect: z.boolean().default(true), + ai_language: z.string().default("en"), + spoken_languages: jsonObject(z.array(z.string()).default(["en"])), + jargons: jsonObject(z.array(z.string()).default([])), + current_llm_provider: z.string().default("hypr"), + current_stt_provider: z.string().default("hypr"), +}); + +export const aiSchema = z.object({ + base_url: z.string(), + api_key: z.string(), +}); +export type AI = z.infer; +export type AIStorage = ToStorageType; + +export type General = z.infer; +export type GeneralStorage = ToStorageType; export const STORE_ID = "internal"; export const SCHEMA = { value: { user_id: { type: "string" }, - device_id: { type: "string" }, - } as const satisfies ValuesSchema, + autostart: { type: "boolean" }, + save_recordings: { type: "boolean" }, + notification_event: { type: "boolean" }, + notification_detect: { type: "boolean" }, + telemetry_consent: { type: "boolean" }, + ai_language: { type: "string" }, + spoken_languages: { type: "string" }, + jargons: { type: "string" }, + current_llm_provider: { type: "string" }, + current_stt_provider: { type: "string" }, + } as const satisfies InferTinyBaseSchema, table: { + ai: { + base_url: { type: "string" }, + api_key: { type: "string" }, + } as const satisfies InferTinyBaseSchema, changes: { row_id: { type: "string" }, table: { type: "string" }, diff --git a/apps/desktop2/src/store/tinybase/persisted.ts b/apps/desktop2/src/store/tinybase/persisted.ts index 4ee0097fb9..de5ab739e1 100644 --- a/apps/desktop2/src/store/tinybase/persisted.ts +++ b/apps/desktop2/src/store/tinybase/persisted.ts @@ -16,7 +16,6 @@ import { calendarSchema as baseCalendarSchema, chatGroupSchema as baseChatGroupSchema, chatMessageSchema as baseChatMessageSchema, - configSchema as baseConfigSchema, eventSchema as baseEventSchema, folderSchema as baseFolderSchema, humanSchema as baseHumanSchema, @@ -30,7 +29,6 @@ import { templateSchema as baseTemplateSchema, transcriptSchema, } from "@hypr/db"; -import { id } from "../../utils"; import * as internal from "./internal"; import { createLocalPersister, LOCAL_PERSISTER_ID } from "./localPersister"; import { createLocalSynchronizer } from "./localSynchronizer"; @@ -89,18 +87,6 @@ export const templateSchema = baseTemplateSchema.omit({ id: true }).extend({ sections: jsonObject(z.array(templateSectionSchema)), }); -export const configSchema = baseConfigSchema.omit({ id: true }).extend({ - created_at: z.string(), - spoken_languages: jsonObject(z.array(z.string())), - jargons: jsonObject(z.array(z.string())), - notification_ignored_platforms: jsonObject(z.array(z.string()).optional()), - save_recordings: z.preprocess(val => val ?? undefined, z.boolean().optional()), - selected_template_id: z.preprocess(val => val ?? undefined, z.string().optional()), - ai_api_base: z.preprocess(val => val ?? undefined, z.string().optional()), - ai_api_key: z.preprocess(val => val ?? undefined, z.string().optional()), - ai_specificity: z.preprocess(val => val ?? undefined, z.string().optional()), -}); - export const chatGroupSchema = baseChatGroupSchema.omit({ id: true }).extend({ created_at: z.string() }); export const chatMessageSchema = baseChatMessageSchema.omit({ id: true }).extend({ created_at: z.string(), @@ -119,14 +105,12 @@ export type Tag = z.infer; export type MappingTagSession = z.infer; export type Template = z.infer; export type TemplateSection = z.infer; -export type Config = z.infer; export type ChatGroup = z.infer; export type ChatMessage = z.infer; export type SessionStorage = ToStorageType; export type TemplateStorage = ToStorageType; export type ChatMessageStorage = ToStorageType; -export type ConfigStorage = ToStorageType; const SCHEMA = { value: {} as const satisfies ValuesSchema, @@ -199,24 +183,6 @@ const SCHEMA = { description: { type: "string" }, sections: { type: "string" }, } satisfies InferTinyBaseSchema, - configs: { - user_id: { type: "string" }, - created_at: { type: "string" }, - autostart: { type: "boolean" }, - display_language: { type: "string" }, - spoken_languages: { type: "string" }, - jargons: { type: "string" }, - telemetry_consent: { type: "boolean" }, - save_recordings: { type: "boolean" }, - selected_template_id: { type: "string" }, - summary_language: { type: "string" }, - notification_before: { type: "boolean" }, - notification_auto: { type: "boolean" }, - notification_ignored_platforms: { type: "string" }, - ai_api_base: { type: "string" }, - ai_api_key: { type: "string" }, - ai_specificity: { type: "string" }, - } satisfies InferTinyBaseSchema, chat_groups: { user_id: { type: "string" }, created_at: { type: "string" }, @@ -517,30 +483,3 @@ export const INDEXES = { tagSessionsByTag: "tagSessionsByTag", chatMessagesByGroup: "chatMessagesByGroup", }; - -// TODO -export const useConfig = () => { - const user_id = "0b28fde2-2f07-49da-946c-01fc4b94e9ae"; - const config_id = id(); - - const defaultConfig = { - user_id, - created_at: new Date().toISOString(), - autostart: false, - display_language: "en", - telemetry_consent: true, - summary_language: "en", - notification_before: true, - notification_auto: true, - spoken_languages: JSON.stringify(["en"]), - jargons: JSON.stringify([]), - save_recordings: false, - selected_template_id: undefined, - notification_ignored_platforms: undefined, - ai_api_base: undefined, - ai_api_key: undefined, - ai_specificity: "3", - } satisfies ToStorageType; - - return { id: config_id, user_id, config: defaultConfig }; -}; diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index 104171e696..959fbcb26f 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -87,25 +87,6 @@ export const templates = pgTable(TABLE_TEMPLATES, { sections: json("sections").notNull(), }); -export const TABLE_CONFIGS = "configs"; -export const configs = pgTable(TABLE_CONFIGS, { - ...SHARED, - autostart: boolean("autostart").notNull().default(false), - display_language: text("display_language").notNull().default("en"), - spoken_languages: json("spoken_languages").notNull().default([]), - jargons: json("jargons").notNull().default([]), - telemetry_consent: boolean("telemetry_consent").notNull().default(true), - save_recordings: boolean("save_recordings").default(false), - selected_template_id: uuid("selected_template_id"), - summary_language: text("summary_language").notNull().default("en"), - notification_before: boolean("notification_before").notNull().default(true), - notification_auto: boolean("notification_auto").notNull().default(true), - notification_ignored_platforms: json("notification_ignored_platforms"), - ai_api_base: text("ai_api_base"), - ai_api_key: text("ai_api_key"), - ai_specificity: text("ai_specificity").default("3"), -}); - export const TABLE_CHAT_GROUPS = "chat_groups"; export const chatGroups = pgTable(TABLE_CHAT_GROUPS, { ...SHARED, @@ -143,6 +124,5 @@ export const mappingSessionParticipantSchema = createSelectSchema(mappingSession export const tagSchema = createSelectSchema(tags); export const mappingTagSessionSchema = createSelectSchema(mappingTagSession); export const templateSchema = createSelectSchema(templates); -export const configSchema = createSelectSchema(configs); export const chatGroupSchema = createSelectSchema(chatGroups); export const chatMessageSchema = createSelectSchema(chatMessages);