diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/chartView.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/chartView.tsx index bb1e4fd95b..00f1190045 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/chartView.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/chartView.tsx @@ -46,7 +46,7 @@ export default function ChartView({ appId }: IChartViewProps) { return (
-
+
{t('appOverview.analysis.title')} ({ value: k, name: t(`appLog.filter.period.${v.name}`) }))} diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/page.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/page.tsx index 137c2c36ee..47dd36eb81 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/page.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/page.tsx @@ -12,7 +12,7 @@ const Overview = async ({ params: { appId }, }: IDevelopProps) => { return ( -
+
diff --git a/web/app/components/app-sidebar/basic.tsx b/web/app/components/app-sidebar/basic.tsx index 51fc10721e..20777c7b6a 100644 --- a/web/app/components/app-sidebar/basic.tsx +++ b/web/app/components/app-sidebar/basic.tsx @@ -60,18 +60,18 @@ export default function AppBasic({ icon, icon_background, name, isExternal, type return (
{icon && icon_background && iconType === 'app' && ( -
+
)} {iconType !== 'app' - &&
+ &&
{ICON_MAP[iconType]}
} {mode === 'expand' &&
-
+
{name} {hoverTip && }
-
{type}
+
{type}
{isExternal ? t('dataset.externalTag') : ''}
}
diff --git a/web/app/components/app/overview/appChart.tsx b/web/app/components/app/overview/appChart.tsx index d1426caa27..6ae6253812 100644 --- a/web/app/components/app/overview/appChart.tsx +++ b/web/app/components/app/overview/appChart.tsx @@ -231,7 +231,7 @@ const Chart: React.FC = ({ const sumData = isAvg ? (sum(yData) / yData.length) : sum(yData) return ( -
+
@@ -242,11 +242,11 @@ const Chart: React.FC = ({ type={!CHART_TYPE_CONFIG[chartType].showTokens ? '' : {t('appOverview.analysis.tokenUsage.consumed')} Tokens - ( + ( ~{sum(statistics.map(item => Number.parseFloat(get(item, 'total_price', '0')))).toLocaleString('en-US', { style: 'currency', currency: 'USD', minimumFractionDigits: 4 })} - ) + ) } - textStyle={{ main: `!text-3xl !font-normal ${sumData === 0 ? '!text-gray-300' : ''}` }} /> + textStyle={{ main: `!text-3xl !font-normal ${sumData === 0 ? '!text-text-quaternary' : ''}` }} />
diff --git a/web/app/components/base/modal/index.tsx b/web/app/components/base/modal/index.tsx index 26cde5fce3..a659ccaac7 100644 --- a/web/app/components/base/modal/index.tsx +++ b/web/app/components/base/modal/index.tsx @@ -29,7 +29,7 @@ export default function Modal({ }: IModal) { return ( - + = ({ leaveTo="opacity-0" > - + {items.map((item: Item) => ( = ({ if (provider?.icon_small) { return ( -
model-icon = ({ 'flex items-center justify-center rounded-md border-[0.5px] border-components-panel-border-subtle bg-background-default-subtle', className, )}> -
- +
+
) 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 df6e69193e..d9cdb26431 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 @@ -91,7 +91,7 @@ const PopupItem: FC = ({ popupClassName='p-3 !w-[206px] bg-components-panel-bg-blur backdrop-blur-sm border-[0.5px] border-components-panel-border rounded-xl' popupContent={
-
+
= ({ ) }
-
{ +
{ onHide() setShowAccountSettingModal({ payload: 'provider' }) }}> diff --git a/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx b/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx index 46d1fafcc7..ec2bdc265f 100644 --- a/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx @@ -139,7 +139,7 @@ const SystemModel: FC = ({ {t('common.modelProvider.systemModelSettings')} - +
diff --git a/web/app/components/plugins/install-plugin/hooks/use-refresh-plugin-list.tsx b/web/app/components/plugins/install-plugin/hooks/use-refresh-plugin-list.tsx new file mode 100644 index 0000000000..6bcb8f0321 --- /dev/null +++ b/web/app/components/plugins/install-plugin/hooks/use-refresh-plugin-list.tsx @@ -0,0 +1,43 @@ +import { useUpdateModelProviders } from '@/app/components/header/account-setting/model-provider-page/hooks' +import { useProviderContext } from '@/context/provider-context' +import { useInvalidateInstalledPluginList } from '@/service/use-plugins' +import { useInvalidateAllBuiltInTools, useInvalidateAllToolProviders } from '@/service/use-tools' +import { useInvalidateStrategyProviders } from '@/service/use-strategy' +import type { Plugin, PluginManifestInMarket } from '../../types' +import { PluginType } from '../../types' + +const useRefreshPluginList = () => { + const invalidateInstalledPluginList = useInvalidateInstalledPluginList() + const updateModelProviders = useUpdateModelProviders() + const { refreshModelProviders } = useProviderContext() + + const invalidateAllToolProviders = useInvalidateAllToolProviders() + const invalidateAllBuiltInTools = useInvalidateAllBuiltInTools() + + const invalidateStrategyProviders = useInvalidateStrategyProviders() + return { + refreshPluginList: (manifest: PluginManifestInMarket | Plugin) => { + // installed list + invalidateInstalledPluginList() + + // tool page, tool select + if (PluginType.tool.includes(manifest.category)) { + invalidateAllToolProviders() + invalidateAllBuiltInTools() + // TODO: update suggested tools. It's a function in hook useMarketplacePlugins,handleUpdatePlugins + } + + // model select + if (PluginType.model.includes(manifest.category)) { + updateModelProviders() + refreshModelProviders() + } + + // agent select + if (PluginType.agent.includes(manifest.category)) + invalidateStrategyProviders() + }, + } +} + +export default useRefreshPluginList diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx index 046806ee08..7ac271b83f 100644 --- a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx @@ -3,13 +3,11 @@ import React, { useCallback, useState } from 'react' import Modal from '@/app/components/base/modal' import type { Dependency, Plugin, PluginManifestInMarket } from '../../types' -import { InstallStep, PluginType } from '../../types' +import { InstallStep } from '../../types' import Install from './steps/install' import Installed from '../base/installed' import { useTranslation } from 'react-i18next' -import { useUpdateModelProviders } from '@/app/components/header/account-setting/model-provider-page/hooks' -import { useInvalidateInstalledPluginList } from '@/service/use-plugins' -import { useInvalidateAllToolProviders } from '@/service/use-tools' +import useRefreshPluginList from '../hooks/use-refresh-plugin-list' import ReadyToInstallBundle from '../install-bundle/ready-to-install' const i18nPrefix = 'plugin.installModal' @@ -35,9 +33,7 @@ const InstallFromMarketplace: React.FC = ({ // readyToInstall -> check installed -> installed/failed const [step, setStep] = useState(InstallStep.readyToInstall) const [errorMsg, setErrorMsg] = useState(null) - const updateModelProviders = useUpdateModelProviders() - const invalidateAllToolProviders = useInvalidateAllToolProviders() - const invalidateInstalledPluginList = useInvalidateInstalledPluginList() + const { refreshPluginList } = useRefreshPluginList() const getTitle = useCallback(() => { if (isBundle && step === InstallStep.installed) @@ -51,12 +47,8 @@ const InstallFromMarketplace: React.FC = ({ const handleInstalled = useCallback(() => { setStep(InstallStep.installed) - invalidateInstalledPluginList() - if (PluginType.model.includes(manifest.category)) - updateModelProviders() - if (PluginType.tool.includes(manifest.category)) - invalidateAllToolProviders() - }, [invalidateAllToolProviders, invalidateInstalledPluginList, manifest, updateModelProviders]) + refreshPluginList(manifest) + }, [manifest, refreshPluginList]) const handleFailed = useCallback((errorMsg?: string) => { setStep(InstallStep.installFailed)