Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -25,11 +24,9 @@ const UserBanner = memo(() => {
<Link href={'/profile'} style={{ color: 'inherit' }}>
<UserInfo />
</Link>
{!isDeprecatedEdition && (
<Link href={'/profile/stats'} style={{ color: 'inherit' }}>
<DataStatistics paddingInline={12} />
</Link>
)}
<Link href={'/profile/stats'} style={{ color: 'inherit' }}>
<DataStatistics paddingInline={12} />
</Link>
</>
) : (
<UserLoginOrSignup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down
21 changes: 8 additions & 13 deletions src/components/InvalidAPIKey/APIKeyForm/Bedrock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -33,7 +28,7 @@ const BedrockForm = memo<{ description: string }>(({ description }) => {
<InputPassword
autoComplete={'new-password'}
onChange={(e) => {
setConfig(ModelProvider.Bedrock, { accessKeyId: e.target.value });
setConfig(ModelProvider.Bedrock, { keyVaults: { accessKeyId: e.target.value } });
}}
placeholder={'Aws Access Key Id'}
value={accessKeyId}
Expand All @@ -42,7 +37,7 @@ const BedrockForm = memo<{ description: string }>(({ description }) => {
<InputPassword
autoComplete={'new-password'}
onChange={(e) => {
setConfig(ModelProvider.Bedrock, { secretAccessKey: e.target.value });
setConfig(ModelProvider.Bedrock, { keyVaults: { secretAccessKey: e.target.value } });
}}
placeholder={'Aws Secret Access Key'}
value={secretAccessKey}
Expand All @@ -52,7 +47,7 @@ const BedrockForm = memo<{ description: string }>(({ description }) => {
<InputPassword
autoComplete={'new-password'}
onChange={(e) => {
setConfig(ModelProvider.Bedrock, { sessionToken: e.target.value });
setConfig(ModelProvider.Bedrock, { keyVaults: { sessionToken: e.target.value } });
}}
placeholder={'Aws Session Token'}
value={sessionToken}
Expand All @@ -73,7 +68,7 @@ const BedrockForm = memo<{ description: string }>(({ description }) => {
{showRegion ? (
<Select
onChange={(region) => {
setConfig('bedrock', { region });
setConfig('bedrock', { keyVaults: { region } });
}}
Comment on lines 68 to 72

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve existing Bedrock credentials when updating single field

Each Bedrock input calls updateAiProviderConfig with a keyVaults object containing only the changed property (accessKeyId, secretAccessKey, sessionToken, or region). The backend’s AiProviderModel.updateConfig replaces the entire stored keyVaults with the provided value rather than merging it, so typing in one field wipes any previously entered credentials. A user who enters access key and then secret key will end up persisting only the latter, making it impossible to save a complete Bedrock configuration. Consider reading the current vault values and sending a merged object (similar to useApiKey) before calling the update function.

Useful? React with 👍 / 👎.

options={['us-east-1', 'us-west-2', 'ap-southeast-1', 'eu-central-1'].map((i) => ({
label: i,
Expand Down
17 changes: 1 addition & 16 deletions src/config/modelProviders/ai21.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,7 @@ import { ModelProviderCard } from '@/types/llm';

// ref https://docs.ai21.com/reference/jamba-15-api-ref
const Ai21: ModelProviderCard = {
chatModels: [
{
contextWindowTokens: 256_000,
displayName: 'Jamba 1.5 Mini',
enabled: true,
functionCall: true,
id: 'jamba-1.5-mini',
},
{
contextWindowTokens: 256_000,
displayName: 'Jamba 1.5 Large',
enabled: true,
functionCall: true,
id: 'jamba-1.5-large',
},
],
chatModels: [],
checkModel: 'jamba-mini',
description: 'AI21 Labs 为企业构建基础模型和人工智能系统,加速生成性人工智能在生产中的应用。',
id: 'ai21',
Expand Down
129 changes: 1 addition & 128 deletions src/config/modelProviders/ai302.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,134 +3,7 @@ import { ModelProviderCard } from '@/types/llm';
// ref: https://302.ai/pricing/
const Ai302: ModelProviderCard = {
apiKeyUrl: 'https://lobe.li/Oizw5sN',
chatModels: [
{
contextWindowTokens: 32_000,
displayName: 'deepseek-chat',
enabled: true,
id: 'deepseek-chat',
},
{
contextWindowTokens: 128_000,
displayName: 'gpt-4o',
enabled: true,
id: 'gpt-4o',
},
{
contextWindowTokens: 128_000,
displayName: 'chatgpt-4o-latest',
enabled: true,
id: 'chatgpt-4o-latest',
},
{
contextWindowTokens: 128_000,
displayName: 'llama3.3-70b',
enabled: true,
id: 'llama3.3-70b',
},
{
contextWindowTokens: 64_000,
displayName: 'deepseek-reasoner',
enabled: true,
id: 'deepseek-reasoner',
},
{
contextWindowTokens: 1_000_000,
displayName: 'gemini-2.0-flash',
enabled: true,
id: 'gemini-2.0-flash',
},
{
contextWindowTokens: 200_000,
displayName: 'claude-3-7-sonnet-20250219',
enabled: true,
id: 'claude-3-7-sonnet-20250219',
},
{
contextWindowTokens: 200_000,
displayName: 'claude-3-7-sonnet-latest',
enabled: true,
id: 'claude-3-7-sonnet-latest',
},
{
contextWindowTokens: 131_072,
displayName: 'grok-3-beta',
enabled: true,
id: 'grok-3-beta',
},
{
contextWindowTokens: 131_072,
displayName: 'grok-3-mini-beta',
enabled: true,
id: 'grok-3-mini-beta',
},
{
contextWindowTokens: 1_000_000,
displayName: 'gpt-4.1',
enabled: true,
id: 'gpt-4.1',
},
{
contextWindowTokens: 200_000,
displayName: 'o3',
enabled: true,
id: 'o3',
},
{
contextWindowTokens: 200_000,
displayName: 'o4-mini',
enabled: true,
id: 'o4-mini',
},
{
contextWindowTokens: 128_000,
displayName: 'qwen3-235b-a22b',
enabled: true,
id: 'qwen3-235b-a22b',
},
{
contextWindowTokens: 128_000,
displayName: 'qwen3-32b',
enabled: true,
id: 'qwen3-32b',
},
{
contextWindowTokens: 1_000_000,
displayName: 'gemini-2.5-pro-preview-05-06',
enabled: true,
id: 'gemini-2.5-pro-preview-05-06',
},
{
contextWindowTokens: 128_000,
displayName: 'llama-4-maverick',
enabled: true,
id: 'llama-4-maverick',
},
{
contextWindowTokens: 1_000_000,
displayName: 'gemini-2.5-flash',
enabled: true,
id: 'gemini-2.5-flash',
},
{
contextWindowTokens: 200_000,
displayName: 'claude-sonnet-4-20250514',
enabled: true,
id: 'claude-sonnet-4-20250514',
},
{
contextWindowTokens: 200_000,
displayName: 'claude-opus-4-20250514',
enabled: true,
id: 'claude-opus-4-20250514',
},
{
contextWindowTokens: 1_000_000,
displayName: 'gemini-2.5-pro',
enabled: true,
id: 'gemini-2.5-pro',
},
],
chatModels: [],
checkModel: 'gpt-4o',
description: '302.AI 是一个按需付费的 AI 应用平台,提供市面上最全的 AI API 和 AI 在线应用',
id: 'ai302',
Expand Down
33 changes: 1 addition & 32 deletions src/config/modelProviders/ai360.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,7 @@ import { ModelProviderCard } from '@/types/llm';

// ref: https://ai.360.cn/platform/docs/overview
const Ai360: ModelProviderCard = {
chatModels: [
{
contextWindowTokens: 8000,
description:
'360gpt2-o1 使用树搜索构建思维链,并引入了反思机制,使用强化学习训练,模型具备自我反思与纠错的能力。',
displayName: '360GPT2 o1',
enabled: true,
id: '360gpt2-o1',
},
{
contextWindowTokens: 8000,
description: '360智脑系列效果最好的主力千亿级大模型,广泛适用于各领域复杂任务场景。',
displayName: '360GPT2 Pro',
enabled: true,
id: '360gpt2-pro',
},
{
contextWindowTokens: 8000,
description: '360智脑系列效果最好的主力千亿级大模型,广泛适用于各领域复杂任务场景。',
displayName: '360GPT Pro',
enabled: true,
functionCall: true,
id: '360gpt-pro',
},
{
contextWindowTokens: 7000,
description: '兼顾性能和效果的百亿级大模型,适合对性能/成本要求较高 的场景。',
displayName: '360GPT Turbo',
enabled: true,
id: '360gpt-turbo',
},
],
chatModels: [],
checkModel: '360gpt-turbo',
description:
'360 AI 是 360 公司推出的 AI 模型和服务平台,提供多种先进的自然语言处理模型,包括 360GPT2 Pro、360GPT Pro、360GPT Turbo 和 360GPT Turbo Responsibility 8K。这些模型结合了大规模参数和多模态能力,广泛应用于文本生成、语义理解、对话系统与代码生成等领域。通过灵活的定价策略,360 AI 满足多样化用户需求,支持开发者集成,推动智能化应用的革新和发展。',
Expand Down
72 changes: 1 addition & 71 deletions src/config/modelProviders/anthropic.ts
Original file line number Diff line number Diff line change
@@ -1,77 +1,7 @@
import { ModelProviderCard } from '@/types/llm';

const Anthropic: ModelProviderCard = {
chatModels: [
{
contextWindowTokens: 200_000,
description:
'Claude 4 Opus 是 Anthropic 最强大的下一代模型,具有卓越的推理能力和创造力,适用于最复杂的任务和高级分析。',
displayName: 'Claude 4 Opus',
enabled: true,
functionCall: true,
id: 'claude-opus-4-20250514',
maxOutput: 32_000,
releasedAt: '2025-05-14',
vision: true,
},
{
contextWindowTokens: 200_000,
description:
'Claude 4 Sonnet 提供了优异的性能和速度平衡,是新一代模型中的理想选择,适用于广泛的企业和创意任务。',
displayName: 'Claude 4 Sonnet',
enabled: true,
functionCall: true,
id: 'claude-sonnet-4-20250514',
maxOutput: 64_000,
releasedAt: '2025-05-14',
vision: true,
},
{
contextWindowTokens: 200_000,
description:
'Claude 3.7 sonnet 是 Anthropic 最快的下一代模型。与 Claude 3 Haiku 相比,Claude 3.7 Sonnet 在各项技能上都有所提升,并在许多智力基准测试中超越了上一代最大的模型 Claude 3 Opus。',
displayName: 'Claude 3.7 Sonnet',
enabled: true,
functionCall: true,
id: 'claude-3-7-sonnet-20250219',
maxOutput: 64_000,
releasedAt: '2025-02-24',
},
{
contextWindowTokens: 200_000,
description:
'Claude 3.5 Haiku 是 Anthropic 最快的下一代模型。与 Claude 3 Haiku 相比,Claude 3.5 Haiku 在各项技能上都有所提升,并在许多智力基准测试中超越了上一代最大的模型 Claude 3 Opus。',
displayName: 'Claude 3.5 Haiku',
enabled: true,
functionCall: true,
id: 'claude-3-5-haiku-20241022',
maxOutput: 8192,
releasedAt: '2024-11-05',
},
{
contextWindowTokens: 200_000,
description:
'Claude 3 Haiku 是 Anthropic 的最快且最紧凑的模型,旨在实现近乎即时的响应。它具有快速且准确的定向性能。',
displayName: 'Claude 3 Haiku',
functionCall: true,
id: 'claude-3-haiku-20240307',
maxOutput: 4096,
releasedAt: '2024-03-07',
vision: true,
},
{
contextWindowTokens: 200_000,
description:
'Claude 3 Opus 是 Anthropic 用于处理高度复杂任务的最强大模型。它在性能、智能、流畅性和理解力方面表现卓越。',
displayName: 'Claude 3 Opus',
enabled: true,
functionCall: true,
id: 'claude-3-opus-20240229',
maxOutput: 4096,
releasedAt: '2024-02-29',
vision: true,
},
],
chatModels: [],
checkModel: 'claude-3-haiku-20240307',
description:
'Anthropic 是一家专注于人工智能研究和开发的公司,提供了一系列先进的语言模型,如 Claude 3.5 Sonnet、Claude 3 Sonnet、Claude 3 Opus 和 Claude 3 Haiku。这些模型在智能、速度和成本之间取得了理想的平衡,适用于从企业级工作负载到快速响应的各种应用场景。Claude 3.5 Sonnet 作为其最新模型,在多项评估中表现优异,同时保持了较高的性价比。',
Expand Down
Loading
Loading