From 6117a1d6c0409fd2d23b441b61b45cda350e6f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Malfait?= Date: Sun, 19 Apr 2026 13:29:35 +0200 Subject: [PATCH] refactor: standardize AI acronym to Ai (PascalCase) across internal identifiers (#19837) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary The "AI" acronym was rendered inconsistently across the codebase. The backend AI module had settled on PascalCase `Ai` (`AiAgentModule`, `AiBillingService`, `AiChatModule`, `AiModelRegistryService`, etc.), while frontend components, several DTOs, a few types, and shared identifiers still used all-caps `AI` (`AIChatTab`, `AISystemPromptPreviewDTO`, `SettingsPath.AIPrompts`, ...). CLAUDE.md specifies PascalCase for classes; this PR normalizes everything internal to `Ai`. **This is a pure internal rename.** The GraphQL schema is untouched — `@ObjectType` decorator string arguments, resolver method names (which become Query/Mutation field names), gql template contents, and the `generated-metadata/graphql.ts` file are preserved verbatim. The only visible change is TypeScript identifiers and file names. ## Also folded in (adjacent cleanups) - **`AgentModelConfigService` → `AiModelConfigService`**. Lives in `ai-models/` and is used by multiple AI code paths, not just the Agent entity. The "Agent" prefix was misleading. - **`generate-text-input.dto.ts` → `generate-text.input.ts`**. The `ai-agent/dtos/` folder already uses `.input.ts` convention for Input classes (`create-agent.input.ts` etc.); the old path mixed `.dto.ts` file extension with a class that has no DTO suffix. File rename only; class stays `GenerateTextInput`. - **Removed stale TODO** in `ai-model-config.type.ts` that asked for the `AiModelConfig` rename that this PR performs. ## Rename methodology Bulk rename via perl with anchored regex `(?…`) ## Test plan - [x] `npx nx typecheck twenty-server` — PASS - [x] `npx nx typecheck twenty-front` — PASS - [x] `npx jest ai-model admin agent-role` — 79/79 PASS - [x] `npx oxlint --type-aware` on 118 changed files — 0 errors - [x] `npx prettier --check` on 118 changed files — clean - [ ] CI --- .../src/metadata/generated/schema.graphql | 22 ++--- .../src/metadata/generated/schema.ts | 94 +++++++++---------- .../src/metadata/generated/types.ts | 14 +-- .../src/generated-metadata/graphql.ts | 46 ++++----- .../ai/components/AIChatErrorRenderer.tsx | 22 ----- .../AgentChatMessagesFetchEffect.tsx | 20 ++-- ...tomOnDisplayedThreadChangeLayoutEffect.tsx | 6 +- .../AgentChatStreamSubscriptionEffect.tsx | 20 ++-- .../AgentChatStreamingAutoScrollEffect.tsx | 10 +- .../AgentChatStreamingPartsDiffSyncEffect.tsx | 10 +- .../AgentChatThreadInitializationEffect.tsx | 20 ++-- ...x => AiChatApiKeyNotConfiguredMessage.tsx} | 6 +- ...tsx => AiChatAssistantMessageRenderer.tsx} | 6 +- .../{AIChatBanner.tsx => AiChatBanner.tsx} | 16 ++-- ...ator.tsx => AiChatCompactionIndicator.tsx} | 2 +- ....tsx => AiChatCreditsExhaustedMessage.tsx} | 6 +- ...torSection.tsx => AiChatEditorSection.tsx} | 26 ++--- ...hatEmptyState.tsx => AiChatEmptyState.tsx} | 16 ++-- ...rrorMessage.tsx => AiChatErrorMessage.tsx} | 8 +- .../ai/components/AiChatErrorRenderer.tsx | 22 +++++ ...st.tsx => AiChatErrorUnderMessageList.tsx} | 6 +- ...> AiChatLastMessageWithStreamingState.tsx} | 6 +- .../{AIChatMessage.tsx => AiChatMessage.tsx} | 18 ++-- ...st.tsx => AiChatNonLastMessageIdsList.tsx} | 6 +- ...dMessages.tsx => AiChatQueuedMessages.tsx} | 10 +- ...ton.tsx => AiChatScrollToBottomButton.tsx} | 6 +- ...oneError.tsx => AiChatStandaloneError.tsx} | 12 +-- .../{AIChatTab.tsx => AiChatTab.tsx} | 24 ++--- ...ssageList.tsx => AiChatTabMessageList.tsx} | 18 ++-- ...tThreadGroup.tsx => AiChatThreadGroup.tsx} | 6 +- ...tThreadsList.tsx => AiChatThreadsList.tsx} | 18 ++-- ...t.tsx => AiChatThreadsListFocusEffect.tsx} | 2 +- ....tsx => NavigationDrawerAiChatContent.tsx} | 20 ++-- ...vigationDrawerAiChatThreadDateSection.tsx} | 6 +- ....stories.tsx => AiChatMessage.stories.tsx} | 34 +++---- ...> AiChatAssistantMessageRenderer.test.tsx} | 6 +- .../internal/AgentChatFileUploadButton.tsx | 4 +- ...utton.tsx => AiChatContextUsageButton.tsx} | 8 +- ...Effect.tsx => AiChatEditorFocusEffect.tsx} | 6 +- ...tonLoader.tsx => AiChatSkeletonLoader.tsx} | 8 +- .../components/internal/SendMessageButton.tsx | 6 +- ...Prompts.tsx => AiChatSuggestedPrompts.tsx} | 6 +- ...ploadAIChatFile.ts => uploadAiChatFile.ts} | 4 +- .../src/modules/ai/hooks/useAgentChat.ts | 14 +-- .../ai/hooks/useAgentChatSubscription.ts | 4 +- ...{useAIChatEditor.ts => useAiChatEditor.ts} | 8 +- ...atFileUpload.ts => useAiChatFileUpload.ts} | 4 +- ...ThreadClick.ts => useAiChatThreadClick.ts} | 30 +++--- .../ai/hooks/useCreateAgentChatThread.ts | 8 +- .../useEnsureAgentChatThreadExistsForDraft.ts | 4 +- .../useEnsureAgentChatThreadIdForSend.ts | 4 +- ...ToNewAIChat.ts => useSwitchToNewAiChat.ts} | 20 ++-- .../agentChatErrorComponentFamilyState.ts | 4 +- ...adState.ts => currentAiChatThreadState.ts} | 4 +- ...tAiChatThreadTitleComponentFamilyState.ts} | 4 +- .../types/{AIChatError.ts => AiChatError.ts} | 2 +- .../src/modules/ai/utils/aiChatErrorCode.ts | 2 +- ...hatToBottom.ts => scrollAiChatToBottom.ts} | 2 +- .../modules/app/components/SettingsRoutes.tsx | 30 +++--- ...EngineComponentKeyHeadlessComponentMap.tsx | 2 +- .../hooks/useCommandMenuHotKeys.ts | 8 +- .../components/MainNavigationDrawer.tsx | 4 +- .../MainNavigationDrawerTabsRow.tsx | 4 +- .../components/MobileNavigationBar.tsx | 8 +- .../hooks/useSettingsNavigationItems.tsx | 4 +- ...gsRolePermissionsObjectLevelObjectForm.tsx | 4 +- .../useActionRolePermissionFlagConfig.ts | 6 +- .../useSettingsRolePermissionFlagConfig.ts | 6 +- ...elAskAIInfo.tsx => SidePanelAskAiInfo.tsx} | 16 ++-- .../components/SidePanelPageInfo.tsx | 8 +- .../SidePanelTopBarRightCornerIcon.tsx | 10 +- .../constants/SidePanelPagesConfig.tsx | 8 +- ...x => useOpenAskAiPageInSidePanel.test.tsx} | 16 ++-- ...anel.ts => useOpenAskAiPageInSidePanel.ts} | 6 +- ...age.tsx => SidePanelAiChatThreadsPage.tsx} | 6 +- ...elAskAIPage.tsx => SidePanelAskAiPage.tsx} | 6 +- .../components/WorkflowStepFooter.tsx | 2 +- ...Preview.ts => getAiSystemPromptPreview.ts} | 4 +- .../SettingsAdminNewAiProvider.tsx | 12 +-- .../src/pages/settings/ai/SettingsAI.tsx | 14 +-- .../settings/ai/SettingsAgentTurnDetail.tsx | 8 +- ...ngsAIPrompts.tsx => SettingsAiPrompts.tsx} | 4 +- ...tail.tsx => SettingsAiUsageUserDetail.tsx} | 2 +- .../ai/components/SettingsAgentLogsTab.tsx | 2 +- .../ai/components/SettingsAgentRoleTab.tsx | 8 +- .../components/SettingsAgentSettingsTab.tsx | 8 +- .../components/SettingsAgentSkillsTable.tsx | 2 +- ...bleRow.tsx => SettingsAiAgentTableRow.tsx} | 6 +- ...ntsTable.tsx => SettingsAiAgentsTable.tsx} | 20 ++-- .../{SettingsAIMCP.tsx => SettingsAiMCP.tsx} | 2 +- ...IModelsTab.tsx => SettingsAiModelsTab.tsx} | 2 +- ...ngsAIMoreTab.tsx => SettingsAiMoreTab.tsx} | 10 +- ...sAIUsageTab.tsx => SettingsAiUsageTab.tsx} | 4 +- .../ai/components/SettingsToolsTable.tsx | 2 +- .../constants/SettingsAiAgentTableMetadata.ts | 2 +- ...IAgentForm.tsx => SettingsAiAgentForm.tsx} | 14 +-- .../ai/hooks/useSettingsAgentFormState.ts | 16 ++-- ...Schema.ts => settingsAiAgentFormSchema.ts} | 6 +- .../SettingsApplicationDetailContentTab.tsx | 4 +- .../roles/SettingsRoleAddObjectLevel.tsx | 2 +- .../admin-panel/admin-panel.resolver.ts | 6 +- .../client-config/client-config.entity.ts | 16 ++-- .../services/client-config.service.ts | 4 +- .../file/file-ai-chat/file-ai-chat.module.ts | 10 +- .../resolvers/file-ai-chat.resolver.ts | 10 +- .../services/file-ai-chat.service.ts | 2 +- .../engine/core-modules/file/file.module.ts | 6 +- .../metrics/types/metrics-keys.type.ts | 4 +- .../providers/native-model-tool.provider.ts | 6 +- .../services/agent-async-executor.service.ts | 8 +- .../utils/compute-cost-breakdown.util.ts | 4 +- .../dtos/ai-system-prompt-preview.dto.ts | 12 +-- .../ai/ai-chat/jobs/stream-agent-chat.job.ts | 6 +- .../ai-chat/resolvers/agent-chat.resolver.ts | 6 +- .../services/chat-execution.service.ts | 8 +- .../ai-generate-text.controller.ts | 2 +- ...xt-input.dto.ts => generate-text.input.ts} | 0 .../ai/ai-models/ai-models.module.ts | 6 +- ....service.ts => ai-model-config.service.ts} | 12 +-- .../services/ai-model-registry.service.ts | 40 ++++---- .../services/sdk-provider-factory.service.ts | 4 +- .../ai-models/types/ai-model-config.type.ts | 3 +- packages/twenty-shared/src/ai/index.ts | 4 +- .../src/ai/types/ExtendedUIMessage.ts | 8 +- .../twenty-shared/src/types/SettingsPath.ts | 16 ++-- .../twenty-shared/src/types/SidePanelPages.ts | 2 +- 126 files changed, 629 insertions(+), 630 deletions(-) delete mode 100644 packages/twenty-front/src/modules/ai/components/AIChatErrorRenderer.tsx rename packages/twenty-front/src/modules/ai/components/{AIChatApiKeyNotConfiguredMessage.tsx => AiChatApiKeyNotConfiguredMessage.tsx} (80%) rename packages/twenty-front/src/modules/ai/components/{AIChatAssistantMessageRenderer.tsx => AiChatAssistantMessageRenderer.tsx} (96%) rename packages/twenty-front/src/modules/ai/components/{AIChatBanner.tsx => AiChatBanner.tsx} (87%) rename packages/twenty-front/src/modules/ai/components/{AIChatCompactionIndicator.tsx => AiChatCompactionIndicator.tsx} (94%) rename packages/twenty-front/src/modules/ai/components/{AIChatCreditsExhaustedMessage.tsx => AiChatCreditsExhaustedMessage.tsx} (91%) rename packages/twenty-front/src/modules/ai/components/{AIChatEditorSection.tsx => AiChatEditorSection.tsx} (86%) rename packages/twenty-front/src/modules/ai/components/{AIChatEmptyState.tsx => AiChatEmptyState.tsx} (81%) rename packages/twenty-front/src/modules/ai/components/{AIChatErrorMessage.tsx => AiChatErrorMessage.tsx} (91%) create mode 100644 packages/twenty-front/src/modules/ai/components/AiChatErrorRenderer.tsx rename packages/twenty-front/src/modules/ai/components/{AIChatErrorUnderMessageList.tsx => AiChatErrorUnderMessageList.tsx} (92%) rename packages/twenty-front/src/modules/ai/components/{AIChatLastMessageWithStreamingState.tsx => AiChatLastMessageWithStreamingState.tsx} (91%) rename packages/twenty-front/src/modules/ai/components/{AIChatMessage.tsx => AiChatMessage.tsx} (93%) rename packages/twenty-front/src/modules/ai/components/{AIChatNonLastMessageIdsList.tsx => AiChatNonLastMessageIdsList.tsx} (70%) rename packages/twenty-front/src/modules/ai/components/{AIChatQueuedMessages.tsx => AiChatQueuedMessages.tsx} (90%) rename packages/twenty-front/src/modules/ai/components/{AIChatScrollToBottomButton.tsx => AiChatScrollToBottomButton.tsx} (91%) rename packages/twenty-front/src/modules/ai/components/{AIChatStandaloneError.tsx => AiChatStandaloneError.tsx} (81%) rename packages/twenty-front/src/modules/ai/components/{AIChatTab.tsx => AiChatTab.tsx} (71%) rename packages/twenty-front/src/modules/ai/components/{AIChatTabMessageList.tsx => AiChatTabMessageList.tsx} (78%) rename packages/twenty-front/src/modules/ai/components/{AIChatThreadGroup.tsx => AiChatThreadGroup.tsx} (94%) rename packages/twenty-front/src/modules/ai/components/{AIChatThreadsList.tsx => AiChatThreadsList.tsx} (82%) rename packages/twenty-front/src/modules/ai/components/{AIChatThreadsListFocusEffect.tsx => AiChatThreadsListFocusEffect.tsx} (95%) rename packages/twenty-front/src/modules/ai/components/{NavigationDrawerAIChatContent.tsx => NavigationDrawerAiChatContent.tsx} (78%) rename packages/twenty-front/src/modules/ai/components/{NavigationDrawerAIChatThreadDateSection.tsx => NavigationDrawerAiChatThreadDateSection.tsx} (93%) rename packages/twenty-front/src/modules/ai/components/__stories__/{AIChatMessage.stories.tsx => AiChatMessage.stories.tsx} (90%) rename packages/twenty-front/src/modules/ai/components/__tests__/{AIChatAssistantMessageRenderer.test.tsx => AiChatAssistantMessageRenderer.test.tsx} (97%) rename packages/twenty-front/src/modules/ai/components/internal/{AIChatContextUsageButton.tsx => AiChatContextUsageButton.tsx} (97%) rename packages/twenty-front/src/modules/ai/components/internal/{AIChatEditorFocusEffect.tsx => AiChatEditorFocusEffect.tsx} (86%) rename packages/twenty-front/src/modules/ai/components/internal/{AIChatSkeletonLoader.tsx => AiChatSkeletonLoader.tsx} (92%) rename packages/twenty-front/src/modules/ai/components/suggested-prompts/{AIChatSuggestedPrompts.tsx => AiChatSuggestedPrompts.tsx} (95%) rename packages/twenty-front/src/modules/ai/graphql/mutations/{uploadAIChatFile.ts => uploadAiChatFile.ts} (64%) rename packages/twenty-front/src/modules/ai/hooks/{useAIChatEditor.ts => useAiChatEditor.ts} (96%) rename packages/twenty-front/src/modules/ai/hooks/{useAIChatFileUpload.ts => useAiChatFileUpload.ts} (96%) rename packages/twenty-front/src/modules/ai/hooks/{useAIChatThreadClick.ts => useAiChatThreadClick.ts} (75%) rename packages/twenty-front/src/modules/ai/hooks/{useSwitchToNewAIChat.ts => useSwitchToNewAiChat.ts} (73%) rename packages/twenty-front/src/modules/ai/states/{currentAIChatThreadState.ts => currentAiChatThreadState.ts} (54%) rename packages/twenty-front/src/modules/ai/states/{currentAIChatThreadTitleComponentFamilyState.ts => currentAiChatThreadTitleComponentFamilyState.ts} (76%) rename packages/twenty-front/src/modules/ai/types/{AIChatError.ts => AiChatError.ts} (54%) rename packages/twenty-front/src/modules/ai/utils/{scrollAIChatToBottom.ts => scrollAiChatToBottom.ts} (87%) rename packages/twenty-front/src/modules/side-panel/components/{SidePanelAskAIInfo.tsx => SidePanelAskAiInfo.tsx} (60%) rename packages/twenty-front/src/modules/side-panel/hooks/__tests__/{useOpenAskAIPageInSidePanel.test.tsx => useOpenAskAiPageInSidePanel.test.tsx} (80%) rename packages/twenty-front/src/modules/side-panel/hooks/{useOpenAskAIPageInSidePanel.ts => useOpenAskAiPageInSidePanel.ts} (91%) rename packages/twenty-front/src/modules/side-panel/pages/ai-chat-threads/components/{SidePanelAIChatThreadsPage.tsx => SidePanelAiChatThreadsPage.tsx} (56%) rename packages/twenty-front/src/modules/side-panel/pages/ask-ai/components/{SidePanelAskAIPage.tsx => SidePanelAskAiPage.tsx} (60%) rename packages/twenty-front/src/modules/workspace/graphql/queries/{getAISystemPromptPreview.ts => getAiSystemPromptPreview.ts} (76%) rename packages/twenty-front/src/pages/settings/ai/{SettingsAIPrompts.tsx => SettingsAiPrompts.tsx} (98%) rename packages/twenty-front/src/pages/settings/ai/{SettingsAIUsageUserDetail.tsx => SettingsAiUsageUserDetail.tsx} (98%) rename packages/twenty-front/src/pages/settings/ai/components/{SettingsAIAgentTableRow.tsx => SettingsAiAgentTableRow.tsx} (93%) rename packages/twenty-front/src/pages/settings/ai/components/{SettingsAIAgentsTable.tsx => SettingsAiAgentsTable.tsx} (90%) rename packages/twenty-front/src/pages/settings/ai/components/{SettingsAIMCP.tsx => SettingsAiMCP.tsx} (99%) rename packages/twenty-front/src/pages/settings/ai/components/{SettingsAIModelsTab.tsx => SettingsAiModelsTab.tsx} (99%) rename packages/twenty-front/src/pages/settings/ai/components/{SettingsAIMoreTab.tsx => SettingsAiMoreTab.tsx} (94%) rename packages/twenty-front/src/pages/settings/ai/components/{SettingsAIUsageTab.tsx => SettingsAiUsageTab.tsx} (97%) rename packages/twenty-front/src/pages/settings/ai/forms/components/{SettingsAIAgentForm.tsx => SettingsAiAgentForm.tsx} (93%) rename packages/twenty-front/src/pages/settings/ai/validation-schemas/{settingsAIAgentFormSchema.ts => settingsAiAgentFormSchema.ts} (88%) rename packages/twenty-server/src/engine/metadata-modules/ai/ai-generate-text/dtos/{generate-text-input.dto.ts => generate-text.input.ts} (100%) rename packages/twenty-server/src/engine/metadata-modules/ai/ai-models/services/{agent-model-config.service.ts => ai-model-config.service.ts} (94%) diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql index 6ae8f3aff6..6f6dffadd3 100644 --- a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql +++ b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql @@ -1743,7 +1743,7 @@ type NativeModelCapabilities { twitterSearch: Boolean } -type ClientAIModelConfig { +type ClientAiModelConfig { modelId: String! label: String! modelFamily: ModelFamily @@ -1769,7 +1769,7 @@ enum ModelFamily { GROK } -type AdminAIModelConfig { +type AdminAiModelConfig { modelId: String! label: String! modelFamily: ModelFamily @@ -1789,8 +1789,8 @@ type AdminAIModelConfig { dataResidency: String } -type AdminAIModels { - models: [AdminAIModelConfig!]! +type AdminAiModels { + models: [AdminAiModelConfig!]! defaultSmartModelId: String defaultFastModelId: String } @@ -1852,7 +1852,7 @@ type ClientConfig { appVersion: String authProviders: AuthProviders! billing: Billing! - aiModels: [ClientAIModelConfig!]! + aiModels: [ClientAiModelConfig!]! signInPrefilled: Boolean! isMultiWorkspaceEnabled: Boolean! isEmailVerificationRequired: Boolean! @@ -2957,14 +2957,14 @@ type AgentMessage { createdAt: DateTime! } -type AISystemPromptSection { +type AiSystemPromptSection { title: String! content: String! estimatedTokenCount: Int! } -type AISystemPromptPreview { - sections: [AISystemPromptSection!]! +type AiSystemPromptPreview { + sections: [AiSystemPromptSection!]! estimatedTokenCount: Int! } @@ -3319,7 +3319,7 @@ type Query { chatThread(id: UUID!): AgentChatThread! chatMessages(threadId: UUID!): [AgentMessage!]! chatStreamCatchupChunks(threadId: UUID!): ChatStreamCatchupChunks! - getAISystemPromptPreview: AISystemPromptPreview! + getAiSystemPromptPreview: AiSystemPromptPreview! skills: [Skill!]! skill(id: UUID!): Skill chatThreads( @@ -3364,7 +3364,7 @@ type Query { getIndicatorHealthStatus(indicatorId: HealthIndicatorId!): AdminPanelHealthServiceData! getQueueMetrics(queueName: String!, timeRange: QueueMetricsTimeRange = OneHour): QueueMetricsData! versionInfo: VersionInfo! - getAdminAiModels: AdminAIModels! + getAdminAiModels: AdminAiModels! getDatabaseConfigVariable(key: String!): ConfigVariable! getQueueJobs(queueName: String!, state: JobState!, limit: Int = 50, offset: Int = 0): QueueJobsResponse! findAllApplicationRegistrations: [ApplicationRegistration!]! @@ -3519,7 +3519,7 @@ type Mutation { deleteManyNavigationMenuItems(ids: [UUID!]!): [NavigationMenuItem!]! deleteNavigationMenuItem(id: UUID!): NavigationMenuItem! uploadEmailAttachmentFile(file: Upload!): FileWithSignedUrl! - uploadAIChatFile(file: Upload!): FileWithSignedUrl! + uploadAiChatFile(file: Upload!): FileWithSignedUrl! uploadWorkflowFile(file: Upload!): FileWithSignedUrl! uploadWorkspaceLogo(file: Upload!): FileWithSignedUrl! uploadWorkspaceMemberProfilePicture(file: Upload!): FileWithSignedUrl! diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.ts b/packages/twenty-client-sdk/src/metadata/generated/schema.ts index 4039c25d4c..85e66f50be 100644 --- a/packages/twenty-client-sdk/src/metadata/generated/schema.ts +++ b/packages/twenty-client-sdk/src/metadata/generated/schema.ts @@ -1444,7 +1444,7 @@ export interface NativeModelCapabilities { __typename: 'NativeModelCapabilities' } -export interface ClientAIModelConfig { +export interface ClientAiModelConfig { modelId: Scalars['String'] label: Scalars['String'] modelFamily?: ModelFamily @@ -1460,12 +1460,12 @@ export interface ClientAIModelConfig { contextWindowTokens?: Scalars['Float'] maxOutputTokens?: Scalars['Float'] dataResidency?: Scalars['String'] - __typename: 'ClientAIModelConfig' + __typename: 'ClientAiModelConfig' } export type ModelFamily = 'GPT' | 'CLAUDE' | 'GEMINI' | 'MISTRAL' | 'GROK' -export interface AdminAIModelConfig { +export interface AdminAiModelConfig { modelId: Scalars['String'] label: Scalars['String'] modelFamily?: ModelFamily @@ -1483,14 +1483,14 @@ export interface AdminAIModelConfig { providerLabel?: Scalars['String'] name?: Scalars['String'] dataResidency?: Scalars['String'] - __typename: 'AdminAIModelConfig' + __typename: 'AdminAiModelConfig' } -export interface AdminAIModels { - models: AdminAIModelConfig[] +export interface AdminAiModels { + models: AdminAiModelConfig[] defaultSmartModelId?: Scalars['String'] defaultFastModelId?: Scalars['String'] - __typename: 'AdminAIModels' + __typename: 'AdminAiModels' } export interface Billing { @@ -1552,7 +1552,7 @@ export interface ClientConfig { appVersion?: Scalars['String'] authProviders: AuthProviders billing: Billing - aiModels: ClientAIModelConfig[] + aiModels: ClientAiModelConfig[] signInPrefilled: Scalars['Boolean'] isMultiWorkspaceEnabled: Scalars['Boolean'] isEmailVerificationRequired: Scalars['Boolean'] @@ -2628,17 +2628,17 @@ export interface AgentMessage { __typename: 'AgentMessage' } -export interface AISystemPromptSection { +export interface AiSystemPromptSection { title: Scalars['String'] content: Scalars['String'] estimatedTokenCount: Scalars['Int'] - __typename: 'AISystemPromptSection' + __typename: 'AiSystemPromptSection' } -export interface AISystemPromptPreview { - sections: AISystemPromptSection[] +export interface AiSystemPromptPreview { + sections: AiSystemPromptSection[] estimatedTokenCount: Scalars['Int'] - __typename: 'AISystemPromptPreview' + __typename: 'AiSystemPromptPreview' } export interface ChatStreamCatchupChunks { @@ -2891,7 +2891,7 @@ export interface Query { chatThread: AgentChatThread chatMessages: AgentMessage[] chatStreamCatchupChunks: ChatStreamCatchupChunks - getAISystemPromptPreview: AISystemPromptPreview + getAiSystemPromptPreview: AiSystemPromptPreview skills: Skill[] skill?: Skill chatThreads: AgentChatThreadConnection @@ -2927,7 +2927,7 @@ export interface Query { getIndicatorHealthStatus: AdminPanelHealthServiceData getQueueMetrics: QueueMetricsData versionInfo: VersionInfo - getAdminAiModels: AdminAIModels + getAdminAiModels: AdminAiModels getDatabaseConfigVariable: ConfigVariable getQueueJobs: QueueJobsResponse findAllApplicationRegistrations: ApplicationRegistration[] @@ -2975,7 +2975,7 @@ export interface Mutation { deleteManyNavigationMenuItems: NavigationMenuItem[] deleteNavigationMenuItem: NavigationMenuItem uploadEmailAttachmentFile: FileWithSignedUrl - uploadAIChatFile: FileWithSignedUrl + uploadAiChatFile: FileWithSignedUrl uploadWorkflowFile: FileWithSignedUrl uploadWorkspaceLogo: FileWithSignedUrl uploadWorkspaceMemberProfilePicture: FileWithSignedUrl @@ -4706,7 +4706,7 @@ export interface NativeModelCapabilitiesGenqlSelection{ __scalar?: boolean | number } -export interface ClientAIModelConfigGenqlSelection{ +export interface ClientAiModelConfigGenqlSelection{ modelId?: boolean | number label?: boolean | number modelFamily?: boolean | number @@ -4726,7 +4726,7 @@ export interface ClientAIModelConfigGenqlSelection{ __scalar?: boolean | number } -export interface AdminAIModelConfigGenqlSelection{ +export interface AdminAiModelConfigGenqlSelection{ modelId?: boolean | number label?: boolean | number modelFamily?: boolean | number @@ -4748,8 +4748,8 @@ export interface AdminAIModelConfigGenqlSelection{ __scalar?: boolean | number } -export interface AdminAIModelsGenqlSelection{ - models?: AdminAIModelConfigGenqlSelection +export interface AdminAiModelsGenqlSelection{ + models?: AdminAiModelConfigGenqlSelection defaultSmartModelId?: boolean | number defaultFastModelId?: boolean | number __typename?: boolean | number @@ -4819,7 +4819,7 @@ export interface ClientConfigGenqlSelection{ appVersion?: boolean | number authProviders?: AuthProvidersGenqlSelection billing?: BillingGenqlSelection - aiModels?: ClientAIModelConfigGenqlSelection + aiModels?: ClientAiModelConfigGenqlSelection signInPrefilled?: boolean | number isMultiWorkspaceEnabled?: boolean | number isEmailVerificationRequired?: boolean | number @@ -5993,7 +5993,7 @@ export interface AgentMessageGenqlSelection{ __scalar?: boolean | number } -export interface AISystemPromptSectionGenqlSelection{ +export interface AiSystemPromptSectionGenqlSelection{ title?: boolean | number content?: boolean | number estimatedTokenCount?: boolean | number @@ -6001,8 +6001,8 @@ export interface AISystemPromptSectionGenqlSelection{ __scalar?: boolean | number } -export interface AISystemPromptPreviewGenqlSelection{ - sections?: AISystemPromptSectionGenqlSelection +export interface AiSystemPromptPreviewGenqlSelection{ + sections?: AiSystemPromptSectionGenqlSelection estimatedTokenCount?: boolean | number __typename?: boolean | number __scalar?: boolean | number @@ -6265,7 +6265,7 @@ export interface QueryGenqlSelection{ chatThread?: (AgentChatThreadGenqlSelection & { __args: {id: Scalars['UUID']} }) chatMessages?: (AgentMessageGenqlSelection & { __args: {threadId: Scalars['UUID']} }) chatStreamCatchupChunks?: (ChatStreamCatchupChunksGenqlSelection & { __args: {threadId: Scalars['UUID']} }) - getAISystemPromptPreview?: AISystemPromptPreviewGenqlSelection + getAiSystemPromptPreview?: AiSystemPromptPreviewGenqlSelection skills?: SkillGenqlSelection skill?: (SkillGenqlSelection & { __args: {id: Scalars['UUID']} }) chatThreads?: (AgentChatThreadConnectionGenqlSelection & { __args: { @@ -6307,7 +6307,7 @@ export interface QueryGenqlSelection{ getIndicatorHealthStatus?: (AdminPanelHealthServiceDataGenqlSelection & { __args: {indicatorId: HealthIndicatorId} }) getQueueMetrics?: (QueueMetricsDataGenqlSelection & { __args: {queueName: Scalars['String'], timeRange?: (QueueMetricsTimeRange | null)} }) versionInfo?: VersionInfoGenqlSelection - getAdminAiModels?: AdminAIModelsGenqlSelection + getAdminAiModels?: AdminAiModelsGenqlSelection getDatabaseConfigVariable?: (ConfigVariableGenqlSelection & { __args: {key: Scalars['String']} }) getQueueJobs?: (QueueJobsResponseGenqlSelection & { __args: {queueName: Scalars['String'], state: JobState, limit?: (Scalars['Int'] | null), offset?: (Scalars['Int'] | null)} }) findAllApplicationRegistrations?: ApplicationRegistrationGenqlSelection @@ -6374,7 +6374,7 @@ export interface MutationGenqlSelection{ deleteManyNavigationMenuItems?: (NavigationMenuItemGenqlSelection & { __args: {ids: Scalars['UUID'][]} }) deleteNavigationMenuItem?: (NavigationMenuItemGenqlSelection & { __args: {id: Scalars['UUID']} }) uploadEmailAttachmentFile?: (FileWithSignedUrlGenqlSelection & { __args: {file: Scalars['Upload']} }) - uploadAIChatFile?: (FileWithSignedUrlGenqlSelection & { __args: {file: Scalars['Upload']} }) + uploadAiChatFile?: (FileWithSignedUrlGenqlSelection & { __args: {file: Scalars['Upload']} }) uploadWorkflowFile?: (FileWithSignedUrlGenqlSelection & { __args: {file: Scalars['Upload']} }) uploadWorkspaceLogo?: (FileWithSignedUrlGenqlSelection & { __args: {file: Scalars['Upload']} }) uploadWorkspaceMemberProfilePicture?: (FileWithSignedUrlGenqlSelection & { __args: {file: Scalars['Upload']} }) @@ -7887,26 +7887,26 @@ export interface LogicFunctionLogsInput {applicationId?: (Scalars['UUID'] | null - const ClientAIModelConfig_possibleTypes: string[] = ['ClientAIModelConfig'] - export const isClientAIModelConfig = (obj?: { __typename?: any } | null): obj is ClientAIModelConfig => { - if (!obj?.__typename) throw new Error('__typename is missing in "isClientAIModelConfig"') - return ClientAIModelConfig_possibleTypes.includes(obj.__typename) + const ClientAiModelConfig_possibleTypes: string[] = ['ClientAiModelConfig'] + export const isClientAiModelConfig = (obj?: { __typename?: any } | null): obj is ClientAiModelConfig => { + if (!obj?.__typename) throw new Error('__typename is missing in "isClientAiModelConfig"') + return ClientAiModelConfig_possibleTypes.includes(obj.__typename) } - const AdminAIModelConfig_possibleTypes: string[] = ['AdminAIModelConfig'] - export const isAdminAIModelConfig = (obj?: { __typename?: any } | null): obj is AdminAIModelConfig => { - if (!obj?.__typename) throw new Error('__typename is missing in "isAdminAIModelConfig"') - return AdminAIModelConfig_possibleTypes.includes(obj.__typename) + const AdminAiModelConfig_possibleTypes: string[] = ['AdminAiModelConfig'] + export const isAdminAiModelConfig = (obj?: { __typename?: any } | null): obj is AdminAiModelConfig => { + if (!obj?.__typename) throw new Error('__typename is missing in "isAdminAiModelConfig"') + return AdminAiModelConfig_possibleTypes.includes(obj.__typename) } - const AdminAIModels_possibleTypes: string[] = ['AdminAIModels'] - export const isAdminAIModels = (obj?: { __typename?: any } | null): obj is AdminAIModels => { - if (!obj?.__typename) throw new Error('__typename is missing in "isAdminAIModels"') - return AdminAIModels_possibleTypes.includes(obj.__typename) + const AdminAiModels_possibleTypes: string[] = ['AdminAiModels'] + export const isAdminAiModels = (obj?: { __typename?: any } | null): obj is AdminAiModels => { + if (!obj?.__typename) throw new Error('__typename is missing in "isAdminAiModels"') + return AdminAiModels_possibleTypes.includes(obj.__typename) } @@ -8975,18 +8975,18 @@ export interface LogicFunctionLogsInput {applicationId?: (Scalars['UUID'] | null - const AISystemPromptSection_possibleTypes: string[] = ['AISystemPromptSection'] - export const isAISystemPromptSection = (obj?: { __typename?: any } | null): obj is AISystemPromptSection => { - if (!obj?.__typename) throw new Error('__typename is missing in "isAISystemPromptSection"') - return AISystemPromptSection_possibleTypes.includes(obj.__typename) + const AiSystemPromptSection_possibleTypes: string[] = ['AiSystemPromptSection'] + export const isAiSystemPromptSection = (obj?: { __typename?: any } | null): obj is AiSystemPromptSection => { + if (!obj?.__typename) throw new Error('__typename is missing in "isAiSystemPromptSection"') + return AiSystemPromptSection_possibleTypes.includes(obj.__typename) } - const AISystemPromptPreview_possibleTypes: string[] = ['AISystemPromptPreview'] - export const isAISystemPromptPreview = (obj?: { __typename?: any } | null): obj is AISystemPromptPreview => { - if (!obj?.__typename) throw new Error('__typename is missing in "isAISystemPromptPreview"') - return AISystemPromptPreview_possibleTypes.includes(obj.__typename) + const AiSystemPromptPreview_possibleTypes: string[] = ['AiSystemPromptPreview'] + export const isAiSystemPromptPreview = (obj?: { __typename?: any } | null): obj is AiSystemPromptPreview => { + if (!obj?.__typename) throw new Error('__typename is missing in "isAiSystemPromptPreview"') + return AiSystemPromptPreview_possibleTypes.includes(obj.__typename) } diff --git a/packages/twenty-client-sdk/src/metadata/generated/types.ts b/packages/twenty-client-sdk/src/metadata/generated/types.ts index b4b2649e97..a12d7f83b6 100644 --- a/packages/twenty-client-sdk/src/metadata/generated/types.ts +++ b/packages/twenty-client-sdk/src/metadata/generated/types.ts @@ -3506,7 +3506,7 @@ export default { 1 ] }, - "ClientAIModelConfig": { + "ClientAiModelConfig": { "modelId": [ 1 ], @@ -3557,7 +3557,7 @@ export default { ] }, "ModelFamily": {}, - "AdminAIModelConfig": { + "AdminAiModelConfig": { "modelId": [ 1 ], @@ -3613,7 +3613,7 @@ export default { 1 ] }, - "AdminAIModels": { + "AdminAiModels": { "models": [ 181 ], @@ -5936,7 +5936,7 @@ export default { 1 ] }, - "AISystemPromptSection": { + "AiSystemPromptSection": { "title": [ 1 ], @@ -5950,7 +5950,7 @@ export default { 1 ] }, - "AISystemPromptPreview": { + "AiSystemPromptPreview": { "sections": [ 331 ], @@ -6810,7 +6810,7 @@ export default { ] } ], - "getAISystemPromptPreview": [ + "getAiSystemPromptPreview": [ 332 ], "skills": [ @@ -7544,7 +7544,7 @@ export default { ] } ], - "uploadAIChatFile": [ + "uploadAiChatFile": [ 118, { "file": [ diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.ts index 8e345a73e7..e2362bd4a7 100644 --- a/packages/twenty-front/src/generated-metadata/graphql.ts +++ b/packages/twenty-front/src/generated-metadata/graphql.ts @@ -19,19 +19,6 @@ export type Scalars = { Upload: any; }; -export type AiSystemPromptPreview = { - __typename?: 'AISystemPromptPreview'; - estimatedTokenCount: Scalars['Int']; - sections: Array; -}; - -export type AiSystemPromptSection = { - __typename?: 'AISystemPromptSection'; - content: Scalars['String']; - estimatedTokenCount: Scalars['Int']; - title: Scalars['String']; -}; - export type ActivateWorkspaceInput = { displayName?: InputMaybe; }; @@ -43,7 +30,7 @@ export type AddQuerySubscriptionInput = { }; export type AdminAiModelConfig = { - __typename?: 'AdminAIModelConfig'; + __typename?: 'AdminAiModelConfig'; contextWindowTokens?: Maybe; dataResidency?: Maybe; inputCostPerMillionTokens?: Maybe; @@ -64,7 +51,7 @@ export type AdminAiModelConfig = { }; export type AdminAiModels = { - __typename?: 'AdminAIModels'; + __typename?: 'AdminAiModels'; defaultFastModelId?: Maybe; defaultSmartModelId?: Maybe; models: Array; @@ -328,6 +315,19 @@ export enum AiModelRole { SMART = 'SMART' } +export type AiSystemPromptPreview = { + __typename?: 'AiSystemPromptPreview'; + estimatedTokenCount: Scalars['Int']; + sections: Array; +}; + +export type AiSystemPromptSection = { + __typename?: 'AiSystemPromptSection'; + content: Scalars['String']; + estimatedTokenCount: Scalars['Int']; + title: Scalars['String']; +}; + export enum AllMetadataName { agent = 'agent', commandMenuItem = 'commandMenuItem', @@ -924,7 +924,7 @@ export type CheckUserExist = { }; export type ClientAiModelConfig = { - __typename?: 'ClientAIModelConfig'; + __typename?: 'ClientAiModelConfig'; contextWindowTokens?: Maybe; dataResidency?: Maybe; inputCostPerMillionTokens?: Maybe; @@ -2792,7 +2792,7 @@ export type Mutation = { updateWorkspaceMemberRole: WorkspaceMember; updateWorkspaceMemberSettings: Scalars['Boolean']; upgradeApplication: Scalars['Boolean']; - uploadAIChatFile: FileWithSignedUrl; + uploadAiChatFile: FileWithSignedUrl; uploadAppTarball: ApplicationRegistration; uploadApplicationFile: File; uploadEmailAttachmentFile: FileWithSignedUrl; @@ -4441,13 +4441,13 @@ export type Query = { findWorkspaceInvitations: Array; frontComponent?: Maybe; frontComponents: Array; - getAISystemPromptPreview: AiSystemPromptPreview; getAddressDetails: PlaceDetailsResult; getAdminAiModels: AdminAiModels; getAdminAiUsageByWorkspace: Array; getAdminChatThreadMessages: AdminChatThreadMessages; getAdminWorkspaceChatThreads: Array; getAiProviders: Scalars['JSON']; + getAiSystemPromptPreview: AiSystemPromptPreview; getApprovedAccessDomains: Array; getAutoCompleteAddress: Array; getAvailablePackages: Scalars['JSON']; @@ -6636,7 +6636,7 @@ export type UploadAiChatFileMutationVariables = Exact<{ }>; -export type UploadAiChatFileMutation = { __typename?: 'Mutation', uploadAIChatFile: { __typename?: 'FileWithSignedUrl', id: string, path: string, size: number, createdAt: string, url: string } }; +export type UploadAiChatFileMutation = { __typename?: 'Mutation', uploadAiChatFile: { __typename?: 'FileWithSignedUrl', id: string, path: string, size: number, createdAt: string, url: string } }; export type FindManyAgentsQueryVariables = Exact<{ [key: string]: never; }>; @@ -7462,7 +7462,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', 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 GetAdminAiUsageByWorkspaceQueryVariables = Exact<{ periodStart?: InputMaybe; @@ -8589,7 +8589,7 @@ export type CheckCustomDomainValidRecordsMutation = { __typename?: 'Mutation', c export type GetAiSystemPromptPreviewQueryVariables = Exact<{ [key: string]: never; }>; -export type GetAiSystemPromptPreviewQuery = { __typename?: 'Query', getAISystemPromptPreview: { __typename?: 'AISystemPromptPreview', estimatedTokenCount: number, sections: Array<{ __typename?: 'AISystemPromptSection', title: string, content: string, estimatedTokenCount: number }> } }; +export type GetAiSystemPromptPreviewQuery = { __typename?: 'Query', getAiSystemPromptPreview: { __typename?: 'AiSystemPromptPreview', estimatedTokenCount: number, sections: Array<{ __typename?: 'AiSystemPromptSection', title: string, content: string, estimatedTokenCount: number }> } }; export type GetPublicWorkspaceDataByIdQueryVariables = Exact<{ id: Scalars['UUID']; @@ -8670,7 +8670,7 @@ export const SendChatMessageDocument = {"kind":"Document","definitions":[{"kind" export const StopAgentChatStreamDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"StopAgentChatStream"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"stopAgentChatStream"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}]}]}}]} as unknown as DocumentNode; export const UpdateOneAgentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateOneAgent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateAgentInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateOneAgent"},"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":"AgentFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"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":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"evaluationInputs"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; export const UpdateSkillDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateSkill"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateSkillInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateSkill"},"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":"SkillFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SkillFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Skill"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"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":"content"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; -export const UploadAiChatFileDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"uploadAIChatFile"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"file"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Upload"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"uploadAIChatFile"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"file"},"value":{"kind":"Variable","name":{"kind":"Name","value":"file"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"path"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]} as unknown as DocumentNode; +export const UploadAiChatFileDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"uploadAiChatFile"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"file"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Upload"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"uploadAiChatFile"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"file"},"value":{"kind":"Variable","name":{"kind":"Name","value":"file"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"path"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]} as unknown as DocumentNode; export const FindManyAgentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindManyAgents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findManyAgents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"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":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"evaluationInputs"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; export const FindManySkillsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindManySkills"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"skills"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SkillFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SkillFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Skill"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"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":"content"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; export const FindOneAgentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneAgent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneAgent"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"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":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"evaluationInputs"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; @@ -8939,6 +8939,6 @@ export const DeleteCurrentWorkspaceDocument = {"kind":"Document","definitions":[ export const UpdateWorkspaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateWorkspace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateWorkspaceInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateWorkspace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"customDomain"}},{"kind":"Field","name":{"kind":"Name","value":"subdomain"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"allowImpersonation"}},{"kind":"Field","name":{"kind":"Name","value":"isPublicInviteLinkEnabled"}},{"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":"isTwoFactorAuthenticationEnforced"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRole"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RoleFragment"}}]}}]}}]}},{"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; export const UploadWorkspaceLogoDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UploadWorkspaceLogo"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"file"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Upload"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"uploadWorkspaceLogo"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"file"},"value":{"kind":"Variable","name":{"kind":"Name","value":"file"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]} as unknown as DocumentNode; export const CheckCustomDomainValidRecordsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CheckCustomDomainValidRecords"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"checkCustomDomainValidRecords"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"domain"}},{"kind":"Field","name":{"kind":"Name","value":"records"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"validationType"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetAiSystemPromptPreviewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAISystemPromptPreview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getAISystemPromptPreview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTokenCount"}}]}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTokenCount"}}]}}]}}]} as unknown as DocumentNode; +export const GetAiSystemPromptPreviewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAiSystemPromptPreview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getAiSystemPromptPreview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTokenCount"}}]}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTokenCount"}}]}}]}}]} as unknown as DocumentNode; export const GetPublicWorkspaceDataByIdDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPublicWorkspaceDataById"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getPublicWorkspaceDataById"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"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"}}]}}]}}]} as unknown as DocumentNode; export const GetWorkspaceFromInviteHashDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspaceFromInviteHash"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"inviteHash"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findWorkspaceFromInviteHash"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"inviteHash"},"value":{"kind":"Variable","name":{"kind":"Name","value":"inviteHash"}}}],"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":"allowImpersonation"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/packages/twenty-front/src/modules/ai/components/AIChatErrorRenderer.tsx b/packages/twenty-front/src/modules/ai/components/AIChatErrorRenderer.tsx deleted file mode 100644 index b5ead539a9..0000000000 --- a/packages/twenty-front/src/modules/ai/components/AIChatErrorRenderer.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { AIChatApiKeyNotConfiguredMessage } from '@/ai/components/AIChatApiKeyNotConfiguredMessage'; -import { AIChatCreditsExhaustedMessage } from '@/ai/components/AIChatCreditsExhaustedMessage'; -import { AIChatErrorMessage } from '@/ai/components/AIChatErrorMessage'; -import { type AIChatError } from '@/ai/types/AIChatError'; -import { AIChatErrorCode } from '@/ai/utils/aiChatErrorCode'; -import { isGraphqlErrorOfType } from '~/utils/is-graphql-error-of-type.util'; - -type AIChatErrorRendererProps = { - error: AIChatError; -}; - -export const AIChatErrorRenderer = ({ error }: AIChatErrorRendererProps) => { - if (isGraphqlErrorOfType(error, AIChatErrorCode.BILLING_CREDITS_EXHAUSTED)) { - return ; - } - - if (isGraphqlErrorOfType(error, AIChatErrorCode.API_KEY_NOT_CONFIGURED)) { - return ; - } - - return ; -}; diff --git a/packages/twenty-front/src/modules/ai/components/AgentChatMessagesFetchEffect.tsx b/packages/twenty-front/src/modules/ai/components/AgentChatMessagesFetchEffect.tsx index 65591bdc04..6671fa5c1e 100644 --- a/packages/twenty-front/src/modules/ai/components/AgentChatMessagesFetchEffect.tsx +++ b/packages/twenty-front/src/modules/ai/components/AgentChatMessagesFetchEffect.tsx @@ -10,7 +10,7 @@ import { AGENT_CHAT_NEW_THREAD_DRAFT_KEY } from '@/ai/states/agentChatDraftsByTh import { agentChatFetchedMessagesComponentFamilyState } from '@/ai/states/agentChatFetchedMessagesComponentFamilyState'; import { agentChatMessagesLoadingState } from '@/ai/states/agentChatMessagesLoadingState'; import { agentChatQueuedMessagesComponentFamilyState } from '@/ai/states/agentChatQueuedMessagesComponentFamilyState'; -import { currentAIChatThreadState } from '@/ai/states/currentAIChatThreadState'; +import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState'; import { skipMessagesSkeletonUntilLoadedState } from '@/ai/states/skipMessagesSkeletonUntilLoadedState'; import { mapDBMessagesToUIMessages } from '@/ai/utils/mapDBMessagesToUIMessages'; import { useQueryWithCallbacks } from '@/apollo/hooks/useQueryWithCallbacks'; @@ -26,13 +26,13 @@ import { export const AgentChatMessagesFetchEffect = () => { const store = useStore(); - const currentAIChatThread = useAtomStateValue(currentAIChatThreadState); + const currentAiChatThread = useAtomStateValue(currentAiChatThreadState); const isNewThread = useMemo( () => - currentAIChatThread === null || - currentAIChatThread === AGENT_CHAT_NEW_THREAD_DRAFT_KEY, - [currentAIChatThread], + currentAiChatThread === null || + currentAiChatThread === AGENT_CHAT_NEW_THREAD_DRAFT_KEY, + [currentAiChatThread], ); const setAgentChatMessagesLoading = useSetAtomState( @@ -45,12 +45,12 @@ export const AgentChatMessagesFetchEffect = () => { const setAgentChatFetchedMessages = useSetAtomComponentFamilyState( agentChatFetchedMessagesComponentFamilyState, - { threadId: currentAIChatThread }, + { threadId: currentAiChatThread }, ); const setAgentChatQueuedMessages = useSetAtomComponentFamilyState( agentChatQueuedMessagesComponentFamilyState, - { threadId: currentAIChatThread }, + { threadId: currentAiChatThread }, ); const handleEventCallbackFamilyCallback = @@ -84,7 +84,7 @@ export const AgentChatMessagesFetchEffect = () => { return; } - const threadId = store.get(currentAIChatThreadState.atom); + const threadId = store.get(currentAiChatThreadState.atom); if (!isDefined(threadId)) { return; @@ -135,8 +135,8 @@ export const AgentChatMessagesFetchEffect = () => { const { refetch: refetchAgentChatMessages } = useQueryWithCallbacks( GetChatMessagesDocument, { - variables: { threadId: currentAIChatThread ?? '' }, - skip: !isDefined(currentAIChatThread) || isNewThread, + variables: { threadId: currentAiChatThread ?? '' }, + skip: !isDefined(currentAiChatThread) || isNewThread, onFirstLoad: handleFirstLoad, onDataLoaded: handleDataLoaded, onLoadingChange: handleLoadingChange, diff --git a/packages/twenty-front/src/modules/ai/components/AgentChatScrollToBottomOnDisplayedThreadChangeLayoutEffect.tsx b/packages/twenty-front/src/modules/ai/components/AgentChatScrollToBottomOnDisplayedThreadChangeLayoutEffect.tsx index ce9d288b94..2d70d2dbb5 100644 --- a/packages/twenty-front/src/modules/ai/components/AgentChatScrollToBottomOnDisplayedThreadChangeLayoutEffect.tsx +++ b/packages/twenty-front/src/modules/ai/components/AgentChatScrollToBottomOnDisplayedThreadChangeLayoutEffect.tsx @@ -1,6 +1,6 @@ import { AI_CHAT_SCROLL_WRAPPER_ID } from '@/ai/constants/AiChatScrollWrapperId'; import { agentChatIsInitialScrollPendingOnThreadChangeState } from '@/ai/states/agentChatIsInitialScrollPendingOnThreadChangeState'; -import { scrollAIChatToBottom } from '@/ai/utils/scrollAIChatToBottom'; +import { scrollAiChatToBottom } from '@/ai/utils/scrollAiChatToBottom'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useEffect } from 'react'; @@ -37,10 +37,10 @@ export const AgentChatScrollToBottomOnDisplayedThreadChangeLayoutEffect = clearTimeout(settleTimeoutId); } - scrollAIChatToBottom(); + scrollAiChatToBottom(); settleTimeoutId = setTimeout(() => { - scrollAIChatToBottom(); + scrollAiChatToBottom(); setAgentChatIsInitialScrollPendingOnThreadChange(false); mutationObserver.disconnect(); }, SCROLL_SETTLE_DELAY_MS); diff --git a/packages/twenty-front/src/modules/ai/components/AgentChatStreamSubscriptionEffect.tsx b/packages/twenty-front/src/modules/ai/components/AgentChatStreamSubscriptionEffect.tsx index dc5f3d8b8c..aecb63d8cd 100644 --- a/packages/twenty-front/src/modules/ai/components/AgentChatStreamSubscriptionEffect.tsx +++ b/packages/twenty-front/src/modules/ai/components/AgentChatStreamSubscriptionEffect.tsx @@ -15,7 +15,7 @@ import { agentChatIsStreamingComponentFamilyState } from '@/ai/states/agentChatI import { agentChatMessagesComponentFamilyState } from '@/ai/states/agentChatMessagesComponentFamilyState'; import { agentChatMessagesLoadingState } from '@/ai/states/agentChatMessagesLoadingState'; import { agentChatThreadsLoadingState } from '@/ai/states/agentChatThreadsLoadingState'; -import { currentAIChatThreadState } from '@/ai/states/currentAIChatThreadState'; +import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState'; import { useListenToBrowserEvent } from '@/browser-event/hooks/useListenToBrowserEvent'; import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; @@ -23,7 +23,7 @@ import { useSetAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const AgentChatStreamSubscriptionEffect = () => { - const currentAIChatThread = useAtomStateValue(currentAIChatThreadState); + const currentAiChatThread = useAtomStateValue(currentAiChatThreadState); const { createChatThread } = useCreateAgentChatThread(); @@ -41,25 +41,25 @@ export const AgentChatStreamSubscriptionEffect = () => { useAgentChat(ensureThreadIdForSend); const subscriptionThreadId = - currentAIChatThread !== null && isValidUuid(currentAIChatThread) - ? currentAIChatThread + currentAiChatThread !== null && isValidUuid(currentAiChatThread) + ? currentAiChatThread : null; useAgentChatSubscription(subscriptionThreadId); const agentChatFetchedMessages = useAtomComponentFamilyStateValue( agentChatFetchedMessagesComponentFamilyState, - { threadId: currentAIChatThread }, + { threadId: currentAiChatThread }, ); const setAgentChatMessages = useSetAtomComponentFamilyState( agentChatMessagesComponentFamilyState, - { threadId: currentAIChatThread }, + { threadId: currentAiChatThread }, ); const agentChatIsStreaming = useAtomComponentFamilyStateValue( agentChatIsStreamingComponentFamilyState, - { threadId: currentAIChatThread }, + { threadId: currentAiChatThread }, ); const agentChatDisplayedThread = useAtomStateValue( @@ -81,17 +81,17 @@ export const AgentChatStreamSubscriptionEffect = () => { setAgentChatMessages(agentChatFetchedMessages); - if (currentAIChatThread !== agentChatDisplayedThread) { + if (currentAiChatThread !== agentChatDisplayedThread) { if (agentChatFetchedMessages.length > 0) { setAgentChatIsInitialScrollPendingOnThreadChange(true); } - setAgentChatDisplayedThread(currentAIChatThread); + setAgentChatDisplayedThread(currentAiChatThread); } }, [ agentChatFetchedMessages, agentChatIsStreaming, setAgentChatMessages, - currentAIChatThread, + currentAiChatThread, agentChatDisplayedThread, setAgentChatDisplayedThread, setAgentChatIsInitialScrollPendingOnThreadChange, diff --git a/packages/twenty-front/src/modules/ai/components/AgentChatStreamingAutoScrollEffect.tsx b/packages/twenty-front/src/modules/ai/components/AgentChatStreamingAutoScrollEffect.tsx index 54538b154c..196937ebf9 100644 --- a/packages/twenty-front/src/modules/ai/components/AgentChatStreamingAutoScrollEffect.tsx +++ b/packages/twenty-front/src/modules/ai/components/AgentChatStreamingAutoScrollEffect.tsx @@ -1,17 +1,17 @@ import { agentChatIsScrolledToBottomSelector } from '@/ai/states/agentChatIsScrolledToBottomSelector'; import { agentChatMessagesComponentFamilyState } from '@/ai/states/agentChatMessagesComponentFamilyState'; -import { currentAIChatThreadState } from '@/ai/states/currentAIChatThreadState'; -import { scrollAIChatToBottom } from '@/ai/utils/scrollAIChatToBottom'; +import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState'; +import { scrollAiChatToBottom } from '@/ai/utils/scrollAiChatToBottom'; import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useEffect } from 'react'; export const AgentChatStreamingAutoScrollEffect = () => { - const currentAIChatThread = useAtomStateValue(currentAIChatThreadState); + const currentAiChatThread = useAtomStateValue(currentAiChatThreadState); const agentChatMessages = useAtomComponentFamilyStateValue( agentChatMessagesComponentFamilyState, - { threadId: currentAIChatThread }, + { threadId: currentAiChatThread }, ); const agentChatIsScrolledToBottom = useAtomStateValue( @@ -24,7 +24,7 @@ export const AgentChatStreamingAutoScrollEffect = () => { } if (agentChatIsScrolledToBottom) { - scrollAIChatToBottom(); + scrollAiChatToBottom(); } }, [agentChatMessages, agentChatIsScrolledToBottom]); diff --git a/packages/twenty-front/src/modules/ai/components/AgentChatStreamingPartsDiffSyncEffect.tsx b/packages/twenty-front/src/modules/ai/components/AgentChatStreamingPartsDiffSyncEffect.tsx index 7761ab11ec..32ae92f24a 100644 --- a/packages/twenty-front/src/modules/ai/components/AgentChatStreamingPartsDiffSyncEffect.tsx +++ b/packages/twenty-front/src/modules/ai/components/AgentChatStreamingPartsDiffSyncEffect.tsx @@ -1,18 +1,18 @@ import { useUpdateStreamingPartsWithDiff } from '@/ai/hooks/useUpdateStreamingPartsWithDiff'; import { agentChatLastDiffSyncedThreadState } from '@/ai/states/agentChatLastDiffSyncedThreadState'; import { agentChatMessagesComponentFamilyState } from '@/ai/states/agentChatMessagesComponentFamilyState'; -import { currentAIChatThreadState } from '@/ai/states/currentAIChatThreadState'; +import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState'; import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useEffect } from 'react'; export const AgentChatStreamingPartsDiffSyncEffect = () => { - const currentAIChatThread = useAtomStateValue(currentAIChatThreadState); + const currentAiChatThread = useAtomStateValue(currentAiChatThreadState); const agentChatMessages = useAtomComponentFamilyStateValue( agentChatMessagesComponentFamilyState, - { threadId: currentAIChatThread }, + { threadId: currentAiChatThread }, ); const { updateStreamingPartsWithDiff } = useUpdateStreamingPartsWithDiff(); @@ -27,11 +27,11 @@ export const AgentChatStreamingPartsDiffSyncEffect = () => { } updateStreamingPartsWithDiff(agentChatMessages); - setAgentChatLastDiffSyncedThread(currentAIChatThread); + setAgentChatLastDiffSyncedThread(currentAiChatThread); }, [ agentChatMessages, updateStreamingPartsWithDiff, - currentAIChatThread, + currentAiChatThread, setAgentChatLastDiffSyncedThread, ]); diff --git a/packages/twenty-front/src/modules/ai/components/AgentChatThreadInitializationEffect.tsx b/packages/twenty-front/src/modules/ai/components/AgentChatThreadInitializationEffect.tsx index 4bbda19c93..50e601032f 100644 --- a/packages/twenty-front/src/modules/ai/components/AgentChatThreadInitializationEffect.tsx +++ b/packages/twenty-front/src/modules/ai/components/AgentChatThreadInitializationEffect.tsx @@ -10,8 +10,8 @@ import { agentChatInputState } from '@/ai/states/agentChatInputState'; import { agentChatThreadsLoadingState } from '@/ai/states/agentChatThreadsLoadingState'; import { agentChatThreadsSelector } from '@/ai/states/agentChatThreadsSelector'; import { agentChatUsageComponentFamilyState } from '@/ai/states/agentChatUsageComponentFamilyState'; -import { currentAIChatThreadState } from '@/ai/states/currentAIChatThreadState'; -import { currentAIChatThreadTitleComponentFamilyState } from '@/ai/states/currentAIChatThreadTitleComponentFamilyState'; +import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState'; +import { currentAiChatThreadTitleComponentFamilyState } from '@/ai/states/currentAiChatThreadTitleComponentFamilyState'; import { hasInitializedAgentChatThreadsState } from '@/ai/states/hasInitializedAgentChatThreadsState'; import { hasTriggeredCreateForDraftState } from '@/ai/states/hasTriggeredCreateForDraftState'; import { useUpdateMetadataStoreDraft } from '@/metadata-store/hooks/useUpdateMetadataStoreDraft'; @@ -35,14 +35,14 @@ export const AgentChatThreadInitializationEffect = () => { PermissionFlagType.AI_SETTINGS, ); - const currentAIChatThread = useAtomStateValue(currentAIChatThreadState); - const setCurrentAIChatThread = useSetAtomState(currentAIChatThreadState); + const currentAiChatThread = useAtomStateValue(currentAiChatThreadState); + const setCurrentAiChatThread = useSetAtomState(currentAiChatThreadState); const setAgentChatInput = useSetAtomState(agentChatInputState); const setAgentChatThreadsLoading = useSetAtomState( agentChatThreadsLoadingState, ); const threadTitleFamilyCallback = useAtomComponentFamilyStateCallbackState( - currentAIChatThreadTitleComponentFamilyState, + currentAiChatThreadTitleComponentFamilyState, ); const agentChatUsageFamilyCallback = useAtomComponentFamilyStateCallbackState( agentChatUsageComponentFamilyState, @@ -93,7 +93,7 @@ export const AgentChatThreadInitializationEffect = () => { useEffect(() => { if ( hasInitializedAgentChatThreads || - (currentAIChatThread !== null && isValidUuid(currentAIChatThread)) + (currentAiChatThread !== null && isValidUuid(currentAiChatThread)) ) { return; } @@ -114,7 +114,7 @@ export const AgentChatThreadInitializationEffect = () => { const draftForThread = store.get(agentChatDraftsByThreadIdState.atom)[firstThread.id] ?? ''; - setCurrentAIChatThread(firstThread.id); + setCurrentAiChatThread(firstThread.id); setAgentChatInput(draftForThread); const firstThreadFamilyKey = { threadId: firstThread.id }; @@ -144,7 +144,7 @@ export const AgentChatThreadInitializationEffect = () => { ); } else { store.set(hasTriggeredCreateForDraftState.atom, false); - setCurrentAIChatThread(AGENT_CHAT_NEW_THREAD_DRAFT_KEY); + setCurrentAiChatThread(AGENT_CHAT_NEW_THREAD_DRAFT_KEY); setAgentChatInput( store.get(agentChatDraftsByThreadIdState.atom)[ AGENT_CHAT_NEW_THREAD_DRAFT_KEY @@ -153,12 +153,12 @@ export const AgentChatThreadInitializationEffect = () => { } }, [ agentChatThreads, - currentAIChatThread, + currentAiChatThread, hasAiSettingsPermission, hasInitializedAgentChatThreads, setHasInitializedAgentChatThreads, storeEntry.status, - setCurrentAIChatThread, + setCurrentAiChatThread, setAgentChatInput, store, threadTitleFamilyCallback, diff --git a/packages/twenty-front/src/modules/ai/components/AIChatApiKeyNotConfiguredMessage.tsx b/packages/twenty-front/src/modules/ai/components/AiChatApiKeyNotConfiguredMessage.tsx similarity index 80% rename from packages/twenty-front/src/modules/ai/components/AIChatApiKeyNotConfiguredMessage.tsx rename to packages/twenty-front/src/modules/ai/components/AiChatApiKeyNotConfiguredMessage.tsx index df26fc7954..3c32900ad4 100644 --- a/packages/twenty-front/src/modules/ai/components/AIChatApiKeyNotConfiguredMessage.tsx +++ b/packages/twenty-front/src/modules/ai/components/AiChatApiKeyNotConfiguredMessage.tsx @@ -1,17 +1,17 @@ -import { AIChatBanner } from '@/ai/components/AIChatBanner'; +import { AiChatBanner } from '@/ai/components/AiChatBanner'; import { t } from '@lingui/core/macro'; import { IconExternalLink } from 'twenty-ui/display'; const DOCS_URL = 'https://twenty.com/developers/section/self-hosting/self-hosting-var#ai-features'; -export const AIChatApiKeyNotConfiguredMessage = () => { +export const AiChatApiKeyNotConfiguredMessage = () => { const handleDocsClick = () => { window.open(DOCS_URL, '_blank', 'noopener,noreferrer'); }; return ( - ; case 'data-compaction': - return ; + return ; case 'data-code-execution': return ( ` +const StyledBanner = styled.div<{ variant: AiChatBannerVariant }>` align-items: center; background-color: ${({ variant }) => variant === 'warning' @@ -25,7 +25,7 @@ const StyledBanner = styled.div<{ variant: AIChatBannerVariant }>` width: 100%; `; -const StyledIconContainer = styled.div<{ variant: AIChatBannerVariant }>` +const StyledIconContainer = styled.div<{ variant: AiChatBannerVariant }>` align-items: center; color: ${({ variant }) => variant === 'warning' @@ -38,7 +38,7 @@ const StyledIconContainer = styled.div<{ variant: AIChatBannerVariant }>` width: 16px; `; -const StyledMessage = styled.p<{ variant: AIChatBannerVariant }>` +const StyledMessage = styled.p<{ variant: AiChatBannerVariant }>` color: ${({ variant }) => variant === 'warning' ? themeCssVariables.color.orange @@ -53,9 +53,9 @@ const StyledMessage = styled.p<{ variant: AIChatBannerVariant }>` min-width: 0; `; -export type AIChatBannerProps = { +export type AiChatBannerProps = { message: string; - variant?: AIChatBannerVariant; + variant?: AiChatBannerVariant; tooltipMessage?: string; buttonTitle?: string; buttonIcon?: IconComponent; @@ -64,7 +64,7 @@ export type AIChatBannerProps = { isButtonLoading?: boolean; }; -export const AIChatBanner = ({ +export const AiChatBanner = ({ message, variant = 'default', tooltipMessage, @@ -73,7 +73,7 @@ export const AIChatBanner = ({ buttonOnClick, isButtonDisabled = false, isButtonLoading = false, -}: AIChatBannerProps) => { +}: AiChatBannerProps) => { const tooltipId = 'ai-chat-banner-tooltip'; return ( diff --git a/packages/twenty-front/src/modules/ai/components/AIChatCompactionIndicator.tsx b/packages/twenty-front/src/modules/ai/components/AiChatCompactionIndicator.tsx similarity index 94% rename from packages/twenty-front/src/modules/ai/components/AIChatCompactionIndicator.tsx rename to packages/twenty-front/src/modules/ai/components/AiChatCompactionIndicator.tsx index af900a4bc2..1d6b159ba1 100644 --- a/packages/twenty-front/src/modules/ai/components/AIChatCompactionIndicator.tsx +++ b/packages/twenty-front/src/modules/ai/components/AiChatCompactionIndicator.tsx @@ -16,7 +16,7 @@ const StyledIconTextContainer = styled.div` gap: ${themeCssVariables.spacing[1]}; `; -export const AIChatCompactionIndicator = () => { +export const AiChatCompactionIndicator = () => { const { theme } = useContext(ThemeContext); return ( diff --git a/packages/twenty-front/src/modules/ai/components/AIChatCreditsExhaustedMessage.tsx b/packages/twenty-front/src/modules/ai/components/AiChatCreditsExhaustedMessage.tsx similarity index 91% rename from packages/twenty-front/src/modules/ai/components/AIChatCreditsExhaustedMessage.tsx rename to packages/twenty-front/src/modules/ai/components/AiChatCreditsExhaustedMessage.tsx index c37e771fc2..4258c03e54 100644 --- a/packages/twenty-front/src/modules/ai/components/AIChatCreditsExhaustedMessage.tsx +++ b/packages/twenty-front/src/modules/ai/components/AiChatCreditsExhaustedMessage.tsx @@ -1,4 +1,4 @@ -import { AIChatBanner } from '@/ai/components/AIChatBanner'; +import { AiChatBanner } from '@/ai/components/AiChatBanner'; import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap'; import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus'; import { t } from '@lingui/core/macro'; @@ -10,7 +10,7 @@ import { } from '~/generated-metadata/graphql'; import { useNavigateSettings } from '~/hooks/useNavigateSettings'; -export const AIChatCreditsExhaustedMessage = () => { +export const AiChatCreditsExhaustedMessage = () => { const navigateSettings = useNavigateSettings(); const subscriptionStatus = useSubscriptionStatus(); @@ -32,7 +32,7 @@ export const AIChatCreditsExhaustedMessage = () => { const buttonTitle = isTrialing ? t`Subscribe Now` : t`Upgrade Plan`; return ( - { +export const AiChatEditorSection = () => { const isMobile = useIsMobile(); const { options, pinnedOption } = useAiModelOptions({ variant: 'pinned-default', @@ -123,14 +123,14 @@ export const AIChatEditorSection = () => { ); const { selectedModelId } = useAgentChatModelId(); - const { editor, handleSendAndClear } = useAIChatEditor(); + const { editor, handleSendAndClear } = useAiChatEditor(); return ( <> - - - - + + + + @@ -141,7 +141,7 @@ export const AIChatEditorSection = () => { - +