diff --git a/src/screens/Login/LoginForm.tsx b/src/screens/Login/LoginForm.tsx
index 1c368d6c9..9c850155c 100644
--- a/src/screens/Login/LoginForm.tsx
+++ b/src/screens/Login/LoginForm.tsx
@@ -279,13 +279,13 @@ function OAuthLoginFields({
diff --git a/src/screens/Login/LoginForm.web.tsx b/src/screens/Login/LoginForm.web.tsx
index dad5b6a4c..ad3baabe1 100644
--- a/src/screens/Login/LoginForm.web.tsx
+++ b/src/screens/Login/LoginForm.web.tsx
@@ -275,13 +275,13 @@ function OAuthLoginFields({
diff --git a/src/screens/Settings/AIPreferencesSettings.tsx b/src/screens/Settings/AIPreferencesSettings.tsx
index ef269da31..1369da78c 100644
--- a/src/screens/Settings/AIPreferencesSettings.tsx
+++ b/src/screens/Settings/AIPreferencesSettings.tsx
@@ -13,7 +13,7 @@ import {
} from '#/state/queries/ai-preferences'
import * as SettingsList from '#/screens/Settings/components/SettingsList'
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
-import * as SegmentedControl from '#/components/forms/SegmentedControl'
+import * as ToggleButton from '#/components/forms/ToggleButton'
import * as Layout from '#/components/Layout'
import {Loader} from '#/components/Loader'
import {Text} from '#/components/Typography'
@@ -38,7 +38,8 @@ export function AIPreferencesSettingsScreen({}: Props) {
const categoryCopy = useCategoryCopy()
- const onChange = (category: AIPreferenceCategory) => (value: TriState) => {
+ const onChange = (category: AIPreferenceCategory) => (values: string[]) => {
+ const value = values[0] as TriState | undefined
if (value !== 'allow' && value !== 'deny' && value !== 'unset') return
mutate({[category]: value})
}
@@ -153,7 +154,7 @@ function CategoryRow({
allowLabel: string
unsetLabel: string
denyLabel: string
- onChange: (value: TriState) => void
+ onChange: (values: string[]) => void
}) {
const {t: l} = useLingui()
const t = useTheme()
@@ -180,21 +181,20 @@ function CategoryRow({
-
-
- {allowLabel}
-
-
- {unsetLabel}
-
-
- {denyLabel}
-
-
+
+ {allowLabel}
+
+
+ {unsetLabel}
+
+
+ {denyLabel}
+
+
)
diff --git a/src/state/queries/ai-preferences/index.ts b/src/state/queries/ai-preferences/index.ts
index 4e5e3ff9e..6ac8a61bf 100644
--- a/src/state/queries/ai-preferences/index.ts
+++ b/src/state/queries/ai-preferences/index.ts
@@ -3,17 +3,21 @@ import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
import {logger} from '#/logger'
import {STALE} from '#/state/queries'
import {useAgent, useSession} from '#/state/session'
-import {buildGlobalRecord, type Patch} from './serde'
-import {AI_PREFERENCE_NSID, type AIPreferenceRecord} from './types'
+import {
+ AI_PREFERENCE_NSID,
+ buildGlobalRecord,
+ type Patch,
+ type AIPreferenceRecord,
+} from './serde'
-export {preferenceSetToTriStates} from './serde'
export {
+ preferenceSetToTriStates,
AI_PREFERENCE_CATEGORIES,
AI_PREFERENCE_NSID,
type AIPreferenceCategory,
type AIPreferenceRecord,
type TriState,
-} from './types'
+} from './serde'
const RQKEY_ROOT = 'ai-preferences'
diff --git a/src/state/queries/ai-preferences/serde.ts b/src/state/queries/ai-preferences/serde.ts
index 026efe91c..07cfb92a9 100644
--- a/src/state/queries/ai-preferences/serde.ts
+++ b/src/state/queries/ai-preferences/serde.ts
@@ -1,12 +1,66 @@
-import {
- AI_PREFERENCE_CATEGORIES,
- type AIPreferenceCategory,
- type AIPreferenceRecord,
- type AIPreferenceSet,
- type AIPreferenceTriStates,
- DEFAULT_TRI_STATES,
- type TriState,
-} from './types'
+export const AI_PREFERENCE_NSID = 'community.lexicon.preference.ai'
+
+export type AIPreferenceCategory =
+ | 'training'
+ | 'inference'
+ | 'syntheticContent'
+ | 'embedding'
+
+export const AI_PREFERENCE_CATEGORIES: AIPreferenceCategory[] = [
+ 'training',
+ 'inference',
+ 'syntheticContent',
+ 'embedding',
+]
+
+export type TriState = 'allow' | 'deny' | 'unset'
+
+export type AIPreferenceField = {
+ allow: boolean
+ updatedAt: string
+}
+
+export type AIGlobalScope = {
+ $type: 'community.lexicon.preference.ai#globalScope'
+}
+
+export type AIEntityScope = {
+ $type: 'community.lexicon.preference.ai#entityScope'
+ entity: string
+}
+
+export type AICollectionScope = {
+ $type: 'community.lexicon.preference.ai#collectionScope'
+ collection: string
+}
+
+export type AIPreferenceScope =
+ | AIGlobalScope
+ | AIEntityScope
+ | AICollectionScope
+
+export type AIPreferenceSet = {
+ training?: AIPreferenceField
+ inference?: AIPreferenceField
+ syntheticContent?: AIPreferenceField
+ embedding?: AIPreferenceField
+}
+
+export type AIPreferenceRecord = {
+ $type: 'community.lexicon.preference.ai'
+ updatedAt: string
+ scope: AIPreferenceScope
+ preferences: AIPreferenceSet
+}
+
+export type AIPreferenceTriStates = Record
+
+export const DEFAULT_TRI_STATES: AIPreferenceTriStates = {
+ training: 'unset',
+ inference: 'unset',
+ syntheticContent: 'unset',
+ embedding: 'unset',
+}
export function fieldToTriState(field: {allow: boolean} | undefined): TriState {
if (!field) return 'unset'
diff --git a/src/state/queries/ai-preferences/types.ts b/src/state/queries/ai-preferences/types.ts
deleted file mode 100644
index 265299d0b..000000000
--- a/src/state/queries/ai-preferences/types.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-export const AI_PREFERENCE_NSID = 'community.lexicon.preference.ai'
-
-export type AIPreferenceCategory =
- | 'training'
- | 'inference'
- | 'syntheticContent'
- | 'embedding'
-
-export const AI_PREFERENCE_CATEGORIES: AIPreferenceCategory[] = [
- 'training',
- 'inference',
- 'syntheticContent',
- 'embedding',
-]
-
-export type TriState = 'allow' | 'deny' | 'unset'
-
-export type AIPreferenceField = {
- allow: boolean
- updatedAt: string
-}
-
-export type AIGlobalScope = {
- $type: 'community.lexicon.preference.ai#globalScope'
-}
-
-export type AIEntityScope = {
- $type: 'community.lexicon.preference.ai#entityScope'
- entity: string
-}
-
-export type AICollectionScope = {
- $type: 'community.lexicon.preference.ai#collectionScope'
- collection: string
-}
-
-export type AIPreferenceScope =
- | AIGlobalScope
- | AIEntityScope
- | AICollectionScope
-
-export type AIPreferenceSet = {
- training?: AIPreferenceField
- inference?: AIPreferenceField
- syntheticContent?: AIPreferenceField
- embedding?: AIPreferenceField
-}
-
-export type AIPreferenceRecord = {
- $type: 'community.lexicon.preference.ai'
- updatedAt: string
- scope: AIPreferenceScope
- preferences: AIPreferenceSet
-}
-
-export type AIPreferenceTriStates = Record
-
-export const DEFAULT_TRI_STATES: AIPreferenceTriStates = {
- training: 'unset',
- inference: 'unset',
- syntheticContent: 'unset',
- embedding: 'unset',
-}