diff --git a/docs/self-hosting/advanced/feature-flags.mdx b/docs/self-hosting/advanced/feature-flags.mdx index 7a6e45f121512..727020038bd9f 100644 --- a/docs/self-hosting/advanced/feature-flags.mdx +++ b/docs/self-hosting/advanced/feature-flags.mdx @@ -49,7 +49,6 @@ You can achieve various feature combinations using the above configuration synta | `token_counter` | Reserved for token counter display. | Enabled | | `welcome_suggest` | Displays welcome suggestions. | Enabled | | `changelog` | Controls changelog modal/page display. | Enabled | -| `clerk_sign_up` | Enables the Clerk SignUp functionality. | Enabled | | `market` | Enables the assistant market functionality. | Enabled | | `knowledge_base` | Enables the knowledge base functionality. | Enabled | | `rag_eval` | Controls RAG evaluation feature (/repos/\[id]/evals). | Disabled | diff --git a/docs/self-hosting/advanced/feature-flags.zh-CN.mdx b/docs/self-hosting/advanced/feature-flags.zh-CN.mdx index e86bdce80755c..3966e3b44a5b6 100644 --- a/docs/self-hosting/advanced/feature-flags.zh-CN.mdx +++ b/docs/self-hosting/advanced/feature-flags.zh-CN.mdx @@ -46,7 +46,6 @@ tags: | `token_counter` | 保留用于令牌计数器显示。 | 开启 | | `welcome_suggest` | 显示欢迎建议。 | 开启 | | `changelog` | 控制更新日志弹窗 / 页面的显示。 | 开启 | -| `clerk_sign_up` | 启用 Clerk 注册功能。 | 开启 | | `market` | 启用助手市场功能。 | 开启 | | `knowledge_base` | 启用知识库功能。 | 开启 | | `rag_eval` | 控制 RAG 评估功能 (/repos/\[id]/evals)。 | 关闭 | diff --git a/packages/types/src/serverConfig.ts b/packages/types/src/serverConfig.ts index 9343d43d6e63e..b475b4669cca1 100644 --- a/packages/types/src/serverConfig.ts +++ b/packages/types/src/serverConfig.ts @@ -15,9 +15,9 @@ export interface ServerModelProviderConfig { enabledModels?: string[]; fetchOnClient?: boolean; /** - * the model cards defined in server + * the model lists defined in server */ - serverModelCards?: ChatModelCard[]; + serverModelLists?: ChatModelCard[]; } export type ServerLanguageModel = Partial>; @@ -32,10 +32,6 @@ export interface GlobalServerConfig { */ enabledOAuthSSO?: boolean; image?: PartialDeep; - /** - * @deprecated - */ - languageModel?: ServerLanguageModel; oAuthSSOProviders?: string[]; systemAgent?: PartialDeep; telemetry: { diff --git a/packages/utils/src/_deprecated/__snapshots__/parseModels.test.ts.snap b/packages/utils/src/_deprecated/__snapshots__/parseModels.test.ts.snap deleted file mode 100644 index 877e7c3afb826..0000000000000 --- a/packages/utils/src/_deprecated/__snapshots__/parseModels.test.ts.snap +++ /dev/null @@ -1,104 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`parseModelString > custom deletion, addition, and renaming of models 1`] = ` -{ - "add": [ - { - "displayName": undefined, - "id": "llama", - }, - { - "displayName": undefined, - "id": "claude-2", - }, - { - "displayName": "gpt-4-32k", - "id": "gpt-4-1106-preview", - }, - ], - "removeAll": true, - "removed": [ - "all", - "gpt-3.5-turbo", - ], -} -`; - -exports[`parseModelString > duplicate naming model 1`] = ` -{ - "add": [ - { - "displayName": "gpt-4-32k", - "id": "gpt-4-1106-preview", - }, - ], - "removeAll": false, - "removed": [], -} -`; - -exports[`parseModelString > empty string model 1`] = ` -{ - "add": [ - { - "displayName": "gpt-4-turbo", - "id": "gpt-4-1106-preview", - }, - { - "displayName": undefined, - "id": "claude-2", - }, - ], - "removeAll": false, - "removed": [], -} -`; - -exports[`parseModelString > only add the model 1`] = ` -{ - "add": [ - { - "displayName": undefined, - "id": "model1", - }, - { - "displayName": undefined, - "id": "model2", - }, - { - "displayName": undefined, - "id": "model3", - }, - { - "displayName": undefined, - "id": "model4", - }, - ], - "removeAll": false, - "removed": [], -} -`; - -exports[`transformToChatModelCards > should have file with builtin models like gpt-4-0125-preview 1`] = ` -[ - { - "contextWindowTokens": 128000, - "description": "最新的 GPT-4 Turbo 模型具备视觉功能。现在,视觉请求可以使用 JSON 模式和函数调用。 GPT-4 Turbo 是一个增强版本,为多模态任务提供成本效益高的支持。它在准确性和效率之间找到平衡,适合需要进行实时交互的应用程序场景。", - "displayName": "ChatGPT-4", - "enabled": true, - "files": true, - "functionCall": true, - "id": "gpt-4-0125-preview", - }, - { - "contextWindowTokens": 128000, - "description": "最新的 GPT-4 Turbo 模型具备视觉功能。现在,视觉请求可以使用 JSON 模式和函数调用。 GPT-4 Turbo 是一个增强版本,为多模态任务提供成本效益高的支持。它在准确性和效率之间找到平衡,适合需要进行实时交互的应用程序场景。", - "displayName": "ChatGPT-4 Vision", - "enabled": true, - "files": true, - "functionCall": true, - "id": "gpt-4-turbo-2024-04-09", - "vision": true, - }, -] -`; diff --git a/packages/utils/src/_deprecated/parseModels.test.ts b/packages/utils/src/_deprecated/parseModels.test.ts deleted file mode 100644 index 1eacdcb1b2063..0000000000000 --- a/packages/utils/src/_deprecated/parseModels.test.ts +++ /dev/null @@ -1,287 +0,0 @@ -import { ChatModelCard } from '@lobechat/types'; -import { describe, expect, it } from 'vitest'; - -import { LOBE_DEFAULT_MODEL_LIST, OpenAIProviderCard } from '@/config/modelProviders'; - -import { parseModelString, transformToChatModelCards } from './parseModels'; - -describe('parseModelString', () => { - it('custom deletion, addition, and renaming of models', () => { - const result = parseModelString( - '-all,+llama,+claude-2,-gpt-3.5-turbo,gpt-4-1106-preview=gpt-4-turbo,gpt-4-1106-preview=gpt-4-32k', - ); - - expect(result).toMatchSnapshot(); - }); - - it('duplicate naming model', () => { - const result = parseModelString('gpt-4-1106-preview=gpt-4-turbo,gpt-4-1106-preview=gpt-4-32k'); - expect(result).toMatchSnapshot(); - }); - - it('only add the model', () => { - const result = parseModelString('model1,model2,model3,model4'); - - expect(result).toMatchSnapshot(); - }); - - it('empty string model', () => { - const result = parseModelString('gpt-4-1106-preview=gpt-4-turbo,, ,\n ,+claude-2'); - expect(result).toMatchSnapshot(); - }); - - describe('extension capabilities', () => { - it('with token', () => { - const result = parseModelString('chatglm-6b=ChatGLM 6B<4096>'); - - expect(result.add[0]).toEqual({ - displayName: 'ChatGLM 6B', - id: 'chatglm-6b', - contextWindowTokens: 4096, - }); - }); - - it('token and function calling', () => { - const result = parseModelString('spark-v3.5=讯飞星火 v3.5<8192:fc>'); - - expect(result.add[0]).toEqual({ - displayName: '讯飞星火 v3.5', - functionCall: true, - id: 'spark-v3.5', - contextWindowTokens: 8192, - }); - }); - - it('token and reasoning', () => { - const result = parseModelString('deepseek-r1=Deepseek R1<65536:reasoning>'); - - expect(result.add[0]).toEqual({ - displayName: 'Deepseek R1', - reasoning: true, - id: 'deepseek-r1', - contextWindowTokens: 65_536, - }); - }); - - it('multi models', () => { - const result = parseModelString( - 'gemini-1.5-flash-latest=Gemini 1.5 Flash<16000:vision>,gpt-4-all=ChatGPT Plus<128000:fc:vision:file>', - ); - - expect(result.add).toEqual([ - { - displayName: 'Gemini 1.5 Flash', - vision: true, - id: 'gemini-1.5-flash-latest', - contextWindowTokens: 16000, - }, - { - displayName: 'ChatGPT Plus', - vision: true, - functionCall: true, - files: true, - id: 'gpt-4-all', - contextWindowTokens: 128000, - }, - ]); - }); - - it('should have file with builtin models like gpt-4-0125-preview', () => { - const result = parseModelString( - '-all,+gpt-4-0125-preview=ChatGPT-4<128000:fc:file>,+gpt-4-turbo-2024-04-09=ChatGPT-4 Vision<128000:fc:vision:file>', - ); - expect(result.add).toEqual([ - { - displayName: 'ChatGPT-4', - files: true, - functionCall: true, - id: 'gpt-4-0125-preview', - contextWindowTokens: 128000, - }, - { - displayName: 'ChatGPT-4 Vision', - files: true, - functionCall: true, - id: 'gpt-4-turbo-2024-04-09', - contextWindowTokens: 128000, - vision: true, - }, - ]); - }); - - it('should handle empty extension capability value', () => { - const result = parseModelString('model1<1024:>'); - expect(result.add[0]).toEqual({ id: 'model1', contextWindowTokens: 1024 }); - }); - - it('should handle empty extension capability name', () => { - const result = parseModelString('model1<1024::file>'); - expect(result.add[0]).toEqual({ id: 'model1', contextWindowTokens: 1024, files: true }); - }); - - it('should handle duplicate extension capabilities', () => { - const result = parseModelString('model1<1024:vision:vision>'); - expect(result.add[0]).toEqual({ id: 'model1', contextWindowTokens: 1024, vision: true }); - }); - - it('should handle case-sensitive extension capability names', () => { - const result = parseModelString('model1<1024:VISION:FC:file>'); - expect(result.add[0]).toEqual({ id: 'model1', contextWindowTokens: 1024, files: true }); - }); - - it('should handle case-sensitive extension capability values', () => { - const result = parseModelString('model1<1024:vision:Fc:File>'); - expect(result.add[0]).toEqual({ id: 'model1', contextWindowTokens: 1024, vision: true }); - }); - - it('should handle empty angle brackets', () => { - const result = parseModelString('model1<>'); - expect(result.add[0]).toEqual({ id: 'model1' }); - }); - - it('should handle not close angle brackets', () => { - const result = parseModelString('model1<,model2'); - expect(result.add).toEqual([{ id: 'model1' }, { id: 'model2' }]); - }); - - it('should handle multi close angle brackets', () => { - const result = parseModelString('model1<>>,model2'); - expect(result.add).toEqual([{ id: 'model1' }, { id: 'model2' }]); - }); - - it('should handle only colon inside angle brackets', () => { - const result = parseModelString('model1<:>'); - expect(result.add[0]).toEqual({ id: 'model1' }); - }); - - it('should handle only non-digit characters inside angle brackets', () => { - const result = parseModelString('model1'); - expect(result.add[0]).toEqual({ id: 'model1' }); - }); - - it('should handle non-digit characters followed by digits inside angle brackets', () => { - const result = parseModelString('model1'); - expect(result.add[0]).toEqual({ id: 'model1' }); - }); - - it('should handle digits followed by non-colon characters inside angle brackets', () => { - const result = parseModelString('model1<1024abc>'); - expect(result.add[0]).toEqual({ id: 'model1', contextWindowTokens: 1024 }); - }); - - it('should handle digits followed by multiple colons inside angle brackets', () => { - const result = parseModelString('model1<1024::>'); - expect(result.add[0]).toEqual({ id: 'model1', contextWindowTokens: 1024 }); - }); - - it('should handle digits followed by a colon and non-letter characters inside angle brackets', () => { - const result = parseModelString('model1<1024:123>'); - expect(result.add[0]).toEqual({ id: 'model1', contextWindowTokens: 1024 }); - }); - - it('should handle digits followed by a colon and spaces inside angle brackets', () => { - const result = parseModelString('model1<1024: vision>'); - expect(result.add[0]).toEqual({ id: 'model1', contextWindowTokens: 1024 }); - }); - - it('should handle digits followed by multiple colons and spaces inside angle brackets', () => { - const result = parseModelString('model1<1024: : vision>'); - expect(result.add[0]).toEqual({ id: 'model1', contextWindowTokens: 1024 }); - }); - }); - - describe('deployment name', () => { - it('should have same deployment name as id', () => { - const result = parseModelString('model1=Model 1', true); - expect(result.add[0]).toEqual({ - id: 'model1', - displayName: 'Model 1', - deploymentName: 'model1', - }); - }); - - it('should have diff deployment name as id', () => { - const result = parseModelString('gpt-35-turbo->my-deploy=GPT 3.5 Turbo', true); - expect(result.add[0]).toEqual({ - id: 'gpt-35-turbo', - displayName: 'GPT 3.5 Turbo', - deploymentName: 'my-deploy', - }); - }); - }); -}); - -describe('transformToChatModelCards', () => { - const defaultChatModels: ChatModelCard[] = [ - { id: 'model1', displayName: 'Model 1', enabled: true }, - { id: 'model2', displayName: 'Model 2', enabled: false }, - ]; - - it('should return undefined when modelString is empty', () => { - const result = transformToChatModelCards({ - modelString: '', - defaultChatModels, - }); - expect(result).toBeUndefined(); - }); - - it('should remove all models when removeAll is true', () => { - const result = transformToChatModelCards({ - modelString: '-all', - defaultChatModels, - }); - expect(result).toEqual([]); - }); - - it('should remove specified models', () => { - const result = transformToChatModelCards({ - modelString: '-model1', - defaultChatModels, - }); - expect(result).toEqual([{ id: 'model2', displayName: 'Model 2', enabled: false }]); - }); - - it('should add a new known model', () => { - const knownModel = LOBE_DEFAULT_MODEL_LIST[0]; - const result = transformToChatModelCards({ - modelString: `${knownModel.id}`, - defaultChatModels, - }); - expect(result).toContainEqual({ - ...knownModel, - displayName: knownModel.displayName || knownModel.id, - enabled: true, - }); - }); - - it('should update an existing known model', () => { - const knownModel = LOBE_DEFAULT_MODEL_LIST[0]; - const result = transformToChatModelCards({ - modelString: `+${knownModel.id}=Updated Model`, - defaultChatModels: [knownModel], - }); - expect(result![0]).toEqual({ ...knownModel, displayName: 'Updated Model', enabled: true }); - }); - - it('should add a new custom model', () => { - const result = transformToChatModelCards({ - modelString: '+custom_model=Custom Model', - defaultChatModels, - }); - expect(result).toContainEqual({ - id: 'custom_model', - displayName: 'Custom Model', - enabled: true, - }); - }); - - it('should have file with builtin models like gpt-4-0125-preview', () => { - const result = transformToChatModelCards({ - modelString: - '-all,+gpt-4-0125-preview=ChatGPT-4<128000:fc:file>,+gpt-4-turbo-2024-04-09=ChatGPT-4 Vision<128000:fc:vision:file>', - defaultChatModels: OpenAIProviderCard.chatModels, - }); - - expect(result).toMatchSnapshot(); - }); -}); diff --git a/packages/utils/src/_deprecated/parseModels.ts b/packages/utils/src/_deprecated/parseModels.ts deleted file mode 100644 index 803fc71030d48..0000000000000 --- a/packages/utils/src/_deprecated/parseModels.ts +++ /dev/null @@ -1,165 +0,0 @@ -import { ChatModelCard } from '@lobechat/types'; -import { produce } from 'immer'; - -import { LOBE_DEFAULT_MODEL_LIST } from '@/config/modelProviders'; - -/** - * Parse model string to add or remove models. - */ -export const parseModelString = (modelString: string = '', withDeploymentName = false) => { - let models: ChatModelCard[] = []; - let removeAll = false; - const removedModels: string[] = []; - const modelNames = modelString.split(/[,,]/).filter(Boolean); - - for (const item of modelNames) { - const disable = item.startsWith('-'); - const nameConfig = item.startsWith('+') || item.startsWith('-') ? item.slice(1) : item; - const [idAndDisplayName, ...capabilities] = nameConfig.split('<'); - let [id, displayName] = idAndDisplayName.split('='); - - let deploymentName: string | undefined; - - if (withDeploymentName) { - [id, deploymentName] = id.split('->'); - if (!deploymentName) deploymentName = id; - } - - if (disable) { - // Disable all models. - if (id === 'all') { - removeAll = true; - } - removedModels.push(id); - continue; - } - - // remove empty model name - if (!item.trim().length) { - continue; - } - - // Remove duplicate model entries. - const existingIndex = models.findIndex(({ id: n }) => n === id); - if (existingIndex !== -1) { - models.splice(existingIndex, 1); - } - - const model: ChatModelCard = { - displayName: displayName || undefined, - id, - }; - - if (deploymentName) { - model.deploymentName = deploymentName; - } - - if (capabilities.length > 0) { - const [maxTokenStr, ...capabilityList] = capabilities[0].replace('>', '').split(':'); - model.contextWindowTokens = parseInt(maxTokenStr, 10) || undefined; - - for (const capability of capabilityList) { - switch (capability) { - case 'reasoning': { - model.reasoning = true; - break; - } - case 'vision': { - model.vision = true; - break; - } - case 'fc': { - model.functionCall = true; - break; - } - case 'file': { - model.files = true; - break; - } - default: { - console.warn(`Unknown capability: ${capability}`); - } - } - } - } - - models.push(model); - } - - return { - add: models, - removeAll, - removed: removedModels, - }; -}; - -/** - * Extract a special method to process chatModels - */ -export const transformToChatModelCards = ({ - modelString = '', - defaultChatModels, - withDeploymentName = false, -}: { - defaultChatModels: ChatModelCard[]; - modelString?: string; - withDeploymentName?: boolean; -}): ChatModelCard[] | undefined => { - if (!modelString) return undefined; - - const modelConfig = parseModelString(modelString, withDeploymentName); - let chatModels = modelConfig.removeAll ? [] : defaultChatModels; - - // 处理移除逻辑 - if (!modelConfig.removeAll) { - chatModels = chatModels.filter((m) => !modelConfig.removed.includes(m.id)); - } - - return produce(chatModels, (draft) => { - // 处理添加或替换逻辑 - for (const toAddModel of modelConfig.add) { - // first try to find the model in LOBE_DEFAULT_MODEL_LIST to confirm if it is a known model - const knownModel = LOBE_DEFAULT_MODEL_LIST.find((model) => model.id === toAddModel.id); - - // if the model is known, update it based on the known model - if (knownModel) { - const index = draft.findIndex((model) => model.id === toAddModel.id); - const modelInList = draft[index]; - - // if the model is already in chatModels, update it - if (modelInList) { - draft[index] = { - ...modelInList, - ...toAddModel, - displayName: toAddModel.displayName || modelInList.displayName || modelInList.id, - enabled: true, - }; - } else { - // if the model is not in chatModels, add it - draft.push({ - ...knownModel, - ...toAddModel, - displayName: toAddModel.displayName || knownModel.displayName || knownModel.id, - enabled: true, - }); - } - } else { - // if the model is not in LOBE_DEFAULT_MODEL_LIST, add it as a new custom model - draft.push({ - ...toAddModel, - displayName: toAddModel.displayName || toAddModel.id, - enabled: true, - }); - } - } - }); -}; - -export const extractEnabledModels = (modelString: string = '', withDeploymentName = false) => { - const modelConfig = parseModelString(modelString, withDeploymentName); - const list = modelConfig.add.map((m) => m.id); - - if (list.length === 0) return; - - return list; -}; diff --git a/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx b/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx index af553f556211c..a45995817d3db 100644 --- a/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx +++ b/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx @@ -1,7 +1,6 @@ import { SignUp } from '@clerk/nextjs'; -import { notFound, redirect } from 'next/navigation'; +import { notFound } from 'next/navigation'; -import { serverFeatureFlags } from '@/config/featureFlags'; import { enableClerk } from '@/const/auth'; import { metadataModule } from '@/server/metadata'; import { translation } from '@/server/translation'; @@ -21,12 +20,6 @@ export const generateMetadata = async (props: DynamicLayoutProps) => { const Page = () => { if (!enableClerk) return notFound(); - const enableClerkSignUp = serverFeatureFlags().enableClerkSignUp; - - if (!enableClerkSignUp) { - redirect('/login'); - } - return ; }; diff --git a/src/app/[variants]/(main)/(mobile)/me/(home)/features/UserBanner.tsx b/src/app/[variants]/(main)/(mobile)/me/(home)/features/UserBanner.tsx index c46796af67c26..8286bde31b6fc 100644 --- a/src/app/[variants]/(main)/(mobile)/me/(home)/features/UserBanner.tsx +++ b/src/app/[variants]/(main)/(mobile)/me/(home)/features/UserBanner.tsx @@ -6,7 +6,6 @@ import { memo } from 'react'; import { Flexbox } from 'react-layout-kit'; import { enableAuth, enableNextAuth } from '@/const/auth'; -import { isDeprecatedEdition } from '@/const/version'; import DataStatistics from '@/features/User/DataStatistics'; import UserInfo from '@/features/User/UserInfo'; import UserLoginOrSignup from '@/features/User/UserLoginOrSignup/Community'; @@ -25,11 +24,9 @@ const UserBanner = memo(() => { - {!isDeprecatedEdition && ( - - - - )} + + + ) : ( >(
- {cover && {title}} + {cover && ( + {title} + )}
{title}
diff --git a/src/app/[variants]/(main)/settings/provider/detail/azure/index.tsx b/src/app/[variants]/(main)/settings/provider/detail/azure/index.tsx index 83a77aeb817cd..d72aaeb857752 100644 --- a/src/app/[variants]/(main)/settings/provider/detail/azure/index.tsx +++ b/src/app/[variants]/(main)/settings/provider/detail/azure/index.tsx @@ -7,9 +7,7 @@ import { useTranslation } from 'react-i18next'; import { FormInput, FormPassword } from '@/components/FormInput'; import { AzureProviderCard } from '@/config/modelProviders'; -import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra'; -import { useUserStore } from '@/store/user'; -import { modelProviderSelectors } from '@/store/user/selectors'; +import { aiModelSelectors, aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra'; import { KeyVaultsConfigKey, LLMProviderApiTokenKey, LLMProviderBaseUrlKey } from '../../const'; import { SkeletonInput } from '../../features/ProviderConfig'; @@ -35,11 +33,11 @@ const useProviderCard = (): ProviderItem => { const { styles } = useStyles(); // Get the first model card's deployment name as the check model - const checkModel = useUserStore((s) => { - const chatModelCards = modelProviderSelectors.getModelCardsById(providerKey)(s); + const checkModel = useAiInfraStore((s) => { + const modelList = aiModelSelectors.enabledAiProviderModelList(s); - if (chatModelCards.length > 0) { - return chatModelCards[0].deploymentName; + if (modelList.length > 0) { + return modelList[0].id; } return 'gpt-35-turbo'; diff --git a/src/components/InvalidAPIKey/APIKeyForm/Bedrock.tsx b/src/components/InvalidAPIKey/APIKeyForm/Bedrock.tsx index 3101fcf2fe64a..d242fd9d5a88f 100644 --- a/src/components/InvalidAPIKey/APIKeyForm/Bedrock.tsx +++ b/src/components/InvalidAPIKey/APIKeyForm/Bedrock.tsx @@ -7,21 +7,16 @@ import { memo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { FormAction } from '@/features/Conversation/Error/style'; -import { useUserStore } from '@/store/user'; -import { keyVaultsConfigSelectors } from '@/store/user/selectors'; +import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra'; const BedrockForm = memo<{ description: string }>(({ description }) => { const { t } = useTranslation('modelProvider'); const [showRegion, setShow] = useState(false); const [showSessionToken, setShowSessionToken] = useState(false); - const [accessKeyId, secretAccessKey, sessionToken, region, setConfig] = useUserStore((s) => [ - keyVaultsConfigSelectors.bedrockConfig(s).accessKeyId, - keyVaultsConfigSelectors.bedrockConfig(s).secretAccessKey, - keyVaultsConfigSelectors.bedrockConfig(s).sessionToken, - keyVaultsConfigSelectors.bedrockConfig(s).region, - s.updateKeyVaultConfig, - ]); + const config = useAiInfraStore(aiProviderSelectors.providerKeyVaults(ModelProvider.Bedrock)); + const setConfig = useAiInfraStore((s) => s.updateAiProviderConfig); + const { accessKeyId, secretAccessKey, sessionToken, region } = config || {}; const theme = useTheme(); return ( @@ -33,7 +28,7 @@ const BedrockForm = memo<{ description: string }>(({ description }) => { { - setConfig(ModelProvider.Bedrock, { accessKeyId: e.target.value }); + setConfig(ModelProvider.Bedrock, { keyVaults: { accessKeyId: e.target.value } }); }} placeholder={'Aws Access Key Id'} value={accessKeyId} @@ -42,7 +37,7 @@ const BedrockForm = memo<{ description: string }>(({ description }) => { { - setConfig(ModelProvider.Bedrock, { secretAccessKey: e.target.value }); + setConfig(ModelProvider.Bedrock, { keyVaults: { secretAccessKey: e.target.value } }); }} placeholder={'Aws Secret Access Key'} value={secretAccessKey} @@ -52,7 +47,7 @@ const BedrockForm = memo<{ description: string }>(({ description }) => { { - setConfig(ModelProvider.Bedrock, { sessionToken: e.target.value }); + setConfig(ModelProvider.Bedrock, { keyVaults: { sessionToken: e.target.value } }); }} placeholder={'Aws Session Token'} value={sessionToken} @@ -73,7 +68,7 @@ const BedrockForm = memo<{ description: string }>(({ description }) => { {showRegion ? (