Skip to content

The open alternative to Salesforce, designed for AI.

feat(ai): replace model pickers with a five-tier model slider (#25721)

Félix Malfait99a0e1c39f4f
diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql
index 5c2ed7b68ed..44b1838bf83 100644
--- a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql
+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql
@@ -845,12 +845,11 @@ type Workspace {
isInternalMessagesImportEnabled: Boolean!
editableProfileFields: [String!]
defaultRole: Role
- fastModel: String!
- smartModel: String!
+ aiChatModelTier: AiModelTier!
+ aiAgentModelTier: AiModelTier!
+ isAutoModelSelectionEnabled: Boolean!
+ aiModelIdByTier: JSON!
aiAdditionalInstructions: String
- enabledAiModelIds: [String!]
- useRecommendedModels: Boolean!
- routerModel: String!
workspaceCustomApplication: Application
featureFlags: [FeatureFlag!]
billingSubscriptions: [BillingSubscription!]!
@@ -879,6 +878,14 @@ enum WorkspaceActivationStatus {
SUSPENDED
}
+enum AiModelTier {
+ extraFast
+ fast
+ balanced
+ smart
+ extraSmart
+}
+
type User {
id: UUID!
firstName: String!
@@ -2050,12 +2057,17 @@ type ClientAiModelConfig {
outputCostPerMillionTokens: Float
nativeCapabilities: NativeModelCapabilities
isDeprecated: Boolean
- isRecommended: Boolean
providerName: String
providerLabel: String
contextWindowTokens: Float
maxOutputTokens: Float
dataResidency: String
+ intelligenceIndex: Float
+ outputTokensPerSecond: Float
+ costPerTask: Float
+ efforts: [String!]
+ effort: String
+ isBenchmarkInherited: Boolean
}
enum ModelFamily {
@@ -2066,6 +2078,11 @@ enum ModelFamily {
GROK
}
+type ClientAiModelTierConfig {
+ tier: AiModelTier!
+ modelId: String!
+}
+
type Billing {
isBillingEnabled: Boolean!
billingUrl: String
@@ -2127,6 +2144,7 @@ type ClientConfig {
authProviders: AuthProviders!
billing: Billing!
aiModels: [ClientAiModelConfig!]!
+ aiModelTiers: [ClientAiModelTierConfig!]!
signInPrefilled: Boolean!
isMultiWorkspaceEnabled: Boolean!
isEmailVerificationRequired: Boolean!
@@ -4770,12 +4788,12 @@ input UpdateWorkspaceInput {
isTwoFactorAuthenticationEnforced: Boolean
trashRetentionDays: Float
eventLogRetentionDays: Float
- fastModel: String
- smartModel: String
+ aiChatModelTier: AiModelTier
+ aiAgentModelTier: AiModelTier
+ isAutoModelSelectionEnabled: Boolean
+ aiModelIdByTier: JSON
aiAdditionalInstructions: String
editableProfileFields: [String!]
- enabledAiModelIds: [String!]
- useRecommendedModels: Boolean
isInternalMessagesImportEnabled: Boolean
}
diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.ts b/packages/twenty-client-sdk/src/metadata/generated/schema.ts
index a63422aca4e..7ac4ece3b4f 100644
--- a/packages/twenty-client-sdk/src/metadata/generated/schema.ts
+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.ts
@@ -588,12 +588,11 @@ export interface Workspace {
isInternalMessagesImportEnabled: Scalars['Boolean']
editableProfileFields?: Scalars['String'][]
defaultRole?: Role
- fastModel: Scalars['String']
- smartModel: Scalars['String']
+ aiChatModelTier: AiModelTier
+ aiAgentModelTier: AiModelTier
+ isAutoModelSelectionEnabled: Scalars['Boolean']
+ aiModelIdByTier: Scalars['JSON']
aiAdditionalInstructions?: Scalars['String']
- enabledAiModelIds?: Scalars['String'][]
- useRecommendedModels: Scalars['Boolean']
- routerModel: Scalars['String']
workspaceCustomApplication?: Application
featureFlags?: FeatureFlag[]
billingSubscriptions: BillingSubscription[]
@@ -612,6 +611,8 @@ export type WorkspaceDiscoverability = 'PUBLIC' | 'MEMBERS_AND_INVITEES' | 'HIDD
export type WorkspaceActivationStatus = 'ONGOING_CREATION' | 'PENDING_CREATION' | 'CREATED' | 'ACTIVE' | 'INACTIVE' | 'SUSPENDED'
+export type AiModelTier = 'extraFast' | 'fast' | 'balanced' | 'smart' | 'extraSmart'
+
export interface User {
id: Scalars['UUID']
firstName: Scalars['String']
@@ -1667,17 +1668,28 @@ export interface ClientAiModelConfig {
outputCostPerMillionTokens?: Scalars['Float']
nativeCapabilities?: NativeModelCapabilities
isDeprecated?: Scalars['Boolean']
- isRecommended?: Scalars['Boolean']
providerName?: Scalars['String']
providerLabel?: Scalars['String']
contextWindowTokens?: Scalars['Float']
maxOutputTokens?: Scalars['Float']
dataResidency?: Scalars['String']
+ intelligenceIndex?: Scalars['Float']
+ outputTokensPerSecond?: Scalars['Float']
+ costPerTask?: Scalars['Float']
+ efforts?: Scalars['String'][]
+ effort?: Scalars['String']
+ isBenchmarkInherited?: Scalars['Boolean']
__typename: 'ClientAiModelConfig'
}
export type ModelFamily = 'GPT' | 'CLAUDE' | 'GEMINI' | 'MISTRAL' | 'GROK'
+export interface ClientAiModelTierConfig {
+ tier: AiModelTier
+ modelId: Scalars['String']
+ __typename: 'ClientAiModelTierConfig'
+}
+
export interface Billing {
isBillingEnabled: Scalars['Boolean']
billingUrl?: Scalars['String']
@@ -1741,6 +1753,7 @@ export interface ClientConfig {
authProviders: AuthProviders
billing: Billing
aiModels: ClientAiModelConfig[]
+ aiModelTiers: ClientAiModelTierConfig[]
signInPrefilled: Scalars['Boolean']
isMultiWorkspaceEnabled: Scalars['Boolean']
isEmailVerificationRequired: Scalars['Boolean']
@@ -4096,12 +4109,11 @@ export interface WorkspaceGenqlSelection{
isInternalMessagesImportEnabled?: boolean | number
editableProfileFields?: boolean | number
defaultRole?: RoleGenqlSelection
- fastModel?: boolean | number
- smartModel?: boolean | number
+ aiChatModelTier?: boolean | number
+ aiAgentModelTier?: boolean | number
+ isAutoModelSelectionEnabled?: boolean | number
+ aiModelIdByTier?: boolean | number
aiAdditionalInstructions?: boolean | number
- enabledAiModelIds?: boolean | number
- useRecommendedModels?: boolean | number
- routerModel?: boolean | number
workspaceCustomApplication?: ApplicationGenqlSelection
featureFlags?: FeatureFlagGenqlSelection
billingSubscriptions?: BillingSubscriptionGenqlSelection
@@ -5222,12 +5234,24 @@ export interface ClientAiModelConfigGenqlSelection{
outputCostPerMillionTokens?: boolean | number
nativeCapabilities?: NativeModelCapabilitiesGenqlSelection
isDeprecated?: boolean | number
- isRecommended?: boolean | number
providerName?: boolean | number
providerLabel?: boolean | number
contextWindowTokens?: boolean | number
maxOutputTokens?: boolean | number
dataResidency?: boolean | number
+ intelligenceIndex?: boolean | number
+ outputTokensPerSecond?: boolean | number
+ costPerTask?: boolean | number
+ efforts?: boolean | number
+ effort?: boolean | number
+ isBenchmarkInherited?: boolean | number
+ __typename?: boolean | number
+ __scalar?: boolean | number
+}
+
+export interface ClientAiModelTierConfigGenqlSelection{
+ tier?: boolean | number
+ modelId?: boolean | number
__typename?: boolean | number
__scalar?: boolean | number
}
@@ -5299,6 +5323,7 @@ export interface ClientConfigGenqlSelection{
authProviders?: AuthProvidersGenqlSelection
billing?: BillingGenqlSelection
aiModels?: ClientAiModelConfigGenqlSelection
+ aiModelTiers?: ClientAiModelTierConfigGenqlSelection
signInPrefilled?: boolean | number
isMultiWorkspaceEnabled?: boolean | number
isEmailVerificationRequired?: boolean | number
@@ -7416,7 +7441,7 @@ export interface ActivateWorkspaceInput {
/** Deprecated: the workspace name is set at creation (signUpInNewWorkspace) and this field is ignored during activation. Kept for backward compatibility. */
displayName?: (Scalars['String'] | null)}
-export interface UpdateWorkspaceInput {subdomain?: (Scalars['String'] | null),customDomain?: (Scalars['String'] | null),displayName?: (Scalars['String'] | null),logo?: (Scalars['String'] | null),inviteHash?: (Scalars['String'] | null),isPublicInviteLinkEnabled?: (Scalars['Boolean'] | null),workspaceDiscoverability?: (WorkspaceDiscoverability | null),allowImpersonation?: (Scalars['Boolean'] | null),isGoogleAuthEnabled?: (Scalars['Boolean'] | null),isMicrosoftAuthEnabled?: (Scalars['Boolean'] | null),isPasswordAuthEnabled?: (Scalars['Boolean'] | null),isGoogleAuthBypassEnabled?: (Scalars['Boolean'] | null),isMicrosoftAuthBypassEnabled?: (Scalars['Boolean'] | null),isPasswordAuthBypassEnabled?: (Scalars['Boolean'] | null),defaultRoleId?: (Scalars['UUID'] | null),isTwoFactorAuthenticationEnforced?: (Scalars['Boolean'] | null),trashRetentionDays?: (Scalars['Float'] | null),eventLogRetentionDays?: (Scalars['Float'] | null),fastModel?: (Scalars['String'] | null),smartModel?: (Scalars['String'] | null),aiAdditionalInstructions?: (Scalars['String'] | null),editableProfileFields?: (Scalars['String'][] | null),enabledAiModelIds?: (Scalars['String'][] | null),useRecommendedModels?: (Scalars['Boolean'] | null),isInternalMessagesImportEnabled?: (Scalars['Boolean'] | null)}
+export interface UpdateWorkspaceInput {subdomain?: (Scalars['String'] | null),customDomain?: (Scalars['String'] | null),displayName?: (Scalars['String'] | null),logo?: (Scalars['String'] | null),inviteHash?: (Scalars['String'] | null),isPublicInviteLinkEnabled?: (Scalars['Boolean'] | null),workspaceDiscoverability?: (WorkspaceDiscoverability | null),allowImpersonation?: (Scalars['Boolean'] | null),isGoogleAuthEnabled?: (Scalars['Boolean'] | null),isMicrosoftAuthEnabled?: (Scalars['Boolean'] | null),isPasswordAuthEnabled?: (Scalars['Boolean'] | null),isGoogleAuthBypassEnabled?: (Scalars['Boolean'] | null),isMicrosoftAuthBypassEnabled?: (Scalars['Boolean'] | null),isPasswordAuthBypassEnabled?: (Scalars['Boolean'] | null),defaultRoleId?: (Scalars['UUID'] | null),isTwoFactorAuthenticationEnforced?: (Scalars['Boolean'] | null),trashRetentionDays?: (Scalars['Float'] | null),eventLogRetentionDays?: (Scalars['Float'] | null),aiChatModelTier?: (AiModelTier | null),aiAgentModelTier?: (AiModelTier | null),isAutoModelSelectionEnabled?: (Scalars['Boolean'] | null),aiModelIdByTier?: (Scalars['JSON'] | null),aiAdditionalInstructions?: (Scalars['String'] | null),editableProfileFields?: (Scalars['String'][] | null),isInternalMessagesImportEnabled?: (Scalars['Boolean'] | null)}
export interface CreateApplicationRegistrationInput {name: Scalars['String'],universalIdentifier?: (Scalars['String'] | null),oAuthRedirectUris?: (Scalars['String'][] | null),oAuthScopes?: (Scalars['String'][] | null)}
@@ -8700,6 +8725,14 @@ export interface LogicFunctionLogsInput {applicationId?: (Scalars['UUID'] | null
+ const ClientAiModelTierConfig_possibleTypes: string[] = ['ClientAiModelTierConfig']
+ export const isClientAiModelTierConfig = (obj?: { __typename?: any } | null): obj is ClientAiModelTierConfig => {
+ if (!obj?.__typename) throw new Error('__typename is missing in "isClientAiModelTierConfig"')
+ return ClientAiModelTierConfig_possibleTypes.includes(obj.__typename)
+ }
+
+
+
const Billing_possibleTypes: string[] = ['Billing']
export const isBilling = (obj?: { __typename?: any } | null): obj is Billing => {
if (!obj?.__typename) throw new Error('__typename is missing in "isBilling"')
@@ -10226,6 +10259,14 @@ export const enumWorkspaceActivationStatus = {
SUSPENDED: 'SUSPENDED' as const
}
+export const enumAiModelTier = {
+ extraFast: 'extraFast' as const,
+ fast: 'fast' as const,
+ balanced: 'balanced' as const,
+ smart: 'smart' as const,
+ extraSmart: 'extraSmart' as const
+}
+
export const enumOnboardingStatus = {
PLAN_REQUIRED: 'PLAN_REQUIRED' as const,
WORKSPACE_ACTIVATION: 'WORKSPACE_ACTIVATION' as const,
diff --git a/packages/twenty-client-sdk/src/metadata/generated/types.ts b/packages/twenty-client-sdk/src/metadata/generated/types.ts
index f1f51c5d450..b91973e84b0 100644
--- a/packages/twenty-client-sdk/src/metadata/generated/types.ts
+++ b/packages/twenty-client-sdk/src/metadata/generated/types.ts
@@ -33,74 +33,75 @@ export default {
68,
70,
71,
- 73,
+ 72,
74,
- 81,
- 84,
- 89,
+ 75,
+ 82,
+ 85,
90,
- 93,
+ 91,
94,
- 96,
- 99,
+ 95,
+ 97,
100,
- 110,
- 125,
- 131,
+ 101,
+ 111,
+ 126,
132,
133,
- 135,
- 144,
- 146,
- 153,
- 155,
- 158,
- 160,
- 175,
+ 134,
+ 136,
+ 145,
+ 147,
+ 154,
+ 156,
+ 159,
+ 161,
176,
177,
- 185,
- 190,
- 197,
+ 178,
+ 186,
+ 191,
198,
- 205,
- 208,
- 211,
- 222,
- 241,
- 242,
+ 199,
+ 206,
+ 210,
+ 213,
+ 224,
+ 243,
244,
- 249,
- 252,
- 261,
- 292,
- 299,
- 307,
- 308,
+ 246,
+ 251,
+ 254,
+ 263,
+ 294,
+ 301,
309,
+ 310,
311,
- 312,
313,
314,
315,
316,
317,
- 325,
- 326,
- 329,
- 366,
- 373,
+ 318,
+ 319,
+ 327,
+ 328,
+ 331,
+ 368,
375,
- 376,
377,
378,
+ 379,
380,
382,
- 387,
- 402,
- 414,
- 531,
- 557
+ 384,
+ 389,
+ 404,
+ 416,
+ 533,
+ 559
],
"types": {
"BillingProductDTO": {
@@ -114,13 +115,13 @@ export default {
1
],
"metadata": [
- 130
+ 131
],
"on_BillingLicensedProduct": [
- 139
+ 140
],
"on_BillingMeteredProduct": [
- 140
+ 141
],
"__typename": [
1
@@ -576,7 +577,7 @@ export default {
1
],
"fields": [
- 256,
+ 258,
{
"paging": [
27,
@@ -589,7 +590,7 @@ export default {
}
],
"indexMetadatas": [
- 257,
+ 259,
{
"paging": [
27,
@@ -602,13 +603,13 @@ export default {
}
],
"fieldsList": [
- 243
+ 245
],
"indexMetadataList": [
- 251
+ 253
],
"searchFieldMetadataList": [
- 259
+ 261
],
"__typename": [
1
@@ -1124,7 +1125,7 @@ export default {
3
],
"user": [
- 72
+ 73
],
"userId": [
3
@@ -1626,44 +1627,41 @@ export default {
"defaultRole": [
48
],
- "fastModel": [
- 1
- ],
- "smartModel": [
- 1
- ],
- "aiAdditionalInstructions": [
- 1
+ "aiChatModelTier": [
+ 72
],
- "enabledAiModelIds": [
- 1
+ "aiAgentModelTier": [
+ 72
],
- "useRecommendedModels": [
+ "isAutoModelSelectionEnabled": [
8
],
- "routerModel": [
+ "aiModelIdByTier": [
+ 9
+ ],
+ "aiAdditionalInstructions": [
1
],
"workspaceCustomApplication": [
49
],
"featureFlags": [
- 189
+ 190
],
"billingSubscriptions": [
- 143
+ 144
],
"installedApplications": [
49
],
"currentBillingSubscription": [
- 143
+ 144
],
"billingCustomer": [
- 142
+ 143
],
"billingEntitlements": [
- 260
+ 262
],
"hasValidSignedEnterpriseKey": [
8
@@ -1672,7 +1670,7 @@ export default {
8
],
"workspaceUrls": [
- 191
+ 192
],
"workspaceCustomApplicationId": [
1
@@ -1683,6 +1681,7 @@ export default {
},
"WorkspaceDiscoverability": {},
"WorkspaceActivationStatus": {},
+ "AiModelTier": {},
"User": {
"id": [
3
@@ -1727,10 +1726,10 @@ export default {
51
],
"onboardingStatus": [
- 73
+ 74
],
"previousOnboardingStatus": [
- 73
+ 74
],
"currentWorkspace": [
69
@@ -1739,13 +1738,13 @@ export default {
51
],
"userVars": [
- 74
+ 75
],
"workspaceMembers": [
35
],
"deletedWorkspaceMembers": [
- 232
+ 234
],
"hasPassword": [
8
@@ -1760,7 +1759,7 @@ export default {
51
],
"availableWorkspaces": [
- 231
+ 233
],
"__typename": [
1
@@ -1897,19 +1896,19 @@ export default {
1
],
"type": [
- 81
+ 82
],
"objectMetadataId": [
3
],
"gridPosition": [
- 79
+ 80
],
"position": [
- 82
+ 83
],
"configuration": [
- 87
+ 88
],
"conditionalDisplay": [
9
@@ -1939,13 +1938,13 @@ export default {
"WidgetType": {},
"PageLayoutWidgetPosition": {
"on_PageLayoutWidgetGridPosition": [
- 83
+ 84
],
"on_PageLayoutWidgetVerticalListPosition": [
- 85
+ 86
],
"on_PageLayoutWidgetCanvasPosition": [
- 86
+ 87
],
"__typename": [
1
@@ -1953,7 +1952,7 @@ export default {
},
"PageLayoutWidgetGridPosition": {
"layoutMode": [
- 84
+ 85
],
"row": [
28
@@ -1974,7 +1973,7 @@ export default {
"PageLayoutTabLayoutMode": {},
"PageLayoutWidgetVerticalListPosition": {
"layoutMode": [
- 84
+ 85
],
"index": [
28
@@ -1985,7 +1984,7 @@ export default {
},
"PageLayoutWidgetCanvasPosition": {
"layoutMode": [
- 84
+ 85
],
"__typename": [
1
@@ -1993,85 +1992,85 @@ export default {
},
"WidgetConfiguration": {
"on_AggregateChartConfiguration": [
- 88
+ 89
],
"on_StandaloneRichTextConfiguration": [
- 91
+ 92
],
"on_PieChartConfiguration": [
- 92
+ 93
],
"on_LineChartConfiguration": [
- 95
+ 96
],
"on_IframeConfiguration": [
- 97
+ 98
],
"on_BarChartConfiguration": [
- 98
+ 99
],
"on_CalendarConfiguration": [
- 101
+ 102
],
"on_FrontComponentConfiguration": [
- 102
+ 103
],
"on_EmailsConfiguration": [
- 103
+ 104
],
"on_EmailThreadConfiguration": [
- 104
+ 105
],
"on_CallRecordingSummaryConfiguration": [
- 105
+ 106
],
"on_CallRecordingTranscriptConfiguration": [
- 106
+ 107
],
"on_MessageCampaignBodyConfiguration": [
- 107
+ 108
],
"on_MessageCampaignDetailsConfiguration": [
- 108
+ 109
],
"on_FieldConfiguration": [
- 109
+ 110
],
"on_FieldRichTextConfiguration": [
- 111
+ 112
],
"on_FieldsConfiguration": [
- 112
+ 113
],
"on_FormFieldConfiguration": [
- 113
+ 114
],
"on_FilesConfiguration": [
- 114
+ 115
],
"on_NotesConfiguration": [
- 115
+ 116
],
"on_TasksConfiguration": [
- 116
+ 117
],
"on_TimelineConfiguration": [
- 117
+ 118
],
"on_ViewConfiguration": [
- 118
+ 119
],
"on_RecordTableConfiguration": [
- 119
+ 120
],
"on_WorkflowConfiguration": [
- 120
+ 121
],
"on_WorkflowRunConfiguration": [
- 121
+ 122
],
"on_WorkflowVersionConfiguration": [
- 122
+ 123
],
"__typename": [
1
@@ -2079,7 +2078,7 @@ export default {
},
"AggregateChartConfiguration": {
"configurationType": [
- 89
+ 90
],
"aggregateFieldMetadataId": [
3
@@ -2094,7 +2093,7 @@ export default {
8
],
"numberFormat": [
- 90
+ 91
],
"description": [
1
@@ -2115,7 +2114,7 @@ export default {
1
],
"ratioAggregateConfig": [
- 77
+ 78
],
"__typename": [
1
@@ -2125,10 +2124,10 @@ export default {
"ChartNumberFormat": {},
"StandaloneRichTextConfiguration": {
"configurationType": [
- 89
+ 90
],
"body": [
- 78
+ 79
],
"__typename": [
1
@@ -2136,7 +2135,7 @@ export default {
},
"PieChartConfiguration": {
"configurationType": [
- 89
+ 90
],
"aggregateFieldMetadataId": [
3
@@ -2151,10 +2150,10 @@ export default {
1
],
"dateGranularity": [
- 93
+ 94
],
"orderBy": [
- 94
+ 95
],
"manualSortOrder": [
1
@@ -2172,7 +2171,7 @@ export default {
8
],
"numberFormat": [
- 90
+ 91
],
"splitMultiValueFields": [
8
@@ -2200,7 +2199,7 @@ export default {
"GraphOrderBy": {},
"LineChartConfiguration": {
"configurationType": [
- 89
+ 90
],
"aggregateFieldMetadataId": [
3
@@ -2215,10 +2214,10 @@ export default {
1
],
"primaryAxisDateGranularity": [
- 93
+ 94
],
"primaryAxisOrderBy": [
- 94
+ 95
],
"primaryAxisManualSortOrder": [
1
@@ -2230,10 +2229,10 @@ export default {
1
],
"secondaryAxisGroupByDateGranularity": [
- 93
+ 94
],
"secondaryAxisOrderBy": [
- 94
+ 95
],
"secondaryAxisManualSortOrder": [
1
@@ -2245,7 +2244,7 @@ export default {
8
],
"axisNameDisplay": [
- 96
+ 97
],
"displayDataLabel": [
8
@@ -2254,7 +2253,7 @@ export default {
8
],
"numberFormat": [
- 90
+ 91
],
"rangeMin": [
15
@@ -2290,7 +2289,7 @@ export default {
"AxisNameDisplay": {},
"IframeConfiguration": {
"configurationType": [
- 89
+ 90
],
"url": [
1
@@ -2301,7 +2300,7 @@ export default {
},
"BarChartConfiguration": {
"configurationType": [
- 89
+ 90
],
"aggregateFieldMetadataId": [
3
@@ -2316,10 +2315,10 @@ export default {
1
],
"primaryAxisDateGranularity": [
- 93
+ 94
],
"primaryAxisOrderBy": [
- 94
+ 95
],
"primaryAxisManualSortOrder": [
1
@@ -2331,10 +2330,10 @@ export default {
1
],
"secondaryAxisGroupByDateGranularity": [
- 93
+ 94
],
"secondaryAxisOrderBy": [
- 94
+ 95
],
"secondaryAxisManualSortOrder": [
1
@@ -2346,7 +2345,7 @@ export default {
8
],
"axisNameDisplay": [
- 96
+ 97
],
"displayDataLabel": [
8
@@ -2355,7 +2354,7 @@ export default {
8
],
"numberFormat": [
- 90
+ 91
],
"rangeMin": [
15
@@ -2373,10 +2372,10 @@ export default {
9
],
"groupMode": [
- 99
+ 100
],
"layout": [
- 100
+ 101
],
"isCumulative": [
8
@@ -2395,7 +2394,7 @@ export default {
"BarChartLayout": {},
"CalendarConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2403,7 +2402,7 @@ export default {
},
"FrontComponentConfiguration": {
"configurationType": [
- 89
+ 90
],
"frontComponentId": [
3
@@ -2417,7 +2416,7 @@ export default {
},
"EmailsConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2425,7 +2424,7 @@ export default {
},
"EmailThreadConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2433,7 +2432,7 @@ export default {
},
"CallRecordingSummaryConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2441,7 +2440,7 @@ export default {
},
"CallRecordingTranscriptConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2449,7 +2448,7 @@ export default {
},
"MessageCampaignBodyConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2457,7 +2456,7 @@ export default {
},
"MessageCampaignDetailsConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2465,13 +2464,13 @@ export default {
},
"FieldConfiguration": {
"configurationType": [
- 89
+ 90
],
"fieldMetadataId": [
1
],
"fieldDisplayMode": [
- 110
+ 111
],
"viewId": [
1
@@ -2489,7 +2488,7 @@ export default {
"FieldDisplayMode": {},
"FieldRichTextConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2497,7 +2496,7 @@ export default {
},
"FieldsConfiguration": {
"configurationType": [
- 89
+ 90
],
"viewId": [
1
@@ -2514,7 +2513,7 @@ export default {
},
"FormFieldConfiguration": {
"configurationType": [
- 89
+ 90
],
"fieldMetadataId": [
1
@@ -2525,7 +2524,7 @@ export default {
},
"FilesConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2533,7 +2532,7 @@ export default {
},
"NotesConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2541,7 +2540,7 @@ export default {
},
"TasksConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2549,7 +2548,7 @@ export default {
},
"TimelineConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2557,7 +2556,7 @@ export default {
},
"ViewConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2565,7 +2564,7 @@ export default {
},
"RecordTableConfiguration": {
"configurationType": [
- 89
+ 90
],
"viewId": [
1
@@ -2582,7 +2581,7 @@ export default {
},
"WorkflowConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2590,7 +2589,7 @@ export default {
},
"WorkflowRunConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2598,7 +2597,7 @@ export default {
},
"WorkflowVersionConfiguration": {
"configurationType": [
- 89
+ 90
],
"__typename": [
1
@@ -2627,13 +2626,13 @@ export default {
3
],
"widgets": [
- 80
+ 81
],
"icon": [
1
],
"layoutMode": [
- 84
+ 85
],
"createdAt": [
4
@@ -2662,13 +2661,13 @@ export default {
1
],
"type": [
- 125
+ 126
],
"objectMetadataId": [
3
],
"tabs": [
- 123
+ 124
],
"defaultTabToFocusOnMobileAndSidePanelId": [
3
@@ -2727,7 +2726,7 @@ export default {
1
],
"oauth": [
- 126
+ 127
],
"logoUrl": [
1
@@ -2755,7 +2754,7 @@ export default {
15
],
"items": [
- 128
+ 129
],
"__typename": [
1
@@ -2763,13 +2762,13 @@ export default {
},
"BillingProductMetadata": {
"planKey": [
- 131
+ 132
],
"priceUsageBased": [
- 132
+ 133
],
"productKey": [
- 133
+ 134
],
"isLegacy": [
1
@@ -2783,7 +2782,7 @@ export default {
"BillingProductKey": {},
"BillingPriceLicensed": {
"recurringInterval": [
- 135
+ 136
],
"unitAmount": [
15
@@ -2792,7 +2791,7 @@ export default {
1
],
"priceUsageType": [
- 132
+ 133
],
"creditAmount": [
15
@@ -2821,16 +2820,16 @@ export default {
},
"BillingPriceMetered": {
"tiers": [
- 136
+ 137
],
"recurringInterval": [
- 135
+ 136
],
"stripePriceId": [
1
],
"priceUsageType": [
- 132
+ 133
],
"__typename": [
1
@@ -2847,7 +2846,7 @@ export default {
1
],
"metadata": [
- 130
+ 131
],
"__typename": [
1
@@ -2864,10 +2863,10 @@ export default {
1
],
"metadata": [
- 130
+ 131
],
"prices": [
- 134
+ 135
],
"__typename": [
1
@@ -2884,10 +2883,10 @@ export default {
1
],
"metadata": [
- 130
+ 131
],
"prices": [
- 137
+ 138
],
"__typename": [
1
@@ -2935,13 +2934,13 @@ export default {
3
],
"status": [
- 144
+ 145
],
"interval": [
- 135
+ 136
],
"billingSubscriptionItems": [
- 141
+ 142
],
"currentPeriodEnd": [
4
@@ -2950,7 +2949,7 @@ export default {
9
],
"phases": [
- 129
+ 130
],
"cancelAt": [
4
@@ -2971,7 +2970,7 @@ export default {
15
],
"status": [
- 146
+ 147
],
"error": [
9
@@ -3089,7 +3088,7 @@ export default {
3
],
"type": [
- 153
+ 154
],
"name": [
1
@@ -3122,7 +3121,7 @@ export default {
4
],
"targetRecordIdentifier": [
- 151
+ 152
],
"__typename": [
1
@@ -3134,7 +3133,7 @@ export default {
1
],
"state": [
- 155
+ 156
],
"attemptsMade": [
28
@@ -3175,7 +3174,7 @@ export default {
},
"MetadataEvent": {
"type": [
- 158
+ 159
],
"metadataName": [
1
@@ -3184,7 +3183,7 @@ export default {
1
],
"properties": [
- 156
+ 157
],
"updatedCollectionHash": [
1
@@ -3196,7 +3195,7 @@ export default {
"MetadataEventAction": {},
"ObjectRecordEvent": {
"action": [
- 160
+ 161
],
"objectNameSingular": [
1
@@ -3211,7 +3210,7 @@ export default {
1
],
"properties": [
- 156
+ 157
],
"__typename": [
1
@@ -3223,7 +3222,7 @@ export default {
1
],
"objectRecordEvent": [
- 159
+ 160
],
"__typename": [
1
@@ -3234,13 +3233,13 @@ export default {
1
],
"objectRecordEventsWithQueryIds": [
- 161
+ 162
],
"metadataEvents": [
- 157
+ 158
],
"queueJobEvents": [
- 154
+ 155
],
"__typename": [
1
@@ -3283,7 +3282,7 @@ export default {
},
"BillingEndTrialPeriod": {
"status": [
- 144
+ 145
],
"hasPaymentMethod": [
8
@@ -3292,10 +3291,10 @@ export default {
1
],
"currentBillingSubscription": [
- 143
+ 144
],
"billingSubscriptions": [
- 143
+ 144
],
"__typename": [
1
@@ -3303,7 +3302,7 @@ export default {
},
"BillingResourceCreditUsage": {
"productKey": [
- 133
+ 134
],
"periodStart": [
4
@@ -3332,16 +3331,16 @@ export default {
},
"BillingPlan": {
"planKey": [
- 131
+ 132
],
"baseProducts": [
- 139
+ 140
],
"resourceCreditProducts": [
- 139
+ 140
],
"meteredProducts": [
- 140
+ 141
],
"__typename": [
1
@@ -3368,10 +3367,10 @@ export default {
},
"BillingUpdate": {
"currentBillingSubscription": [
- 143
+ 144
],
"billingSubscriptions": [
- 143
+ 144
],
"__typename": [
1
@@ -3407,7 +3406,7 @@ export default {
1
],
"dailyUsage": [
- 171
+ 172
],
"__typename": [
1
@@ -3415,19 +3414,19 @@ export default {
},
"UsageAnalytics": {
"usageByUser": [
- 170
+ 171
],
"usageByOperationType": [
- 170
+ 171
],
"usageByApplication": [
- 170
+ 171
],
"usageByModel": [
- 170
+ 171
],
"timeSeries": [
- 171
+ 172
],
"periodStart": [
4
@@ -3436,7 +3435,7 @@ export default {
4
],
"userDailyUsage": [
- 172
+ 173
],
"__typename": [
1
@@ -3447,10 +3446,10 @@ export default {
3
],
"resourceType": [
- 175
+ 176
],
"operationType": [
- 176
+ 177
],
"spenderType": [
1
@@ -3471,10 +3470,10 @@ export default {
1
],
"limitValue": [
- 177
+ 178
],
"burstValue": [
- 177
+ 178
],
"createdAt": [
4
@@ -3519,10 +3518,10 @@ export default {
},
"OnboardingStepNavigation": {
"onboardingStatus": [
- 73
+ 74
],
"previousOnboardingStatus": [
- 73
+ 74
],
"__typename": [
1
@@ -3561,7 +3560,7 @@ export default {
1
],
"result": [
- 182
+ 183
],
"__typename": [
1
@@ -3578,7 +3577,7 @@ export default {
1
],
"connectionSecurity": [
- 185
+ 186
],
"__typename": [
1
@@ -3587,13 +3586,13 @@ export default {
"EmailConnectionSecurity": {},
"PublicImapSmtpCaldavConnectionParameters": {
"IMAP": [
- 184
+ 185
],
"SMTP": [
- 184
+ 185
],
"CALDAV": [
- 184
+ 185
],
"__typename": [
1
@@ -3652,7 +3651,7 @@ export default {
4
],
"connectionParameters": [
- 186
+ 187
],
"__typename": [
1
@@ -3711,7 +3710,7 @@ export default {
4
],
"connectionParameters": [
- 186
+ 187
],
"isOwnedByCurrentUser": [
8
@@ -3722,7 +3721,7 @@ export default {
},
"FeatureFlag": {
"key": [
- 190
+ 191
],
"value": [
8
@@ -3806,7 +3805,7 @@ export default {
1
],
"versionDistribution": [
- 193
+ 194
],
"__typename": [
1
@@ -3831,10 +3830,10 @@ export default {
1
],
"type": [
- 197
+ 198
],
"status": [
- 198
+ 199
],
"issuer": [
1
@@ -3847,7 +3846,7 @@ export default {
"SSOIdentityProviderStatus": {},
"AuthProviders": {
"sso": [
- 196
+ 197
],
"google": [
8
@@ -3884,10 +3883,10 @@ export default {
3
],
"authProviders": [
- 199
+ 200
],
"authBypassProviders": [
- 200
+ 201
],
"logo": [
1
@@ -3896,7 +3895,7 @@ export default {
1
],
"workspaceUrls": [
- 191
+ 192
],
"__typename": [
1
@@ -3935,7 +3934,7 @@ export default {
1
],
"modelFamily": [
- 205
+ 206
],
"modelFamilyLabel": [
1
@@ -3950,14 +3949,11 @@ export default {
15
],
"nativeCapabilities": [
- 203
+ 204
],
"isDeprecated": [
8
],
- "isRecommended": [
- 8
- ],
"providerName": [
1
],
@@ -3973,11 +3969,40 @@ export default {
"dataResidency": [
1
],
+ "intelligenceIndex": [
+ 15
+ ],
+ "outputTokensPerSecond": [
+ 15
+ ],
+ "costPerTask": [
+ 15
+ ],
+ "efforts": [
+ 1
+ ],
+ "effort": [
+ 1
+ ],
+ "isBenchmarkInherited": [
+ 8
+ ],
"__typename": [
1
]
},
"ModelFamily": {},
+ "ClientAiModelTierConfig": {
+ "tier": [
+ 72
+ ],
+ "modelId": [
+ 1
+ ],
+ "__typename": [
+ 1
+ ]
+ },
"Billing": {
"isBillingEnabled": [
8
@@ -3989,7 +4014,7 @@ export default {
1
],
"trialPeriods": [
- 195
+ 196
],
"__typename": [
1
@@ -3997,7 +4022,7 @@ export default {
},
"Support": {
"supportDriver": [
- 208
+ 210
],
"supportFrontChatId": [
1
@@ -4026,7 +4051,7 @@ export default {
},
"Captcha": {
"provider": [
- 211
+ 213
],
"siteKey": [
1
@@ -4063,10 +4088,10 @@ export default {
},
"PublicFeatureFlag": {
"key": [
- 190
+ 191
],
"metadata": [
- 213
+ 215
],
"__typename": [
1
@@ -4091,13 +4116,16 @@ export default {
1
],
"authProviders": [
- 199
+ 200
],
"billing": [
- 206
+ 208
],
"aiModels": [
- 204
+ 205
+ ],
+ "aiModelTiers": [
+ 207
],
"signInPrefilled": [
8
@@ -4121,25 +4149,25 @@ export default {
8
],
"support": [
- 207
+ 209
],
"isAttachmentPreviewEnabled": [
8
],
"sentry": [
- 209
+ 211
],
"captcha": [
- 210
+ 212
],
"api": [
- 212
+ 214
],
"canManageFeatureFlags": [
8
],
"publicFeatureFlags": [
- 214
+ 216
],
"isCookieSessionEnabled": [
8
@@ -4193,7 +4221,7 @@ export default {
1
],
"maintenance": [
- 215
+ 217
],
"__typename": [
1
@@ -4230,7 +4258,7 @@ export default {
},
"CreateApplicationRegistration": {
"applicationRegistration": [
- 75
+ 76
],
"clientSecret": [
1
@@ -4269,7 +4297,7 @@ export default {
},
"AppConnection": {
"id": [
- 222
+ 224
],
"providerName": [
1
@@ -4327,7 +4355,7 @@ export default {
3
],
"type": [
- 197
+ 198
],
"issuer": [
1
@@ -4336,7 +4364,7 @@ export default {
1
],
"status": [
- 198
+ 199
],
"__typename": [
1
@@ -4355,7 +4383,7 @@ export default {
},
"FindAvailableSSOIDP": {
"type": [
- 197
+ 198
],
"id": [
3
@@ -4367,10 +4395,10 @@ export default {
1
],
"status": [
- 198
+ 199
],
"workspace": [
- 226
+ 228
],
"__typename": [
1
@@ -4381,7 +4409,7 @@ export default {
3
],
"type": [
- 197
+ 198
],
"issuer": [
1
@@ -4390,7 +4418,7 @@ export default {
1
],
"status": [
- 198
+ 199
],
"__typename": [
1
@@ -4398,7 +4426,7 @@ export default {
},
"SSOConnection": {
"type": [
- 197
+ 198
],
"id": [
3
@@ -4410,7 +4438,7 @@ export default {
1
],
"status": [
- 198
+ 199
],
"__typename": [
1
@@ -4433,13 +4461,13 @@ export default {
1
],
"workspaceUrls": [
- 191
+ 192
],
"logo": [
1
],
"sso": [
- 229
+ 231
],
"__typename": [
1
@@ -4447,10 +4475,10 @@ export default {
},
"AvailableWorkspaces": {
"availableWorkspacesForSignIn": [
- 230
+ 232
],
"availableWorkspacesForSignUp": [
- 230
+ 232
],
"__typename": [
1
@@ -4583,10 +4611,10 @@ export default {
1
],
"objectPermissions": [
- 234
+ 236
],
"fieldPermissions": [
- 235
+ 237
],
"__typename": [
1
@@ -4657,7 +4685,7 @@ export default {
1
],
"roles": [
- 236
+ 238
],
"manifest": [
9
@@ -4684,13 +4712,13 @@ export default {
},
"WorkspaceCompanyEnrichmentResult": {
"outcome": [
- 241
+ 243
],
"enrichment": [
9
],
"personOutcome": [
- 242
+ 244
],
"personEnrichment": [
9
@@ -4712,7 +4740,7 @@ export default {
1
],
"type": [
- 244
+ 246
],
"name": [
1
@@ -4784,10 +4812,10 @@ export default {
23
],
"relation": [
- 248
+ 250
],
"morphRelations": [
- 248
+ 250
],
"__typename": [
1
@@ -4813,7 +4841,7 @@ export default {
},
"FieldEdge": {
"node": [
- 243
+ 245
],
"cursor": [
29
@@ -4824,10 +4852,10 @@ export default {
},
"FieldConnection": {
"pageInfo": [
- 245
+ 247
],
"edges": [
- 246
+ 248
],
"__typename": [
1
@@ -4835,7 +4863,7 @@ export default {
},
"Relation": {
"type": [
- 249
+ 251
],
"sourceObjectMetadata": [
23
@@ -4844,10 +4872,10 @@ export default {
23
],
"sourceFieldMetadata": [
- 243
+ 245
],
"targetFieldMetadata": [
- 243
+ 245
],
"__typename": [
1
@@ -4894,7 +4922,7 @@ export default {
1
],
"indexType": [
- 252
+ 254
],
"createdAt": [
4
@@ -4903,7 +4931,7 @@ export default {
4
],
"indexFieldMetadataList": [
- 250
+ 252
],
"__typename": [
1
@@ -4912,7 +4940,7 @@ export default {
"IndexType": {},
"IndexEdge": {
"node": [
- 251
+ 253
],
"cursor": [
29
@@ -4934,10 +4962,10 @@ export default {
},
"ObjectConnection": {
"pageInfo": [
- 245
+ 247
],
"edges": [
- 254
+ 256
],
"__typename": [
1
@@ -4945,10 +4973,10 @@ export default {
},
"ObjectFieldsConnection": {
"pageInfo": [
- 245
+ 247
],
"edges": [
- 246
+ 248
],
"__typename": [
1
@@ -4956,10 +4984,10 @@ export default {
},
"ObjectIndexMetadatasConnection": {
"pageInfo": [
- 245
+ 247
],
"edges": [
- 253
+ 255
],
"__typename": [
1
@@ -5001,7 +5029,7 @@ export default {
},
"BillingEntitlement": {
"key": [
- 261
+ 263
],
"value": [
8
@@ -5039,7 +5067,7 @@ export default {
1
],
"records": [
- 262
+ 264
],
"isCustomDomainEnabled": [
8
@@ -5112,10 +5140,10 @@ export default {
},
"AvailableWorkspacesAndAccessTokens": {
"tokens": [
- 270
+ 272
],
"availableWorkspaces": [
- 231
+ 233
],
"__typename": [
1
@@ -5153,7 +5181,7 @@ export default {
},
"WorkspaceUrlsAndId": {
"workspaceUrls": [
- 191
+ 192
],
"id": [
3
@@ -5167,7 +5195,7 @@ export default {
11
],
"workspace": [
- 275
+ 277
],
"__typename": [
1
@@ -5200,7 +5228,7 @@ export default {
11
],
"workspaceUrls": [
- 191
+ 192
],
"__typename": [
1
@@ -5244,7 +5272,7 @@ export default {
},
"AuthTokens": {
"tokens": [
- 270
+ 272
],
"__typename": [
1
@@ -5285,7 +5313,7 @@ export default {
11
],
"workspace": [
- 275
+ 277
],
"__typename": [
1
@@ -5353,7 +5381,7 @@ export default {
1
],
"status": [
- 292
+ 294
],
"reason": [
1
@@ -5379,16 +5407,16 @@ export default {
},
"ApplicationExport": {
"application": [
- 290
+ 292
],
"manifest": [
9
],
"coverage": [
- 291
+ 293
],
"files": [
- 293
+ 295
],
"__typename": [
1
@@ -5424,10 +5452,10 @@ export default {
},
"CompleteApplicationFileUploadsResult": {
"files": [
- 295
+ 297
],
"errors": [
- 296
+ 298
],
"__typename": [
1
@@ -5438,7 +5466,7 @@ export default {
3
],
"fileFolder": [
- 299
+ 301
],
"filePath": [
1
@@ -5459,7 +5487,7 @@ export default {
"FileFolder": {},
"ApplicationFileUploadError": {
"fileFolder": [
- 299
+ 301
],
"filePath": [
1
@@ -5473,10 +5501,10 @@ export default {
},
"CreateApplicationFileUploadsResult": {
"targets": [
- 298
+ 300
],
"errors": [
- 300
+ 302
],
"__typename": [
1
@@ -5558,16 +5586,16 @@ export default {
1
],
"status": [
- 307
+ 309
],
"tenantStatus": [
- 308
+ 310
],
"unsubscribeHostnameStatus": [
- 309
+ 311
],
"verificationRecords": [
- 305
+ 307
],
"verifiedAt": [
4
@@ -5584,7 +5612,7 @@ export default {
3
],
"visibility": [
- 311
+ 313
],
"handle": [
1
@@ -5593,16 +5621,16 @@ export default {
1
],
"type": [
- 312
+ 314
],
"isContactAutoCreationEnabled": [
8
],
"contactAutoCreationPolicy": [
- 313
+ 315
],
"messageFolderImportPolicy": [
- 314
+ 316
],
"excludeNonProfessionalEmails": [
8
@@ -5611,7 +5639,7 @@ export default {
8
],
"pendingGroupEmailsAction": [
- 315
+ 317
],
"isSyncEnabled": [
8
@@ -5620,10 +5648,10 @@ export default {
4
],
"syncStatus": [
- 316
+ 318
],
"syncStage": [
- 317
+ 319
],
"syncStageStartedAt": [
4
@@ -5644,7 +5672,7 @@ export default {
4
],
"connectedAccount": [
- 187
+ 188
],
"__typename": [
1
@@ -5659,7 +5687,7 @@ export default {
"MessageChannelSyncStage": {},
"CreateEmailGroupChannelOutput": {
"messageChannel": [
- 310
+ 312
],
"forwardingAddress": [
1
@@ -5724,7 +5752,7 @@ export default {
28
],
"audience": [
- 319
+ 321
],
"__typename": [
1
@@ -5767,10 +5795,10 @@ export default {
1
],
"reason": [
- 325
+ 327
],
"source": [
- 326
+ 328
],
"unsubscribeTopicId": [
3
@@ -5783,7 +5811,7 @@ export default {
"MessageSuppressionSource": {},
"MessageSuppressionList": {
"records": [
- 324
+ 326
],
"totalCount": [
28
@@ -5809,7 +5837,7 @@ export default {
1
],
"visibility": [
- 329
+ 331
],
"__typename": [
1
@@ -5855,7 +5883,7 @@ export default {
1
],
"location": [
- 331
+ 333
],
"__typename": [
1
@@ -5872,7 +5900,7 @@ export default {
1
],
"connectionSecurity": [
- 185
+ 186
],
"__typename": [
1
@@ -5883,13 +5911,13 @@ export default {
1
],
"IMAP": [
- 333
+ 335
],
"SMTP": [
- 333
+ 335
],
"CALDAV": [
- 333
+ 335
],
"__typename": [
1
@@ -5909,7 +5937,7 @@ export default {
3
],
"connectionParameters": [
- 334
+ 336
],
"__typename": [
1
@@ -6134,7 +6162,7 @@ export default {
1
],
"series": [
- 343
+ 345
],
"xAxisLabel": [
1
@@ -6149,10 +6177,10 @@ export default {
8
],
"layout": [
- 100
+ 101
],
"groupMode": [
- 99
+ 100
],
"hasTooManyGroups": [
8
@@ -6183,7 +6211,7 @@ export default {
1
],
"data": [
- 345
+ 347
],
"__typename": [
1
@@ -6191,7 +6219,7 @@ export default {
},
"LineChartData": {
"series": [
- 346
+ 348
],
"xAxisLabel": [
1
@@ -6228,7 +6256,7 @@ export default {
},
"PieChartData": {
"data": [
- 348
+ 350
],
"showLegend": [
8
@@ -6333,13 +6361,13 @@ export default {
},
"EventLogQueryResult": {
"records": [
- 353
+ 355
],
"totalCount": [
28
],
"pageInfo": [
- 354
+ 356
],
"__typename": [
1
@@ -6403,7 +6431,7 @@ export default {
1
],
"parts": [
- 339
+ 341
],
"processedAt": [
4
@@ -6417,7 +6445,7 @@ export default {
},
"AgentChatThread": {
"id": [
- 222
+ 224
],
"title": [
1
@@ -6472,7 +6500,7 @@ export default {
},
"AiSystemPromptPreview": {
"sections": [
- 359
+ 361
],
"estimatedTokenCount": [
28
@@ -6500,7 +6528,7 @@ export default {
28
],
"error": [
- 361
+ 363
],
"__typename": [
1
@@ -6533,10 +6561,10 @@ export default {
},
"StartWorkspaceSetupChatResult": {
"outcome": [
- 366
+ 368
],
"thread": [
- 358
+ 360
],
"__typename": [
1
@@ -6574,10 +6602,10 @@ export default {
3
],
"evaluations": [
- 367
+ 369
],
"messages": [
- 357
+ 359
],
"createdAt": [
4
@@ -6639,7 +6667,7 @@ export default {
9
],
"scope": [
- 373
+ 375
],
"__typename": [
1
@@ -6654,19 +6682,19 @@ export default {
1
],
"syncStatus": [
- 375
+ 377
],
"syncStage": [
- 376
+ 378
],
"visibility": [
- 377
+ 379
],
"isContactAutoCreationEnabled": [
8
],
"contactAutoCreationPolicy": [
- 378
+ 380
],
"isSyncEnabled": [
8
@@ -6717,7 +6745,7 @@ export default {
1
],
"pendingSyncAction": [
- 380
+ 382
],
"messageChannelId": [
3
@@ -6759,7 +6787,7 @@ export default {
1
],
"provenance": [
- 382
+ 384
],
"__typename": [
1
@@ -6788,7 +6816,7 @@ export default {
3
],
"through": [
- 383
+ 385
],
"__typename": [
1
@@ -6808,7 +6836,7 @@ export default {
1
],
"emit": [
- 384
+ 386
],
"action": [
1
@@ -6843,7 +6871,7 @@ export default {
},
"CollectionHash": {
"collectionName": [
- 387
+ 389
],
"hash": [
1
@@ -6907,13 +6935,13 @@ export default {
},
"MinimalMetadata": {
"objectMetadataItems": [
- 388
+ 390
],
"views": [
- 389
+ 391
],
"collectionHashes": [
- 386
+ 388
],
"__typename": [
1
@@ -6921,10 +6949,10 @@ export default {
},
"Query": {
"navigationMenuItems": [
- 152
+ 153
],
"navigationMenuItem": [
- 152,
+ 153,
{
"id": [
3,
@@ -6933,7 +6961,7 @@ export default {
}
],
"applicationSdkClientChecksums": [
- 76,
+ 77,
{
"applicationId": [
3,
@@ -6967,18 +6995,18 @@ export default {
}
],
"enterpriseSubscriptionStatus": [
- 148
+ 149
],
"getUsageAnalytics": [
- 173,
+ 174,
{
"input": [
- 392
+ 394
]
}
],
"usageLimits": [
- 174
+ 175
],
"getViewFilterGroups": [
55,
@@ -7098,19 +7126,19 @@ export default {
2,
{
"input": [
- 393,
+ 395,
"GetApiKeyInput!"
]
}
],
"currentUserSessions": [
- 163
+ 164
],
"myConnectedAccounts": [
- 187
+ 188
],
"applicationConnectedAccounts": [
- 188,
+ 189,
{
"applicationId": [
3,
@@ -7119,7 +7147,7 @@ export default {
}
],
"applicationConnectionProviders": [
- 127,
+ 128,
{
"applicationId": [
3,
@@ -7128,7 +7156,7 @@ export default {
}
],
"billingPortalSession": [
- 168,
+ 169,
{
"returnUrlPath": [
1
@@ -7139,22 +7167,22 @@ export default {
}
],
"listPlans": [
- 166
+ 167
],
"getResourceCreditUsage": [
- 165
+ 166
],
"getInviteSuggestions": [
- 179
+ 180
],
"findWorkspaceInvitations": [
- 182
+ 183
],
"getApprovedAccessDomains": [
- 178
+ 179
],
"getPageLayoutTabs": [
- 123,
+ 124,
{
"pageLayoutId": [
1,
@@ -7163,7 +7191,7 @@ export default {
}
],
"getPageLayoutTab": [
- 123,
+ 124,
{
"id": [
1,
@@ -7172,18 +7200,18 @@ export default {
}
],
"getPageLayouts": [
- 124,
+ 125,
{
"objectMetadataId": [
1
],
"pageLayoutType": [
- 125
+ 126
]
}
],
"getPageLayout": [
- 124,
+ 125,
{
"id": [
1,
@@ -7192,7 +7220,7 @@ export default {
}
],
"getPageLayoutWidgets": [
- 80,
+ 81,
{
"pageLayoutTabId": [
1,
@@ -7201,7 +7229,7 @@ export default {
}
],
"getPageLayoutWidget": [
- 80,
+ 81,
{
"id": [
1,
@@ -7216,20 +7244,20 @@ export default {
10,
{
"input": [
- 394,
+ 396,
"AgentIdInput!"
]
}
],
"objects": [
- 255,
+ 257,
{
"paging": [
27,
"CursorPaging!"
],
"filter": [
- 395,
+ 397,
"ObjectFilter!"
]
}
@@ -7244,7 +7272,7 @@ export default {
}
],
"objectRecordCounts": [
- 258
+ 260
],
"mostlyEmptyFieldMetadataIds": [
3,
@@ -7259,7 +7287,7 @@ export default {
21,
{
"input": [
- 396,
+ 398,
"LogicFunctionIdInput!"
]
}
@@ -7271,7 +7299,7 @@ export default {
9,
{
"input": [
- 396,
+ 398,
"LogicFunctionIdInput!"
]
}
@@ -7280,7 +7308,7 @@ export default {
1,
{
"input": [
- 396,
+ 398,
"LogicFunctionIdInput!"
]
}
@@ -7313,7 +7341,7 @@ export default {
69
],
"getPublicWorkspaceDataByDomain": [
- 201,
+ 202,
{
"origin": [
1
@@ -7321,7 +7349,7 @@ export default {
}
],
"getPublicWorkspaceDataById": [
- 202,
+ 203,
{
"id": [
3,
@@ -7330,7 +7358,7 @@ export default {
}
],
"findApplicationRegistrationByClientId": [
- 219,
+ 221,
{
"clientId": [
1,
@@ -7339,7 +7367,7 @@ export default {
}
],
"findApplicationRegistrationByUniversalIdentifier": [
- 75,
+ 76,
{
"universalIdentifier": [
1,
@@ -7348,10 +7376,10 @@ export default {
}
],
"findManyApplicationRegistrations": [
- 75
+ 76
],
"findOneApplicationRegistration": [
- 75,
+ 76,
{
"id": [
1,
@@ -7360,7 +7388,7 @@ export default {
}
],
"findApplicationRegistrationStats": [
- 194,
+ 195,
{
"id": [
1,
@@ -7369,7 +7397,7 @@ export default {
}
],
"findApplicationRegistrationVariables": [
- 192,
+ 193,
{
"applicationRegistrationId": [
1,
@@ -7387,7 +7415,7 @@ export default {
}
],
"findClaimableApplicationRegistration": [
- 217,
+ 219,
{
"sourcePackage": [
1
@@ -7421,7 +7449,7 @@ export default {
}
],
"findInstallApplicationJobStatus": [
- 154,
+ 155,
{
"universalIdentifier": [
1,
@@ -7430,7 +7458,7 @@ export default {
}
],
"findUninstallApplicationJobStatus": [
- 154,
+ 155,
{
"universalIdentifier": [
1,
@@ -7439,7 +7467,7 @@ export default {
}
],
"findManyMarketplaceApps": [
- 233,
+ 235,
{
"universalIdentifiers": [
1,
@@ -7448,7 +7476,7 @@ export default {
}
],
"findMarketplaceAppDetail": [
- 237,
+ 239,
{
"universalIdentifier": [
1,
@@ -7457,7 +7485,7 @@ export default {
}
],
"publicMarketplaceApps": [
- 233,
+ 235,
{
"isVetted": [
8,
@@ -7466,7 +7494,7 @@ export default {
}
],
"publicMarketplaceAppDetail": [
- 237,
+ 239,
{
"universalIdentifier": [
1,
@@ -7475,7 +7503,7 @@ export default {
}
],
"fields": [
- 247,
+ 249,
{
"paging": [
27,
@@ -7488,7 +7516,7 @@ export default {
}
],
"field": [
- 243,
+ 245,
{
"id": [
3,
@@ -7517,28 +7545,28 @@ export default {
48
],
"previewMessageCampaignAudience": [
- 319,
+ 321,
{
"input": [
- 397,
+ 399,
"PreviewMessageCampaignAudienceInput!"
]
}
],
"messageSuppressions": [
- 327,
+ 329,
{
"input": [
- 398,
+ 400,
"FindMessageSuppressionsInput!"
]
}
],
"unsubscribeTopics": [
- 328
+ 330
],
"myMessageChannels": [
- 310,
+ 312,
{
"connectedAccountId": [
3
@@ -7546,10 +7574,10 @@ export default {
}
],
"getEmailingDomains": [
- 306
+ 308
],
"getToolIndex": [
- 338
+ 340
],
"getToolInputSchema": [
9,
@@ -7561,10 +7589,10 @@ export default {
}
],
"webhooks": [
- 337
+ 339
],
"webhook": [
- 337,
+ 339,
{
"id": [
3,
@@ -7573,7 +7601,7 @@ export default {
}
],
"myMessageFolders": [
- 379,
+ 381,
{
"messageChannelId": [
3
@@ -7581,7 +7609,7 @@ export default {
}
],
"myCalendarChannels": [
- 374,
+ 376,
{
"connectedAccountId": [
3
@@ -7589,22 +7617,22 @@ export default {
}
],
"minimalMetadata": [
- 390
+ 392
],
"appKeyValue": [
- 372,
+ 374,
{
"key": [
1,
"String!"
],
"scope": [
- 373
+ 375
]
}
],
"getJobs": [
- 154,
+ 155,
{
"jobIds": [
1,
@@ -7613,30 +7641,30 @@ export default {
}
],
"appConnections": [
- 221,
+ 223,
{
"filter": [
- 399
+ 401
]
}
],
"appConnection": [
- 221,
+ 223,
{
"id": [
- 222,
+ 224,
"ID!"
]
}
],
"findWorkspaceAiStats": [
- 369
+ 371
],
"chatThreads": [
- 358
+ 360
],
"chatThread": [
- 358,
+ 360,
{
"id": [
3,
@@ -7645,7 +7673,7 @@ export default {
}
],
"chatMessages": [
- 357,
+ 359,
{
"threadId": [
3,
@@ -7654,7 +7682,7 @@ export default {
}
],
"chatStreamCatchupChunks": [
- 362,
+ 364,
{
"threadId": [
3,
@@ -7663,13 +7691,13 @@ export default {
}
],
"getAiSystemPromptPreview": [
- 360
+ 362
],
"skills": [
- 356
+ 358
],
"skill": [
- 356,
+ 358,
{
"id": [
3,
@@ -7678,7 +7706,7 @@ export default {
}
],
"agentTurns": [
- 368,
+ 370,
{
"agentId": [
3,
@@ -7687,19 +7715,19 @@ export default {
}
],
"timelineActivityTypes": [
- 385
+ 387
],
"metadataTranslations": [
- 381,
+ 383,
{
"input": [
- 400,
+ 402,
"MetadataTranslationsInput!"
]
}
],
"checkUserExists": [
- 285,
+ 287,
{
"email": [
1,
@@ -7711,7 +7739,7 @@ export default {
}
],
"checkWorkspaceInviteHashIsValid": [
- 286,
+ 288,
{
"inviteHash": [
1,
@@ -7729,7 +7757,7 @@ export default {
}
],
"checkWorkspaceSubdomainAvailability": [
- 280,
+ 282,
{
"subdomain": [
1,
@@ -7738,10 +7766,10 @@ export default {
}
],
"getWorkspaceCreationDefaults": [
- 281
+ 283
],
"validatePasswordResetToken": [
- 278,
+ 280,
{
"passwordResetToken": [
1,
@@ -7750,43 +7778,43 @@ export default {
}
],
"currentUser": [
- 72
+ 73
],
"getSSOIdentityProviders": [
- 227
+ 229
],
"eventLogs": [
- 355,
+ 357,
{
"input": [
- 401,
+ 403,
"EventLogQueryInput!"
]
}
],
"pieChartData": [
- 349,
+ 351,
{
"input": [
- 405,
+ 407,
"PieChartDataInput!"
]
}
],
"lineChartData": [
- 347,
+ 349,
{
"input": [
- 406,
+ 408,
"LineChartDataInput!"
]
}
],
"barChartData": [
- 344,
+ 346,
{
"input": [
- 407,
+ 409,
"BarChartDataInput!"
]
}
@@ -7801,7 +7829,7 @@ export default {
}
],
"getConnectedImapSmtpCaldavAccount": [
- 335,
+ 337,
{
"id": [
3,
@@ -7810,7 +7838,7 @@ export default {
}
],
"getAutoCompleteAddress": [
- 330,
+ 332,
{
"address": [
1,
@@ -7829,7 +7857,7 @@ export default {
}
],
"getAddressDetails": [
- 332,
+ 334,
{
"placeId": [
1,
@@ -7842,10 +7870,10 @@ export default {
}
],
"findManyPublicDomains": [
- 304
+ 306
],
"exportApplication": [
- 294,
+ 296,
{
"universalIdentifier": [
3,
@@ -7854,7 +7882,7 @@ export default {
}
],
"currentUserApplicationAuthorizations": [
- 289
+ 291
],
"__typename": [
1
@@ -7871,7 +7899,7 @@ export default {
1
],
"operationTypes": [
- 176
+ 177
],
"__typename": [
1
@@ -7895,10 +7923,10 @@ export default {
},
"ObjectFilter": {
"and": [
- 395
+ 397
],
"or": [
- 395
+ 397
],
"id": [
31
@@ -7933,7 +7961,7 @@ export default {
},
"LogicFunctionIdInput": {
"id": [
- 222
+ 224
],
"__typename": [
1
@@ -7952,7 +7980,7 @@ export default {
},
"FindMessageSuppressionsInput": {
"reason": [
- 325
+ 327
],
"searchTerm": [
1
@@ -8000,10 +8028,10 @@ export default {
},
"EventLogQueryInput": {
"table": [
- 402
+ 404
],
"filters": [
- 403
+ 405
],
"first": [
28
@@ -8024,7 +8052,7 @@ export default {
1
],
"dateRange": [
- 404
+ 406
],
"recordId": [
1
@@ -8085,7 +8113,7 @@ export default {
8,
{
"input": [
- 409,
+ 411,
"AddQuerySubscriptionInput!"
]
}
@@ -8094,49 +8122,49 @@ export default {
8,
{
"input": [
- 410,
+ 412,
"RemoveQueryFromEventStreamInput!"
]
}
],
"createManyNavigationMenuItems": [
- 152,
+ 153,
{
"inputs": [
- 411,
+ 413,
"[CreateNavigationMenuItemInput!]!"
]
}
],
"createNavigationMenuItem": [
- 152,
+ 153,
{
"input": [
- 411,
+ 413,
"CreateNavigationMenuItemInput!"
]
}
],
"updateManyNavigationMenuItems": [
- 152,
+ 153,
{
"inputs": [
- 412,
+ 414,
"[UpdateOneNavigationMenuItemInput!]!"
]
}
],
"updateNavigationMenuItem": [
- 152,
+ 153,
{
"input": [
- 412,
+ 414,
"UpdateOneNavigationMenuItemInput!"
]
}
],
"deleteManyNavigationMenuItems": [
- 152,
+ 153,
{
"ids": [
3,
@@ -8145,7 +8173,7 @@ export default {
}
],
"deleteNavigationMenuItem": [
- 152,
+ 153,
{
"id": [
3,
@@ -8154,7 +8182,7 @@ export default {
}
],
"createFileUpload": [
- 150,
+ 151,
{
"filename": [
1,
@@ -8165,7 +8193,7 @@ export default {
"Float!"
],
"fileFolder": [
- 299,
+ 301,
"FileFolder!"
],
"fieldMetadataId": [
@@ -8177,7 +8205,7 @@ export default {
}
],
"completeFileUpload": [
- 149,
+ 150,
{
"fileId": [
1,
@@ -8189,10 +8217,10 @@ export default {
8
],
"releaseEnterpriseServerBinding": [
- 147
+ 148
],
"setEnterpriseKey": [
- 147,
+ 148,
{
"enterpriseKey": [
1,
@@ -8201,28 +8229,28 @@ export default {
}
],
"uploadWorkspaceLogo": [
- 149,
+ 150,
{
"file": [
- 414,
+ 416,
"Upload!"
]
}
],
"uploadWorkspaceMemberProfilePicture": [
- 149,
+ 150,
{
"file": [
- 414,
+ 416,
"Upload!"
]
}
],
"uploadFilesFieldFileByUniversalIdentifier": [
- 149,
+ 150,
{
"file": [
- 414,
+ 416,
"Upload!"
],
"fieldMetadataUniversalIdentifier": [
@@ -8232,10 +8260,10 @@ export default {
}
],
"upsertUsageLimit": [
- 174,
+ 175,
{
"input": [
- 415,
+ 417,
"UpsertUsageLimitInput!"
]
}
@@ -8253,7 +8281,7 @@ export default {
55,
{
"input": [
- 416,
+ 418,
"CreateViewFilterGroupInput!"
]
}
@@ -8266,7 +8294,7 @@ export default {
"String!"
],
"input": [
- 417,
+ 419,
"UpdateViewFilterGroupInput!"
]
}
@@ -8293,7 +8321,7 @@ export default {
57,
{
"input": [
- 418,
+ 420,
"CreateViewFilterInput!"
]
}
@@ -8302,7 +8330,7 @@ export default {
57,
{
"input": [
- 419,
+ 421,
"UpdateViewFilterInput!"
]
}
@@ -8311,7 +8339,7 @@ export default {
57,
{
"input": [
- 421,
+ 423,
"DeleteViewFilterInput!"
]
}
@@ -8320,7 +8348,7 @@ export default {
57,
{
"input": [
- 422,
+ 424,
"DestroyViewFilterInput!"
]
}
@@ -8329,7 +8357,7 @@ export default {
63,
{
"input": [
- 423,
+ 425,
"CreateViewInput!"
]
}
@@ -8342,7 +8370,7 @@ export default {
"String!"
],
"input": [
- 424,
+ 426,
"UpdateViewInput!"
]
}
@@ -8369,7 +8397,7 @@ export default {
63,
{
"input": [
- 425,
+ 427,
"UpsertViewWidgetInput!"
]
}
@@ -8378,7 +8406,7 @@ export default {
60,
{
"input": [
- 431,
+ 433,
"CreateViewSortInput!"
]
}
@@ -8387,7 +8415,7 @@ export default {
60,
{
"input": [
- 432,
+ 434,
"UpdateViewSortInput!"
]
}
@@ -8396,7 +8424,7 @@ export default {
8,
{
"input": [
- 434,
+ 436,
"DeleteViewSortInput!"
]
}
@@ -8405,7 +8433,7 @@ export default {
8,
{
"input": [
- 435,
+ 437,
"DestroyViewSortInput!"
]
}
@@ -8414,7 +8442,7 @@ export default {
53,
{
"input": [
- 436,
+ 438,
"UpdateViewFieldInput!"
]
}
@@ -8423,7 +8451,7 @@ export default {
53,
{
"input": [
- 438,
+ 440,
"CreateViewFieldInput!"
]
}
@@ -8432,7 +8460,7 @@ export default {
53,
{
"inputs": [
- 438,
+ 440,
"[CreateViewFieldInput!]!"
]
}
@@ -8441,7 +8469,7 @@ export default {
53,
{
"input": [
- 439,
+ 441,
"DeleteViewFieldInput!"
]
}
@@ -8450,7 +8478,7 @@ export default {
53,
{
"input": [
- 440,
+ 442,
"DestroyViewFieldInput!"
]
}
@@ -8459,7 +8487,7 @@ export default {
62,
{
"input": [
- 441,
+ 443,
"UpdateViewFieldGroupInput!"
]
}
@@ -8468,7 +8496,7 @@ export default {
62,
{
"input": [
- 443,
+ 445,
"CreateViewFieldGroupInput!"
]
}
@@ -8477,7 +8505,7 @@ export default {
62,
{
"inputs": [
- 443,
+ 445,
"[CreateViewFieldGroupInput!]!"
]
}
@@ -8486,7 +8514,7 @@ export default {
62,
{
"input": [
- 444,
+ 446,
"DeleteViewFieldGroupInput!"
]
}
@@ -8495,7 +8523,7 @@ export default {
62,
{
"input": [
- 445,
+ 447,
"DestroyViewFieldGroupInput!"
]
}
@@ -8504,7 +8532,7 @@ export default {
63,
{
"input": [
- 446,
+ 448,
"UpsertFieldsWidgetInput!"
]
}
@@ -8513,7 +8541,7 @@ export default {
2,
{
"input": [
- 449,
+ 451,
"CreateApiKeyInput!"
]
}
@@ -8522,7 +8550,7 @@ export default {
2,
{
"input": [
- 450,
+ 452,
"UpdateApiKeyInput!"
]
}
@@ -8531,7 +8559,7 @@ export default {
2,
{
"input": [
- 451,
+ 453,
"RevokeApiKeyInput!"
]
}
@@ -8562,7 +8590,7 @@ export default {
28
],
"deleteConnectedAccount": [
- 187,
+ 188,
{
"id": [
3,
@@ -8588,14 +8616,14 @@ export default {
}
],
"checkoutSession": [
- 168,
+ 169,
{
"recurringInterval": [
- 135,
+ 136,
"SubscriptionInterval!"
],
"plan": [
- 131,
+ 132,
"BillingPlanKey!"
],
"requirePaymentMethod": [
@@ -8608,14 +8636,14 @@ export default {
}
],
"createSubscriptionPaymentIntent": [
- 167,
+ 168,
{
"recurringInterval": [
- 135,
+ 136,
"SubscriptionInterval!"
],
"plan": [
- 131,
+ 132,
"BillingPlanKey!"
],
"requirePaymentMethod": [
@@ -8632,22 +8660,22 @@ export default {
}
],
"createBillingPaymentMethodSetupIntent": [
- 167
+ 168
],
"switchSubscriptionInterval": [
- 169
+ 170
],
"switchBillingPlan": [
- 169
+ 170
],
"cancelSwitchBillingPlan": [
- 169
+ 170
],
"cancelSwitchBillingInterval": [
- 169
+ 170
],
"setResourceCreditSubscriptionPrice": [
- 169,
+ 170,
{
"priceId": [
1,
@@ -8656,13 +8684,13 @@ export default {
}
],
"endSubscriptionTrialPeriod": [
- 164
+ 165
],
"cancelSwitchResourceCreditPrice": [
- 169
+ 170
],
"skipSyncEmailOnboardingStep": [
- 181,
+ 182,
{
"isAutoSkipped": [
8,
@@ -8671,7 +8699,7 @@ export default {
}
],
"completeBookCallOnboardingStep": [
- 181,
+ 182,
{
"hasBookedCall": [
8,
@@ -8684,7 +8712,7 @@ export default {
}
],
"triggerInstallAppsOnboardingStep": [
- 181,
+ 182,
{
"universalIdentifiers": [
1,
@@ -8697,7 +8725,7 @@ export default {
}
],
"goBackToPreviousOnboardingStep": [
- 180
+ 181
],
"deleteWorkspaceInvitation": [
1,
@@ -8709,7 +8737,7 @@ export default {
}
],
"resendWorkspaceInvitation": [
- 183,
+ 184,
{
"appTokenId": [
1,
@@ -8718,7 +8746,7 @@ export default {
}
],
"sendInvitations": [
- 183,
+ 184,
{
"emails": [
1,
@@ -8730,10 +8758,10 @@ export default {
}
],
"createApprovedAccessDomain": [
- 178,
+ 179,
{
"input": [
- 452,
+ 454,
"CreateApprovedAccessDomainInput!"
]
}
@@ -8742,38 +8770,38 @@ export default {
8,
{
"input": [
- 453,
+ 455,
"DeleteApprovedAccessDomainInput!"
]
}
],
"validateApprovedAccessDomain": [
- 178,
+ 179,
{
"input": [
- 454,
+ 456,
"ValidateApprovedAccessDomainInput!"
]
}
],
"createPageLayoutTab": [
- 123,
+ 124,
{
"input": [
- 455,
+ 457,
"CreatePageLayoutTabInput!"
]
}
],
"updatePageLayoutTab": [
- 123,
+ 124,
{
"id": [
1,
"String!"
],
"input": [
- 456,
+ 458,
"UpdatePageLayoutTabInput!"
]
}
@@ -8788,23 +8816,23 @@ export default {
}
],
"createPageLayout": [
- 124,
+ 125,
{
"input": [
- 457,
+ 459,
"CreatePageLayoutInput!"
]
}
],
"updatePageLayout": [
- 124,
+ 125,
{
"id": [
1,
"String!"
],
"input": [
- 458,
+ 460,
"UpdatePageLayoutInput!"
]
}
@@ -8819,20 +8847,20 @@ export default {
}
],
"updatePageLayoutWithTabsAndWidgets": [
- 124,
+ 125,
{
"id": [
1,
"String!"
],
"input": [
- 459,
+ 461,
"UpdatePageLayoutWithTabsInput!"
]
}
],
"resetPageLayoutToDefault": [
- 124,
+ 125,
{
"id": [
1,
@@ -8841,7 +8869,7 @@ export default {
}
],
"resetPageLayoutWidgetToDefault": [
- 80,
+ 81,
{
"id": [
1,
@@ -8850,7 +8878,7 @@ export default {
}
],
"resetPageLayoutTabToDefault": [
- 123,
+ 124,
{
"id": [
1,
@@ -8859,23 +8887,23 @@ export default {
}
],
"createPageLayoutWidget": [
- 80,
+ 81,
{
"input": [
- 462,
+ 464,
"CreatePageLayoutWidgetInput!"
]
}
],
"updatePageLayoutWidget": [
- 80,
+ 81,
{
"id": [
1,
"String!"
],
"input": [
- 463,
+ 465,
"UpdatePageLayoutWidgetInput!"
]
}
@@ -8893,7 +8921,7 @@ export default {
10,
{
"input": [
- 464,
+ 466,
"CreateAgentInput!"
]
}
@@ -8902,7 +8930,7 @@ export default {
10,
{
"input": [
- 465,
+ 467,
"UpdateAgentInput!"
]
}
@@ -8911,7 +8939,7 @@ export default {
10,
{
"input": [
- 394,
+ 396,
"AgentIdInput!"
]
}
@@ -8920,7 +8948,7 @@ export default {
23,
{
"input": [
- 466,
+ 468,
"CreateOneObjectInput!"
]
}
@@ -8929,7 +8957,7 @@ export default {
23,
{
"input": [
- 468,
+ 470,
"DeleteOneObjectInput!"
]
}
@@ -8938,25 +8966,25 @@ export default {
23,
{
"input": [
- 469,
+ 471,
"UpdateOneObjectInput!"
]
}
],
"createOneIndex": [
- 251,
+ 253,
{
"input": [
- 472,
+ 474,
"CreateOneIndexInput!"
]
}
],
"deleteOneIndex": [
- 251,
+ 253,
{
"input": [
- 475,
+ 477,
"DeleteOneIndexInput!"
]
}
@@ -8965,7 +8993,7 @@ export default {
21,
{
"input": [
- 396,
+ 398,
"LogicFunctionIdInput!"
]
}
@@ -8974,16 +9002,16 @@ export default {
21,
{
"input": [
- 476,
+ 478,
"CreateLogicFunctionFromSourceInput!"
]
}
],
"executeOneLogicFunction": [
- 145,
+ 146,
{
"input": [
- 477,
+ 479,
"ExecuteOneLogicFunctionInput!"
]
}
@@ -8992,7 +9020,7 @@ export default {
8,
{
"input": [
- 478,
+ 480,
"UpdateLogicFunctionFromSourceInput!"
]
}
@@ -9001,7 +9029,7 @@ export default {
14,
{
"input": [
- 480,
+ 482,
"CreateCommandMenuItemInput!"
]
}
@@ -9010,7 +9038,7 @@ export default {
14,
{
"input": [
- 481,
+ 483,
"UpdateCommandMenuItemInput!"
]
}
@@ -9037,7 +9065,7 @@ export default {
13,
{
"input": [
- 482,
+ 484,
"CreateFrontComponentInput!"
]
}
@@ -9046,7 +9074,7 @@ export default {
13,
{
"input": [
- 483,
+ 485,
"UpdateFrontComponentInput!"
]
}
@@ -9064,7 +9092,7 @@ export default {
69,
{
"data": [
- 485,
+ 487,
"ActivateWorkspaceInput!"
]
}
@@ -9073,7 +9101,7 @@ export default {
69,
{
"data": [
- 486,
+ 488,
"UpdateWorkspaceInput!"
]
}
@@ -9082,10 +9110,10 @@ export default {
69
],
"checkCustomDomainValidRecords": [
- 263
+ 265
],
"enrichWorkspaceCompany": [
- 240
+ 242
],
"upgradeApplication": [
8,
@@ -9101,19 +9129,19 @@ export default {
}
],
"createApplicationRegistration": [
- 218,
+ 220,
{
"input": [
- 487,
+ 489,
"CreateApplicationRegistrationInput!"
]
}
],
"updateApplicationRegistration": [
- 75,
+ 76,
{
"input": [
- 488,
+ 490,
"UpdateApplicationRegistrationInput!"
]
}
@@ -9128,7 +9156,7 @@ export default {
}
],
"rotateApplicationRegistrationClientSecret": [
- 220,
+ 222,
{
"id": [
1,
@@ -9137,19 +9165,19 @@ export default {
}
],
"createApplicationRegistrationVariable": [
- 192,
+ 193,
{
"input": [
- 490,
+ 492,
"CreateApplicationRegistrationVariableInput!"
]
}
],
"updateApplicationRegistrationVariable": [
- 192,
+ 193,
{
"input": [
- 491,
+ 493,
"UpdateApplicationRegistrationVariableInput!"
]
}
@@ -9164,10 +9192,10 @@ export default {
}
],
"uploadAppTarball": [
- 75,
+ 76,
{
"file": [
- 414,
+ 416,
"Upload!"
],
"universalIdentifier": [
@@ -9176,7 +9204,7 @@ export default {
}
],
"claimApplicationRegistrationOwnership": [
- 75,
+ 76,
{
"applicationRegistrationId": [
1,
@@ -9185,7 +9213,7 @@ export default {
}
],
"transferApplicationRegistrationOwnership": [
- 75,
+ 76,
{
"applicationRegistrationId": [
1,
@@ -9222,19 +9250,19 @@ export default {
}
],
"triggerInstallApplicationJob": [
- 238,
+ 240,
{
"input": [
- 493,
+ 495,
"TriggerInstallApplicationJobInput!"
]
}
],
"triggerUninstallApplicationJob": [
- 239,
+ 241,
{
"input": [
- 494,
+ 496,
"TriggerUninstallApplicationJobInput!"
]
}
@@ -9247,7 +9275,7 @@ export default {
"UUID!"
],
"input": [
- 495,
+ 497,
"UpdateApplicationInput!"
]
}
@@ -9265,28 +9293,28 @@ export default {
8
],
"createOneField": [
- 243,
+ 245,
{
"input": [
- 496,
+ 498,
"CreateOneFieldMetadataInput!"
]
}
],
"updateOneField": [
- 243,
+ 245,
{
"input": [
- 498,
+ 500,
"UpdateOneFieldMetadataInput!"
]
}
],
"deleteOneField": [
- 243,
+ 245,
{
"input": [
- 500,
+ 502,
"DeleteOneFieldInput!"
]
}
@@ -9295,7 +9323,7 @@ export default {
59,
{
"input": [
- 501,
+ 503,
"CreateViewGroupInput!"
]
}
@@ -9304,7 +9332,7 @@ export default {
59,
{
"inputs": [
- 501,
+ 503,
"[CreateViewGroupInput!]!"
]
}
@@ -9313,7 +9341,7 @@ export default {
59,
{
"input": [
- 502,
+ 504,
"UpdateViewGroupInput!"
]
}
@@ -9322,7 +9350,7 @@ export default {
59,
{
"inputs": [
- 502,
+ 504,
"[UpdateViewGroupInput!]!"
]
}
@@ -9331,7 +9359,7 @@ export default {
59,
{
"input": [
- 504,
+ 506,
"DeleteViewGroupInput!"
]
}
@@ -9340,7 +9368,7 @@ export default {
59,
{
"input": [
- 505,
+ 507,
"DestroyViewGroupInput!"
]
}
@@ -9362,7 +9390,7 @@ export default {
48,
{
"createRoleInput": [
- 506,
+ 508,
"CreateRoleInput!"
]
}
@@ -9371,7 +9399,7 @@ export default {
48,
{
"updateRoleInput": [
- 507,
+ 509,
"UpdateRoleInput!"
]
}
@@ -9389,7 +9417,7 @@ export default {
45,
{
"upsertObjectPermissionsInput": [
- 509,
+ 511,
"UpsertObjectPermissionsInput!"
]
}
@@ -9398,7 +9426,7 @@ export default {
46,
{
"upsertPermissionFlagsInput": [
- 511,
+ 513,
"UpsertPermissionFlagsInput!"
]
}
@@ -9407,16 +9435,16 @@ export default {
40,
{
"upsertFieldPermissionsInput": [
- 512,
+ 514,
"UpsertFieldPermissionsInput!"
]
}
],
"upsertRowLevelPermissionPredicates": [
- 264,
+ 266,
{
"input": [
- 514,
+ 516,
"UpsertRowLevelPermissionPredicatesInput!"
]
}
@@ -9444,43 +9472,43 @@ export default {
}
],
"sendEmailViaEmailingDomain": [
- 321,
+ 323,
{
"input": [
- 517,
+ 519,
"SendEmailViaDomainInput!"
]
}
],
"sendMessageCampaign": [
- 322,
+ 324,
{
"input": [
- 518,
+ 520,
"SendMessageCampaignInput!"
]
}
],
"cancelMessageCampaign": [
- 320,
+ 322,
{
"input": [
- 519,
+ 521,
"CancelMessageCampaignInput!"
]
}
],
"sendMessageCampaignTest": [
- 321,
+ 323,
{
"input": [
- 520,
+ 522,
"SendMessageCampaignTestInput!"
]
}
],
"duplicateMessageList": [
- 323,
+ 325,
{
"id": [
3,
@@ -9489,10 +9517,10 @@ export default {
}
],
"createMessageSuppression": [
- 324,
+ 326,
{
"input": [
- 521,
+ 523,
"CreateMessageSuppressionInput!"
]
}
@@ -9507,19 +9535,19 @@ export default {
}
],
"createUnsubscribeTopic": [
- 328,
+ 330,
{
"input": [
- 522,
+ 524,
"CreateUnsubscribeTopicInput!"
]
}
],
"updateUnsubscribeTopic": [
- 328,
+ 330,
{
"input": [
- 523,
+ 525,
"UpdateUnsubscribeTopicInput!"
]
}
@@ -9534,34 +9562,34 @@ export default {
}
],
"updateMessageChannel": [
- 310,
+ 312,
{
"input": [
- 524,
+ 526,
"UpdateMessageChannelInput!"
]
}
],
"createEmailGroupChannel": [
- 318,
+ 320,
{
"input": [
- 526,
+ 528,
"CreateEmailGroupChannelInput!"
]
}
],
"updateEmailGroupChannel": [
- 310,
+ 312,
{
"input": [
- 527,
+ 529,
"UpdateEmailGroupChannelInput!"
]
}
],
"deleteEmailGroupChannel": [
- 310,
+ 312,
{
"id": [
3,
@@ -9570,10 +9598,10 @@ export default {
}
],
"createEmailingDomain": [
- 306,
+ 308,
{
"input": [
- 528,
+ 530,
"CreateEmailingDomainInput!"
]
}
@@ -9588,7 +9616,7 @@ export default {
}
],
"verifyEmailingDomain": [
- 306,
+ 308,
{
"id": [
1,
@@ -9597,34 +9625,34 @@ export default {
}
],
"runAgent": [
- 340,
+ 342,
{
"input": [
- 529,
+ 531,
"RunAgentInput!"
]
}
],
"createWebhook": [
- 337,
+ 339,
{
"input": [
- 532,
+ 534,
"CreateWebhookInput!"
]
}
],
"updateWebhook": [
- 337,
+ 339,
{
"input": [
- 533,
+ 535,
"UpdateWebhookInput!"
]
}
],
"deleteWebhook": [
- 337,
+ 339,
{
"id": [
3,
@@ -9633,37 +9661,37 @@ export default {
}
],
"updateMessageFolder": [
- 379,
+ 381,
{
"input": [
- 535,
+ 537,
"UpdateMessageFolderInput!"
]
}
],
"updateMessageFolders": [
- 379,
+ 381,
{
"input": [
- 537,
+ 539,
"UpdateMessageFoldersInput!"
]
}
],
"updateCalendarChannel": [
- 374,
+ 376,
{
"input": [
- 538,
+ 540,
"UpdateCalendarChannelInput!"
]
}
],
"setAppKeyValue": [
- 372,
+ 374,
{
"input": [
- 540,
+ 542,
"SetAppKeyValueInput!"
]
}
@@ -9676,24 +9704,24 @@ export default {
"String!"
],
"scope": [
- 373
+ 375
]
}
],
"enqueueJob": [
- 370,
+ 372,
{
"input": [
- 541,
+ 543,
"EnqueueJobInput!"
]
}
],
"enqueueJobs": [
- 371,
+ 373,
{
"input": [
- 542,
+ 544,
"EnqueueJobsInput!"
]
}
@@ -9702,16 +9730,16 @@ export default {
8,
{
"input": [
- 544,
+ 546,
"ReportAppConnectionAuthFailureInput!"
]
}
],
"createChatThread": [
- 358
+ 360
],
"sendChatMessage": [
- 363,
+ 365,
{
"threadId": [
3,
@@ -9732,13 +9760,13 @@ export default {
1
],
"fileAttachments": [
- 545,
+ 547,
"[FileAttachmentInput!]"
]
}
],
"retryChatMessage": [
- 363,
+ 365,
{
"threadId": [
3,
@@ -9750,7 +9778,7 @@ export default {
}
],
"answerAgentChatQuestion": [
- 363,
+ 365,
{
"threadId": [
3,
@@ -9761,14 +9789,14 @@ export default {
"UUID!"
],
"answers": [
- 546,
+ 548,
"[AgentChatQuestionAnswerInput!]!"
],
"modelId": [
1
],
"fileAttachments": [
- 545,
+ 547,
"[FileAttachmentInput!]"
]
}
@@ -9783,7 +9811,7 @@ export default {
}
],
"renameChatThread": [
- 358,
+ 360,
{
"id": [
3,
@@ -9796,7 +9824,7 @@ export default {
}
],
"archiveChatThread": [
- 358,
+ 360,
{
"id": [
3,
@@ -9805,7 +9833,7 @@ export default {
}
],
"unarchiveChatThread": [
- 358,
+ 360,
{
"id": [
3,
@@ -9832,7 +9860,7 @@ export default {
}
],
"startWorkspaceSetupChat": [
- 365,
+ 367,
{
"companyContext": [
9
@@ -9843,25 +9871,25 @@ export default {
}
],
"createSkill": [
- 356,
+ 358,
{
"input": [
- 547,
+ 549,
"CreateSkillInput!"
]
}
],
"updateSkill": [
- 356,
+ 358,
{
"input": [
- 548,
+ 550,
"UpdateSkillInput!"
]
}
],
"deleteSkill": [
- 356,
+ 358,
{
"id": [
3,
@@ -9870,7 +9898,7 @@ export default {
}
],
"activateSkill": [
- 356,
+ 358,
{
"id": [
3,
@@ -9879,7 +9907,7 @@ export default {
}
],
"deactivateSkill": [
- 356,
+ 358,
{
"id": [
3,
@@ -9888,7 +9916,7 @@ export default {
}
],
"evaluateAgentTurn": [
- 367,
+ 369,
{
"turnId": [
3,
@@ -9897,7 +9925,7 @@ export default {
}
],
"runEvaluationInput": [
- 368,
+ 370,
{
"agentId": [
3,
@@ -9910,16 +9938,16 @@ export default {
}
],
"updateTimelineActivityType": [
- 385,
+ 387,
{
"input": [
- 549,
+ 551,
"UpdateTimelineActivityTypeInput!"
]
}
],
"resetTimelineActivityType": [
- 385,
+ 387,
{
"id": [
3,
@@ -9928,16 +9956,16 @@ export default {
}
],
"getAuthorizationUrlForSSO": [
- 273,
+ 275,
{
"input": [
- 550,
+ 552,
"GetAuthorizationUrlForSSOInput!"
]
}
],
"getLoginTokenFromCredentials": [
- 284,
+ 286,
{
"email": [
1,
@@ -9963,7 +9991,7 @@ export default {
}
],
"signIn": [
- 271,
+ 273,
{
"email": [
1,
@@ -9985,7 +10013,7 @@ export default {
}
],
"verifyEmailAndGetLoginToken": [
- 279,
+ 281,
{
"emailVerificationToken": [
1,
@@ -10005,7 +10033,7 @@ export default {
}
],
"verifyEmailAndGetWorkspaceAgnosticToken": [
- 271,
+ 273,
{
"emailVerificationToken": [
1,
@@ -10021,7 +10049,7 @@ export default {
}
],
"getAuthTokensFromOTP": [
- 283,
+ 285,
{
"otp": [
1,
@@ -10041,7 +10069,7 @@ export default {
}
],
"signUp": [
- 271,
+ 273,
{
"email": [
1,
@@ -10063,7 +10091,7 @@ export default {
}
],
"signUpInWorkspace": [
- 276,
+ 278,
{
"email": [
1,
@@ -10094,31 +10122,31 @@ export default {
}
],
"signUpInNewWorkspace": [
- 276,
+ 278,
{
"input": [
- 551
+ 553
]
}
],
"uploadNewWorkspaceLogo": [
- 149,
+ 150,
{
"workspaceId": [
1,
"String!"
],
"file": [
- 414,
+ 416,
"Upload!"
]
}
],
"generateTransientToken": [
- 277
+ 279
],
"getAuthTokensFromLoginToken": [
- 283,
+ 285,
{
"loginToken": [
1,
@@ -10131,7 +10159,7 @@ export default {
}
],
"getAuthTokensFromSSOExchangeToken": [
- 283,
+ 285,
{
"ssoExchangeToken": [
1,
@@ -10140,7 +10168,7 @@ export default {
}
],
"authorizeApp": [
- 269,
+ 271,
{
"clientId": [
1,
@@ -10165,7 +10193,7 @@ export default {
}
],
"renewToken": [
- 283,
+ 285,
{
"appToken": [
1,
@@ -10182,7 +10210,7 @@ export default {
}
],
"generateApiKeyToken": [
- 282,
+ 284,
{
"apiKeyId": [
3,
@@ -10198,7 +10226,7 @@ export default {
11
],
"emailPasswordResetLink": [
- 272,
+ 274,
{
"email": [
1,
@@ -10213,7 +10241,7 @@ export default {
}
],
"updatePasswordViaResetToken": [
- 274,
+ 276,
{
"passwordResetToken": [
1,
@@ -10226,7 +10254,7 @@ export default {
}
],
"initiateOTPProvisioning": [
- 267,
+ 269,
{
"loginToken": [
1,
@@ -10239,10 +10267,10 @@ export default {
}
],
"initiateOTPProvisioningForAuthenticatedUser": [
- 267
+ 269
],
"deleteTwoFactorAuthenticationMethod": [
- 266,
+ 268,
{
"twoFactorAuthenticationMethodId": [
3,
@@ -10251,7 +10279,7 @@ export default {
}
],
"verifyTwoFactorAuthenticationMethodForAuthenticatedUser": [
- 268,
+ 270,
{
"otp": [
1,
@@ -10260,7 +10288,7 @@ export default {
}
],
"deleteUser": [
- 72
+ 73
],
"deleteUserFromWorkspace": [
51,
@@ -10275,7 +10303,7 @@ export default {
8,
{
"input": [
- 552,
+ 554,
"UpdateWorkspaceMemberSettingsInput!"
]
}
@@ -10293,7 +10321,7 @@ export default {
}
],
"resendEmailVerificationToken": [
- 223,
+ 225,
{
"email": [
1,
@@ -10306,43 +10334,43 @@ export default {
}
],
"createOIDCIdentityProvider": [
- 228,
+ 230,
{
"input": [
- 553,
+ 555,
"SetupOIDCSsoInput!"
]
}
],
"createSAMLIdentityProvider": [
- 228,
+ 230,
{
"input": [
- 554,
+ 556,
"SetupSAMLSsoInput!"
]
}
],
"deleteSSOIdentityProvider": [
- 224,
+ 226,
{
"input": [
- 555,
+ 557,
"DeleteSsoInput!"
]
}
],
"editSSOIdentityProvider": [
- 225,
+ 227,
{
"input": [
- 556,
+ 558,
"EditSsoInput!"
]
}
],
"createObjectEvent": [
- 352,
+ 354,
{
"event": [
1,
@@ -10362,10 +10390,10 @@ export default {
}
],
"trackAnalytics": [
- 352,
+ 354,
{
"type": [
- 557,
+ 559,
"AnalyticsType!"
],
"name": [
@@ -10380,7 +10408,7 @@ export default {
}
],
"duplicateDashboard": [
- 350,
+ 352,
{
"id": [
3,
@@ -10389,7 +10417,7 @@ export default {
}
],
"impersonate": [
- 287,
+ 289,
{
"userId": [
3,
@@ -10402,28 +10430,28 @@ export default {
}
],
"stopImpersonation": [
- 288
+ 290
],
"createCalendarEvent": [
- 342,
+ 344,
{
"input": [
- 558,
+ 560,
"CreateCalendarEventInput!"
]
}
],
"sendEmail": [
- 351,
+ 353,
{
"input": [
- 559,
+ 561,
"SendEmailInput!"
]
}
],
"startChannelSync": [
- 341,
+ 343,
{
"connectedAccountId": [
3,
@@ -10432,14 +10460,14 @@ export default {
}
],
"saveImapSmtpCaldavAccount": [
- 336,
+ 338,
{
"handle": [
1,
"String!"
],
"connectionParameters": [
- 561,
+ 563,
"EmailAccountConnectionParameters!"
],
"id": [
@@ -10448,16 +10476,16 @@ export default {
}
],
"updateLabPublicFeatureFlag": [
- 189,
+ 190,
{
"input": [
- 563,
+ 565,
"UpdateLabPublicFeatureFlagInput!"
]
}
],
"createPublicDomain": [
- 304,
+ 306,
{
"domain": [
1,
@@ -10479,7 +10507,7 @@ export default {
}
],
"checkPublicDomainValidRecords": [
- 263,
+ 265,
{
"domain": [
1,
@@ -10488,7 +10516,7 @@ export default {
}
],
"createDevelopmentApplication": [
- 302,
+ 304,
{
"universalIdentifier": [
1,
@@ -10501,7 +10529,7 @@ export default {
}
],
"syncApplication": [
- 303,
+ 305,
{
"manifest": [
9,
@@ -10516,10 +10544,10 @@ export default {
}
],
"uploadApplicationFile": [
- 295,
+ 297,
{
"file": [
- 414,
+ 416,
"Upload!"
],
"applicationUniversalIdentifier": [
@@ -10527,7 +10555,7 @@ export default {
"String!"
],
"fileFolder": [
- 299,
+ 301,
"FileFolder!"
],
"filePath": [
@@ -10537,20 +10565,20 @@ export default {
}
],
"createApplicationFileUploads": [
- 301,
+ 303,
{
"applicationUniversalIdentifier": [
1,
"String!"
],
"files": [
- 564,
+ 566,
"[ApplicationFileUploadRequestInput!]!"
]
}
],
"completeApplicationFileUploads": [
- 297,
+ 299,
{
"applicationUniversalIdentifier": [
1,
@@ -10635,7 +10663,7 @@ export default {
3
],
"type": [
- 153
+ 154
],
"name": [
1
@@ -10667,7 +10695,7 @@ export default {
3
],
"update": [
- 413
+ 415
],
"__typename": [
1
@@ -10702,10 +10730,10 @@ export default {
"Upload": {},
"UpsertUsageLimitInput": {
"resourceType": [
- 175
+ 176
],
"operationType": [
- 176
+ 177
],
"spenderType": [
1
@@ -10726,10 +10754,10 @@ export default {
1
],
"limitValue": [
- 177
+ 178
],
"burstValue": [
- 177
+ 178
],
"__typename": [
1
@@ -10812,7 +10840,7 @@ export default {
3
],
"update": [
- 420
+ 422
],
"__typename": [
1
@@ -10983,19 +11011,19 @@ export default {
3
],
"view": [
- 426
+ 428
],
"viewFields": [
- 427
+ 429
],
"viewFilters": [
- 428
+ 430
],
"viewFilterGroups": [
- 429
+ 431
],
"viewSorts": [
- 430
+ 432
],
"__typename": [
1
@@ -11144,7 +11172,7 @@ export default {
3
],
"update": [
- 433
+ 435
],
"__typename": [
1
@@ -11182,7 +11210,7 @@ export default {
3
],
"update": [
- 437
+ 439
],
"__typename": [
1
@@ -11258,7 +11286,7 @@ export default {
3
],
"update": [
- 442
+ 444
],
"__typename": [
1
@@ -11322,10 +11350,10 @@ export default {
3
],
"groups": [
- 447
+ 449
],
"fields": [
- 448
+ 450
],
"__typename": [
1
@@ -11345,7 +11373,7 @@ export default {
8
],
"fields": [
- 448
+ 450
],
"__typename": [
1
@@ -11451,7 +11479,7 @@ export default {
3
],
"layoutMode": [
- 84
+ 85
],
"__typename": [
1
@@ -11468,7 +11496,7 @@ export default {
1
],
"layoutMode": [
- 84
+ 85
],
"__typename": [
1
@@ -11479,7 +11507,7 @@ export default {
1
],
"type": [
- 125
+ 126
],
"objectMetadataId": [
3
@@ -11493,7 +11521,7 @@ export default {
1
],
"type": [
- 125
+ 126
],
"objectMetadataId": [
3
@@ -11507,7 +11535,7 @@ export default {
1
],
"type": [
- 125
+ 126
],
"objectMetadataId": [
3
@@ -11516,7 +11544,7 @@ export default {
8
],
"tabs": [
- 460
+ 462
],
"__typename": [
1
@@ -11536,10 +11564,10 @@ export default {
1
],
"layoutMode": [
- 84
+ 85
],
"widgets": [
- 461
+ 463
],
"__typename": [
1
@@ -11556,7 +11584,7 @@ export default {
1
],
"type": [
- 81
+ 82
],
"objectMetadataId": [
3
@@ -11585,7 +11613,7 @@ export default {
1
],
"type": [
- 81
+ 82
],
"objectMetadataId": [
3
@@ -11608,7 +11636,7 @@ export default {
1
],
"type": [
- 81
+ 82
],
"objectMetadataId": [
3
@@ -11704,7 +11732,7 @@ export default {
},
"CreateOneObjectInput": {
"object": [
- 467
+ 469
],
"__typename": [
1
@@ -11764,7 +11792,7 @@ export default {
},
"UpdateOneObjectInput": {
"update": [
- 470
+ 472
],
"id": [
3
@@ -11817,7 +11845,7 @@ export default {
24
],
"translations": [
- 471
+ 473
],
"__typename": [
1
@@ -11839,7 +11867,7 @@ export default {
},
"CreateOneIndexInput": {
"index": [
- 473
+ 475
],
"__typename": [
1
@@ -11850,10 +11878,10 @@ export default {
3
],
"fields": [
- 474
+ 476
],
"indexType": [
- 252
+ 254
],
"__typename": [
1
@@ -11935,7 +11963,7 @@ export default {
3
],
"update": [
- 479
+ 481
],
"__typename": [
1
@@ -12101,7 +12129,7 @@ export default {
3
],
"update": [
- 484
+ 486
],
"__typename": [
1
@@ -12181,11 +12209,17 @@ export default {
"eventLogRetentionDays": [
15
],
- "fastModel": [
- 1
+ "aiChatModelTier": [
+ 72
],
- "smartModel": [
- 1
+ "aiAgentModelTier": [
+ 72
+ ],
+ "isAutoModelSelectionEnabled": [
+ 8
+ ],
+ "aiModelIdByTier": [
+ 9
],
"aiAdditionalInstructions": [
1
@@ -12193,12 +12227,6 @@ export default {
"editableProfileFields": [
1
],
- "enabledAiModelIds": [
- 1
- ],
- "useRecommendedModels": [
- 8
- ],
"isInternalMessagesImportEnabled": [
8
],
@@ -12228,7 +12256,7 @@ export default {
1
],
"update": [
- 489
+ 491
],
"__typename": [
1
@@ -12282,7 +12310,7 @@ export default {
1
],
"update": [
- 492
+ 494
],
"__typename": [
1
@@ -12328,7 +12356,7 @@ export default {
},
"CreateOneFieldMetadataInput": {
"field": [
- 497
+ 499
],
"__typename": [
1
@@ -12336,7 +12364,7 @@ export default {
},
"CreateFieldInput": {
"type": [
- 244
+ 246
],
"name": [
1
@@ -12407,7 +12435,7 @@ export default {
3
],
"update": [
- 499
+ 501
],
"__typename": [
1
@@ -12472,7 +12500,7 @@ export default {
9
],
"translations": [
- 471
+ 473
],
"__typename": [
1
@@ -12511,7 +12539,7 @@ export default {
3
],
"update": [
- 503
+ 505
],
"__typename": [
1
@@ -12596,7 +12624,7 @@ export default {
},
"UpdateRoleInput": {
"update": [
- 508
+ 510
],
"id": [
3
@@ -12651,7 +12679,7 @@ export default {
3
],
"objectPermissions": [
- 510
+ 512
],
"__typename": [
1
@@ -12693,7 +12721,7 @@ export default {
3
],
"fieldPermissions": [
- 513
+ 515
],
"__typename": [
1
@@ -12724,10 +12752,10 @@ export default {
3
],
"predicates": [
- 515
+ 517
],
"predicateGroups": [
- 516
+ 518
],
"__typename": [
1
@@ -12875,7 +12903,7 @@ export default {
1
],
"visibility": [
- 329
+ 331
],
"__typename": [
1
@@ -12892,7 +12920,7 @@ export default {
1
],
"visibility": [
- 329
+ 331
],
"__typename": [
1
@@ -12903,7 +12931,7 @@ export default {
3
],
"update": [
- 525
+ 527
],
"__typename": [
1
@@ -12911,16 +12939,16 @@ export default {
},
"UpdateMessageChannelInputUpdates": {
"visibility": [
- 311
+ 313
],
"isContactAutoCreationEnabled": [
8
],
"contactAutoCreationPolicy": [
- 313
+ 315
],
"messageFolderImportPolicy": [
- 314
+ 316
],
"isSyncEnabled": [
8
@@ -12976,7 +13004,7 @@ export default {
3
],
"messages": [
- 530
+ 532
],
"__typename": [
1
@@ -12984,7 +13012,7 @@ export default {
},
"RunAgentMessageInput": {
"role": [
- 531
+ 533
],
"content": [
1
@@ -13019,7 +13047,7 @@ export default {
3
],
"update": [
- 534
+ 536
],
"__typename": [
1
@@ -13047,7 +13075,7 @@ export default {
3
],
"update": [
- 536
+ 538
],
"__typename": [
1
@@ -13066,7 +13094,7 @@ export default {
3
],
"update": [
- 536
+ 538
],
"__typename": [
1
@@ -13077,7 +13105,7 @@ export default {
3
],
"update": [
- 539
+ 541
],
"__typename": [
1
@@ -13085,13 +13113,13 @@ export default {
},
"UpdateCalendarChannelInputUpdates": {
"visibility": [
- 377
+ 379
],
"isContactAutoCreationEnabled": [
8
],
"contactAutoCreationPolicy": [
- 378
+ 380
],
"isSyncEnabled": [
8
@@ -13108,7 +13136,7 @@ export default {
9
],
"scope": [
- 373
+ 375
],
"__typename": [
1
@@ -13142,7 +13170,7 @@ export default {
9
],
"jobs": [
- 543
+ 545
],
"retryLimit": [
28
@@ -13167,7 +13195,7 @@ export default {
},
"ReportAppConnectionAuthFailureInput": {
"id": [
- 222
+ 224
],
"reason": [
1
@@ -13264,7 +13292,7 @@ export default {
8
],
"translations": [
- 471
+ 473
],
"__typename": [
1
@@ -13356,7 +13384,7 @@ export default {
3
],
"status": [
- 198
+ 199
],
"__typename": [
1
@@ -13430,7 +13458,7 @@ export default {
1
],
"files": [
- 560
+ 562
],
"__typename": [
1
@@ -13452,13 +13480,13 @@ export default {
1
],
"IMAP": [
- 562
+ 564
],
"SMTP": [
- 562
+ 564
],
"CALDAV": [
- 562
+ 564
],
"__typename": [
1
@@ -13478,7 +13506,7 @@ export default {
1
],
"connectionSecurity": [
- 185
+ 186
],
"__typename": [
1
@@ -13497,7 +13525,7 @@ export default {
},
"ApplicationFileUploadRequestInput": {
"fileFolder": [
- 299
+ 301
],
"filePath": [
1
@@ -13511,7 +13539,7 @@ export default {
},
"Subscription": {
"onEventSubscription": [
- 162,
+ 163,
{
"eventStreamId": [
1,
@@ -13520,16 +13548,16 @@ export default {
}
],
"logicFunctionLogs": [
- 265,
+ 267,
{
"input": [
- 566,
+ 568,
"LogicFunctionLogsInput!"
]
}
],
"onAgentChatEvent": [
- 364,
+ 366,
{
"threadId": [
3,
@@ -13538,10 +13566,10 @@ export default {
}
],
"eventLogsLive": [
- 353,
+ 355,
{
"table": [
- 402,
+ 404,
"EventLogTable!"
]
}
diff --git a/packages/twenty-front/src/generated-admin/graphql.ts b/packages/twenty-front/src/generated-admin/graphql.ts
index 699996d7552..c59b459e02e 100644
--- a/packages/twenty-front/src/generated-admin/graphql.ts
+++ b/packages/twenty-front/src/generated-admin/graphql.ts
@@ -22,11 +22,11 @@ export type AdminAiModelConfig = {
__typename?: 'AdminAiModelConfig';
contextWindowTokens?: Maybe<Scalars['Float']['output']>;
dataResidency?: Maybe<Scalars['String']['output']>;
+ efforts?: Maybe<Array<Scalars['String']['output']>>;
inputCostPerMillionTokens?: Maybe<Scalars['Float']['output']>;
isAdminEnabled: Scalars['Boolean']['output'];
isAvailable: Scalars['Boolean']['output'];
isDeprecated?: Maybe<Scalars['Boolean']['output']>;
- isRecommended?: Maybe<Scalars['Boolean']['output']>;
label: Scalars['String']['output'];
maxOutputTokens?: Maybe<Scalars['Float']['output']>;
modelFamily?: Maybe<ModelFamily>;
@@ -39,10 +39,15 @@ export type AdminAiModelConfig = {
sdkPackage?: Maybe<Scalars['String']['output']>;
};
+export type AdminAiModelTierDefault = {
+ __typename?: 'AdminAiModelTierDefault';
+ modelId?: Maybe<Scalars['String']['output']>;
+ tier: AiModelTier;
+};
+
export type AdminAiModels = {
__typename?: 'AdminAiModels';
- defaultFastModelId?: Maybe<Scalars['String']['output']>;
- defaultSmartModelId?: Maybe<Scalars['String']['output']>;
+ defaultModelByTier: Array<AdminAiModelTierDefault>;
models: Array<AdminAiModelConfig>;
};
@@ -245,9 +250,12 @@ export enum AgentMessageRole {
USER = 'USER'
}
-export enum AiModelRole {
- FAST = 'FAST',
- SMART = 'SMART'
+export enum AiModelTier {
+ balanced = 'balanced',
+ extraFast = 'extraFast',
+ extraSmart = 'extraSmart',
+ fast = 'fast',
+ smart = 'smart'
}
export type ApplicationRegistration = {
@@ -536,9 +544,7 @@ export type Mutation = {
revokeSigningKey: SigningKeyDto;
revokeWorkspaceCreditGrant: AdminPanelWorkspaceCreditGrant;
setAdminAiModelEnabled: Scalars['Boolean']['output'];
- setAdminAiModelRecommended: Scalars['Boolean']['output'];
setAdminAiModelsEnabled: Scalars['Boolean']['output'];
- setAdminAiModelsRecommended: Scalars['Boolean']['output'];
setAdminDefaultAiModel: Scalars['Boolean']['output'];
setMaintenanceMode: Scalars['Boolean']['output'];
syncMarketplaceCatalog: Scalars['Boolean']['output'];
@@ -623,27 +629,15 @@ export type MutationSetAdminAiModelEnabledArgs = {
};
-export type MutationSetAdminAiModelRecommendedArgs = {
- modelId: Scalars['String']['input'];
- recommended: Scalars['Boolean']['input'];
-};
-
-
export type MutationSetAdminAiModelsEnabledArgs = {
enabled: Scalars['Boolean']['input'];
modelIds: Array<Scalars['String']['input']>;
};
-export type MutationSetAdminAiModelsRecommendedArgs = {
- modelIds: Array<Scalars['String']['input']>;
- recommended: Scalars['Boolean']['input'];
-};
-
-
export type MutationSetAdminDefaultAiModelArgs = {
modelId: Scalars['String']['input'];
- role: AiModelRole;
+ tier: AiModelTier;
};
@@ -1141,14 +1135,6 @@ export type SetAdminAiModelEnabledMutationVariables = Exact<{
export type SetAdminAiModelEnabledMutation = { __typename?: 'Mutation', setAdminAiModelEnabled: boolean };
-export type SetAdminAiModelRecommendedMutationVariables = Exact<{
- modelId: Scalars['String']['input'];
- recommended: Scalars['Boolean']['input'];
-}>;
-
-
-export type SetAdminAiModelRecommendedMutation = { __typename?: 'Mutation', setAdminAiModelRecommended: boolean };
-
export type SetAdminAiModelsEnabledMutationVariables = Exact<{
modelIds: Array<Scalars['String']['input']> | Scalars['String']['input'];
enabled: Scalars['Boolean']['input'];
@@ -1157,16 +1143,8 @@ export type SetAdminAiModelsEnabledMutationVariables = Exact<{
export type SetAdminAiModelsEnabledMutation = { __typename?: 'Mutation', setAdminAiModelsEnabled: boolean };
-export type SetAdminAiModelsRecommendedMutationVariables = Exact<{
- modelIds: Array<Scalars['String']['input']> | Scalars['String']['input'];
- recommended: Scalars['Boolean']['input'];
-}>;
-
-
-export type SetAdminAiModelsRecommendedMutation = { __typename?: 'Mutation', setAdminAiModelsRecommended: boolean };
-
export type SetAdminDefaultAiModelMutationVariables = Exact<{
- role: AiModelRole;
+ tier: AiModelTier;
modelId: Scalars['String']['input'];
}>;
@@ -1176,7 +1154,7 @@ export type SetAdminDefaultAiModelMutation = { __typename?: 'Mutation', setAdmin
export type GetAdminAiModelsQueryVariables = Exact<{ [key: string]: never; }>;
-export type GetAdminAiModelsQuery = { __typename?: 'Query', getAdminAiModels: { __typename?: 'AdminAiModels', defaultSmartModelId?: string | null, defaultFastModelId?: string | null, models: Array<{ __typename?: 'AdminAiModelConfig', modelId: string, label: string, modelFamily?: ModelFamily | null, sdkPackage?: string | null, isAvailable: boolean, isAdminEnabled: boolean, isDeprecated?: boolean | null, isRecommended?: boolean | null, contextWindowTokens?: number | null, maxOutputTokens?: number | null, inputCostPerMillionTokens?: number | null, outputCostPerMillionTokens?: number | null, providerName?: string | null, providerLabel?: string | null, name?: string | null, dataResidency?: string | null }> } };
+export type GetAdminAiModelsQuery = { __typename?: 'Query', getAdminAiModels: { __typename?: 'AdminAiModels', defaultModelByTier: Array<{ __typename?: 'AdminAiModelTierDefault', tier: AiModelTier, modelId?: string | null }>, models: Array<{ __typename?: 'AdminAiModelConfig', modelId: string, label: string, modelFamily?: ModelFamily | null, sdkPackage?: string | null, isAvailable: boolean, isAdminEnabled: boolean, isDeprecated?: boolean | null, contextWindowTokens?: number | null, maxOutputTokens?: number | null, inputCostPerMillionTokens?: number | null, outputCostPerMillionTokens?: number | null, providerName?: string | null, providerLabel?: string | null, name?: string | null, dataResidency?: string | null, efforts?: Array<string> | null }> } };
export type GetAdminAiUsageByWorkspaceQueryVariables = Exact<{
periodStart?: InputMaybe<Scalars['DateTime']['input']>;
@@ -1527,11 +1505,9 @@ export const AddModelToProviderDocument = {"kind":"Document","definitions":[{"ki
export const RemoveAiProviderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveAiProvider"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"providerName"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeAiProvider"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"providerName"},"value":{"kind":"Variable","name":{"kind":"Name","value":"providerName"}}}]}]}}]} as unknown as DocumentNode<RemoveAiProviderMutation, RemoveAiProviderMutationVariables>;
export const RemoveModelFromProviderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveModelFromProvider"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"providerName"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelName"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeModelFromProvider"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"providerName"},"value":{"kind":"Variable","name":{"kind":"Name","value":"providerName"}}},{"kind":"Argument","name":{"kind":"Name","value":"modelName"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelName"}}}]}]}}]} as unknown as DocumentNode<RemoveModelFromProviderMutation, RemoveModelFromProviderMutationVariables>;
export const SetAdminAiModelEnabledDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetAdminAiModelEnabled"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"enabled"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setAdminAiModelEnabled"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"modelId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}},{"kind":"Argument","name":{"kind":"Name","value":"enabled"},"value":{"kind":"Variable","name":{"kind":"Name","value":"enabled"}}}]}]}}]} as unknown as DocumentNode<SetAdminAiModelEnabledMutation, SetAdminAiModelEnabledMutationVariables>;
-export const SetAdminAiModelRecommendedDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetAdminAiModelRecommended"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"recommended"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setAdminAiModelRecommended"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"modelId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}},{"kind":"Argument","name":{"kind":"Name","value":"recommended"},"value":{"kind":"Variable","name":{"kind":"Name","value":"recommended"}}}]}]}}]} as unknown as DocumentNode<SetAdminAiModelRecommendedMutation, SetAdminAiModelRecommendedMutationVariables>;
export const SetAdminAiModelsEnabledDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetAdminAiModelsEnabled"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelIds"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"enabled"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setAdminAiModelsEnabled"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"modelIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelIds"}}},{"kind":"Argument","name":{"kind":"Name","value":"enabled"},"value":{"kind":"Variable","name":{"kind":"Name","value":"enabled"}}}]}]}}]} as unknown as DocumentNode<SetAdminAiModelsEnabledMutation, SetAdminAiModelsEnabledMutationVariables>;
-export const SetAdminAiModelsRecommendedDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetAdminAiModelsRecommended"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelIds"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"recommended"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setAdminAiModelsRecommended"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"modelIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelIds"}}},{"kind":"Argument","name":{"kind":"Name","value":"recommended"},"value":{"kind":"Variable","name":{"kind":"Name","value":"recommended"}}}]}]}}]} as unknown as DocumentNode<SetAdminAiModelsRecommendedMutation, SetAdminAiModelsRecommendedMutationVariables>;
-export const SetAdminDefaultAiModelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetAdminDefaultAiModel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"role"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AiModelRole"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setAdminDefaultAiModel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"role"},"value":{"kind":"Variable","name":{"kind":"Name","value":"role"}}},{"kind":"Argument","name":{"kind":"Name","value":"modelId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}]}]}}]} as unknown as DocumentNode<SetAdminDefaultAiModelMutation, SetAdminDefaultAiModelMutationVariables>;
-export const GetAdminAiModelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAdminAiModels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getAdminAiModels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"defaultSmartModelId"}},{"kind":"Field","name":{"kind":"Name","value":"defaultFastModelId"}},{"kind":"Field","name":{"kind":"Name","value":"models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"modelFamily"}},{"kind":"Field","name":{"kind":"Name","value":"sdkPackage"}},{"kind":"Field","name":{"kind":"Name","value":"isAvailable"}},{"kind":"Field","name":{"kind":"Name","value":"isAdminEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isDeprecated"}},{"kind":"Field","name":{"kind":"Name","value":"isRecommended"}},{"kind":"Field","name":{"kind":"Name","value":"contextWindowTokens"}},{"kind":"Field","name":{"kind":"Name","value":"maxOutputTokens"}},{"kind":"Field","name":{"kind":"Name","value":"inputCostPerMillionTokens"}},{"kind":"Field","name":{"kind":"Name","value":"outputCostPerMillionTokens"}},{"kind":"Field","name":{"kind":"Name","value":"providerName"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabel"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"dataResidency"}}]}}]}}]}}]} as unknown as DocumentNode<GetAdminAiModelsQuery, GetAdminAiModelsQueryVariables>;
+export const SetAdminDefaultAiModelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetAdminDefaultAiModel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"tier"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AiModelTier"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setAdminDefaultAiModel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"tier"},"value":{"kind":"Variable","name":{"kind":"Name","value":"tier"}}},{"kind":"Argument","name":{"kind":"Name","value":"modelId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}]}]}}]} as unknown as DocumentNode<SetAdminDefaultAiModelMutation, SetAdminDefaultAiModelMutationVariables>;
+export const GetAdminAiModelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAdminAiModels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getAdminAiModels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"defaultModelByTier"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tier"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}}]}},{"kind":"Field","name":{"kind":"Name","value":"models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"modelFamily"}},{"kind":"Field","name":{"kind":"Name","value":"sdkPackage"}},{"kind":"Field","name":{"kind":"Name","value":"isAvailable"}},{"kind":"Field","name":{"kind":"Name","value":"isAdminEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isDeprecated"}},{"kind":"Field","name":{"kind":"Name","value":"contextWindowTokens"}},{"kind":"Field","name":{"kind":"Name","value":"maxOutputTokens"}},{"kind":"Field","name":{"kind":"Name","value":"inputCostPerMillionTokens"}},{"kind":"Field","name":{"kind":"Name","value":"outputCostPerMillionTokens"}},{"kind":"Field","name":{"kind":"Name","value":"providerName"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabel"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"dataResidency"}},{"kind":"Field","name":{"kind":"Name","value":"efforts"}}]}}]}}]}}]} as unknown as DocumentNode<GetAdminAiModelsQuery, GetAdminAiModelsQueryVariables>;
export const GetAdminAiUsageByWorkspaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAdminAiUsageByWorkspace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"periodStart"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"periodEnd"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getAdminAiUsageByWorkspace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"periodStart"},"value":{"kind":"Variable","name":{"kind":"Name","value":"periodStart"}}},{"kind":"Argument","name":{"kind":"Name","value":"periodEnd"},"value":{"kind":"Variable","name":{"kind":"Name","value":"periodEnd"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"creditsUsed"}}]}}]}}]} as unknown as DocumentNode<GetAdminAiUsageByWorkspaceQuery, GetAdminAiUsageByWorkspaceQueryVariables>;
export const GetAiProvidersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAiProviders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getAiProviders"}}]}}]} as unknown as DocumentNode<GetAiProvidersQuery, GetAiProvidersQueryVariables>;
export const GetCustomAiProviderAccessDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomAiProviderAccess"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getCustomAiProviderAccess"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasAccess"}},{"kind":"Field","name":{"kind":"Name","value":"seatCount"}},{"kind":"Field","name":{"kind":"Name","value":"seatThreshold"}}]}}]}}]} as unknown as DocumentNode<GetCustomAiProviderAccessQuery, GetCustomAiProviderAccessQueryVariables>;
diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.ts
index c5cbb454e32..8bf34941b78 100644
--- a/packages/twenty-front/src/generated-metadata/graphql.ts
+++ b/packages/twenty-front/src/generated-metadata/graphql.ts
@@ -180,6 +180,14 @@ export enum AggregateOperations {
SUM = 'SUM'
}
+export enum AiModelTier {
+ balanced = 'balanced',
+ extraFast = 'extraFast',
+ extraSmart = 'extraSmart',
+ fast = 'fast',
+ smart = 'smart'
+}
+
export type AiSystemPromptPreview = {
__typename?: 'AiSystemPromptPreview';
estimatedTokenCount: Scalars['Int']['output'];
@@ -1035,10 +1043,14 @@ export type ClaimableApplicationRegistration = {
export type ClientAiModelConfig = {
__typename?: 'ClientAiModelConfig';
contextWindowTokens?: Maybe<Scalars['Float']['output']>;
+ costPerTask?: Maybe<Scalars['Float']['output']>;
dataResidency?: Maybe<Scalars['String']['output']>;
+ effort?: Maybe<Scalars['String']['output']>;
+ efforts?: Maybe<Array<Scalars['String']['output']>>;
inputCostPerMillionTokens?: Maybe<Scalars['Float']['output']>;
+ intelligenceIndex?: Maybe<Scalars['Float']['output']>;
+ isBenchmarkInherited?: Maybe<Scalars['Boolean']['output']>;
isDeprecated?: Maybe<Scalars['Boolean']['output']>;
- isRecommended?: Maybe<Scalars['Boolean']['output']>;
label: Scalars['String']['output'];
maxOutputTokens?: Maybe<Scalars['Float']['output']>;
modelFamily?: Maybe<ModelFamily>;
@@ -1046,13 +1058,21 @@ export type ClientAiModelConfig = {
modelId: Scalars['String']['output'];
nativeCapabilities?: Maybe<NativeModelCapabilities>;
outputCostPerMillionTokens?: Maybe<Scalars['Float']['output']>;
+ outputTokensPerSecond?: Maybe<Scalars['Float']['output']>;
providerLabel?: Maybe<Scalars['String']['output']>;
providerName?: Maybe<Scalars['String']['output']>;
sdkPackage?: Maybe<Scalars['String']['output']>;
};
+export type ClientAiModelTierConfig = {
+ __typename?: 'ClientAiModelTierConfig';
+ modelId: Scalars['String']['output'];
+ tier: AiModelTier;
+};
+
export type ClientConfig = {
__typename?: 'ClientConfig';
+ aiModelTiers: Array<ClientAiModelTierConfig>;
aiModels: Array<ClientAiModelConfig>;
allowRequestsToTwentyIcons: Scalars['Boolean']['output'];
analyticsEnabled: Scalars['Boolean']['output'];
@@ -6469,15 +6489,17 @@ export type UpdateWebhookInputUpdates = {
export type UpdateWorkspaceInput = {
aiAdditionalInstructions?: InputMaybe<Scalars['String']['input']>;
+ aiAgentModelTier?: InputMaybe<AiModelTier>;
+ aiChatModelTier?: InputMaybe<AiModelTier>;
+ aiModelIdByTier?: InputMaybe<Scalars['JSON']['input']>;
allowImpersonation?: InputMaybe<Scalars['Boolean']['input']>;
customDomain?: InputMaybe<Scalars['String']['input']>;
defaultRoleId?: InputMaybe<Scalars['UUID']['input']>;
displayName?: InputMaybe<Scalars['String']['input']>;
editableProfileFields?: InputMaybe<Array<Scalars['String']['input']>>;
- enabledAiModelIds?: InputMaybe<Array<Scalars['String']['input']>>;
eventLogRetentionDays?: InputMaybe<Scalars['Float']['input']>;
- fastModel?: InputMaybe<Scalars['String']['input']>;
inviteHash?: InputMaybe<Scalars['String']['input']>;
+ isAutoModelSelectionEnabled?: InputMaybe<Scalars['Boolean']['input']>;
isGoogleAuthBypassEnabled?: InputMaybe<Scalars['Boolean']['input']>;
isGoogleAuthEnabled?: InputMaybe<Scalars['Boolean']['input']>;
isInternalMessagesImportEnabled?: InputMaybe<Scalars['Boolean']['input']>;
@@ -6488,10 +6510,8 @@ export type UpdateWorkspaceInput = {
isPublicInviteLinkEnabled?: InputMaybe<Scalars['Boolean']['input']>;
isTwoFactorAuthenticationEnforced?: InputMaybe<Scalars['Boolean']['input']>;
logo?: InputMaybe<Scalars['String']['input']>;
- smartModel?: InputMaybe<Scalars['String']['input']>;
subdomain?: InputMaybe<Scalars['String']['input']>;
trashRetentionDays?: InputMaybe<Scalars['Float']['input']>;
- useRecommendedModels?: InputMaybe<Scalars['Boolean']['input']>;
workspaceDiscoverability?: InputMaybe<WorkspaceDiscoverability>;
};
@@ -7103,6 +7123,9 @@ export type Workspace = {
__typename?: 'Workspace';
activationStatus: WorkspaceActivationStatus;
aiAdditionalInstructions?: Maybe<Scalars['String']['output']>;
+ aiAgentModelTier: AiModelTier;
+ aiChatModelTier: AiModelTier;
+ aiModelIdByTier: Scalars['JSON']['output'];
allowImpersonation: Scalars['Boolean']['output'];
billingCustomer?: Maybe<BillingCustomer>;
billingEntitlements: Array<BillingEntitlement>;
@@ -7115,15 +7138,14 @@ export type Workspace = {
deletedAt?: Maybe<Scalars['DateTime']['output']>;
displayName?: Maybe<Scalars['String']['output']>;
editableProfileFields?: Maybe<Array<Scalars['String']['output']>>;
- enabledAiModelIds?: Maybe<Array<Scalars['String']['output']>>;
eventLogRetentionDays: Scalars['Float']['output'];
- fastModel: Scalars['String']['output'];
featureFlags?: Maybe<Array<FeatureFlag>>;
hasValidEnterpriseValidityToken: Scalars['Boolean']['output'];
hasValidSignedEnterpriseKey: Scalars['Boolean']['output'];
id: Scalars['UUID']['output'];
installedApplications: Array<Application>;
inviteHash?: Maybe<Scalars['String']['output']>;
+ isAutoModelSelectionEnabled: Scalars['Boolean']['output'];
isCustomDomainEnabled: Scalars['Boolean']['output'];
isGoogleAuthBypassEnabled: Scalars['Boolean']['output'];
isGoogleAuthEnabled: Scalars['Boolean']['output'];
@@ -7138,12 +7160,9 @@ export type Workspace = {
logoFileId?: Maybe<Scalars['UUID']['output']>;
/** @deprecated No longer used for metadata cache invalidation, will be removed */
metadataVersion: Scalars['Float']['output'];
- routerModel: Scalars['String']['output'];
- smartModel: Scalars['String']['output'];
subdomain: Scalars['String']['output'];
trashRetentionDays: Scalars['Float']['output'];
updatedAt: Scalars['DateTime']['output'];
- useRecommendedModels: Scalars['Boolean']['output'];
viewFields?: Maybe<Array<ViewField>>;
viewFilterGroups?: Maybe<Array<ViewFilterGroup>>;
viewFilters?: Maybe<Array<ViewFilter>>;
@@ -9493,7 +9512,7 @@ export type CurrentBillingSubscriptionFragmentFragment = { __typename?: 'Billing
| { __typename?: 'BillingMeteredProduct', name: string, description: string, images?: Array<string> | null, metadata: { __typename?: 'BillingProductMetadata', productKey: BillingProductKey, planKey: BillingPlanKey, priceUsageBased: BillingUsageType, isLegacy?: string | null } }
}> | null };
-export type UserQueryFragmentFragment = { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, hasPassword: boolean, canAccessFullAdminPanel: boolean, canImpersonate: boolean, supportUserHash?: string | null, onboardingStatus?: OnboardingStatus | null, previousOnboardingStatus?: OnboardingStatus | null, isWorkspaceCreator?: boolean | null, userVars?: any | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, uiScale: string, openRecordIn: OpenRecordIn, avatarUrl?: string | null, locale?: string | null, userEmail: string, userWorkspaceId?: string | null, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, numberFormat?: WorkspaceMemberNumberFormatEnum | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, workspaceMembers?: Array<{ __typename?: 'WorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, userWorkspaceId?: string | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, deletedWorkspaceMembers?: Array<{ __typename?: 'DeletedWorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, currentUserWorkspace?: { __typename?: 'UserWorkspace', id: string, permissionFlags?: Array<PermissionFlagType> | null, isImpersonating?: boolean | null, objectsPermissions?: Array<{ __typename?: 'ObjectPermission', objectMetadataId: string, canReadObjectRecords?: boolean | null, canUpdateObjectRecords?: boolean | null, canSoftDeleteObjectRecords?: boolean | null, canDestroyObjectRecords?: boolean | null, restrictedFields?: any | null, rowLevelPermissionPredicates?: Array<{ __typename?: 'RowLevelPermissionPredicate', id: string, fieldMetadataId: string, objectMetadataId: string, operand: RowLevelPermissionPredicateOperand, subFieldName?: string | null, workspaceMemberFieldMetadataId?: string | null, workspaceMemberSubFieldName?: string | null, rowLevelPermissionPredicateGroupId?: string | null, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, value?: any | null }> | null, rowLevelPermissionPredicateGroups?: Array<{ __typename?: 'RowLevelPermissionPredicateGroup', id: string, parentRowLevelPermissionPredicateGroupId?: string | null, logicalOperator: RowLevelPermissionPredicateGroupLogicalOperator, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, objectMetadataId: string }> | null }> | null, twoFactorAuthenticationMethodSummary?: Array<{ __typename?: 'TwoFactorAuthenticationMethodSummary', twoFactorAuthenticationMethodId: string, status: string, strategy: string }> | null } | null, currentWorkspace?: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, inviteHash?: string | null, allowImpersonation: boolean, activationStatus: WorkspaceActivationStatus, isPublicInviteLinkEnabled: boolean, workspaceDiscoverability: WorkspaceDiscoverability, isGoogleAuthEnabled: boolean, isMicrosoftAuthEnabled: boolean, isPasswordAuthEnabled: boolean, isGoogleAuthBypassEnabled: boolean, isMicrosoftAuthBypassEnabled: boolean, isPasswordAuthBypassEnabled: boolean, subdomain: string, customDomain?: string | null, hasValidSignedEnterpriseKey: boolean, hasValidEnterpriseValidityToken: boolean, isCustomDomainEnabled: boolean, workspaceMembersCount?: number | null, fastModel: string, smartModel: string, aiAdditionalInstructions?: string | null, enabledAiModelIds?: Array<string> | null, useRecommendedModels: boolean, isTwoFactorAuthenticationEnforced: boolean, trashRetentionDays: number, eventLogRetentionDays: number, editableProfileFields?: Array<string> | null, isInternalMessagesImportEnabled: boolean, workspaceCustomApplication?: { __typename?: 'Application', id: string } | null, installedApplications: Array<{ __typename?: 'Application', id: string, name: string, universalIdentifier: string, logoUrl?: string | null }>, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, featureFlags?: Array<{ __typename?: 'FeatureFlag', key: FeatureFlagKey, value: boolean }> | null, currentBillingSubscription?: { __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, interval?: SubscriptionInterval | null, metadata: any, currentPeriodEnd?: string | null, cancelAt?: string | null, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }>, billingSubscriptionItems?: Array<{ __typename?: 'BillingSubscriptionItem', id: string, hasReachedCurrentPeriodCap: boolean, quantity?: number | null, stripePriceId: string, unitAmount?: number | null, creditAmount?: number | null, billingProduct:
+export type UserQueryFragmentFragment = { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, hasPassword: boolean, canAccessFullAdminPanel: boolean, canImpersonate: boolean, supportUserHash?: string | null, onboardingStatus?: OnboardingStatus | null, previousOnboardingStatus?: OnboardingStatus | null, isWorkspaceCreator?: boolean | null, userVars?: any | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, uiScale: string, openRecordIn: OpenRecordIn, avatarUrl?: string | null, locale?: string | null, userEmail: string, userWorkspaceId?: string | null, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, numberFormat?: WorkspaceMemberNumberFormatEnum | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, workspaceMembers?: Array<{ __typename?: 'WorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, userWorkspaceId?: string | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, deletedWorkspaceMembers?: Array<{ __typename?: 'DeletedWorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, currentUserWorkspace?: { __typename?: 'UserWorkspace', id: string, permissionFlags?: Array<PermissionFlagType> | null, isImpersonating?: boolean | null, objectsPermissions?: Array<{ __typename?: 'ObjectPermission', objectMetadataId: string, canReadObjectRecords?: boolean | null, canUpdateObjectRecords?: boolean | null, canSoftDeleteObjectRecords?: boolean | null, canDestroyObjectRecords?: boolean | null, restrictedFields?: any | null, rowLevelPermissionPredicates?: Array<{ __typename?: 'RowLevelPermissionPredicate', id: string, fieldMetadataId: string, objectMetadataId: string, operand: RowLevelPermissionPredicateOperand, subFieldName?: string | null, workspaceMemberFieldMetadataId?: string | null, workspaceMemberSubFieldName?: string | null, rowLevelPermissionPredicateGroupId?: string | null, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, value?: any | null }> | null, rowLevelPermissionPredicateGroups?: Array<{ __typename?: 'RowLevelPermissionPredicateGroup', id: string, parentRowLevelPermissionPredicateGroupId?: string | null, logicalOperator: RowLevelPermissionPredicateGroupLogicalOperator, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, objectMetadataId: string }> | null }> | null, twoFactorAuthenticationMethodSummary?: Array<{ __typename?: 'TwoFactorAuthenticationMethodSummary', twoFactorAuthenticationMethodId: string, status: string, strategy: string }> | null } | null, currentWorkspace?: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, inviteHash?: string | null, allowImpersonation: boolean, activationStatus: WorkspaceActivationStatus, isPublicInviteLinkEnabled: boolean, workspaceDiscoverability: WorkspaceDiscoverability, isGoogleAuthEnabled: boolean, isMicrosoftAuthEnabled: boolean, isPasswordAuthEnabled: boolean, isGoogleAuthBypassEnabled: boolean, isMicrosoftAuthBypassEnabled: boolean, isPasswordAuthBypassEnabled: boolean, subdomain: string, customDomain?: string | null, hasValidSignedEnterpriseKey: boolean, hasValidEnterpriseValidityToken: boolean, isCustomDomainEnabled: boolean, workspaceMembersCount?: number | null, aiChatModelTier: AiModelTier, aiAgentModelTier: AiModelTier, isAutoModelSelectionEnabled: boolean, aiModelIdByTier: any, aiAdditionalInstructions?: string | null, isTwoFactorAuthenticationEnforced: boolean, trashRetentionDays: number, eventLogRetentionDays: number, editableProfileFields?: Array<string> | null, isInternalMessagesImportEnabled: boolean, workspaceCustomApplication?: { __typename?: 'Application', id: string } | null, installedApplications: Array<{ __typename?: 'Application', id: string, name: string, universalIdentifier: string, logoUrl?: string | null }>, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, featureFlags?: Array<{ __typename?: 'FeatureFlag', key: FeatureFlagKey, value: boolean }> | null, currentBillingSubscription?: { __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, interval?: SubscriptionInterval | null, metadata: any, currentPeriodEnd?: string | null, cancelAt?: string | null, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }>, billingSubscriptionItems?: Array<{ __typename?: 'BillingSubscriptionItem', id: string, hasReachedCurrentPeriodCap: boolean, quantity?: number | null, stripePriceId: string, unitAmount?: number | null, creditAmount?: number | null, billingProduct:
| { __typename?: 'BillingLicensedProduct', name: string, description: string, images?: Array<string> | null, metadata: { __typename?: 'BillingProductMetadata', productKey: BillingProductKey, planKey: BillingPlanKey, priceUsageBased: BillingUsageType, isLegacy?: string | null } }
| { __typename?: 'BillingMeteredProduct', name: string, description: string, images?: Array<string> | null, metadata: { __typename?: 'BillingProductMetadata', productKey: BillingProductKey, planKey: BillingPlanKey, priceUsageBased: BillingUsageType, isLegacy?: string | null } }
}> | null } | null, billingCustomer?: { __typename?: 'BillingCustomer', id: string, hasPaymentMethod?: boolean | null } | null, billingSubscriptions: Array<{ __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, metadata: any, cancelAt?: string | null, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }> }>, billingEntitlements: Array<{ __typename?: 'BillingEntitlement', key: BillingEntitlementKey, value: boolean }>, defaultRole?: { __typename?: 'Role', id: string, label: string, description?: string | null, icon?: string | null, canUpdateAllSettings: boolean, canAccessAllTools: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean, canBeAssignedToUsers: boolean, canBeAssignedToAgents: boolean, canBeAssignedToApiKeys: boolean } | null } | null, availableWorkspaces: { __typename?: 'AvailableWorkspaces', availableWorkspacesForSignIn: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }>, availableWorkspacesForSignUp: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }> } };
@@ -9515,7 +9534,7 @@ export type DeleteUserWorkspaceMutation = { __typename?: 'Mutation', deleteUserF
export type GetCurrentUserQueryVariables = Exact<{ [key: string]: never; }>;
-export type GetCurrentUserQuery = { __typename?: 'Query', currentUser: { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, hasPassword: boolean, canAccessFullAdminPanel: boolean, canImpersonate: boolean, supportUserHash?: string | null, onboardingStatus?: OnboardingStatus | null, previousOnboardingStatus?: OnboardingStatus | null, isWorkspaceCreator?: boolean | null, userVars?: any | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, uiScale: string, openRecordIn: OpenRecordIn, avatarUrl?: string | null, locale?: string | null, userEmail: string, userWorkspaceId?: string | null, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, numberFormat?: WorkspaceMemberNumberFormatEnum | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, workspaceMembers?: Array<{ __typename?: 'WorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, userWorkspaceId?: string | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, deletedWorkspaceMembers?: Array<{ __typename?: 'DeletedWorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, currentUserWorkspace?: { __typename?: 'UserWorkspace', id: string, permissionFlags?: Array<PermissionFlagType> | null, isImpersonating?: boolean | null, objectsPermissions?: Array<{ __typename?: 'ObjectPermission', objectMetadataId: string, canReadObjectRecords?: boolean | null, canUpdateObjectRecords?: boolean | null, canSoftDeleteObjectRecords?: boolean | null, canDestroyObjectRecords?: boolean | null, restrictedFields?: any | null, rowLevelPermissionPredicates?: Array<{ __typename?: 'RowLevelPermissionPredicate', id: string, fieldMetadataId: string, objectMetadataId: string, operand: RowLevelPermissionPredicateOperand, subFieldName?: string | null, workspaceMemberFieldMetadataId?: string | null, workspaceMemberSubFieldName?: string | null, rowLevelPermissionPredicateGroupId?: string | null, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, value?: any | null }> | null, rowLevelPermissionPredicateGroups?: Array<{ __typename?: 'RowLevelPermissionPredicateGroup', id: string, parentRowLevelPermissionPredicateGroupId?: string | null, logicalOperator: RowLevelPermissionPredicateGroupLogicalOperator, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, objectMetadataId: string }> | null }> | null, twoFactorAuthenticationMethodSummary?: Array<{ __typename?: 'TwoFactorAuthenticationMethodSummary', twoFactorAuthenticationMethodId: string, status: string, strategy: string }> | null } | null, currentWorkspace?: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, inviteHash?: string | null, allowImpersonation: boolean, activationStatus: WorkspaceActivationStatus, isPublicInviteLinkEnabled: boolean, workspaceDiscoverability: WorkspaceDiscoverability, isGoogleAuthEnabled: boolean, isMicrosoftAuthEnabled: boolean, isPasswordAuthEnabled: boolean, isGoogleAuthBypassEnabled: boolean, isMicrosoftAuthBypassEnabled: boolean, isPasswordAuthBypassEnabled: boolean, subdomain: string, customDomain?: string | null, hasValidSignedEnterpriseKey: boolean, hasValidEnterpriseValidityToken: boolean, isCustomDomainEnabled: boolean, workspaceMembersCount?: number | null, fastModel: string, smartModel: string, aiAdditionalInstructions?: string | null, enabledAiModelIds?: Array<string> | null, useRecommendedModels: boolean, isTwoFactorAuthenticationEnforced: boolean, trashRetentionDays: number, eventLogRetentionDays: number, editableProfileFields?: Array<string> | null, isInternalMessagesImportEnabled: boolean, workspaceCustomApplication?: { __typename?: 'Application', id: string } | null, installedApplications: Array<{ __typename?: 'Application', id: string, name: string, universalIdentifier: string, logoUrl?: string | null }>, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, featureFlags?: Array<{ __typename?: 'FeatureFlag', key: FeatureFlagKey, value: boolean }> | null, currentBillingSubscription?: { __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, interval?: SubscriptionInterval | null, metadata: any, currentPeriodEnd?: string | null, cancelAt?: string | null, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }>, billingSubscriptionItems?: Array<{ __typename?: 'BillingSubscriptionItem', id: string, hasReachedCurrentPeriodCap: boolean, quantity?: number | null, stripePriceId: string, unitAmount?: number | null, creditAmount?: number | null, billingProduct:
+export type GetCurrentUserQuery = { __typename?: 'Query', currentUser: { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, hasPassword: boolean, canAccessFullAdminPanel: boolean, canImpersonate: boolean, supportUserHash?: string | null, onboardingStatus?: OnboardingStatus | null, previousOnboardingStatus?: OnboardingStatus | null, isWorkspaceCreator?: boolean | null, userVars?: any | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, uiScale: string, openRecordIn: OpenRecordIn, avatarUrl?: string | null, locale?: string | null, userEmail: string, userWorkspaceId?: string | null, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, numberFormat?: WorkspaceMemberNumberFormatEnum | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, workspaceMembers?: Array<{ __typename?: 'WorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, userWorkspaceId?: string | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, deletedWorkspaceMembers?: Array<{ __typename?: 'DeletedWorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, currentUserWorkspace?: { __typename?: 'UserWorkspace', id: string, permissionFlags?: Array<PermissionFlagType> | null, isImpersonating?: boolean | null, objectsPermissions?: Array<{ __typename?: 'ObjectPermission', objectMetadataId: string, canReadObjectRecords?: boolean | null, canUpdateObjectRecords?: boolean | null, canSoftDeleteObjectRecords?: boolean | null, canDestroyObjectRecords?: boolean | null, restrictedFields?: any | null, rowLevelPermissionPredicates?: Array<{ __typename?: 'RowLevelPermissionPredicate', id: string, fieldMetadataId: string, objectMetadataId: string, operand: RowLevelPermissionPredicateOperand, subFieldName?: string | null, workspaceMemberFieldMetadataId?: string | null, workspaceMemberSubFieldName?: string | null, rowLevelPermissionPredicateGroupId?: string | null, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, value?: any | null }> | null, rowLevelPermissionPredicateGroups?: Array<{ __typename?: 'RowLevelPermissionPredicateGroup', id: string, parentRowLevelPermissionPredicateGroupId?: string | null, logicalOperator: RowLevelPermissionPredicateGroupLogicalOperator, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, objectMetadataId: string }> | null }> | null, twoFactorAuthenticationMethodSummary?: Array<{ __typename?: 'TwoFactorAuthenticationMethodSummary', twoFactorAuthenticationMethodId: string, status: string, strategy: string }> | null } | null, currentWorkspace?: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, inviteHash?: string | null, allowImpersonation: boolean, activationStatus: WorkspaceActivationStatus, isPublicInviteLinkEnabled: boolean, workspaceDiscoverability: WorkspaceDiscoverability, isGoogleAuthEnabled: boolean, isMicrosoftAuthEnabled: boolean, isPasswordAuthEnabled: boolean, isGoogleAuthBypassEnabled: boolean, isMicrosoftAuthBypassEnabled: boolean, isPasswordAuthBypassEnabled: boolean, subdomain: string, customDomain?: string | null, hasValidSignedEnterpriseKey: boolean, hasValidEnterpriseValidityToken: boolean, isCustomDomainEnabled: boolean, workspaceMembersCount?: number | null, aiChatModelTier: AiModelTier, aiAgentModelTier: AiModelTier, isAutoModelSelectionEnabled: boolean, aiModelIdByTier: any, aiAdditionalInstructions?: string | null, isTwoFactorAuthenticationEnforced: boolean, trashRetentionDays: number, eventLogRetentionDays: number, editableProfileFields?: Array<string> | null, isInternalMessagesImportEnabled: boolean, workspaceCustomApplication?: { __typename?: 'Application', id: string } | null, installedApplications: Array<{ __typename?: 'Application', id: string, name: string, universalIdentifier: string, logoUrl?: string | null }>, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, featureFlags?: Array<{ __typename?: 'FeatureFlag', key: FeatureFlagKey, value: boolean }> | null, currentBillingSubscription?: { __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, interval?: SubscriptionInterval | null, metadata: any, currentPeriodEnd?: string | null, cancelAt?: string | null, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }>, billingSubscriptionItems?: Array<{ __typename?: 'BillingSubscriptionItem', id: string, hasReachedCurrentPeriodCap: boolean, quantity?: number | null, stripePriceId: string, unitAmount?: number | null, creditAmount?: number | null, billingProduct:
| { __typename?: 'BillingLicensedProduct', name: string, description: string, images?: Array<string> | null, metadata: { __typename?: 'BillingProductMetadata', productKey: BillingProductKey, planKey: BillingPlanKey, priceUsageBased: BillingUsageType, isLegacy?: string | null } }
| { __typename?: 'BillingMeteredProduct', name: string, description: string, images?: Array<string> | null, metadata: { __typename?: 'BillingProductMetadata', productKey: BillingProductKey, planKey: BillingPlanKey, priceUsageBased: BillingUsageType, isLegacy?: string | null } }
}> | null } | null, billingCustomer?: { __typename?: 'BillingCustomer', id: string, hasPaymentMethod?: boolean | null } | null, billingSubscriptions: Array<{ __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, metadata: any, cancelAt?: string | null, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }> }>, billingEntitlements: Array<{ __typename?: 'BillingEntitlement', key: BillingEntitlementKey, value: boolean }>, defaultRole?: { __typename?: 'Role', id: string, label: string, description?: string | null, icon?: string | null, canUpdateAllSettings: boolean, canAccessAllTools: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean, canBeAssignedToUsers: boolean, canBeAssignedToAgents: boolean, canBeAssignedToApiKeys: boolean } | null } | null, availableWorkspaces: { __typename?: 'AvailableWorkspaces', availableWorkspacesForSignIn: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }>, availableWorkspacesForSignUp: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }> } } };
@@ -9837,7 +9856,7 @@ export const BillingSubscriptionFragmentFragmentDoc = {"kind":"Document","defini
export const RoleFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RoleFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllSettings"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessAllTools"}},{"kind":"Field","name":{"kind":"Name","value":"isEditable"}},{"kind":"Field","name":{"kind":"Name","value":"canReadAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToUsers"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToAgents"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToApiKeys"}}]}}]} as unknown as DocumentNode<RoleFragmentFragment, unknown>;
export const AvailableWorkspaceFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]} as unknown as DocumentNode<AvailableWorkspaceFragmentFragment, unknown>;
export const AvailableWorkspacesFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspacesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspaces"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignIn"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignUp"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]} as unknown as DocumentNode<AvailableWorkspacesFragmentFragment, unknown>;
-export const UserQueryFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"hasPassword"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessFullAdminPanel"}},{"kind":"Field","name":{"kind":"Name","value":"canImpersonate"}},{"kind":"Field","name":{"kind":"Name","value":"supportUserHash"}},{"kind":"Field","name":{"kind":"Name","value":"onboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"previousOnboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isWorkspaceCreator"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMember"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"deletedWorkspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentUserWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"permissionFlags"}},{"kind":"Field","name":{"kind":"Name","value":"isImpersonating"}},{"kind":"Field","name":{"kind":"Name","value":"objectsPermissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectPermissionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodSummary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"strategy"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"allowImpersonation"}},{"kind":"Field","name":{"kind":"Name","value":"activationStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isPublicInviteLinkEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceDiscoverability"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"subdomain"}},{"kind":"Field","name":{"kind":"Name","value":"customDomain"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidSignedEnterpriseKey"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidEnterpriseValidityToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceCustomApplication"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"installedApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"isCustomDomainEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceUrlsFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"featureFlags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentBillingSubscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasPaymentMethod"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingEntitlements"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembersCount"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRole"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RoleFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fastModel"}},{"kind":"Field","name":{"kind":"Name","value":"smartModel"}},{"kind":"Field","name":{"kind":"Name","value":"aiAdditionalInstructions"}},{"kind":"Field","name":{"kind":"Name","value":"enabledAiModelIds"}},{"kind":"Field","name":{"kind":"Name","value":"useRecommendedModels"}},{"kind":"Field","name":{"kind":"Name","value":"isTwoFactorAuthenticationEnforced"}},{"kind":"Field","name":{"kind":"Name","value":"trashRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"eventLogRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"editableProfileFields"}},{"kind":"Field","name":{"kind":"Name","value":"isInternalMessagesImportEnabled"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspacesFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"userVars"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"operand"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberSubFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"parentRowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"logicalOperator"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhase"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start_date"}},{"kind":"Field","name":{"kind":"Name","value":"end_date"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"colorScheme"}},{"kind":"Field","name":{"kind":"Name","value":"uiScale"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"locale"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","name":{"kind":"Name","value":"dateFormat"}},{"kind":"Field","name":{"kind":"Name","value":"timeFormat"}},{"kind":"Field","name":{"kind":"Name","value":"calendarStartDay"}},{"kind":"Field","name":{"kind":"Name","value":"numberFormat"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"DeletedWorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectPermissionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ObjectPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"canReadObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"restrictedFields"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceUrlsFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceUrls"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"interval"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"currentPeriodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"cancelAt"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptionItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasReachedCurrentPeriodCap"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"unitAmount"}},{"kind":"Field","name":{"kind":"Name","value":"creditAmount"}},{"kind":"Field","name":{"kind":"Name","value":"billingProduct"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}},{"kind":"Field","name":{"kind":"Name","value":"isLegacy"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"cancelAt"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RoleFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllSettings"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessAllTools"}},{"kind":"Field","name":{"kind":"Name","value":"isEditable"}},{"kind":"Field","name":{"kind":"Name","value":"canReadAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToUsers"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToAgents"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToApiKeys"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspacesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspaces"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignIn"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignUp"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}}]}}]} as unknown as DocumentNode<UserQueryFragmentFragment, unknown>;
+export const UserQueryFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"hasPassword"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessFullAdminPanel"}},{"kind":"Field","name":{"kind":"Name","value":"canImpersonate"}},{"kind":"Field","name":{"kind":"Name","value":"supportUserHash"}},{"kind":"Field","name":{"kind":"Name","value":"onboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"previousOnboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isWorkspaceCreator"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMember"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"deletedWorkspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentUserWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"permissionFlags"}},{"kind":"Field","name":{"kind":"Name","value":"isImpersonating"}},{"kind":"Field","name":{"kind":"Name","value":"objectsPermissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectPermissionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodSummary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"strategy"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"allowImpersonation"}},{"kind":"Field","name":{"kind":"Name","value":"activationStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isPublicInviteLinkEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceDiscoverability"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"subdomain"}},{"kind":"Field","name":{"kind":"Name","value":"customDomain"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidSignedEnterpriseKey"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidEnterpriseValidityToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceCustomApplication"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"installedApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"isCustomDomainEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceUrlsFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"featureFlags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentBillingSubscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasPaymentMethod"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingEntitlements"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembersCount"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRole"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RoleFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"aiChatModelTier"}},{"kind":"Field","name":{"kind":"Name","value":"aiAgentModelTier"}},{"kind":"Field","name":{"kind":"Name","value":"isAutoModelSelectionEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"aiModelIdByTier"}},{"kind":"Field","name":{"kind":"Name","value":"aiAdditionalInstructions"}},{"kind":"Field","name":{"kind":"Name","value":"isTwoFactorAuthenticationEnforced"}},{"kind":"Field","name":{"kind":"Name","value":"trashRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"eventLogRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"editableProfileFields"}},{"kind":"Field","name":{"kind":"Name","value":"isInternalMessagesImportEnabled"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspacesFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"userVars"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"operand"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberSubFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"parentRowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"logicalOperator"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhase"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start_date"}},{"kind":"Field","name":{"kind":"Name","value":"end_date"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"colorScheme"}},{"kind":"Field","name":{"kind":"Name","value":"uiScale"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"locale"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","name":{"kind":"Name","value":"dateFormat"}},{"kind":"Field","name":{"kind":"Name","value":"timeFormat"}},{"kind":"Field","name":{"kind":"Name","value":"calendarStartDay"}},{"kind":"Field","name":{"kind":"Name","value":"numberFormat"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"DeletedWorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectPermissionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ObjectPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"canReadObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"restrictedFields"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceUrlsFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceUrls"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"interval"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"currentPeriodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"cancelAt"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptionItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasReachedCurrentPeriodCap"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"unitAmount"}},{"kind":"Field","name":{"kind":"Name","value":"creditAmount"}},{"kind":"Field","name":{"kind":"Name","value":"billingProduct"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}},{"kind":"Field","name":{"kind":"Name","value":"isLegacy"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"cancelAt"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RoleFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllSettings"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessAllTools"}},{"kind":"Field","name":{"kind":"Name","value":"isEditable"}},{"kind":"Field","name":{"kind":"Name","value":"canReadAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToUsers"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToAgents"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToApiKeys"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspacesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspaces"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignIn"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignUp"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}}]}}]} as unknown as DocumentNode<UserQueryFragmentFragment, unknown>;
export const ViewFieldFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewField"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"aggregateOperation"}},{"kind":"Field","name":{"kind":"Name","value":"viewFieldGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode<ViewFieldFragmentFragment, unknown>;
export const ViewFieldGroupFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewFieldGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewFields"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFieldFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewField"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"aggregateOperation"}},{"kind":"Field","name":{"kind":"Name","value":"viewFieldGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode<ViewFieldGroupFragmentFragment, unknown>;
export const ViewFilterFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFilterFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewFilter"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"operand"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"viewFilterGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"positionInViewFilterGroup"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"relationTargetFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode<ViewFilterFragmentFragment, unknown>;
@@ -10103,7 +10122,7 @@ export const RemoveQueryFromEventStreamDocument = {"kind":"Document","definition
export const OnEventSubscriptionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"OnEventSubscription"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"eventStreamId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"onEventSubscription"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"eventStreamId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"eventStreamId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"eventStreamId"}},{"kind":"Field","name":{"kind":"Name","value":"objectRecordEventsWithQueryIds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"objectRecordEvent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"action"}},{"kind":"Field","name":{"kind":"Name","value":"objectNameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"recordId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberId"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updatedFields"}},{"kind":"Field","name":{"kind":"Name","value":"before"}},{"kind":"Field","name":{"kind":"Name","value":"after"}},{"kind":"Field","name":{"kind":"Name","value":"diff"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"queryIds"}}]}},{"kind":"Field","name":{"kind":"Name","value":"metadataEvents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"metadataName"}},{"kind":"Field","name":{"kind":"Name","value":"recordId"}},{"kind":"Field","name":{"kind":"Name","value":"updatedCollectionHash"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updatedFields"}},{"kind":"Field","name":{"kind":"Name","value":"before"}},{"kind":"Field","name":{"kind":"Name","value":"after"}},{"kind":"Field","name":{"kind":"Name","value":"diff"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"queueJobEvents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"jobId"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"attemptsMade"}},{"kind":"Field","name":{"kind":"Name","value":"failedReason"}},{"kind":"Field","name":{"kind":"Name","value":"enqueuedAt"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"finishedAt"}}]}}]}}]}}]} as unknown as DocumentNode<OnEventSubscriptionSubscription, OnEventSubscriptionSubscriptionVariables>;
export const DeleteUserAccountDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteUserAccount"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<DeleteUserAccountMutation, DeleteUserAccountMutationVariables>;
export const DeleteUserWorkspaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteUserWorkspace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceMemberIdToDelete"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteUserFromWorkspace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"workspaceMemberIdToDelete"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceMemberIdToDelete"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<DeleteUserWorkspaceMutation, DeleteUserWorkspaceMutationVariables>;
-export const GetCurrentUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCurrentUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserQueryFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"colorScheme"}},{"kind":"Field","name":{"kind":"Name","value":"uiScale"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"locale"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","name":{"kind":"Name","value":"dateFormat"}},{"kind":"Field","name":{"kind":"Name","value":"timeFormat"}},{"kind":"Field","name":{"kind":"Name","value":"calendarStartDay"}},{"kind":"Field","name":{"kind":"Name","value":"numberFormat"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"DeletedWorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"operand"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberSubFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"parentRowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"logicalOperator"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectPermissionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ObjectPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"canReadObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"restrictedFields"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceUrlsFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceUrls"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhase"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start_date"}},{"kind":"Field","name":{"kind":"Name","value":"end_date"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"interval"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"currentPeriodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"cancelAt"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptionItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasReachedCurrentPeriodCap"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"unitAmount"}},{"kind":"Field","name":{"kind":"Name","value":"creditAmount"}},{"kind":"Field","name":{"kind":"Name","value":"billingProduct"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}},{"kind":"Field","name":{"kind":"Name","value":"isLegacy"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"cancelAt"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RoleFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllSettings"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessAllTools"}},{"kind":"Field","name":{"kind":"Name","value":"isEditable"}},{"kind":"Field","name":{"kind":"Name","value":"canReadAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToUsers"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToAgents"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToApiKeys"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspacesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspaces"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignIn"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignUp"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"hasPassword"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessFullAdminPanel"}},{"kind":"Field","name":{"kind":"Name","value":"canImpersonate"}},{"kind":"Field","name":{"kind":"Name","value":"supportUserHash"}},{"kind":"Field","name":{"kind":"Name","value":"onboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"previousOnboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isWorkspaceCreator"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMember"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"deletedWorkspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentUserWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"permissionFlags"}},{"kind":"Field","name":{"kind":"Name","value":"isImpersonating"}},{"kind":"Field","name":{"kind":"Name","value":"objectsPermissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectPermissionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodSummary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"strategy"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"allowImpersonation"}},{"kind":"Field","name":{"kind":"Name","value":"activationStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isPublicInviteLinkEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceDiscoverability"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"subdomain"}},{"kind":"Field","name":{"kind":"Name","value":"customDomain"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidSignedEnterpriseKey"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidEnterpriseValidityToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceCustomApplication"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"installedApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"isCustomDomainEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceUrlsFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"featureFlags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentBillingSubscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasPaymentMethod"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingEntitlements"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembersCount"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRole"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RoleFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fastModel"}},{"kind":"Field","name":{"kind":"Name","value":"smartModel"}},{"kind":"Field","name":{"kind":"Name","value":"aiAdditionalInstructions"}},{"kind":"Field","name":{"kind":"Name","value":"enabledAiModelIds"}},{"kind":"Field","name":{"kind":"Name","value":"useRecommendedModels"}},{"kind":"Field","name":{"kind":"Name","value":"isTwoFactorAuthenticationEnforced"}},{"kind":"Field","name":{"kind":"Name","value":"trashRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"eventLogRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"editableProfileFields"}},{"kind":"Field","name":{"kind":"Name","value":"isInternalMessagesImportEnabled"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspacesFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"userVars"}}]}}]} as unknown as DocumentNode<GetCurrentUserQuery, GetCurrentUserQueryVariables>;
+export const GetCurrentUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCurrentUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserQueryFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"colorScheme"}},{"kind":"Field","name":{"kind":"Name","value":"uiScale"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"locale"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","name":{"kind":"Name","value":"dateFormat"}},{"kind":"Field","name":{"kind":"Name","value":"timeFormat"}},{"kind":"Field","name":{"kind":"Name","value":"calendarStartDay"}},{"kind":"Field","name":{"kind":"Name","value":"numberFormat"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"DeletedWorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"operand"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberSubFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"parentRowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"logicalOperator"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectPermissionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ObjectPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"canReadObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"restrictedFields"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceUrlsFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceUrls"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhase"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start_date"}},{"kind":"Field","name":{"kind":"Name","value":"end_date"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"interval"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"currentPeriodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"cancelAt"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptionItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasReachedCurrentPeriodCap"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"unitAmount"}},{"kind":"Field","name":{"kind":"Name","value":"creditAmount"}},{"kind":"Field","name":{"kind":"Name","value":"billingProduct"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}},{"kind":"Field","name":{"kind":"Name","value":"isLegacy"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"cancelAt"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RoleFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllSettings"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessAllTools"}},{"kind":"Field","name":{"kind":"Name","value":"isEditable"}},{"kind":"Field","name":{"kind":"Name","value":"canReadAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToUsers"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToAgents"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToApiKeys"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspacesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspaces"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignIn"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignUp"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"hasPassword"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessFullAdminPanel"}},{"kind":"Field","name":{"kind":"Name","value":"canImpersonate"}},{"kind":"Field","name":{"kind":"Name","value":"supportUserHash"}},{"kind":"Field","name":{"kind":"Name","value":"onboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"previousOnboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isWorkspaceCreator"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMember"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"deletedWorkspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentUserWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"permissionFlags"}},{"kind":"Field","name":{"kind":"Name","value":"isImpersonating"}},{"kind":"Field","name":{"kind":"Name","value":"objectsPermissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectPermissionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodSummary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"strategy"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"allowImpersonation"}},{"kind":"Field","name":{"kind":"Name","value":"activationStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isPublicInviteLinkEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceDiscoverability"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"subdomain"}},{"kind":"Field","name":{"kind":"Name","value":"customDomain"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidSignedEnterpriseKey"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidEnterpriseValidityToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceCustomApplication"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"installedApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"isCustomDomainEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceUrlsFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"featureFlags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentBillingSubscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasPaymentMethod"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingEntitlements"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembersCount"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRole"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RoleFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"aiChatModelTier"}},{"kind":"Field","name":{"kind":"Name","value":"aiAgentModelTier"}},{"kind":"Field","name":{"kind":"Name","value":"isAutoModelSelectionEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"aiModelIdByTier"}},{"kind":"Field","name":{"kind":"Name","value":"aiAdditionalInstructions"}},{"kind":"Field","name":{"kind":"Name","value":"isTwoFactorAuthenticationEnforced"}},{"kind":"Field","name":{"kind":"Name","value":"trashRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"eventLogRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"editableProfileFields"}},{"kind":"Field","name":{"kind":"Name","value":"isInternalMessagesImportEnabled"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspacesFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"userVars"}}]}}]} as unknown as DocumentNode<GetCurrentUserQuery, GetCurrentUserQueryVariables>;
export const CreateManyViewFieldsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateManyViewFields"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateViewFieldInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createManyViewFields"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"inputs"},"value":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFieldFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewField"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"aggregateOperation"}},{"kind":"Field","name":{"kind":"Name","value":"viewFieldGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode<CreateManyViewFieldsMutation, CreateManyViewFieldsMutationVariables>;
export const CreateManyViewGroupsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateManyViewGroups"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateViewGroupInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createManyViewGroups"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"inputs"},"value":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewGroupFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"fieldValue"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode<CreateManyViewGroupsMutation, CreateManyViewGroupsMutationVariables>;
export const CreateViewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateView"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateViewInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createView"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewField"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"aggregateOperation"}},{"kind":"Field","name":{"kind":"Name","value":"viewFieldGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewFieldGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewFields"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFieldFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFilterFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewFilter"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"operand"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"viewFilterGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"positionInViewFilterGroup"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"relationTargetFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFilterGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewFilterGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"parentViewFilterGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"logicalOperator"}},{"kind":"Field","name":{"kind":"Name","value":"positionInViewFilterGroup"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewSortFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewSort"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"direction"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"fieldValue"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"View"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"isCompact"}},{"kind":"Field","name":{"kind":"Name","value":"kanbanAggregateOperation"}},{"kind":"Field","name":{"kind":"Name","value":"kanbanAggregateOperationFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"mainGroupByFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"shouldHideEmptyGroups"}},{"kind":"Field","name":{"kind":"Name","value":"kanbanColumnWidth"}},{"kind":"Field","name":{"kind":"Name","value":"anyFieldFilterValue"}},{"kind":"Field","name":{"kind":"Name","value":"calendarFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"calendarEndFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"calendarLayout"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"createdByUserWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"viewFields"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFieldFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewFieldGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFieldGroupFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewFilters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFilterFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewFilterGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFilterGroupFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewSorts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewSortFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewGroupFragment"}}]}}]}}]} as unknown as DocumentNode<CreateViewMutation, CreateViewMutationVariables>;
diff --git a/packages/twenty-front/src/modules/ai/components/AiChatEditorSection.tsx b/packages/twenty-front/src/modules/ai/components/AiChatEditorSection.tsx
index c2d25d96fac..cf4c0fef9a2 100644
--- a/packages/twenty-front/src/modules/ai/components/AiChatEditorSection.tsx
+++ b/packages/twenty-front/src/modules/ai/components/AiChatEditorSection.tsx
@@ -6,10 +6,10 @@ import { EditorContent } from '@tiptap/react';
import { useLingui } from '@lingui/react/macro';
import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { SettingsPath } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import { AiChatInlineBanner } from '@/ai/components/AiChatInlineBanner';
+import { AiModelTierDropdown } from '@/ai/components/AiModelTierDropdown';
import { AiChatEmptyState } from '@/ai/components/AiChatEmptyState';
import { AiChatQuestionCard } from '@/ai/components/AiChatQuestionCard';
import { AIChatNoMoreBillingCreditsBanner } from '@/ai/components/AIChatNoMoreBillingCreditsBanner';
@@ -22,24 +22,15 @@ import { AiChatDictationHint } from '@/ai/dictation/components/AiChatDictationHi
import { AiChatContextUsageButton } from '@/ai/components/internal/AiChatContextUsageButton';
import { AiChatEditorFocusEffect } from '@/ai/components/internal/AiChatEditorFocusEffect';
import { SendMessageButton } from '@/ai/components/internal/SendMessageButton';
-import { useAgentChatModelId } from '@/ai/hooks/useAgentChatModelId';
import { useAiChatEditor } from '@/ai/hooks/useAiChatEditor';
import { useInsertDictatedText } from '@/ai/dictation/hooks/useInsertDictatedText';
import { useIsAiChatComposerCentered } from '@/ai/hooks/useIsAiChatComposerCentered';
-import { useAiModelOptions } from '@/ai/hooks/useAiModelOptions';
import { useHasReachedAiChatCreditsCap } from '@/ai/hooks/useHasReachedAiChatCreditsCap';
-import { useWorkspaceAiModelAvailability } from '@/ai/hooks/useWorkspaceAiModelAvailability';
-import { agentChatUserSelectedModelState } from '@/ai/states/agentChatUserSelectedModelState';
import { agentChatPendingQuestionComponentSelector } from '@/ai/states/selectors/agentChatPendingQuestionComponentSelector';
-import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';
-import { Select } from '@/ui/input/components/Select';
+import { aiModelsState } from '@/client-config/states/aiModelsState';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';
-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
-import { type SelectOption } from 'twenty-ui/input';
-import { PermissionFlagType } from '~/generated-metadata/graphql';
-import { useNavigateSettings } from '~/hooks/useNavigateSettings';
-import { SETTINGS_AI_TABS } from '~/pages/settings/ai/constants/SettingsAiTabs';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
const StyledInputArea = styled(StyledAiChatContentContainer)<{
isMobile: boolean;
@@ -155,31 +146,11 @@ const StyledRightButtonsContainer = styled.div`
export const AiChatEditorSection = () => {
const { t } = useLingui();
- const navigateSettings = useNavigateSettings();
- const hasAiSettingsPermission = useHasPermissionFlag(
- PermissionFlagType.AI_SETTINGS,
- );
const isMobile = useIsMobile();
const isComposerCentered = useIsAiChatComposerCentered();
const hasReachedAiChatCreditsCap = useHasReachedAiChatCreditsCap();
- const { enabledModels } = useWorkspaceAiModelAvailability();
- const hasNoEnabledModels = enabledModels.length === 0;
- const { options, pinnedOption } = useAiModelOptions({
- variant: 'pinned-default',
- });
-
- const smartModelOptions: SelectOption<string | null>[] = options;
- const defaultPinnedOption: SelectOption<string | null> | undefined =
- pinnedOption
- ? {
- ...pinnedOption,
- value: null,
- }
- : undefined;
- const setAgentChatUserSelectedModel = useSetAtomState(
- agentChatUserSelectedModelState,
- );
- const { selectedModelId } = useAgentChatModelId();
+ const aiModels = useAtomStateValue(aiModelsState);
+ const hasNoEnabledModels = aiModels.length === 0;
const { editor, handleSendAndClear } = useAiChatEditor();
@@ -204,26 +175,7 @@ export const AiChatEditorSection = () => {
<AgentChatContextPreview />
{hasNoEnabledModels && (
<AiChatInlineBanner
- message={
- hasAiSettingsPermission
- ? t`No AI models are enabled.`
- : t`Ask your workspace admin to enable an AI model.`
- }
- button={
- hasAiSettingsPermission
- ? {
- title: t`Configure models`,
- onClick: () =>
- navigateSettings(
- SettingsPath.AI,
- undefined,
- undefined,
- undefined,
- SETTINGS_AI_TABS.TABS_IDS.MODELS,
- ),
- }
- : undefined
- }
+ message={t`No AI provider is configured on this instance.`}
/>
)}
{hasReachedAiChatCreditsCap && <AIChatNoMoreBillingCreditsBanner />}
@@ -242,17 +194,9 @@ export const AiChatEditorSection = () => {
<AiChatContextUsageButton />
</StyledLeftButtonsContainer>
<StyledRightButtonsContainer>
- <Select
- dropdownId="ai-chat-smart-model-select"
- value={selectedModelId}
- onChange={setAgentChatUserSelectedModel}
- options={smartModelOptions}
- pinnedOption={defaultPinnedOption}
+ <AiModelTierDropdown
+ dropdownId="ai-chat-model-tier-dropdown"
disabled={hasNoEnabledModels}
- selectSizeVariant="small"
- showContextualTextInControl={false}
- withSearchInput
- dropdownOffset={{ x: 0, y: 8 }}
/>
<SendMessageButton
onSend={handleSendAndClear}
diff --git a/packages/twenty-front/src/modules/ai/components/AiChatQuestionCard.tsx b/packages/twenty-front/src/modules/ai/components/AiChatQuestionCard.tsx
index f0feaaef7f2..ab0f5cd346a 100644
--- a/packages/twenty-front/src/modules/ai/components/AiChatQuestionCard.tsx
+++ b/packages/twenty-front/src/modules/ai/components/AiChatQuestionCard.tsx
@@ -20,25 +20,18 @@ import {
IconSquareNumber8,
IconSquareNumber9,
} from 'twenty-ui/icon';
-import {
- LightIconButton,
- RoundedIconButton,
- type SelectOption,
-} from 'twenty-ui/input';
+import { LightIconButton, RoundedIconButton } from 'twenty-ui/input';
import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { AgentChatFileUploadButton } from '@/ai/components/internal/AgentChatFileUploadButton';
import { AiChatContextUsageButton } from '@/ai/components/internal/AiChatContextUsageButton';
import { AiChatQuestionOtherOption } from '@/ai/components/internal/AiChatQuestionOtherOption';
import { TextWithChatReferences } from '@/ai/components/TextWithChatReferences';
-import { useAgentChatModelId } from '@/ai/hooks/useAgentChatModelId';
-import { useAiModelOptions } from '@/ai/hooks/useAiModelOptions';
+import { AiModelTierDropdown } from '@/ai/components/AiModelTierDropdown';
import { useSubmitQuestionAnswer } from '@/ai/hooks/useSubmitQuestionAnswer';
-import { useWorkspaceAiModelAvailability } from '@/ai/hooks/useWorkspaceAiModelAvailability';
-import { agentChatUserSelectedModelState } from '@/ai/states/agentChatUserSelectedModelState';
import { type AgentChatPendingQuestion } from '@/ai/types/AgentChatPendingQuestion';
-import { Select } from '@/ui/input/components/Select';
-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
+import { aiModelsState } from '@/client-config/states/aiModelsState';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
const NUMBER_ICONS: IconComponent[] = [
IconSquareNumber1,
@@ -225,17 +218,8 @@ export const AiChatQuestionCard = ({
const { submitAnswer } = useSubmitQuestionAnswer();
- const { options: modelOptions, pinnedOption } = useAiModelOptions({
- variant: 'pinned-default',
- });
- const { enabledModels } = useWorkspaceAiModelAvailability();
- const hasNoEnabledModels = enabledModels.length === 0;
- const { selectedModelId } = useAgentChatModelId();
- const setAgentChatUserSelectedModel = useSetAtomState(
- agentChatUserSelectedModelState,
- );
- const defaultPinnedOption: SelectOption<string | null> | undefined =
- pinnedOption ? { ...pinnedOption, value: null } : undefined;
+ const aiModels = useAtomStateValue(aiModelsState);
+ const hasNoEnabledModels = aiModels.length === 0;
const currentQuestion = questions[currentIndex];
const hasMultipleQuestions = questions.length > 1;
@@ -515,17 +499,9 @@ export const AiChatQuestionCard = ({
<AiChatContextUsageButton />
</StyledLeftActions>
<StyledRightActions>
- <Select
- dropdownId="ai-chat-question-model-select"
- value={selectedModelId}
- onChange={setAgentChatUserSelectedModel}
- options={modelOptions}
- pinnedOption={defaultPinnedOption}
+ <AiModelTierDropdown
+ dropdownId="ai-chat-question-model-tier-dropdown"
disabled={hasNoEnabledModels}
- selectSizeVariant="small"
- showContextualTextInControl={false}
- withSearchInput
- dropdownOffset={{ x: 0, y: 8 }}
/>
<RoundedIconButton
Icon={IconArrowUp}
diff --git a/packages/twenty-front/src/modules/ai/components/AiModelPicker.tsx b/packages/twenty-front/src/modules/ai/components/AiModelPicker.tsx
new file mode 100644
index 00000000000..e992d50e13d
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/components/AiModelPicker.tsx
@@ -0,0 +1,122 @@
+import { styled } from '@linaria/react';
+import { useLingui } from '@lingui/react/macro';
+import { useState } from 'react';
+import {
+ AUTO_SELECT_MODEL_ID_BY_TIER,
+ AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,
+} from 'twenty-shared/ai';
+import { isDefined } from 'twenty-shared/utils';
+import { LightButton } from 'twenty-ui/input';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+import { AiModelTierSlider } from '@/ai/components/AiModelTierSlider';
+import { useAiModelTiers } from '@/ai/hooks/useAiModelTiers';
+import { useWorkspaceAiModelTiers } from '@/ai/hooks/useWorkspaceAiModelTiers';
+import { getAiModelTierForAgentModelId } from '@/ai/utils/getAiModelTierForAgentModelId';
+import { getNearestAiModelTier } from '@/ai/utils/getNearestAiModelTier';
+import { aiModelsState } from '@/client-config/states/aiModelsState';
+import { AiModelPinSelect } from '@/settings/ai/components/AiModelPinSelect';
+import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
+
+const StyledContainer = styled.div`
+ display: flex;
+ flex-direction: column;
+ gap: ${themeCssVariables.spacing[2]};
+`;
+
+const StyledSliderCard = styled.div`
+ background: ${themeCssVariables.background.secondary};
+ border: 1px solid ${themeCssVariables.border.color.medium};
+ border-radius: ${themeCssVariables.border.radius.md};
+ corner-shape: round;
+ padding: ${themeCssVariables.spacing[3]};
+`;
+
+const StyledFooter = styled.div`
+ align-items: center;
+ display: flex;
+ justify-content: space-between;
+`;
+
+const StyledHint = styled.span`
+ color: ${themeCssVariables.font.color.light};
+ font-size: ${themeCssVariables.font.size.sm};
+`;
+
+type AiModelPickerProps = {
+ modelId: string;
+ onModelIdChange: (modelId: string) => void;
+ disabled?: boolean;
+};
+
+export const AiModelPicker = ({
+ modelId,
+ onModelIdChange,
+ disabled = false,
+}: AiModelPickerProps) => {
+ const { t } = useLingui();
+ const tiers = useAiModelTiers();
+ const aiModels = useAtomStateValue(aiModelsState);
+ const { agentTier } = useWorkspaceAiModelTiers();
+
+ const isWorkspaceDefault = modelId === AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID;
+ const tierFromModelId = getAiModelTierForAgentModelId(modelId, agentTier);
+ const hasPinnedModel = !isDefined(tierFromModelId);
+ const pinnedModel = hasPinnedModel
+ ? aiModels.find((model) => model.modelId === modelId)
+ : undefined;
+
+ const [isAdvancedOpen, setIsAdvancedOpen] = useState(hasPinnedModel);
+
+ const selectedTier =
+ tierFromModelId ?? getNearestAiModelTier(pinnedModel, tiers);
+
+ return (
+ <StyledContainer>
+ <StyledSliderCard>
+ <AiModelTierSlider
+ selectedTier={selectedTier}
+ onTierChange={(tier) =>
+ onModelIdChange(AUTO_SELECT_MODEL_ID_BY_TIER[tier])
+ }
+ title={hasPinnedModel ? (pinnedModel?.label ?? modelId) : undefined}
+ disabled={disabled}
+ />
+ </StyledSliderCard>
+ <StyledFooter>
+ <StyledHint>
+ {isWorkspaceDefault
+ ? t`Follows the workspace default for agents`
+ : hasPinnedModel
+ ? t`Pinned to a specific model`
+ : t`Set for this agent only`}
+ </StyledHint>
+ {!isAdvancedOpen && !disabled && (
+ <LightButton
+ title={t`Advanced`}
+ accent="tertiary"
+ onClick={() => setIsAdvancedOpen(true)}
+ />
+ )}
+ </StyledFooter>
+ {isAdvancedOpen && (
+ <AiModelPinSelect
+ dropdownId="ai-model-picker-pinned-model"
+ label={t`Pin a specific model`}
+ description={t`Overrides the tier above until you switch back to automatic`}
+ modelId={hasPinnedModel ? modelId : null}
+ onChange={(pinnedModelId) =>
+ onModelIdChange(
+ pinnedModelId ?? AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,
+ )
+ }
+ aiModels={aiModels}
+ emptyOptionLabel={t`Automatic`}
+ disabled={disabled}
+ dropdownWidth={GenericDropdownContentWidth.ExtraLarge}
+ />
+ )}
+ </StyledContainer>
+ );
+};
diff --git a/packages/twenty-front/src/modules/ai/components/AiModelTierBars.tsx b/packages/twenty-front/src/modules/ai/components/AiModelTierBars.tsx
new file mode 100644
index 00000000000..346d7e7ee4d
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/components/AiModelTierBars.tsx
@@ -0,0 +1,61 @@
+import { styled } from '@linaria/react';
+import { AI_MODEL_TIERS, type AiModelTier } from 'twenty-shared/ai';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+const BAR_WIDTH_PX = 3;
+const BAR_HEIGHT_PX = 10;
+
+const StyledButton = styled.button<{ disabled: boolean }>`
+ align-items: center;
+ background: transparent;
+ border: none;
+ border-radius: ${themeCssVariables.border.radius.sm};
+ cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
+ display: flex;
+ gap: 2px;
+ height: 24px;
+ opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
+ padding: 0 ${themeCssVariables.spacing[1]};
+
+ &:hover {
+ background: ${({ disabled }) =>
+ disabled
+ ? 'transparent'
+ : themeCssVariables.background.transparent.light};
+ }
+`;
+
+const StyledBar = styled.span<{ isReached: boolean }>`
+ background: ${({ isReached }) =>
+ isReached
+ ? themeCssVariables.font.color.tertiary
+ : themeCssVariables.background.tertiary};
+ border-radius: ${BAR_WIDTH_PX / 2}px;
+ display: block;
+ height: ${BAR_HEIGHT_PX}px;
+ width: ${BAR_WIDTH_PX}px;
+`;
+
+type AiModelTierBarsProps = {
+ selectedTier: AiModelTier;
+ label: string;
+ disabled?: boolean;
+};
+
+// One bar per tier, filled up to the selected one, so the composer shows the
+// level without spending the space a label would take.
+export const AiModelTierBars = ({
+ selectedTier,
+ label,
+ disabled = false,
+}: AiModelTierBarsProps) => {
+ const selectedStep = AI_MODEL_TIERS.indexOf(selectedTier);
+
+ return (
+ <StyledButton type="button" aria-label={label} disabled={disabled}>
+ {AI_MODEL_TIERS.map((tier, index) => (
+ <StyledBar key={tier} isReached={index <= selectedStep} />
+ ))}
+ </StyledButton>
+ );
+};
diff --git a/packages/twenty-front/src/modules/ai/components/AiModelTierDropdown.tsx b/packages/twenty-front/src/modules/ai/components/AiModelTierDropdown.tsx
new file mode 100644
index 00000000000..84b288de20e
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/components/AiModelTierDropdown.tsx
@@ -0,0 +1,82 @@
+import { styled } from '@linaria/react';
+import { useLingui } from '@lingui/react/macro';
+import { AI_MODEL_TIERS, type AiModelTier } from 'twenty-shared/ai';
+import { isDefined } from 'twenty-shared/utils';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+import { AiModelTierBars } from '@/ai/components/AiModelTierBars';
+import { AiModelTierSlider } from '@/ai/components/AiModelTierSlider';
+import { useAiModelTiers } from '@/ai/hooks/useAiModelTiers';
+import { useIsWorkspaceSetupChat } from '@/ai/hooks/useIsWorkspaceSetupChat';
+import { useWorkspaceAiModelTiers } from '@/ai/hooks/useWorkspaceAiModelTiers';
+import { agentChatUserSelectedModelTierState } from '@/ai/states/agentChatUserSelectedModelTierState';
+import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
+import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
+
+const SLIDER_DROPDOWN_WIDTH_PX = 286;
+
+const StyledSliderContainer = styled.div`
+ padding: ${themeCssVariables.spacing[3]};
+`;
+
+type AiModelTierDropdownProps = {
+ dropdownId: string;
+ disabled?: boolean;
+};
+
+export const AiModelTierDropdown = ({
+ dropdownId,
+ disabled = false,
+}: AiModelTierDropdownProps) => {
+ const { t } = useLingui();
+ const tiers = useAiModelTiers();
+ const { chatTier } = useWorkspaceAiModelTiers();
+ const isWorkspaceSetupChat = useIsWorkspaceSetupChat();
+ const [agentChatUserSelectedModelTier, setAgentChatUserSelectedModelTier] =
+ useAtomState(agentChatUserSelectedModelTierState);
+
+ // The setup chat runs on the fast tier server-side whatever the workspace
+ // setting says, so the control shows what will actually answer.
+ const workspaceTier: AiModelTier = isWorkspaceSetupChat ? 'fast' : chatTier;
+
+ const selectedTier = agentChatUserSelectedModelTier ?? workspaceTier;
+ const selectedResolvedTier = tiers[AI_MODEL_TIERS.indexOf(selectedTier)];
+
+ const handleTierChange = (tier: AiModelTier) => {
+ setAgentChatUserSelectedModelTier(tier === workspaceTier ? null : tier);
+ };
+
+ return (
+ <Dropdown
+ dropdownId={dropdownId}
+ dropdownPlacement="top-end"
+ dropdownOffset={{ x: 0, y: 8 }}
+ clickableComponent={
+ <AiModelTierBars
+ selectedTier={selectedTier}
+ label={
+ isDefined(selectedResolvedTier.model)
+ ? t`${selectedResolvedTier.label}: ${selectedResolvedTier.model.label}`
+ : selectedResolvedTier.label
+ }
+ disabled={disabled}
+ />
+ }
+ dropdownComponents={
+ <DropdownContent widthInPixels={SLIDER_DROPDOWN_WIDTH_PX}>
+ <StyledSliderContainer
+ role="group"
+ aria-label={t`Choose a model tier`}
+ >
+ <AiModelTierSlider
+ selectedTier={selectedTier}
+ onTierChange={handleTierChange}
+ disabled={disabled}
+ />
+ </StyledSliderContainer>
+ </DropdownContent>
+ }
+ />
+ );
+};
diff --git a/packages/twenty-front/src/modules/ai/components/AiModelTierSlider.tsx b/packages/twenty-front/src/modules/ai/components/AiModelTierSlider.tsx
new file mode 100644
index 00000000000..56a7d763c5a
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/components/AiModelTierSlider.tsx
@@ -0,0 +1,268 @@
+import { styled } from '@linaria/react';
+import { useLingui } from '@lingui/react/macro';
+import { type ChangeEvent, useContext, useId } from 'react';
+import { AI_MODEL_TIERS, type AiModelTier } from 'twenty-shared/ai';
+import { isDefined } from 'twenty-shared/utils';
+import { IconBolt, IconBrain, IconCoins } from 'twenty-ui/icon';
+import { AppTooltip, TooltipDelay } from 'twenty-ui/surfaces';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
+
+import { useAiModelTiers } from '@/ai/hooks/useAiModelTiers';
+import { formatPercentDelta } from '@/ai/utils/formatPercentDelta';
+import { formatNumber } from '~/utils/format/formatNumber';
+
+const TRACK_HEIGHT_PX = 24;
+const TRACK_INSET_PX = 2;
+const DOT_CENTER_INSET_PX = 18;
+const HANDLE_WIDTH_PX = 12;
+const HANDLE_HEIGHT_PX = 28;
+const LAST_STEP = AI_MODEL_TIERS.length - 1;
+const BALANCED_STEP = AI_MODEL_TIERS.indexOf('balanced');
+
+const StyledContainer = styled.div`
+ display: flex;
+ flex-direction: column;
+ gap: ${themeCssVariables.spacing[3]};
+ width: 100%;
+`;
+
+const StyledHeader = styled.div`
+ align-items: center;
+ display: flex;
+ height: 20px;
+ justify-content: space-between;
+`;
+
+const StyledTitle = styled.span`
+ color: ${themeCssVariables.font.color.primary};
+ font-size: ${themeCssVariables.font.size.md};
+ font-weight: ${themeCssVariables.font.weight.semiBold};
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+`;
+
+const StyledMetrics = styled.div`
+ align-items: center;
+ display: flex;
+ flex-shrink: 0;
+ gap: ${themeCssVariables.spacing[2]};
+`;
+
+const StyledMetric = styled.span<{ isInherited: boolean }>`
+ align-items: center;
+ color: ${({ isInherited }) =>
+ isInherited
+ ? themeCssVariables.font.color.light
+ : themeCssVariables.font.color.tertiary};
+ display: flex;
+ font-size: ${themeCssVariables.font.size.sm};
+ font-weight: ${themeCssVariables.font.weight.medium};
+ gap: 2px;
+`;
+
+const StyledTrack = styled.div<{ disabled: boolean }>`
+ background: ${themeCssVariables.background.tertiary};
+ border-radius: ${themeCssVariables.border.radius.md};
+ corner-shape: round;
+ cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
+ height: ${TRACK_HEIGHT_PX}px;
+ opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
+ position: relative;
+ width: 100%;
+
+ &:has(input:focus-visible) {
+ box-shadow: 0 0 0 3px ${themeCssVariables.color.blue3};
+ }
+`;
+
+// The handle centre sits on a dot, so the fill runs from the track inset to
+// half a handle past that dot.
+const StyledFill = styled.div`
+ background: ${themeCssVariables.color.blue};
+ border-radius: ${themeCssVariables.border.radius.sm};
+ corner-shape: round;
+ height: ${TRACK_HEIGHT_PX - 2 * TRACK_INSET_PX}px;
+ left: ${TRACK_INSET_PX}px;
+ position: absolute;
+ top: ${TRACK_INSET_PX}px;
+ width: calc(
+ ${DOT_CENTER_INSET_PX - TRACK_INSET_PX + HANDLE_WIDTH_PX / 2}px +
+ var(--slider-step) * (100% - ${2 * DOT_CENTER_INSET_PX}px) / ${LAST_STEP}
+ );
+`;
+
+const StyledDots = styled.div`
+ display: flex;
+ inset: 0 ${DOT_CENTER_INSET_PX - 2}px;
+ justify-content: space-between;
+ pointer-events: none;
+ position: absolute;
+`;
+
+const StyledDot = styled.span<{ isReached: boolean }>`
+ align-self: center;
+ background: ${({ isReached }) =>
+ isReached
+ ? themeCssVariables.background.primary
+ : themeCssVariables.border.color.strong};
+ border-radius: ${themeCssVariables.border.radius.rounded};
+ corner-shape: round;
+ height: 4px;
+ width: 4px;
+`;
+
+const StyledHandle = styled.div`
+ background: ${themeCssVariables.background.primary};
+ border-radius: ${themeCssVariables.border.radius.md};
+ box-shadow: ${themeCssVariables.boxShadow.light};
+ corner-shape: round;
+ height: ${HANDLE_HEIGHT_PX}px;
+ pointer-events: none;
+ position: absolute;
+ right: 0;
+ top: 50%;
+ transform: translateY(-50%);
+ width: ${HANDLE_WIDTH_PX}px;
+`;
+
+const StyledInput = styled.input`
+ appearance: none;
+ background: transparent;
+ cursor: inherit;
+ height: 100%;
+ inset: 0;
+ margin: 0;
+ opacity: 0;
+ position: absolute;
+ width: 100%;
+`;
+
+type AiModelTierSliderProps = {
+ selectedTier: AiModelTier;
+ onTierChange: (tier: AiModelTier) => void;
+ // Shown instead of the tier name, for an agent pinned to a specific model.
+ title?: string;
+ disabled?: boolean;
+};
+
+export const AiModelTierSlider = ({
+ selectedTier,
+ onTierChange,
+ title,
+ disabled = false,
+}: AiModelTierSliderProps) => {
+ const { t } = useLingui();
+ const { theme } = useContext(ThemeContext);
+ const tiers = useAiModelTiers();
+ const tooltipId = useId().replace(/:/g, '');
+
+ const selectedStep = AI_MODEL_TIERS.indexOf(selectedTier);
+ const resolvedTier = tiers[selectedStep];
+ const model = resolvedTier.model;
+
+ // The base model's reading stands in until the sync measures this effort.
+ const isBenchmarkInherited = model?.isBenchmarkInherited ?? false;
+ const inheritedNote = isBenchmarkInherited
+ ? t` Not measured at this effort yet, so this is the base model's reading.`
+ : '';
+
+ // Below Balanced the gain is speed, above it intelligence; cost moves with
+ // both, so each side shows the two figures that explain the trade.
+ const metrics = [
+ ...(selectedStep < BALANCED_STEP
+ ? [
+ {
+ key: 'speed',
+ Icon: IconBolt,
+ deltaPercent: resolvedTier.speedDeltaPercent,
+ description: t`${formatNumber(model?.outputTokensPerSecond ?? 0)} tokens per second`,
+ },
+ ]
+ : []),
+ ...(selectedStep !== BALANCED_STEP
+ ? [
+ {
+ key: 'cost',
+ Icon: IconCoins,
+ deltaPercent: resolvedTier.costDeltaPercent,
+ description: t`cost per task`,
+ },
+ ]
+ : []),
+ ...(selectedStep > BALANCED_STEP
+ ? [
+ {
+ key: 'intelligence',
+ Icon: IconBrain,
+ deltaPercent: resolvedTier.intelligenceDeltaPercent,
+ description: t`intelligence index ${formatNumber(model?.intelligenceIndex ?? 0)}`,
+ },
+ ]
+ : []),
+ ].filter((metric) => isDefined(metric.deltaPercent));
+
+ const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
+ const tier = AI_MODEL_TIERS[Number(event.target.value)];
+
+ if (isDefined(tier)) {
+ onTierChange(tier);
+ }
+ };
+
+ return (
+ <StyledContainer>
+ <StyledHeader>
+ <StyledTitle title={model?.label}>
+ {title ?? resolvedTier.label}
+ </StyledTitle>
+ <StyledMetrics>
+ {metrics.map(({ key, Icon, deltaPercent }) => (
+ <StyledMetric
+ key={key}
+ id={`ai-model-tier-${key}-${tooltipId}`}
+ isInherited={isBenchmarkInherited}
+ >
+ <Icon size={theme.icon.size.md} />
+ {formatPercentDelta(deltaPercent ?? 0)}
+ </StyledMetric>
+ ))}
+ </StyledMetrics>
+ </StyledHeader>
+ <StyledTrack
+ disabled={disabled}
+ style={{ '--slider-step': selectedStep } as React.CSSProperties}
+ >
+ <StyledFill>
+ <StyledHandle />
+ </StyledFill>
+ <StyledDots>
+ {AI_MODEL_TIERS.map((tier, index) => (
+ <StyledDot key={tier} isReached={index <= selectedStep} />
+ ))}
+ </StyledDots>
+ <StyledInput
+ type="range"
+ min={0}
+ max={LAST_STEP}
+ step={1}
+ value={selectedStep}
+ onChange={handleChange}
+ disabled={disabled}
+ aria-label={t`Model`}
+ aria-valuetext={resolvedTier.label}
+ />
+ </StyledTrack>
+ {isDefined(model) &&
+ metrics.map(({ key, description }) => (
+ <AppTooltip
+ key={key}
+ anchorSelect={`#ai-model-tier-${key}-${tooltipId}`}
+ title={`${t`${model.label}: ${description}, compared with the Balanced tier.`}${inheritedNote}`}
+ delay={TooltipDelay.shortDelay}
+ place="bottom"
+ />
+ ))}
+ </StyledContainer>
+ );
+};
diff --git a/packages/twenty-front/src/modules/ai/components/RoutingDebugDisplay.tsx b/packages/twenty-front/src/modules/ai/components/RoutingDebugDisplay.tsx
index 274fff8240e..26b83537ed5 100644
--- a/packages/twenty-front/src/modules/ai/components/RoutingDebugDisplay.tsx
+++ b/packages/twenty-front/src/modules/ai/components/RoutingDebugDisplay.tsx
@@ -251,8 +251,6 @@ const DetailsTab = ({ debug, copyToClipboard }: DetailsTabProps) => {
id: debug.selectedAgentId,
label: debug.selectedAgentLabel,
},
- fastModel: debug.fastModel,
- smartModel: debug.smartModel,
agentModel: debug.agentModel,
availableAgents: debug.availableAgents,
};
diff --git a/packages/twenty-front/src/modules/ai/components/SettingsAgentModelCapabilities.tsx b/packages/twenty-front/src/modules/ai/components/SettingsAgentModelCapabilities.tsx
index 17369d59315..1ff6fa9f7ee 100644
--- a/packages/twenty-front/src/modules/ai/components/SettingsAgentModelCapabilities.tsx
+++ b/packages/twenty-front/src/modules/ai/components/SettingsAgentModelCapabilities.tsx
@@ -1,6 +1,5 @@
-import { aiModelsState } from '@/client-config/states/aiModelsState';
+import { useResolvedAiModel } from '@/ai/hooks/useResolvedAiModel';
import { InputLabel, Checkbox } from 'twenty-ui/input';
-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { useContext } from 'react';
@@ -59,9 +58,7 @@ export const SettingsAgentModelCapabilities = ({
disabled = false,
}: SettingsAgentModelCapabilitiesProps) => {
const { theme } = useContext(ThemeContext);
- const aiModels = useAtomStateValue(aiModelsState);
-
- const selectedModel = aiModels.find((m) => m.modelId === selectedModelId);
+ const selectedModel = useResolvedAiModel(selectedModelId);
const nativeCapabilities = selectedModel?.nativeCapabilities;
if (!isDefined(nativeCapabilities)) {
diff --git a/packages/twenty-front/src/modules/ai/hooks/__tests__/useAgentChatModelId.test.tsx b/packages/twenty-front/src/modules/ai/hooks/__tests__/useAgentChatModelId.test.tsx
index 210c3b71a81..b35b125bc27 100644
--- a/packages/twenty-front/src/modules/ai/hooks/__tests__/useAgentChatModelId.test.tsx
+++ b/packages/twenty-front/src/modules/ai/hooks/__tests__/useAgentChatModelId.test.tsx
@@ -1,16 +1,8 @@
import { act, renderHook } from '@testing-library/react';
import { Provider as JotaiProvider } from 'jotai';
-import { MemoryRouter } from 'react-router-dom';
-import { AI_CHAT_SURFACE } from '@/ai/constants/AiChatSurface';
-import { AiChatSurfaceContext } from '@/ai/contexts/AiChatSurfaceContext';
-import { type AiChatSurface } from '@/ai/types/AiChatSurface';
-import { AppPath } from 'twenty-shared/types';
-import { getAppPath } from 'twenty-shared/utils';
import { useAgentChatModelId } from '@/ai/hooks/useAgentChatModelId';
-import { agentChatUserSelectedModelState } from '@/ai/states/agentChatUserSelectedModelState';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
-import { aiModelsState } from '@/client-config/states/aiModelsState';
+import { agentChatUserSelectedModelTierState } from '@/ai/states/agentChatUserSelectedModelTierState';
import { shouldOpenAiChatAfterOnboardingState } from '@/onboarding/states/shouldOpenAiChatAfterOnboardingState';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
import {
@@ -18,125 +10,68 @@ import {
resetJotaiStore,
} from '@/ui/utilities/state/jotai/jotaiStore';
-const getWrapper =
- (pathname: string, surface?: AiChatSurface) =>
- ({ children }: { children: React.ReactNode }) => (
- <MemoryRouter initialEntries={[pathname]}>
- <JotaiProvider store={jotaiStore}>
- <AiChatSurfaceContext.Provider value={surface}>
- {children}
- </AiChatSurfaceContext.Provider>
- </JotaiProvider>
- </MemoryRouter>
+const Wrapper = ({ children }: { children: React.ReactNode }) => (
+ <JotaiProvider store={jotaiStore}>{children}</JotaiProvider>
+);
+
+const renderHooks = () =>
+ renderHook(
+ () => ({
+ setSelectedTier: useSetAtomState(agentChatUserSelectedModelTierState),
+ setShouldOpenAiChatAfterOnboarding: useSetAtomState(
+ shouldOpenAiChatAfterOnboardingState,
+ ),
+ ...useAgentChatModelId(),
+ }),
+ { wrapper: Wrapper },
);
-const renderHooks = ({
- pathname,
- userSelectedModel = null,
- surface,
-}: {
- pathname: string;
- userSelectedModel?: string | null;
- surface?: AiChatSurface;
-}) => {
- const { result } = renderHook(
- () => {
- const setCurrentWorkspace = useSetAtomState(currentWorkspaceState);
- const setAiModels = useSetAtomState(aiModelsState);
- const setAgentChatUserSelectedModel = useSetAtomState(
- agentChatUserSelectedModelState,
- );
-
- return {
- setCurrentWorkspace,
- setAiModels,
- setAgentChatUserSelectedModel,
- ...useAgentChatModelId(),
- };
- },
- { wrapper: getWrapper(pathname, surface) },
- );
-
- act(() => {
- result.current.setCurrentWorkspace({
- fastModel: 'openai/gpt-5-mini',
- smartModel: 'openai/gpt-5.2',
- useRecommendedModels: false,
- enabledAiModelIds: ['openai/gpt-4.1'],
- } as never);
- result.current.setAiModels([
- { modelId: 'openai/gpt-4.1', isDeprecated: false },
- ] as never);
- result.current.setAgentChatUserSelectedModel(userSelectedModel);
- });
-
- return result;
-};
-
-const onboardingChatPath = getAppPath(AppPath.AiChat, { threadId: null });
-
describe('useAgentChatModelId', () => {
beforeEach(() => {
- sessionStorage.clear();
+ window.localStorage.clear();
resetJotaiStore();
});
- it.each([onboardingChatPath, '/objects/companies'])(
- 'should request the workspace fast model during onboarding on %s',
- (pathname) => {
- jotaiStore.set(shouldOpenAiChatAfterOnboardingState.atom, true);
-
- const result = renderHooks({ pathname });
-
- expect(result.current.modelIdForRequest).toBe('openai/gpt-5-mini');
- },
- );
-
- it('should request no model on a plain chat page', () => {
- const result = renderHooks({ pathname: onboardingChatPath });
+ it('sends nothing so the server falls back to the workspace chat tier', () => {
+ const { result } = renderHooks();
expect(result.current.modelIdForRequest).toBeUndefined();
});
- it.each([undefined, AI_CHAT_SURFACE.PAGE, AI_CHAT_SURFACE.SIDE_PANEL])(
- 'keeps sends, retries and answers on the fast model in surface %s',
- (surface) => {
- jotaiStore.set(shouldOpenAiChatAfterOnboardingState.atom, true);
- const result = renderHooks({ pathname: onboardingChatPath, surface });
-
- expect(result.current.modelIdForRequest).toBe('openai/gpt-5-mini');
-
- act(() =>
- jotaiStore.set(shouldOpenAiChatAfterOnboardingState.atom, false),
- );
-
- expect(result.current.modelIdForRequest).toBeUndefined();
- },
- );
+ it('ignores a persisted tier name it does not know', () => {
+ window.localStorage.setItem(
+ 'ai/agentChatUserSelectedModelTier',
+ JSON.stringify('turbo'),
+ );
- it('should request no model elsewhere so the server falls back to the smart model', () => {
- const result = renderHooks({ pathname: '/objects/companies' });
+ const { result } = renderHooks();
expect(result.current.modelIdForRequest).toBeUndefined();
});
- it('should let a user selected model win during the onboarding chat', () => {
- jotaiStore.set(shouldOpenAiChatAfterOnboardingState.atom, true);
+ it('sends the auto-select id of the tier the user picked', () => {
+ const { result } = renderHooks();
- const result = renderHooks({
- pathname: onboardingChatPath,
- userSelectedModel: 'openai/gpt-4.1',
+ act(() => {
+ result.current.setSelectedTier('smart');
});
- expect(result.current.modelIdForRequest).toBe('openai/gpt-4.1');
+ expect(result.current.modelIdForRequest).toBe('default-smart-model');
});
- it('should keep an auto-select sentinel selection instead of discarding it', () => {
- const result = renderHooks({
- pathname: '/objects/companies',
- userSelectedModel: 'default-fast-model',
+ it('runs the workspace setup chat on the fast tier unless the user picked one', () => {
+ const { result } = renderHooks();
+
+ act(() => {
+ result.current.setShouldOpenAiChatAfterOnboarding(true);
});
expect(result.current.modelIdForRequest).toBe('default-fast-model');
+
+ act(() => {
+ result.current.setSelectedTier('extraSmart');
+ });
+
+ expect(result.current.modelIdForRequest).toBe('default-extra-smart-model');
});
});
diff --git a/packages/twenty-front/src/modules/ai/hooks/__tests__/useAiModelOptions.test.tsx b/packages/twenty-front/src/modules/ai/hooks/__tests__/useAiModelOptions.test.tsx
deleted file mode 100644
index cb1451fd982..00000000000
--- a/packages/twenty-front/src/modules/ai/hooks/__tests__/useAiModelOptions.test.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import { act, renderHook } from '@testing-library/react';
-import { Provider as JotaiProvider } from 'jotai';
-import { MemoryRouter } from 'react-router-dom';
-import { AI_CHAT_SURFACE } from '@/ai/constants/AiChatSurface';
-import { AiChatSurfaceContext } from '@/ai/contexts/AiChatSurfaceContext';
-import { AppPath } from 'twenty-shared/types';
-import { getAppPath } from 'twenty-shared/utils';
-
-import { useAiModelOptions } from '@/ai/hooks/useAiModelOptions';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
-import { aiModelsState } from '@/client-config/states/aiModelsState';
-import { shouldOpenAiChatAfterOnboardingState } from '@/onboarding/states/shouldOpenAiChatAfterOnboardingState';
-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
-import {
- jotaiStore,
- resetJotaiStore,
-} from '@/ui/utilities/state/jotai/jotaiStore';
-
-const getWrapper =
- (pathname: string) =>
- ({ children }: { children: React.ReactNode }) => (
- <MemoryRouter initialEntries={[pathname]}>
- <JotaiProvider store={jotaiStore}>
- <AiChatSurfaceContext.Provider value={AI_CHAT_SURFACE.SIDE_PANEL}>
- {children}
- </AiChatSurfaceContext.Provider>
- </JotaiProvider>
- </MemoryRouter>
- );
-
-const renderHooks = (pathname: string) => {
- const { result } = renderHook(
- () => {
- const setCurrentWorkspace = useSetAtomState(currentWorkspaceState);
- const setAiModels = useSetAtomState(aiModelsState);
-
- return {
- setCurrentWorkspace,
- setAiModels,
- ...useAiModelOptions({ variant: 'pinned-default' }),
- };
- },
- { wrapper: getWrapper(pathname) },
- );
-
- act(() => {
- result.current.setCurrentWorkspace({
- fastModel: 'default-fast-model',
- smartModel: 'default-smart-model',
- useRecommendedModels: true,
- } as never);
- result.current.setAiModels([
- {
- modelId: 'default-smart-model',
- label: 'GPT-5.2',
- providerName: 'openai',
- },
- {
- modelId: 'default-fast-model',
- label: 'GPT-5.6 Luna',
- providerName: 'openai',
- },
- ] as never);
- });
-
- return result;
-};
-
-describe('useAiModelOptions', () => {
- beforeEach(() => {
- sessionStorage.clear();
- resetJotaiStore();
- });
-
- it('should pin the workspace fast model during the onboarding chat', () => {
- jotaiStore.set(shouldOpenAiChatAfterOnboardingState.atom, true);
-
- const result = renderHooks(getAppPath(AppPath.AiChat, { threadId: null }));
-
- expect(result.current.pinnedOption?.label).toBe('GPT-5.6 Luna');
- });
-
- it('should pin the workspace smart model on a plain chat page', () => {
- const result = renderHooks(getAppPath(AppPath.AiChat, { threadId: null }));
-
- expect(result.current.pinnedOption?.label).toBe('GPT-5.2');
- });
-
- it('should pin the workspace smart model elsewhere', () => {
- const result = renderHooks('/objects/companies');
-
- expect(result.current.pinnedOption?.label).toBe('GPT-5.2');
- });
-});
diff --git a/packages/twenty-front/src/modules/ai/hooks/__tests__/useAiModelTiers.test.tsx b/packages/twenty-front/src/modules/ai/hooks/__tests__/useAiModelTiers.test.tsx
new file mode 100644
index 00000000000..a6821cd0498
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/hooks/__tests__/useAiModelTiers.test.tsx
@@ -0,0 +1,157 @@
+import { act, renderHook } from '@testing-library/react';
+import { Provider as JotaiProvider } from 'jotai';
+
+import { useAiModelTiers } from '@/ai/hooks/useAiModelTiers';
+import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { aiModelTiersState } from '@/client-config/states/aiModelTiersState';
+import { aiModelsState } from '@/client-config/states/aiModelsState';
+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
+import {
+ jotaiStore,
+ resetJotaiStore,
+} from '@/ui/utilities/state/jotai/jotaiStore';
+import {
+ AiModelTier,
+ type ClientAiModelConfig,
+} from '~/generated-metadata/graphql';
+import { mockCurrentWorkspace } from '~/testing/mock-data/users';
+
+const Wrapper = ({ children }: { children: React.ReactNode }) => (
+ <JotaiProvider store={jotaiStore}>{children}</JotaiProvider>
+);
+
+const buildModel = ({
+ modelId,
+ outputTokensPerSecond,
+ intelligenceIndex,
+ inputCostPerMillionTokens,
+}: {
+ modelId: string;
+ outputTokensPerSecond: number;
+ intelligenceIndex: number;
+ inputCostPerMillionTokens: number;
+}): ClientAiModelConfig => ({
+ modelId,
+ label: modelId,
+ sdkPackage: null,
+ outputTokensPerSecond,
+ intelligenceIndex,
+ inputCostPerMillionTokens,
+ outputCostPerMillionTokens: inputCostPerMillionTokens * 4,
+});
+
+const models = [
+ buildModel({
+ modelId: 'openai/luna',
+ outputTokensPerSecond: 120,
+ intelligenceIndex: 36,
+ inputCostPerMillionTokens: 0.5,
+ }),
+ buildModel({
+ modelId: 'openai/terra',
+ outputTokensPerSecond: 100,
+ intelligenceIndex: 40,
+ inputCostPerMillionTokens: 2,
+ }),
+ buildModel({
+ modelId: 'openai/sol',
+ outputTokensPerSecond: 60,
+ intelligenceIndex: 48,
+ inputCostPerMillionTokens: 4,
+ }),
+ buildModel({
+ modelId: 'anthropic/opus',
+ outputTokensPerSecond: 50,
+ intelligenceIndex: 50,
+ inputCostPerMillionTokens: 5,
+ }),
+];
+
+const instanceTiers = [
+ { tier: AiModelTier.extraFast, modelId: 'openai/luna' },
+ { tier: AiModelTier.fast, modelId: 'openai/luna' },
+ { tier: AiModelTier.balanced, modelId: 'openai/terra' },
+ { tier: AiModelTier.smart, modelId: 'openai/sol' },
+ { tier: AiModelTier.extraSmart, modelId: 'openai/missing' },
+];
+
+const renderHooks = () =>
+ renderHook(
+ () => ({
+ setAiModels: useSetAtomState(aiModelsState),
+ setAiModelTiers: useSetAtomState(aiModelTiersState),
+ setCurrentWorkspace: useSetAtomState(currentWorkspaceState),
+ tiers: useAiModelTiers(),
+ }),
+ { wrapper: Wrapper },
+ );
+
+describe('useAiModelTiers', () => {
+ beforeEach(() => {
+ resetJotaiStore();
+ });
+
+ it('resolves every tier from the instance defaults with deltas against Balanced', () => {
+ const { result } = renderHooks();
+
+ act(() => {
+ result.current.setAiModels(models);
+ result.current.setAiModelTiers(instanceTiers);
+ result.current.setCurrentWorkspace(mockCurrentWorkspace);
+ });
+
+ const fast = result.current.tiers.find((tier) => tier.tier === 'fast');
+ const extraSmart = result.current.tiers.find(
+ (tier) => tier.tier === 'extraSmart',
+ );
+
+ expect(result.current.tiers.map((tier) => tier.tier)).toEqual([
+ 'extraFast',
+ 'fast',
+ 'balanced',
+ 'smart',
+ 'extraSmart',
+ ]);
+ expect(fast?.model?.modelId).toBe('openai/luna');
+ expect(fast?.speedDeltaPercent).toBe(20);
+ expect(fast?.intelligenceDeltaPercent).toBe(-10);
+ expect(fast?.costDeltaPercent).toBe(-75);
+ expect(extraSmart?.model).toBeUndefined();
+ expect(extraSmart?.speedDeltaPercent).toBeUndefined();
+ });
+
+ it('uses the workspace pin only while automatic selection is off', () => {
+ const { result } = renderHooks();
+
+ act(() => {
+ result.current.setAiModels(models);
+ result.current.setAiModelTiers(instanceTiers);
+ result.current.setCurrentWorkspace({
+ ...mockCurrentWorkspace,
+ isAutoModelSelectionEnabled: false,
+ aiModelIdByTier: { smart: 'anthropic/opus', fast: 'openai/gone' },
+ });
+ });
+
+ const smart = result.current.tiers.find((tier) => tier.tier === 'smart');
+ const fast = result.current.tiers.find((tier) => tier.tier === 'fast');
+
+ expect(smart?.model?.modelId).toBe('anthropic/opus');
+ expect(smart?.isPinned).toBe(true);
+ expect(fast?.model?.modelId).toBe('openai/luna');
+ expect(fast?.isPinned).toBe(false);
+
+ act(() => {
+ result.current.setCurrentWorkspace({
+ ...mockCurrentWorkspace,
+ isAutoModelSelectionEnabled: true,
+ aiModelIdByTier: { smart: 'anthropic/opus' },
+ });
+ });
+
+ expect(
+ result.current.tiers.find((tier) => tier.tier === 'smart')?.model
+ ?.modelId,
+ ).toBe('openai/sol');
+ });
+});
diff --git a/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts b/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts
index 07bd2c4b60f..5ef3f565a5b 100644
--- a/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts
+++ b/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts
@@ -19,10 +19,10 @@ import { AGENT_CHAT_STOP_EVENT_NAME } from '@/ai/constants/AgentChatStopEventNam
import { SEND_CHAT_MESSAGE } from '@/ai/graphql/mutations/sendChatMessage';
import { STOP_AGENT_CHAT_STREAM } from '@/ai/graphql/mutations/stopAgentChatStream';
import { useAgentChatModelId } from '@/ai/hooks/useAgentChatModelId';
+import { aiModelsState } from '@/client-config/states/aiModelsState';
import { useGetBrowsingContext } from '@/ai/hooks/useBrowsingContext';
import { useProjectAiChatThreadToUrl } from '@/ai/hooks/useProjectAiChatThreadToUrl';
import { useOptimisticallyUnarchiveOnSend } from '@/ai/hooks/useOptimisticallyUnarchiveOnSend';
-import { useWorkspaceAiModelAvailability } from '@/ai/hooks/useWorkspaceAiModelAvailability';
import {
AGENT_CHAT_NEW_THREAD_DRAFT_KEY,
agentChatDraftsByThreadIdState,
@@ -41,6 +41,7 @@ import { useListenToBrowserEvent } from '@/browser-event/hooks/useListenToBrowse
import { dispatchBrowserEvent } from '@/browser-event/utils/dispatchBrowserEvent';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
import {
markWorkspaceCreditsAvailable,
@@ -51,7 +52,7 @@ export const useAgentChat = (
ensureThreadIdForSend: () => Promise<string | null>,
) => {
const { modelIdForRequest } = useAgentChatModelId();
- const { enabledModels } = useWorkspaceAiModelAvailability();
+ const aiModels = useAtomStateValue(aiModelsState);
const { getBrowsingContext } = useGetBrowsingContext();
const { applyOptimisticUnarchive } = useOptimisticallyUnarchiveOnSend();
const apolloClient = useApolloClient();
@@ -83,9 +84,9 @@ export const useAgentChat = (
return;
}
- if (enabledModels.length === 0) {
+ if (aiModels.length === 0) {
enqueueErrorSnackBar({
- message: t`No AI models are enabled in this workspace.`,
+ message: t`No AI provider is configured on this instance.`,
});
return;
@@ -270,7 +271,7 @@ export const useAgentChat = (
setAgentChatUploadedFiles,
setAgentChatDraftsByThreadId,
modelIdForRequest,
- enabledModels,
+ aiModels,
enqueueErrorSnackBar,
setCurrentAiChatThread,
apolloClient,
diff --git a/packages/twenty-front/src/modules/ai/hooks/useAgentChatModelId.ts b/packages/twenty-front/src/modules/ai/hooks/useAgentChatModelId.ts
index 2262bb73224..12966327300 100644
--- a/packages/twenty-front/src/modules/ai/hooks/useAgentChatModelId.ts
+++ b/packages/twenty-front/src/modules/ai/hooks/useAgentChatModelId.ts
@@ -1,37 +1,28 @@
-import { isAutoSelectModelId, isDefined } from 'twenty-shared/utils';
+import { AUTO_SELECT_MODEL_ID_BY_TIER } from 'twenty-shared/ai';
+import { isDefined } from 'twenty-shared/utils';
+import { agentChatUserSelectedModelTierState } from '@/ai/states/agentChatUserSelectedModelTierState';
import { shouldOpenAiChatAfterOnboardingState } from '@/onboarding/states/shouldOpenAiChatAfterOnboardingState';
-import { useWorkspaceAiModelAvailability } from '@/ai/hooks/useWorkspaceAiModelAvailability';
-import { agentChatUserSelectedModelState } from '@/ai/states/agentChatUserSelectedModelState';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
+// An undefined request id lets the server fall back to the workspace chat
+// tier, so the client never has to know that setting to send a message.
export const useAgentChatModelId = () => {
- const { enabledModels } = useWorkspaceAiModelAvailability();
- const agentChatUserSelectedModel = useAtomStateValue(
- agentChatUserSelectedModelState,
+ const agentChatUserSelectedModelTier = useAtomStateValue(
+ agentChatUserSelectedModelTierState,
);
- const currentWorkspace = useAtomStateValue(currentWorkspaceState);
// The shared sender mounts above the chat surface providers.
const shouldOpenAiChatAfterOnboarding = useAtomStateValue(
shouldOpenAiChatAfterOnboardingState,
);
- const isUserModelAvailable =
- !isDefined(agentChatUserSelectedModel) ||
- isAutoSelectModelId(agentChatUserSelectedModel) ||
- enabledModels.some((model) => model.modelId === agentChatUserSelectedModel);
-
- const selectedModelId = isUserModelAvailable
- ? agentChatUserSelectedModel
- : null;
-
const workspaceSetupModelId = shouldOpenAiChatAfterOnboarding
- ? currentWorkspace?.fastModel
- : null;
+ ? AUTO_SELECT_MODEL_ID_BY_TIER.fast
+ : undefined;
- const modelIdForRequest =
- selectedModelId ?? workspaceSetupModelId ?? undefined;
+ const modelIdForRequest = isDefined(agentChatUserSelectedModelTier)
+ ? AUTO_SELECT_MODEL_ID_BY_TIER[agentChatUserSelectedModelTier]
+ : workspaceSetupModelId;
- return { selectedModelId, modelIdForRequest };
+ return { modelIdForRequest };
};
diff --git a/packages/twenty-front/src/modules/ai/hooks/useAiModelOptions.ts b/packages/twenty-front/src/modules/ai/hooks/useAiModelOptions.ts
deleted file mode 100644
index 945f96c3ea3..00000000000
--- a/packages/twenty-front/src/modules/ai/hooks/useAiModelOptions.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-import { t } from '@lingui/core/macro';
-import { isAutoSelectModelId } from 'twenty-shared/utils';
-import { type SelectOption } from 'twenty-ui/input';
-
-import { useIsWorkspaceSetupChat } from '@/ai/hooks/useIsWorkspaceSetupChat';
-import { useWorkspaceAiModelAvailability } from '@/ai/hooks/useWorkspaceAiModelAvailability';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
-import { aiModelsState } from '@/client-config/states/aiModelsState';
-import { getModelIcon } from '@/settings/ai/utils/getModelIcon';
-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
-
-type UseAiModelOptionsVariant = 'all' | 'pinned-default';
-
-type UseAiModelOptionsOptions = {
- variant?: UseAiModelOptionsVariant;
-};
-
-export const useAiModelOptions = ({
- variant = 'all',
-}: UseAiModelOptionsOptions = {}): {
- options: SelectOption<string>[];
- pinnedOption?: SelectOption<string>;
-} => {
- const aiModels = useAtomStateValue(aiModelsState);
- const currentWorkspace = useAtomStateValue(currentWorkspaceState);
- const { enabledModels } = useWorkspaceAiModelAvailability();
- const isWorkspaceSetupChat = useIsWorkspaceSetupChat();
-
- const workspaceDefaultModelId = isWorkspaceSetupChat
- ? currentWorkspace?.fastModel
- : currentWorkspace?.smartModel;
-
- const workspaceDefaultModel = aiModels.find(
- (model) => model.modelId === workspaceDefaultModelId,
- );
-
- const resolvedDefaultModelId = enabledModels.find(
- (model) =>
- model.label === workspaceDefaultModel?.label &&
- model.providerName === workspaceDefaultModel?.providerName,
- )?.modelId;
-
- const allOptions = enabledModels
- .map((model) => ({
- value: model.modelId,
- label: model.label,
- Icon: getModelIcon(model.modelFamily, model.providerName),
- }))
- .sort((a, b) => a.label.localeCompare(b.label));
-
- const pinnedOption = workspaceDefaultModel
- ? {
- value: resolvedDefaultModelId ?? workspaceDefaultModel.modelId,
- label: workspaceDefaultModel.label,
- Icon: getModelIcon(
- workspaceDefaultModel.modelFamily,
- workspaceDefaultModel.providerName,
- ),
- contextualText: t`default`,
- }
- : undefined;
-
- const options =
- variant === 'pinned-default' && resolvedDefaultModelId
- ? allOptions.filter((model) => model.value !== resolvedDefaultModelId)
- : allOptions;
-
- return {
- options,
- pinnedOption: variant === 'pinned-default' ? pinnedOption : undefined,
- };
-};
-
-export const useAiModelLabel = (
- modelId: string | undefined,
- includeProvider = true,
-): string => {
- const aiModels = useAtomStateValue(aiModelsState);
-
- if (!modelId) {
- return '';
- }
-
- const model = aiModels.find((m) => m.modelId === modelId);
-
- if (!model) {
- return modelId;
- }
-
- if (isAutoSelectModelId(model.modelId) || !includeProvider) {
- return model.label;
- }
-
- return model.modelFamilyLabel
- ? `${model.label} (${model.modelFamilyLabel})`
- : model.label;
-};
diff --git a/packages/twenty-front/src/modules/ai/hooks/useAiModelTiers.ts b/packages/twenty-front/src/modules/ai/hooks/useAiModelTiers.ts
new file mode 100644
index 00000000000..8ef25af8004
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/hooks/useAiModelTiers.ts
@@ -0,0 +1,96 @@
+import { useMemo } from 'react';
+import { AI_MODEL_TIERS, type AiModelTier } from 'twenty-shared/ai';
+import { isDefined } from 'twenty-shared/utils';
+
+import { type ResolvedAiModelTier } from '@/ai/types/ResolvedAiModelTier';
+import { getAiModelTierLabel } from '@/ai/utils/getAiModelTierLabel';
+import { getPercentDelta } from '@/ai/utils/getPercentDelta';
+import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { aiModelTiersState } from '@/client-config/states/aiModelTiersState';
+import { aiModelsState } from '@/client-config/states/aiModelsState';
+import { getAiModelBlendedCostPerMillionTokens } from '@/settings/ai/utils/getAiModelBlendedCostPerMillionTokens';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
+import { type ClientAiModelConfig } from '~/generated-metadata/graphql';
+
+const REFERENCE_TIER: AiModelTier = 'balanced';
+
+// Both sides of a cost comparison must use the same basis: the publisher's
+// cost per task when both models have one, the catalog price otherwise.
+const getCostDeltaPercent = ({
+ model,
+ referenceModel,
+}: {
+ model: ClientAiModelConfig | undefined;
+ referenceModel: ClientAiModelConfig | undefined;
+}) => {
+ if (!isDefined(model) || !isDefined(referenceModel)) {
+ return undefined;
+ }
+
+ const hasCostPerTask =
+ isDefined(model.costPerTask) && isDefined(referenceModel.costPerTask);
+
+ return getPercentDelta({
+ value: hasCostPerTask
+ ? model.costPerTask
+ : getAiModelBlendedCostPerMillionTokens(model),
+ reference: hasCostPerTask
+ ? referenceModel.costPerTask
+ : getAiModelBlendedCostPerMillionTokens(referenceModel),
+ });
+};
+
+// Mirrors the server rule: a pin counts only while automatic selection is off
+// and the pinned model is still served by the instance.
+export const useAiModelTiers = (): ResolvedAiModelTier[] => {
+ const aiModels = useAtomStateValue(aiModelsState);
+ const aiModelTiers = useAtomStateValue(aiModelTiersState);
+ const currentWorkspace = useAtomStateValue(currentWorkspaceState);
+ const isAutoModelSelectionEnabled =
+ currentWorkspace?.isAutoModelSelectionEnabled ?? true;
+ const aiModelIdByTier = currentWorkspace?.aiModelIdByTier;
+
+ return useMemo(() => {
+ const findModel = (modelId: string | undefined) =>
+ aiModels.find((model) => model.modelId === modelId);
+
+ const resolvedModels = AI_MODEL_TIERS.map((tier) => {
+ const pinnedModel = isAutoModelSelectionEnabled
+ ? undefined
+ : findModel(aiModelIdByTier?.[tier]);
+
+ if (isDefined(pinnedModel)) {
+ return { tier, model: pinnedModel, isPinned: true };
+ }
+
+ return {
+ tier,
+ model: findModel(
+ aiModelTiers.find((instanceTier) => instanceTier.tier === tier)
+ ?.modelId,
+ ),
+ isPinned: false,
+ };
+ });
+
+ const referenceModel = resolvedModels.find(
+ (resolved) => resolved.tier === REFERENCE_TIER,
+ )?.model;
+
+ return resolvedModels.map(({ tier, model, isPinned }) => ({
+ tier,
+ label: getAiModelTierLabel(tier),
+ model,
+ isPinned,
+ speedDeltaPercent: getPercentDelta({
+ value: model?.outputTokensPerSecond,
+ reference: referenceModel?.outputTokensPerSecond,
+ }),
+ intelligenceDeltaPercent: getPercentDelta({
+ value: model?.intelligenceIndex,
+ reference: referenceModel?.intelligenceIndex,
+ }),
+ costDeltaPercent: getCostDeltaPercent({ model, referenceModel }),
+ }));
+ }, [aiModels, aiModelTiers, isAutoModelSelectionEnabled, aiModelIdByTier]);
+};
diff --git a/packages/twenty-front/src/modules/ai/hooks/useOpenAskAiPageWithPreprompt.ts b/packages/twenty-front/src/modules/ai/hooks/useOpenAskAiPageWithPreprompt.ts
index 879025d012d..bef4063166f 100644
--- a/packages/twenty-front/src/modules/ai/hooks/useOpenAskAiPageWithPreprompt.ts
+++ b/packages/twenty-front/src/modules/ai/hooks/useOpenAskAiPageWithPreprompt.ts
@@ -1,23 +1,29 @@
+import { type AiModelTier } from 'twenty-shared/ai';
import { isDefined } from 'twenty-shared/utils';
import { useStageAiChatPreprompt } from '@/ai/hooks/useStageAiChatPreprompt';
import { useSwitchToNewAiChat } from '@/ai/hooks/useSwitchToNewAiChat';
import { AGENT_CHAT_NEW_THREAD_DRAFT_KEY } from '@/ai/states/agentChatDraftsByThreadIdState';
import { type AgentChatPrepromptMode } from '@/ai/states/agentChatPrepromptState';
-import { agentChatUserSelectedModelState } from '@/ai/states/agentChatUserSelectedModelState';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
+import { useWorkspaceAiModelTiers } from '@/ai/hooks/useWorkspaceAiModelTiers';
+import { agentChatUserSelectedModelTierState } from '@/ai/states/agentChatUserSelectedModelTierState';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
+// Kept coarse because it is part of the front component SDK surface.
export type AgentChatModelPreselection = 'FAST' | 'SMART';
+const TIER_BY_PRESELECTION: Record<AgentChatModelPreselection, AiModelTier> = {
+ FAST: 'fast',
+ SMART: 'smart',
+};
+
export const useOpenAskAiPageWithPreprompt = () => {
const { switchToNewChat } = useSwitchToNewAiChat();
const { stageAiChatPreprompt } = useStageAiChatPreprompt();
- const currentWorkspace = useAtomStateValue(currentWorkspaceState);
- const setAgentChatUserSelectedModel = useSetAtomState(
- agentChatUserSelectedModelState,
+ const setAgentChatUserSelectedModelTier = useSetAtomState(
+ agentChatUserSelectedModelTierState,
);
+ const { chatTier } = useWorkspaceAiModelTiers();
const openAskAiPageWithPreprompt = ({
text,
@@ -31,11 +37,10 @@ export const useOpenAskAiPageWithPreprompt = () => {
switchToNewChat();
if (isDefined(model)) {
- const fastModelId = currentWorkspace?.fastModel;
+ const tier = TIER_BY_PRESELECTION[model];
- setAgentChatUserSelectedModel(
- model === 'FAST' && isDefined(fastModelId) ? fastModelId : null,
- );
+ // null keeps following the workspace, so a later change there applies.
+ setAgentChatUserSelectedModelTier(tier === chatTier ? null : tier);
}
stageAiChatPreprompt({
diff --git a/packages/twenty-front/src/modules/ai/hooks/useResolvedAiModel.ts b/packages/twenty-front/src/modules/ai/hooks/useResolvedAiModel.ts
new file mode 100644
index 00000000000..feca463635c
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/hooks/useResolvedAiModel.ts
@@ -0,0 +1,24 @@
+import { isDefined } from 'twenty-shared/utils';
+
+import { useAiModelTiers } from '@/ai/hooks/useAiModelTiers';
+import { useWorkspaceAiModelTiers } from '@/ai/hooks/useWorkspaceAiModelTiers';
+import { getAiModelTierForAgentModelId } from '@/ai/utils/getAiModelTierForAgentModelId';
+import { aiModelsState } from '@/client-config/states/aiModelsState';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
+import { type ClientAiModelConfig } from '~/generated-metadata/graphql';
+
+export const useResolvedAiModel = (
+ modelId: string | null | undefined,
+): ClientAiModelConfig | undefined => {
+ const aiModels = useAtomStateValue(aiModelsState);
+ const { agentTier } = useWorkspaceAiModelTiers();
+ const tiers = useAiModelTiers();
+
+ const tier = getAiModelTierForAgentModelId(modelId, agentTier);
+
+ if (isDefined(tier)) {
+ return tiers.find((resolvedTier) => resolvedTier.tier === tier)?.model;
+ }
+
+ return aiModels.find((model) => model.modelId === modelId);
+};
diff --git a/packages/twenty-front/src/modules/ai/hooks/useWorkspaceAiModelAvailability.ts b/packages/twenty-front/src/modules/ai/hooks/useWorkspaceAiModelAvailability.ts
deleted file mode 100644
index b871eec49be..00000000000
--- a/packages/twenty-front/src/modules/ai/hooks/useWorkspaceAiModelAvailability.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { isAutoSelectModelId } from 'twenty-shared/utils';
-
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
-import { aiModelsState } from '@/client-config/states/aiModelsState';
-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
-
-export const useWorkspaceAiModelAvailability = () => {
- const aiModels = useAtomStateValue(aiModelsState);
- const currentWorkspace = useAtomStateValue(currentWorkspaceState);
-
- const useRecommendedModels = currentWorkspace?.useRecommendedModels ?? true;
- const enabledAiModelIds = new Set(currentWorkspace?.enabledAiModelIds ?? []);
-
- const realModels = aiModels.filter(
- (model) => !isAutoSelectModelId(model.modelId) && !model.isDeprecated,
- );
-
- const enabledModels = useRecommendedModels
- ? realModels.filter((model) => model.isRecommended === true)
- : realModels.filter((model) => enabledAiModelIds.has(model.modelId));
-
- return {
- enabledModels,
- realModels,
- useRecommendedModels,
- };
-};
diff --git a/packages/twenty-front/src/modules/ai/hooks/useWorkspaceAiModelTiers.ts b/packages/twenty-front/src/modules/ai/hooks/useWorkspaceAiModelTiers.ts
new file mode 100644
index 00000000000..0b13117399e
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/hooks/useWorkspaceAiModelTiers.ts
@@ -0,0 +1,22 @@
+import {
+ DEFAULT_AI_AGENT_MODEL_TIER,
+ DEFAULT_AI_CHAT_MODEL_TIER,
+ type AiModelTier,
+} from 'twenty-shared/ai';
+
+import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
+
+// The defaults only cover the moment before the workspace has loaded.
+export const useWorkspaceAiModelTiers = (): {
+ chatTier: AiModelTier;
+ agentTier: AiModelTier;
+} => {
+ const currentWorkspace = useAtomStateValue(currentWorkspaceState);
+
+ return {
+ chatTier: currentWorkspace?.aiChatModelTier ?? DEFAULT_AI_CHAT_MODEL_TIER,
+ agentTier:
+ currentWorkspace?.aiAgentModelTier ?? DEFAULT_AI_AGENT_MODEL_TIER,
+ };
+};
diff --git a/packages/twenty-front/src/modules/ai/states/agentChatUserSelectedModelState.ts b/packages/twenty-front/src/modules/ai/states/agentChatUserSelectedModelState.ts
deleted file mode 100644
index 0383c09b14e..00000000000
--- a/packages/twenty-front/src/modules/ai/states/agentChatUserSelectedModelState.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
-
-export const agentChatUserSelectedModelState = createAtomState<string | null>({
- key: 'ai/agentChatUserSelectedModel',
- defaultValue: null,
- useLocalStorage: true,
- localStorageOptions: { getOnInit: true },
-});
diff --git a/packages/twenty-front/src/modules/ai/states/agentChatUserSelectedModelTierState.ts b/packages/twenty-front/src/modules/ai/states/agentChatUserSelectedModelTierState.ts
new file mode 100644
index 00000000000..a53ac0c8ff1
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/states/agentChatUserSelectedModelTierState.ts
@@ -0,0 +1,14 @@
+import { isAiModelTier, type AiModelTier } from 'twenty-shared/ai';
+
+import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
+
+// null follows the workspace chat tier.
+export const agentChatUserSelectedModelTierState =
+ createAtomState<AiModelTier | null>({
+ key: 'ai/agentChatUserSelectedModelTier',
+ defaultValue: null,
+ useLocalStorage: true,
+ localStorageOptions: { getOnInit: true },
+ // A stale tier name in localStorage hydrates as null instead.
+ validateInitFn: isAiModelTier,
+ });
diff --git a/packages/twenty-front/src/modules/ai/types/ResolvedAiModelTier.ts b/packages/twenty-front/src/modules/ai/types/ResolvedAiModelTier.ts
new file mode 100644
index 00000000000..69de4967562
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/types/ResolvedAiModelTier.ts
@@ -0,0 +1,14 @@
+import { type AiModelTier } from 'twenty-shared/ai';
+
+import { type ClientAiModelConfig } from '~/generated-metadata/graphql';
+
+export type ResolvedAiModelTier = {
+ tier: AiModelTier;
+ label: string;
+ // Undefined when no provider on the instance can serve the tier.
+ model: ClientAiModelConfig | undefined;
+ isPinned: boolean;
+ speedDeltaPercent: number | undefined;
+ intelligenceDeltaPercent: number | undefined;
+ costDeltaPercent: number | undefined;
+};
diff --git a/packages/twenty-front/src/modules/ai/utils/__tests__/getNearestAiModelTier.test.ts b/packages/twenty-front/src/modules/ai/utils/__tests__/getNearestAiModelTier.test.ts
new file mode 100644
index 00000000000..5092a82dc98
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/utils/__tests__/getNearestAiModelTier.test.ts
@@ -0,0 +1,54 @@
+import { type ResolvedAiModelTier } from '@/ai/types/ResolvedAiModelTier';
+import { getNearestAiModelTier } from '@/ai/utils/getNearestAiModelTier';
+import { type ClientAiModelConfig } from '~/generated-metadata/graphql';
+
+const buildModel = (
+ modelId: string,
+ intelligenceIndex?: number,
+): ClientAiModelConfig => ({
+ modelId,
+ label: modelId,
+ sdkPackage: null,
+ intelligenceIndex,
+});
+
+const tierModels: Pick<ResolvedAiModelTier, 'tier' | 'model'>[] = [
+ { tier: 'extraFast', model: buildModel('a/lite', 20) },
+ { tier: 'fast', model: buildModel('a/fast', 37) },
+ { tier: 'balanced', model: buildModel('a/balanced', 42) },
+ { tier: 'smart', model: buildModel('a/smart', 47) },
+ { tier: 'extraSmart', model: undefined },
+];
+
+const tiers: ResolvedAiModelTier[] = tierModels.map((tier) => ({
+ ...tier,
+ label: tier.tier,
+ isPinned: false,
+ speedDeltaPercent: undefined,
+ intelligenceDeltaPercent: undefined,
+ costDeltaPercent: undefined,
+}));
+
+describe('getNearestAiModelTier', () => {
+ it('returns the tier that resolves to the model itself', () => {
+ expect(getNearestAiModelTier(buildModel('a/smart', 1), tiers)).toBe(
+ 'smart',
+ );
+ });
+
+ it('picks the tier whose model is closest in intelligence', () => {
+ expect(getNearestAiModelTier(buildModel('b/other', 39), tiers)).toBe(
+ 'fast',
+ );
+ expect(getNearestAiModelTier(buildModel('b/other', 60), tiers)).toBe(
+ 'smart',
+ );
+ });
+
+ it('falls back to balanced without a benchmark', () => {
+ expect(getNearestAiModelTier(buildModel('b/other'), tiers)).toBe(
+ 'balanced',
+ );
+ expect(getNearestAiModelTier(undefined, tiers)).toBe('balanced');
+ });
+});
diff --git a/packages/twenty-front/src/modules/ai/utils/__tests__/getPercentDelta.test.ts b/packages/twenty-front/src/modules/ai/utils/__tests__/getPercentDelta.test.ts
new file mode 100644
index 00000000000..b860f3d9245
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/utils/__tests__/getPercentDelta.test.ts
@@ -0,0 +1,17 @@
+import { getPercentDelta } from '@/ai/utils/getPercentDelta';
+
+describe('getPercentDelta', () => {
+ it('rounds the relative difference to a whole percent', () => {
+ expect(getPercentDelta({ value: 123, reference: 55 })).toBe(124);
+ expect(getPercentDelta({ value: 37.5, reference: 48 })).toBe(-22);
+ expect(getPercentDelta({ value: 48, reference: 48 })).toBe(0);
+ });
+
+ it('returns undefined when either side is missing or the reference is zero', () => {
+ expect(
+ getPercentDelta({ value: undefined, reference: 10 }),
+ ).toBeUndefined();
+ expect(getPercentDelta({ value: 10, reference: null })).toBeUndefined();
+ expect(getPercentDelta({ value: 10, reference: 0 })).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-front/src/modules/ai/utils/formatPercentDelta.ts b/packages/twenty-front/src/modules/ai/utils/formatPercentDelta.ts
new file mode 100644
index 00000000000..d5357f6dd06
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/utils/formatPercentDelta.ts
@@ -0,0 +1,2 @@
+export const formatPercentDelta = (delta: number): string =>
+ `${delta > 0 ? '+' : ''}${delta}%`;
diff --git a/packages/twenty-front/src/modules/ai/utils/getAiModelTierForAgentModelId.ts b/packages/twenty-front/src/modules/ai/utils/getAiModelTierForAgentModelId.ts
new file mode 100644
index 00000000000..c26b3571894
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/utils/getAiModelTierForAgentModelId.ts
@@ -0,0 +1,13 @@
+import {
+ AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,
+ getAiModelTierFromModelId,
+ type AiModelTier,
+} from 'twenty-shared/ai';
+
+export const getAiModelTierForAgentModelId = (
+ modelId: string | null | undefined,
+ workspaceAgentTier: AiModelTier,
+): AiModelTier | undefined =>
+ modelId === AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID
+ ? workspaceAgentTier
+ : getAiModelTierFromModelId(modelId);
diff --git a/packages/twenty-front/src/modules/ai/utils/getAiModelTierLabel.ts b/packages/twenty-front/src/modules/ai/utils/getAiModelTierLabel.ts
new file mode 100644
index 00000000000..1bbe62080ff
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/utils/getAiModelTierLabel.ts
@@ -0,0 +1,17 @@
+import { t } from '@lingui/core/macro';
+import { type AiModelTier } from 'twenty-shared/ai';
+
+export const getAiModelTierLabel = (tier: AiModelTier): string => {
+ switch (tier) {
+ case 'extraFast':
+ return t`Extra Fast`;
+ case 'fast':
+ return t`Fast`;
+ case 'balanced':
+ return t`Balanced`;
+ case 'smart':
+ return t`Smart`;
+ case 'extraSmart':
+ return t`Extra Smart`;
+ }
+};
diff --git a/packages/twenty-front/src/modules/ai/utils/getNearestAiModelTier.ts b/packages/twenty-front/src/modules/ai/utils/getNearestAiModelTier.ts
new file mode 100644
index 00000000000..c0d17474e65
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/utils/getNearestAiModelTier.ts
@@ -0,0 +1,37 @@
+import { type AiModelTier } from 'twenty-shared/ai';
+import { isDefined } from 'twenty-shared/utils';
+
+import { type ResolvedAiModelTier } from '@/ai/types/ResolvedAiModelTier';
+import { type ClientAiModelConfig } from '~/generated-metadata/graphql';
+
+// Where a pinned model sits on the slider: its own tier when a tier resolves
+// to it, otherwise the tier whose model is closest in intelligence, so the
+// handle lands somewhere honest rather than always in the middle.
+export const getNearestAiModelTier = (
+ model: ClientAiModelConfig | undefined,
+ tiers: ResolvedAiModelTier[],
+): AiModelTier => {
+ const exactTier = tiers.find(
+ (tier) => isDefined(model) && tier.model?.modelId === model.modelId,
+ );
+
+ if (isDefined(exactTier)) {
+ return exactTier.tier;
+ }
+
+ const intelligenceIndex = model?.intelligenceIndex;
+
+ if (!isDefined(intelligenceIndex)) {
+ return 'balanced';
+ }
+
+ const rankedTiers = tiers
+ .filter((tier) => isDefined(tier.model?.intelligenceIndex))
+ .sort(
+ (first, second) =>
+ Math.abs((first.model?.intelligenceIndex ?? 0) - intelligenceIndex) -
+ Math.abs((second.model?.intelligenceIndex ?? 0) - intelligenceIndex),
+ );
+
+ return rankedTiers[0]?.tier ?? 'balanced';
+};
diff --git a/packages/twenty-front/src/modules/ai/utils/getPercentDelta.ts b/packages/twenty-front/src/modules/ai/utils/getPercentDelta.ts
new file mode 100644
index 00000000000..a34d1026cc2
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/utils/getPercentDelta.ts
@@ -0,0 +1,17 @@
+import { isDefined } from 'twenty-shared/utils';
+
+type GetPercentDeltaArgs = {
+ value: number | null | undefined;
+ reference: number | null | undefined;
+};
+
+export const getPercentDelta = ({
+ value,
+ reference,
+}: GetPercentDeltaArgs): number | undefined => {
+ if (!isDefined(value) || !isDefined(reference) || reference <= 0) {
+ return undefined;
+ }
+
+ return Math.round(((value - reference) / reference) * 100);
+};
diff --git a/packages/twenty-front/src/modules/apollo/services/__tests__/apollo.factory.test.ts b/packages/twenty-front/src/modules/apollo/services/__tests__/apollo.factory.test.ts
index 77bbaaf095b..01803bfdbeb 100644
--- a/packages/twenty-front/src/modules/apollo/services/__tests__/apollo.factory.test.ts
+++ b/packages/twenty-front/src/modules/apollo/services/__tests__/apollo.factory.test.ts
@@ -8,10 +8,7 @@ import { getSessionGeneration } from '@/auth/utils/getSessionGeneration';
import { rotateSessionGeneration } from '@/auth/utils/rotateSessionGeneration';
import { CUSTOM_WORKSPACE_APPLICATION_MOCK } from '@/object-metadata/hooks/__tests__/constants/CustomWorkspaceApplicationMock.test.constant';
import {
- AUTO_SELECT_FAST_MODEL_ID,
- AUTO_SELECT_SMART_MODEL_ID,
-} from 'twenty-shared/constants';
-import {
+ AiModelTier,
WorkspaceActivationStatus,
WorkspaceDiscoverability,
} from '~/generated-metadata/graphql';
@@ -83,11 +80,10 @@ const mockWorkspace = {
isTwoFactorAuthenticationEnforced: false,
trashRetentionDays: 14,
eventLogRetentionDays: 365 * 3,
- fastModel: AUTO_SELECT_FAST_MODEL_ID,
- smartModel: AUTO_SELECT_SMART_MODEL_ID,
- routerModel: 'auto',
- enabledAiModelIds: [],
- useRecommendedModels: true,
+ aiChatModelTier: AiModelTier.fast,
+ aiAgentModelTier: AiModelTier.fast,
+ isAutoModelSelectionEnabled: true,
+ aiModelIdByTier: {},
isInternalMessagesImportEnabled: false,
workspaceCustomApplication: CUSTOM_WORKSPACE_APPLICATION_MOCK,
workspaceCustomApplicationId: CUSTOM_WORKSPACE_APPLICATION_MOCK.id,
diff --git a/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts b/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts
index c8f4f9e5e22..71084b0b4e1 100644
--- a/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts
+++ b/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts
@@ -36,12 +36,12 @@ export type CurrentWorkspace = Pick<
| 'isTwoFactorAuthenticationEnforced'
| 'trashRetentionDays'
| 'eventLogRetentionDays'
- | 'fastModel'
- | 'smartModel'
+ | 'aiChatModelTier'
+ | 'aiAgentModelTier'
+ | 'isAutoModelSelectionEnabled'
+ | 'aiModelIdByTier'
| 'aiAdditionalInstructions'
| 'editableProfileFields'
- | 'enabledAiModelIds'
- | 'useRecommendedModels'
| 'isInternalMessagesImportEnabled'
> & {
defaultRole?: Omit<Role, 'workspaceMembers' | 'agents' | 'apiKeys'> | null;
diff --git a/packages/twenty-front/src/modules/client-config/hooks/useClientConfig.ts b/packages/twenty-front/src/modules/client-config/hooks/useClientConfig.ts
index b231b8650e4..81213269886 100644
--- a/packages/twenty-front/src/modules/client-config/hooks/useClientConfig.ts
+++ b/packages/twenty-front/src/modules/client-config/hooks/useClientConfig.ts
@@ -1,3 +1,4 @@
+import { aiModelTiersState } from '@/client-config/states/aiModelTiersState';
import { aiModelsState } from '@/client-config/states/aiModelsState';
import { apiConfigState } from '@/client-config/states/apiConfigState';
import { onboardingConfigState } from '@/client-config/states/onboardingConfigState';
@@ -53,6 +54,7 @@ export const useClientConfig = (): UseClientConfigResult => {
const setDomainConfiguration = useSetAtomState(domainConfigurationState);
const setAuthProviders = useSetAtomState(authProvidersState);
const setAiModels = useSetAtomState(aiModelsState);
+ const setAiModelTiers = useSetAtomState(aiModelTiersState);
const setIsDeveloperDefaultSignInPrefilled = useSetAtomState(
isDeveloperDefaultSignInPrefilledState,
@@ -179,6 +181,7 @@ export const useClientConfig = (): UseClientConfigResult => {
sso: clientConfig.authProviders.sso,
});
setAiModels(clientConfig.aiModels ?? []);
+ setAiModelTiers(clientConfig.aiModelTiers ?? []);
setIsAnalyticsEnabled(clientConfig.analyticsEnabled);
setIsDeveloperDefaultSignInPrefilled(clientConfig.signInPrefilled);
setIsMultiWorkspaceEnabled(clientConfig.isMultiWorkspaceEnabled);
@@ -258,6 +261,7 @@ export const useClientConfig = (): UseClientConfigResult => {
}
}, [
setAiModels,
+ setAiModelTiers,
setApiConfig,
setOnboardingConfig,
setAppVersion,
diff --git a/packages/twenty-front/src/modules/client-config/states/aiModelTiersState.ts b/packages/twenty-front/src/modules/client-config/states/aiModelTiersState.ts
new file mode 100644
index 00000000000..848a25c9afc
--- /dev/null
+++ b/packages/twenty-front/src/modules/client-config/states/aiModelTiersState.ts
@@ -0,0 +1,7 @@
+import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
+import { type ClientAiModelTierConfig } from '~/generated-metadata/graphql';
+
+export const aiModelTiersState = createAtomState<ClientAiModelTierConfig[]>({
+ key: 'aiModelTiersState',
+ defaultValue: [],
+});
diff --git a/packages/twenty-front/src/modules/client-config/types/ClientConfig.ts b/packages/twenty-front/src/modules/client-config/types/ClientConfig.ts
index f792fee6a99..4abd3d5deeb 100644
--- a/packages/twenty-front/src/modules/client-config/types/ClientConfig.ts
+++ b/packages/twenty-front/src/modules/client-config/types/ClientConfig.ts
@@ -4,6 +4,7 @@ import {
type Billing,
type Captcha,
type ClientAiModelConfig,
+ type ClientAiModelTierConfig,
type ClientConfigMaintenanceMode,
type PublicFeatureFlag,
type Sentry,
@@ -15,6 +16,7 @@ import { type OnboardingConfig } from '@/client-config/types/OnboardingConfig';
export type ClientConfig = {
appVersion?: string;
aiModels: Array<ClientAiModelConfig>;
+ aiModelTiers: Array<ClientAiModelTierConfig>;
analyticsEnabled: boolean;
api: ApiConfig;
authProviders: AuthProviders;
diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromObjectMetadata.test.ts b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromObjectMetadata.test.ts
index bc6e2cdb361..2301c94858e 100644
--- a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromObjectMetadata.test.ts
+++ b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromObjectMetadata.test.ts
@@ -1,15 +1,12 @@
import { renderHook } from '@testing-library/react';
-import {
- AUTO_SELECT_FAST_MODEL_ID,
- AUTO_SELECT_SMART_MODEL_ID,
-} from 'twenty-shared/constants';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { CUSTOM_WORKSPACE_APPLICATION_MOCK } from '@/object-metadata/hooks/__tests__/constants/CustomWorkspaceApplicationMock.test.constant';
import { useColumnDefinitionsFromObjectMetadata } from '@/object-metadata/hooks/useColumnDefinitionsFromObjectMetadata';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';
import {
+ AiModelTier,
SubscriptionInterval,
SubscriptionStatus,
WorkspaceActivationStatus,
@@ -72,10 +69,10 @@ describe('useColumnDefinitionsFromObjectMetadata', () => {
isTwoFactorAuthenticationEnforced: false,
trashRetentionDays: 14,
eventLogRetentionDays: 365 * 3,
- fastModel: AUTO_SELECT_FAST_MODEL_ID,
- smartModel: AUTO_SELECT_SMART_MODEL_ID,
- enabledAiModelIds: [],
- useRecommendedModels: true,
+ aiChatModelTier: AiModelTier.fast,
+ aiAgentModelTier: AiModelTier.fast,
+ isAutoModelSelectionEnabled: true,
+ aiModelIdByTier: {},
isInternalMessagesImportEnabled: false,
});
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx b/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx
index 0131a957322..6a36074b0d0 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx
@@ -3,8 +3,9 @@ import { useMemo, useState } from 'react';
import { useMutation, useQuery } from '@apollo/client/react';
import { t } from '@lingui/core/macro';
import { SettingsPath } from 'twenty-shared/types';
-import { getSettingsPath } from 'twenty-shared/utils';
-import { IconBolt, IconMessage, IconRobot } from 'twenty-ui/icon';
+import { getSettingsPath, isDefined } from 'twenty-shared/utils';
+import { AI_MODEL_TIERS, type AiModelTier } from 'twenty-shared/ai';
+import { IconMessage } from 'twenty-ui/icon';
import { Button } from 'twenty-ui/input';
import { UndecoratedLink } from 'twenty-ui/navigation';
import { H2Title } from 'twenty-ui/typography';
@@ -15,22 +16,20 @@ import { themeCssVariables } from 'twenty-ui/theme-constants';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { billingState } from '@/client-config/states/billingState';
import { useClientConfig } from '@/client-config/hooks/useClientConfig';
-import { SettingsAiModelsTable } from '@/settings/ai/components/SettingsAiModelsTable';
+import { getAiModelTierLabel } from '@/ai/utils/getAiModelTierLabel';
import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';
import { SettingsAdminAiProviderListCard } from '@/settings/admin-panel/ai/components/SettingsAdminAiProviderListCard';
import { useCustomAiProviderAccess } from '@/settings/admin-panel/ai/hooks/useCustomAiProviderAccess';
import { AI_PROVIDER_SOURCE } from '@/settings/admin-panel/ai/constants/AiProviderSource';
-import { SET_ADMIN_AI_MODEL_RECOMMENDED } from '@/settings/admin-panel/ai/graphql/mutations/setAdminAiModelRecommended';
-import { SET_ADMIN_AI_MODELS_RECOMMENDED } from '@/settings/admin-panel/ai/graphql/mutations/setAdminAiModelsRecommended';
import { SET_ADMIN_DEFAULT_AI_MODEL } from '@/settings/admin-panel/ai/graphql/mutations/setAdminDefaultAiModel';
import { GET_ADMIN_AI_MODELS } from '@/settings/admin-panel/ai/graphql/queries/getAdminAiModels';
import { GET_ADMIN_AI_USAGE_BY_WORKSPACE } from '@/settings/admin-panel/ai/graphql/queries/getAdminAiUsageByWorkspace';
import { GET_AI_PROVIDERS } from '@/settings/admin-panel/ai/graphql/queries/getAiProviders';
import { type GetAiProvidersResult } from '@/settings/admin-panel/ai/types/GetAiProvidersResult';
import { parseProviderItems } from '@/settings/admin-panel/ai/utils/parseProviderItems';
-import { getModelIcon } from '@/settings/ai/utils/getModelIcon';
import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';
import { SettingsEnterpriseFeatureGateCard } from '@/settings/components/SettingsEnterpriseFeatureGateCard';
+import { AiModelPinSelect } from '@/settings/ai/components/AiModelPinSelect';
import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
import { useUsageValueFormatter } from '@/settings/usage/hooks/useUsageValueFormatter';
import { getPeriodDates } from '@/settings/usage/utils/getPeriodDates';
@@ -45,8 +44,9 @@ import { TableHeader } from '@/ui/layout/table/components/TableHeader';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
import {
- AiModelRole,
type AdminAiModelConfig,
+ type AdminAiModelTierDefault,
+ AiModelTier as GraphqlAiModelTier,
} from '~/generated-admin/graphql';
import { OrganizationAdornment } from '~/pages/settings/enterprise/components/OrganizationAdornment';
@@ -78,24 +78,13 @@ export const SettingsAdminAI = () => {
const periodOptions = getPeriodOptions();
const usageDates = getPeriodDates(usagePeriod);
- const {
- data,
- loading: isLoadingModels,
- refetch: refetchModels,
- } = useQuery<{
+ const { data, loading: isLoadingModels } = useQuery<{
getAdminAiModels: {
- defaultSmartModelId?: string | null;
- defaultFastModelId?: string | null;
+ defaultModelByTier: AdminAiModelTierDefault[];
models: AdminAiModelConfig[];
};
}>(GET_ADMIN_AI_MODELS, { client: apolloAdminClient });
- const [setModelRecommended] = useMutation(SET_ADMIN_AI_MODEL_RECOMMENDED, {
- client: apolloAdminClient,
- });
- const [setModelsRecommended] = useMutation(SET_ADMIN_AI_MODELS_RECOMMENDED, {
- client: apolloAdminClient,
- });
const [setDefaultModel] = useMutation(SET_ADMIN_DEFAULT_AI_MODEL, {
client: apolloAdminClient,
});
@@ -142,43 +131,19 @@ export const SettingsAdminAI = () => {
return <SettingsSectionSkeletonLoader />;
}
- const handleRecommendedToggle = async (
- modelId: string,
- isCurrentlyRecommended: boolean,
- ) => {
- try {
- await setModelRecommended({
- variables: { modelId, recommended: !isCurrentlyRecommended },
- refetchQueries: [{ query: GET_ADMIN_AI_MODELS }],
- });
- await refetchClientConfig();
- } catch {
- enqueueErrorSnackBar({
- message: t`Failed to update model recommendation`,
- });
- }
- };
-
- const defaultSmartModelId = data?.getAdminAiModels?.defaultSmartModelId;
- const defaultFastModelId = data?.getAdminAiModels?.defaultFastModelId;
+ const defaultModelByTier = data?.getAdminAiModels?.defaultModelByTier ?? [];
const enabledModels = models.filter(
(model) => model.isAvailable && model.isAdminEnabled && !model.isDeprecated,
);
- const availableModelOptions = enabledModels.map((model) => ({
- value: model.modelId,
- label: model.label,
- Icon: getModelIcon(model.modelFamily, model.providerName),
- }));
-
const handleDefaultModelChange = async (
- role: AiModelRole,
+ tier: AiModelTier,
modelId: string,
) => {
try {
await setDefaultModel({
- variables: { role, modelId },
+ variables: { tier: GraphqlAiModelTier[tier], modelId },
refetchQueries: [{ query: GET_ADMIN_AI_MODELS }],
});
await refetchClientConfig();
@@ -228,92 +193,42 @@ export const SettingsAdminAI = () => {
)}
</Section>
- {availableModelOptions.length > 0 && (
+ {enabledModels.length > 0 && (
<Section>
<H2Title
title={t`Default Models`}
- description={t`Configure the default AI models for all workspaces`}
+ description={t`The model behind each tier for every workspace. Workspaces can pin their own.`}
/>
<Card rounded>
- <SettingsOptionCardContentSelect
- Icon={IconRobot}
- title={t`Smart Model`}
- description={t`Default model for chats and complex reasoning`}
- divider
- >
- <Select
- dropdownId="admin-smart-model-select"
- value={defaultSmartModelId ?? undefined}
- onChange={(value: string) =>
- handleDefaultModelChange(AiModelRole.SMART, value)
- }
- options={availableModelOptions}
- selectSizeVariant="small"
- dropdownWidth={GenericDropdownContentWidth.ExtraLarge}
- />
- </SettingsOptionCardContentSelect>
- <SettingsOptionCardContentSelect
- Icon={IconBolt}
- title={t`Fast Model`}
- description={t`Default model for lightweight tasks`}
- >
- <Select
- dropdownId="admin-fast-model-select"
- value={defaultFastModelId ?? undefined}
- onChange={(value: string) =>
- handleDefaultModelChange(AiModelRole.FAST, value)
- }
- options={availableModelOptions}
- selectSizeVariant="small"
- dropdownWidth={GenericDropdownContentWidth.ExtraLarge}
- />
- </SettingsOptionCardContentSelect>
+ {AI_MODEL_TIERS.map((tier, index) => (
+ <SettingsOptionCardContentSelect
+ key={tier}
+ title={getAiModelTierLabel(tier)}
+ divider={index < AI_MODEL_TIERS.length - 1}
+ >
+ <AiModelPinSelect
+ dropdownId={`admin-default-model-select-${tier}`}
+ modelId={
+ defaultModelByTier.find(
+ (defaultModel) => defaultModel.tier === tier,
+ )?.modelId ?? null
+ }
+ onChange={(modelId) => {
+ if (isDefined(modelId)) {
+ void handleDefaultModelChange(tier, modelId);
+ }
+ }}
+ aiModels={enabledModels}
+ selectSizeVariant="small"
+ dropdownWidth={GenericDropdownContentWidth.ExtraLarge}
+ />
+ </SettingsOptionCardContentSelect>
+ ))}
</Card>
</Section>
)}
- {enabledModels.length > 0 && (
- <Section>
- <H2Title
- title={t`Recommended Models`}
- description={t`Select which models appear as recommended in the workspace model picker`}
- />
-
- <SettingsAiModelsTable
- models={enabledModels}
- isChecked={(model) => model.isRecommended === true}
- onToggle={handleRecommendedToggle}
- onToggleAll={async (shouldCheckAll) => {
- const modelIds = enabledModels
- .filter(
- (model) => (model.isRecommended === true) !== shouldCheckAll,
- )
- .map((model) => model.modelId);
-
- if (modelIds.length === 0) return;
-
- try {
- await setModelsRecommended({
- variables: {
- modelIds,
- recommended: shouldCheckAll,
- },
- });
- } catch {
- enqueueErrorSnackBar({
- message: t`Failed to update model recommendations`,
- });
- } finally {
- await refetchModels();
- await refetchClientConfig();
- }
- }}
- anchorPrefix="recommended-model-row"
- />
- </Section>
- )}
-
<Section>
<H2Title
title={t`Chats`}
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/mutations/setAdminAiModelRecommended.ts b/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/mutations/setAdminAiModelRecommended.ts
deleted file mode 100644
index 7be68348b5e..00000000000
--- a/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/mutations/setAdminAiModelRecommended.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { gql } from '@apollo/client';
-
-export const SET_ADMIN_AI_MODEL_RECOMMENDED = gql`
- mutation SetAdminAiModelRecommended(
- $modelId: String!
- $recommended: Boolean!
- ) {
- setAdminAiModelRecommended(modelId: $modelId, recommended: $recommended)
- }
-`;
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/mutations/setAdminAiModelsRecommended.ts b/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/mutations/setAdminAiModelsRecommended.ts
deleted file mode 100644
index be62f6b43f1..00000000000
--- a/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/mutations/setAdminAiModelsRecommended.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { gql } from '@apollo/client';
-
-export const SET_ADMIN_AI_MODELS_RECOMMENDED = gql`
- mutation SetAdminAiModelsRecommended(
- $modelIds: [String!]!
- $recommended: Boolean!
- ) {
- setAdminAiModelsRecommended(modelIds: $modelIds, recommended: $recommended)
- }
-`;
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/mutations/setAdminDefaultAiModel.ts b/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/mutations/setAdminDefaultAiModel.ts
index 2bae314b4e8..db12d467d28 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/mutations/setAdminDefaultAiModel.ts
+++ b/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/mutations/setAdminDefaultAiModel.ts
@@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
export const SET_ADMIN_DEFAULT_AI_MODEL = gql`
- mutation SetAdminDefaultAiModel($role: AiModelRole!, $modelId: String!) {
- setAdminDefaultAiModel(role: $role, modelId: $modelId)
+ mutation SetAdminDefaultAiModel($tier: AiModelTier!, $modelId: String!) {
+ setAdminDefaultAiModel(tier: $tier, modelId: $modelId)
}
`;
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/queries/getAdminAiModels.ts b/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/queries/getAdminAiModels.ts
index aed76832d35..d2e8ec932fe 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/queries/getAdminAiModels.ts
+++ b/packages/twenty-front/src/modules/settings/admin-panel/ai/graphql/queries/getAdminAiModels.ts
@@ -3,8 +3,10 @@ import { gql } from '@apollo/client';
export const GET_ADMIN_AI_MODELS = gql`
query GetAdminAiModels {
getAdminAiModels {
- defaultSmartModelId
- defaultFastModelId
+ defaultModelByTier {
+ tier
+ modelId
+ }
models {
modelId
label
@@ -13,7 +15,6 @@ export const GET_ADMIN_AI_MODELS = gql`
isAvailable
isAdminEnabled
isDeprecated
- isRecommended
contextWindowTokens
maxOutputTokens
inputCostPerMillionTokens
@@ -22,6 +23,7 @@ export const GET_ADMIN_AI_MODELS = gql`
providerLabel
name
dataResidency
+ efforts
}
}
}
diff --git a/packages/twenty-front/src/modules/settings/ai/components/AiModelPinSelect.tsx b/packages/twenty-front/src/modules/settings/ai/components/AiModelPinSelect.tsx
new file mode 100644
index 00000000000..c495c870a0b
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/ai/components/AiModelPinSelect.tsx
@@ -0,0 +1,116 @@
+import { styled } from '@linaria/react';
+import { useLingui } from '@lingui/react/macro';
+import { type ComponentProps } from 'react';
+import {
+ AI_MODEL_EFFORT_LABELS,
+ isAiModelEffort,
+ parseAiModelVariantId,
+} from 'twenty-shared/ai';
+import { isDefined } from 'twenty-shared/utils';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+import { AUTOMATIC_MODEL_PIN } from '@/settings/ai/constants/AutomaticModelPin';
+import { type PinnableAiModel } from '@/settings/ai/types/PinnableAiModel';
+import { getAiModelPinOptions } from '@/settings/ai/utils/getAiModelPinOptions';
+import { Select } from '@/ui/input/components/Select';
+import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
+
+const DEFAULT_EFFORT = '';
+
+const StyledRow = styled.div`
+ align-items: flex-end;
+ display: flex;
+ gap: ${themeCssVariables.spacing[2]};
+`;
+
+type AiModelPinSelectProps = {
+ dropdownId: string;
+ // null follows the tier automatically; a variant id names its effort.
+ modelId: string | null;
+ onChange: (modelId: string | null) => void;
+ aiModels: PinnableAiModel[];
+ emptyOptionLabel?: string;
+ label?: string;
+ description?: string;
+ disabled?: boolean;
+ selectSizeVariant?: ComponentProps<typeof Select>['selectSizeVariant'];
+ dropdownWidth?: ComponentProps<typeof Select>['dropdownWidth'];
+};
+
+export const AiModelPinSelect = ({
+ dropdownId,
+ modelId,
+ onChange,
+ aiModels,
+ emptyOptionLabel,
+ label,
+ description,
+ disabled = false,
+ selectSizeVariant,
+ dropdownWidth,
+}: AiModelPinSelectProps) => {
+ const { t } = useLingui();
+
+ const { modelId: baseModelId, effort } = parseAiModelVariantId(modelId ?? '');
+ const baseModel = aiModels.find((model) => model.modelId === baseModelId);
+ const efforts = (baseModel?.efforts ?? []).filter(isAiModelEffort);
+
+ const handleModelChange = (value: string) => {
+ if (value === AUTOMATIC_MODEL_PIN) {
+ onChange(null);
+
+ return;
+ }
+
+ const nextModel = aiModels.find((model) => model.modelId === value);
+ const keepsEffort =
+ isDefined(effort) && (nextModel?.efforts ?? []).includes(effort);
+
+ onChange(keepsEffort ? `${value}@${effort}` : value);
+ };
+
+ const handleEffortChange = (value: string) => {
+ onChange(
+ value === DEFAULT_EFFORT ? baseModelId : `${baseModelId}@${value}`,
+ );
+ };
+
+ return (
+ <StyledRow>
+ <Select
+ dropdownId={dropdownId}
+ label={label}
+ description={description}
+ value={isDefined(modelId) ? baseModelId : AUTOMATIC_MODEL_PIN}
+ onChange={handleModelChange}
+ options={getAiModelPinOptions({ aiModels, keepModelId: baseModelId })}
+ emptyOption={
+ isDefined(emptyOptionLabel)
+ ? { value: AUTOMATIC_MODEL_PIN, label: emptyOptionLabel }
+ : undefined
+ }
+ withSearchInput
+ disabled={disabled}
+ selectSizeVariant={selectSizeVariant}
+ dropdownWidth={dropdownWidth}
+ />
+ {efforts.length > 0 && (
+ <Select
+ dropdownId={`${dropdownId}-effort`}
+ value={effort ?? DEFAULT_EFFORT}
+ onChange={handleEffortChange}
+ options={[
+ { value: DEFAULT_EFFORT, label: t`Default reasoning` },
+ ...efforts.map((availableEffort) => ({
+ value: availableEffort,
+ label: AI_MODEL_EFFORT_LABELS[availableEffort],
+ })),
+ ]}
+ disabled={disabled}
+ selectSizeVariant={selectSizeVariant}
+ dropdownWidth={GenericDropdownContentWidth.Medium}
+ />
+ )}
+ </StyledRow>
+ );
+};
diff --git a/packages/twenty-front/src/modules/settings/ai/constants/AutomaticModelPin.ts b/packages/twenty-front/src/modules/settings/ai/constants/AutomaticModelPin.ts
new file mode 100644
index 00000000000..489afa7c97b
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/ai/constants/AutomaticModelPin.ts
@@ -0,0 +1,2 @@
+// The empty select value that means "no pin, follow the tier".
+export const AUTOMATIC_MODEL_PIN = '';
diff --git a/packages/twenty-front/src/modules/settings/ai/types/PinnableAiModel.ts b/packages/twenty-front/src/modules/settings/ai/types/PinnableAiModel.ts
new file mode 100644
index 00000000000..17e2cf50d1c
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/ai/types/PinnableAiModel.ts
@@ -0,0 +1,14 @@
+import { type ModelFamily } from '~/generated-metadata/graphql';
+
+// The fields a pin select needs, shared by the workspace and admin model DTOs.
+export type PinnableAiModel = {
+ modelId: string;
+ label: string;
+ isDeprecated?: boolean | null;
+ dataResidency?: string | null;
+ providerLabel?: string | null;
+ providerName?: string | null;
+ modelFamily?: ModelFamily | null;
+ efforts?: string[] | null;
+ effort?: string | null;
+};
diff --git a/packages/twenty-front/src/modules/settings/ai/utils/__tests__/getAiModelBlendedCostPerMillionTokens.test.ts b/packages/twenty-front/src/modules/settings/ai/utils/__tests__/getAiModelBlendedCostPerMillionTokens.test.ts
new file mode 100644
index 00000000000..f8f776d9316
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/ai/utils/__tests__/getAiModelBlendedCostPerMillionTokens.test.ts
@@ -0,0 +1,45 @@
+import { getAiModelBlendedCostPerMillionTokens } from '@/settings/ai/utils/getAiModelBlendedCostPerMillionTokens';
+
+describe('getAiModelBlendedCostPerMillionTokens', () => {
+ it('weights input three to one against output', () => {
+ expect(
+ getAiModelBlendedCostPerMillionTokens({
+ inputCostPerMillionTokens: 2,
+ outputCostPerMillionTokens: 12,
+ }),
+ ).toBe(4.5);
+ });
+
+ it('accepts a free input side as long as the model is not free', () => {
+ expect(
+ getAiModelBlendedCostPerMillionTokens({
+ inputCostPerMillionTokens: 0,
+ outputCostPerMillionTokens: 4,
+ }),
+ ).toBe(1);
+ });
+
+ it('returns undefined when a price is missing', () => {
+ expect(
+ getAiModelBlendedCostPerMillionTokens({
+ inputCostPerMillionTokens: null,
+ outputCostPerMillionTokens: 4,
+ }),
+ ).toBeUndefined();
+ expect(
+ getAiModelBlendedCostPerMillionTokens({
+ inputCostPerMillionTokens: 2,
+ outputCostPerMillionTokens: undefined,
+ }),
+ ).toBeUndefined();
+ });
+
+ it('returns undefined for a free model instead of a zero price', () => {
+ expect(
+ getAiModelBlendedCostPerMillionTokens({
+ inputCostPerMillionTokens: 0,
+ outputCostPerMillionTokens: 0,
+ }),
+ ).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-front/src/modules/settings/ai/utils/getAiModelBlendedCostPerMillionTokens.ts b/packages/twenty-front/src/modules/settings/ai/utils/getAiModelBlendedCostPerMillionTokens.ts
new file mode 100644
index 00000000000..006a9b18565
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/ai/utils/getAiModelBlendedCostPerMillionTokens.ts
@@ -0,0 +1,31 @@
+import { isDefined } from 'twenty-shared/utils';
+
+import { type ClientAiModelConfig } from '~/generated-metadata/graphql';
+
+// The 3:1 input to output split Artificial Analysis uses for its blended price,
+// so the number lines up with what a reader will find on their site.
+const INPUT_WEIGHT = 3;
+const OUTPUT_WEIGHT = 1;
+
+export const getAiModelBlendedCostPerMillionTokens = (
+ model: Pick<
+ ClientAiModelConfig,
+ 'inputCostPerMillionTokens' | 'outputCostPerMillionTokens'
+ >,
+): number | undefined => {
+ const { inputCostPerMillionTokens, outputCostPerMillionTokens } = model;
+
+ if (
+ !isDefined(inputCostPerMillionTokens) ||
+ !isDefined(outputCostPerMillionTokens) ||
+ inputCostPerMillionTokens + outputCostPerMillionTokens <= 0
+ ) {
+ return undefined;
+ }
+
+ return (
+ (inputCostPerMillionTokens * INPUT_WEIGHT +
+ outputCostPerMillionTokens * OUTPUT_WEIGHT) /
+ (INPUT_WEIGHT + OUTPUT_WEIGHT)
+ );
+};
diff --git a/packages/twenty-front/src/modules/settings/ai/utils/getAiModelPinOptions.ts b/packages/twenty-front/src/modules/settings/ai/utils/getAiModelPinOptions.ts
new file mode 100644
index 00000000000..621e259906c
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/ai/utils/getAiModelPinOptions.ts
@@ -0,0 +1,37 @@
+import { t } from '@lingui/core/macro';
+import { isDefined } from 'twenty-shared/utils';
+
+import { type PinnableAiModel } from '@/settings/ai/types/PinnableAiModel';
+import { getDataResidencyDisplay } from '@/settings/ai/utils/getDataResidencyDisplay';
+import { getModelIcon } from '@/settings/ai/utils/getModelIcon';
+
+// Effort variants are picked through their base model and a separate effort
+// select, so only base models are listed. A deprecated model stays listed
+// while it is the current pin, so an existing choice is visible until changed.
+export const getAiModelPinOptions = ({
+ aiModels,
+ keepModelId,
+}: {
+ aiModels: PinnableAiModel[];
+ keepModelId?: string;
+}) =>
+ aiModels
+ .filter(
+ (model) =>
+ !isDefined(model.effort) &&
+ (!model.isDeprecated || model.modelId === keepModelId),
+ )
+ .map((model) => {
+ const residencyFlag = model.dataResidency
+ ? ` ${getDataResidencyDisplay(model.dataResidency)}`
+ : '';
+ const label = `${model.label}${residencyFlag}`;
+
+ return {
+ value: model.modelId,
+ label: model.isDeprecated ? t`${label} (deprecated)` : label,
+ contextualText: model.providerLabel ?? model.providerName ?? undefined,
+ Icon: getModelIcon(model.modelFamily, model.providerName),
+ };
+ })
+ .sort((first, second) => first.label.localeCompare(second.label));
diff --git a/packages/twenty-front/src/modules/users/graphql/fragments/userQueryFragment.ts b/packages/twenty-front/src/modules/users/graphql/fragments/userQueryFragment.ts
index 5f187450fe2..d61bdfbc1d6 100644
--- a/packages/twenty-front/src/modules/users/graphql/fragments/userQueryFragment.ts
+++ b/packages/twenty-front/src/modules/users/graphql/fragments/userQueryFragment.ts
@@ -101,11 +101,11 @@ export const USER_QUERY_FRAGMENT = gql`
defaultRole {
...RoleFragment
}
- fastModel
- smartModel
+ aiChatModelTier
+ aiAgentModelTier
+ isAutoModelSelectionEnabled
+ aiModelIdByTier
aiAdditionalInstructions
- enabledAiModelIds
- useRecommendedModels
isTwoFactorAuthenticationEnforced
trashRetentionDays
eventLogRetentionDays
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPromptTab.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPromptTab.tsx
index 1487bbd2f32..b5f772c320e 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPromptTab.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPromptTab.tsx
@@ -1,12 +1,11 @@
import { SettingsAgentModelCapabilities } from '@/ai/components/SettingsAgentModelCapabilities';
import { type OutputSchemaField } from '@/ai/constants/OutputFieldTypeOptions';
-import { useAiModelOptions } from '@/ai/hooks/useAiModelOptions';
+import { AiModelPicker } from '@/ai/components/AiModelPicker';
import { agentResponseSchemaToOutputSchema } from '@/ai/utils/agentResponseSchemaToOutputSchema';
import { createDefaultOutputSchemaField } from '@/ai/utils/createDefaultOutputSchemaField';
import { fieldsToSchema } from '@/ai/utils/fieldsToSchema';
import { schemaToFields } from '@/ai/utils/schemaToFields';
import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormTextFieldInput';
-import { Select } from '@/ui/input/components/Select';
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
import { type WorkflowAiAgentAction } from '@/workflow/types/Workflow';
import { WorkflowOutputSchemaBuilder } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowOutputSchemaBuilder';
@@ -42,9 +41,6 @@ export const WorkflowAiAgentPromptTab = ({
}: WorkflowAiAgentPromptTabProps) => {
const [workflowAiAgentActionAgent, setWorkflowAiAgentActionAgent] =
useAtomState(workflowAiAgentActionAgentState);
- const { options: aiModelOptions, pinnedOption } = useAiModelOptions({
- variant: 'pinned-default',
- });
const [updateAgent] = useMutation(UpdateOneAgentDocument);
const [outputSchemaFields, setOutputSchemaFields] = useState<
@@ -136,14 +132,9 @@ export const WorkflowAiAgentPromptTab = ({
return (
<>
- <Select
- label={t`Model`}
- dropdownId="select-agent-model"
- options={aiModelOptions}
- pinnedOption={pinnedOption}
- value={agent.modelId}
- onChange={handleModelChange}
- showContextualTextInControl={false}
+ <AiModelPicker
+ modelId={agent.modelId}
+ onModelIdChange={handleModelChange}
disabled={readonly}
/>
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx
index 9d41371123f..03fe668ae06 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx
@@ -1,14 +1,10 @@
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
-import {
- useAiModelLabel,
- useAiModelOptions,
-} from '@/ai/hooks/useAiModelOptions';
+import { AiModelPicker } from '@/ai/components/AiModelPicker';
import { SettingsAgentModelCapabilities } from '@/ai/components/SettingsAgentModelCapabilities';
import { aiModelsState } from '@/client-config/states/aiModelsState';
import { IconPicker } from '@/ui/input/components/IconPicker';
-import { Select } from '@/ui/input/components/Select';
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
import { TextArea } from '@/ui/input/components/TextArea';
import { useModal } from '@/ui/layout/modal/hooks/useModal';
@@ -69,23 +65,7 @@ export const SettingsAgentSettingsTab = ({
const { openModal } = useModal();
const aiModels = useAtomStateValue(aiModelsState);
- const { options: activeModelOptions } = useAiModelOptions();
- const currentModelLabel = useAiModelLabel(formValues.modelId);
-
- const currentModel = aiModels.find((m) => m.modelId === formValues.modelId);
- const isCurrentModelDeprecated = currentModel?.isDeprecated === true;
-
- const modelOptions = isCurrentModelDeprecated
- ? [
- {
- value: formValues.modelId,
- label: `${currentModelLabel} (deprecated)`,
- },
- ...activeModelOptions,
- ]
- : activeModelOptions;
-
- const noModelsAvailable = modelOptions.length === 0;
+ const noModelsAvailable = aiModels.length === 0;
const fillNameFromLabel = (label: string) => {
if (isDefined(label)) {
@@ -133,16 +113,13 @@ export const SettingsAgentSettingsTab = ({
<StyledFormContainer>
{noModelsAvailable ? (
<StyledErrorMessage>
- {t`No models available. Please configure AI models in your workspace settings.`}
+ {t`No AI provider is configured on this instance.`}
</StyledErrorMessage>
) : (
- <Select
- dropdownId="ai-model-select"
- label={t`AI Model`}
- value={formValues.modelId}
- onChange={(value) => onFieldChange('modelId', value)}
- options={modelOptions}
- disabled={noModelsAvailable || disabled}
+ <AiModelPicker
+ modelId={formValues.modelId}
+ onModelIdChange={(value) => onFieldChange('modelId', value)}
+ disabled={disabled}
/>
)}
</StyledFormContainer>
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelTiersPreview.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelTiersPreview.tsx
new file mode 100644
index 00000000000..84e9ab3791c
--- /dev/null
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelTiersPreview.tsx
@@ -0,0 +1,109 @@
+import { styled } from '@linaria/react';
+import { t } from '@lingui/core/macro';
+import { isDefined } from 'twenty-shared/utils';
+import { H2Title } from 'twenty-ui/typography';
+import { Section } from 'twenty-ui/layout';
+import { AppTooltip, TooltipDelay } from 'twenty-ui/surfaces';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+import { useAiModelTiers } from '@/ai/hooks/useAiModelTiers';
+import { type ResolvedAiModelTier } from '@/ai/types/ResolvedAiModelTier';
+import { getAiModelBlendedCostPerMillionTokens } from '@/settings/ai/utils/getAiModelBlendedCostPerMillionTokens';
+import { Table } from '@/ui/layout/table/components/Table';
+import { TableCell } from '@/ui/layout/table/components/TableCell';
+import { TableHeader } from '@/ui/layout/table/components/TableHeader';
+import { TableRow } from '@/ui/layout/table/components/TableRow';
+import { formatNumber } from '~/utils/format/formatNumber';
+
+const GRID_TEMPLATE_COLUMNS = '1fr 1fr 1fr 1fr 1.4fr';
+const EMPTY_VALUE = '–';
+
+const StyledInheritedValue = styled.span`
+ color: ${themeCssVariables.font.color.light};
+`;
+
+const INHERITED_BENCHMARK_CLASS_NAME = 'ai-model-tier-inherited-benchmark';
+
+// The reading belongs to the base model, so it is dimmed and explained rather
+// than passed off as a measurement at this effort.
+const renderBenchmarkValue = (tier: ResolvedAiModelTier, value: string) =>
+ (tier.model?.isBenchmarkInherited ?? false) && value !== EMPTY_VALUE ? (
+ <StyledInheritedValue className={INHERITED_BENCHMARK_CLASS_NAME}>
+ {value}
+ </StyledInheritedValue>
+ ) : (
+ value
+ );
+
+const formatSpeed = (tier: ResolvedAiModelTier) =>
+ isDefined(tier.model?.outputTokensPerSecond)
+ ? t`${formatNumber(tier.model.outputTokensPerSecond, { decimals: 0 })} tokens/s`
+ : EMPTY_VALUE;
+
+const formatIntelligence = (tier: ResolvedAiModelTier) =>
+ isDefined(tier.model?.intelligenceIndex)
+ ? formatNumber(tier.model.intelligenceIndex, { decimals: 0 })
+ : EMPTY_VALUE;
+
+// Artificial Analysis measures a cost per task at the same time as the index.
+// Where a model has no such reading, the catalog prices give a blended price
+// per million tokens instead, so the unit is spelled out on every row.
+const formatCost = (tier: ResolvedAiModelTier) => {
+ if (!isDefined(tier.model)) {
+ return EMPTY_VALUE;
+ }
+
+ if (isDefined(tier.model.costPerTask)) {
+ return t`$${formatNumber(tier.model.costPerTask, { decimals: 2 })} / task`;
+ }
+
+ const blendedCost = getAiModelBlendedCostPerMillionTokens(tier.model);
+
+ return isDefined(blendedCost)
+ ? t`$${formatNumber(blendedCost, { decimals: 2 })} / 1M tokens`
+ : EMPTY_VALUE;
+};
+
+export const SettingsAiModelTiersPreview = () => {
+ const tiers = useAiModelTiers();
+
+ return (
+ <Section>
+ <H2Title
+ title={t`Preview`}
+ description={t`The tiers people and agents choose between`}
+ />
+ <Table>
+ <TableRow gridTemplateColumns={GRID_TEMPLATE_COLUMNS}>
+ <TableHeader>{t`Tier`}</TableHeader>
+ <TableHeader>{t`Model`}</TableHeader>
+ <TableHeader align="right">{t`Speed`}</TableHeader>
+ <TableHeader align="right">{t`Intelligence`}</TableHeader>
+ <TableHeader align="right">{t`Cost`}</TableHeader>
+ </TableRow>
+ {tiers.map((tier) => (
+ <TableRow key={tier.tier} gridTemplateColumns={GRID_TEMPLATE_COLUMNS}>
+ <TableCell color={themeCssVariables.font.color.primary}>
+ {tier.label}
+ </TableCell>
+ <TableCell>{tier.model?.label ?? EMPTY_VALUE}</TableCell>
+ <TableCell align="right">
+ {renderBenchmarkValue(tier, formatSpeed(tier))}
+ </TableCell>
+ <TableCell align="right">
+ {renderBenchmarkValue(tier, formatIntelligence(tier))}
+ </TableCell>
+ <TableCell align="right">{formatCost(tier)}</TableCell>
+ </TableRow>
+ ))}
+ </Table>
+ {tiers.some((tier) => tier.model?.isBenchmarkInherited ?? false) && (
+ <AppTooltip
+ anchorSelect={`.${INHERITED_BENCHMARK_CLASS_NAME}`}
+ title={t`Not measured at this effort yet. Showing the base model's reading.`}
+ delay={TooltipDelay.shortDelay}
+ />
+ )}
+ </Section>
+ );
+};
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelsTab.tsx
index 9c7cadcf8ff..20f6e594ec4 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelsTab.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelsTab.tsx
@@ -1,60 +1,58 @@
import { styled } from '@linaria/react';
-import { useContext, useState } from 'react';
+import { useContext } from 'react';
+import { useQuery } from '@apollo/client/react';
+import { t } from '@lingui/core/macro';
+import { AI_MODEL_TIERS, type AiModelTier } from 'twenty-shared/ai';
+import { SettingsPath } from 'twenty-shared/types';
+import { getSettingsPath, isDefined } from 'twenty-shared/utils';
+import {
+ IconMessage,
+ IconPrompt,
+ IconRefresh,
+ IconRobot,
+} from 'twenty-ui/icon';
+import { H2Title } from 'twenty-ui/typography';
+import { Section } from 'twenty-ui/layout';
+import { UndecoratedLink } from 'twenty-ui/navigation';
+import { Card } from 'twenty-ui/surfaces';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
-import { useWorkspaceAiModelAvailability } from '@/ai/hooks/useWorkspaceAiModelAvailability';
+import { useAiModelTiers } from '@/ai/hooks/useAiModelTiers';
+import { useWorkspaceAiModelTiers } from '@/ai/hooks/useWorkspaceAiModelTiers';
+import { getAiModelTierLabel } from '@/ai/utils/getAiModelTierLabel';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { aiModelsState } from '@/client-config/states/aiModelsState';
-import { SettingsAiModelsTable } from '@/settings/ai/components/SettingsAiModelsTable';
-import { getDataResidencyDisplay } from '@/settings/ai/utils/getDataResidencyDisplay';
-import { getModelIcon } from '@/settings/ai/utils/getModelIcon';
+import { AiModelPinSelect } from '@/settings/ai/components/AiModelPinSelect';
import { SettingsCard } from '@/settings/components/SettingsCard';
import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { Select } from '@/ui/input/components/Select';
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
-import { useQuery } from '@apollo/client/react';
-import { t } from '@lingui/core/macro';
-import {
- AUTO_SELECT_FAST_MODEL_ID,
- AUTO_SELECT_SMART_MODEL_ID,
-} from 'twenty-shared/constants';
-import { SettingsPath } from 'twenty-shared/types';
-import { getSettingsPath, isDefined } from 'twenty-shared/utils';
-import { IconBolt, IconCpu, IconPrompt, IconStar } from 'twenty-ui/icon';
-import { H2Title } from 'twenty-ui/typography';
-import { SearchInput } from 'twenty-ui/input';
-import { Section } from 'twenty-ui/layout';
-import { Card } from 'twenty-ui/surfaces';
-import { UndecoratedLink } from 'twenty-ui/navigation';
-import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { GetAiSystemPromptPreviewDocument } from '~/generated-metadata/graphql';
+import { SettingsAiModelTiersPreview } from '~/pages/settings/ai/components/SettingsAiModelTiersPreview';
import { useSettingsAiModelsActions } from '~/pages/settings/ai/hooks/useSettingsAiModelsActions';
import { formatNumber } from '~/utils/format/formatNumber';
-const StyledCustomModelsContainer = styled.div`
- display: flex;
- flex-direction: column;
- gap: ${themeCssVariables.spacing[4]};
+const StyledPinnedModelsContainer = styled.div`
padding-top: ${themeCssVariables.spacing[4]};
`;
export const SettingsAiModelsTab = () => {
const { theme } = useContext(ThemeContext);
const currentWorkspace = useAtomStateValue(currentWorkspaceState);
- const [searchQuery, setSearchQuery] = useState('');
-
- const { data: previewData } = useQuery(GetAiSystemPromptPreviewDocument);
const aiModels = useAtomStateValue(aiModelsState);
- const { useRecommendedModels, realModels, enabledModels } =
- useWorkspaceAiModelAvailability();
+ const tiers = useAiModelTiers();
+ const { chatTier, agentTier } = useWorkspaceAiModelTiers();
const {
- handleModelFieldChange,
- handleUseRecommendedToggle,
- handleModelToggle,
- handleToggleAllVisibleModels,
+ handleChatTierChange,
+ handleAgentTierChange,
+ handleAutoModelSelectionToggle,
+ handlePinnedModelChange,
} = useSettingsAiModelsActions();
+ const { data: previewData } = useQuery(GetAiSystemPromptPreviewDocument);
+
const systemPromptTokenCount =
previewData?.getAiSystemPromptPreview.estimatedTokenCount;
const systemPromptDescription = isDefined(systemPromptTokenCount)
@@ -64,134 +62,97 @@ export const SettingsAiModelsTab = () => {
)} tokens)`
: t`Read the system prompts to understand how the AI works`;
- const currentSmartModel = currentWorkspace?.smartModel;
- const currentFastModel = currentWorkspace?.fastModel;
-
- const buildPinnedOption = (autoSelectModelId: string) => {
- const autoSelectEntry = aiModels.find(
- (model) => model.modelId === autoSelectModelId,
- );
- if (!autoSelectEntry) return undefined;
- return {
- value: autoSelectModelId,
- label: autoSelectEntry.label,
- Icon: getModelIcon(
- autoSelectEntry.modelFamily,
- autoSelectEntry.providerName,
- ),
- contextualText: t`Best`,
- };
- };
+ const isAutoModelSelectionEnabled =
+ currentWorkspace?.isAutoModelSelectionEnabled ?? true;
+ const aiModelIdByTier: Partial<Record<AiModelTier, string>> =
+ currentWorkspace?.aiModelIdByTier ?? {};
- const smartPinnedOption = buildPinnedOption(AUTO_SELECT_SMART_MODEL_ID);
- const fastPinnedOption = buildPinnedOption(AUTO_SELECT_FAST_MODEL_ID);
-
- const modelOptions = enabledModels.map((model) => {
- const residencyFlag = model.dataResidency
- ? ` ${getDataResidencyDisplay(model.dataResidency)}`
- : '';
- return {
- value: model.modelId,
- label: `${model.label}${residencyFlag}`,
- Icon: getModelIcon(model.modelFamily, model.providerName),
- };
- });
-
- const enabledModelIdSet = new Set(currentWorkspace?.enabledAiModelIds ?? []);
-
- const filteredModels = searchQuery.trim()
- ? realModels.filter((model) => {
- const query = searchQuery.toLowerCase();
- return (
- model.label.toLowerCase().includes(query) ||
- (model.modelFamily?.toLowerCase().includes(query) ?? false) ||
- (model.sdkPackage?.toLowerCase().includes(query) ?? false)
- );
- })
- : realModels;
+ const tierOptions = AI_MODEL_TIERS.map((tier) => ({
+ value: tier,
+ label: getAiModelTierLabel(tier),
+ }));
return (
<>
<Section>
<H2Title
- title={t`Default model`}
- description={t`The default AI model used for chats, agents, and workflows`}
+ title={t`Models`}
+ description={t`Which level of model people and agents get by default`}
/>
<Card rounded>
<SettingsOptionCardContentSelect
- Icon={IconCpu}
- title={t`Smart Model`}
- description={t`Used for chats, agents, and complex reasoning`}
+ Icon={IconMessage}
+ title={t`AI chat`}
+ description={t`Model used when you chat with Twenty`}
divider
>
<Select
- dropdownId="models-tab-smart-model-select"
- value={currentSmartModel}
- onChange={(value) => handleModelFieldChange('smartModel', value)}
- options={modelOptions}
- pinnedOption={smartPinnedOption}
+ dropdownId="models-tab-chat-tier-select"
+ value={chatTier}
+ onChange={handleChatTierChange}
+ options={tierOptions}
selectSizeVariant="small"
- dropdownWidth={GenericDropdownContentWidth.ExtraLarge}
/>
</SettingsOptionCardContentSelect>
<SettingsOptionCardContentSelect
- Icon={IconBolt}
- title={t`Fast Model`}
- description={t`Used for lightweight tasks like title generation`}
+ Icon={IconRobot}
+ title={t`Agents`}
+ description={t`Model agents use when they run on their own`}
+ divider
>
<Select
- dropdownId="models-tab-fast-model-select"
- value={currentFastModel}
- onChange={(value) => handleModelFieldChange('fastModel', value)}
- options={modelOptions}
- pinnedOption={fastPinnedOption}
+ dropdownId="models-tab-agent-tier-select"
+ value={agentTier}
+ onChange={handleAgentTierChange}
+ options={tierOptions}
selectSizeVariant="small"
- dropdownWidth={GenericDropdownContentWidth.ExtraLarge}
/>
</SettingsOptionCardContentSelect>
- </Card>
- </Section>
-
- <Section>
- <H2Title
- title={t`Available models`}
- description={t`Models available in the agent node and chat model pickers`}
- />
- <Card rounded>
<SettingsOptionCardContentSwitch
- Icon={IconStar}
- title={t`Use best models only`}
- description={t`Restrict available models to a curated list`}
- checked={useRecommendedModels}
- onChange={handleUseRecommendedToggle}
- divider={!useRecommendedModels}
+ Icon={IconRefresh}
+ title={t`Choose automatically`}
+ description={t`Twenty fills each level with the best model that meets your requirements`}
+ checked={isAutoModelSelectionEnabled}
+ onChange={handleAutoModelSelectionToggle}
/>
</Card>
- {!useRecommendedModels && (
- <StyledCustomModelsContainer>
- <SearchInput
- placeholder={t`Search a model...`}
- value={searchQuery}
- onChange={setSearchQuery}
- />
-
- <SettingsAiModelsTable
- models={filteredModels}
- isChecked={(model) => enabledModelIdSet.has(model.modelId)}
- onToggle={handleModelToggle}
- onToggleAll={(shouldCheckAll) =>
- handleToggleAllVisibleModels(
- shouldCheckAll,
- new Set(filteredModels.map((m) => m.modelId)),
- )
- }
- anchorPrefix="workspace-model-row"
- />
- </StyledCustomModelsContainer>
+ {!isAutoModelSelectionEnabled && (
+ <StyledPinnedModelsContainer>
+ <Card rounded>
+ {tiers.map((tier, index) => (
+ <SettingsOptionCardContentSelect
+ key={tier.tier}
+ title={tier.label}
+ description={
+ tier.isPinned
+ ? t`Pinned`
+ : isDefined(tier.model)
+ ? t`Automatic: ${tier.model.label}`
+ : t`No model available`
+ }
+ divider={index < tiers.length - 1}
+ >
+ <AiModelPinSelect
+ dropdownId={`models-tab-pinned-model-select-${tier.tier}`}
+ modelId={aiModelIdByTier[tier.tier] ?? null}
+ onChange={(modelId) =>
+ handlePinnedModelChange(tier.tier, modelId)
+ }
+ aiModels={aiModels}
+ emptyOptionLabel={t`Automatic`}
+ selectSizeVariant="small"
+ dropdownWidth={GenericDropdownContentWidth.ExtraLarge}
+ />
+ </SettingsOptionCardContentSelect>
+ ))}
+ </Card>
+ </StyledPinnedModelsContainer>
)}
</Section>
+ <SettingsAiModelTiersPreview />
+
<Section>
<H2Title
title={t`System Prompt`}
diff --git a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentFormState.ts b/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentFormState.ts
index b0ef427f24e..8f7f63a2aae 100644
--- a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentFormState.ts
+++ b/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentFormState.ts
@@ -1,4 +1,5 @@
import { useState } from 'react';
+import { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from 'twenty-shared/ai';
import { isDefined } from 'twenty-shared/utils';
import { type z } from 'zod';
import { settingsAiAgentFormSchema } from '~/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema';
@@ -13,7 +14,7 @@ export const useSettingsAgentFormState = (mode: 'create' | 'edit') => {
label: '',
description: '',
icon: 'IconLego',
- modelId: mode === 'edit' ? '' : 'auto',
+ modelId: mode === 'edit' ? '' : AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,
role: null,
prompt: '',
isCustom: true,
@@ -52,7 +53,7 @@ export const useSettingsAgentFormState = (mode: 'create' | 'edit') => {
label: '',
description: '',
icon: 'IconLego',
- modelId: mode === 'edit' ? '' : 'auto',
+ modelId: mode === 'edit' ? '' : AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,
role: '',
prompt: '',
isCustom: true,
diff --git a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAiModelsActions.ts b/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAiModelsActions.ts
index 5ebedd5333d..29db1e6d808 100644
--- a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAiModelsActions.ts
+++ b/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAiModelsActions.ts
@@ -1,11 +1,31 @@
import { useMutation } from '@apollo/client/react';
import { t } from '@lingui/core/macro';
+import { type AiModelTier } from 'twenty-shared/ai';
+import { isDefined } from 'twenty-shared/utils';
-import { useWorkspaceAiModelAvailability } from '@/ai/hooks/useWorkspaceAiModelAvailability';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import {
+ currentWorkspaceState,
+ type CurrentWorkspace,
+} from '@/auth/states/currentWorkspaceState';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
-import { UpdateWorkspaceDocument } from '~/generated-metadata/graphql';
+import {
+ AiModelTier as GraphqlAiModelTier,
+ UpdateWorkspaceDocument,
+} from '~/generated-metadata/graphql';
+
+// Typed with the generated enum so the same object is both the optimistic
+// workspace patch and the mutation input; the enum's keys are the shared tier
+// literals, which is what makes the lookup below total.
+type WorkspaceAiModelSettingsChanges = Partial<
+ Pick<
+ CurrentWorkspace,
+ | 'aiChatModelTier'
+ | 'aiAgentModelTier'
+ | 'isAutoModelSelectionEnabled'
+ | 'aiModelIdByTier'
+ >
+>;
export const useSettingsAiModelsActions = () => {
const { enqueueErrorSnackBar } = useSnackBar();
@@ -13,125 +33,53 @@ export const useSettingsAiModelsActions = () => {
currentWorkspaceState,
);
const [updateWorkspace] = useMutation(UpdateWorkspaceDocument);
- const { realModels } = useWorkspaceAiModelAvailability();
- const handleModelFieldChange = async (
- field: 'smartModel' | 'fastModel',
- value: string,
+ const updateAiModelSettings = async (
+ changes: WorkspaceAiModelSettingsChanges,
) => {
if (!currentWorkspace?.id) return;
- const previousValue = currentWorkspace[field];
- try {
- setCurrentWorkspace({ ...currentWorkspace, [field]: value });
- await updateWorkspace({ variables: { input: { [field]: value } } });
- } catch {
- setCurrentWorkspace({ ...currentWorkspace, [field]: previousValue });
- enqueueErrorSnackBar({ message: t`Failed to update model` });
- }
- };
-
- const handleUseRecommendedToggle = async (checked: boolean) => {
- if (!currentWorkspace?.id) return;
-
- const previousValue = currentWorkspace.useRecommendedModels;
- let newEnabledIds = currentWorkspace.enabledAiModelIds ?? [];
-
- if (!checked && previousValue) {
- newEnabledIds = realModels
- .filter((model) => model.isRecommended)
- .map((model) => model.modelId);
- }
+ const previousWorkspace = currentWorkspace;
try {
- setCurrentWorkspace({
- ...currentWorkspace,
- useRecommendedModels: checked,
- enabledAiModelIds: newEnabledIds,
- });
- await updateWorkspace({
- variables: {
- input: {
- useRecommendedModels: checked,
- enabledAiModelIds: newEnabledIds,
- },
- },
- });
+ setCurrentWorkspace({ ...currentWorkspace, ...changes });
+ await updateWorkspace({ variables: { input: changes } });
} catch {
- setCurrentWorkspace({
- ...currentWorkspace,
- useRecommendedModels: previousValue,
- });
- enqueueErrorSnackBar({
- message: t`Failed to update model selection mode`,
- });
+ setCurrentWorkspace(previousWorkspace);
+ enqueueErrorSnackBar({ message: t`Failed to update model settings` });
}
};
- const handleModelToggle = async (
- modelId: string,
- isCurrentlyEnabled: boolean,
- ) => {
- if (!currentWorkspace?.id) return;
+ const handleChatTierChange = (tier: AiModelTier) =>
+ updateAiModelSettings({ aiChatModelTier: GraphqlAiModelTier[tier] });
- const previousEnabled = currentWorkspace.enabledAiModelIds ?? [];
- const newEnabledIds = isCurrentlyEnabled
- ? previousEnabled.filter((id) => id !== modelId)
- : [...previousEnabled, modelId];
+ const handleAgentTierChange = (tier: AiModelTier) =>
+ updateAiModelSettings({ aiAgentModelTier: GraphqlAiModelTier[tier] });
- try {
- setCurrentWorkspace({
- ...currentWorkspace,
- enabledAiModelIds: newEnabledIds,
- });
- await updateWorkspace({
- variables: { input: { enabledAiModelIds: newEnabledIds } },
- });
- } catch {
- setCurrentWorkspace({
- ...currentWorkspace,
- enabledAiModelIds: previousEnabled,
- });
- enqueueErrorSnackBar({
- message: t`Failed to update model availability`,
- });
- }
- };
+ const handleAutoModelSelectionToggle = (isEnabled: boolean) =>
+ updateAiModelSettings({ isAutoModelSelectionEnabled: isEnabled });
- const handleToggleAllVisibleModels = async (
- shouldCheckAll: boolean,
- visibleModelIds: Set<string>,
+ const handlePinnedModelChange = (
+ tier: AiModelTier,
+ modelId: string | null,
) => {
- if (!currentWorkspace?.id) return;
-
- const previousIds = currentWorkspace.enabledAiModelIds ?? [];
- const newEnabledIds = shouldCheckAll
- ? [...new Set([...previousIds, ...visibleModelIds])]
- : previousIds.filter((id) => !visibleModelIds.has(id));
+ const {
+ [tier]: _previousPin,
+ ...otherPins
+ }: Partial<Record<AiModelTier, string>> =
+ currentWorkspace?.aiModelIdByTier ?? {};
- try {
- setCurrentWorkspace({
- ...currentWorkspace,
- enabledAiModelIds: newEnabledIds,
- });
- await updateWorkspace({
- variables: { input: { enabledAiModelIds: newEnabledIds } },
- });
- } catch {
- setCurrentWorkspace({
- ...currentWorkspace,
- enabledAiModelIds: previousIds,
- });
- enqueueErrorSnackBar({
- message: t`Failed to update model availability`,
- });
- }
+ return updateAiModelSettings({
+ aiModelIdByTier: isDefined(modelId)
+ ? { ...otherPins, [tier]: modelId }
+ : otherPins,
+ });
};
return {
- handleModelFieldChange,
- handleUseRecommendedToggle,
- handleModelToggle,
- handleToggleAllVisibleModels,
+ handleChatTierChange,
+ handleAgentTierChange,
+ handleAutoModelSelectionToggle,
+ handlePinnedModelChange,
};
};
diff --git a/packages/twenty-front/src/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema.ts b/packages/twenty-front/src/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema.ts
index 08a832a14dc..c08f114d53c 100644
--- a/packages/twenty-front/src/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema.ts
+++ b/packages/twenty-front/src/pages/settings/ai/validation-schemas/settingsAiAgentFormSchema.ts
@@ -7,7 +7,7 @@ export const settingsAiAgentFormSchema = z.object({
label: zodNonEmptyString,
description: z.string().nullish(),
icon: z.string().optional(),
- modelId: z.union([z.string().min(1, 'Model is required'), z.literal('auto')]),
+ modelId: z.string().min(1, 'Model is required'),
role: z.string().nullish(),
prompt: zodNonEmptyString,
isCustom: z.boolean().default(true),
diff --git a/packages/twenty-front/src/testing/mock-data/config.ts b/packages/twenty-front/src/testing/mock-data/config.ts
index 30002afc898..50f0ee95cac 100644
--- a/packages/twenty-front/src/testing/mock-data/config.ts
+++ b/packages/twenty-front/src/testing/mock-data/config.ts
@@ -3,6 +3,7 @@ import { CaptchaDriverType, SupportDriver } from '~/generated-metadata/graphql';
export const mockedClientConfig: ClientConfig = {
aiModels: [],
+ aiModelTiers: [],
signInPrefilled: true,
isMultiWorkspaceEnabled: false,
isEmailVerificationRequired: false,
diff --git a/packages/twenty-front/src/testing/mock-data/users.ts b/packages/twenty-front/src/testing/mock-data/users.ts
index cceb86cd0e0..58259a60edb 100644
--- a/packages/twenty-front/src/testing/mock-data/users.ts
+++ b/packages/twenty-front/src/testing/mock-data/users.ts
@@ -2,10 +2,7 @@ import { type CurrentUserWorkspace } from '@/auth/states/currentUserWorkspaceSta
import { CUSTOM_WORKSPACE_APPLICATION_MOCK } from '@/object-metadata/hooks/__tests__/constants/CustomWorkspaceApplicationMock.test.constant';
import { type WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
import {
- AUTO_SELECT_FAST_MODEL_ID,
- AUTO_SELECT_SMART_MODEL_ID,
-} from 'twenty-shared/constants';
-import {
+ AiModelTier,
OnboardingStatus,
PermissionFlagType,
SubscriptionInterval,
@@ -89,11 +86,10 @@ export const mockCurrentWorkspace = {
updatedAt: '2023-04-26T10:23:42.33625+00:00',
metadataVersion: 1,
trashRetentionDays: 14,
- fastModel: AUTO_SELECT_FAST_MODEL_ID,
- smartModel: AUTO_SELECT_SMART_MODEL_ID,
- routerModel: 'auto',
- enabledAiModelIds: [],
- useRecommendedModels: true,
+ aiChatModelTier: AiModelTier.fast,
+ aiAgentModelTier: AiModelTier.fast,
+ isAutoModelSelectionEnabled: true,
+ aiModelIdByTier: {},
isInternalMessagesImportEnabled: false,
currentBillingSubscription: {
__typename: 'BillingSubscription',
diff --git a/packages/twenty-server/.env.example b/packages/twenty-server/.env.example
index fa03facee9d..cab43765b4f 100644
--- a/packages/twenty-server/.env.example
+++ b/packages/twenty-server/.env.example
@@ -119,9 +119,11 @@ FRONTEND_URL=http://localhost:3001
# AI_PROVIDERS='{"my-gateway":{"type":"openai-compatible","baseUrl":"...","apiKey":"..."}}'
#
# Comma-separated model IDs (JSON array syntax also accepted, e.g. '["a","b"]'):
-# AI_MODELS_DEFAULT_FAST=openai/gpt-5-mini,anthropic/claude-haiku-4-5-20251001
-# AI_MODELS_DEFAULT_SMART=openai/gpt-5.2,anthropic/claude-sonnet-4-6
-# AI_MODELS_DEFAULT_RECOMMENDED=openai/gpt-5.2,openai/gpt-4.1,anthropic/claude-sonnet-4-6
+# AI_MODELS_DEFAULT_EXTRA_FAST=openai/gpt-5.6-luna@low,google/gemini-3.8-flash@low
+# AI_MODELS_DEFAULT_FAST=openai/gpt-5.6-luna@medium,google/gemini-3.8-flash@medium
+# AI_MODELS_DEFAULT_BALANCED=openai/gpt-5.6-luna@high,google/gemini-3.8-flash@high
+# AI_MODELS_DEFAULT_SMART=openai/gpt-5.6-sol@high,google/gemini-3.8-flash@high
+# AI_MODELS_DEFAULT_EXTRA_SMART=openai/gpt-6-astra@xhigh,google/gemini-3.8-flash@high
# AI_MODELS_DEFAULT_DISABLED=
# ———————— Emailing domain (marketing campaigns) ————————
diff --git a/packages/twenty-server/scripts/ai-catalog-sync/__tests__/fetch-artificial-analysis.spec.ts b/packages/twenty-server/scripts/ai-catalog-sync/__tests__/fetch-artificial-analysis.spec.ts
index 49b0aa4855e..d9872996af5 100644
--- a/packages/twenty-server/scripts/ai-catalog-sync/__tests__/fetch-artificial-analysis.spec.ts
+++ b/packages/twenty-server/scripts/ai-catalog-sync/__tests__/fetch-artificial-analysis.spec.ts
@@ -10,8 +10,10 @@ const respondWith = (models: unknown[]): void => {
const measuredModel = {
slug: 'claude-sonnet-5',
evaluations: { artificial_analysis_intelligence_index: 38.4 },
- median_output_tokens_per_second: 92.1,
- cost_per_task: { total_cost: 0.42 },
+ performance: { median_output_tokens_per_second: 92.1 },
+ artificial_analysis_intelligence_index_cost: {
+ cost_per_task: { total_cost: 0.42 },
+ },
};
describe('fetchArtificialAnalysisBenchmarks', () => {
@@ -32,7 +34,7 @@ describe('fetchArtificialAnalysisBenchmarks', () => {
{
slug: 'grok-4-6',
evaluations: { artificial_analysis_intelligence_index: 44.1 },
- median_output_tokens_per_second: 0,
+ performance: { median_output_tokens_per_second: 0 },
},
]);
@@ -57,14 +59,16 @@ describe('fetchArtificialAnalysisBenchmarks', () => {
slug: 'claude-sonnet-4-6',
name: 'Claude Sonnet 4.6 (Non-reasoning, Low Effort)',
evaluations: { artificial_analysis_intelligence_index: 23.3 },
- median_output_tokens_per_second: 120,
- cost_per_task: { total_cost: 0.1 },
+ performance: { median_output_tokens_per_second: 120 },
+ artificial_analysis_intelligence_index_cost: {
+ cost_per_task: { total_cost: 0.1 },
+ },
};
const maxEffort = {
slug: 'claude-sonnet-4-6',
name: 'Claude Sonnet 4.6 (Adaptive Reasoning, Max Effort)',
evaluations: { artificial_analysis_intelligence_index: 36.2 },
- median_output_tokens_per_second: 80,
+ performance: { median_output_tokens_per_second: 80 },
};
respondWith(bestFirst ? [maxEffort, lowEffort] : [lowEffort, maxEffort]);
@@ -89,7 +93,7 @@ describe('fetchArtificialAnalysisBenchmarks', () => {
async (_label, unmeasuredFirst) => {
const unmeasured = {
slug: 'claude-sonnet-5',
- median_output_tokens_per_second: 0,
+ performance: { median_output_tokens_per_second: 0 },
};
respondWith(
@@ -118,7 +122,10 @@ describe('fetchArtificialAnalysisBenchmarks', () => {
it('fails loudly when every row came back unmeasured', async () => {
respondWith([
- { slug: 'claude-sonnet-5', median_output_tokens_per_second: 0 },
+ {
+ slug: 'claude-sonnet-5',
+ performance: { median_output_tokens_per_second: 0 },
+ },
]);
await expect(fetchArtificialAnalysisBenchmarks('key')).rejects.toThrow(
@@ -131,7 +138,7 @@ describe('fetchArtificialAnalysisBenchmarks', () => {
{
slug: 'claude-sonnet-5',
artificial_analysis_intelligence_index: 38.4,
- median_output_tokens_per_second: 92.1,
+ performance: { median_output_tokens_per_second: 92.1 },
},
]);
@@ -143,6 +150,36 @@ describe('fetchArtificialAnalysisBenchmarks', () => {
expect(record?.outputTokensPerSecond).toBe(92.1);
});
+ it('reads every page of the list before indexing', async () => {
+ const pages = [
+ {
+ data: [measuredModel],
+ pagination: { page: 1, has_more: true },
+ },
+ {
+ data: [
+ {
+ slug: 'gpt-5-6-luna',
+ evaluations: { artificial_analysis_intelligence_index: 37.5 },
+ },
+ ],
+ pagination: { page: 2, has_more: false },
+ },
+ ];
+ const fetchMock = jest.fn(async (url: URL) => ({
+ ok: true,
+ json: async () => pages[Number(url.searchParams.get('page')) - 1],
+ }));
+
+ global.fetch = fetchMock as unknown as typeof fetch;
+
+ const index = await fetchArtificialAnalysisBenchmarks('key');
+
+ expect(fetchMock).toHaveBeenCalledTimes(2);
+ expect(index.get('claudesonnet5')?.intelligenceIndex).toBe(38.4);
+ expect(index.get('gpt56luna')?.intelligenceIndex).toBe(37.5);
+ });
+
it('files a row under its effort as well as under the bare model name', async () => {
respondWith([
{
@@ -154,7 +191,9 @@ describe('fetchArtificialAnalysisBenchmarks', () => {
slug: 'gpt-5-6-sol',
name: 'GPT-5.6 Sol (low)',
evaluations: { artificial_analysis_intelligence_index: 30.2 },
- cost_per_task: { total_cost: 0.08 },
+ artificial_analysis_intelligence_index_cost: {
+ cost_per_task: { total_cost: 0.08 },
+ },
},
]);
@@ -181,7 +220,7 @@ describe('fetchArtificialAnalysisBenchmarks', () => {
slug: 'grok-4-6',
name: 'Grok 4.6 (high)',
evaluations: { artificial_analysis_intelligence_index: 44.4 },
- median_output_tokens_per_second: 71,
+ performance: { median_output_tokens_per_second: 71 },
},
]);
diff --git a/packages/twenty-server/scripts/ai-catalog-sync/types/coverage-report.type.ts b/packages/twenty-server/scripts/ai-catalog-sync/types/coverage-report.type.ts
index 4d595559630..93d5fa1c326 100644
--- a/packages/twenty-server/scripts/ai-catalog-sync/types/coverage-report.type.ts
+++ b/packages/twenty-server/scripts/ai-catalog-sync/types/coverage-report.type.ts
@@ -1,6 +1,7 @@
export type CoverageReport = {
generalPurposeModelCount: number;
scoredGeneralPurposeModelCount: number;
+ costedGeneralPurposeModelCount: number;
unscoredGeneralPurposeModelIds: string[];
specializedModelCount: number;
declaredEffortVariantCount: number;
diff --git a/packages/twenty-server/scripts/ai-catalog-sync/utils/build-coverage-report.util.ts b/packages/twenty-server/scripts/ai-catalog-sync/utils/build-coverage-report.util.ts
index 38797d203d8..e6874e4fd90 100644
--- a/packages/twenty-server/scripts/ai-catalog-sync/utils/build-coverage-report.util.ts
+++ b/packages/twenty-server/scripts/ai-catalog-sync/utils/build-coverage-report.util.ts
@@ -16,6 +16,7 @@ export const buildCoverageReport = (
const report: CoverageReport = {
generalPurposeModelCount: 0,
scoredGeneralPurposeModelCount: 0,
+ costedGeneralPurposeModelCount: 0,
unscoredGeneralPurposeModelIds: [],
specializedModelCount: 0,
declaredEffortVariantCount: 0,
@@ -36,6 +37,10 @@ export const buildCoverageReport = (
report.generalPurposeModelCount += 1;
+ if (isDefined(model.benchmark?.costPerTask)) {
+ report.costedGeneralPurposeModelCount += 1;
+ }
+
if (isDefined(model.benchmark?.intelligenceIndex)) {
report.scoredGeneralPurposeModelCount += 1;
} else {
diff --git a/packages/twenty-server/scripts/ai-catalog-sync/utils/fetch-artificial-analysis-benchmarks.util.ts b/packages/twenty-server/scripts/ai-catalog-sync/utils/fetch-artificial-analysis-benchmarks.util.ts
index e6c72a2d33b..4af4bb433df 100644
--- a/packages/twenty-server/scripts/ai-catalog-sync/utils/fetch-artificial-analysis-benchmarks.util.ts
+++ b/packages/twenty-server/scripts/ai-catalog-sync/utils/fetch-artificial-analysis-benchmarks.util.ts
@@ -7,7 +7,9 @@ import { type BenchmarkIndex } from '../types/benchmark-index.type';
import { type BenchmarkRecord } from '../types/benchmark-record.type';
const DEFAULT_ARTIFICIAL_ANALYSIS_API_URL =
- 'https://artificialanalysis.ai/api/v2/data/llms/models';
+ 'https://artificialanalysis.ai/api/v2/language/models/free';
+
+const PAGE_SIZE = 200;
type ArtificialAnalysisModel = Record<string, unknown> & {
id?: string;
@@ -15,6 +17,11 @@ type ArtificialAnalysisModel = Record<string, unknown> & {
name?: string;
};
+type ArtificialAnalysisPage = {
+ data?: unknown;
+ pagination?: { has_more?: unknown };
+};
+
// This endpoint returns 0 for "not measured", and a zero tokens-per-second is a
// lie rather than a datum.
const readPositiveNumber = (value: unknown): number | undefined =>
@@ -24,32 +31,27 @@ const readPositiveNumber = (value: unknown): number | undefined =>
const readNested = ({
model,
- containerKey,
- leafKey,
+ path,
}: {
model: ArtificialAnalysisModel;
- containerKey: string;
- leafKey: string;
+ path: string[];
}): number | undefined => {
- const container = model[containerKey];
-
- if (typeof container !== 'object' || container === null) {
- return undefined;
- }
+ let current: unknown = model;
- return readPositiveNumber((container as Record<string, unknown>)[leafKey]);
-};
+ for (const key of path) {
+ if (typeof current !== 'object' || current === null) {
+ return undefined;
+ }
-const readModels = (payload: unknown): ArtificialAnalysisModel[] => {
- if (Array.isArray(payload)) {
- return payload as ArtificialAnalysisModel[];
+ current = (current as Record<string, unknown>)[key];
}
- const data = (payload as { data?: unknown } | null)?.data;
-
- return Array.isArray(data) ? (data as ArtificialAnalysisModel[]) : [];
+ return readPositiveNumber(current);
};
+const readModels = (page: ArtificialAnalysisPage): ArtificialAnalysisModel[] =>
+ Array.isArray(page.data) ? (page.data as ArtificialAnalysisModel[]) : [];
+
// How much a row actually says. The endpoint carries several rows per model and
// some hosts publish no measurements at all, so an unmeasured row must never
// displace a measured one under the same key.
@@ -80,14 +82,21 @@ const preferOver = (
return informationScore(candidate) > informationScore(existing);
};
-export const fetchArtificialAnalysisBenchmarks = async (
- apiKey: string,
-): Promise<BenchmarkIndex> => {
- const url =
- process.env.ARTIFICIAL_ANALYSIS_API_URL ??
- DEFAULT_ARTIFICIAL_ANALYSIS_API_URL;
+const fetchPage = async ({
+ url,
+ apiKey,
+ page,
+}: {
+ url: string;
+ apiKey: string;
+ page: number;
+}): Promise<ArtificialAnalysisPage> => {
+ const pageUrl = new URL(url);
- const response = await fetch(url, {
+ pageUrl.searchParams.set('page', String(page));
+ pageUrl.searchParams.set('page_size', String(PAGE_SIZE));
+
+ const response = await fetch(pageUrl, {
headers: { 'x-api-key': apiKey },
signal: AbortSignal.timeout(60000),
});
@@ -96,7 +105,39 @@ export const fetchArtificialAnalysisBenchmarks = async (
throw new Error(`${response.status} ${response.statusText}`);
}
- const models = readModels(await response.json());
+ return (await response.json()) as ArtificialAnalysisPage;
+};
+
+// The list is paginated and the free tier allows ten requests a day, so every
+// page is read in one run rather than spread across runs.
+const fetchAllModels = async ({
+ url,
+ apiKey,
+}: {
+ url: string;
+ apiKey: string;
+}): Promise<ArtificialAnalysisModel[]> => {
+ const models: ArtificialAnalysisModel[] = [];
+
+ for (let page = 1; ; page += 1) {
+ const response = await fetchPage({ url, apiKey, page });
+
+ models.push(...readModels(response));
+
+ if (response.pagination?.has_more !== true) {
+ return models;
+ }
+ }
+};
+
+export const fetchArtificialAnalysisBenchmarks = async (
+ apiKey: string,
+): Promise<BenchmarkIndex> => {
+ const url =
+ process.env.ARTIFICIAL_ANALYSIS_API_URL ??
+ DEFAULT_ARTIFICIAL_ANALYSIS_API_URL;
+
+ const models = await fetchAllModels({ url, apiKey });
if (models.length === 0) {
throw new Error(`No models in response from ${url}`);
@@ -120,22 +161,25 @@ export const fetchArtificialAnalysisBenchmarks = async (
const aliases = [model.slug, model.id, model.name].filter(isDefined);
- // The intelligence index sits under `evaluations` and cost per task under
- // `cost_per_task`; only the speed figure is top level. Reading them all
- // from the top level yields matched models carrying no usable number.
+ // Cost per task is the price of one task of the intelligence index run at
+ // this row's effort, so it reflects reasoning volume where per-token
+ // pricing cannot.
const record: BenchmarkRecord = {
intelligenceIndex: readNested({
model,
- containerKey: 'evaluations',
- leafKey: 'artificial_analysis_intelligence_index',
+ path: ['evaluations', 'artificial_analysis_intelligence_index'],
+ }),
+ outputTokensPerSecond: readNested({
+ model,
+ path: ['performance', 'median_output_tokens_per_second'],
}),
- outputTokensPerSecond: readPositiveNumber(
- model.median_output_tokens_per_second,
- ),
costPerTask: readNested({
model,
- containerKey: 'cost_per_task',
- leafKey: 'total_cost',
+ path: [
+ 'artificial_analysis_intelligence_index_cost',
+ 'cost_per_task',
+ 'total_cost',
+ ],
}),
effort:
typeof model.name === 'string'
diff --git a/packages/twenty-server/scripts/ai-catalog-sync/utils/render-coverage-report.util.ts b/packages/twenty-server/scripts/ai-catalog-sync/utils/render-coverage-report.util.ts
index 0b92a529ebf..4370f8f3615 100644
--- a/packages/twenty-server/scripts/ai-catalog-sync/utils/render-coverage-report.util.ts
+++ b/packages/twenty-server/scripts/ai-catalog-sync/utils/render-coverage-report.util.ts
@@ -31,6 +31,7 @@ export const renderCoverageReport = (report: CoverageReport): string => {
const {
generalPurposeModelCount: total,
scoredGeneralPurposeModelCount: scored,
+ costedGeneralPurposeModelCount: costed,
declaredEffortVariantCount: declaredVariants,
scoredEffortVariantCount: scoredVariants,
} = report;
@@ -40,6 +41,7 @@ export const renderCoverageReport = (report: CoverageReport): string => {
'',
`- General-purpose models with an intelligence index: **${scored}/${total}** (${asPercentage({ numerator: scored, denominator: total })})`,
`- Declared effort variants with an index measured at their own effort: **${scoredVariants}/${declaredVariants}** (${asPercentage({ numerator: scoredVariants, denominator: declaredVariants })})`,
+ `- General-purpose models with a cost per task: **${costed}/${total}** (${asPercentage({ numerator: costed, denominator: total })})`,
`- Specialized models excluded from the denominator: ${report.specializedModelCount}`,
...renderGapList({
summary: 'General-purpose models with no matched intelligence index',
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-40/2-40-instance-command-fast-1789000000000-add-ai-model-tiers-to-workspace.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-40/2-40-instance-command-fast-1789000000000-add-ai-model-tiers-to-workspace.ts
new file mode 100644
index 00000000000..99d4a4944fe
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-40/2-40-instance-command-fast-1789000000000-add-ai-model-tiers-to-workspace.ts
@@ -0,0 +1,39 @@
+import { type QueryRunner } from 'typeorm';
+
+import { RegisteredInstanceCommand } from 'src/engine/core-modules/upgrade/decorators/registered-instance-command.decorator';
+import { type FastInstanceCommand } from 'src/engine/core-modules/upgrade/interfaces/fast-instance-command.interface';
+
+// Opens the tier columns next to the model columns they replace. Until the
+// paired slow command copies each workspace's earlier picks into them and drops
+// the old columns, every workspace reads as automatic selection on Fast.
+@RegisteredInstanceCommand('2.40.0', 1789000000000)
+export class AddAiModelTiersToWorkspaceFastInstanceCommand
+ implements FastInstanceCommand
+{
+ public async up(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspace" ADD "aiChatModelTier" character varying NOT NULL DEFAULT 'fast'`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspace" ADD "aiAgentModelTier" character varying NOT NULL DEFAULT 'fast'`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspace" ADD "isAutoModelSelectionEnabled" boolean NOT NULL DEFAULT true`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspace" ADD "aiModelIdByTier" jsonb NOT NULL DEFAULT '{}'`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agent" ALTER COLUMN "modelId" SET DEFAULT 'workspace-default-model'`,
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.query(
+ `ALTER TABLE "core"."agent" ALTER COLUMN "modelId" SET DEFAULT 'default-smart-model'`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspace" DROP COLUMN "aiModelIdByTier", DROP COLUMN "isAutoModelSelectionEnabled", DROP COLUMN "aiAgentModelTier", DROP COLUMN "aiChatModelTier"`,
+ );
+ }
+}
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-40/2-40-instance-command-slow-1789000000001-migrate-workspace-models-to-tiers.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-40/2-40-instance-command-slow-1789000000001-migrate-workspace-models-to-tiers.ts
new file mode 100644
index 00000000000..f827bc7582e
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-40/2-40-instance-command-slow-1789000000001-migrate-workspace-models-to-tiers.ts
@@ -0,0 +1,102 @@
+import { type DataSource, type QueryRunner } from 'typeorm';
+
+import { RegisteredInstanceCommand } from 'src/engine/core-modules/upgrade/decorators/registered-instance-command.decorator';
+import { type SlowInstanceCommand } from 'src/engine/core-modules/upgrade/interfaces/slow-instance-command.interface';
+
+const LEGACY_WORKSPACE_MODEL_COLUMNS = [
+ 'fastModel',
+ 'smartModel',
+ 'enabledAiModelIds',
+ 'useRecommendedModels',
+ 'routerModel',
+];
+
+const hasLegacyWorkspaceModelColumns = async (
+ runQuery: (sql: string, parameters?: unknown[]) => Promise<unknown[]>,
+): Promise<boolean> => {
+ const rows = await runQuery(
+ `SELECT 1 FROM information_schema.columns
+ WHERE table_schema = 'core' AND table_name = 'workspace' AND column_name = 'smartModel'`,
+ );
+
+ return rows.length > 0;
+};
+
+// A workspace that had picked concrete models keeps them as pins in manual
+// mode, and one that picked its smart model stays on the Smart tier since chat
+// and default agents ran on it. Every other workspace moves to automatic
+// selection with the new defaults. Agents created with the old smart default
+// or the legacy 'auto' id follow the workspace agent tier from now on. A
+// workspace edited in the new UI before this ran keeps what it chose. Guarded
+// on the old columns so a re-run after the schema step is a no-op.
+@RegisteredInstanceCommand('2.40.0', 1789000000001, { type: 'slow' })
+export class MigrateWorkspaceModelsToTiersSlowInstanceCommand
+ implements SlowInstanceCommand
+{
+ async runDataMigration(dataSource: DataSource): Promise<void> {
+ if (
+ !(await hasLegacyWorkspaceModelColumns((sql) => dataSource.query(sql)))
+ ) {
+ return;
+ }
+
+ // Composite ids always contain a slash; the auto-select ids never do.
+ await dataSource.query(
+ `UPDATE "core"."workspace"
+ SET "isAutoModelSelectionEnabled" = false,
+ "aiModelIdByTier" = jsonb_strip_nulls(jsonb_build_object(
+ 'smart', CASE WHEN "smartModel" LIKE '%/%' THEN "smartModel" END,
+ 'fast', CASE WHEN "fastModel" LIKE '%/%' THEN "fastModel" END
+ )),
+ "aiChatModelTier" = CASE WHEN "smartModel" LIKE '%/%' THEN 'smart' ELSE "aiChatModelTier" END,
+ "aiAgentModelTier" = CASE WHEN "smartModel" LIKE '%/%' THEN 'smart' ELSE "aiAgentModelTier" END
+ WHERE ("smartModel" LIKE '%/%' OR "fastModel" LIKE '%/%')
+ AND "isAutoModelSelectionEnabled" = true
+ AND "aiModelIdByTier" = '{}'::jsonb`,
+ );
+ await dataSource.query(
+ `UPDATE "core"."agent" SET "modelId" = 'workspace-default-model' WHERE "modelId" IN ('default-smart-model', 'auto')`,
+ );
+ }
+
+ public async up(queryRunner: QueryRunner): Promise<void> {
+ if (
+ !(await hasLegacyWorkspaceModelColumns((sql) => queryRunner.query(sql)))
+ ) {
+ return;
+ }
+
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspace" ${LEGACY_WORKSPACE_MODEL_COLUMNS.map(
+ (column) => `DROP COLUMN "${column}"`,
+ ).join(', ')}`,
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspace" ADD "routerModel" character varying NOT NULL DEFAULT 'auto'`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspace" ADD "useRecommendedModels" boolean NOT NULL DEFAULT true`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspace" ADD "enabledAiModelIds" character varying array NOT NULL DEFAULT '{}'`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspace" ADD "smartModel" character varying NOT NULL DEFAULT 'default-smart-model'`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspace" ADD "fastModel" character varying NOT NULL DEFAULT 'default-fast-model'`,
+ );
+ await queryRunner.query(
+ `UPDATE "core"."workspace"
+ SET "smartModel" = COALESCE("aiModelIdByTier"->>'smart', "smartModel"),
+ "fastModel" = COALESCE("aiModelIdByTier"->>'fast', "fastModel")
+ WHERE "isAutoModelSelectionEnabled" = false`,
+ );
+ await queryRunner.query(
+ `UPDATE "core"."agent" SET "modelId" = 'default-smart-model' WHERE "modelId" = 'workspace-default-model'`,
+ );
+ }
+}
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-40/__tests__/2-40-instance-command-slow-1789000000001-migrate-workspace-models-to-tiers.spec.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-40/__tests__/2-40-instance-command-slow-1789000000001-migrate-workspace-models-to-tiers.spec.ts
new file mode 100644
index 00000000000..2df7d1a537c
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-40/__tests__/2-40-instance-command-slow-1789000000001-migrate-workspace-models-to-tiers.spec.ts
@@ -0,0 +1,110 @@
+import { type DataSource, type QueryRunner } from 'typeorm';
+
+import { MigrateWorkspaceModelsToTiersSlowInstanceCommand } from 'src/database/commands/upgrade-version-command/2-40/2-40-instance-command-slow-1789000000001-migrate-workspace-models-to-tiers';
+
+const buildFakeRunner = ({
+ hasLegacyColumns,
+}: {
+ hasLegacyColumns: boolean;
+}): {
+ runner: DataSource & QueryRunner;
+ queries: string[];
+} => {
+ const queries: string[] = [];
+
+ const runner = {
+ query: jest.fn(async (sql: string) => {
+ queries.push(sql);
+
+ if (sql.includes('information_schema.columns')) {
+ return hasLegacyColumns ? [{ '?column?': 1 }] : [];
+ }
+
+ return [];
+ }),
+ } as unknown as DataSource & QueryRunner;
+
+ return { runner, queries };
+};
+
+describe('MigrateWorkspaceModelsToTiersSlowInstanceCommand', () => {
+ it('is a no-op once the legacy columns are gone', async () => {
+ const { runner, queries } = buildFakeRunner({ hasLegacyColumns: false });
+ const command = new MigrateWorkspaceModelsToTiersSlowInstanceCommand();
+
+ await command.runDataMigration(runner);
+ await command.up(runner);
+
+ expect(queries.every((sql) => sql.includes('information_schema'))).toBe(
+ true,
+ );
+ });
+
+ it('pins the concrete models a workspace had chosen and turns automatic selection off', async () => {
+ const { runner, queries } = buildFakeRunner({ hasLegacyColumns: true });
+
+ await new MigrateWorkspaceModelsToTiersSlowInstanceCommand().runDataMigration(
+ runner,
+ );
+
+ const workspaceUpdate = queries.find((sql) =>
+ sql.includes('UPDATE "core"."workspace"'),
+ );
+
+ expect(workspaceUpdate).toContain('"isAutoModelSelectionEnabled" = false');
+ expect(workspaceUpdate).toContain(`"smartModel" LIKE '%/%'`);
+ expect(workspaceUpdate).toContain(`"fastModel" LIKE '%/%'`);
+ expect(workspaceUpdate).toContain(`"aiModelIdByTier" = '{}'::jsonb`);
+ });
+
+ it('keeps a workspace that picked its smart model on the Smart tier', async () => {
+ const { runner, queries } = buildFakeRunner({ hasLegacyColumns: true });
+
+ await new MigrateWorkspaceModelsToTiersSlowInstanceCommand().runDataMigration(
+ runner,
+ );
+
+ const workspaceUpdate = queries.find((sql) =>
+ sql.includes('UPDATE "core"."workspace"'),
+ );
+
+ expect(workspaceUpdate).toContain(
+ `"aiChatModelTier" = CASE WHEN "smartModel" LIKE '%/%' THEN 'smart'`,
+ );
+ expect(workspaceUpdate).toContain(
+ `"aiAgentModelTier" = CASE WHEN "smartModel" LIKE '%/%' THEN 'smart'`,
+ );
+ });
+
+ it('moves agents on the old smart default or the legacy auto id onto the workspace tier', async () => {
+ const { runner, queries } = buildFakeRunner({ hasLegacyColumns: true });
+
+ await new MigrateWorkspaceModelsToTiersSlowInstanceCommand().runDataMigration(
+ runner,
+ );
+
+ expect(queries).toContainEqual(
+ expect.stringContaining(
+ `SET "modelId" = 'workspace-default-model' WHERE "modelId" IN ('default-smart-model', 'auto')`,
+ ),
+ );
+ });
+
+ it('drops every legacy column in the schema step', async () => {
+ const { runner, queries } = buildFakeRunner({ hasLegacyColumns: true });
+
+ await new MigrateWorkspaceModelsToTiersSlowInstanceCommand().up(runner);
+
+ const dropStatement = queries.find((sql) => sql.includes('DROP COLUMN'));
+
+ for (const column of [
+ 'fastModel',
+ 'smartModel',
+ 'enabledAiModelIds',
+ 'useRecommendedModels',
+ 'routerModel',
+ ]) {
+ expect(dropStatement).toContain(`DROP COLUMN "${column}"`);
+ }
+ });
+});
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts
index 0ff8511831b..42324609eb8 100644
--- a/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts
@@ -184,6 +184,8 @@ import { ConvertLiveCreditGrantsToNoExpirySlowInstanceCommand } from 'src/databa
import { AddIsAuditLoggedToFieldMetadataFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-40/2-40-instance-command-fast-1788885873410-add-is-audit-logged-to-field-metadata';
import { BackfillIsAuditLoggedOnPositionFieldMetadataSlowInstanceCommand } from 'src/database/commands/upgrade-version-command/2-40/2-40-instance-command-slow-1788885873411-backfill-is-audit-logged-on-position-field-metadata';
import { AddCoreWorkflowIdToWorkflowVersionFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-40/2-40-instance-command-fast-1788960408161-add-core-workflow-id-to-workflow-version';
+import { AddAiModelTiersToWorkspaceFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-40/2-40-instance-command-fast-1789000000000-add-ai-model-tiers-to-workspace';
+import { MigrateWorkspaceModelsToTiersSlowInstanceCommand } from 'src/database/commands/upgrade-version-command/2-40/2-40-instance-command-slow-1789000000001-migrate-workspace-models-to-tiers';
export const INSTANCE_COMMANDS = [
AddViewFieldGroupIdIndexOnViewFieldFastInstanceCommand,
@@ -370,4 +372,6 @@ export const INSTANCE_COMMANDS = [
AddIsAuditLoggedToFieldMetadataFastInstanceCommand,
BackfillIsAuditLoggedOnPositionFieldMetadataSlowInstanceCommand,
AddCoreWorkflowIdToWorkflowVersionFastInstanceCommand,
+ AddAiModelTiersToWorkspaceFastInstanceCommand,
+ MigrateWorkspaceModelsToTiersSlowInstanceCommand,
];
diff --git a/packages/twenty-server/src/engine/core-modules/admin-panel/admin-panel.resolver.ts b/packages/twenty-server/src/engine/core-modules/admin-panel/admin-panel.resolver.ts
index 7fc47876b15..7e55e4f2291 100644
--- a/packages/twenty-server/src/engine/core-modules/admin-panel/admin-panel.resolver.ts
+++ b/packages/twenty-server/src/engine/core-modules/admin-panel/admin-panel.resolver.ts
@@ -3,6 +3,7 @@ import { Args, Int, Mutation, Query } from '@nestjs/graphql';
import { InjectRepository } from '@nestjs/typeorm';
import GraphQLJSON from 'graphql-type-json';
+import { AI_MODEL_TIERS } from 'twenty-shared/ai';
import { PermissionFlagType } from 'twenty-shared/constants';
import { isDefined } from 'twenty-shared/utils';
import { In, type Repository } from 'typeorm';
@@ -97,14 +98,14 @@ import { SettingsPermissionGuard } from 'src/engine/guards/settings-permission.g
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard';
import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';
import { MODEL_FAMILY_LABELS } from 'src/engine/metadata-modules/ai/ai-models/constants/model-family-labels.const';
-import { AiModelPreferencesService } from 'src/engine/metadata-modules/ai/ai-models/services/ai-model-preferences.service';
import { AiModelRegistryService } from 'src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service';
-import { AiModelRole } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-role.enum';
+import { AiModelTier } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-tier.enum';
import { AdminPanelHealthServiceDataDTO } from './dtos/admin-panel-health-service-data.dto';
import { MaintenanceModeDTO } from './dtos/maintenance-mode.dto';
import { QueueMetricsDataDTO } from './dtos/queue-metrics-data.dto';
import { SetMaintenanceModeInput } from './dtos/set-maintenance-mode.input';
+import { getAvailableEfforts } from 'src/engine/metadata-modules/ai/ai-models/utils/get-available-efforts.util';
@UsePipes(ResolverValidationPipe)
@AdminResolver()
@@ -138,7 +139,6 @@ export class AdminPanelResolver {
private featureFlagService: FeatureFlagService,
private readonly twentyConfigService: TwentyConfigService,
private readonly aiModelRegistryService: AiModelRegistryService,
- private readonly aiModelPreferencesService: AiModelPreferencesService,
private readonly usageAnalyticsService: UsageAnalyticsService,
private readonly maintenanceModeService: MaintenanceModeService,
private readonly upgradeStatusService: UpgradeStatusService,
@@ -285,14 +285,7 @@ export class AdminPanelResolver {
const models = this.aiModelRegistryService
.getAllModelsWithStatus()
.map(
- ({
- modelConfig,
- isAvailable,
- isAdminEnabled,
- isRecommended,
- providerName,
- name,
- }) => ({
+ ({ modelConfig, isAvailable, isAdminEnabled, providerName, name }) => ({
modelId: modelConfig.modelId,
label: modelConfig.label,
modelFamily: modelConfig.modelFamily,
@@ -303,7 +296,6 @@ export class AdminPanelResolver {
isAvailable,
isAdminEnabled,
isDeprecated: modelConfig.isDeprecated ?? false,
- isRecommended,
contextWindowTokens: modelConfig.contextWindowTokens,
maxOutputTokens: modelConfig.maxOutputTokens,
inputCostPerMillionTokens: modelConfig.inputCostPerMillionTokens,
@@ -314,15 +306,21 @@ export class AdminPanelResolver {
: undefined,
name,
dataResidency: modelConfig.dataResidency,
+ efforts: isDefined(modelConfig.effort)
+ ? undefined
+ : getAvailableEfforts(modelConfig),
}),
);
- const prefs = this.aiModelPreferencesService.getPreferences();
-
return {
models,
- defaultSmartModelId: prefs.defaultSmartModels?.[0],
- defaultFastModelId: prefs.defaultFastModels?.[0],
+ // The model the tier actually runs on here, not the head of the chain: a
+ // chain can start with a provider this instance holds no key for.
+ defaultModelByTier: AI_MODEL_TIERS.map((tier) => ({
+ tier,
+ modelId:
+ this.aiModelRegistryService.findDefaultModelForTier(tier)?.modelId,
+ })),
};
}
@@ -348,38 +346,13 @@ export class AdminPanelResolver {
return true;
}
- @UseGuards(AdminPanelGuard)
- @Mutation(() => Boolean)
- async setAdminAiModelRecommended(
- @Args('modelId', { type: () => String }) modelId: string,
- @Args('recommended', { type: () => Boolean }) recommended: boolean,
- ): Promise<boolean> {
- await this.aiModelRegistryService.setModelRecommended(modelId, recommended);
-
- return true;
- }
-
- @UseGuards(AdminPanelGuard)
- @Mutation(() => Boolean)
- async setAdminAiModelsRecommended(
- @Args('modelIds', { type: () => [String] }) modelIds: string[],
- @Args('recommended', { type: () => Boolean }) recommended: boolean,
- ): Promise<boolean> {
- await this.aiModelRegistryService.setModelsRecommended(
- modelIds,
- recommended,
- );
-
- return true;
- }
-
@UseGuards(AdminPanelGuard)
@Mutation(() => Boolean)
async setAdminDefaultAiModel(
- @Args('role', { type: () => AiModelRole }) role: AiModelRole,
+ @Args('tier', { type: () => AiModelTier }) tier: AiModelTier,
@Args('modelId', { type: () => String }) modelId: string,
): Promise<boolean> {
- await this.aiModelRegistryService.setDefaultModel(role, modelId);
+ await this.aiModelRegistryService.setDefaultModel(tier, modelId);
return true;
}
diff --git a/packages/twenty-server/src/engine/core-modules/application/utils/from-agent-manifest-to-universal-flat-agent.util.ts b/packages/twenty-server/src/engine/core-modules/application/utils/from-agent-manifest-to-universal-flat-agent.util.ts
index 6f76df35e1c..4f6113675a2 100644
--- a/packages/twenty-server/src/engine/core-modules/application/utils/from-agent-manifest-to-universal-flat-agent.util.ts
+++ b/packages/twenty-server/src/engine/core-modules/application/utils/from-agent-manifest-to-universal-flat-agent.util.ts
@@ -1,6 +1,6 @@
import { type AgentManifest } from 'twenty-shared/application';
-import { AUTO_SELECT_SMART_MODEL_ID } from 'twenty-shared/constants';
+import { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from 'twenty-shared/ai';
import { type ModelId } from 'src/engine/metadata-modules/ai/ai-models/types/model-id.type';
import { type UniversalFlatAgent } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-agent.type';
@@ -21,7 +21,9 @@ export const fromAgentManifestToUniversalFlatAgent = ({
icon: agentManifest.icon ?? null,
description: agentManifest.description ?? null,
prompt: agentManifest.prompt,
- modelId: (agentManifest.modelId as ModelId) ?? AUTO_SELECT_SMART_MODEL_ID,
+ modelId:
+ (agentManifest.modelId as ModelId) ??
+ AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,
responseFormat: agentManifest.responseFormat ?? { type: 'text' },
modelConfiguration: null,
evaluationInputs: [],
diff --git a/packages/twenty-server/src/engine/core-modules/client-config/client-config.controller.spec.ts b/packages/twenty-server/src/engine/core-modules/client-config/client-config.controller.spec.ts
index 89c01032d47..aa9ae491781 100644
--- a/packages/twenty-server/src/engine/core-modules/client-config/client-config.controller.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/client-config/client-config.controller.spec.ts
@@ -47,6 +47,7 @@ describe('ClientConfigController', () => {
},
],
},
+ aiModelTiers: [],
aiModels: [
{
modelId: 'openai/gpt-4o' as ModelId,
diff --git a/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts b/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts
index 2b0f090671d..d9dd5fe13ba 100644
--- a/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts
+++ b/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts
@@ -5,7 +5,7 @@ import {
registerEnumType,
} from '@nestjs/graphql';
-import { type AiSdkPackage } from 'twenty-shared/ai';
+import { type AiModelTier, type AiSdkPackage } from 'twenty-shared/ai';
import { FeatureFlagKey } from 'twenty-shared/types';
import { SupportDriver } from 'src/engine/core-modules/twenty-config/interfaces/support.interface';
@@ -13,7 +13,7 @@ import { SupportDriver } from 'src/engine/core-modules/twenty-config/interfaces/
import { BillingTrialPeriodDTO } from 'src/engine/core-modules/billing/dtos/billing-trial-period.dto';
import { CaptchaDriverType } from 'src/engine/core-modules/captcha/interfaces';
import { AuthProvidersDTO } from 'src/engine/core-modules/workspace/dtos/public-workspace-data.dto';
-import { AiModelRole } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-role.enum';
+import { AiModelTier as AiModelTierEnum } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-tier.enum';
import { ModelFamily } from 'src/engine/metadata-modules/ai/ai-models/types/model-family.enum';
import { type ModelId } from 'src/engine/metadata-modules/ai/ai-models/types/model-id.type';
@@ -25,10 +25,6 @@ registerEnumType(ModelFamily, {
name: 'ModelFamily',
});
-registerEnumType(AiModelRole, {
- name: 'AiModelRole',
-});
-
@ObjectType()
export class NativeModelCapabilities {
@Field(() => Boolean, { nullable: true })
@@ -68,9 +64,6 @@ export class ClientAiModelConfig {
@Field(() => Boolean, { nullable: true })
isDeprecated?: boolean;
- @Field(() => Boolean, { nullable: true })
- isRecommended?: boolean;
-
@Field(() => String, { nullable: true })
providerName?: string;
@@ -85,6 +78,38 @@ export class ClientAiModelConfig {
@Field(() => String, { nullable: true })
dataResidency?: string;
+
+ @Field(() => Number, { nullable: true })
+ intelligenceIndex?: number;
+
+ @Field(() => Number, { nullable: true })
+ outputTokensPerSecond?: number;
+
+ @Field(() => Number, { nullable: true })
+ costPerTask?: number;
+
+ // Reasoning levels a pin may name as `modelId@effort`; empty for a model
+ // that takes none, unset on a variant that already names its own.
+ @Field(() => [String], { nullable: true })
+ efforts?: string[];
+
+ @Field(() => String, { nullable: true })
+ effort?: string;
+
+ // A pinned effort without a reading of its own shows the base model's
+ // figures until the benchmark sync measures it.
+ @Field(() => Boolean, { nullable: true })
+ isBenchmarkInherited?: boolean;
+}
+
+@ObjectType()
+export class ClientAiModelTierConfig {
+ @Field(() => AiModelTierEnum)
+ tier: AiModelTier;
+
+ // The model this instance resolves the tier to when a workspace has no pin.
+ @Field(() => String)
+ modelId: ModelId;
}
@ObjectType()
@@ -114,9 +139,6 @@ export class AdminAiModelConfig {
@Field(() => Boolean, { nullable: true })
isDeprecated?: boolean;
- @Field(() => Boolean, { nullable: true })
- isRecommended?: boolean;
-
@Field(() => Number, { nullable: true })
contextWindowTokens?: number;
@@ -141,6 +163,20 @@ export class AdminAiModelConfig {
@Field(() => String, { nullable: true })
dataResidency?: string;
+
+ @Field(() => [String], { nullable: true })
+ efforts?: string[];
+}
+
+@ObjectType()
+export class AdminAiModelTierDefault {
+ @Field(() => AiModelTierEnum)
+ tier: AiModelTier;
+
+ // The model the tier resolves to on this instance; unset when no model is
+ // available.
+ @Field(() => String, { nullable: true })
+ modelId?: string;
}
@ObjectType('AdminAiModels')
@@ -148,13 +184,8 @@ export class AdminAiModelsDTO {
@Field(() => [AdminAiModelConfig])
models: AdminAiModelConfig[];
- @Field(() => String, { nullable: true })
- // Composite model id for the default “smart” role (`provider/modelName`).
- defaultSmartModelId?: string;
-
- @Field(() => String, { nullable: true })
- // Composite model id for the default “fast” role (`provider/modelName`).
- defaultFastModelId?: string;
+ @Field(() => [AdminAiModelTierDefault])
+ defaultModelByTier: AdminAiModelTierDefault[];
}
@ObjectType()
@@ -271,6 +302,9 @@ export class ClientConfig {
@Field(() => [ClientAiModelConfig])
aiModels: ClientAiModelConfig[];
+ @Field(() => [ClientAiModelTierConfig])
+ aiModelTiers: ClientAiModelTierConfig[];
+
@Field(() => Boolean)
signInPrefilled: boolean;
diff --git a/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.ts b/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.ts
index 139ea020a82..2c92218a368 100644
--- a/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.ts
@@ -18,14 +18,14 @@ import { EmailingDomainDriver } from 'src/engine/core-modules/emailing-domain/dr
import { PUBLIC_FEATURE_FLAGS } from 'src/engine/core-modules/feature-flag/constants/public-feature-flag.const';
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
import { toDisplayCredits } from 'src/engine/core-modules/usage/utils/to-display-credits.util';
-import {
- AUTO_SELECT_FAST_MODEL_ID,
- AUTO_SELECT_SMART_MODEL_ID,
- ENTERPRISE_INSTANCE_TYPE,
-} from 'twenty-shared/constants';
+import { AI_MODEL_TIERS, parseAiModelVariantId } from 'twenty-shared/ai';
+import { ENTERPRISE_INSTANCE_TYPE } from 'twenty-shared/constants';
import { MODEL_FAMILY_LABELS } from 'src/engine/metadata-modules/ai/ai-models/constants/model-family-labels.const';
+import { getAvailableEfforts } from 'src/engine/metadata-modules/ai/ai-models/utils/get-available-efforts.util';
import { getNativeModelCapabilities } from 'src/engine/metadata-modules/ai/ai-models/utils/get-native-model-capabilities.util';
import { AiModelRegistryService } from 'src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service';
+import { type AiModelBenchmark } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-benchmark.type';
+import { type AiModelConfig } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-config.type';
@Injectable()
export class ClientConfigService {
@@ -36,6 +36,26 @@ export class ClientConfigService {
private maintenanceModeService: MaintenanceModeService,
) {}
+ // A variant carries only the reading taken at its own effort, so until the
+ // sync measures it the base model's reading is shown, flagged as such.
+ private resolveBenchmark(modelConfig: AiModelConfig | undefined): {
+ benchmark?: AiModelBenchmark;
+ isInherited: boolean;
+ } {
+ if (isDefined(modelConfig?.benchmark)) {
+ return { benchmark: modelConfig.benchmark, isInherited: false };
+ }
+
+ const { modelId: baseModelId, effort } = parseAiModelVariantId(
+ modelConfig?.modelId ?? '',
+ );
+ const baseBenchmark = isDefined(effort)
+ ? this.aiModelRegistryService.getModelConfig(baseModelId)?.benchmark
+ : undefined;
+
+ return { benchmark: baseBenchmark, isInherited: isDefined(baseBenchmark) };
+ }
+
private isCloudflareIntegrationEnabled(): boolean {
return (
!!this.twentyConfigService.get('CLOUDFLARE_API_KEY') &&
@@ -64,8 +84,6 @@ export class ClientConfigService {
const availableModels =
this.aiModelRegistryService.getAdminFilteredModels();
- const recommendedModelIds =
- this.aiModelRegistryService.getRecommendedModelIds();
const resolvedProviders =
this.aiModelRegistryService.getResolvedProvidersForAdmin();
@@ -82,6 +100,7 @@ export class ClientConfigService {
const modelFamily = modelConfig?.modelFamily;
const providerName = registeredModel.providerName;
+ const { benchmark, isInherited } = this.resolveBenchmark(modelConfig);
return {
modelId: registeredModel.modelId,
@@ -101,71 +120,27 @@ export class ClientConfigService {
contextWindowTokens: modelConfig?.contextWindowTokens,
maxOutputTokens: modelConfig?.maxOutputTokens,
isDeprecated: modelConfig?.isDeprecated,
- isRecommended: recommendedModelIds.has(registeredModel.modelId),
dataResidency: modelConfig?.dataResidency,
+ intelligenceIndex: benchmark?.intelligenceIndex,
+ outputTokensPerSecond: benchmark?.outputTokensPerSecond,
+ costPerTask: benchmark?.costPerTask,
+ isBenchmarkInherited: isInherited,
+ efforts:
+ isDefined(modelConfig) && !isDefined(modelConfig.effort)
+ ? getAvailableEfforts(modelConfig)
+ : undefined,
+ effort: modelConfig?.effort,
};
},
);
- if (aiModels.length > 0) {
- const defaultSpeedModel =
- this.aiModelRegistryService.getDefaultSpeedModel();
- const defaultSpeedModelConfig =
- this.aiModelRegistryService.getModelConfig(defaultSpeedModel?.modelId);
+ // A tier with no model is left out; the client shows its "configure a
+ // provider" state from the empty list rather than an error.
+ const aiModelTiers = AI_MODEL_TIERS.flatMap((tier) => {
+ const model = this.aiModelRegistryService.findDefaultModelForTier(tier);
- const defaultPerformanceModel =
- this.aiModelRegistryService.getDefaultPerformanceModel();
- const defaultPerformanceModelConfig =
- this.aiModelRegistryService.getModelConfig(
- defaultPerformanceModel?.modelId,
- );
-
- aiModels.unshift(
- {
- modelId: AUTO_SELECT_SMART_MODEL_ID,
- label:
- defaultPerformanceModelConfig?.label ||
- defaultPerformanceModel?.modelId ||
- 'Default',
- modelFamily: defaultPerformanceModelConfig?.modelFamily,
- providerName: defaultPerformanceModel?.providerName,
- providerLabel: getProviderLabel(
- defaultPerformanceModel?.providerName,
- ),
- sdkPackage: defaultPerformanceModel?.sdkPackage ?? null,
- nativeCapabilities: getNativeModelCapabilities(
- defaultPerformanceModel?.sdkPackage,
- ),
- inputCostPerMillionTokens:
- defaultPerformanceModelConfig?.inputCostPerMillionTokens,
- outputCostPerMillionTokens:
- defaultPerformanceModelConfig?.outputCostPerMillionTokens,
- contextWindowTokens:
- defaultPerformanceModelConfig?.contextWindowTokens,
- maxOutputTokens: defaultPerformanceModelConfig?.maxOutputTokens,
- },
- {
- modelId: AUTO_SELECT_FAST_MODEL_ID,
- label:
- defaultSpeedModelConfig?.label ||
- defaultSpeedModel?.modelId ||
- 'Default',
- modelFamily: defaultSpeedModelConfig?.modelFamily,
- providerName: defaultSpeedModel?.providerName,
- providerLabel: getProviderLabel(defaultSpeedModel?.providerName),
- sdkPackage: defaultSpeedModel?.sdkPackage ?? null,
- nativeCapabilities: getNativeModelCapabilities(
- defaultSpeedModel?.sdkPackage,
- ),
- inputCostPerMillionTokens:
- defaultSpeedModelConfig?.inputCostPerMillionTokens,
- outputCostPerMillionTokens:
- defaultSpeedModelConfig?.outputCostPerMillionTokens,
- contextWindowTokens: defaultSpeedModelConfig?.contextWindowTokens,
- maxOutputTokens: defaultSpeedModelConfig?.maxOutputTokens,
- },
- );
- }
+ return isDefined(model) ? [{ tier, modelId: model.modelId }] : [];
+ });
const clientConfig: ClientConfig = {
appVersion: this.twentyConfigService.get('APP_VERSION'),
@@ -191,6 +166,7 @@ export class ClientConfigService {
],
},
aiModels,
+ aiModelTiers,
authProviders: {
google: this.twentyConfigService.get('AUTH_GOOGLE_ENABLED'),
magicLink: false,
diff --git a/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts b/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts
index 03e0be60fe3..c5bd8bb13bb 100644
--- a/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts
+++ b/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts
@@ -63,9 +63,7 @@ import { type OnboardingEnrichmentCreditRewardTier } from 'src/engine/core-modul
import { type AiProvidersConfig } from 'src/engine/metadata-modules/ai/ai-models/types/ai-providers-config.type';
import {
DEFAULT_DISABLED_MODELS,
- DEFAULT_FAST_MODELS,
- DEFAULT_RECOMMENDED_MODELS,
- DEFAULT_SMART_MODELS,
+ DEFAULT_MODELS_BY_TIER,
} from 'src/engine/metadata-modules/ai/ai-models/utils/load-default-model-preferences.util';
export class ConfigVariables {
@@ -1936,29 +1934,47 @@ export class ConfigVariables {
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.LLM,
description:
- 'Ordered list of fast model IDs to use as defaults; an ID may pin an effort level as provider/model@effort. Managed via admin panel or env.',
+ 'Ordered list of model IDs backing the Extra Fast tier; the first available one is used. An ID may pin an effort level as provider/model@effort. Managed via admin panel or env.',
type: ConfigVariableType.ARRAY,
})
@IsOptional()
- AI_MODELS_DEFAULT_FAST: string[] = DEFAULT_FAST_MODELS;
+ AI_MODELS_DEFAULT_EXTRA_FAST: string[] = DEFAULT_MODELS_BY_TIER.extraFast;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.LLM,
description:
- 'Ordered list of smart model IDs to use as defaults; an ID may pin an effort level as provider/model@effort. Managed via admin panel or env.',
+ 'Ordered list of model IDs backing the Fast tier; the first available one is used. An ID may pin an effort level as provider/model@effort. Managed via admin panel or env.',
type: ConfigVariableType.ARRAY,
})
@IsOptional()
- AI_MODELS_DEFAULT_SMART: string[] = DEFAULT_SMART_MODELS;
+ AI_MODELS_DEFAULT_FAST: string[] = DEFAULT_MODELS_BY_TIER.fast;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.LLM,
description:
- 'List of recommended model IDs shown to workspaces using curated model selection; an ID may pin an effort level as provider/model@effort. Managed via admin panel or env.',
+ 'Ordered list of model IDs backing the Balanced tier; the first available one is used. An ID may pin an effort level as provider/model@effort. Managed via admin panel or env.',
type: ConfigVariableType.ARRAY,
})
@IsOptional()
- AI_MODELS_DEFAULT_RECOMMENDED: string[] = DEFAULT_RECOMMENDED_MODELS;
+ AI_MODELS_DEFAULT_BALANCED: string[] = DEFAULT_MODELS_BY_TIER.balanced;
+
+ @ConfigVariablesMetadata({
+ group: ConfigVariablesGroup.LLM,
+ description:
+ 'Ordered list of model IDs backing the Smart tier; the first available one is used. An ID may pin an effort level as provider/model@effort. Managed via admin panel or env.',
+ type: ConfigVariableType.ARRAY,
+ })
+ @IsOptional()
+ AI_MODELS_DEFAULT_SMART: string[] = DEFAULT_MODELS_BY_TIER.smart;
+
+ @ConfigVariablesMetadata({
+ group: ConfigVariablesGroup.LLM,
+ description:
+ 'Ordered list of model IDs backing the Extra Smart tier; the first available one is used. An ID may pin an effort level as provider/model@effort. Managed via admin panel or env.',
+ type: ConfigVariableType.ARRAY,
+ })
+ @IsOptional()
+ AI_MODELS_DEFAULT_EXTRA_SMART: string[] = DEFAULT_MODELS_BY_TIER.extraSmart;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.LLM,
diff --git a/packages/twenty-server/src/engine/core-modules/workspace/dtos/update-workspace-input.ts b/packages/twenty-server/src/engine/core-modules/workspace/dtos/update-workspace-input.ts
index 7af0aaefe6b..b384165b693 100644
--- a/packages/twenty-server/src/engine/core-modules/workspace/dtos/update-workspace-input.ts
+++ b/packages/twenty-server/src/engine/core-modules/workspace/dtos/update-workspace-input.ts
@@ -1,11 +1,15 @@
import { Field, InputType } from '@nestjs/graphql';
+import GraphQLJSON from 'graphql-type-json';
+import { type AiModelTier } from 'twenty-shared/ai';
+
import {
IsArray,
IsBoolean,
IsEnum,
IsInt,
IsOptional,
+ IsObject,
IsString,
IsUUID,
Matches,
@@ -15,6 +19,7 @@ import {
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import { WorkspaceDiscoverability } from 'src/engine/core-modules/workspace/types/workspace-discoverability.type';
+import { AiModelTier as AiModelTierEnum } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-tier.enum';
@InputType()
export class UpdateWorkspaceInput {
@@ -114,15 +119,25 @@ export class UpdateWorkspaceInput {
@IsOptional()
eventLogRetentionDays?: number;
- @Field({ nullable: true })
- @IsString()
+ @Field(() => AiModelTierEnum, { nullable: true })
+ @IsEnum(AiModelTierEnum)
+ @IsOptional()
+ aiChatModelTier?: AiModelTier;
+
+ @Field(() => AiModelTierEnum, { nullable: true })
+ @IsEnum(AiModelTierEnum)
@IsOptional()
- fastModel?: string;
+ aiAgentModelTier?: AiModelTier;
@Field({ nullable: true })
- @IsString()
+ @IsBoolean()
+ @IsOptional()
+ isAutoModelSelectionEnabled?: boolean;
+
+ @Field(() => GraphQLJSON, { nullable: true })
+ @IsObject()
@IsOptional()
- smartModel?: string;
+ aiModelIdByTier?: Partial<Record<AiModelTier, string>>;
@Field({ nullable: true })
@IsString()
@@ -135,17 +150,6 @@ export class UpdateWorkspaceInput {
@IsOptional()
editableProfileFields?: string[];
- @Field(() => [String], { nullable: true })
- @IsArray()
- @IsString({ each: true })
- @IsOptional()
- enabledAiModelIds?: string[];
-
- @Field({ nullable: true })
- @IsBoolean()
- @IsOptional()
- useRecommendedModels?: boolean;
-
@Field({ nullable: true })
@IsBoolean()
@IsOptional()
diff --git a/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.ts b/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.ts
index 5ed7421f358..5942c40dd07 100644
--- a/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.ts
@@ -4,9 +4,16 @@ import { InjectDataSource, InjectRepository } from '@nestjs/typeorm';
import assert from 'assert';
+import { isNonEmptyString } from '@sniptt/guards';
+
import { msg } from '@lingui/core/macro';
+import { isAiModelTier, type AiModelTier } from 'twenty-shared/ai';
import { PermissionFlagType } from 'twenty-shared/constants';
-import { assertIsDefinedOrThrow, isDefined } from 'twenty-shared/utils';
+import {
+ assertIsDefinedOrThrow,
+ isAutoSelectModelId,
+ isDefined,
+} from 'twenty-shared/utils';
import { WorkspaceActivationStatus } from 'twenty-shared/workspace';
import {
DataSource,
@@ -72,7 +79,6 @@ import {
WorkspaceNotFoundDefaultError,
} from 'src/engine/core-modules/workspace/workspace.exception';
import { AiModelRegistryService } from 'src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service';
-import { isModelAllowedByWorkspace } from 'src/engine/metadata-modules/ai/ai-models/utils/is-model-allowed.util';
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
import { ALL_METADATA_ENTITY_BY_METADATA_NAME } from 'src/engine/metadata-modules/flat-entity/constant/all-metadata-entity-by-metadata-name.constant';
import { ALL_METADATA_NAMES_SORTED_ATOMICALLY } from 'src/engine/metadata-modules/flat-entity/constant/all-metadata-names-sorted-atomically.constant';
@@ -130,11 +136,11 @@ export class WorkspaceService {
editableProfileFields: PermissionFlagType.SECURITY,
isTwoFactorAuthenticationEnforced: PermissionFlagType.SECURITY,
defaultRoleId: PermissionFlagType.ROLES,
- fastModel: PermissionFlagType.WORKSPACE,
- smartModel: PermissionFlagType.WORKSPACE,
+ aiChatModelTier: PermissionFlagType.AI_SETTINGS,
+ aiAgentModelTier: PermissionFlagType.AI_SETTINGS,
+ isAutoModelSelectionEnabled: PermissionFlagType.AI_SETTINGS,
+ aiModelIdByTier: PermissionFlagType.AI_SETTINGS,
aiAdditionalInstructions: PermissionFlagType.WORKSPACE,
- enabledAiModelIds: PermissionFlagType.AI_SETTINGS,
- useRecommendedModels: PermissionFlagType.AI_SETTINGS,
isInternalMessagesImportEnabled: PermissionFlagType.WORKSPACE,
};
@@ -180,6 +186,58 @@ export class WorkspaceService {
private readonly applicationUninstallService: ApplicationUninstallService,
) {}
+ // Pins are stored as given, so a stale or mistyped id must be refused here
+ // rather than silently falling back to the tier default at run time. A pin
+ // that is already stored is left alone so the others stay editable.
+ private validateAiModelIdByTier({
+ aiModelIdByTier,
+ storedAiModelIdByTier,
+ }: {
+ aiModelIdByTier: Partial<Record<AiModelTier, string>>;
+ storedAiModelIdByTier: Partial<Record<AiModelTier, string>>;
+ }): void {
+ for (const [tier, modelId] of Object.entries(aiModelIdByTier)) {
+ if (!isAiModelTier(tier)) {
+ throw new WorkspaceException(
+ `Unknown AI model tier "${tier}"`,
+ WorkspaceExceptionCode.AI_MODEL_PIN_NOT_VALID,
+ );
+ }
+
+ if (!isNonEmptyString(modelId)) {
+ throw new WorkspaceException(
+ `Missing model id for tier "${tier}"`,
+ WorkspaceExceptionCode.AI_MODEL_PIN_NOT_VALID,
+ );
+ }
+
+ if (isAutoSelectModelId(modelId)) {
+ throw new WorkspaceException(
+ `Tier "${tier}" must be pinned to a concrete model`,
+ WorkspaceExceptionCode.AI_MODEL_PIN_NOT_VALID,
+ );
+ }
+
+ if (modelId === storedAiModelIdByTier?.[tier]) {
+ continue;
+ }
+
+ if (!this.aiModelRegistryService.isModelAdminAllowed(modelId)) {
+ throw new WorkspaceException(
+ 'Selected model has been disabled by the administrator',
+ WorkspaceExceptionCode.AI_MODEL_PIN_NOT_VALID,
+ );
+ }
+
+ if (!isDefined(this.aiModelRegistryService.getModelConfig(modelId))) {
+ throw new WorkspaceException(
+ `Model "${modelId}" is not in this instance's catalog`,
+ WorkspaceExceptionCode.AI_MODEL_PIN_NOT_VALID,
+ );
+ }
+ }
+ }
+
async updateWorkspaceById({
payload,
userWorkspaceId,
@@ -281,46 +339,11 @@ export class WorkspaceService {
);
}
- const isChangingModels =
- isDefined(payload.smartModel) || isDefined(payload.fastModel);
- const isChangingAvailability =
- payload.useRecommendedModels !== undefined ||
- payload.enabledAiModelIds !== undefined;
-
- if (isChangingModels || isChangingAvailability) {
- const effectiveWorkspace = {
- useRecommendedModels:
- payload.useRecommendedModels ?? workspace.useRecommendedModels,
- enabledAiModelIds:
- payload.enabledAiModelIds ?? workspace.enabledAiModelIds,
- };
-
- const modelsToValidate = [
- payload.smartModel ?? workspace.smartModel,
- payload.fastModel ?? workspace.fastModel,
- ].filter(isDefined);
-
- for (const modelId of modelsToValidate) {
- if (!this.aiModelRegistryService.isModelAdminAllowed(modelId)) {
- throw new WorkspaceException(
- 'Selected model has been disabled by the administrator',
- WorkspaceExceptionCode.ENVIRONMENT_VAR_NOT_ENABLED,
- );
- }
-
- if (
- !isModelAllowedByWorkspace(
- modelId,
- effectiveWorkspace,
- this.aiModelRegistryService.getRecommendedModelIds(),
- )
- ) {
- throw new WorkspaceException(
- 'Selected model is not available in this workspace',
- WorkspaceExceptionCode.ENVIRONMENT_VAR_NOT_ENABLED,
- );
- }
- }
+ if (isDefined(payload.aiModelIdByTier)) {
+ this.validateAiModelIdByTier({
+ aiModelIdByTier: payload.aiModelIdByTier,
+ storedAiModelIdByTier: workspace.aiModelIdByTier,
+ });
}
let updatedWorkspace: WorkspaceEntity;
diff --git a/packages/twenty-server/src/engine/core-modules/workspace/utils/from-workspace-entity-to-flat.util.ts b/packages/twenty-server/src/engine/core-modules/workspace/utils/from-workspace-entity-to-flat.util.ts
index 90e95e289f3..251ba3abdaf 100644
--- a/packages/twenty-server/src/engine/core-modules/workspace/utils/from-workspace-entity-to-flat.util.ts
+++ b/packages/twenty-server/src/engine/core-modules/workspace/utils/from-workspace-entity-to-flat.util.ts
@@ -29,14 +29,13 @@ export const fromWorkspaceEntityToFlat = (
isCustomDomainEnabled: entity.isCustomDomainEnabled,
editableProfileFields: entity.editableProfileFields,
defaultRoleId: entity.defaultRoleId,
- fastModel: entity.fastModel,
- smartModel: entity.smartModel,
+ aiChatModelTier: entity.aiChatModelTier,
+ aiAgentModelTier: entity.aiAgentModelTier,
+ isAutoModelSelectionEnabled: entity.isAutoModelSelectionEnabled,
+ aiModelIdByTier: entity.aiModelIdByTier,
aiAdditionalInstructions: entity.aiAdditionalInstructions,
- enabledAiModelIds: entity.enabledAiModelIds,
- useRecommendedModels: entity.useRecommendedModels,
isInternalMessagesImportEnabled: entity.isInternalMessagesImportEnabled,
workspaceCustomApplicationId: entity.workspaceCustomApplicationId,
- routerModel: entity.routerModel,
createdAt: entity.createdAt.toISOString(),
updatedAt: entity.updatedAt.toISOString(),
deletedAt: entity.deletedAt?.toISOString(),
diff --git a/packages/twenty-server/src/engine/core-modules/workspace/utils/workspace-graphql-api-exception-handler.util.ts b/packages/twenty-server/src/engine/core-modules/workspace/utils/workspace-graphql-api-exception-handler.util.ts
index 730abc5b3b4..976c9242197 100644
--- a/packages/twenty-server/src/engine/core-modules/workspace/utils/workspace-graphql-api-exception-handler.util.ts
+++ b/packages/twenty-server/src/engine/core-modules/workspace/utils/workspace-graphql-api-exception-handler.util.ts
@@ -4,6 +4,7 @@ import {
ConflictError,
ForbiddenError,
NotFoundError,
+ UserInputError,
} from 'src/engine/core-modules/graphql/utils/graphql-errors.util';
import {
WorkspaceException,
@@ -25,6 +26,8 @@ export const workspaceGraphqlApiExceptionHandler = (error: Error) => {
case WorkspaceExceptionCode.ENVIRONMENT_VAR_NOT_ENABLED:
case WorkspaceExceptionCode.WORKSPACE_CUSTOM_DOMAIN_DISABLED:
throw new ForbiddenError(error);
+ case WorkspaceExceptionCode.AI_MODEL_PIN_NOT_VALID:
+ throw new UserInputError(error);
default: {
return assertUnreachable(error.code);
}
diff --git a/packages/twenty-server/src/engine/core-modules/workspace/workspace.entity.ts b/packages/twenty-server/src/engine/core-modules/workspace/workspace.entity.ts
index b5b2d53b69c..84d21736ed1 100644
--- a/packages/twenty-server/src/engine/core-modules/workspace/workspace.entity.ts
+++ b/packages/twenty-server/src/engine/core-modules/workspace/workspace.entity.ts
@@ -1,6 +1,12 @@
import { Field, ObjectType, registerEnumType } from '@nestjs/graphql';
import { type Application } from 'cloudflare/resources/zero-trust/access/applications/applications';
+import GraphQLJSON from 'graphql-type-json';
+import {
+ DEFAULT_AI_AGENT_MODEL_TIER,
+ DEFAULT_AI_CHAT_MODEL_TIER,
+ type AiModelTier,
+} from 'twenty-shared/ai';
import { WorkspaceActivationStatus } from 'twenty-shared/workspace';
import {
Check,
@@ -35,7 +41,7 @@ import { WasIntroducedInUpgrade } from 'src/engine/core-modules/upgrade/decorato
import { UserWorkspaceEntity } from 'src/engine/core-modules/user-workspace/user-workspace.entity';
import { WorkspaceDiscoverability } from 'src/engine/core-modules/workspace/types/workspace-discoverability.type';
import { AgentEntity } from 'src/engine/metadata-modules/ai/ai-agent/entities/agent.entity';
-import { type ModelId } from 'src/engine/metadata-modules/ai/ai-models/types/model-id.type';
+import { AiModelTier as AiModelTierEnum } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-tier.enum';
import { RoleDTO } from 'src/engine/metadata-modules/role/dtos/role.dto';
import { ViewFieldDTO } from 'src/engine/metadata-modules/view-field/dtos/view-field.dto';
import { ViewFieldEntity } from 'src/engine/metadata-modules/view-field/entities/view-field.entity';
@@ -50,11 +56,6 @@ import { ViewSortEntity } from 'src/engine/metadata-modules/view-sort/entities/v
import { ViewDTO } from 'src/engine/metadata-modules/view/dtos/view.dto';
import { ViewEntity } from 'src/engine/metadata-modules/view/entities/view.entity';
import { WebhookEntity } from 'src/engine/metadata-modules/webhook/entities/webhook.entity';
-import {
- AUTO_SELECT_FAST_MODEL_ID,
- AUTO_SELECT_SMART_MODEL_ID,
-} from 'twenty-shared/constants';
-
registerEnumType(WorkspaceActivationStatus, {
name: 'WorkspaceActivationStatus',
});
@@ -315,49 +316,39 @@ export class WorkspaceEntity {
@Field(() => RoleDTO, { nullable: true })
defaultRole: RoleDTO | null;
- @Field(() => String, { nullable: false })
+ @Field(() => AiModelTierEnum, { nullable: false })
@Column({
type: 'varchar',
nullable: false,
- default: AUTO_SELECT_FAST_MODEL_ID,
+ default: DEFAULT_AI_CHAT_MODEL_TIER,
})
- fastModel: ModelId;
+ aiChatModelTier: AiModelTier;
- @Field(() => String, { nullable: false })
+ @Field(() => AiModelTierEnum, { nullable: false })
@Column({
type: 'varchar',
nullable: false,
- default: AUTO_SELECT_SMART_MODEL_ID,
+ default: DEFAULT_AI_AGENT_MODEL_TIER,
})
- smartModel: ModelId;
+ aiAgentModelTier: AiModelTier;
+
+ @Field(() => Boolean, { nullable: false })
+ @Column({ type: 'boolean', nullable: false, default: true })
+ isAutoModelSelectionEnabled: boolean;
+
+ // Only read while isAutoModelSelectionEnabled is false; kept when the toggle
+ // goes back on so switching off again restores the previous pins.
+ @Field(() => GraphQLJSON, { nullable: false })
+ @Column({ type: 'jsonb', nullable: false, default: {} })
+ aiModelIdByTier: Partial<Record<AiModelTier, string>>;
@Field(() => String, { nullable: true })
@Column({ type: 'text', nullable: true })
aiAdditionalInstructions: string | null;
- @Field(() => [String], { nullable: true })
- @Column({
- type: 'varchar',
- array: true,
- nullable: false,
- default: '{}',
- })
- enabledAiModelIds: string[];
-
- @Field(() => Boolean, { nullable: false })
- @Column({ type: 'boolean', nullable: false, default: true })
- useRecommendedModels: boolean;
-
@Column({ nullable: false, type: 'uuid' })
workspaceCustomApplicationId: string;
- // TODO: delete
- // This is deprecated
- // If we are in December 2025 you can remove this column from DB
- @Field(() => String, { nullable: false })
- @Column({ type: 'varchar', nullable: false, default: 'auto' })
- routerModel: ModelId;
-
@Field(() => ApplicationDTO, { nullable: true })
@ManyToOne(() => ApplicationEntity, {
onDelete: 'RESTRICT',
diff --git a/packages/twenty-server/src/engine/core-modules/workspace/workspace.exception.ts b/packages/twenty-server/src/engine/core-modules/workspace/workspace.exception.ts
index cc96d4b1726..44e61438e14 100644
--- a/packages/twenty-server/src/engine/core-modules/workspace/workspace.exception.ts
+++ b/packages/twenty-server/src/engine/core-modules/workspace/workspace.exception.ts
@@ -14,6 +14,7 @@ export enum WorkspaceExceptionCode {
ENVIRONMENT_VAR_NOT_ENABLED = 'ENVIRONMENT_VAR_NOT_ENABLED',
CUSTOM_DOMAIN_NOT_FOUND = 'CUSTOM_DOMAIN_NOT_FOUND',
APPLICATION_UNINSTALL_IN_PROGRESS = 'APPLICATION_UNINSTALL_IN_PROGRESS',
+ AI_MODEL_PIN_NOT_VALID = 'AI_MODEL_PIN_NOT_VALID',
}
const getWorkspaceExceptionUserFriendlyMessage = (
@@ -38,6 +39,8 @@ const getWorkspaceExceptionUserFriendlyMessage = (
return msg`Custom domain not found.`;
case WorkspaceExceptionCode.APPLICATION_UNINSTALL_IN_PROGRESS:
return msg`Application cleanup is still in progress. Please try again.`;
+ case WorkspaceExceptionCode.AI_MODEL_PIN_NOT_VALID:
+ return msg`This model cannot be used for this tier.`;
default:
assertUnreachable(code);
}
diff --git a/packages/twenty-server/src/engine/core-modules/workspace/workspace.resolver.ts b/packages/twenty-server/src/engine/core-modules/workspace/workspace.resolver.ts
index 872a4287b6d..b5a8d190436 100644
--- a/packages/twenty-server/src/engine/core-modules/workspace/workspace.resolver.ts
+++ b/packages/twenty-server/src/engine/core-modules/workspace/workspace.resolver.ts
@@ -147,13 +147,6 @@ export class WorkspaceResolver {
}
}
- @ResolveField(() => String, { nullable: true })
- async routerModel(
- @Parent() _workspace: WorkspaceEntity,
- ): Promise<string | null> {
- return 'auto';
- }
-
@ResolveField(() => [FeatureFlagDTO], { nullable: true })
async featureFlags(
@Parent() workspace: WorkspaceEntity,
@@ -212,34 +205,6 @@ export class WorkspaceResolver {
: null;
}
- @ResolveField(() => String, { nullable: true })
- async fastModel(
- @Parent() workspace: WorkspaceEntity,
- ): Promise<string | null> {
- return workspace.fastModel;
- }
-
- @ResolveField(() => String, { nullable: true })
- async smartModel(
- @Parent() workspace: WorkspaceEntity,
- ): Promise<string | null> {
- return workspace.smartModel;
- }
-
- @ResolveField(() => [String], { nullable: true })
- async enabledAiModelIds(
- @Parent() workspace: WorkspaceEntity,
- ): Promise<string[]> {
- return workspace.enabledAiModelIds;
- }
-
- @ResolveField(() => Boolean, { nullable: false })
- async useRecommendedModels(
- @Parent() workspace: WorkspaceEntity,
- ): Promise<boolean> {
- return workspace.useRecommendedModels;
- }
-
@ResolveField(() => ApplicationDTO, { nullable: true })
async workspaceCustomApplication(
@Parent() workspace: WorkspaceEntity,
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent-execution/services/agent-async-executor.service.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent-execution/services/agent-async-executor.service.ts
index acee738bf6d..e49a1b6b753 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent-execution/services/agent-async-executor.service.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent-execution/services/agent-async-executor.service.ts
@@ -12,7 +12,7 @@ import {
type ToolSet,
} from 'ai';
import { type RunAgentMessage } from 'twenty-shared/application';
-import { AUTO_SELECT_SMART_MODEL_ID } from 'twenty-shared/constants';
+import { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from 'twenty-shared/ai';
import { type ActorMetadata } from 'twenty-shared/types';
import {
isDefined,
@@ -290,23 +290,24 @@ export class AgentAsyncExecutorService {
let cacheCreationTokens = 0;
let nativeWebSearchCallCount = 0;
let executionSteps: StepResult<ToolSet>[] = [];
+ let resolvedModelId: string | undefined;
try {
- if (agent) {
- const workspace = await this.workspaceRepository.findOneBy({
- id: agent.workspaceId,
- });
+ const workspace = await this.workspaceRepository.findOneBy({
+ id: workspaceId,
+ });
- if (workspace) {
- this.aiModelRegistryService.validateModelAvailability(
- agent.modelId,
- workspace,
- );
- }
+ if (isDefined(agent)) {
+ this.aiModelRegistryService.validateModelAvailability(agent.modelId);
}
const registeredModel =
- await this.aiModelRegistryService.resolveModelForAgent(agent);
+ await this.aiModelRegistryService.resolveModelForAgent(
+ agent,
+ workspace ?? undefined,
+ );
+
+ resolvedModelId = registeredModel.modelId;
let tools: ToolSet = {};
let toolCatalogSection = '';
@@ -547,9 +548,8 @@ export class AgentAsyncExecutorService {
result = structuredResult.output as object;
}
- const resolvedModelId = registeredModel.modelId;
const tokenCostInDollars = this.aiBillingService.calculateCost(
- resolvedModelId,
+ registeredModel.modelId,
{ usage: accumulatedUsage, cacheCreationTokens },
);
const totalCostInDollars =
@@ -577,11 +577,18 @@ export class AgentAsyncExecutorService {
AiExceptionCode.AGENT_EXECUTION_FAILED,
);
} finally {
- const modelId = agent?.modelId ?? AUTO_SELECT_SMART_MODEL_ID;
- const costInDollars = this.aiBillingService.calculateCost(modelId, {
- usage: accumulatedUsage,
- cacheCreationTokens,
- });
+ const modelId =
+ resolvedModelId ??
+ agent?.modelId ??
+ AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID;
+ // Nothing was generated when execution failed before a model resolved,
+ // and pricing an unresolved id would throw over the original error.
+ const costInDollars = isDefined(resolvedModelId)
+ ? this.aiBillingService.calculateCost(resolvedModelId, {
+ usage: accumulatedUsage,
+ cacheCreationTokens,
+ })
+ : 0;
const creditsUsedMicro = convertDollarsToCreditsMicro(costInDollars);
const totalTokens =
(accumulatedUsage.inputTokens ?? 0) +
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent-monitor/services/agent-turn-grader.service.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent-monitor/services/agent-turn-grader.service.ts
index 33c75fc2c81..eb3b566feb6 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent-monitor/services/agent-turn-grader.service.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent-monitor/services/agent-turn-grader.service.ts
@@ -9,6 +9,7 @@ import { AgentTurnEntity } from 'src/engine/metadata-modules/ai/ai-agent-executi
import { AgentTurnEvaluationEntity } from 'src/engine/metadata-modules/ai/ai-agent-monitor/entities/agent-turn-evaluation.entity';
import { buildAiTelemetry } from 'src/engine/metadata-modules/ai/ai-models/utils/build-ai-telemetry.util';
import { AiModelRegistryService } from 'src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service';
+import { buildReasoningProviderOptions } from 'src/engine/metadata-modules/ai/ai-models/utils/build-reasoning-provider-options.util';
import { InjectWorkspaceScopedRepository } from 'src/engine/twenty-orm/workspace-scoped-repository/inject-workspace-scoped-repository.decorator';
import { WorkspaceScopedRepository } from 'src/engine/twenty-orm/workspace-scoped-repository/workspace-scoped-repository';
@Injectable()
@@ -54,7 +55,8 @@ export class AgentTurnGraderService {
turn: AgentTurnEntity & { messages: AgentMessageEntity[] },
): Promise<{ score: number; comment: string }> {
try {
- const defaultModel = this.aiModelRegistryService.getDefaultSpeedModel();
+ const defaultModel =
+ this.aiModelRegistryService.getDefaultModelForTier('fast');
if (!defaultModel) {
this.logger.warn('No default AI model available for evaluation');
@@ -83,6 +85,7 @@ Respond ONLY with valid JSON in this exact format:
const result = await generateText({
model: defaultModel.model,
+ providerOptions: buildReasoningProviderOptions(defaultModel),
prompt,
temperature: 0.3,
...buildAiTelemetry({
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/agent.resolver.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/agent.resolver.ts
index 08e46fb2dac..3bd05ad0adf 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/agent.resolver.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/agent.resolver.ts
@@ -63,10 +63,7 @@ export class AgentResolver {
@AuthWorkspace() workspace: WorkspaceEntity,
): Promise<AgentDTO> {
if (isNonEmptyString(input.modelId)) {
- this.aiModelRegistryService.validateModelAvailability(
- input.modelId,
- workspace,
- );
+ this.aiModelRegistryService.validateModelAvailability(input.modelId);
}
const createdAgent = await this.agentService.createOneAgent(
@@ -84,10 +81,7 @@ export class AgentResolver {
@AuthWorkspace() workspace: WorkspaceEntity,
): Promise<AgentDTO> {
if (isNonEmptyString(input.modelId)) {
- this.aiModelRegistryService.validateModelAvailability(
- input.modelId,
- workspace,
- );
+ this.aiModelRegistryService.validateModelAvailability(input.modelId);
}
const updatedAgent = await this.agentService.updateOneAgent({
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/entities/agent.entity.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/entities/agent.entity.ts
index 40fd8e01b50..6aa64413c06 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/entities/agent.entity.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/entities/agent.entity.ts
@@ -10,7 +10,7 @@ import {
import { AgentResponseFormat } from 'src/engine/metadata-modules/ai/ai-agent/types/agent-response-format.type';
import { ModelConfiguration } from 'src/engine/metadata-modules/ai/ai-agent/types/modelConfiguration';
-import { AUTO_SELECT_SMART_MODEL_ID } from 'twenty-shared/constants';
+import { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from 'twenty-shared/ai';
import { type ModelId } from 'src/engine/metadata-modules/ai/ai-models/types/model-id.type';
import { SyncableEntity } from 'src/engine/workspace-manager/types/syncable-entity.interface';
import { JsonbProperty } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/jsonb-property.type';
@@ -46,7 +46,7 @@ export class AgentEntity
@Column({
nullable: false,
type: 'varchar',
- default: AUTO_SELECT_SMART_MODEL_ID,
+ default: AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,
})
modelId: ModelId;
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/jobs/__tests__/stream-agent-chat.job.spec.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/jobs/__tests__/stream-agent-chat.job.spec.ts
index 138fe150d8a..a3c424819e1 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/jobs/__tests__/stream-agent-chat.job.spec.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/jobs/__tests__/stream-agent-chat.job.spec.ts
@@ -133,7 +133,10 @@ const createFakeChatStream = ({
describe('StreamAgentChatJob', () => {
const workspace = {
id: 'workspace-id',
- smartModel: 'default-smart-model',
+ aiChatModelTier: 'smart',
+ aiAgentModelTier: 'smart',
+ isAutoModelSelectionEnabled: true,
+ aiModelIdByTier: {},
} as WorkspaceEntity;
const jobData: StreamAgentChatJobData = {
@@ -637,6 +640,7 @@ describe('StreamAgentChatJob', () => {
expect(aiModelRegistryService.getEffectiveModelConfig).toHaveBeenCalledWith(
'default-fast-model',
+ workspace,
);
expect(turnCounts('ai-chat/turn-started')).toEqual([
expect.objectContaining({
@@ -645,13 +649,14 @@ describe('StreamAgentChatJob', () => {
]);
});
- it('falls back to the workspace default model when the turn did not pick one', async () => {
+ it('falls back to the workspace chat tier when the turn did not pick one', async () => {
const { job, aiModelRegistryService } = buildJob();
await job.handle(jobData);
expect(aiModelRegistryService.getEffectiveModelConfig).toHaveBeenCalledWith(
'default-smart-model',
+ workspace,
);
});
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/jobs/stream-agent-chat.job.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/jobs/stream-agent-chat.job.ts
index 1d3ecefc73b..a284d36d1fe 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/jobs/stream-agent-chat.job.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/jobs/stream-agent-chat.job.ts
@@ -7,10 +7,10 @@ import {
readUIMessageStream,
toUIMessageStream,
} from 'ai';
-import type {
- CodeExecutionData,
- ExtendedUIMessage,
- ExtendedUIMessagePart,
+import {
+ type CodeExecutionData,
+ type ExtendedUIMessage,
+ type ExtendedUIMessagePart,
} from 'twenty-shared/ai';
import { assertUnreachable, isDefined } from 'twenty-shared/utils';
import { Repository } from 'typeorm';
@@ -57,6 +57,7 @@ import { WorkspaceScopedRepository } from 'src/engine/twenty-orm/workspace-scope
import { STREAM_AGENT_CHAT_JOB_NAME } from './stream-agent-chat-job-name.constant';
import { type StreamAgentChatJobData } from './stream-agent-chat-job.types';
+import { getChatModelId } from 'src/engine/metadata-modules/ai/ai-models/utils/get-chat-model-id.util';
export { STREAM_AGENT_CHAT_JOB_NAME, type StreamAgentChatJobData };
@@ -255,15 +256,19 @@ export class StreamAgentChatJob {
requestedModelId: string | undefined,
workspace: WorkspaceEntity | null,
): string {
- const modelId = requestedModelId ?? workspace?.smartModel;
+ const modelId = isDefined(workspace)
+ ? getChatModelId({ requestedModelId, workspace })
+ : requestedModelId;
if (!isNonEmptyString(modelId)) {
return 'unknown';
}
try {
- return this.aiModelRegistryService.getEffectiveModelConfig(modelId)
- .modelId;
+ return this.aiModelRegistryService.getEffectiveModelConfig(
+ modelId,
+ workspace ?? undefined,
+ ).modelId;
} catch {
return modelId;
}
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat.resolver.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat.resolver.ts
index a45daca3543..dd8b2714200 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat.resolver.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/resolvers/agent-chat.resolver.ts
@@ -48,6 +48,7 @@ import { UsageLimitGraphqlApiExceptionFilter } from 'src/engine/core-modules/usa
import { AiGraphqlApiExceptionInterceptor } from 'src/engine/metadata-modules/ai/interceptors/ai-graphql-api-exception.interceptor';
import { InjectWorkspaceScopedRepository } from 'src/engine/twenty-orm/workspace-scoped-repository/inject-workspace-scoped-repository.decorator';
import { WorkspaceScopedRepository } from 'src/engine/twenty-orm/workspace-scoped-repository/workspace-scoped-repository';
+import { getChatModelId } from 'src/engine/metadata-modules/ai/ai-models/utils/get-chat-model-id.util';
@UseGuards(WorkspaceAuthGuard, SettingsPermissionGuard(PermissionFlagType.AI))
@UseInterceptors(AiGraphqlApiExceptionInterceptor)
@@ -179,12 +180,12 @@ export class AgentChatResolver {
);
}
- const resolvedModelId = modelId ?? workspace.smartModel;
-
- this.aiModelRegistryService.validateModelAvailability(
- resolvedModelId,
+ const resolvedModelId = getChatModelId({
+ requestedModelId: modelId,
workspace,
- );
+ });
+
+ this.aiModelRegistryService.validateModelAvailability(resolvedModelId);
await this.aiBillingService.assertAiExecutionAllowed({
workspaceId: workspace.id,
@@ -297,8 +298,7 @@ export class AgentChatResolver {
}
this.aiModelRegistryService.validateModelAvailability(
- modelId ?? workspace.smartModel,
- workspace,
+ getChatModelId({ requestedModelId: modelId, workspace }),
);
await this.aiBillingService.assertAiExecutionAllowed({
@@ -351,12 +351,12 @@ export class AgentChatResolver {
);
}
- const resolvedModelId = modelId ?? workspace.smartModel;
-
- this.aiModelRegistryService.validateModelAvailability(
- resolvedModelId,
+ const resolvedModelId = getChatModelId({
+ requestedModelId: modelId,
workspace,
- );
+ });
+
+ this.aiModelRegistryService.validateModelAvailability(resolvedModelId);
await this.aiBillingService.assertAiExecutionAllowed({
workspaceId: workspace.id,
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-title-generation.service.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-title-generation.service.ts
index d306f13a6f7..b53be0f2018 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-title-generation.service.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-title-generation.service.ts
@@ -12,6 +12,7 @@ import { AiBillingService } from 'src/engine/metadata-modules/ai/ai-billing/serv
import { extractCacheCreationTokensFromSteps } from 'src/engine/metadata-modules/ai/ai-billing/utils/extract-cache-creation-tokens.util';
import { buildAiTelemetry } from 'src/engine/metadata-modules/ai/ai-models/utils/build-ai-telemetry.util';
import { AiModelRegistryService } from 'src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service';
+import { buildReasoningProviderOptions } from 'src/engine/metadata-modules/ai/ai-models/utils/build-reasoning-provider-options.util';
@Injectable()
export class AgentTitleGenerationService {
@@ -33,7 +34,8 @@ export class AgentTitleGenerationService {
spenders: { userWorkspaceId },
});
- const defaultModel = this.aiModelRegistryService.getDefaultSpeedModel();
+ const defaultModel =
+ this.aiModelRegistryService.getDefaultModelForTier('fast');
if (!defaultModel) {
this.logger.warn('No default AI model available for title generation');
@@ -47,6 +49,7 @@ export class AgentTitleGenerationService {
try {
const result = await generateText({
model: defaultModel.model,
+ providerOptions: buildReasoningProviderOptions(defaultModel),
prompt: `Generate a concise, descriptive title (maximum 60 characters) for a chat thread based on the following message. The title should capture the main topic or purpose of the conversation. Return only the title, nothing else. Message: "${messageContent}"`,
...buildAiTelemetry({
functionId: 'agent-title-generation',
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/chat-execution.service.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/chat-execution.service.ts
index 10d1d8a552a..639bd87adba 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/chat-execution.service.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/chat-execution.service.ts
@@ -93,6 +93,7 @@ import {
AiExceptionCode,
} from 'src/engine/metadata-modules/ai/ai.exception';
import { SkillService } from 'src/engine/metadata-modules/skill/skill.service';
+import { getChatModelId } from 'src/engine/metadata-modules/ai/ai-models/utils/get-chat-model-id.util';
export type ChatExecutionOptions = {
workspace: WorkspaceEntity;
@@ -187,17 +188,18 @@ export class ChatExecutionService {
{ compactOutput: true, spillLargeOutput: true },
);
- const resolvedModelId = modelId ?? workspace.smartModel;
-
- this.aiModelRegistryService.validateModelAvailability(
- resolvedModelId,
+ const resolvedModelId = getChatModelId({
+ requestedModelId: modelId,
workspace,
- );
+ });
+
+ this.aiModelRegistryService.validateModelAvailability(resolvedModelId);
const registeredModel =
- await this.aiModelRegistryService.resolveModelForAgent({
- modelId: resolvedModelId,
- });
+ await this.aiModelRegistryService.resolveModelForAgent(
+ { modelId: resolvedModelId },
+ workspace,
+ );
const modelConfig = this.aiModelRegistryService.getEffectiveModelConfig(
registeredModel.modelId,
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/workspace-setup-chat.service.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/workspace-setup-chat.service.ts
index f6e245e389a..855b47413d6 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/workspace-setup-chat.service.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/workspace-setup-chat.service.ts
@@ -25,6 +25,7 @@ import { tagAiChatStreamScope } from 'src/engine/metadata-modules/ai/ai-chat/uti
import { AiModelRegistryService } from 'src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service';
import { WorkspaceOrmManager } from 'src/engine/twenty-orm/workspace-orm.manager';
import { buildSystemAuthContext } from 'src/engine/twenty-orm/utils/build-system-auth-context.util';
+import { AUTO_SELECT_MODEL_ID_BY_TIER } from 'twenty-shared/ai';
const WORKSPACE_SETUP_CHAT_THREAD_TITLE = msg`Workspace setup`;
@@ -174,7 +175,7 @@ export class WorkspaceSetupChatService {
},
locale,
}),
- modelId: workspace.fastModel,
+ modelId: AUTO_SELECT_MODEL_ID_BY_TIER.fast,
});
if (!isDefined(kickoffResult)) {
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-generate-text/controllers/ai-generate-text.controller.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-generate-text/controllers/ai-generate-text.controller.ts
index 3f644d72fb6..adf45c6436a 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-generate-text/controllers/ai-generate-text.controller.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-generate-text/controllers/ai-generate-text.controller.ts
@@ -22,9 +22,11 @@ import { AiRestApiExceptionFilter } from 'src/engine/metadata-modules/ai/filters
import { BillingRestApiExceptionFilter } from 'src/engine/core-modules/billing/filters/billing-api-exception.filter';
import { GenerateTextInput } from 'src/engine/metadata-modules/ai/ai-generate-text/dtos/generate-text.input';
import { AiModelRegistryService } from 'src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service';
+import { buildReasoningProviderOptions } from 'src/engine/metadata-modules/ai/ai-models/utils/build-reasoning-provider-options.util';
import { buildAiTelemetry } from 'src/engine/metadata-modules/ai/ai-models/utils/build-ai-telemetry.util';
import { withDedicatedAiTrace } from 'src/engine/metadata-modules/ai/ai-models/utils/with-dedicated-ai-trace.util';
import { PermissionsRestApiExceptionFilter } from 'src/engine/metadata-modules/permissions/utils/permissions-rest-api-exception.filter';
+import { AUTO_SELECT_MODEL_ID_BY_TIER } from 'twenty-shared/ai';
@Controller(`${ApiPath.Rest}/ai`)
@UseGuards(JwtAuthGuard, WorkspaceAuthGuard)
@@ -61,17 +63,15 @@ export class AiGenerateTextController {
spenders: { userWorkspaceId },
});
- const resolvedModelId = body.modelId ?? workspace.fastModel;
+ const resolvedModelId = body.modelId ?? AUTO_SELECT_MODEL_ID_BY_TIER.fast;
- this.aiModelRegistryService.validateModelAvailability(
- resolvedModelId,
- workspace,
- );
+ this.aiModelRegistryService.validateModelAvailability(resolvedModelId);
const registeredModel =
- await this.aiModelRegistryService.resolveModelForAgent({
- modelId: resolvedModelId,
- });
+ await this.aiModelRegistryService.resolveModelForAgent(
+ { modelId: resolvedModelId },
+ workspace,
+ );
let result: Awaited<ReturnType<typeof generateText>> | undefined;
@@ -79,6 +79,7 @@ export class AiGenerateTextController {
result = await withDedicatedAiTrace(() =>
generateText({
model: registeredModel.model,
+ providerOptions: buildReasoningProviderOptions(registeredModel),
instructions: body.systemPrompt,
prompt: body.userPrompt,
...buildAiTelemetry({
@@ -99,7 +100,7 @@ export class AiGenerateTextController {
} finally {
if (result) {
void this.aiBillingService.calculateAndBillUsage(
- resolvedModelId,
+ registeredModel.modelId,
{
usage: result.usage,
cacheCreationTokens:
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/constants/ai-models-default-config-key-by-tier.const.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/constants/ai-models-default-config-key-by-tier.const.ts
new file mode 100644
index 00000000000..f8a1e4d977a
--- /dev/null
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/constants/ai-models-default-config-key-by-tier.const.ts
@@ -0,0 +1,9 @@
+import { type AiModelTier } from 'twenty-shared/ai';
+
+export const AI_MODELS_DEFAULT_CONFIG_KEY_BY_TIER = {
+ extraFast: 'AI_MODELS_DEFAULT_EXTRA_FAST',
+ fast: 'AI_MODELS_DEFAULT_FAST',
+ balanced: 'AI_MODELS_DEFAULT_BALANCED',
+ smart: 'AI_MODELS_DEFAULT_SMART',
+ extraSmart: 'AI_MODELS_DEFAULT_EXTRA_SMART',
+} as const satisfies Record<AiModelTier, string>;
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/services/ai-model-preferences.service.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/services/ai-model-preferences.service.ts
index bcb4aa44bbb..1ac5ef5923f 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/services/ai-model-preferences.service.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/services/ai-model-preferences.service.ts
@@ -1,119 +1,53 @@
import { Injectable } from '@nestjs/common';
+import { type AiModelTier } from 'twenty-shared/ai';
+
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
-import { type AiModelPreferences } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-preferences.type';
-import { AiModelRole } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-role.enum';
+import { AI_MODELS_DEFAULT_CONFIG_KEY_BY_TIER } from 'src/engine/metadata-modules/ai/ai-models/constants/ai-models-default-config-key-by-tier.const';
@Injectable()
export class AiModelPreferencesService {
constructor(private readonly twentyConfigService: TwentyConfigService) {}
- getPreferences(): AiModelPreferences {
- return {
- defaultFastModels: this.twentyConfigService.get('AI_MODELS_DEFAULT_FAST'),
- defaultSmartModels: this.twentyConfigService.get(
- 'AI_MODELS_DEFAULT_SMART',
- ),
- recommendedModels: this.twentyConfigService.get(
- 'AI_MODELS_DEFAULT_RECOMMENDED',
- ),
- disabledModels: this.twentyConfigService.get(
- 'AI_MODELS_DEFAULT_DISABLED',
- ),
- };
+ getDisabledModelIds(): string[] {
+ return this.twentyConfigService.get('AI_MODELS_DEFAULT_DISABLED');
}
- getRecommendedModelIds(): Set<string> {
- return new Set(this.getPreferences().recommendedModels ?? []);
+ getDefaultModelIdsForTier(tier: AiModelTier): string[] {
+ return this.twentyConfigService.get(
+ AI_MODELS_DEFAULT_CONFIG_KEY_BY_TIER[tier],
+ );
}
async setModelAdminEnabled(modelId: string, enabled: boolean): Promise<void> {
- await this.togglePreferenceList(modelId, 'disabledModels', !enabled);
- }
-
- async setModelRecommended(
- modelId: string,
- recommended: boolean,
- ): Promise<void> {
- await this.togglePreferenceList(modelId, 'recommendedModels', recommended);
+ await this.setModelsAdminEnabled([modelId], enabled);
}
async setModelsAdminEnabled(
modelIds: string[],
enabled: boolean,
): Promise<void> {
- await this.togglePreferenceListBulk(modelIds, 'disabledModels', !enabled);
- }
-
- async setModelsRecommended(
- modelIds: string[],
- recommended: boolean,
- ): Promise<void> {
- await this.togglePreferenceListBulk(
- modelIds,
- 'recommendedModels',
- recommended,
- );
- }
-
- async setDefaultModel(role: AiModelRole, modelId: string): Promise<void> {
- const prefs = { ...this.getPreferences() };
- const key =
- role === AiModelRole.FAST ? 'defaultFastModels' : 'defaultSmartModels';
-
- const current = prefs[key] ?? [];
-
- prefs[key] = [modelId, ...current.filter((id) => id !== modelId)];
-
- await this.persistPreferences(prefs);
- }
-
- private async togglePreferenceList(
- modelId: string,
- key: 'disabledModels' | 'recommendedModels',
- add: boolean,
- ): Promise<void> {
- await this.togglePreferenceListBulk([modelId], key, add);
- }
-
- private async togglePreferenceListBulk(
- modelIds: string[],
- key: 'disabledModels' | 'recommendedModels',
- add: boolean,
- ): Promise<void> {
- const prefs = { ...this.getPreferences() };
- const current = prefs[key] ?? [];
+ const current = this.getDisabledModelIds();
const idSet = new Set(modelIds);
- if (add) {
- const existing = new Set(current);
-
- prefs[key] = [...current, ...modelIds.filter((id) => !existing.has(id))];
- } else {
- prefs[key] = current.filter((id) => !idSet.has(id));
- }
+ const disabledModels = enabled
+ ? current.filter((id) => !idSet.has(id))
+ : [...current, ...modelIds.filter((id) => !current.includes(id))];
- await this.persistPreferences(prefs);
+ await this.twentyConfigService.set(
+ 'AI_MODELS_DEFAULT_DISABLED',
+ disabledModels,
+ );
}
- private async persistPreferences(prefs: AiModelPreferences): Promise<void> {
- await Promise.all([
- this.twentyConfigService.set(
- 'AI_MODELS_DEFAULT_FAST',
- prefs.defaultFastModels ?? [],
- ),
- this.twentyConfigService.set(
- 'AI_MODELS_DEFAULT_SMART',
- prefs.defaultSmartModels ?? [],
- ),
- this.twentyConfigService.set(
- 'AI_MODELS_DEFAULT_RECOMMENDED',
- prefs.recommendedModels ?? [],
- ),
- this.twentyConfigService.set(
- 'AI_MODELS_DEFAULT_DISABLED',
- prefs.disabledModels ?? [],
- ),
- ]);
+ // The chosen model moves to the front of the chain; the rest of the chain is
+ // kept so an instance losing that provider's key still resolves the tier.
+ async setDefaultModel(tier: AiModelTier, modelId: string): Promise<void> {
+ const current = this.getDefaultModelIdsForTier(tier);
+
+ await this.twentyConfigService.set(
+ AI_MODELS_DEFAULT_CONFIG_KEY_BY_TIER[tier],
+ [modelId, ...current.filter((id) => id !== modelId)],
+ );
}
}
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service.ts
index 4ad9d74b6f1..d68c42ae171 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service.ts
@@ -2,14 +2,22 @@ import { Injectable, Logger } from '@nestjs/common';
import { type LanguageModel, type TranscriptionModel } from 'ai';
import { isNonEmptyString } from '@sniptt/guards';
-import { type AiModelEffort, type AiSdkPackage } from 'twenty-shared/ai';
+import {
+ AI_MODEL_TIERS,
+ AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,
+ DEFAULT_AI_AGENT_MODEL_TIER,
+ getAiModelTierFromModelId,
+ type AiModelEffort,
+ type AiModelTier,
+ type AiSdkPackage,
+ AI_MODEL_EFFORT_LABELS,
+ parseAiModelVariantId,
+} from 'twenty-shared/ai';
import { MAX_SEATS_WITHOUT_ENTERPRISE_KEY } from 'src/engine/core-modules/enterprise/constants/max-seats-without-enterprise-key.constant';
import { CustomAiProviderAccessService } from 'src/engine/core-modules/enterprise/services/custom-ai-provider-access.service';
import { ConfigVariablesGroup } from 'src/engine/core-modules/twenty-config/enums/config-variables-group.enum';
import { ConfigGroupHashService } from 'src/engine/core-modules/twenty-config/services/config-group-hash.service';
-import { AiModelRole } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-role.enum';
-
import {
AiException,
AiExceptionCode,
@@ -26,10 +34,6 @@ import { type AiProviderConfig } from 'src/engine/metadata-modules/ai/ai-models/
import { type AiProviderModelConfig } from 'src/engine/metadata-modules/ai/ai-models/types/ai-provider-model-config.type';
import { type AiProvidersConfig } from 'src/engine/metadata-modules/ai/ai-models/types/ai-providers-config.type';
import { DEFAULT_CONTEXT_WINDOW_TOKENS } from 'src/engine/metadata-modules/ai/ai-models/types/default-context-window-tokens.const';
-import {
- AUTO_SELECT_FAST_MODEL_ID,
- AUTO_SELECT_SMART_MODEL_ID,
-} from 'twenty-shared/constants';
import { isAutoSelectModelId, isDefined } from 'twenty-shared/utils';
import { DEFAULT_MAX_OUTPUT_TOKENS } from 'src/engine/metadata-modules/ai/ai-models/types/default-max-output-tokens.const';
@@ -38,12 +42,7 @@ import { getAvailableEfforts } from 'src/engine/metadata-modules/ai/ai-models/ut
import { getPositiveTokenLimitOrDefault } from 'src/engine/metadata-modules/ai/ai-models/utils/get-positive-token-limit-or-default.util';
import { inferModelFamily } from 'src/engine/metadata-modules/ai/ai-models/utils/infer-model-family.util';
import { isProviderConfigured } from 'src/engine/metadata-modules/ai/ai-models/utils/is-provider-configured.util';
-import { parseModelVariantId } from 'src/engine/metadata-modules/ai/ai-models/utils/parse-model-variant-id.util';
-import {
- isModelAllowedByWorkspace,
- type WorkspaceModelAvailabilitySettings,
-} from 'src/engine/metadata-modules/ai/ai-models/utils/is-model-allowed.util';
-import { workspaceHasEnabledModels } from 'src/engine/metadata-modules/ai/ai-models/utils/workspace-has-enabled-models.util';
+import { type WorkspaceAiModelSettings } from 'src/engine/metadata-modules/ai/ai-models/types/workspace-ai-model-settings.type';
export interface RegisteredAiModel {
modelId: string;
@@ -187,50 +186,51 @@ export class AiModelRegistryService {
}
}
- // A variant exists only where an operator listed one, so no caller reaches an
- // effort the catalog never declared by typing an id.
private registerConfiguredVariants(): void {
- const preferences = this.preferencesService.getPreferences();
- const listedModelIds = new Set([
- ...(preferences.recommendedModels ?? []),
- ...(preferences.defaultFastModels ?? []),
- ...(preferences.defaultSmartModels ?? []),
- ]);
+ for (const tier of AI_MODEL_TIERS) {
+ for (const variantId of this.preferencesService.getDefaultModelIdsForTier(
+ tier,
+ )) {
+ this.registerVariant(variantId);
+ }
+ }
+ }
- for (const variantId of listedModelIds) {
- const variant = this.resolveConfiguredVariant(variantId);
+ // Any effort the catalog declares for a model is reachable by id, whether it
+ // sits in a chain, a workspace pin or an agent. An undeclared one never is.
+ private registerVariant(variantId: string): void {
+ const variant = this.resolveConfiguredVariant(variantId);
- if (!isDefined(variant)) {
- continue;
- }
+ if (!isDefined(variant)) {
+ return;
+ }
- const { baseConfig, effort } = variant;
+ const { baseConfig, effort } = variant;
- this.modelConfigCache.set(variantId, {
- ...baseConfig,
- modelId: variantId,
- label: `${baseConfig.label} (${effort})`,
- effort,
- // A reading describes the effort it was taken at, so the variant gets
- // the one taken at its effort or none, never the base model's ceiling.
- benchmark: baseConfig.benchmarkByEffort?.[effort],
- });
+ this.modelConfigCache.set(variantId, {
+ ...baseConfig,
+ modelId: variantId,
+ label: `${baseConfig.label} (${AI_MODEL_EFFORT_LABELS[effort]})`,
+ effort,
+ // A reading describes the effort it was taken at, so the variant gets
+ // the one taken at its effort or none, never the base model's ceiling.
+ benchmark: baseConfig.benchmarkByEffort?.[effort],
+ });
- const baseModelDef = this.providerModelDefCache.get(baseConfig.modelId);
+ const baseModelDef = this.providerModelDefCache.get(baseConfig.modelId);
- if (isDefined(baseModelDef)) {
- this.providerModelDefCache.set(variantId, baseModelDef);
- }
+ if (isDefined(baseModelDef)) {
+ this.providerModelDefCache.set(variantId, baseModelDef);
+ }
- const baseModel = this.modelRegistry.get(baseConfig.modelId);
+ const baseModel = this.modelRegistry.get(baseConfig.modelId);
- if (isDefined(baseModel)) {
- this.modelRegistry.set(variantId, {
- ...baseModel,
- modelId: variantId,
- effort,
- });
- }
+ if (isDefined(baseModel)) {
+ this.modelRegistry.set(variantId, {
+ ...baseModel,
+ modelId: variantId,
+ effort,
+ });
}
}
@@ -241,7 +241,7 @@ export class AiModelRegistryService {
return undefined;
}
- const { modelId, effort } = parseModelVariantId(variantId);
+ const { modelId, effort } = parseAiModelVariantId(variantId);
if (!isDefined(effort)) {
return undefined;
@@ -254,10 +254,6 @@ export class AiModelRegistryService {
}
if (!getAvailableEfforts(baseConfig).includes(effort)) {
- this.logger.warn(
- `Skipping "${variantId}": effort "${effort}" is not available for ${modelId}`,
- );
-
return undefined;
}
@@ -400,6 +396,7 @@ export class AiModelRegistryService {
getModel(modelId: string): RegisteredAiModel | undefined {
this.ensureFresh();
+ this.registerVariant(modelId);
return this.modelRegistry.get(modelId);
}
@@ -412,21 +409,18 @@ export class AiModelRegistryService {
getModelConfig(modelId: string): AiModelConfig | undefined {
this.ensureFresh();
+ this.registerVariant(modelId);
return this.modelConfigCache.get(modelId);
}
- getRecommendedModelIds(): Set<string> {
- return this.preferencesService.getRecommendedModelIds();
- }
-
private getFirstAvailableModelFromList(
modelIds: string[],
): RegisteredAiModel | undefined {
for (const modelId of modelIds) {
const model = this.getModel(modelId);
- if (model) {
+ if (isDefined(model) && this.isModelAdminAllowed(modelId)) {
return model;
}
}
@@ -434,24 +428,18 @@ export class AiModelRegistryService {
return undefined;
}
- getDefaultSpeedModel(): RegisteredAiModel {
- return this.getDefaultModelForRole(AiModelRole.FAST);
- }
-
- getDefaultPerformanceModel(): RegisteredAiModel {
- return this.getDefaultModelForRole(AiModelRole.SMART);
+ // The last resort is any model the admin still allows: a chain that names
+ // only disabled models must not hand a disabled one to the client.
+ findDefaultModelForTier(tier: AiModelTier): RegisteredAiModel | undefined {
+ return (
+ this.getFirstAvailableModelFromList(
+ this.preferencesService.getDefaultModelIdsForTier(tier),
+ ) ?? this.getAdminFilteredModels()[0]
+ );
}
- private getDefaultModelForRole(role: AiModelRole): RegisteredAiModel {
- const prefs = this.preferencesService.getPreferences();
- const preferenceKey =
- role === AiModelRole.FAST ? 'defaultFastModels' : 'defaultSmartModels';
-
- let model = this.getFirstAvailableModelFromList(prefs[preferenceKey] ?? []);
-
- if (!model) {
- model = this.getAvailableModels()[0];
- }
+ getDefaultModelForTier(tier: AiModelTier): RegisteredAiModel {
+ const model = this.findDefaultModelForTier(tier);
if (!model) {
throw new AiException(
@@ -463,18 +451,61 @@ export class AiModelRegistryService {
return model;
}
- getEffectiveModelConfig(modelId: string): AiModelConfig {
+ // A pin only applies while the pinned model still resolves and is not
+ // disabled, so a workspace never loses a tier because a provider key went
+ // away or an admin disabled the model after it was pinned.
+ private resolveModelForTier(
+ tier: AiModelTier,
+ workspaceSettings?: WorkspaceAiModelSettings,
+ ): RegisteredAiModel {
+ const pinnedModelId =
+ isDefined(workspaceSettings) &&
+ !workspaceSettings.isAutoModelSelectionEnabled
+ ? workspaceSettings.aiModelIdByTier[tier]
+ : undefined;
+
+ if (isDefined(pinnedModelId) && this.isModelAdminAllowed(pinnedModelId)) {
+ const pinnedModel = this.getModel(pinnedModelId);
+
+ if (isDefined(pinnedModel)) {
+ return pinnedModel;
+ }
+ }
+
+ return this.getDefaultModelForTier(tier);
+ }
+
+ private resolveAutoSelectModel(
+ modelId: string,
+ workspaceSettings?: WorkspaceAiModelSettings,
+ ): RegisteredAiModel | undefined {
+ const tier =
+ modelId === AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID
+ ? (workspaceSettings?.aiAgentModelTier ?? DEFAULT_AI_AGENT_MODEL_TIER)
+ : getAiModelTierFromModelId(modelId);
+
+ if (!isDefined(tier)) {
+ return undefined;
+ }
+
+ return this.resolveModelForTier(tier, workspaceSettings);
+ }
+
+ getEffectiveModelConfig(
+ modelId: string,
+ workspaceSettings?: WorkspaceAiModelSettings,
+ ): AiModelConfig {
this.ensureFresh();
- if (isAutoSelectModelId(modelId)) {
- const defaultModel =
- modelId === AUTO_SELECT_FAST_MODEL_ID
- ? this.getDefaultSpeedModel()
- : this.getDefaultPerformanceModel();
+ const autoSelectedModel = this.resolveAutoSelectModel(
+ modelId,
+ workspaceSettings,
+ );
+ if (isDefined(autoSelectedModel)) {
return (
- this.modelConfigCache.get(defaultModel.modelId) ??
- this.createDefaultConfigForCustomModel(defaultModel)
+ this.modelConfigCache.get(autoSelectedModel.modelId) ??
+ this.createDefaultConfigForCustomModel(autoSelectedModel)
);
}
@@ -542,16 +573,19 @@ export class AiModelRegistryService {
return true;
}
- const prefs = this.preferencesService.getPreferences();
- const disabledModels = prefs.disabledModels ?? [];
+ const disabledModels = this.preferencesService.getDisabledModelIds();
+ // Disabling a model disables every effort it can be pinned at.
+ const { modelId: baseModelId } = parseAiModelVariantId(modelId);
- return !disabledModels.includes(modelId);
+ return (
+ !disabledModels.includes(modelId) && !disabledModels.includes(baseModelId)
+ );
}
- validateModelAvailability(
- modelId: string,
- availabilitySettings: WorkspaceModelAvailabilitySettings,
- ): void {
+ // Catalog membership rather than registration: an instance can name a
+ // model before it holds the provider key, and a key added later makes the
+ // stored id work without touching the agent.
+ validateModelAvailability(modelId: string): void {
if (!this.isModelAdminAllowed(modelId)) {
throw new AiException(
'The selected model has been disabled by the administrator.',
@@ -559,19 +593,12 @@ export class AiModelRegistryService {
);
}
- const recommendedModelIds = this.getRecommendedModelIds();
-
- const isAvailable = isAutoSelectModelId(modelId)
- ? workspaceHasEnabledModels(availabilitySettings, recommendedModelIds)
- : isModelAllowedByWorkspace(
- modelId,
- availabilitySettings,
- recommendedModelIds,
- );
-
- if (!isAvailable) {
+ if (
+ !isAutoSelectModelId(modelId) &&
+ !isDefined(this.getModelConfig(modelId))
+ ) {
throw new AiException(
- 'The selected model is not available in this workspace.',
+ this.buildModelNotFoundMessage(modelId),
AiExceptionCode.AGENT_EXECUTION_FAILED,
);
}
@@ -587,12 +614,10 @@ export class AiModelRegistryService {
modelConfig: AiModelConfig;
isAvailable: boolean;
isAdminEnabled: boolean;
- isRecommended: boolean;
providerName?: string;
name?: string;
}> {
this.ensureFresh();
- const recommended = this.getRecommendedModelIds();
return Array.from(this.modelConfigCache.values()).map((modelConfig) => {
const registered = this.modelRegistry.get(modelConfig.modelId);
@@ -602,7 +627,6 @@ export class AiModelRegistryService {
modelConfig,
isAvailable: !!registered,
isAdminEnabled: this.isModelAdminAllowed(modelConfig.modelId),
- isRecommended: recommended.has(modelConfig.modelId),
providerName: registered?.providerName ?? cached?.providerName,
name: cached?.modelDef.name,
};
@@ -614,14 +638,6 @@ export class AiModelRegistryService {
await this.preferencesService.setModelAdminEnabled(modelId, enabled);
}
- async setModelRecommended(
- modelId: string,
- recommended: boolean,
- ): Promise<void> {
- this.validateModelInRegistry(modelId);
- await this.preferencesService.setModelRecommended(modelId, recommended);
- }
-
async setModelsAdminEnabled(
modelIds: string[],
enabled: boolean,
@@ -630,17 +646,9 @@ export class AiModelRegistryService {
await this.preferencesService.setModelsAdminEnabled(modelIds, enabled);
}
- async setModelsRecommended(
- modelIds: string[],
- recommended: boolean,
- ): Promise<void> {
- modelIds.forEach((id) => this.validateModelInRegistry(id));
- await this.preferencesService.setModelsRecommended(modelIds, recommended);
- }
-
- async setDefaultModel(role: AiModelRole, modelId: string): Promise<void> {
+ async setDefaultModel(tier: AiModelTier, modelId: string): Promise<void> {
this.validateModelInRegistry(modelId);
- await this.preferencesService.setDefaultModel(role, modelId);
+ await this.preferencesService.setDefaultModel(tier, modelId);
}
private validateModelInRegistry(modelId: string): void {
@@ -665,9 +673,13 @@ export class AiModelRegistryService {
return this.providerConfigService.getCatalogProviderNames();
}
- resolveModelForAgent(agent: { modelId: string } | null): RegisteredAiModel {
+ resolveModelForAgent(
+ agent: { modelId: string } | null,
+ workspaceSettings?: WorkspaceAiModelSettings,
+ ): RegisteredAiModel {
const aiModel = this.getEffectiveModelConfig(
- agent?.modelId ?? AUTO_SELECT_SMART_MODEL_ID,
+ agent?.modelId ?? AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,
+ workspaceSettings,
);
const registeredModel = this.getModel(aiModel.modelId);
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/ai-model-preferences.type.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/ai-model-preferences.type.ts
deleted file mode 100644
index 0f754a12549..00000000000
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/ai-model-preferences.type.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-// Preference lists use composite model ids (`provider/modelName`), aligned with the registry.
-export type AiModelPreferences = {
- disabledModels?: string[];
- recommendedModels?: string[];
- defaultFastModels?: string[];
- defaultSmartModels?: string[];
-};
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/ai-model-role.enum.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/ai-model-role.enum.ts
deleted file mode 100644
index ff7c1d573c9..00000000000
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/ai-model-role.enum.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export enum AiModelRole {
- FAST = 'fast',
- SMART = 'smart',
-}
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/ai-model-tier.enum.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/ai-model-tier.enum.ts
new file mode 100644
index 00000000000..bbf3dfbe5cb
--- /dev/null
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/ai-model-tier.enum.ts
@@ -0,0 +1,20 @@
+import { registerEnumType } from '@nestjs/graphql';
+
+import { type AiModelTier as SharedAiModelTier } from 'twenty-shared/ai';
+
+// GraphQL needs a runtime enum. Keys equal values so the GraphQL names are the
+// twenty-shared tier literals and the client can use one type on both sides.
+export enum AiModelTier {
+ extraFast = 'extraFast',
+ fast = 'fast',
+ balanced = 'balanced',
+ smart = 'smart',
+ extraSmart = 'extraSmart',
+}
+
+registerEnumType(AiModelTier, { name: 'AiModelTier' });
+
+// The enum object itself must satisfy the shared record, so a tier added on
+// one side without the other fails to compile.
+const _assertTierValuesMatchShared: Record<SharedAiModelTier, AiModelTier> =
+ AiModelTier;
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/workspace-ai-model-settings.type.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/workspace-ai-model-settings.type.ts
new file mode 100644
index 00000000000..578febf202f
--- /dev/null
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/types/workspace-ai-model-settings.type.ts
@@ -0,0 +1,10 @@
+import { type AiModelTier } from 'twenty-shared/ai';
+
+// The subset of a workspace that decides which concrete model a tier resolves
+// to. Pins are ignored while automatic selection is on.
+export type WorkspaceAiModelSettings = {
+ isAutoModelSelectionEnabled: boolean;
+ aiModelIdByTier: Partial<Record<AiModelTier, string>>;
+ aiChatModelTier: AiModelTier;
+ aiAgentModelTier: AiModelTier;
+};
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/__tests__/workspace-has-enabled-models.util.spec.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/__tests__/workspace-has-enabled-models.util.spec.ts
deleted file mode 100644
index 247fd48ea82..00000000000
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/__tests__/workspace-has-enabled-models.util.spec.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-import { workspaceHasEnabledModels } from 'src/engine/metadata-modules/ai/ai-models/utils/workspace-has-enabled-models.util';
-
-describe('workspaceHasEnabledModels', () => {
- describe('when the workspace uses recommended models', () => {
- it('returns true when at least one model is recommended', () => {
- expect(
- workspaceHasEnabledModels(
- { useRecommendedModels: true, enabledAiModelIds: [] },
- new Set(['openai/gpt-5.2']),
- ),
- ).toBe(true);
- });
-
- it('returns false when no model is recommended', () => {
- expect(
- workspaceHasEnabledModels(
- { useRecommendedModels: true, enabledAiModelIds: [] },
- new Set(),
- ),
- ).toBe(false);
- });
-
- it('returns false when no recommended ids are provided', () => {
- expect(
- workspaceHasEnabledModels({
- useRecommendedModels: true,
- enabledAiModelIds: [],
- }),
- ).toBe(false);
- });
- });
-
- describe('when the workspace selects models manually', () => {
- it('returns true when at least one model is enabled', () => {
- expect(
- workspaceHasEnabledModels({
- useRecommendedModels: false,
- enabledAiModelIds: ['openai/gpt-5.2'],
- }),
- ).toBe(true);
- });
-
- it('returns false when every model is disabled', () => {
- expect(
- workspaceHasEnabledModels({
- useRecommendedModels: false,
- enabledAiModelIds: [],
- }),
- ).toBe(false);
- });
- });
-});
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/get-chat-model-id.util.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/get-chat-model-id.util.ts
new file mode 100644
index 00000000000..7da5aabeffa
--- /dev/null
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/get-chat-model-id.util.ts
@@ -0,0 +1,13 @@
+import { AUTO_SELECT_MODEL_ID_BY_TIER } from 'twenty-shared/ai';
+
+import { type WorkspaceAiModelSettings } from 'src/engine/metadata-modules/ai/ai-models/types/workspace-ai-model-settings.type';
+
+// A chat turn that names no model runs on the workspace chat tier.
+export const getChatModelId = ({
+ requestedModelId,
+ workspace,
+}: {
+ requestedModelId: string | null | undefined;
+ workspace: Pick<WorkspaceAiModelSettings, 'aiChatModelTier'>;
+}): string =>
+ requestedModelId ?? AUTO_SELECT_MODEL_ID_BY_TIER[workspace.aiChatModelTier];
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/is-model-allowed.util.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/is-model-allowed.util.ts
deleted file mode 100644
index fec2a326e44..00000000000
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/is-model-allowed.util.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { isAutoSelectModelId } from 'twenty-shared/utils';
-
-export type WorkspaceModelAvailabilitySettings = {
- useRecommendedModels: boolean;
- enabledAiModelIds: string[];
-};
-
-export const isModelAllowedByWorkspace = (
- modelId: string,
- availabilitySettings: WorkspaceModelAvailabilitySettings,
- recommendedModelIds?: Set<string>,
-): boolean => {
- if (isAutoSelectModelId(modelId)) {
- return true;
- }
-
- if (availabilitySettings.useRecommendedModels) {
- return recommendedModelIds?.has(modelId) ?? false;
- }
-
- return availabilitySettings.enabledAiModelIds.includes(modelId);
-};
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/load-default-model-preferences.util.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/load-default-model-preferences.util.ts
index 988ad4b0d45..e141b68bcd1 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/load-default-model-preferences.util.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/load-default-model-preferences.util.ts
@@ -1,44 +1,51 @@
// TODO: derive default model preferences dynamically from the catalog
// instead of hardcoding model IDs that become stale as models evolve
//
-// These lists are resolved by taking the first model that is actually
-// available, meaning the one whose provider the instance holds a key for. They
-// are therefore a preference chain across providers, not a shortlist: every
+// Each tier is resolved by taking the first model that is actually available,
+// meaning the one whose provider the instance holds a key for. A chain is
+// therefore a preference order across providers, not a shortlist: every
// supported provider needs an entry, or an instance configured with only that
-// provider resolves to nothing and shows an empty model picker.
-import { type AiModelPreferences } from 'src/engine/metadata-modules/ai/ai-models/types/ai-model-preferences.type';
+// provider resolves the tier to nothing.
+import { type AiModelTier } from 'twenty-shared/ai';
-export const DEFAULT_FAST_MODELS = [
- 'openai/gpt-5.6-luna',
- 'anthropic/claude-sonnet-5',
- 'google/gemini-3.8-flash',
- 'xai/grok-4.3',
- 'mistral/mistral-large-latest',
-];
-
-export const DEFAULT_SMART_MODELS = [
- 'openai/gpt-5.6-sol',
- 'anthropic/claude-opus-5',
- 'google/gemini-3.8-flash',
- 'xai/grok-4.6',
- 'mistral/mistral-large-latest',
-];
-
-export const DEFAULT_RECOMMENDED_MODELS = [
- 'openai/gpt-5.6-luna',
- 'openai/gpt-5.6-sol',
- 'anthropic/claude-sonnet-5',
- 'anthropic/claude-opus-5',
- 'google/gemini-3.8-flash',
- 'xai/grok-4.6',
- 'mistral/mistral-large-latest',
-];
+// Efforts are pinned so a tier runs at the effort its benchmark was measured
+// at, and so one model family can back neighbouring tiers at different speeds.
+export const DEFAULT_MODELS_BY_TIER: Record<AiModelTier, string[]> = {
+ extraFast: [
+ 'openai/gpt-5.6-luna@low',
+ 'google/gemini-3.8-flash@low',
+ 'anthropic/claude-sonnet-5@low',
+ 'xai/grok-4.5@low',
+ 'mistral/mistral-small-latest@none',
+ ],
+ fast: [
+ 'openai/gpt-5.6-luna@medium',
+ 'google/gemini-3.8-flash@medium',
+ 'anthropic/claude-sonnet-5@medium',
+ 'xai/grok-4.5@medium',
+ 'mistral/mistral-medium-latest',
+ ],
+ balanced: [
+ 'openai/gpt-5.6-luna@high',
+ 'google/gemini-3.8-flash@high',
+ 'anthropic/claude-sonnet-5@high',
+ 'xai/grok-4.6@medium',
+ 'mistral/mistral-large-latest',
+ ],
+ smart: [
+ 'openai/gpt-5.6-sol@high',
+ 'google/gemini-3.8-flash@high',
+ 'anthropic/claude-opus-5@high',
+ 'xai/grok-4.6@high',
+ 'mistral/mistral-large-latest',
+ ],
+ extraSmart: [
+ 'openai/gpt-6-astra@xhigh',
+ 'google/gemini-3.8-flash@high',
+ 'anthropic/claude-fable-5-1@xhigh',
+ 'xai/grok-4.6@xhigh',
+ 'mistral/mistral-large-latest',
+ ],
+};
export const DEFAULT_DISABLED_MODELS: string[] = [];
-
-export const DEFAULT_MODEL_PREFERENCES: AiModelPreferences = {
- disabledModels: [],
- recommendedModels: DEFAULT_RECOMMENDED_MODELS,
- defaultFastModels: DEFAULT_FAST_MODELS,
- defaultSmartModels: DEFAULT_SMART_MODELS,
-};
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/workspace-has-enabled-models.util.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/workspace-has-enabled-models.util.ts
deleted file mode 100644
index 9ea6687aaa0..00000000000
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/workspace-has-enabled-models.util.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { type WorkspaceModelAvailabilitySettings } from 'src/engine/metadata-modules/ai/ai-models/utils/is-model-allowed.util';
-
-export const workspaceHasEnabledModels = (
- availabilitySettings: WorkspaceModelAvailabilitySettings,
- recommendedModelIds?: Set<string>,
-): boolean => {
- if (availabilitySettings.useRecommendedModels) {
- return (recommendedModelIds?.size ?? 0) > 0;
- }
-
- return availabilitySettings.enabledAiModelIds.length > 0;
-};
diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/agent-metadata/create-standard-flat-agent-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/agent-metadata/create-standard-flat-agent-metadata.util.ts
index 2415607f692..486fab43407 100644
--- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/agent-metadata/create-standard-flat-agent-metadata.util.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/agent-metadata/create-standard-flat-agent-metadata.util.ts
@@ -1,4 +1,4 @@
-import { AUTO_SELECT_SMART_MODEL_ID } from 'twenty-shared/constants';
+import { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from 'twenty-shared/ai';
import { type FlatAgent } from 'src/engine/metadata-modules/flat-agent/types/flat-agent.type';
import { type AllStandardAgentName } from 'src/engine/workspace-manager/twenty-standard-application/types/all-standard-agent-name.type';
import {
@@ -40,7 +40,7 @@ Response format:
- Use markdown for readability
Always base answers on official Twenty documentation. Be patient and helpful.`,
- modelId: AUTO_SELECT_SMART_MODEL_ID,
+ modelId: AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,
responseFormat: { type: 'text' },
isCustom: false,
modelConfiguration: {},
diff --git a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/workflow-version-step-operations.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/workflow-version-step-operations.workspace-service.ts
index cba17c8c80f..be8a7a76c8d 100644
--- a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/workflow-version-step-operations.workspace-service.ts
+++ b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/workflow-version-step-operations.workspace-service.ts
@@ -1,6 +1,7 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
+import { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from 'twenty-shared/ai';
import { inputSchemaToOutputSchema } from 'twenty-shared/logic-function';
import {
FieldMetadataType,
@@ -20,10 +21,8 @@ import { v4 } from 'uuid';
import { getFlatFieldsFromFlatObjectMetadata } from 'src/engine/api/graphql/workspace-schema-builder/utils/get-flat-fields-for-flat-object-metadata.util';
import { type WorkflowStepPositionInput } from 'src/engine/core-modules/workflow/dtos/update-workflow-step-position.input';
import { WorkflowVersionCoreSyncService } from 'src/engine/core-modules/workflow/services/workflow-version-core-sync.service';
-import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
import { AiAgentRoleService } from 'src/engine/metadata-modules/ai/ai-agent-role/ai-agent-role.service';
import { AgentService } from 'src/engine/metadata-modules/ai/ai-agent/agent.service';
-import { AiModelRegistryService } from 'src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service';
import { WorkspaceManyOrAllFlatEntityMapsCacheService } from 'src/engine/metadata-modules/flat-entity/services/workspace-many-or-all-flat-entity-maps-cache.service';
import {
LogicFunctionException,
@@ -78,13 +77,10 @@ export class WorkflowVersionStepOperationsWorkspaceService {
private readonly logicFunctionFromSourceService: LogicFunctionFromSourceService,
private readonly codeStepBuildService: CodeStepBuildService,
private readonly agentService: AgentService,
- private readonly aiModelRegistryService: AiModelRegistryService,
@InjectWorkspaceScopedRepository(RoleTargetEntity)
private readonly roleTargetRepository: WorkspaceScopedRepository<RoleTargetEntity>,
@InjectRepository(ObjectMetadataEntity)
private readonly objectMetadataRepository: Repository<ObjectMetadataEntity>,
- @InjectRepository(WorkspaceEntity)
- private readonly workspaceRepository: Repository<WorkspaceEntity>,
private readonly workflowCommonWorkspaceService: WorkflowCommonWorkspaceService,
private readonly aiAgentRoleService: AiAgentRoleService,
private readonly workspaceCacheService: WorkspaceCacheService,
@@ -92,26 +88,6 @@ export class WorkflowVersionStepOperationsWorkspaceService {
private readonly workflowVersionCoreSyncService: WorkflowVersionCoreSyncService,
) {}
- private async getWorkspaceDefaultFastModelId(
- workspaceId: string,
- ): Promise<string> {
- const workspace = await this.workspaceRepository.findOneBy({
- id: workspaceId,
- });
-
- if (!isDefined(workspace)) {
- throw new WorkflowVersionStepException(
- `Workspace ${workspaceId} not found`,
- WorkflowVersionStepExceptionCode.NOT_FOUND,
- );
- }
-
- const effectiveModelConfig =
- this.aiModelRegistryService.getEffectiveModelConfig(workspace.fastModel);
-
- return effectiveModelConfig.modelId;
- }
-
async runWorkflowVersionStepDeletionSideEffects({
step,
workspaceId,
@@ -586,7 +562,7 @@ export class WorkflowVersionStepOperationsWorkspaceService {
description: '',
prompt:
'You are a helpful AI assistant. Complete the task based on the workflow context.',
- modelId: await this.getWorkspaceDefaultFastModelId(workspaceId),
+ modelId: AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID,
responseFormat: { type: 'text' },
isCustom: true,
},
diff --git a/packages/twenty-server/test/integration/constants/test-ai-model-ids.constants.ts b/packages/twenty-server/test/integration/constants/test-ai-model-ids.constants.ts
index e7e66e17e78..e5d83f57242 100644
--- a/packages/twenty-server/test/integration/constants/test-ai-model-ids.constants.ts
+++ b/packages/twenty-server/test/integration/constants/test-ai-model-ids.constants.ts
@@ -1,22 +1,20 @@
-import { DEFAULT_RECOMMENDED_MODELS } from 'src/engine/metadata-modules/ai/ai-models/utils/load-default-model-preferences.util';
+import { DEFAULT_MODELS_BY_TIER } from 'src/engine/metadata-modules/ai/ai-models/utils/load-default-model-preferences.util';
-// Workspaces default to useRecommendedModels, so an agent can only be created
-// with a model from this list. Reading the ids from it rather than naming them
-// keeps these suites working when the list is refreshed against the models.dev
-// catalog — that refresh lands on a daily automerge, and the previous
-// hardcoded openai/gpt-4.1 broke every agent suite when it dropped out.
-export const [TEST_AI_MODEL_ID, TEST_AI_OTHER_MODEL_ID] =
- DEFAULT_RECOMMENDED_MODELS;
+// Any registered model can back an agent, so the suites read ids from the
+// default chains rather than naming them: those lists are refreshed against the
+// models.dev catalog on a daily automerge, and a hardcoded id broke every agent
+// suite the day it dropped out of the catalog.
+export const [TEST_AI_MODEL_ID, TEST_AI_OTHER_MODEL_ID] = [
+ DEFAULT_MODELS_BY_TIER.fast[0],
+ DEFAULT_MODELS_BY_TIER.smart[0],
+];
// Two distinct ids are load-bearing: the update suites assert a transition from
// one model to another, and would pass without testing anything if both were
// the same. Fail at import rather than let a future list shape silently empty
// those assertions out.
-if (
- DEFAULT_RECOMMENDED_MODELS.length < 2 ||
- TEST_AI_MODEL_ID === TEST_AI_OTHER_MODEL_ID
-) {
+if (TEST_AI_MODEL_ID === TEST_AI_OTHER_MODEL_ID) {
throw new Error(
- 'The agent integration suites need two distinct recommended models: one to create an agent with and one to update it to. DEFAULT_RECOMMENDED_MODELS no longer provides two different ids.',
+ 'The agent integration suites need two distinct default models: one to create an agent with and one to update it to. The fast and smart chains now start with the same id.',
);
}
diff --git a/packages/twenty-shared/src/ai/constants/ai-model-effort-labels.const.ts b/packages/twenty-shared/src/ai/constants/ai-model-effort-labels.const.ts
new file mode 100644
index 00000000000..f0c8f56b27a
--- /dev/null
+++ b/packages/twenty-shared/src/ai/constants/ai-model-effort-labels.const.ts
@@ -0,0 +1,11 @@
+import { type AiModelEffort } from './ai-model-effort.const';
+
+export const AI_MODEL_EFFORT_LABELS: Record<AiModelEffort, string> = {
+ none: 'no reasoning',
+ minimal: 'minimal reasoning',
+ low: 'low reasoning',
+ medium: 'medium reasoning',
+ high: 'high reasoning',
+ xhigh: 'very high reasoning',
+ max: 'max reasoning',
+};
diff --git a/packages/twenty-shared/src/ai/constants/ai-model-tier.const.ts b/packages/twenty-shared/src/ai/constants/ai-model-tier.const.ts
new file mode 100644
index 00000000000..a9932d3be5c
--- /dev/null
+++ b/packages/twenty-shared/src/ai/constants/ai-model-tier.const.ts
@@ -0,0 +1,11 @@
+// Ordered from fastest and cheapest to most capable. The order is what the
+// slider walks, so it must stay monotonic in both directions.
+export const AI_MODEL_TIERS = [
+ 'extraFast',
+ 'fast',
+ 'balanced',
+ 'smart',
+ 'extraSmart',
+] as const;
+
+export type AiModelTier = (typeof AI_MODEL_TIERS)[number];
diff --git a/packages/twenty-shared/src/ai/constants/auto-select-model-id-by-tier.const.ts b/packages/twenty-shared/src/ai/constants/auto-select-model-id-by-tier.const.ts
new file mode 100644
index 00000000000..5fea9e7a357
--- /dev/null
+++ b/packages/twenty-shared/src/ai/constants/auto-select-model-id-by-tier.const.ts
@@ -0,0 +1,15 @@
+import { type AiModelTier } from './ai-model-tier.const';
+
+// Stored in agent.modelId and sent by the chat client in place of a concrete
+// `provider/model` id. The fast and smart values predate tiers and live in
+// existing rows, so they keep their original spelling.
+export const AUTO_SELECT_MODEL_ID_BY_TIER = {
+ extraFast: 'default-extra-fast-model',
+ fast: 'default-fast-model',
+ balanced: 'default-balanced-model',
+ smart: 'default-smart-model',
+ extraSmart: 'default-extra-smart-model',
+} as const satisfies Record<AiModelTier, string>;
+
+export type AutoSelectModelId =
+ (typeof AUTO_SELECT_MODEL_ID_BY_TIER)[AiModelTier];
diff --git a/packages/twenty-shared/src/ai/constants/auto-select-workspace-default-model-id.const.ts b/packages/twenty-shared/src/ai/constants/auto-select-workspace-default-model-id.const.ts
new file mode 100644
index 00000000000..727db5c6422
--- /dev/null
+++ b/packages/twenty-shared/src/ai/constants/auto-select-workspace-default-model-id.const.ts
@@ -0,0 +1,4 @@
+// Stored on an agent that follows the workspace's agent tier instead of naming
+// one of its own, so changing the workspace setting moves every such agent.
+export const AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID =
+ 'workspace-default-model' as const;
diff --git a/packages/twenty-shared/src/ai/constants/default-ai-agent-model-tier.const.ts b/packages/twenty-shared/src/ai/constants/default-ai-agent-model-tier.const.ts
new file mode 100644
index 00000000000..193cb1b3805
--- /dev/null
+++ b/packages/twenty-shared/src/ai/constants/default-ai-agent-model-tier.const.ts
@@ -0,0 +1,3 @@
+import { type AiModelTier } from './ai-model-tier.const';
+
+export const DEFAULT_AI_AGENT_MODEL_TIER: AiModelTier = 'fast';
diff --git a/packages/twenty-shared/src/ai/constants/default-ai-chat-model-tier.const.ts b/packages/twenty-shared/src/ai/constants/default-ai-chat-model-tier.const.ts
new file mode 100644
index 00000000000..11c0473a782
--- /dev/null
+++ b/packages/twenty-shared/src/ai/constants/default-ai-chat-model-tier.const.ts
@@ -0,0 +1,5 @@
+import { type AiModelTier } from './ai-model-tier.const';
+
+// Cheap and quick is the right default for most workspaces; the slider is one
+// click away for anyone who wants more.
+export const DEFAULT_AI_CHAT_MODEL_TIER: AiModelTier = 'fast';
diff --git a/packages/twenty-shared/src/ai/index.ts b/packages/twenty-shared/src/ai/index.ts
index 4a061787d89..0096bab5e3a 100644
--- a/packages/twenty-shared/src/ai/index.ts
+++ b/packages/twenty-shared/src/ai/index.ts
@@ -7,17 +7,25 @@
* |___/
*/
+export { AI_MODEL_EFFORT_LABELS } from './constants/ai-model-effort-labels.const';
export type { AiModelEffort } from './constants/ai-model-effort.const';
export { AI_MODEL_EFFORTS } from './constants/ai-model-effort.const';
+export type { AiModelTier } from './constants/ai-model-tier.const';
+export { AI_MODEL_TIERS } from './constants/ai-model-tier.const';
export { AI_SDK_PACKAGE_LABELS } from './constants/ai-sdk-package-labels.const';
export type { AiSdkPackage } from './constants/ai-sdk-packages.const';
export { AI_SDK_PACKAGES } from './constants/ai-sdk-packages.const';
export { ASK_QUESTIONS_TOOL_NAME } from './constants/ask-questions-tool-name.const';
+export type { AutoSelectModelId } from './constants/auto-select-model-id-by-tier.const';
+export { AUTO_SELECT_MODEL_ID_BY_TIER } from './constants/auto-select-model-id-by-tier.const';
+export { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from './constants/auto-select-workspace-default-model-id.const';
export { COMPLETE_WORKSPACE_SETUP_TOOL_NAME } from './constants/complete-workspace-setup-tool-name.const';
export type { DataResidency } from './constants/data-residency.const';
export { DATA_RESIDENCY_KEYS } from './constants/data-residency.const';
export type { DatabaseCrudOperation } from './constants/database-crud-operation.const';
export { DATABASE_CRUD_OPERATIONS } from './constants/database-crud-operation.const';
+export { DEFAULT_AI_AGENT_MODEL_TIER } from './constants/default-ai-agent-model-tier.const';
+export { DEFAULT_AI_CHAT_MODEL_TIER } from './constants/default-ai-chat-model-tier.const';
export type { NativeAiSdkProviderId } from './constants/native-ai-sdk-provider-ids.const';
export { NATIVE_AI_SDK_PROVIDER_IDS } from './constants/native-ai-sdk-provider-ids.const';
export { ToolCategory } from './constants/tool-category.const';
@@ -55,10 +63,13 @@ export type { ExtendedUIMessagePart } from './types/ExtendedUIMessagePart';
export type { ModelConfiguration } from './types/model-configuration.type';
export type { NavigateAppToolOutput } from './types/NavigateAppToolOutput';
export { formatRecordReference } from './utils/format-record-reference.util';
+export { getAiModelTierFromModelId } from './utils/get-ai-model-tier-from-model-id.util';
export { inferAiSdkPackage } from './utils/infer-ai-sdk-package.util';
export { isAiModelEffort } from './utils/is-ai-model-effort.util';
+export { isAiModelTier } from './utils/is-ai-model-tier.util';
export { isAiSdkPackage } from './utils/is-ai-sdk-package.util';
export { isCompleteWorkspaceSetupToolPart } from './utils/is-complete-workspace-setup-tool-part.util';
export { isDataResidency } from './utils/is-data-residency.util';
export { isSucceededCompleteWorkspaceSetupToolPart } from './utils/is-succeeded-complete-workspace-setup-tool-part.util';
export { isValidAgentResponseSchemaPropertyKey } from './utils/is-valid-agent-response-schema-property-key.util';
+export { parseAiModelVariantId } from './utils/parse-ai-model-variant-id.util';
diff --git a/packages/twenty-shared/src/ai/types/DataMessagePart.ts b/packages/twenty-shared/src/ai/types/DataMessagePart.ts
index cf2b9b28868..83cbad20529 100644
--- a/packages/twenty-shared/src/ai/types/DataMessagePart.ts
+++ b/packages/twenty-shared/src/ai/types/DataMessagePart.ts
@@ -56,8 +56,6 @@ export type DataMessagePart = {
selectedAgentId?: string;
selectedAgentLabel?: string;
availableAgents?: Array<{ id: string; label: string }>;
- fastModel?: string;
- smartModel?: string;
agentModel?: string;
context?: string;
contextRecordCount?: number;
diff --git a/packages/twenty-shared/src/ai/utils/__tests__/get-ai-model-tier-from-model-id.util.spec.ts b/packages/twenty-shared/src/ai/utils/__tests__/get-ai-model-tier-from-model-id.util.spec.ts
new file mode 100644
index 00000000000..323462afe7f
--- /dev/null
+++ b/packages/twenty-shared/src/ai/utils/__tests__/get-ai-model-tier-from-model-id.util.spec.ts
@@ -0,0 +1,23 @@
+import { getAiModelTierFromModelId } from '../get-ai-model-tier-from-model-id.util';
+
+describe('getAiModelTierFromModelId', () => {
+ it('maps every auto-select id to its tier', () => {
+ expect(getAiModelTierFromModelId('default-extra-fast-model')).toBe(
+ 'extraFast',
+ );
+ expect(getAiModelTierFromModelId('default-fast-model')).toBe('fast');
+ expect(getAiModelTierFromModelId('default-balanced-model')).toBe(
+ 'balanced',
+ );
+ expect(getAiModelTierFromModelId('default-smart-model')).toBe('smart');
+ expect(getAiModelTierFromModelId('default-extra-smart-model')).toBe(
+ 'extraSmart',
+ );
+ });
+
+ it('returns undefined for concrete model ids and empty values', () => {
+ expect(getAiModelTierFromModelId('openai/gpt-5.6-luna')).toBeUndefined();
+ expect(getAiModelTierFromModelId(null)).toBeUndefined();
+ expect(getAiModelTierFromModelId(undefined)).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/__tests__/parse-model-variant-id.util.spec.ts b/packages/twenty-shared/src/ai/utils/__tests__/parse-ai-model-variant-id.util.spec.ts
similarity index 56%
rename from packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/__tests__/parse-model-variant-id.util.spec.ts
rename to packages/twenty-shared/src/ai/utils/__tests__/parse-ai-model-variant-id.util.spec.ts
index 3da7f00fb44..381653ea326 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/__tests__/parse-model-variant-id.util.spec.ts
+++ b/packages/twenty-shared/src/ai/utils/__tests__/parse-ai-model-variant-id.util.spec.ts
@@ -1,8 +1,8 @@
-import { parseModelVariantId } from 'src/engine/metadata-modules/ai/ai-models/utils/parse-model-variant-id.util';
+import { parseAiModelVariantId } from '../parse-ai-model-variant-id.util';
-describe('parseModelVariantId', () => {
+describe('parseAiModelVariantId', () => {
it('splits a variant id into its model and effort', () => {
- expect(parseModelVariantId('anthropic/claude-opus-5@xhigh')).toEqual({
+ expect(parseAiModelVariantId('anthropic/claude-opus-5@xhigh')).toEqual({
modelId: 'anthropic/claude-opus-5',
effort: 'xhigh',
});
@@ -10,7 +10,7 @@ describe('parseModelVariantId', () => {
it('keeps a Bedrock name that carries a colon intact', () => {
expect(
- parseModelVariantId('amazon-bedrock/us.deepseek.r1-v1:0@high'),
+ parseAiModelVariantId('amazon-bedrock/us.deepseek.r1-v1:0@high'),
).toEqual({
modelId: 'amazon-bedrock/us.deepseek.r1-v1:0',
effort: 'high',
@@ -18,13 +18,13 @@ describe('parseModelVariantId', () => {
});
it('returns a plain id without an effort', () => {
- expect(parseModelVariantId('openai/gpt-5.6-sol')).toEqual({
+ expect(parseAiModelVariantId('openai/gpt-5.6-sol')).toEqual({
modelId: 'openai/gpt-5.6-sol',
});
});
it('treats a suffix that is not an effort as part of the id', () => {
- expect(parseModelVariantId('custom/model@v2')).toEqual({
+ expect(parseAiModelVariantId('custom/model@v2')).toEqual({
modelId: 'custom/model@v2',
});
});
diff --git a/packages/twenty-shared/src/ai/utils/get-ai-model-tier-from-model-id.util.ts b/packages/twenty-shared/src/ai/utils/get-ai-model-tier-from-model-id.util.ts
new file mode 100644
index 00000000000..bb55eb04d03
--- /dev/null
+++ b/packages/twenty-shared/src/ai/utils/get-ai-model-tier-from-model-id.util.ts
@@ -0,0 +1,10 @@
+import {
+ AI_MODEL_TIERS,
+ type AiModelTier,
+} from '../constants/ai-model-tier.const';
+import { AUTO_SELECT_MODEL_ID_BY_TIER } from '../constants/auto-select-model-id-by-tier.const';
+
+export const getAiModelTierFromModelId = (
+ modelId: string | null | undefined,
+): AiModelTier | undefined =>
+ AI_MODEL_TIERS.find((tier) => AUTO_SELECT_MODEL_ID_BY_TIER[tier] === modelId);
diff --git a/packages/twenty-shared/src/ai/utils/is-ai-model-tier.util.ts b/packages/twenty-shared/src/ai/utils/is-ai-model-tier.util.ts
new file mode 100644
index 00000000000..e7d6e76283f
--- /dev/null
+++ b/packages/twenty-shared/src/ai/utils/is-ai-model-tier.util.ts
@@ -0,0 +1,8 @@
+import {
+ AI_MODEL_TIERS,
+ type AiModelTier,
+} from '../constants/ai-model-tier.const';
+
+export const isAiModelTier = (value: unknown): value is AiModelTier =>
+ typeof value === 'string' &&
+ (AI_MODEL_TIERS as readonly string[]).includes(value);
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/parse-model-variant-id.util.ts b/packages/twenty-shared/src/ai/utils/parse-ai-model-variant-id.util.ts
similarity index 76%
rename from packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/parse-model-variant-id.util.ts
rename to packages/twenty-shared/src/ai/utils/parse-ai-model-variant-id.util.ts
index 5674a3a8688..8976592830c 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/utils/parse-model-variant-id.util.ts
+++ b/packages/twenty-shared/src/ai/utils/parse-ai-model-variant-id.util.ts
@@ -1,10 +1,11 @@
-import { type AiModelEffort, isAiModelEffort } from 'twenty-shared/ai';
+import { type AiModelEffort } from '../constants/ai-model-effort.const';
+import { isAiModelEffort } from './is-ai-model-effort.util';
const EFFORT_SEPARATOR = '@';
// Catalog model names never contain `@` (Bedrock ids use `:`), so the last one
// delimits the effort. Any other suffix is part of the id itself.
-export const parseModelVariantId = (
+export const parseAiModelVariantId = (
modelId: string,
): { modelId: string; effort?: AiModelEffort } => {
const separatorIndex = modelId.lastIndexOf(EFFORT_SEPARATOR);
diff --git a/packages/twenty-shared/src/constants/AutoSelectFastModelId.ts b/packages/twenty-shared/src/constants/AutoSelectFastModelId.ts
deleted file mode 100644
index 5a18f5f4602..00000000000
--- a/packages/twenty-shared/src/constants/AutoSelectFastModelId.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const AUTO_SELECT_FAST_MODEL_ID = 'default-fast-model' as const;
diff --git a/packages/twenty-shared/src/constants/AutoSelectSmartModelId.ts b/packages/twenty-shared/src/constants/AutoSelectSmartModelId.ts
deleted file mode 100644
index cc5e9ebbc42..00000000000
--- a/packages/twenty-shared/src/constants/AutoSelectSmartModelId.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const AUTO_SELECT_SMART_MODEL_ID = 'default-smart-model' as const;
diff --git a/packages/twenty-shared/src/constants/index.ts b/packages/twenty-shared/src/constants/index.ts
index bbc4ce19cce..340ad485915 100644
--- a/packages/twenty-shared/src/constants/index.ts
+++ b/packages/twenty-shared/src/constants/index.ts
@@ -10,8 +10,6 @@
export type { AccountType } from './AccountTypes';
export { ACCOUNT_TYPES } from './AccountTypes';
export { ALLOWED_FULL_NAME_SORT_SUBFIELDS } from './AllowedFullNameSortSubfields';
-export { AUTO_SELECT_FAST_MODEL_ID } from './AutoSelectFastModelId';
-export { AUTO_SELECT_SMART_MODEL_ID } from './AutoSelectSmartModelId';
export { BACKEND_BATCH_REQUEST_MAX_COUNT } from './BackendBatchRequestMaxCount';
export { CalendarStartDay } from './CalendarStartDay';
export { COMMAND_MENU_CONFIRMATION_MODAL_RESULT_BROWSER_EVENT_NAME } from './CommandMenuConfirmationModalResultBrowserEventName';
diff --git a/packages/twenty-shared/src/utils/isAutoSelectModelId.ts b/packages/twenty-shared/src/utils/isAutoSelectModelId.ts
index 06cbf35edbe..63c74f459ca 100644
--- a/packages/twenty-shared/src/utils/isAutoSelectModelId.ts
+++ b/packages/twenty-shared/src/utils/isAutoSelectModelId.ts
@@ -1,6 +1,7 @@
-import { AUTO_SELECT_FAST_MODEL_ID } from '../constants/AutoSelectFastModelId';
-import { AUTO_SELECT_SMART_MODEL_ID } from '../constants/AutoSelectSmartModelId';
+import { AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID } from '../ai/constants/auto-select-workspace-default-model-id.const';
+import { getAiModelTierFromModelId } from '../ai/utils/get-ai-model-tier-from-model-id.util';
+import { isDefined } from './validation/isDefined';
export const isAutoSelectModelId = (modelId: string): boolean =>
- modelId === AUTO_SELECT_FAST_MODEL_ID ||
- modelId === AUTO_SELECT_SMART_MODEL_ID;
+ modelId === AUTO_SELECT_WORKSPACE_DEFAULT_MODEL_ID ||
+ isDefined(getAiModelTierFromModelId(modelId));