diff --git a/web/app/components/app/chat/answer/index.tsx b/web/app/components/app/chat/answer/index.tsx index 3340fc6c648c59..09ed12502050e8 100644 --- a/web/app/components/app/chat/answer/index.tsx +++ b/web/app/components/app/chat/answer/index.tsx @@ -275,7 +275,7 @@ const Answer: FC = ({ className={cn(s.copyBtn, 'mr-1')} /> )} - {supportAnnotation && ( + {(supportAnnotation && !item.isOpeningStatement) && ( = ({ } }, onMessageEnd: (messageEnd) => { - // TODO if (messageEnd.metadata?.annotation_reply) { responseItem.id = messageEnd.id responseItem.annotation = ({ @@ -382,27 +381,6 @@ const Debug: FC = ({ onMessageReplace: (messageReplace) => { responseItem.content = messageReplace.answer }, - onAnnotationReply: (annotationReply) => { - // TODO: temp debug - responseItem.id = annotationReply.id - responseItem.content = annotationReply.answer - responseItem.annotation = ({ - id: annotationReply.annotation_id, - authorName: annotationReply.annotation_author_name, - } as AnnotationType) - const newListWithAnswer = produce( - getChatList().filter(item => item.id !== responseItem.id && item.id !== placeholderAnswerId), - (draft) => { - if (!draft.find(item => item.id === questionId)) - draft.push({ ...questionItem }) - - draft.push({ - ...responseItem, - id: annotationReply.id, - }) - }) - setChatList(newListWithAnswer) - }, onError() { setResponsingFalse() // role back placeholder answer diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index 7b219f992222de..4dc7059319730b 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -318,6 +318,7 @@ const Configuration: FC = () => { ...visionConfig, enabled: supportVision, }, true) + setCompletionParams({}) } const isShowVisionConfig = !!currModel?.features?.includes(ModelFeatureEnum.vision) @@ -656,7 +657,6 @@ const Configuration: FC = () => { onCompletionParamsChange={(newParams: FormValue) => { setCompletionParams(newParams) }} - disabled={!hasSettedApiKey} />
diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index a04940ca78dac2..52beb14590c205 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -587,7 +587,7 @@ const StepTwo = ({
- +
diff --git a/web/app/components/header/account-setting/model-provider-page/declarations.ts b/web/app/components/header/account-setting/model-provider-page/declarations.ts index aa7a0b2c1eeada..6bdded4d501ef2 100644 --- a/web/app/components/header/account-setting/model-provider-page/declarations.ts +++ b/web/app/components/header/account-setting/model-provider-page/declarations.ts @@ -61,16 +61,16 @@ export enum ModelStatusEnum { noPermission = 'no-permission', } -export const MODEL_STATUS_TEXT = { - [ModelStatusEnum.noConfigure]: { +export const MODEL_STATUS_TEXT: { [k: string]: TypeWithI18N } = { + 'no-configure': { en_US: 'No Configure', zh_Hans: '未配置凭据', }, - [ModelStatusEnum.quotaExceeded]: { + 'quota-exceeded': { en_US: 'Quota Exceeded', zh_Hans: '额度不足', }, - [ModelStatusEnum.noPermission]: { + 'no-permission': { en_US: 'No Permission', zh_Hans: '无使用权限', }, diff --git a/web/app/components/header/account-setting/model-provider-page/index.tsx b/web/app/components/header/account-setting/model-provider-page/index.tsx index c3dbb80b272e38..b67bb05b21e29b 100644 --- a/web/app/components/header/account-setting/model-provider-page/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/index.tsx @@ -4,11 +4,13 @@ import SystemModelSelector from './system-model-selector' import ProviderAddedCard, { UPDATE_MODEL_PROVIDER_CUSTOM_MODEL_LIST } from './provider-added-card' import ProviderCard from './provider-card' import type { - ConfigurateMethodEnum, CustomConfigrationModelFixedFields, ModelProvider, } from './declarations' -import { CustomConfigurationStatusEnum } from './declarations' +import { + ConfigurateMethodEnum, + CustomConfigurationStatusEnum, +} from './declarations' import { useDefaultModel, useUpdateModelProvidersAndModelList, @@ -57,7 +59,7 @@ const ModelProviderPage = () => { onSaveCallback: () => { updateModelProvidersAndModelList() - if (customConfigrationModelFixedFields && provider.custom_configuration.status === CustomConfigurationStatusEnum.active) { + if (configurateMethod === ConfigurateMethodEnum.customizableModel && provider.custom_configuration.status === CustomConfigurationStatusEnum.active) { eventEmitter?.emit({ type: UPDATE_MODEL_PROVIDER_CUSTOM_MODEL_LIST, payload: provider.provider, diff --git a/web/app/components/header/account-setting/model-provider-page/model-display/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-display/index.tsx new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx index 788d5d5d14b7b2..fe138743840aa6 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx @@ -21,6 +21,7 @@ type FormProps = { validating: boolean validatedSuccess?: boolean showOnVariableMap: Record + isEditMode: boolean } const Form: FC = ({ @@ -30,11 +31,15 @@ const Form: FC = ({ validating, validatedSuccess, showOnVariableMap, + isEditMode, }) => { const language = useLanguage() const [changeKey, setChangeKey] = useState('') const handleFormChange = (key: string, val: string) => { + if (isEditMode && (key === '__model_type' || key === '__model_name')) + return + setChangeKey(key) const shouldClearVariable: Record = {} if (showOnVariableMap[key]?.length) { @@ -58,6 +63,8 @@ const Form: FC = ({ if (show_on.length && !show_on.every(showOnItem => value[showOnItem.variable] === showOnItem.value)) return null + const disabed = isEditMode && (variable === '__model_type' || variable === '__model_name') + return (
@@ -69,10 +76,12 @@ const Form: FC = ({ }
handleFormChange(variable, val)} validated={validatedSuccess} placeholder={placeholder?.[language]} + disabled={disabed} /> {validating && changeKey === variable && }
@@ -91,6 +100,8 @@ const Form: FC = ({ if (show_on.length && !show_on.every(showOnItem => value[showOnItem.variable] === showOnItem.value)) return null + const disabed = isEditMode && (variable === '__model_type' || variable === '__model_name') + return (
@@ -113,6 +124,7 @@ const Form: FC = ({ className={` flex items-center px-3 py-2 rounded-lg border border-gray-100 bg-gray-25 cursor-pointer ${value[variable] === option.value && 'bg-white border-[1.5px] border-primary-400 shadow-sm'} + ${disabed && '!cursor-not-allowed opacity-60'} `} onClick={() => handleFormChange(variable, option.value)} key={`${variable}-${option.value}`} diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/Input.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/Input.tsx index 9fe8fd0b2eb6d1..a9d475471e4798 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-modal/Input.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-modal/Input.tsx @@ -7,6 +7,8 @@ type InputProps = { onFocus?: () => void placeholder?: string validated?: boolean + className?: string + disabled?: boolean } const Input: FC = ({ value, @@ -14,6 +16,8 @@ const Input: FC = ({ onFocus, placeholder, validated, + className, + disabled, }) => { return (
@@ -26,11 +30,13 @@ const Input: FC = ({ focus:bg-white focus:border-gray-300 focus:shadow-xs placeholder:text-sm placeholder:text-gray-400 ${validated && 'pr-[30px]'} + ${className} `} placeholder={placeholder || ''} onChange={e => onChange(e.target.value)} onFocus={onFocus} value={value || ''} + disabled={disabled} /> { validated && ( diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx index bd94df00044354..540a2b798ba719 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx @@ -239,6 +239,7 @@ const ModelModal: FC = ({ validating={validating} validatedSuccess={validatedStatusState.status === ValidatedStatus.Success} showOnVariableMap={showOnVariableMap} + isEditMode={isEditMode} />
{ @@ -313,7 +314,7 @@ const ModelModal: FC = ({ { showConfirm && ( setShowConfirm(false)} onConfirm={handleRemove} diff --git a/web/app/components/header/account-setting/model-provider-page/model-name/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-name/index.tsx index 72d45bc060c29c..87f34c08f29caa 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-name/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-name/index.tsx @@ -43,13 +43,13 @@ const ModelName: FC = ({ `} >
{modelItem.label[language]}
{ - showModelType && ( + showModelType && modelItem.model_type && ( {modelTypeFormat(modelItem.model_type)} diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx index 08ec2205acb4da..aed8a5b1ce980b 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx @@ -1,5 +1,5 @@ import type { FC } from 'react' -import { useEffect, useState } from 'react' +import { useEffect, useMemo, useState } from 'react' import useSWR from 'swr' import { useTranslation } from 'react-i18next' import type { @@ -7,10 +7,17 @@ import type { FormValue, ModelParameterRule, } from '../declarations' +import { + MODEL_STATUS_TEXT, + ModelStatusEnum, +} from '../declarations' import ModelIcon from '../model-icon' import ModelName from '../model-name' import ModelSelector from '../model-selector' -import { useTextGenerationCurrentProviderAndModelAndModelList } from '../hooks' +import { + useLanguage, + useTextGenerationCurrentProviderAndModelAndModelList, +} from '../hooks' import ParameterItem from './parameter-item' import type { ParameterValue } from './parameter-item' import { @@ -23,6 +30,8 @@ import { AlertTriangle } from '@/app/components/base/icons/src/vender/line/alert import { CubeOutline } from '@/app/components/base/icons/src/vender/line/shapes' import { fetchModelParameterRules } from '@/service/common' import Loading from '@/app/components/base/loading' +import { useProviderContext } from '@/context/provider-context' +import TooltipPlus from '@/app/components/base/tooltip-plus' type ModelParameterModalProps = { isAdvancedMode: boolean @@ -32,7 +41,6 @@ type ModelParameterModalProps = { setModel: (model: { modelId: string; provider: string; mode?: string; features: string[] }) => void completionParams: FormValue onCompletionParamsChange: (newParams: FormValue) => void - disabled: boolean } const stopParameerRule: ModelParameterRule = { default: [], @@ -42,7 +50,7 @@ const stopParameerRule: ModelParameterRule = { }, label: { en_US: 'Stop sequences', - zh_Hans: '停止序列 stop_sequences', + zh_Hans: '停止序列', }, name: 'stop', required: false, @@ -59,9 +67,10 @@ const ModelParameterModal: FC = ({ setModel, completionParams, onCompletionParamsChange, - disabled, }) => { const { t } = useTranslation() + const language = useLanguage() + const { hasSettedApiKey, modelProviders } = useProviderContext() const [open, setOpen] = useState(false) const { data: parameterRulesData, isLoading } = useSWR(`/workspaces/current/model-providers/${provider}/models/parameter-rules?model=${modelId}`, fetchModelParameterRules) const { @@ -72,7 +81,13 @@ const ModelParameterModal: FC = ({ { provider, model: modelId }, ) - const parameterRules = parameterRulesData?.data || [] + const hasDeprecated = !currentProvider || !currentModel + const modelDisabled = currentModel?.status !== ModelStatusEnum.active + const disabled = !hasSettedApiKey || hasDeprecated || modelDisabled + + const parameterRules = useMemo(() => { + return parameterRulesData?.data || [] + }, [parameterRulesData]) const handleParamChange = (key: string, value: ParameterValue) => { onCompletionParamsChange({ @@ -92,21 +107,6 @@ const ModelParameterModal: FC = ({ }) } - const handleChangeParams = () => { - const newCompletionParams = parameterRules.reduce((acc, parameter) => { - if (parameter.default !== undefined) - acc[parameter.name] = parameter.default - - return acc - }, {} as Record) - - onCompletionParamsChange(newCompletionParams) - } - - useEffect(() => { - handleChangeParams() - }, [parameterRules]) - const handleSwitch = (key: string, value: boolean, assignValue: ParameterValue) => { if (!value) { const newCompletionParams = { ...completionParams } @@ -122,6 +122,22 @@ const ModelParameterModal: FC = ({ } } + const handleInitialParams = () => { + if (parameterRules.length) { + const newCompletionParams = { ...completionParams } + Object.keys(newCompletionParams).forEach((key) => { + if (!parameterRules.find(item => item.name === key)) + delete newCompletionParams[key] + }) + + onCompletionParamsChange(newCompletionParams) + } + } + + useEffect(() => { + handleInitialParams() + }, [parameterRules]) + return ( = ({ /> ) } + { + !currentProvider && ( + item.provider === provider)} + modelName={modelId} + /> + ) + } { currentModel && ( ) } + { + !currentModel && ( +
+ {modelId} +
+ ) + } { disabled ? ( - + + + ) : ( @@ -178,7 +220,7 @@ const ModelParameterModal: FC = ({ {t('common.modelProvider.modelAndParameters')}
-
+
{t('common.modelProvider.model')} @@ -189,14 +231,18 @@ const ModelParameterModal: FC = ({ onSelect={handleChangeModel} />
-
+ { + !!parameterRules.length && ( +
+ ) + } { isLoading && ( - +
) } { - !isLoading && ( + !isLoading && !!parameterRules.length && ( [ ...parameterRules, ...(isAdvancedMode ? [stopParameerRule] : []), diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx index a641684ffde55d..14a991c33f5cd7 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx @@ -29,7 +29,37 @@ const ParameterItem: FC = ({ const language = useLanguage() const [localValue, setLocalValue] = useState(value) const mergedValue = isNullOrUndefined(value) ? localValue : value - const renderValue = mergedValue === undefined ? parameterRule.default : mergedValue + + const getDefaultValue = () => { + let defaultValue: ParameterValue + + if (parameterRule.type === 'int' || parameterRule.type === 'float') { + if (isNullOrUndefined(parameterRule.default)) { + if (parameterRule.min) + defaultValue = parameterRule.min + else + defaultValue = 0 + } + else { + defaultValue = parameterRule.default + } + } + + if (parameterRule.type === 'string' && !parameterRule.options?.length) + defaultValue = parameterRule.default || '' + + if (parameterRule.type === 'string' && parameterRule.options?.length) + defaultValue = parameterRule.default || '' + + if (parameterRule.type === 'boolean') + defaultValue = !isNullOrUndefined(parameterRule.default) ? parameterRule.default : false + + if (parameterRule.type === 'tag') + defaultValue = !isNullOrUndefined(parameterRule.default) ? parameterRule.default : [] + + return defaultValue + } + const renderValue = isNullOrUndefined(mergedValue) ? getDefaultValue() : mergedValue const handleChange = (v: ParameterValue) => { setLocalValue(v) @@ -73,22 +103,8 @@ const ParameterItem: FC = ({ if (onSwitch) { let assignValue: ParameterValue = localValue - if (isNullOrUndefined(localValue)) { - if (parameterRule.type === 'int' || parameterRule.type === 'float') - assignValue = !isNullOrUndefined(parameterRule.default) ? parameterRule.default : 0 - - if (parameterRule.type === 'string' && !parameterRule.options?.length) - assignValue = parameterRule.default || '' - - if (parameterRule.type === 'string' && parameterRule.options?.length) - assignValue = parameterRule.options[0] - - if (parameterRule.type === 'boolean') - assignValue = !isNullOrUndefined(parameterRule.default) ? parameterRule.default : false - - if (parameterRule.type === 'tag') - assignValue = !isNullOrUndefined(parameterRule.default) ? parameterRule.default : [] - } + if (isNullOrUndefined(localValue)) + assignValue = getDefaultValue() onSwitch(checked, assignValue) } @@ -145,7 +161,7 @@ const ParameterItem: FC = ({
= ({ max={parameterRule.max} min={parameterRule.min} step={+`0.${parameterRule.precision || 0}`} - value={isNullOrUndefined(renderValue) ? 0 : +renderValue!} + value={renderValue as string} onChange={handleNumberInputChange} />
@@ -167,7 +183,7 @@ const ParameterItem: FC = ({ parameterRule.type === 'boolean' && ( True @@ -180,7 +196,7 @@ const ParameterItem: FC = ({ ) @@ -189,13 +205,13 @@ const ParameterItem: FC = ({ parameterRule.type === 'string' && !parameterRule.options?.length && ( ) } { - parameterRule.type === 'string' && parameterRule?.options?.length && ( + parameterRule.type === 'string' && !!parameterRule?.options?.length && ( = ({ parameterRule.type === 'tag' && (
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/deprecated-model-trigger.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/deprecated-model-trigger.tsx new file mode 100644 index 00000000000000..4eb7c3ba0404f3 --- /dev/null +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/deprecated-model-trigger.tsx @@ -0,0 +1,46 @@ +import type { FC } from 'react' +import { useTranslation } from 'react-i18next' +import ModelIcon from '../model-icon' +import { AlertTriangle } from '@/app/components/base/icons/src/vender/line/alertsAndFeedback' +import { useProviderContext } from '@/context/provider-context' +import TooltipPlus from '@/app/components/base/tooltip-plus' + +type ModelTriggerProps = { + modelName: string + providerName: string + className?: string +} +const ModelTrigger: FC = ({ + modelName, + providerName, + className, +}) => { + const { t } = useTranslation() + const { modelProviders } = useProviderContext() + const currentProvider = modelProviders.find(provider => provider.provider === providerName) + + return ( +
+ +
+ {modelName} +
+
+ + + +
+
+ ) +} + +export default ModelTrigger diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/feature-icon.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/feature-icon.tsx index c64b8ca736c837..bf4d15ee3afc6f 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/feature-icon.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/feature-icon.tsx @@ -6,10 +6,10 @@ import { ModelFeatureTextEnum, } from '../declarations' import { - MagicBox, + // MagicBox, MagicEyes, - MagicWand, - Robot, + // MagicWand, + // Robot, } from '@/app/components/base/icons/src/vender/solid/mediaAndDevices' import TooltipPlus from '@/app/components/base/tooltip-plus' @@ -23,41 +23,41 @@ const FeatureIcon: FC = ({ }) => { const { t } = useTranslation() - if (feature === ModelFeatureEnum.agentThought) { - return ( - - - - - - ) - } + // if (feature === ModelFeatureEnum.agentThought) { + // return ( + // + // + // + // + // + // ) + // } - if (feature === ModelFeatureEnum.toolCall) { - return ( - - - - - - ) - } + // if (feature === ModelFeatureEnum.toolCall) { + // return ( + // + // + // + // + // + // ) + // } - if (feature === ModelFeatureEnum.multiToolCall) { - return ( - - - - - - ) - } + // if (feature === ModelFeatureEnum.multiToolCall) { + // return ( + // + // + // + // + // + // ) + // } if (feature === ModelFeatureEnum.vision) { return ( diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx index e6f1efeb54842a..26399639cfa99b 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx @@ -8,6 +8,7 @@ import type { import { useCurrentProviderAndModel } from '../hooks' import ModelTrigger from './model-trigger' import EmptyTrigger from './empty-trigger' +import DeprecatedModelTrigger from './deprecated-model-trigger' import Popup from './popup' import { PortalToFollowElem, @@ -77,7 +78,16 @@ const ModelSelector: FC = ({ ) } { - !currentModel && ( + !currentModel && defaultModel && ( + + ) + } + { + !defaultModel && ( = ({ model, className, }) => { + const language = useLanguage() + return (
= ({ showFeatures />
- + { + model.status !== ModelStatusEnum.active + ? ( + + + + ) + : ( + + ) + }
) diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx index 2a71859deb089b..a18c3292e7232f 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx @@ -102,7 +102,7 @@ const PopupItem: FC = ({ showFeatures /> { - defaultModel?.model === modelItem.model && ( + defaultModel?.model === modelItem.model && defaultModel.provider === currentProvider.provider && ( ) } diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/index.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/index.tsx index 9a689f6dcb64c7..e575448209b6a4 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/index.tsx @@ -21,6 +21,7 @@ import { ChevronDownDouble } from '@/app/components/base/icons/src/vender/line/a import { Loading02 } from '@/app/components/base/icons/src/vender/line/general' import { fetchModelProviderModelList } from '@/service/common' import { useEventEmitterContextContext } from '@/context/event-emitter' +import { IS_CE_EDITION } from '@/config' export const UPDATE_MODEL_PROVIDER_CUSTOM_MODEL_LIST = 'UPDATE_MODEL_PROVIDER_CUSTOM_MODEL_LIST' type ProviderAddedCardProps = { @@ -40,7 +41,7 @@ const ProviderAddedCard: FC = ({ const configurateMethods = provider.configurate_methods.filter(method => method !== ConfigurateMethodEnum.fetchFromRemote) const systemConfig = provider.system_configuration const hasModelList = fetched && !!modelList.length - const showQuota = systemConfig.enabled || ['minimax', 'spark', 'zhipuai', 'anthropic'].includes(provider.provider) + const showQuota = systemConfig.enabled && ['minimax', 'spark', 'zhipuai', 'anthropic', 'openai'].includes(provider.provider) && !IS_CE_EDITION const getModelList = async (providerName: string) => { if (loading) diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx index ad0994790cf7a4..e5c8a7aa6bd322 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx @@ -78,9 +78,9 @@ const ModelList: FC = ({ className={` group flex items-center pl-2 pr-2.5 h-8 rounded-lg ${canCustomConfig && 'hover:bg-gray-50'} + ${model.deprecated && 'opacity-60'} `} > -
= ({ const priorityUseType = provider.preferred_provider_type const systemConfig = provider.system_configuration const currentQuota = systemConfig.enabled && systemConfig.quota_configurations.find(item => item.quota_type === systemConfig.current_quota_type) + const openaiOrAnthropic = ['openai', 'anthropic'].includes(provider.provider) return (
{t('common.modelProvider.quota')} - + + +
{ currentQuota && ( diff --git a/web/app/components/header/account-setting/model-provider-page/provider-card/index.tsx b/web/app/components/header/account-setting/model-provider-page/provider-card/index.tsx index b99732c219027e..6c75ef47382291 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-card/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-card/index.tsx @@ -21,6 +21,7 @@ import s from './index.module.css' import { Plus, Settings01 } from '@/app/components/base/icons/src/vender/line/general' import { CoinsStacked01 } from '@/app/components/base/icons/src/vender/line/financeAndECommerce' import Button from '@/app/components/base/button' +import { IS_CE_EDITION } from '@/config' type ProviderCardProps = { provider: ModelProvider @@ -54,7 +55,7 @@ const ProviderCard: FC = ({ } const handleFreeQuota = useFreeQuota(handleFreeQuotaSuccess) const configurateMethods = provider.configurate_methods.filter(method => method !== ConfigurateMethodEnum.fetchFromRemote) - const canGetFreeQuota = ['mininmax', 'spark', 'zhipuai'].includes(provider.provider) + const canGetFreeQuota = ['mininmax', 'spark', 'zhipuai'].includes(provider.provider) && !IS_CE_EDITION return (
= ({ }) } { - provider.provider === 'anthropic' && ( + provider.provider === 'anthropic' && !IS_CE_EDITION && (