From df76ec7d6f2b8006c4501e2df0d0343524dbadfc Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Mon, 16 Oct 2023 15:25:56 -0700 Subject: [PATCH] tRCP: move client code to src/common/utils --- pages/_app.tsx | 2 +- src/apps/chat/editors/image-generate.ts | 2 +- src/apps/chat/trade/ExportChats.tsx | 2 +- src/apps/chat/trade/ImportChats.tsx | 2 +- src/apps/personas/YTPersonaCreator.tsx | 2 +- src/{modules/trpc => common/util}/trpc.client.ts | 0 src/modules/elevenlabs/useVoiceDropdown.tsx | 2 +- src/modules/google/search.client.ts | 3 ++- src/modules/llms/transports/streamChat.ts | 2 +- src/modules/llms/vendors/anthropic/AnthropicSourceSetup.tsx | 2 +- src/modules/llms/vendors/anthropic/anthropic.vendor.ts | 2 +- src/modules/llms/vendors/azure/AzureSourceSetup.tsx | 2 +- src/modules/llms/vendors/localai/LocalAISourceSetup.tsx | 2 +- src/modules/llms/vendors/oobabooga/OobaboogaSourceSetup.tsx | 2 +- src/modules/llms/vendors/openai/OpenAISourceSetup.tsx | 2 +- src/modules/llms/vendors/openai/openai.vendor.ts | 2 +- src/modules/llms/vendors/openrouter/OpenRouterSourceSetup.tsx | 2 +- src/modules/prodia/ProdiaSettings.tsx | 2 +- 18 files changed, 18 insertions(+), 17 deletions(-) rename src/{modules/trpc => common/util}/trpc.client.ts (100%) diff --git a/pages/_app.tsx b/pages/_app.tsx index 25c776226..52790345d 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -6,7 +6,7 @@ import { CacheProvider, EmotionCache } from '@emotion/react'; import { CssBaseline, CssVarsProvider } from '@mui/joy'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { apiQuery } from '~/modules/trpc/trpc.client'; +import { apiQuery } from '~/common/util/trpc.client'; import 'katex/dist/katex.min.css'; import '~/common/styles/CodePrism.css' diff --git a/src/apps/chat/editors/image-generate.ts b/src/apps/chat/editors/image-generate.ts index 7bc13c29a..bbb60ca28 100644 --- a/src/apps/chat/editors/image-generate.ts +++ b/src/apps/chat/editors/image-generate.ts @@ -1,4 +1,4 @@ -import { apiAsync } from '~/modules/trpc/trpc.client'; +import { apiAsync } from '~/common/util/trpc.client'; import { prodiaDefaultModelId } from '~/modules/prodia/prodia.models'; import { useProdiaStore } from '~/modules/prodia/store-prodia'; diff --git a/src/apps/chat/trade/ExportChats.tsx b/src/apps/chat/trade/ExportChats.tsx index 7ed36c33c..0af617ecd 100644 --- a/src/apps/chat/trade/ExportChats.tsx +++ b/src/apps/chat/trade/ExportChats.tsx @@ -4,7 +4,7 @@ import { Box, Button, Typography } from '@mui/joy'; import ExitToAppIcon from '@mui/icons-material/ExitToApp'; import FileDownloadIcon from '@mui/icons-material/FileDownload'; -import { apiAsync } from '~/modules/trpc/trpc.client'; +import { apiAsync } from '~/common/util/trpc.client'; import { Brand } from '~/common/brand'; import { ConfirmationModal } from '~/common/components/ConfirmationModal'; diff --git a/src/apps/chat/trade/ImportChats.tsx b/src/apps/chat/trade/ImportChats.tsx index 21d176c35..90ba8e13c 100644 --- a/src/apps/chat/trade/ImportChats.tsx +++ b/src/apps/chat/trade/ImportChats.tsx @@ -4,7 +4,7 @@ import { fileOpen, FileWithHandle } from 'browser-fs-access'; import { Box, Button, FormControl, FormLabel, Input, Sheet, Typography } from '@mui/joy'; import FileUploadIcon from '@mui/icons-material/FileUpload'; -import { apiAsync } from '~/modules/trpc/trpc.client'; +import { apiAsync } from '~/common/util/trpc.client'; import { Brand } from '~/common/brand'; import { InlineError } from '~/common/components/InlineError'; diff --git a/src/apps/personas/YTPersonaCreator.tsx b/src/apps/personas/YTPersonaCreator.tsx index 1868f3e23..7efc618c6 100644 --- a/src/apps/personas/YTPersonaCreator.tsx +++ b/src/apps/personas/YTPersonaCreator.tsx @@ -6,7 +6,7 @@ import ContentCopyIcon from '@mui/icons-material/ContentCopy'; import WhatshotIcon from '@mui/icons-material/Whatshot'; import YouTubeIcon from '@mui/icons-material/YouTube'; -import { apiQuery } from '~/modules/trpc/trpc.client'; +import { apiQuery } from '~/common/util/trpc.client'; import { useModelsStore } from '~/modules/llms/store-llms'; import { copyToClipboard } from '~/common/util/copyToClipboard'; diff --git a/src/modules/trpc/trpc.client.ts b/src/common/util/trpc.client.ts similarity index 100% rename from src/modules/trpc/trpc.client.ts rename to src/common/util/trpc.client.ts diff --git a/src/modules/elevenlabs/useVoiceDropdown.tsx b/src/modules/elevenlabs/useVoiceDropdown.tsx index c6ae9ddf1..d2a219ea9 100644 --- a/src/modules/elevenlabs/useVoiceDropdown.tsx +++ b/src/modules/elevenlabs/useVoiceDropdown.tsx @@ -5,7 +5,7 @@ import { CircularProgress, Option, Select } from '@mui/joy'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; import RecordVoiceOverIcon from '@mui/icons-material/RecordVoiceOver'; -import { apiQuery } from '~/modules/trpc/trpc.client'; +import { apiQuery } from '~/common/util/trpc.client'; import { playSoundUrl } from '~/common/util/audioUtils'; diff --git a/src/modules/google/search.client.ts b/src/modules/google/search.client.ts index 084944070..c930a58eb 100644 --- a/src/modules/google/search.client.ts +++ b/src/modules/google/search.client.ts @@ -1,7 +1,8 @@ import { useGoogleSearchStore } from '~/modules/google/store-google'; +import { apiAsync } from '~/common/util/trpc.client'; + import { Search } from './search.types'; -import { apiAsync } from '~/modules/trpc/trpc.client'; export const requireUserKeyGoogleCse = !process.env.HAS_SERVER_KEYS_GOOGLE_CSE; diff --git a/src/modules/llms/transports/streamChat.ts b/src/modules/llms/transports/streamChat.ts index e3d5354a3..da470e452 100644 --- a/src/modules/llms/transports/streamChat.ts +++ b/src/modules/llms/transports/streamChat.ts @@ -1,4 +1,4 @@ -import { apiAsync } from '~/modules/trpc/trpc.client'; +import { apiAsync } from '~/common/util/trpc.client'; import type { DLLM, DLLMId } from '../store-llms'; import { findVendorForLlmOrThrow } from '../vendors/vendor.registry'; diff --git a/src/modules/llms/vendors/anthropic/AnthropicSourceSetup.tsx b/src/modules/llms/vendors/anthropic/AnthropicSourceSetup.tsx index 72796c4c6..7edf3d82e 100644 --- a/src/modules/llms/vendors/anthropic/AnthropicSourceSetup.tsx +++ b/src/modules/llms/vendors/anthropic/AnthropicSourceSetup.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { Box, Button } from '@mui/joy'; import SyncIcon from '@mui/icons-material/Sync'; -import { apiQuery } from '~/modules/trpc/trpc.client'; +import { apiQuery } from '~/common/util/trpc.client'; import { FormInputKey } from '~/common/components/FormInputKey'; import { InlineError } from '~/common/components/InlineError'; diff --git a/src/modules/llms/vendors/anthropic/anthropic.vendor.ts b/src/modules/llms/vendors/anthropic/anthropic.vendor.ts index 85cfd66a2..494857f0b 100644 --- a/src/modules/llms/vendors/anthropic/anthropic.vendor.ts +++ b/src/modules/llms/vendors/anthropic/anthropic.vendor.ts @@ -1,4 +1,4 @@ -import { apiAsync } from '~/modules/trpc/trpc.client'; +import { apiAsync } from '~/common/util/trpc.client'; import { AnthropicIcon } from '~/common/components/icons/AnthropicIcon'; diff --git a/src/modules/llms/vendors/azure/AzureSourceSetup.tsx b/src/modules/llms/vendors/azure/AzureSourceSetup.tsx index 66374c842..4ee272416 100644 --- a/src/modules/llms/vendors/azure/AzureSourceSetup.tsx +++ b/src/modules/llms/vendors/azure/AzureSourceSetup.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { Alert, Box, Button, FormControl, FormLabel, Input, Typography } from '@mui/joy'; import SyncIcon from '@mui/icons-material/Sync'; -import { apiQuery } from '~/modules/trpc/trpc.client'; +import { apiQuery } from '~/common/util/trpc.client'; import { FormInputKey } from '~/common/components/FormInputKey'; import { Link } from '~/common/components/Link'; diff --git a/src/modules/llms/vendors/localai/LocalAISourceSetup.tsx b/src/modules/llms/vendors/localai/LocalAISourceSetup.tsx index c708620dd..9002b4688 100644 --- a/src/modules/llms/vendors/localai/LocalAISourceSetup.tsx +++ b/src/modules/llms/vendors/localai/LocalAISourceSetup.tsx @@ -5,7 +5,7 @@ import { Box, Button, Typography } from '@mui/joy'; import FileDownloadIcon from '@mui/icons-material/FileDownload'; import SyncIcon from '@mui/icons-material/Sync'; -import { apiQuery } from '~/modules/trpc/trpc.client'; +import { apiQuery } from '~/common/util/trpc.client'; import { FormInputKey } from '~/common/components/FormInputKey'; import { InlineError } from '~/common/components/InlineError'; diff --git a/src/modules/llms/vendors/oobabooga/OobaboogaSourceSetup.tsx b/src/modules/llms/vendors/oobabooga/OobaboogaSourceSetup.tsx index aa2d48e30..85b6a6d0d 100644 --- a/src/modules/llms/vendors/oobabooga/OobaboogaSourceSetup.tsx +++ b/src/modules/llms/vendors/oobabooga/OobaboogaSourceSetup.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { Alert, Box, Button, FormControl, FormHelperText, FormLabel, Input, Typography } from '@mui/joy'; import SyncIcon from '@mui/icons-material/Sync'; -import { apiQuery } from '~/modules/trpc/trpc.client'; +import { apiQuery } from '~/common/util/trpc.client'; import { InlineError } from '~/common/components/InlineError'; import { Link } from '~/common/components/Link'; diff --git a/src/modules/llms/vendors/openai/OpenAISourceSetup.tsx b/src/modules/llms/vendors/openai/OpenAISourceSetup.tsx index fd5da098c..92e7715f0 100644 --- a/src/modules/llms/vendors/openai/OpenAISourceSetup.tsx +++ b/src/modules/llms/vendors/openai/OpenAISourceSetup.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { Box, Button, FormControl, FormHelperText, FormLabel, Input, Switch } from '@mui/joy'; import SyncIcon from '@mui/icons-material/Sync'; -import { apiQuery } from '~/modules/trpc/trpc.client'; +import { apiQuery } from '~/common/util/trpc.client'; import { Brand } from '~/common/brand'; import { FormInputKey } from '~/common/components/FormInputKey'; diff --git a/src/modules/llms/vendors/openai/openai.vendor.ts b/src/modules/llms/vendors/openai/openai.vendor.ts index 43967e964..81cc4b4ab 100644 --- a/src/modules/llms/vendors/openai/openai.vendor.ts +++ b/src/modules/llms/vendors/openai/openai.vendor.ts @@ -1,4 +1,4 @@ -import { apiAsync } from '~/modules/trpc/trpc.client'; +import { apiAsync } from '~/common/util/trpc.client'; import { OpenAIIcon } from '~/common/components/icons/OpenAIIcon'; diff --git a/src/modules/llms/vendors/openrouter/OpenRouterSourceSetup.tsx b/src/modules/llms/vendors/openrouter/OpenRouterSourceSetup.tsx index 6417f3a51..0d28e03c3 100644 --- a/src/modules/llms/vendors/openrouter/OpenRouterSourceSetup.tsx +++ b/src/modules/llms/vendors/openrouter/OpenRouterSourceSetup.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { Box, Button, Typography } from '@mui/joy'; import SyncIcon from '@mui/icons-material/Sync'; -import { apiQuery } from '~/modules/trpc/trpc.client'; +import { apiQuery } from '~/common/util/trpc.client'; import { FormInputKey } from '~/common/components/FormInputKey'; import { InlineError } from '~/common/components/InlineError'; diff --git a/src/modules/prodia/ProdiaSettings.tsx b/src/modules/prodia/ProdiaSettings.tsx index 284d8a70d..ad9bd05bc 100644 --- a/src/modules/prodia/ProdiaSettings.tsx +++ b/src/modules/prodia/ProdiaSettings.tsx @@ -11,7 +11,7 @@ import StayPrimaryPortraitIcon from '@mui/icons-material/StayPrimaryPortrait'; import { FormInputKey } from '~/common/components/FormInputKey'; import { InlineError } from '~/common/components/InlineError'; -import { apiQuery } from '~/modules/trpc/trpc.client'; +import { apiQuery } from '~/common/util/trpc.client'; import { settingsGap } from '~/common/theme'; import { isValidProdiaApiKey, requireUserKeyProdia } from './prodia.client';