diff --git a/src/screens/Login/LoginForm.tsx b/src/screens/Login/LoginForm.tsx
--- a/src/screens/Login/LoginForm.tsx
+++ b/src/screens/Login/LoginForm.tsx
@@ -279,13 +279,13 @@
diff --git a/src/screens/Login/LoginForm.web.tsx b/src/screens/Login/LoginForm.web.tsx
--- a/src/screens/Login/LoginForm.web.tsx
+++ b/src/screens/Login/LoginForm.web.tsx
@@ -275,13 +275,13 @@
diff --git a/src/screens/Settings/AIPreferencesSettings.tsx b/src/screens/Settings/AIPreferencesSettings.tsx
--- a/src/screens/Settings/AIPreferencesSettings.tsx
+++ b/src/screens/Settings/AIPreferencesSettings.tsx
@@ -13,7 +13,7 @@ useUpdateAIPreferencesMutation,
} 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 @@ const denyLabel = l`Deny`
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 @@ value: 'allow' | 'deny' | 'unset'
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 @@ {description}
-
-
- {allowLabel}
-
-
- {unsetLabel}
-
-
- {denyLabel}
-
-
+
+ {allowLabel}
+
+
+ {unsetLabel}
+
+
+ {denyLabel}
+
+
)
diff --git a/src/state/queries/ai-preferences/index.ts b/src/state/queries/ai-preferences/index.ts
--- a/src/state/queries/ai-preferences/index.ts
+++ b/src/state/queries/ai-preferences/index.ts
@@ -3,17 +3,21 @@
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
--- 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
--- 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',
-}